Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4c8c0fdc5e
|
|
@ -0,0 +1,66 @@
|
|||
package com.bonus.canteen.core.allocation.alloc.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.canteen.core.allocation.alloc.dto.BasicsCardDTO;
|
||||
import com.bonus.canteen.core.allocation.alloc.model.BasicsCard;
|
||||
import com.bonus.canteen.core.allocation.alloc.service.BasicsCardService;
|
||||
import com.bonus.canteen.core.common.base.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.houqin.utils.LeBeanUtil;
|
||||
import com.google.gson.Gson;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@Api(
|
||||
value = "卡片基础信息",
|
||||
tags = {"卡片基础信息模块"}
|
||||
)
|
||||
@RequestMapping({"/api/v1/basecard"})
|
||||
public class BasicsCardController extends BaseController {
|
||||
@Autowired
|
||||
@Lazy
|
||||
private BasicsCardService basicsCardService;
|
||||
|
||||
@ApiOperation(
|
||||
value = "查询卡片的基础设置信息",
|
||||
notes = "查询条件商家id这里自带"
|
||||
)
|
||||
@PostMapping({"/getBaseInfo"})
|
||||
// @RequiresAuthentication
|
||||
public BasicsCard getBaseInfo(@RequestBody String request) {
|
||||
Gson var10001 = this.gson;
|
||||
this.logger.info("[卡片基础信息]查询卡片基础信息==" + var10001.toJson(request));
|
||||
return this.basicsCardService.getCardBaseInfo();
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "更新卡片的基础设置信息",
|
||||
notes = "查询条件商家id这里pigx自带"
|
||||
)
|
||||
@PostMapping({"/insertUpBaseInfo"})
|
||||
// @RequiresAuthentication
|
||||
public void insertUpBaseInfo(@RequestBody @Valid BasicsCardDTO basicsCardDto) {
|
||||
Gson var10001 = this.gson;
|
||||
this.logger.info("[卡片基础信息]查询卡片基础信息==" + var10001.toJson(basicsCardDto));
|
||||
BasicsCard basicsCard = new BasicsCard();
|
||||
LeBeanUtil.copyProperties(basicsCardDto, basicsCard);
|
||||
this.basicsCardService.insertUpBaseInfo(basicsCard);
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "更新卡片类型和是否校验扇区",
|
||||
notes = "查询条件商家id这里pigx自带"
|
||||
)
|
||||
@PostMapping({"/changeBaseInfo"})
|
||||
// @RequiresAuthentication
|
||||
public AjaxResult changeBaseInfo(@RequestBody @Valid BasicsCard basicsCard) {
|
||||
this.logger.info("[卡片基础信息]查询卡片基础信息==" + JSONObject.toJSONString(basicsCard));
|
||||
return this.basicsCardService.changeBaseInfo(basicsCard);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,281 @@
|
|||
package com.bonus.canteen.core.allocation.alloc.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@TableName("basics_card")
|
||||
@ApiModel("卡基础验证表")
|
||||
public class BasicsCardDTO extends Model<BasicsCardDTO> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
@ApiModelProperty("国家编号")
|
||||
private int cardCountry;
|
||||
@ApiModelProperty("菜品名称拼音首字母")
|
||||
private int cardProvin;
|
||||
@ApiModelProperty("城市编码")
|
||||
private int cardCity;
|
||||
@ApiModelProperty("县编码")
|
||||
private int cardCounty;
|
||||
@ApiModelProperty("集成商")
|
||||
private int cardIntegr;
|
||||
@ApiModelProperty("客户编码")
|
||||
private int cardCustomer;
|
||||
@ApiModelProperty("卡片算法")
|
||||
private int cardAlgorithm;
|
||||
@ApiModelProperty("扇区1")
|
||||
private int cardSector1;
|
||||
@ApiModelProperty("扇区2")
|
||||
private int cardSector2;
|
||||
@ApiModelProperty("扇区3")
|
||||
private int cardSector3;
|
||||
@ApiModelProperty("扇区4")
|
||||
private int cardSector4;
|
||||
@ApiModelProperty("扇区5")
|
||||
private int cardSector5;
|
||||
@ApiModelProperty("水控扇区6")
|
||||
private String cardSector6;
|
||||
@ApiModelProperty("水控扇区7")
|
||||
private String cardSector7;
|
||||
@ApiModelProperty("水控扇区8")
|
||||
private int cardSector8;
|
||||
@ApiModelProperty("水控扇区9")
|
||||
private int cardSector9;
|
||||
@ApiModelProperty("水控扇区10")
|
||||
private int cardSector10;
|
||||
@ApiModelProperty("水控扇区11")
|
||||
private int cardSector11;
|
||||
@ApiModelProperty("卡片类型")
|
||||
private int cardType;
|
||||
@ApiModelProperty("是否校验扇区")
|
||||
private int checkSector;
|
||||
@ApiModelProperty("乐观锁")
|
||||
private Integer revision;
|
||||
@ApiModelProperty("创建人")
|
||||
private String crby;
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime crtime;
|
||||
@ApiModelProperty("更新人")
|
||||
private String upby;
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime uptime;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public int getCardCountry() {
|
||||
return this.cardCountry;
|
||||
}
|
||||
|
||||
public int getCardProvin() {
|
||||
return this.cardProvin;
|
||||
}
|
||||
|
||||
public int getCardCity() {
|
||||
return this.cardCity;
|
||||
}
|
||||
|
||||
public int getCardCounty() {
|
||||
return this.cardCounty;
|
||||
}
|
||||
|
||||
public int getCardIntegr() {
|
||||
return this.cardIntegr;
|
||||
}
|
||||
|
||||
public int getCardCustomer() {
|
||||
return this.cardCustomer;
|
||||
}
|
||||
|
||||
public int getCardAlgorithm() {
|
||||
return this.cardAlgorithm;
|
||||
}
|
||||
|
||||
public int getCardSector1() {
|
||||
return this.cardSector1;
|
||||
}
|
||||
|
||||
public int getCardSector2() {
|
||||
return this.cardSector2;
|
||||
}
|
||||
|
||||
public int getCardSector3() {
|
||||
return this.cardSector3;
|
||||
}
|
||||
|
||||
public int getCardSector4() {
|
||||
return this.cardSector4;
|
||||
}
|
||||
|
||||
public int getCardSector5() {
|
||||
return this.cardSector5;
|
||||
}
|
||||
|
||||
public String getCardSector6() {
|
||||
return this.cardSector6;
|
||||
}
|
||||
|
||||
public String getCardSector7() {
|
||||
return this.cardSector7;
|
||||
}
|
||||
|
||||
public int getCardSector8() {
|
||||
return this.cardSector8;
|
||||
}
|
||||
|
||||
public int getCardSector9() {
|
||||
return this.cardSector9;
|
||||
}
|
||||
|
||||
public int getCardSector10() {
|
||||
return this.cardSector10;
|
||||
}
|
||||
|
||||
public int getCardSector11() {
|
||||
return this.cardSector11;
|
||||
}
|
||||
|
||||
public int getCardType() {
|
||||
return this.cardType;
|
||||
}
|
||||
|
||||
public int getCheckSector() {
|
||||
return this.checkSector;
|
||||
}
|
||||
|
||||
public Integer getRevision() {
|
||||
return this.revision;
|
||||
}
|
||||
|
||||
public String getCrby() {
|
||||
return this.crby;
|
||||
}
|
||||
|
||||
public LocalDateTime getCrtime() {
|
||||
return this.crtime;
|
||||
}
|
||||
|
||||
public String getUpby() {
|
||||
return this.upby;
|
||||
}
|
||||
|
||||
public LocalDateTime getUptime() {
|
||||
return this.uptime;
|
||||
}
|
||||
|
||||
public void setId(final Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setCardCountry(final int cardCountry) {
|
||||
this.cardCountry = cardCountry;
|
||||
}
|
||||
|
||||
public void setCardProvin(final int cardProvin) {
|
||||
this.cardProvin = cardProvin;
|
||||
}
|
||||
|
||||
public void setCardCity(final int cardCity) {
|
||||
this.cardCity = cardCity;
|
||||
}
|
||||
|
||||
public void setCardCounty(final int cardCounty) {
|
||||
this.cardCounty = cardCounty;
|
||||
}
|
||||
|
||||
public void setCardIntegr(final int cardIntegr) {
|
||||
this.cardIntegr = cardIntegr;
|
||||
}
|
||||
|
||||
public void setCardCustomer(final int cardCustomer) {
|
||||
this.cardCustomer = cardCustomer;
|
||||
}
|
||||
|
||||
public void setCardAlgorithm(final int cardAlgorithm) {
|
||||
this.cardAlgorithm = cardAlgorithm;
|
||||
}
|
||||
|
||||
public void setCardSector1(final int cardSector1) {
|
||||
this.cardSector1 = cardSector1;
|
||||
}
|
||||
|
||||
public void setCardSector2(final int cardSector2) {
|
||||
this.cardSector2 = cardSector2;
|
||||
}
|
||||
|
||||
public void setCardSector3(final int cardSector3) {
|
||||
this.cardSector3 = cardSector3;
|
||||
}
|
||||
|
||||
public void setCardSector4(final int cardSector4) {
|
||||
this.cardSector4 = cardSector4;
|
||||
}
|
||||
|
||||
public void setCardSector5(final int cardSector5) {
|
||||
this.cardSector5 = cardSector5;
|
||||
}
|
||||
|
||||
public void setCardSector6(final String cardSector6) {
|
||||
this.cardSector6 = cardSector6;
|
||||
}
|
||||
|
||||
public void setCardSector7(final String cardSector7) {
|
||||
this.cardSector7 = cardSector7;
|
||||
}
|
||||
|
||||
public void setCardSector8(final int cardSector8) {
|
||||
this.cardSector8 = cardSector8;
|
||||
}
|
||||
|
||||
public void setCardSector9(final int cardSector9) {
|
||||
this.cardSector9 = cardSector9;
|
||||
}
|
||||
|
||||
public void setCardSector10(final int cardSector10) {
|
||||
this.cardSector10 = cardSector10;
|
||||
}
|
||||
|
||||
public void setCardSector11(final int cardSector11) {
|
||||
this.cardSector11 = cardSector11;
|
||||
}
|
||||
|
||||
public void setCardType(final int cardType) {
|
||||
this.cardType = cardType;
|
||||
}
|
||||
|
||||
public void setCheckSector(final int checkSector) {
|
||||
this.checkSector = checkSector;
|
||||
}
|
||||
|
||||
public void setRevision(final Integer revision) {
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public void setCrby(final String crby) {
|
||||
this.crby = crby;
|
||||
}
|
||||
|
||||
public void setCrtime(final LocalDateTime crtime) {
|
||||
this.crtime = crtime;
|
||||
}
|
||||
|
||||
public void setUpby(final String upby) {
|
||||
this.upby = upby;
|
||||
}
|
||||
|
||||
public void setUptime(final LocalDateTime uptime) {
|
||||
this.uptime = uptime;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Long var10000 = this.getId();
|
||||
return "BasicsCardDTO(id=" + var10000 + ", cardCountry=" + this.getCardCountry() + ", cardProvin=" + this.getCardProvin() + ", cardCity=" + this.getCardCity() + ", cardCounty=" + this.getCardCounty() + ", cardIntegr=" + this.getCardIntegr() + ", cardCustomer=" + this.getCardCustomer() + ", cardAlgorithm=" + this.getCardAlgorithm() + ", cardSector1=" + this.getCardSector1() + ", cardSector2=" + this.getCardSector2() + ", cardSector3=" + this.getCardSector3() + ", cardSector4=" + this.getCardSector4() + ", cardSector5=" + this.getCardSector5() + ", cardSector6=" + this.getCardSector6() + ", cardSector7=" + this.getCardSector7() + ", cardSector8=" + this.getCardSector8() + ", cardSector9=" + this.getCardSector9() + ", cardSector10=" + this.getCardSector10() + ", cardSector11=" + this.getCardSector11() + ", cardType=" + this.getCardType() + ", checkSector=" + this.getCheckSector() + ", revision=" + this.getRevision() + ", crby=" + this.getCrby() + ", crtime=" + String.valueOf(this.getCrtime()) + ", upby=" + this.getUpby() + ", uptime=" + String.valueOf(this.getUptime()) + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -73,13 +73,13 @@ public class DeviceOrderController {
|
|||
return AjaxResult.success(pageVO);
|
||||
}
|
||||
|
||||
// @PostMapping({"/detail"})
|
||||
// //@RequiresGuest
|
||||
// @ApiOperation("通用订单详情查询")
|
||||
// public LeResponse<OrderInfoAndroidVO> detail(@RequestHeader Map<String, String> headers, @RequestBody LeRequest<OrderInfoAndroidQueryDTO> request) {
|
||||
// OrderInfoAndroidVO orderInfoAndroidVO = this.orderDeviceApi.queryInfo((OrderInfoAndroidQueryDTO)request.getContent());
|
||||
// return LeResponse.succ(orderInfoAndroidVO);
|
||||
// }
|
||||
@PostMapping({"/detail"})
|
||||
//@RequiresGuest
|
||||
@ApiOperation("通用订单详情查询")
|
||||
public AjaxResult detail(@RequestHeader Map<String, String> headers, @RequestBody OrderInfoAndroidQueryDTO request) {
|
||||
OrderInfoAndroidVO orderInfoAndroidVO = this.orderDeviceApi.queryInfo(request);
|
||||
return AjaxResult.success(orderInfoAndroidVO);
|
||||
}
|
||||
//
|
||||
// @PostMapping({"/page-call"})
|
||||
// //@RequiresGuest
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.canteen.core.device.android.common.controller;
|
||||
|
||||
import com.bonus.canteen.core.common.page.PageVO;
|
||||
import com.bonus.canteen.core.report.api.ReportOrderApi;
|
||||
import com.bonus.canteen.core.report.api.dto.DeviceOrderDishesSumQueryDTO;
|
||||
import com.bonus.canteen.core.report.api.dto.ReportOrderSumQueryDTO;
|
||||
import com.bonus.canteen.core.report.api.vo.DeviceOrderDishesSumVO;
|
||||
import com.bonus.canteen.core.report.api.vo.ReportDeviceOrderSumVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Api(
|
||||
tags = {"设备基础接口(报表)"}
|
||||
)
|
||||
@RequestMapping({"/api/v4/device/common/report/"})
|
||||
public class DeviceReportController {
|
||||
private static final Logger log = LoggerFactory.getLogger(DeviceReportController.class);
|
||||
@Autowired
|
||||
@Lazy
|
||||
protected ReportOrderApi reportOrderApi;
|
||||
|
||||
@PostMapping({"/order-stat"})
|
||||
//@RequiresGuest
|
||||
@ApiOperation("通用订单统计")
|
||||
public ReportDeviceOrderSumVO orderStat(@RequestBody ReportOrderSumQueryDTO request) {
|
||||
return this.reportOrderApi.reportDeviceOrderSum(request);
|
||||
}
|
||||
|
||||
@PostMapping({"/order-goods-stat"})
|
||||
//@RequiresGuest
|
||||
@ApiOperation("通用订单商品统计")
|
||||
public PageVO<DeviceOrderDishesSumVO> orderGoodsStat(@RequestBody DeviceOrderDishesSumQueryDTO request) {
|
||||
return this.reportOrderApi.reportOrderDishesSum(request);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.canteen.core.device.manage.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class DeviceSendLogMqDTO {
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
@ApiModelProperty("设备商户")
|
||||
private Long merchantId;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Long getMerchantId() {
|
||||
return this.merchantId;
|
||||
}
|
||||
|
||||
public DeviceSendLogMqDTO setId(final Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceSendLogMqDTO setMerchantId(final Long merchantId) {
|
||||
this.merchantId = merchantId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Long var10000 = this.getId();
|
||||
return "DeviceSendLogMqDTO(id=" + var10000 + ", merchantId=" + this.getMerchantId() + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bonus.canteen.core.device.manage.dto.devicelocker;
|
||||
|
||||
public class DeviceLockerOrderNoticeDTO {
|
||||
private Long ordId;
|
||||
private Long deviceId;
|
||||
private Integer clean;
|
||||
private Integer times;
|
||||
private String sendTime;
|
||||
private Integer timeoutReminderMinute;
|
||||
|
||||
public Long getOrdId() {
|
||||
return this.ordId;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return this.deviceId;
|
||||
}
|
||||
|
||||
public Integer getClean() {
|
||||
return this.clean;
|
||||
}
|
||||
|
||||
public Integer getTimes() {
|
||||
return this.times;
|
||||
}
|
||||
|
||||
public String getSendTime() {
|
||||
return this.sendTime;
|
||||
}
|
||||
|
||||
public Integer getTimeoutReminderMinute() {
|
||||
return this.timeoutReminderMinute;
|
||||
}
|
||||
|
||||
public DeviceLockerOrderNoticeDTO setOrdId(final Long ordId) {
|
||||
this.ordId = ordId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceLockerOrderNoticeDTO setDeviceId(final Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceLockerOrderNoticeDTO setClean(final Integer clean) {
|
||||
this.clean = clean;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceLockerOrderNoticeDTO setTimes(final Integer times) {
|
||||
this.times = times;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceLockerOrderNoticeDTO setSendTime(final String sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceLockerOrderNoticeDTO setTimeoutReminderMinute(final Integer timeoutReminderMinute) {
|
||||
this.timeoutReminderMinute = timeoutReminderMinute;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Long var10000 = this.getOrdId();
|
||||
return "DeviceLockerOrderNoticeDTO(ordId=" + var10000 + ", deviceId=" + this.getDeviceId() + ", clean=" + this.getClean() + ", times=" + this.getTimes() + ", sendTime=" + this.getSendTime() + ", timeoutReminderMinute=" + this.getTimeoutReminderMinute() + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.bonus.canteen.core.device.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bonus.canteen.core.device.manage.model.DeviceLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DeviceLogMapper extends BaseMapper<DeviceLog> {
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.bonus.canteen.core.device.manage.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@TableName("device_log")
|
||||
public class DeviceLog {
|
||||
@TableId
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
@ApiModelProperty("设备sn码")
|
||||
private String deviceSn;
|
||||
@ApiModelProperty("日志下载路劲")
|
||||
private String deviceLogUrl;
|
||||
@ApiModelProperty("日志下发状态 1等待上报 2上报成功 3失败")
|
||||
private String deviceLogState;
|
||||
@ApiModelProperty("日志下发状态 1等待上报")
|
||||
private String deviceLogStateMsg;
|
||||
@ApiModelProperty("日志开始时间")
|
||||
private LocalDate deviceLogSttime;
|
||||
@ApiModelProperty("日志结束时间")
|
||||
private LocalDate deviceLogEndtime;
|
||||
@ApiModelProperty("创建时间")
|
||||
private String crtime;
|
||||
@ApiModelProperty("更新时间")
|
||||
private String uptime;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getDeviceSn() {
|
||||
return this.deviceSn;
|
||||
}
|
||||
|
||||
public String getDeviceLogUrl() {
|
||||
return this.deviceLogUrl;
|
||||
}
|
||||
|
||||
public String getDeviceLogState() {
|
||||
return this.deviceLogState;
|
||||
}
|
||||
|
||||
public String getDeviceLogStateMsg() {
|
||||
return this.deviceLogStateMsg;
|
||||
}
|
||||
|
||||
public LocalDate getDeviceLogSttime() {
|
||||
return this.deviceLogSttime;
|
||||
}
|
||||
|
||||
public LocalDate getDeviceLogEndtime() {
|
||||
return this.deviceLogEndtime;
|
||||
}
|
||||
|
||||
public String getCrtime() {
|
||||
return this.crtime;
|
||||
}
|
||||
|
||||
public String getUptime() {
|
||||
return this.uptime;
|
||||
}
|
||||
|
||||
public void setId(final Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setDeviceSn(final String deviceSn) {
|
||||
this.deviceSn = deviceSn;
|
||||
}
|
||||
|
||||
public void setDeviceLogUrl(final String deviceLogUrl) {
|
||||
this.deviceLogUrl = deviceLogUrl;
|
||||
}
|
||||
|
||||
public void setDeviceLogState(final String deviceLogState) {
|
||||
this.deviceLogState = deviceLogState;
|
||||
}
|
||||
|
||||
public void setDeviceLogStateMsg(final String deviceLogStateMsg) {
|
||||
this.deviceLogStateMsg = deviceLogStateMsg;
|
||||
}
|
||||
|
||||
public void setDeviceLogSttime(final LocalDate deviceLogSttime) {
|
||||
this.deviceLogSttime = deviceLogSttime;
|
||||
}
|
||||
|
||||
public void setDeviceLogEndtime(final LocalDate deviceLogEndtime) {
|
||||
this.deviceLogEndtime = deviceLogEndtime;
|
||||
}
|
||||
|
||||
public void setCrtime(final String crtime) {
|
||||
this.crtime = crtime;
|
||||
}
|
||||
|
||||
public void setUptime(final String uptime) {
|
||||
this.uptime = uptime;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Long var10000 = this.getId();
|
||||
return "DeviceLog(id=" + var10000 + ", deviceSn=" + this.getDeviceSn() + ", deviceLogUrl=" + this.getDeviceLogUrl() + ", deviceLogState=" + this.getDeviceLogState() + ", deviceLogStateMsg=" + this.getDeviceLogStateMsg() + ", deviceLogSttime=" + String.valueOf(this.getDeviceLogSttime()) + ", deviceLogEndtime=" + String.valueOf(this.getDeviceLogEndtime()) + ", crtime=" + this.getCrtime() + ", uptime=" + this.getUptime() + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.bonus.canteen.core.device.manage.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bonus.canteen.core.data.dataset.Executors;
|
||||
import com.bonus.canteen.core.device.manage.mapper.DeviceLogMapper;
|
||||
import com.bonus.canteen.core.device.manage.model.DeviceLog;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.invoke.SerializedLambda;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DeviceLogService {
|
||||
@Autowired
|
||||
private DeviceLogMapper deviceLogMapper;
|
||||
|
||||
public List<DeviceLog> queryLog(String deviceSn) {
|
||||
return Executors.doInSystem(() -> {
|
||||
return this.deviceLogMapper.selectList(Wrappers.lambdaQuery(DeviceLog.class).eq(DeviceLog::getDeviceSn, deviceSn));
|
||||
});
|
||||
}
|
||||
|
||||
public DeviceLog queryLogById(Long id) {
|
||||
return (DeviceLog)this.deviceLogMapper.selectById(id);
|
||||
}
|
||||
|
||||
public DeviceLog addLog(DeviceLog deviceLog) {
|
||||
return (DeviceLog)Executors.doInSystem(() -> {
|
||||
if (ObjectUtil.isEmpty(deviceLog.getDeviceSn())) {
|
||||
throw new ServiceException("设备sn不能为空");
|
||||
} else {
|
||||
deviceLog.setId(Id.next());
|
||||
this.deviceLogMapper.insert(deviceLog);
|
||||
return deviceLog;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateLog(DeviceLog deviceLog) {
|
||||
Executors.doInSystem(() -> {
|
||||
if (ObjectUtil.isEmpty(deviceLog.getId())) {
|
||||
throw new ServiceException("id不能为空");
|
||||
} else {
|
||||
return this.deviceLogMapper.update(null, (((Wrappers.lambdaUpdate(DeviceLog.class).set(DeviceLog::getDeviceLogState, deviceLog.getDeviceLogState())).set(DeviceLog::getDeviceLogUrl, deviceLog.getDeviceLogUrl())).set(DeviceLog::getDeviceLogStateMsg, deviceLog.getDeviceLogStateMsg())).eq(DeviceLog::getId, deviceLog.getId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteLog(Long id) {
|
||||
Executors.doInSystem(() -> {
|
||||
if (ObjectUtil.isEmpty(id)) {
|
||||
throw new ServiceException("id不能为空");
|
||||
} else {
|
||||
return this.deviceLogMapper.delete(Wrappers.lambdaQuery(DeviceLog.class).eq(DeviceLog::getId, id));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
package com.bonus.canteen.core.device.mq;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bonus.canteen.core.common.constant.LeMqConstant;
|
||||
import com.bonus.canteen.core.common.redis.RedisUtil;
|
||||
import com.bonus.canteen.core.common.utils.JacksonUtil;
|
||||
import com.bonus.canteen.core.common.utils.SysUtil;
|
||||
import com.bonus.canteen.core.data.dataset.Executors;
|
||||
import com.bonus.canteen.core.device.api.DeviceApi;
|
||||
import com.bonus.canteen.core.device.constants.MachineConstant;
|
||||
import com.bonus.canteen.core.device.manage.dto.DeviceHeartDTO;
|
||||
import com.bonus.canteen.core.device.manage.dto.DeviceSendLogMqDTO;
|
||||
import com.bonus.canteen.core.device.manage.dto.devicelocker.DeviceLockerOrderNoticeDTO;
|
||||
import com.bonus.canteen.core.device.manage.model.DeviceLog;
|
||||
import com.bonus.canteen.core.device.manage.service.DeviceLogService;
|
||||
import com.bonus.canteen.core.order.api.OrderDeviceApi;
|
||||
import com.bonus.canteen.core.order.common.constants.DishesStateEnum;
|
||||
import com.bonus.canteen.core.order.common.model.OrderInfo;
|
||||
import com.bonus.canteen.core.order.mq.MqPayload;
|
||||
import com.bonus.canteen.core.order.mq.MqUtil;
|
||||
import com.bonus.canteen.core.order.mq.po.OrderChangePO;
|
||||
import com.bonus.common.houqin.oss.OssProperties;
|
||||
import com.bonus.common.houqin.oss.service.OssTemplate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@Service
|
||||
public class DeviceMqHandler {
|
||||
private static final Logger log = LoggerFactory.getLogger(DeviceMqHandler.class);
|
||||
@Autowired
|
||||
private DeviceLogService deviceLogService;
|
||||
@Autowired
|
||||
private OssTemplate ossTemplate;
|
||||
@Autowired
|
||||
private OssProperties ossProperties;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private DeviceApi deviceApi;
|
||||
@Autowired
|
||||
@Lazy
|
||||
protected OrderDeviceApi orderDeviceApi;
|
||||
|
||||
public <T> void handleMessage(MqPayload<?> payload, Class<T> clz, BiConsumer<DeviceMqHandler, T> handleFunc) {
|
||||
try {
|
||||
T payloadData = JacksonUtil.readValue((String)payload.getData(), clz);
|
||||
if (payloadData != null) {
|
||||
Executors.doInTenant(payload.getTenantId(), (s) -> {
|
||||
handleFunc.accept(this, payloadData);
|
||||
});
|
||||
} else {
|
||||
log.error("[订单消息]解析失败 {}", payload);
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
log.error("[订单消息]处理异常", var5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void deviceLogInfoDelete(DeviceSendLogMqDTO deviceSendLogMqDTO) {
|
||||
log.info("[MQ设备]上传日志到时间清理 {}", deviceSendLogMqDTO);
|
||||
DeviceLog deviceLog = this.deviceLogService.queryLogById(deviceSendLogMqDTO.getId());
|
||||
if (ObjectUtil.isEmpty(deviceLog)) {
|
||||
log.info("[MQ设备]上传日志到时间清理 {} 不存在", deviceSendLogMqDTO);
|
||||
} else {
|
||||
if (ObjectUtil.isNotEmpty(deviceLog.getDeviceLogUrl())) {
|
||||
try {
|
||||
this.ossTemplate.removeObject(this.ossProperties.getBucketName(), SysUtil.getCutFileUrl(deviceLog.getDeviceLogUrl()));
|
||||
} catch (Exception var4) {
|
||||
log.error("[MQ设备]上传日志到时间清理 {} 删除失败", deviceSendLogMqDTO);
|
||||
}
|
||||
}
|
||||
|
||||
this.deviceLogService.deleteLog(deviceLog.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public void deviceHeartSend(DeviceHeartDTO dto) {
|
||||
log.info("[兼容老版本http]设备上线/下线上报:{}", dto);
|
||||
if (ObjectUtil.isEmpty(RedisUtil.getString(MachineConstant.getDeviceStateRedisKey(dto.getDeviceSn())))) {
|
||||
Executors.doInTenant(dto.getMerchantId(), (s) -> {
|
||||
this.deviceApi.updateMachineMqttOnlineState(dto.getDeviceSn(), 2, dto.getVersionCode(), dto.getVersionName());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void dealOrderNoticeDto(DeviceLockerOrderNoticeDTO dto) {
|
||||
try {
|
||||
log.info("处理取餐柜取餐消息:{}", dto);
|
||||
Long ordId = dto.getOrdId();
|
||||
OrderChangePO orderChangePO = this.orderDeviceApi.getOrderInfoById(ordId);
|
||||
OrderInfo orderInfo = orderChangePO.getOrderInfo();
|
||||
if (DishesStateEnum.WAIT_TAKE.getKey().equals(orderInfo.getDishesState())) {
|
||||
Integer cleanType = dto.getClean();
|
||||
log.info("处理取餐柜取餐消息类型:{}", cleanType);
|
||||
String sendTimeStr;
|
||||
if (cleanType == 2) {
|
||||
sendTimeStr = dto.getSendTime();
|
||||
if (sendTimeStr != null) {
|
||||
LocalDateTime sendTime = LocalDateTime.parse(sendTimeStr, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
|
||||
orderChangePO.setTimeoutClean(sendTime);
|
||||
}
|
||||
}
|
||||
|
||||
orderChangePO.setCleanType(cleanType);
|
||||
sendTimeStr = JacksonUtil.writeValueAsStringIgnoreNull(orderChangePO);
|
||||
MqUtil.send(sendTimeStr, LeMqConstant.Topic.ORDER_CHANGE);
|
||||
}
|
||||
} catch (Exception var8) {
|
||||
log.error("[取餐柜超时]MQ消费:处理异常", var8);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.canteen.core.device.mq;
|
||||
|
||||
import com.bonus.canteen.core.common.constant.LeMqConstant;
|
||||
import com.bonus.canteen.core.device.manage.dto.DeviceHeartDTO;
|
||||
import com.bonus.canteen.core.device.manage.dto.DeviceSendLogMqDTO;
|
||||
import com.bonus.canteen.core.device.manage.dto.devicelocker.DeviceLockerOrderNoticeDTO;
|
||||
import com.bonus.canteen.core.order.mq.MqPayload;
|
||||
import com.bonus.common.houqin.mq.MQListener;
|
||||
import com.bonus.common.houqin.mq.MQMessageListener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
@MQMessageListener(
|
||||
group = "device-default",
|
||||
topic = "device"
|
||||
)
|
||||
public class DeviceMqListener implements MQListener<MqPayload<?>> {
|
||||
private static final Logger log = LoggerFactory.getLogger(DeviceMqListener.class);
|
||||
@Autowired
|
||||
@Lazy
|
||||
private DeviceMqHandler deviceMqHandler;
|
||||
|
||||
public void onMessage(MqPayload<?> payload) {
|
||||
log.info("[订单消息]消息未处理 {}", payload);
|
||||
if (LeMqConstant.Topic.DEVICE_LOG_INFO_DELETE_v4.equals(payload.getTopic())) {
|
||||
this.deviceMqHandler.handleMessage(payload, DeviceSendLogMqDTO.class, DeviceMqHandler::deviceLogInfoDelete);
|
||||
}
|
||||
|
||||
if (LeMqConstant.Topic.DEVICE_HEARTBEAT.equals(payload.getTopic())) {
|
||||
this.deviceMqHandler.handleMessage(payload, DeviceHeartDTO.class, DeviceMqHandler::deviceHeartSend);
|
||||
}
|
||||
|
||||
if (LeMqConstant.Topic.DEVICE_ORDER_DELAY.equals(payload.getTopic())) {
|
||||
this.deviceMqHandler.handleMessage(payload, DeviceLockerOrderNoticeDTO.class, DeviceMqHandler::dealOrderNoticeDto);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, Order
|
|||
return CollUtil.newArrayList(new OrderDetail[0]);
|
||||
} else {
|
||||
List<LocalDate> dateRange = LeOrderUtil.queryDateRange((Collection)orderIdList, (Collection)orderDates);
|
||||
return this.list((Wrapper)((LambdaQueryWrapper<OrderDetail>)Wrappers.lambdaQuery(OrderDetail.class).in(OrderDetail::getOrderId, orderIdList)).between(OrderDetail::getOrderDate, dateRange.get(0), dateRange.get(1)));
|
||||
return this.list(Wrappers.lambdaQuery(OrderDetail.class).in(OrderDetail::getOrderId, orderIdList).between(OrderDetail::getOrderDate, dateRange.get(0), dateRange.get(1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class ReportOrderApi {
|
|||
result.setLastMonthTotalAmount(lastMonthSum.getTotalAmount());
|
||||
result.setLastMonthTotalCount(lastMonthSum.getTotalCount());
|
||||
}));
|
||||
CompletableFuture.allOf((CompletableFuture[])futures.toArray(new CompletableFuture[0])).join();
|
||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue