提交 01adf667 authored 作者: zhoushaopan's avatar zhoushaopan

fix(3d模块): 入库存储渲染类型是装备并且形态是密码机

入库存储渲染类型是装备并且形态是密码机
上级 e71453b4
......@@ -23,11 +23,9 @@ public class DeviceDataUtil {
*/
public Boolean addString(String str){
//解析当前页,总页数
// int firstFlagIndexOf = str.indexOf("Ǵ");
int firstFlagIndexOf = str.indexOf("!");
int currentPage = Integer.parseInt(str.substring(0,firstFlagIndexOf));
str = str.substring(firstFlagIndexOf+1);
// int secondFlagIndexOf = str.indexOf("Ǵ");
int secondFlagIndexOf = str.indexOf("!");
int totalPage = Integer.parseInt(str.substring(0, secondFlagIndexOf));
if (this.totalPage==-1){
......@@ -48,15 +46,32 @@ public class DeviceDataUtil {
public static void main(String[] args) {
DeviceDataUtil deviceDataUtil = new DeviceDataUtil();
List<String> strings = new ArrayList<>();
strings.add("1!1!H4sIAAAAAAAAAKtWKkkszvZMUbIyMjQwNdABc/0Sc1OVrJSebZ35bOP853Man83Z9WJZ49ONDU/7J77Yuv35rJZn05c+3bHj2eKGZ/OXPtm9+2nXQiWI1pDKAqBWqDnORamJJakuQAw0zcjAyEjXwFTX0FLBwNjK0ACooTg5MQ8im1eak6OjlJJalpmc6pOZVJRYlJlarGQVXa2Um5+SmgNTkAd2GIRdArYJwk7OSE3ODkotLs0pAVtelJaZ4pxYlALylxLIotRCv9LcpNQiINfCwsLQxNTSyMzS0EypVoe2NpjT3AYLpdrYWgB+a8XlxgEAAA==");
DeviceDataUtil deviceDataUtil = new DeviceDataUtil();
for (int i = 0; i < strings.size(); i++) {
deviceDataUtil.addString(strings.get(i));
Map<Integer,Object> map = new HashMap<>();
strings.add("KtWKkkszvZMUbIyMjQwNdABc/0Sc1OVrJSebZ35bOP853Man83Z9WJZ49ONDU/7J77Yuv35rJZn05c+3bHj2eKGZ/OXPtm9+2nXQiWI1pDKAqBWqDnORamJJakuQAw0zcjAyEjXwFTX0FLBwNjK0ACooTg5MQ8im1eak6OjlJJalpmc6pOZVJRYlJlarGQVXa2Um5+SmgNTkAd2GIRdArYJwk7OSE3ODkotLs0pAVtelJaZ4pxYlALylxLIotRCv9LcpNQiINfCwsLQxNTSyMzS0EypVoe2NpjT3AYLpdrYWgB+a8XlxgEAAA==");
String str = "1!3!H4sIAAAAAAAAA!2!3!csds!3!3sdds";
//解析当前页,总页数
int firstFlagIndexOf = str.indexOf("!");
int currentPage = Integer.parseInt(str.substring(0,firstFlagIndexOf));
str = str.substring(firstFlagIndexOf+1);
int secondFlagIndexOf = str.indexOf("!");
int totalPage = Integer.parseInt(str.substring(0, secondFlagIndexOf));
if (deviceDataUtil.totalPage==-1){
deviceDataUtil.totalPage = totalPage;
}
String json = GZIPUtils.uncompressToString(deviceDataUtil.getCompleteString());
System.out.println("json = " + json);
str = str.substring(secondFlagIndexOf+1);
deviceDataUtil.stringMap.put(currentPage,str);
deviceDataUtil.stringMap.forEach((k,v)->{
System.out.println("k = " + k);
System.out.println("v = " + v);
});
// DeviceDataUtil deviceDataUtil = new DeviceDataUtil();
// for (int i = 0; i < strings.size(); i++) {
// deviceDataUtil.addString(strings.get(i));
// }
// String json = GZIPUtils.uncompressToString(deviceDataUtil.getCompleteString());
// System.out.println("json = " + json);
}
......
......@@ -59,6 +59,7 @@ public class QrCodeBillUtil {
public TaskData parseCode(List<String> strings){
DeviceDataUtil deviceDataUtil = new DeviceDataUtil();
log.info("传递的数据格式:{}",strings);
List<String> collect = strings.stream().sorted(Comparator.comparing(s -> {
int i = s.indexOf("!");
s = s.substring(0,i);
......@@ -69,7 +70,7 @@ public class QrCodeBillUtil {
for (int i = 0; i < collect.size(); i++) {
flag = deviceDataUtil.addString(collect.get(i));
}
log.info("collect:{}",collect);
log.info("排序后的数据格式:{}",collect);
if (!flag){
throw new ApiException("没有扫完");
}
......
......@@ -123,6 +123,11 @@ public class DailyCheckController {
@PostMapping(value = "/saveDayDevice")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity saveDayDevice(@RequestBody SelfCheckUnitBill selfCheckUnitBill) {
Integer dailyCheckId = selfCheckUnitBill.getDailyCheckId();
DailyCheckBill dailyCheckBill = dailyCheckBillService.getOne(dailyCheckId);
String dayDeviceList = selfCheckUnitBill.getDayDeviceList();
dailyCheckBill.setCheckDetail(dayDeviceList);
dailyCheckBillService.update(dailyCheckBill);
//先根据单位id查询
SelfCheckUnitBill byUnitId = service.findByUnitId(selfCheckUnitBill.getUnitId());
if (byUnitId != null){
......
......@@ -551,143 +551,6 @@ public class SelfCheckController {
return ResultUtil.success(selfExaminationBillEntity1);
}
// @ApiOperation(value = "发起自查业务", notes = "可以通过这个接口发起自查业务")
// @PostMapping(value = "/addBill")
// @Transactional(rollbackFor = Exception.class)
// public ResponseEntity addSelfExaminationBill(@RequestBody @Validated SelfCheckSaveVo selfCheckSaveVo) {
// //添加账单
// SelfCheckBill selfExaminationBillEntity;
// List<FileVo> fileVoList = new ArrayList<>();
// TaskBto taskBto;
// if (selfCheckSaveVo.getTaskId()!=null){
// taskBto = taskService.get(selfCheckSaveVo.getTaskId());
// TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_SELF_CHECK);
// selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId());
// selfExaminationBillEntity.setCheckTime(new Date());
// selfExaminationBillEntity.setCheckDetail(selfCheckSaveVo.getCheckDetail());
// selfExaminationBillEntity.setCheckResult(selfCheckSaveVo.getCheckResult());
// selfExaminationBillEntity.setCheckStatus(0);
// selfExaminationBillEntity.setCheckedCount(selfCheckSaveVo.getCheckedCount());
// selfExaminationBillEntity.setCheckingCount(selfCheckSaveVo.getCheckingCount());
// selfExaminationBillEntity.setUserbId(selfCheckSaveVo.getUserbId());
// selfExaminationBillEntity.setHandheldTerminalInformation(selfCheckSaveVo.getHandheldTerminalInformation());
// if (selfCheckSaveVo.getUnStockDevices()!=null&&selfCheckSaveVo.getUnStockDevices().size()>0){
// selfExaminationBillEntity.setUnStockDetail(JacksonUtil.toJSon(selfCheckSaveVo.getUnStockDevices()));
// }
// }
// else {
// selfExaminationBillEntity = selfCheckSaveVo.toDo();
// selfExaminationBillEntity.setTitle(userUtils.getCurrentUserUnitName() + "发起的自查任务");
// selfExaminationBillEntity.setCheckUnit(userUtils.getCurrentUserUnitName());
// selfExaminationBillEntity.setCheckUnitId(userUtils.getCurrentUnitId());
// }
// selfExaminationBillEntity.setUseraId(userUtils.getCurrentUserId());
// selfExaminationBillEntity.setCreateUnitId(userUtils.getCurrentUnitId());
// if (selfCheckSaveVo.getNewDeviceList() != null) {
// //按新增不在系统的装备按rfid卡号拼接保存
// StringBuilder stringBuffer = new StringBuilder();
// stringBuffer.append(".");
// for (String s : selfCheckSaveVo.getNewDeviceList()) {
// stringBuffer.append(s);
// stringBuffer.append(".");
// }
// selfExaminationBillEntity.setNewDeviceDetail(stringBuffer.toString());
// }
// if(selfCheckSaveVo.getCheckFiles()!=null&&selfCheckSaveVo.getCheckFiles().size()>0) {
// selfExaminationBillEntity.setCheckFiles(FilesUtil.stringFileToList(selfCheckSaveVo.getCheckFiles()));
// selfCheckSaveVo.getCheckFiles().forEach(fileRet -> {
// fileVoList.add(new FileVo("自查单", fileRet.getName(), fileRet.getPreviewPath()));
// });
// }
// SelfCheckBill selfExaminationBillEntity1 = selfExaminationBillService.addEntity(selfExaminationBillEntity);
// Integer userId = userUtils.getCurrentUserId();
// String deviceIdDetail = selfCheckSaveVo.getCheckDetail();
// String[] strings = deviceIdDetail.split("x");
// if (selfCheckSaveVo.getTaskId()!=null){
// //获取任务
// taskBto = taskService.get(selfCheckSaveVo.getTaskId());
// if (selfCheckSaveVo.getType()==0){
// taskBto.setCustomInfo("手动");
// //添加涉及人员
// taskService.addInvolveUser(taskBto,userId);
// //推至下一阶段
// taskService.moveToNext(taskBto,selfExaminationBillEntity1.getUseraId());
// }
// else if (selfCheckSaveVo.getType()==1){
// taskBto.setCustomInfo("扫码");
// //添加涉及人员
// taskService.addInvolveUser(taskBto,userId);
// if (selfCheckSaveVo.getUserbId()!=null) {
// taskService.moveToEnd(taskBto);
// selfExaminationBillEntity1.setUserbId(selfCheckSaveVo.getUserbId());
// List<Integer> idList = new ArrayList<>();
// idList.add(selfCheckSaveVo.getUserbId());
// //阅知
// MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "完成终端自查", idList, 0,0);
// messageService.add(messageBto);
// }
// else {
// taskService.moveToNext(taskBto,selfExaminationBillEntity1.getUseraId());
// }
// selfExaminationBillEntity1.setCheckStatus(2);
// selfExaminationBillService.update(selfExaminationBillEntity1);
// }
// else {
// throw new ApiException("type只能为0或1");
// }
// }
// else {
// //发起任务
// List<Integer> userIds = new ArrayList<>();
// userIds.add(userId);
//// if (selfExaminationBillEntity1.getUserbId()!=null){
//// userIds.add(selfExaminationBillEntity1.getUserbId());
//// }
// taskBto = new TaskBto(StatusEnum.SELF_CHECK_CONFIRM.id, userUtils.getCurrentUserUnitName() + "发起的自查任务", null, ".", selfExaminationBillEntity1.getId(), 4, userUtils.getCurrentUnitId(), 0, null, userIds);
// if (selfCheckSaveVo.getType()==0){
// taskBto.setCustomInfo("手动");
// taskService.start(taskBto);
// }
// else if (selfCheckSaveVo.getType()==1){
// taskBto.setCustomInfo("扫码");
// if (selfCheckSaveVo.getUserbId()!=null) {
// taskBto.setBillStatus(StatusEnum.END.id);
// }
//// taskBto.setCurrentPoint(0);
// TaskBto taskBto1 = taskService.start(taskBto);
// if (selfCheckSaveVo.getUserbId()!=null) {
// selfExaminationBillEntity1.setUserbId(selfCheckSaveVo.getUserbId());
// List<Integer> idList = new ArrayList<>();
// idList.add(selfCheckSaveVo.getUserbId());
// //阅知
// MessageBto messageBto = new MessageBto(taskBto1.getId(), taskBto1.getBusinessType(), "完成终端自查", idList, 0);
// messageService.add(messageBto);
// }
// selfExaminationBillEntity1.setCheckStatus(2);
// selfExaminationBillService.update(selfExaminationBillEntity1);
// }
// }
// //添加装备日志
// //进行修改日志存储慢的问题
// List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
// for (String s:strings) {
// if (s.length()>=2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
//// DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),null);
// DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,userId,taskBto.getId());
// deviceLogDtos.add(deviceLogDto);
//// deviceLogService.addLog(deviceLogDto);
// }
// }
// executor.execute(
// ()->{
// deviceLogService.addAllLog(deviceLogDtos);
// }
// );
// log.info("[自查模块]:发起自查");
// myWebSocket.sendMessage1();
// return ResultUtil.success(selfExaminationBillEntity1);
// }
@ApiOperation(value = "自查审核", notes = "可以通过这个接口自查审核")
@PostMapping(value = "/selfExaminationConfirm")
......
......@@ -29,6 +29,7 @@ import com.tykj.dev.misc.qrcode.vo.DeviceCodeVO;
import com.tykj.dev.misc.qrcode.vo.TaskData;
import com.tykj.dev.misc.utils.DateUtil;
import com.tykj.dev.misc.utils.PageUtil;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
......@@ -119,13 +120,14 @@ public class DailyCheckBillServiceImpl implements DailyCheckBillService {
Integer id = dailyCheckSaveVo.getId();
//任务推进
TaskBto taskBto = taskService.get(taskId);
taskService.moveToSpecial(taskBto,StatusEnum.WAIT_CHECK_RESULT);
TaskBto taskBto1 = taskService.moveToSpecial(taskBto, StatusEnum.WAIT_CHECK_RESULT);
//更新列表设备
DailyCheckBill checkBill = getOne(id);
checkBill.setCheckStatus(0);
BeanUtils.copyProperties(dailyCheckSaveVo, checkBill);
DailyCheckBill update = update(checkBill);
log.info("[日常检查模块]:发起日常检查");
update.setTaskId(taskBto1.getId());
return update;
}
......@@ -133,7 +135,7 @@ public class DailyCheckBillServiceImpl implements DailyCheckBillService {
@Override
public DailyCheckBill updateBill(DailyCheckUpdateVo dailyCheckUpdateVo) {
TaskBto taskBto = taskService.get(dailyCheckUpdateVo.getTaskId());
taskService.moveToSpecial(taskBto,StatusEnum.WAIT_CHECK_FILE);
TaskBto taskBto1 = taskService.moveToSpecial(taskBto, StatusEnum.WAIT_CHECK_FILE);
Integer id = dailyCheckUpdateVo.getId();
DailyCheckBill checkBill = getOne(id);
BeanUtils.copyProperties(dailyCheckUpdateVo,checkBill);
......@@ -151,6 +153,7 @@ public class DailyCheckBillServiceImpl implements DailyCheckBillService {
batchSave(dailyCheckUpdateVo.getCheckDeviceList0(),Integer.valueOf("0"),historyDeviceBillList0,update.getId());
List<HistoryDailyDeviceBill> historyDeviceBillList1 = new ArrayList<>();
batchSave(dailyCheckUpdateVo.getCheckDeviceList1(),Integer.valueOf("1"),historyDeviceBillList1,update.getId());
update.setTaskId(taskBto1.getId());
return update;
}
......@@ -257,7 +260,7 @@ public class DailyCheckBillServiceImpl implements DailyCheckBillService {
List<Integer> deviceIds = deviceLibraries.stream().map(DeviceLibrary::getId).distinct().collect(Collectors.toList());
Integer dailyCheckId = parseQrCodeVO.getDailyCheckId();
DailyCheckBill checkBill = getOne(dailyCheckId);
String[] ids = checkBill.getCheckDetail().split(",");
String[] ids = checkBill.getCheckDetail().split("x");
List<Integer> finalIds = new ArrayList<>();
if (ids.length > 0){
for (int i = 0; i < ids.length; i++) {
......@@ -266,14 +269,18 @@ public class DailyCheckBillServiceImpl implements DailyCheckBillService {
}
}
if (deviceIds.size() != ids.length){
throw new ApiException("扫描任务与当前的任务时间不一致");
if (deviceIds.size() != finalIds.size()){
log.info("长度不一致");
log.info("deviceIDS的长度:{}",deviceIds.size());
log.info("ids的长度:{}",finalIds.size());
throw new ApiException("与检查设备不匹配");
}else {
//长度一样
deviceIds.removeAll(finalIds);
if (deviceIds.size()>0){
throw new ApiException("扫描任务与当前的任务时间不一致");
boolean b = usingStream(deviceIds, finalIds);
if (!b){
throw new ApiException("与检查设备不匹配");
}
}
}
......@@ -289,7 +296,7 @@ public class DailyCheckBillServiceImpl implements DailyCheckBillService {
if (checkBill.getCheckDetail() != null && !"".equals(checkBill.getCheckDetail())) {
String dayDeviceList = checkBill.getCheckDetail();
String[] ids = dayDeviceList.split(",");
String[] ids = dayDeviceList.split("x");
List<Integer> deviceIds = new ArrayList<>();
if (ids.length>0){
......@@ -404,19 +411,31 @@ public class DailyCheckBillServiceImpl implements DailyCheckBillService {
historyDailyDeviceBill.setTypeName(deviceLibrary.getTypeName());
historyDailyDeviceBill.setInvisibleRangeName(deviceLibrary.getInvisibleRangeName());
historyDailyDeviceBill.setSecretLevelName(deviceLibrary.getSecretLevelName());
historyDeviceBillList.add(historyDailyDeviceBill);
}
historyDailyDeviceBillService.batchSave(historyDeviceBillList);
}
public static void main(String[] args) {
String a = "";
String[] split = a.split(",");
for (int i = 0; i < split.length; i++) {
System.out.println("split = " + split[i]);
List<Integer> a = new ArrayList<>(Arrays.asList(1,2,3));
List<Integer> b = new ArrayList<>(Arrays.asList(1,2,3));
a.removeAll(b);
System.out.println("b = " + b.size());
System.out.println("a = " + a.size());
}
private static boolean usingStream(List<Integer> list, List<Integer> list1) {
List<String> newlist = new ArrayList<>(list.size());
List<String> newList1 = new ArrayList<>(list1.size());
for (Integer myInt : list) {
newlist.add(String.valueOf(myInt));
}
for (Integer myInt1 : list1) {
newList1.add(String.valueOf(myInt1));
}
System.out.println("split = " + split.length);
/** 先将集合转成stream流进行排序然后转成字符串进行比较 */
return newlist.stream().sorted().collect(Collectors.joining())
.equals(newList1.stream().sorted().collect(Collectors.joining()));
}
}
......@@ -103,7 +103,7 @@ public class DailyCheckBill {
private String checkResult;
@Column(name = "check_detail",columnDefinition = "TEXT")
@ApiModelProperty(value = "设备id 1,2,3")
@ApiModelProperty(value = "设备id 1X2X3")
private String checkDetail;
@Column(name = "check_detail0",columnDefinition = "TEXT")
......
......@@ -82,6 +82,10 @@ public class SelfCheckUnitBill {
@ApiModelProperty(value = "选中的系统装备列表")
private List<DeviceLibrary> deviceLibraryList;
@Transient
@ApiModelProperty(value = "列表的id")
private Integer dailyCheckId;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论