调整
This commit is contained in:
parent
ef97f2ded8
commit
10e3cea687
@ -65,9 +65,9 @@ public class WeChatServiceImpl implements WeChatService {
|
||||
@Override
|
||||
public LoginVo authorizeLogin(String code, HttpServletRequest request) {
|
||||
LoginVo loginVo = new LoginVo();
|
||||
// WeChatMiniAuthorizeVo response = miniAuthCode(code);
|
||||
WeChatMiniAuthorizeVo response = new WeChatMiniAuthorizeVo();
|
||||
response.setOpenId("123456");
|
||||
WeChatMiniAuthorizeVo response = miniAuthCode(code);
|
||||
// WeChatMiniAuthorizeVo response = new WeChatMiniAuthorizeVo();
|
||||
// response.setOpenId("123456");
|
||||
String openId = response.getOpenId();
|
||||
String type = "login";
|
||||
BusUser BusUser = BusUserMapper.getUserByOpenId(openId);
|
||||
|
@ -21,16 +21,13 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import java.sql.Timestamp;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import me.zhengjie.modules.system.domain.dto.BusTreeVo;
|
||||
import me.zhengjie.modules.system.service.webstocket.res.WebSocketResPrintInfo;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
@ -75,6 +72,9 @@ public class BusDevice implements Serializable {
|
||||
@ApiModelProperty(value = "打印状态(-1默认/断开,0空闲,1归零中,2下降中,3曝光中,4抬升中,5正在执行暂停动作中,6已暂停,7正在执行停止动作中,8已停止,9打印完成,10文件检测中,11加液中,12铲件中)")
|
||||
private Integer printStatus;
|
||||
|
||||
@ApiModelProperty(value = "打印信息")
|
||||
private String printJson;
|
||||
|
||||
@ApiModelProperty(value = "异常状态(-1默认/断开,0正常,1文件校验失败,2设备或加密错误,3打印准备过程出错,4打印出错,5加液失败,6铲件失败,7图片异物)")
|
||||
private Integer errorStatus;
|
||||
|
||||
@ -96,6 +96,10 @@ public class BusDevice implements Serializable {
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Timestamp updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "打印信息")
|
||||
private WebSocketResPrintInfo printInfo;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BusDeviceCommand> commandList;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public interface BusDeviceMapper extends BaseMapper<BusDevice> {
|
||||
|
||||
List<BusTreeVo> getDevice();
|
||||
|
||||
void updateDeviceStatus(@Param("deviceSn") String deviceSn, @Param("status") Integer status, @Param("printStatus") Integer printStatus, @Param("errorStatus") Integer errorStatus, @Param("remark") String remark);
|
||||
void updateDeviceStatus(@Param("deviceSn") String deviceSn, @Param("status") Integer status, @Param("printStatus") Integer printStatus, @Param("errorStatus") Integer errorStatus, @Param("remark") String remark, @Param("printJson") String printJson);
|
||||
|
||||
IPage<BusDevice> myDeviceList(@Param("userId") Long userId, Page<Object> page);
|
||||
|
||||
|
@ -41,7 +41,7 @@ public interface BusDeviceService extends IService<BusDevice> {
|
||||
/**
|
||||
* 修改设备状态
|
||||
*/
|
||||
void updateDeviceStatus(String deviceSn, CurrentStatusEnum e1, PrintInfoStatusEnum e2, ErrorStatusEnum e3, String remark);
|
||||
void updateDeviceStatus(String deviceSn, CurrentStatusEnum e1, PrintInfoStatusEnum e2, ErrorStatusEnum e3, String remark, String printJson);
|
||||
|
||||
PageResult<BusDevice> myDeviceList(Long userId, Page<Object> page);
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.front.domain.dto.DeviceLogCriteria;
|
||||
@ -31,6 +32,7 @@ import me.zhengjie.modules.system.service.BusDeviceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import me.zhengjie.modules.system.service.webstocket.res.WebSocketResPrintInfo;
|
||||
import me.zhengjie.utils.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@ -64,7 +66,10 @@ public class BusDeviceServiceImpl extends ServiceImpl<BusDeviceMapper, BusDevice
|
||||
|
||||
@Override
|
||||
public BusDevice getByDeviceCode(String deviceCode) {
|
||||
return busDeviceMapper.selectOne(new QueryWrapper<BusDevice>().eq("device_code", deviceCode));
|
||||
BusDevice device = busDeviceMapper.selectOne(new QueryWrapper<BusDevice>().eq("device_code", deviceCode));
|
||||
if (null != device) { device.setPrintInfo(JSON.parseObject(device.getPrintJson(), WebSocketResPrintInfo.class)); }
|
||||
device.setPrintJson(null);
|
||||
return device;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,8 +84,8 @@ public class BusDeviceServiceImpl extends ServiceImpl<BusDeviceMapper, BusDevice
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void updateDeviceStatus(String deviceSn, CurrentStatusEnum e1, PrintInfoStatusEnum e2, ErrorStatusEnum e3, String remark) {
|
||||
busDeviceMapper.updateDeviceStatus(deviceSn, e1.getCode(), e2.getCode(), e3.getCode(), remark);
|
||||
public void updateDeviceStatus(String deviceSn, CurrentStatusEnum e1, PrintInfoStatusEnum e2, ErrorStatusEnum e3, String remark, String printJson) {
|
||||
busDeviceMapper.updateDeviceStatus(deviceSn, e1.getCode(), e2.getCode(), e3.getCode(), remark, printJson);
|
||||
}
|
||||
|
||||
@Async
|
||||
|
@ -90,7 +90,7 @@ public class WebSocketSdcpServiceImpl extends WebSocketService {
|
||||
PrintInfoStatusEnum print = PrintInfoStatusEnum.SDCP_PRINT_STATUS_DEFAULT;
|
||||
ErrorStatusEnum error = ErrorStatusEnum.SDCP_PRINT_ERROR_DEFAULT;
|
||||
String remark = "已关闭连接";
|
||||
myDeviceService.updateDeviceStatus(null, status, print, error, remark);
|
||||
myDeviceService.updateDeviceStatus(null, status, print, error, remark, null);
|
||||
sendVueMessage(JSON.toJSONString(new SocketMsg(new HashMap<>() , remark, MsgEnum.CLOSE)), null, null);
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ public class WebSocketSdcpServiceImpl extends WebSocketService {
|
||||
PrintInfoStatusEnum print = PrintInfoStatusEnum.getEnumByNum(resStatus.getPrintInfo().getStatus());;
|
||||
ErrorStatusEnum error = ErrorStatusEnum.getEnumByNum(resStatus.getPrintInfo().getErrorNumber());
|
||||
remark = "状态已更新";
|
||||
myDeviceService.updateDeviceStatus(deviceSn, status, print, error, remark);
|
||||
myDeviceService.updateDeviceStatus(deviceSn, status, print, error, remark, JSON.toJSONString(resDTO.getStatus().getPrintInfo()));
|
||||
sendVueMessage(JSON.toJSONString(new SocketMsg(commandResult, remark, MsgEnum.STATUS)), null, null);
|
||||
return;
|
||||
} else if (method == MethodEnum.attributes) {
|
||||
@ -361,7 +361,7 @@ public class WebSocketSdcpServiceImpl extends WebSocketService {
|
||||
PrintInfoStatusEnum print = PrintInfoStatusEnum.getEnumByNum(resStatus.getPrintInfo().getStatus());;
|
||||
ErrorStatusEnum error = ErrorStatusEnum.getEnumByNum(resStatus.getPrintInfo().getErrorNumber());
|
||||
remark = "设备发生异常";
|
||||
myDeviceService.updateDeviceStatus(deviceSn, status, print, error, remark);
|
||||
myDeviceService.updateDeviceStatus(deviceSn, status, print, error, remark, null);
|
||||
sendVueMessage(JSON.toJSONString(new SocketMsg(commandResult, remark, MsgEnum.STATUS)), null, null);
|
||||
return;
|
||||
} else if (method == MethodEnum.notice) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.zhengjie.modules.system.service.webstocket.res;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -8,22 +9,31 @@ import java.io.Serializable;
|
||||
public class WebSocketResPrintInfo implements Serializable {
|
||||
|
||||
// 打印子状态
|
||||
@ApiModelProperty(value = "打印子状态")
|
||||
private Integer Status;
|
||||
// 当前打印层数
|
||||
@ApiModelProperty(value = "当前打印层数")
|
||||
private Integer CurrentLayer;
|
||||
// 打印任务总层数
|
||||
@ApiModelProperty(value = "打印任务总层数")
|
||||
private Integer TotalLayer;
|
||||
// 当前已打印时间(ms)
|
||||
@ApiModelProperty(value = "当前已打印时间(ms)")
|
||||
private Integer CurrentTicks;
|
||||
// 总打印时间(ms)
|
||||
@ApiModelProperty(value = "总打印时间(ms)")
|
||||
private Integer TotalTicks;
|
||||
// 打印文件名称
|
||||
@ApiModelProperty(value = "打印文件名称")
|
||||
private String Filename;
|
||||
// 错误码,参考后文 ErrorEnum
|
||||
@ApiModelProperty(value = "错误码")
|
||||
private Integer ErrorNumber;
|
||||
// 当前任务数量
|
||||
@ApiModelProperty(value = "当前任务数量")
|
||||
private Integer Task;
|
||||
// 总共任务数量
|
||||
@ApiModelProperty(value = "总共任务数量")
|
||||
private Integer Total;
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
</select>
|
||||
|
||||
<update id="updateDeviceStatus">
|
||||
update bus_device set status = #{status}, print_status = #{printStatus}, error_status = #{errorStatus}, remark = #{remark}
|
||||
update bus_device set status = #{status}, print_status = #{printStatus}, error_status = #{errorStatus}, remark = #{remark}, print_json = #{printJson}
|
||||
<where><if test="deviceSn != null and deviceSn != ''"> device_sn = #{deviceSn} </if></where>
|
||||
</update>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user