提交 48e35ba5 authored 作者: zhoushaopan's avatar zhoushaopan

fix(自查模块): 修复了数据存储的bug,以及生成二维码的bug

修复了数据存储的bug,以及生成二维码的bug
上级 b40df250
...@@ -34,6 +34,7 @@ public class QrCodeBillUtil { ...@@ -34,6 +34,7 @@ public class QrCodeBillUtil {
public List<String> createCode(TaskData taskData){ public List<String> createCode(TaskData taskData){
String join = JacksonUtil.toJSon(taskData); String join = JacksonUtil.toJSon(taskData);
List<String> code = getCodeNum(join); List<String> code = getCodeNum(join);
log.info("code:{}",code);
List<String> preview = new ArrayList<>(); List<String> preview = new ArrayList<>();
//总页数 //总页数
if (code.size() > 0) { if (code.size() > 0) {
...@@ -47,10 +48,11 @@ public class QrCodeBillUtil { ...@@ -47,10 +48,11 @@ public class QrCodeBillUtil {
String codePath = QRCodeUtil.encode(data, null, qrCodePath, false); String codePath = QRCodeUtil.encode(data, null, qrCodePath, false);
codePath = qrCodePreviewPath + codePath; codePath = qrCodePreviewPath + codePath;
preview.add(codePath); preview.add(codePath);
return preview;
} catch (Exception e) { } catch (Exception e) {
} }
} }
return preview;
} }
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -85,6 +87,7 @@ public class QrCodeBillUtil { ...@@ -85,6 +87,7 @@ public class QrCodeBillUtil {
public List<String> getCodeNum(String data) { public List<String> getCodeNum(String data) {
//先压缩和加密 //先压缩和加密
String s = GZIPUtils.compress(data); String s = GZIPUtils.compress(data);
log.info("压缩和加密之后的长度:{}",s.length());
//然后截取 //然后截取
return QrStringSplitUtil.stringToList2(s, 900); return QrStringSplitUtil.stringToList2(s, 900);
} }
......
...@@ -1004,11 +1004,7 @@ public class SelfCheckController { ...@@ -1004,11 +1004,7 @@ public class SelfCheckController {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_SELF_CHECK); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_SELF_CHECK);
selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId()); selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId());
selfExaminationBillEntity.setCheckTime(new Date()); selfExaminationBillEntity.setCheckTime(new Date());
//日常检查设备
List<DeviceLibrary> dayCheckList = selfCheckSaveVo.getDayCheckList();
if (dayCheckList !=null && dayCheckList.size()>0){
selfExaminationBillEntity.setDayCheckList(JacksonUtil.toJSon(selfCheckSaveVo.getDayCheckList()));
}
BeanUtils.copyProperties(selfCheckSaveVo,selfExaminationBillEntity); BeanUtils.copyProperties(selfCheckSaveVo,selfExaminationBillEntity);
if (selfCheckSaveVo.getUnStockDevices()!=null&&selfCheckSaveVo.getUnStockDevices().size()>0){ if (selfCheckSaveVo.getUnStockDevices()!=null&&selfCheckSaveVo.getUnStockDevices().size()>0){
selfExaminationBillEntity.setUnStockDetail(JacksonUtil.toJSon(selfCheckSaveVo.getUnStockDevices())); selfExaminationBillEntity.setUnStockDetail(JacksonUtil.toJSon(selfCheckSaveVo.getUnStockDevices()));
...@@ -1045,10 +1041,9 @@ public class SelfCheckController { ...@@ -1045,10 +1041,9 @@ public class SelfCheckController {
selfExaminationBillEntity.setTaskId(taskBto1.getId()); selfExaminationBillEntity.setTaskId(taskBto1.getId());
} }
} }
List<DeviceLibrary> dayCheckList = selfCheckSaveVo.getDayCheckList(); //日常检查设备
if (dayCheckList != null && dayCheckList.size() >0){ String dayDeviceList = selfCheckSaveVo.getDayCheckList();
selfExaminationBillEntity.setDayCheckList(JacksonUtil.toJSon(dayCheckList)); selfExaminationBillEntity.setDayCheckList(dayDeviceList);
}
selfExaminationBillEntity.setUseraId(currentUserId); selfExaminationBillEntity.setUseraId(currentUserId);
selfExaminationBillEntity.setCreateUnitId(unitId); selfExaminationBillEntity.setCreateUnitId(unitId);
selfExaminationBillService.update(selfExaminationBillEntity); selfExaminationBillService.update(selfExaminationBillEntity);
...@@ -1071,8 +1066,16 @@ public class SelfCheckController { ...@@ -1071,8 +1066,16 @@ public class SelfCheckController {
Integer unitId = userUtils.getCurrentUnitId(); Integer unitId = userUtils.getCurrentUnitId();
SelfCheckUnitBill checkUnitBill = service.findByUnitId(unitId); SelfCheckUnitBill checkUnitBill = service.findByUnitId(unitId);
if (checkUnitBill != null){ if (checkUnitBill != null){
checkUnitBill.setDeviceLibraryList(JacksonUtil.readValue(checkUnitBill.getDayDeviceList(), new TypeReference<List<DeviceLibrary>>() { //取出设备的id
})); String dayDeviceList = checkUnitBill.getDayDeviceList();
String[] ids = dayDeviceList.split("x");
List<Integer> deviceIds = new ArrayList<>();
for (int i = 0; i < ids.length; i++) {
int i1 = Integer.parseInt(ids[i]);
deviceIds.add(i1);
}
List<DeviceLibrary> deviceLibraryList = deviceLibraryService.findAllByIds(deviceIds);
checkUnitBill.setDeviceLibraryList(deviceLibraryList);
} }
return ResultUtil.success(checkUnitBill); return ResultUtil.success(checkUnitBill);
} }
......
...@@ -271,9 +271,16 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService { ...@@ -271,9 +271,16 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
SelfCheckBill checkBill = getOne(billId); SelfCheckBill checkBill = getOne(billId);
//日常设备信息 //日常设备信息
if (checkBill.getDayCheckList() != null) { if (checkBill.getDayCheckList() != null) {
checkBill.setDayDeviceLibraries(JacksonUtil.readValue(checkBill.getDayCheckList(),
new TypeReference<List<DeviceLibrary>>() { String dayDeviceList = checkBill.getDayCheckList();
})); String[] ids = dayDeviceList.split("x");
List<Integer> deviceIds = new ArrayList<>();
for (int i = 0; i < ids.length; i++) {
int i1 = Integer.parseInt(ids[i]);
deviceIds.add(i1);
}
List<DeviceLibrary> deviceLibraryList = deviceLibraryService.findAllByIds(deviceIds);
checkBill.setDayDeviceLibraries(deviceLibraryList);
} }
//设备信息 //设备信息
List<DeviceLibrary> deviceLibraries = new ArrayList<>(); List<DeviceLibrary> deviceLibraries = new ArrayList<>();
......
...@@ -20,7 +20,6 @@ public class SelfCheckUnitBillServiceImpl implements SelfCheckUnitBillService { ...@@ -20,7 +20,6 @@ public class SelfCheckUnitBillServiceImpl implements SelfCheckUnitBillService {
@Override @Override
public SelfCheckUnitBill add(SelfCheckUnitBill selfCheckUnitBill) { public SelfCheckUnitBill add(SelfCheckUnitBill selfCheckUnitBill) {
selfCheckUnitBill.setDayDeviceList(JacksonUtil.toJSon(selfCheckUnitBill.getDeviceLibraryList()));
return selfCheckUnitBillDao.save(selfCheckUnitBill); return selfCheckUnitBillDao.save(selfCheckUnitBill);
} }
......
...@@ -155,7 +155,7 @@ public class SelfCheckBill { ...@@ -155,7 +155,7 @@ public class SelfCheckBill {
// @Column(name = "qr_code_path",columnDefinition = "TEXT") // @Column(name = "qr_code_path",columnDefinition = "TEXT")
// private String qrcodePath ; // private String qrcodePath ;
@ApiModelProperty(value = "日常检查装备的集合") @ApiModelProperty(value = "日常检查装备的集合",example = "id 以x进行分割 id")
@Column(name = "day_check_list",columnDefinition = "TEXT") @Column(name = "day_check_list",columnDefinition = "TEXT")
private String dayCheckList; private String dayCheckList;
......
...@@ -47,7 +47,7 @@ public class SelfCheckUnitBill { ...@@ -47,7 +47,7 @@ public class SelfCheckUnitBill {
/** /**
* 自查标题 * 自查标题
*/ */
@ApiModelProperty(value = "装备记录详情") @ApiModelProperty(value = "装备记录详情",example = "id 以x分割")
@Column(name = "day_device_list",columnDefinition = "TEXT") @Column(name = "day_device_list",columnDefinition = "TEXT")
private String dayDeviceList; private String dayDeviceList;
......
...@@ -70,8 +70,8 @@ public class SelfCheckSaveVo { ...@@ -70,8 +70,8 @@ public class SelfCheckSaveVo {
@ApiModelProperty(value = "是否是日常检查",notes = "0代表 常规检查, 1代表 日常检查") @ApiModelProperty(value = "是否是日常检查",notes = "0代表 常规检查, 1代表 日常检查")
private Integer isDayCheck = 0; private Integer isDayCheck = 0;
@ApiModelProperty(value = "日常检查装备的集合") @ApiModelProperty(value = "日常检查装备")
private List<DeviceLibrary> dayCheckList ; private String dayCheckList ;
public SelfCheckBill toDo() { public SelfCheckBill toDo() {
SelfCheckBill selfExaminationBillEntity = new SelfCheckBill(); SelfCheckBill selfExaminationBillEntity = new SelfCheckBill();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论