提交 a52d1735 authored 作者: zjm's avatar zjm

Merge branch 'master' of git.yfzx.zjtys.com.cn:matrix/device-back into dev

...@@ -198,6 +198,7 @@ public class AllotBill { ...@@ -198,6 +198,7 @@ public class AllotBill {
* 配发出库检查结果 * 配发出库检查结果
*/ */
@ApiModelProperty(value = "配发出库检查结果") @ApiModelProperty(value = "配发出库检查结果")
@Column(name = "allot_check_result",columnDefinition = "TEXT")
private String allotCheckResult; private String allotCheckResult;
/** /**
* 配发接收方检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配 * 配发接收方检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配
...@@ -209,6 +210,7 @@ public class AllotBill { ...@@ -209,6 +210,7 @@ public class AllotBill {
* 接收方检查结果 * 接收方检查结果
*/ */
@ApiModelProperty(value = "接收方检查结果") @ApiModelProperty(value = "接收方检查结果")
@Column(name = "receive_check_result",columnDefinition = "TEXT")
private String receiveCheckResult; private String receiveCheckResult;
/** /**
* 删除标记(0:未删除,1:已删除) * 删除标记(0:未删除,1:已删除)
......
...@@ -237,61 +237,65 @@ public class DeviceApplyController { ...@@ -237,61 +237,65 @@ public class DeviceApplyController {
return ResponseEntity.ok("ok"); return ResponseEntity.ok("ok");
} }
@ApiOperation(value = "装备申请批复", notes = "可以通过这个接口批复") // @ApiOperation(value = "装备申请批复", notes = "可以通过这个接口批复")
@PostMapping("/replay")//不用了 // @PostMapping("/replay")//不用了
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public ResponseEntity addDeviceApplyBillReplay(@RequestBody @Validated DeviceApplyConfirmVo deviceApplyConfirmVo) { // public ResponseEntity addDeviceApplyBillReplay(@RequestBody @Validated DeviceApplyConfirmVo deviceApplyConfirmVo) {
TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId()); // TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId());
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.DEVICE_APPLY_CONFIRM); // TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.DEVICE_APPLY_CONFIRM);
Integer userId = userUtils.getCurrentUserId(); // Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto, userId); // taskService.addInvolveUser(taskBto, userId);
DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId()); // DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId());
applyBillEntity.setReplyUseraId(userId); // applyBillEntity.setReplyUseraId(userId);
//阅知用户Id // //阅知用户Id
List<Integer> ids = userPublicService.findOtherUser(userId); // List<Integer> ids = userPublicService.findOtherUser(userId);
// ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(applyBillEntity.getApplyUnit())).stream() //// ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(applyBillEntity.getApplyUnit())).stream()
//// .map(User::getUserId)
//// .collect(Collectors.toList()));
// ids.addAll(userDao.findAllByUnitsId(applyBillEntity.getApplyUnitId()).stream()
// .map(User::getUserId) // .map(User::getUserId)
// .collect(Collectors.toList())); // .collect(Collectors.toList()));
ids.addAll(userDao.findAllByUnitsId(applyBillEntity.getApplyUnitId()).stream() // //如果修改了批复文号
.map(User::getUserId) // if (deviceApplyConfirmVo.getReplyNumber() != null) {
.collect(Collectors.toList())); // applyBillEntity.setReplayNumber(deviceApplyConfirmVo.getReplyNumber());
//如果修改了批复文号 // }
if (deviceApplyConfirmVo.getReplyNumber() != null) { // //批复驳回
applyBillEntity.setReplayNumber(deviceApplyConfirmVo.getReplyNumber()); // if (deviceApplyConfirmVo.getStatus() == 1) {
} // applyBillEntity.setApplyStatus(1);
//批复驳回 // taskService.update(taskService.moveToArchive(taskBto));
if (deviceApplyConfirmVo.getStatus() == 1) { // deviceApplyBillService.update(applyBillEntity);
applyBillEntity.setApplyStatus(1); // //发送阅知信息 装备申请被拒绝
taskService.update(taskService.moveToArchive(taskBto)); //// MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),
deviceApplyBillService.update(applyBillEntity); //// "不同意 申请业务:【"+userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "->【中办机要局】",ids);
//发送阅知信息 //
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(), // MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),
"不同意 申请业务:【"+userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "->【中办机要局】",ids); // "装备申请被拒绝:【"+userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) +
messageService.add(messageBto); // "->【中办机要局】申请"+MessageFormatUtil.spellModelAndCount(),ids);
log.info("[申请模块]:装备申请驳回"); // messageService.add(messageBto);
myWebSocket.sendMessage1(); // log.info("[申请模块]:装备申请驳回");
return ResponseEntity.ok(taskBto); // myWebSocket.sendMessage1();
} // return ResponseEntity.ok(taskBto);
//批复成功 // }
if (deviceApplyConfirmVo.getStatus() == 0) { // //批复成功
applyBillEntity.setApplyStatus(2); // if (deviceApplyConfirmVo.getStatus() == 0) {
taskService.update(taskService.moveToEnd(taskBto)); // applyBillEntity.setApplyStatus(2);
//发送阅知信息 // taskService.update(taskService.moveToEnd(taskBto));
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"同意" + userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "的装备申请",ids); // //发送阅知信息
messageService.add(messageBto); // MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"同意" + userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "的装备申请",ids);
log.info("[申请模块]:装备申请批复成功,发起配发子业务"); // messageService.add(messageBto);
//生成配发子任务 // log.info("[申请模块]:装备申请批复成功,发起配发子业务");
List<Integer> userIds = new ArrayList<>(); // //生成配发子任务
userIds.add(0); // List<Integer> userIds = new ArrayList<>();
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_ALLOT.id, "配发业务", taskBto.getId(), "." + taskBto.getId() + ".", 0, 3, userUtils.getCurrentUnitId(), 0, null, userIds); // userIds.add(0);
TaskBto task = taskService.start(taskBto1); // TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_ALLOT.id, "配发业务", taskBto.getId(), "." + taskBto.getId() + ".", 0, 3, userUtils.getCurrentUnitId(), 0, null, userIds);
deviceApplyBillService.update(applyBillEntity); // TaskBto task = taskService.start(taskBto1);
myWebSocket.sendMessage1(); // deviceApplyBillService.update(applyBillEntity);
return ResponseEntity.ok(task); // myWebSocket.sendMessage1();
} else { // return ResponseEntity.ok(task);
throw new ApiException(ResultUtil.failed("status只能为0或1")); // } else {
} // throw new ApiException(ResultUtil.failed("status只能为0或1"));
} // }
// }
@ApiOperation(value = "装备申请后发起配发", notes = "可以通过这个接口装备申请后发起配发") @ApiOperation(value = "装备申请后发起配发", notes = "可以通过这个接口装备申请后发起配发")
@PostMapping("/allot")//不用了 @PostMapping("/allot")//不用了
...@@ -474,7 +478,9 @@ public class DeviceApplyController { ...@@ -474,7 +478,9 @@ public class DeviceApplyController {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId()); DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"申请不同意,申请业务办结",userIds,0);
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"装备申请被拒绝:"
+MessageFormatUtil.spellModelAndCount(uploadApplyFile.getModels(),uploadApplyFile.getTotalNum()),userIds,0);
messageService.add(messageBto); messageService.add(messageBto);
deviceApplyBill.setApplyStatus(1); deviceApplyBill.setApplyStatus(1);
deviceApplyBill.setBackFiles(FilesUtil.stringFileToList(uploadApplyFile.getBackFiles())); deviceApplyBill.setBackFiles(FilesUtil.stringFileToList(uploadApplyFile.getBackFiles()));
......
...@@ -53,4 +53,10 @@ public class UploadApplyFile { ...@@ -53,4 +53,10 @@ public class UploadApplyFile {
@ApiModelProperty(value = "经办人") @ApiModelProperty(value = "经办人")
private String agent; private String agent;
@ApiModelProperty(value = "型号的集合")
private List<String> models;
@ApiModelProperty(value = "总数量")
private Integer totalNum;
} }
...@@ -1151,10 +1151,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1151,10 +1151,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
if (!CollectionUtils.isEmpty(deviceIds)){ if (!CollectionUtils.isEmpty(deviceIds)){
//添加装备日志 //添加装备日志
deviceIds.forEach(integer -> { deviceIds.forEach(integer -> {
DeviceLogDto deviceLogDto= new DeviceLogDto(integer,"将存放位置修改为"+ if (!updateStorageLocationVo.getStorageLocation().equals(getOne(integer).getStorageLocation())){
updateStorageLocationVo.getStorageLocation(),null,userId); DeviceLogDto deviceLogDto= new DeviceLogDto(integer,"将存放位置修改为"+
deviceLogDtos.add(deviceLogDto); updateStorageLocationVo.getStorageLocation(),null,userId);
}); deviceLogDtos.add(deviceLogDto);
}});
deviceLibraryDao.updateStorageLocation(updateStorageLocationVo.getStorageLocation(),deviceIds); deviceLibraryDao.updateStorageLocation(updateStorageLocationVo.getStorageLocation(),deviceIds);
}else { }else {
throw new ApiException("请选择要修改的装备"); throw new ApiException("请选择要修改的装备");
......
package com.tykj.dev.device.loss.service.impl; package com.tykj.dev.device.loss.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil; import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.base.DeviceLifeStatus; import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.config.base.FileName; import com.tykj.dev.config.base.FileName;
...@@ -10,6 +11,7 @@ import com.tykj.dev.device.library.service.DeviceLibraryService; ...@@ -10,6 +11,7 @@ import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService; import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLog; import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.loss.entity.domain.DeviceLoss; import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import com.tykj.dev.device.loss.entity.vo.LossAuditvo; import com.tykj.dev.device.loss.entity.vo.LossAuditvo;
import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo; import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo;
...@@ -31,15 +33,15 @@ import com.tykj.dev.device.user.subject.service.UserService; ...@@ -31,15 +33,15 @@ import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
//import com.tykj.dev.misc.base.DeviceLifeStatus; //import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.MessageFormatUtil;
import com.tykj.dev.misc.utils.TaskDisposeUtil; import com.tykj.dev.misc.utils.TaskDisposeUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -102,13 +104,24 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -102,13 +104,24 @@ public class LossBillServiceImpl implements LossBillService {
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId()); Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
taskBto= newLossCountyTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务",securityUser.getCurrentUserInfo().getUserId()); taskBto= newLossCountyTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务",securityUser.getCurrentUserInfo().getUserId());
} }
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起了装备丢失",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起 装备丢失:"+toMessageCount(deviceLoss.getDevIds()),gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.LOSS.id,deviceLoss.getDevIdsList()); deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.LOSS.id,deviceLoss.getDevIdsList());
devLogAdd(deviceLoss.getDevIdsList(),"装备报备丢失", deviceLoss.getCreateUserId(),taskBto.getId()); devLogAdd(deviceLoss.getDevIdsList(),"装备报备丢失", deviceLoss.getCreateUserId(),taskBto.getId());
} }
private String toMessageCount(String json){
List<Integer> ids=StringUtils.stringToList(json);
Set<String> strings=new HashSet<>();
deviceLibraryService.findByIds(ids).forEach(
deviceLibrary -> {
strings.add(deviceLibrary.getModel());
}
);
return MessageFormatUtil.spellModelSetAndCount(strings,ids.size());
}
@Override @Override
public void superiorAuditLoss(LossAuditvo lossAuditvo) { public void superiorAuditLoss(LossAuditvo lossAuditvo) {
...@@ -132,7 +145,7 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -132,7 +145,7 @@ public class LossBillServiceImpl implements LossBillService {
taskBto.setOwnUnit(parentUnits.getUnitId()); taskBto.setOwnUnit(parentUnits.getUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.LOSS1301,0); taskService.moveToSpecial(taskBto,StatusEnum.LOSS1301,0);
} }
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"审核了装备丢失业务",gainThisUser(user.getUserId(),user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"审核 装备丢失:"+toMessageCount(deviceLoss.getDevIds()),gainThisUser(user.getUserId(),user.getUnitsId())));
deviceLossService.save(deviceLoss); deviceLossService.save(deviceLoss);
} }
...@@ -156,7 +169,7 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -156,7 +169,7 @@ public class LossBillServiceImpl implements LossBillService {
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId()); Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
taskBto= newRetrieveCountyTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId()); taskBto= newRetrieveCountyTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId());
} }
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起装备找回业务",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起 装备找回"+toMessageCount(deviceLoss.getDevIds()),gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
devLogAdd(deviceLoss.getDevIdsList(),"装备找回上报", deviceLoss.getCreateUserId(),taskBto.getId()); devLogAdd(deviceLoss.getDevIdsList(),"装备找回上报", deviceLoss.getCreateUserId(),taskBto.getId());
} }
...@@ -175,11 +188,11 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -175,11 +188,11 @@ public class LossBillServiceImpl implements LossBillService {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
deviceLoss.setBackStatus(2); deviceLoss.setBackStatus(2);
deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,StringUtils.stringToList(deviceLoss.getDevIds())); deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,StringUtils.stringToList(deviceLoss.getDevIds()));
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"装备找回业务审核成功",gainThisUser(user.getUserId(),user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"审核通过 装备找回:"+toMessageCount(deviceLoss.getDevIds()),gainThisUser(user.getUserId(),user.getUnitsId())));
}else { }else {
taskService.moveToEnd(taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1403)); taskService.moveToEnd(taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1403));
User user1= userService.findByUser(taskBto.getCreateUserId()); User user1= userService.findByUser(taskBto.getCreateUserId());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"装备找回业务审核不通过",findUnitId(user1.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"审核不通过 装备找回:"+toMessageCount(deviceLoss.getDevIds()),findUnitId(user1.getUnitsId())));
deviceLoss.setBackStatus(3); deviceLoss.setBackStatus(3);
} }
}else { }else {
...@@ -190,12 +203,12 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -190,12 +203,12 @@ public class LossBillServiceImpl implements LossBillService {
if (retrieveAuditvo.getType()==1){ if (retrieveAuditvo.getType()==1){
taskBto.setOwnUnit(parentUnits.getUnitId()); taskBto.setOwnUnit(parentUnits.getUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1401,0); taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1401,0);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"装备找回业务审核成功",gainThisUser(user.getUserId(),user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"审核通过 装备找回:"+toMessageCount(deviceLoss.getDevIds()),gainThisUser(user.getUserId(),user.getUnitsId())));
}else { }else {
taskService.moveToEnd(taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1402)); taskService.moveToEnd(taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1402));
deviceLoss.setBackStatus(3); deviceLoss.setBackStatus(3);
User user1= userService.findByUser(taskBto.getCreateUserId()); User user1= userService.findByUser(taskBto.getCreateUserId());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"装备找回业务审核不通过",findUnitId(user1.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"审核不通过 装备找回:"+toMessageCount(deviceLoss.getDevIds()),findUnitId(user1.getUnitsId())));
} }
} }
......
...@@ -14,6 +14,7 @@ import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService; ...@@ -14,6 +14,7 @@ import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo; import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo;
import com.tykj.dev.device.matching.subject.vo.RelationDeviceVo; import com.tykj.dev.device.matching.subject.vo.RelationDeviceVo;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
...@@ -163,7 +164,8 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -163,7 +164,8 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
} }
} }
} }
@Autowired
private UnitsService unitsService;
@Override @Override
public List<MatchingDeviceLibrary> getMatchingDevicePage(MatchingDeviceSelectVo matchingDeviceSelectVo) { public List<MatchingDeviceLibrary> getMatchingDevicePage(MatchingDeviceSelectVo matchingDeviceSelectVo) {
PredicateBuilder<MatchingDeviceLibrary> predicateBuilder = getPredicate(matchingDeviceSelectVo); PredicateBuilder<MatchingDeviceLibrary> predicateBuilder = getPredicate(matchingDeviceSelectVo);
...@@ -187,8 +189,8 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -187,8 +189,8 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
//获取区域等级 //获取区域等级
Integer selectLevel = userPublicService.getArea(selectAreaId).getType(); Integer selectLevel = userPublicService.getArea(selectAreaId).getType();
//获取区域下所有单位名称 //获取区域下所有单位名称
// List<String> units = userPublicService.findAllUnitNameByAreaId(selectAreaId); List<String> units = userPublicService.findAllUnitNameByAreaId(selectAreaId);
List<Integer> units = userPublicService.findAllUnitIdByAreaId(selectAreaId); // List<Integer> units = userPublicService.findAllUnitIdByAreaId(selectAreaId);
//如果是市或县,筛选出创建单位在units中的设备 //如果是市或县,筛选出创建单位在units中的设备
if (selectLevel == 3 || selectLevel == 2) { if (selectLevel == 3 || selectLevel == 2) {
// List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(getPredicate(matchingDeviceSelectVo).build()) // List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(getPredicate(matchingDeviceSelectVo).build())
...@@ -197,7 +199,7 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -197,7 +199,7 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
// .collect(Collectors.toList()); // .collect(Collectors.toList());
List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(getPredicate(matchingDeviceSelectVo).build()) List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll(getPredicate(matchingDeviceSelectVo).build())
.stream() .stream()
.filter(matchingDeviceLibraryEntity -> units.contains(matchingDeviceLibraryEntity.getCreateUnitId())) .filter(matchingDeviceLibraryEntity -> units.contains(unitsService.findById(matchingDeviceLibraryEntity.getCreateUnitId()).getName()))
.collect(Collectors.toList()); .collect(Collectors.toList());
// List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll().stream() // List<MatchingDeviceLibrary> resultList = matchingDeviceLibraryDao.findAll().stream()
// .filter(matchingDeviceLibraryEntity -> units.contains(matchingDeviceLibraryEntity.getCreateUnit())) // .filter(matchingDeviceLibraryEntity -> units.contains(matchingDeviceLibraryEntity.getCreateUnit()))
......
package com.tykj.dev.misc.utils; package com.tykj.dev.misc.utils;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author zjm * @author zjm
...@@ -25,7 +26,7 @@ public class MessageFormatUtil { ...@@ -25,7 +26,7 @@ public class MessageFormatUtil {
return "【" + return "【" +
one + one +
"】" + "】" +
"-->" + "" +
"【" + "【" +
two + two +
"】"; "】";
...@@ -41,6 +42,15 @@ public class MessageFormatUtil { ...@@ -41,6 +42,15 @@ public class MessageFormatUtil {
} }
/**
* 阅知中拼接型号和数量
*/
public static String spellModelSetAndCount(Set<String> models,Integer count) {
return "【型号:" +
String.join(",",models) +
"共"+count+"件装备】";
}
/** /**
* 一个【】填空内容的通用接口 * 一个【】填空内容的通用接口
*/ */
...@@ -48,4 +58,15 @@ public class MessageFormatUtil { ...@@ -48,4 +58,15 @@ public class MessageFormatUtil {
return ""; return "";
}; };
/**
* 阅知中拼接型号和数量
*/
public static String spellUnitAndModelAndCount(String unitName, Set<String> models, Integer count) {
return "【"+unitName+"】【型号:" +
String.join(",",models) +
"共"+count+"件装备】";
}
} }
...@@ -153,10 +153,10 @@ public class PackingController { ...@@ -153,10 +153,10 @@ public class PackingController {
packingLog.setPackingId(packingLibrary1.getId()); packingLog.setPackingId(packingLibrary1.getId());
packingLogService.add(packingLog); packingLogService.add(packingLog);
//发送阅知信息 //发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId()); // List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,"添加列装目录:"+mapToString(nowMap),userIds,0); // MessageBto messageBto = new MessageBto(0,1,"添加列装目录:"+mapToString(nowMap),userIds,0);
messageBto.setRecord(packingLibrary1.getId().toString()); // messageBto.setRecord(packingLibrary1.getId().toString());
messageService.add(messageBto); // messageService.add(messageBto);
//更新型号和排序号的对应map //更新型号和排序号的对应map
packingLibraryService.getSortMap(); packingLibraryService.getSortMap();
return ResponseEntity.ok(packingLibraryService.getOne(packingLibrary1.getId())); return ResponseEntity.ok(packingLibraryService.getOne(packingLibrary1.getId()));
...@@ -256,7 +256,7 @@ public class PackingController { ...@@ -256,7 +256,7 @@ public class PackingController {
partMap.put("名称",packingLibrary.getName()); partMap.put("名称",packingLibrary.getName());
partMap.put("配用范围",packingLibrary.getMatchingRangeName()); partMap.put("配用范围",packingLibrary.getMatchingRangeName());
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,"添加列装信息:"+mapToString(partMap),userIds,0); MessageBto messageBto = new MessageBto(0,1,"添加 列装信息:"+mapToString(partMap),userIds,0);
messageBto.setRecord(packingLibrary1.getId().toString()); messageBto.setRecord(packingLibrary1.getId().toString());
messageService.add(messageBto); messageService.add(messageBto);
//添加列装日志 //添加列装日志
...@@ -280,7 +280,8 @@ public class PackingController { ...@@ -280,7 +280,8 @@ public class PackingController {
childMap.put("名称",packingLibrary.getName()); childMap.put("名称",packingLibrary.getName());
childMap.put("配用范围",packingLibrary.getMatchingRangeName()); childMap.put("配用范围",packingLibrary.getMatchingRangeName());
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,"添加列装信息:"+mapToString(partMap)+"子级"+mapToString(childMap),userIds,0); MessageBto messageBto = new MessageBto(0,1,"添加 列装信息:"+mapToString(partMap)
+"子级"+mapToString(childMap),userIds,0);
messageBto.setRecord(packingLibrary1.getId().toString()); messageBto.setRecord(packingLibrary1.getId().toString());
messageService.add(messageBto); messageService.add(messageBto);
//添加列装日志 //添加列装日志
...@@ -309,7 +310,7 @@ public class PackingController { ...@@ -309,7 +310,7 @@ public class PackingController {
nowMap.put("名称",packingLibrary.getName()); nowMap.put("名称",packingLibrary.getName());
nowMap.put("配用范围",packingLibrary.getMatchingRangeName()); nowMap.put("配用范围",packingLibrary.getMatchingRangeName());
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,"删除列装信息:"+mapToString(nowMap),userIds,0); MessageBto messageBto = new MessageBto(0,1,"删除 列装信息:"+mapToString(nowMap),userIds,0);
messageBto.setRecord(packingLibrary.getId().toString()); messageBto.setRecord(packingLibrary.getId().toString());
messageService.add(messageBto); messageService.add(messageBto);
return ResponseEntity.ok("删除成功"); return ResponseEntity.ok("删除成功");
...@@ -627,7 +628,6 @@ public class PackingController { ...@@ -627,7 +628,6 @@ public class PackingController {
// }else { // }else {
if (packingLog.getRemark()!=null){ if (packingLog.getRemark()!=null){
messageBto= new MessageBto(0, 1, "修改"+packingLibrary.getModel()+"列装目录为:原"+mapToString(originalMap)+"-->现"+mapToString(nowMap), userIds, 0); messageBto= new MessageBto(0, 1, "修改"+packingLibrary.getModel()+"列装目录为:原"+mapToString(originalMap)+"-->现"+mapToString(nowMap), userIds, 0);
} }
// } // }
messageService.add(messageBto); messageService.add(messageBto);
......
...@@ -413,10 +413,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -413,10 +413,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
packingLogService.add(packingLog); packingLogService.add(packingLog);
} }
//发送阅知信息 //发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId()); // List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,"恢复列装",userIds,0); // MessageBto messageBto = new MessageBto(0,1,"恢复列装",userIds,0);
messageBto.setRecord(StringSplitUtil.idListToString(ids)); // messageBto.setRecord(StringSplitUtil.idListToString(ids));
messageService.add(messageBto); // messageService.add(messageBto);
} }
// /** // /**
......
...@@ -149,26 +149,37 @@ public class RepairController { ...@@ -149,26 +149,37 @@ public class RepairController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity judge(@RequestBody List<Integer> ids) { public ResponseEntity judge(@RequestBody List<Integer> ids) {
//存放所有维修记录的发件单位 //存放所有维修记录的发件单位
Set<String> sendUnits = new HashSet<>(); // Set<String> sendUnits = new HashSet<>();
List<Integer> sendUnits = new ArrayList<>();
ids.forEach(integer -> { ids.forEach(integer -> {
RepairDetail repairDetail = deviceRepairDetailService.getOne(integer); RepairDetail repairDetail = deviceRepairDetailService.getOne(integer);
RepairBill repairBill = deviceRepairBillService.getOne(repairDetail.getDeviceRepairBillId()); RepairBill repairBill = deviceRepairBillService.getOne(repairDetail.getDeviceRepairBillId());
sendUnits.add(repairBill.getSendUnit()); // sendUnits.add(repairBill.getSendUnit());
sendUnits.add(repairBill.getSendUnitId().toString()); sendUnits.add(repairBill.getSendUnitId());
}); });
//去重
List<Integer> collect = sendUnits.stream().distinct().collect(Collectors.toList());
//如果是同一单位返回单位名称,否则返error //如果是同一单位返回单位名称,否则返error
// if (sendUnits.size() == 1) { if (collect.size() == 1) {
Units units = unitsService.findById(collect.get(0));
// return ResponseEntity.ok(sendUnits.iterator().next()); // return ResponseEntity.ok(sendUnits.iterator().next());
// } else { return ResponseEntity.ok(units);
// return ResponseEntity.ok("error");
// }
List<String> list = sendUnits.stream().sorted().collect(Collectors.toList());
if (sendUnits.size() == 2) {
return ResponseEntity.ok(list);
} else { } else {
return ResponseEntity.ok("error"); return ResponseEntity.ok("error");
} }
// if (sendUnits.size() == 1) {
//// return ResponseEntity.ok(sendUnits.iterator().next());
// return ResponseEntity.ok(collect);
// } else {
// return ResponseEntity.ok("error");
// }
// List<String> list = sendUnits.stream().sorted().collect(Collectors.toList());
//
// if (sendUnits.size() == 2) {
// return ResponseEntity.ok(list);
// } else {
// return ResponseEntity.ok("error");
// }
} }
@ApiOperation(value = "保存维修操作", notes = "可以通过这个接口保存维修操作") @ApiOperation(value = "保存维修操作", notes = "可以通过这个接口保存维修操作")
...@@ -1324,6 +1335,8 @@ public class RepairController { ...@@ -1324,6 +1335,8 @@ public class RepairController {
//如果所属和所在一致,状态改为在库 //如果所属和所在一致,状态改为在库
if (deviceLibraryEntity.getOwnUnit().equals(deviceLibraryEntity.getLocationUnit())) { if (deviceLibraryEntity.getOwnUnit().equals(deviceLibraryEntity.getLocationUnit())) {
deviceLibraryEntity.setLifeStatus(2); deviceLibraryEntity.setLifeStatus(2);
}else {
deviceLibraryEntity.setLifeStatus(4);
} }
deviceLibraryEntity.setManageStatus(1); deviceLibraryEntity.setManageStatus(1);
deviceLibraries.add(deviceLibraryEntity); deviceLibraries.add(deviceLibraryEntity);
...@@ -2297,7 +2310,13 @@ public class RepairController { ...@@ -2297,7 +2310,13 @@ public class RepairController {
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(integer); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(integer);
deviceLibraryEntity.setLocationUnit(repairBackBill.getReceiveUnit()); deviceLibraryEntity.setLocationUnit(repairBackBill.getReceiveUnit());
deviceLibraryEntity.setLifeStatus(2); if (deviceLibraryEntity.getOwnUnit().equals(repairBackBill.getReceiveUnit())){
//在库
deviceLibraryEntity.setLifeStatus(2);
}else {
//维修中
deviceLibraryEntity.setLifeStatus(4);
}
deviceLibraryEntity.setManageStatus(1); deviceLibraryEntity.setManageStatus(1);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
}); });
......
...@@ -195,7 +195,13 @@ public class DeviceRetiredController { ...@@ -195,7 +195,13 @@ public class DeviceRetiredController {
TaskBto task = taskService.start(initTaskBto(retiredBill)); TaskBto task = taskService.start(initTaskBto(retiredBill));
//发送阅知信息 //发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId()); List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(task.getId(),task.getBusinessType(),"业务办结",userIds,0); // MessageBto messageBto = new MessageBto(task.getId(),task.getBusinessType(),"业务办结",userIds,0);
List<PackingLibrary> packingLibraries = packingLibraryService.findByIds(formVo.getPackings());
packingLibraries.forEach(PackingLibrary::setConfigName);
String content = "完成 列装退装"+String.join("-",spellModelAndCount(packingLibraries));
MessageBto messageBto = new MessageBto(task.getId(),task.getBusinessType(),content,userIds,0);
// MessageBto messageBto = new MessageBto(task.getId(),task.getBusinessType(),"业务办结",userIds,0);
messageBto.setRecord(String.valueOf(task.getBillId())); messageBto.setRecord(String.valueOf(task.getBillId()));
messageService.add(messageBto); messageService.add(messageBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
...@@ -366,4 +372,14 @@ public class DeviceRetiredController { ...@@ -366,4 +372,14 @@ public class DeviceRetiredController {
} }
return deviceRetiredResultVoList; return deviceRetiredResultVoList;
} }
private List<String> spellModelAndCount(List<PackingLibrary> packingLibraries) {
List<String> strings = new ArrayList<>();
packingLibraries.forEach(packingLibrary -> {
String s = "【型号:" + packingLibrary.getModel() + ",名称:" + packingLibrary.getName() + ",适用范围:" +
packingLibrary.getMatchingRange() + "】";
strings.add(s);
});
return strings;
}
} }
...@@ -100,6 +100,17 @@ ...@@ -100,6 +100,17 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>blockcha</artifactId> <artifactId>blockcha</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.3</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
package com.tykj.dev.rfid.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zsp
*/
@Data
@ApiModel("条码打印机,打印VO")
public class QRCodePrintVo {
@ApiModelProperty(name = "装备的id")
private Integer deviceId;
@ApiModelProperty(name = "型号")
private String model;
@ApiModelProperty(name = "名称")
private String name;
@ApiModelProperty(name = "序列号")
private String seqNumber;
}
package com.tykj.dev.rfid.service; package com.tykj.dev.rfid.service;
import com.tykj.dev.rfid.entity.vo.PrintVo; import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.entity.vo.QRCodePrintVo;
import com.tykj.dev.rfid.entity.vo.RfidCreateVo; import com.tykj.dev.rfid.entity.vo.RfidCreateVo;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo; import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
...@@ -52,4 +53,9 @@ public interface RfidService { ...@@ -52,4 +53,9 @@ public interface RfidService {
*/ */
List<RfidPrintVo> getRfidNumber(List<RfidCreateVo> list); List<RfidPrintVo> getRfidNumber(List<RfidCreateVo> list);
/**
* 条码打印机 批量打印
*/
void printByQRcode(List<QRCodePrintVo> qrCodePrintVos);
} }
...@@ -4,11 +4,11 @@ import com.tykj.dev.device.library.service.DeviceLibraryService; ...@@ -4,11 +4,11 @@ import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.rfid.entity.vo.PrintVo; import com.tykj.dev.rfid.entity.vo.*;
import com.tykj.dev.rfid.entity.vo.RfidCreateVo;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
import com.tykj.dev.rfid.entity.vo.SplitStringInfo;
import com.tykj.dev.rfid.service.RfidService; import com.tykj.dev.rfid.service.RfidService;
import com.tykj.dev.rfid.utils.DrawImageUtil;
import com.tykj.dev.rfid.utils.Image2Zpl;
import com.tykj.dev.rfid.utils.PrinterUtil;
import com.zebra.sdk.comm.Connection; import com.zebra.sdk.comm.Connection;
import com.zebra.sdk.comm.ConnectionException; import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.comm.TcpConnection; import com.zebra.sdk.comm.TcpConnection;
...@@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
...@@ -92,6 +93,7 @@ public class RfidServiceImpl implements RfidService { ...@@ -92,6 +93,7 @@ public class RfidServiceImpl implements RfidService {
} }
try { try {
Connection connection = new TcpConnection("10.153.4.16", 6101); Connection connection = new TcpConnection("10.153.4.16", 6101);
// Connection connection = new TcpConnection("192.168.101.100", 9100);
connection.open(); connection.open();
for (PrintVo printVo : printVos) { for (PrintVo printVo : printVos) {
printer = ZebraPrinterFactory.getInstance(connection); printer = ZebraPrinterFactory.getInstance(connection);
...@@ -312,6 +314,18 @@ public class RfidServiceImpl implements RfidService { ...@@ -312,6 +314,18 @@ public class RfidServiceImpl implements RfidService {
return rfidPrintVos; return rfidPrintVos;
} }
@Override
public void printByQRcode(List<QRCodePrintVo> qrCodePrintVos) {
if (!qrCodePrintVos.isEmpty()){
throw new ApiException("打印列表为空");
}
qrCodePrintVos.forEach(qrCodePrintVo ->{
BufferedImage bufferedImage = DrawImageUtil.drawImage(qrCodePrintVo.getDeviceId(),
qrCodePrintVo.getModel(),qrCodePrintVo.getName(),qrCodePrintVo.getSeqNumber());
PrinterUtil.execute(Image2Zpl.image2Zpl(bufferedImage));
});
}
/** /**
* 描述:生成装备的RFID表面号 * 描述:生成装备的RFID表面号
* *
......
package com.tykj.dev.rfid.utils;
import com.google.zxing.*;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
/**
* 条形码生成工具
*/
public class BarCodeUtil {
/**
* 保存格式
*/
private static String format = "png";
/**
* 生成条形码图片文件
*/
public static void createBarCodeImgFile(String text, Integer width, Integer height, String barPath) {
try {
Map<EncodeHintType, Object> hints = getDecodeHintType();
BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.CODE_128, width, height, hints);
File file = new File(barPath);
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
ImageIO.write(image, format, file);
MatrixToImageWriter.writeToFile(bitMatrix, format, file);
} catch (WriterException | IOException e) {
e.printStackTrace();
}
}
/**
* 生成条形码图片对象
*/
public static BufferedImage createBarCodeImg(String text, Integer width, Integer height) {
try {
Map<EncodeHintType, Object> hints = getDecodeHintType();
BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.CODE_128, width, height, hints);
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
image.setRGB(x, y, rgb(bitMatrix.get(x, y)));
}
}
return image;
} catch (WriterException e) {
e.printStackTrace();
}
return null;
}
/**
* 生成条形码输出流
*/
private static void createBarCode(String text, Integer width, Integer height, OutputStream out) {
try {
Map<EncodeHintType, Object> hints = getDecodeHintType();
BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.CODE_128, width, height, hints);
MatrixToImageWriter.writeToStream(bitMatrix, format, out);
} catch (WriterException | IOException e) {
e.printStackTrace();
}
}
/**
* 针对条形码进行解析
*/
public static String decodeBar(String imgPath) {
BufferedImage image;
Result result;
try {
image = ImageIO.read(new File(imgPath));
if (image == null) {
System.out.println("the decode image may be not exit.");
}
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
result = new MultiFormatReader().decode(bitmap, null);
System.out.println(result.getText());
return result.getText();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 二维码的格式参数
*/
private static Map<EncodeHintType, Object> getDecodeHintType() {
// 用于设置QR二维码参数
Map<EncodeHintType, Object> hints = new HashMap<>();
//设置QR二维码的纠错级别(H为最高级别)具体级别信息
//二维码容错率 L = ~7% /M = ~15% /Q = ~25% /H = ~30% 容错率越高,二维码的有效像素点就越多
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
//白边大小,取值范围0~4
Integer margin = 1;
hints.put(EncodeHintType.MARGIN, margin);
// 设置编码方式
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
return hints;
}
private static Integer rgb(boolean point) {
return point ? 0 : 16777215;
}
}
package com.tykj.dev.rfid.utils;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* 完整标签生成工具
*/
public class DrawImageUtil {
private static Integer width = 300;
private static Integer height = 200;
public static BufferedImage drawImage(Integer id, String string1, String string2, String string3) {
//创建图片对象
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
//基于图片对象打开绘图
Graphics2D graphics = image.createGraphics();
//绘图逻辑 START (基于业务逻辑进行绘图处理)
graphics.setBackground(Color.WHITE);
graphics.setColor(Color.BLACK);
graphics.clearRect(0, 0, width, height);
//偏移量
int offsetX = 20;
int offsetY = 40;
//留白率 例如40就是留白1/40
int blankRange = 40;
//计算条形码尺寸
Integer barCodeWidth = width - (width / blankRange) * 2;//320
Integer barCodeHeight = (height - offsetY) / 5;//32
//计算字体尺寸
int fontSize = Math.min(((height - offsetY) / 5), (width - width / blankRange - offsetX) / maxLength(string1, string2, string3));
graphics.setFont(new Font("Default", Font.BOLD, fontSize));
//写入条形码
graphics.drawImage(BarCodeUtil.createBarCodeImg(String.valueOf(id), barCodeWidth, barCodeHeight), null, width / blankRange, offsetY + height / blankRange);
//写入字体
graphics.drawString(string1, offsetX + width / blankRange, barCodeHeight + offsetY + (fontSize + fontSize / 10));
graphics.drawString(string2, offsetX + width / blankRange, barCodeHeight + offsetY + 2 * (fontSize + fontSize / 10));
graphics.drawString(string3, offsetX + width / blankRange, barCodeHeight + offsetY + 3 * (fontSize + fontSize / 10));
image.flush();
return image;
}
public static void writeImage(BufferedImage bufferedImage, String path) {
try {
ImageIO.write(bufferedImage, "png", new File(path));
} catch (IOException e) {
e.printStackTrace();
}
}
private static int maxLength(String string1, String string2, String string3) {
int max;
max = string1.length();
if (string2.length() > string1.length()) {
max = string2.length();
}
if (string3.length() > string2.length()) {
max = string3.length();
}
return max;
}
}
package com.tykj.dev.rfid.utils;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.File;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 转换器工具:将图片对象转换为ZPL码 用于打印
*
* 在 erp中单独使用
* 实现思路:
* 1、获取图片的二值化字节数组 这一步是关键
* 2、将字节数组转为十六进制
* 3、压缩十六进制字符串 结尾为1、0或者与上一行相同的;相同的连续字符压缩
* 4、拼凑ZPL编码,宽度需要扩大,因为需要时8个点(1字节)的整数倍
* Created by guzy on 17/11/12.
*/
public class Image2Zpl {
static Pattern ZEROS = Pattern.compile("0+$"), ONES = Pattern.compile("1+$"), MULTI_W = Pattern.compile("([0-9A-Z])\\1{2,}");
public static void main(String[] args) throws IOException {
BufferedImage read = ImageIO.read(new File("test.png"));
System.out.println(image2Zpl(read));
}
public static String image2Zpl(BufferedImage image) {
//获取图片的字节数组
DataBufferByte data = (DataBufferByte) getBinaryGrayImage(image).getRaster().getDataBuffer();
byte[] imgData = data.getData();
int newW = (image.getWidth() + 7) / 8;//实际每行字节大小,8个点,每个点1位,共8位
String[] strs = byte2HexStr(imgData, newW);
int bytes = imgData.length;
return String.format("^XA^GFA,%d,%d,%d,%s^FS^XZ", bytes, bytes, newW, compress(strs));
}
/**
* 获取二值化图,并取反
*
* @param srcImage
* @return
*/
private static BufferedImage getBinaryGrayImage(BufferedImage srcImage) {
BufferedImage dstImage = new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), BufferedImage.TYPE_BYTE_BINARY);
dstImage.getGraphics().drawImage(srcImage, 0, 0, null);
for (int y = 0; y < dstImage.getHeight(); y++) {
for (int x = 0; x < dstImage.getWidth(); x++) {
Color color = new Color(dstImage.getRGB(x, y));
//获取该点的像素的RGB的颜色
Color newColor = new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue());
dstImage.setRGB(x, y, newColor.getRGB());
}
}
return dstImage;
}
/**
* 压缩图片数据
*
* @param data
* @return
*/
private static String compress(String[] data) {
StringBuilder sb = new StringBuilder();
String pre = null;
for (String d : data) {
String a = d;
Matcher m = ZEROS.matcher(a);
if (m.find()) {
a = m.replaceFirst(",");
}
m = ONES.matcher(a);
if (m.find()) {
a = m.replaceFirst("!");
}
a = minimizeSameWord(a);
if (pre != null && a.equals(pre)) {
a = ":";
} else {
pre = a;
}
sb.append(a);
}
return sb.toString();
}
/**
* 十六进制串中相同字母压缩
*
* @param str
* @return
*/
private static String minimizeSameWord(String str) {
Matcher matcher = MULTI_W.matcher(str);
while (matcher.find()) {
String group = matcher.group();
int len = group.length();
String c = "";
if (len > 20) {
c = Character.toString((char) ('f' + len / 20));
}
if (len % 20 > 0) {
c = c + Character.toString((char) ('F' + len % 20));
}
str = str.replaceFirst(group, c + group.charAt(0));
}
return str;
}
/**
* 字节数组转为十六进制
*
* @param b
* @param rowSize
* @return
*/
private static String[] byte2HexStr(byte[] b, int rowSize) {
int len = b.length / rowSize;
String[] arr = new String[len];
for (int n = 0; n < len; n++) {
StringBuffer hs = new StringBuffer();
for (int j = 0; j < rowSize; j++) {
String stmp = Integer.toHexString(b[n * rowSize + j] & 0XFF);
if (stmp.length() == 1) hs.append("0");
hs.append(stmp);
}
arr[n] = hs.toString().toUpperCase();
}
return arr;
}
}
package com.tykj.dev.rfid.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetSocketAddress;
import java.net.Socket;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
/**
* 打印机工具 调用打印机并传输ZPL码 打印图片
*/
public class PrinterUtil {
private static String address = "192.168.101.100";
private static int portNumber = 9100;
private static Socket socket = null;
private static PrintWriter printWriter;
private static BufferedReader bufferedReader;
private static void connect() {
if (isNull(socket)) {
try {
socket = new Socket(address, portNumber);
} catch (IOException e) {
e.printStackTrace();
}
}
if (nonNull(socket) && !socket.isConnected()) {
try {
socket.connect(new InetSocketAddress(address, portNumber));
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void execute(String code) {
connect();
try {
bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
printWriter = new PrintWriter(socket.getOutputStream());
printWriter.println(
code
);
printWriter.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void close() {
if (nonNull(socket)) {
try {
socket.close();
printWriter.close();
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
...@@ -703,8 +703,12 @@ public class SelfCheckController { ...@@ -703,8 +703,12 @@ public class SelfCheckController {
if (allByBillAndBusinessTypeAndOwnUnit.size()>0){ if (allByBillAndBusinessTypeAndOwnUnit.size()>0){
for (Task task : allByBillAndBusinessTypeAndOwnUnit) { for (Task task : allByBillAndBusinessTypeAndOwnUnit) {
taskService.moveToArchive(task.parse2Bto()); taskService.moveToArchive(task.parse2Bto());
//删除 SelfCheckBill selfCheckBill = selfCheckBillService.getOne(task.getBillId());
selfCheckBillService.delete(task.getBillId()); if (selfCheckBill !=null){
//删除
selfCheckBillService.delete(task.getBillId());
}
} }
} }
} }
......
...@@ -47,6 +47,7 @@ import java.time.LocalDateTime; ...@@ -47,6 +47,7 @@ import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -643,7 +644,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -643,7 +644,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setRepelId(deviceRepel1.getId()); deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1); deviceRepelDetail.setRepelStatus(1);
TaskBto taskBto = cityInitiateTask(unitsFather.getUnitId(), deviceRepel1.getId(), deviceRepel.getTitle(), userId); TaskBto taskBto = cityInitiateTask(unitsFather.getUnitId(), deviceRepel1.getId(), deviceRepel.getTitle(), userId);
addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), user.getName() + "发起清退任务[" + deviceRepel1.getTitle() + "]", gainThisUser(userId, units.getUnitId()))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "发起 清退出库:"+toMessageCount(deviceRepelDetail.getScriptJson(),deviceRepelDetail.getSendUnit()), gainThisUser(userId, units.getUnitId())));
} }
...@@ -850,7 +851,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -850,7 +851,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1209, 0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1209, 0);
DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
waitingReceiptsTask(orderOutData.getSendUnitId(), deviceRepelDetail.getId(), taskBto.getId(), taskBto.getTitle(), userId); waitingReceiptsTask(orderOutData.getSendUnitId(), deviceRepelDetail.getId(), taskBto.getId(), taskBto.getTitle(), userId);
addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "清退设备出库完成", gainThisUser(userId, user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "发起 清退出库:"+toMessageCount(deviceRepelDetail.getScriptJson(),deviceRepelDetail.getSendUnit()), gainThisUser(userId, user.getUnitsId())));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()), deviceRepelDetail.getSendUnit() + "装备清退出库" + ",等待接收", userId, taskBto.getId()); devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()), deviceRepelDetail.getSendUnit() + "装备清退出库" + ",等待接收", userId, taskBto.getId());
orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds())); orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
//把一些字段填写到对象中,保存入库 //把一些字段填写到对象中,保存入库
...@@ -1009,7 +1010,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1009,7 +1010,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId)); taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId));
taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId)); taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()), "签收" + deviceRepelDetail.getSendUnit() + "清退的设备", storageDeviceRepel.getUserId(), taskBto.getId()); devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()), "签收" + deviceRepelDetail.getSendUnit() + "清退的设备", storageDeviceRepel.getUserId(), taskBto.getId());
addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "签收" + deviceRepelDetail.getSendUnit() + "清退的设备", findUnitIds(user.getUserId(), unitIds))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "办结 清退业务:"+toMessageCount(deviceRepelDetail.getScriptJson(),deviceRepelDetail.getSendUnit()), findUnitIds(user.getUserId(), unitIds)));
} else { } else {
if (storageDeviceRepel.getIsIgnore() == null) { if (storageDeviceRepel.getIsIgnore() == null) {
List<StatusEnum> enumList = new ArrayList<>(); List<StatusEnum> enumList = new ArrayList<>();
...@@ -1047,7 +1048,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1047,7 +1048,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
FileRet fileRet = pdfService.billPdf(documents); FileRet fileRet = pdfService.billPdf(documents);
deviceRepelDetail.setOutboundFile(JacksonUtil.toJSon(fileRet)); deviceRepelDetail.setOutboundFile(JacksonUtil.toJSon(fileRet));
deviceRepelDetail.setSendFiles(JacksonUtil.toJSon(fileRet)); deviceRepelDetail.setSendFiles(JacksonUtil.toJSon(fileRet));
addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "签收" + deviceRepelDetail.getSendUnit() + "清退的设备", findUnitIds(user.getUserId(), unitIds))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "接收 清退业务:"+toMessageCount(deviceRepelDetail.getScriptJson(),deviceRepelDetail.getSendUnit()), findUnitIds(user.getUserId(), unitIds)));
} }
} }
deviceRepelDetail.setReceiveTime(new Date()); deviceRepelDetail.setReceiveTime(new Date());
...@@ -1197,7 +1198,21 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1197,7 +1198,21 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
List<Integer> unitIds = new ArrayList<>(); List<Integer> unitIds = new ArrayList<>();
unitIds.add(deviceRepelDetail.getSendUnitId()); unitIds.add(deviceRepelDetail.getSendUnitId());
unitIds.add(deviceRepelDetail.getReceiveUnitId()); unitIds.add(deviceRepelDetail.getReceiveUnitId());
addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "装备清退任务,出库方上传了回执单据任务结束", findUnitIds(storageDeviceRepel.getUserId(), unitIds))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "办结 清退业务:"+toMessageCount(deviceRepelDetail.getScriptJson(),deviceRepelDetail.getSendUnit()), findUnitIds(storageDeviceRepel.getUserId(), unitIds)));
}
private String toMessageCount(String json,String unitName){
List<ScriptSaveVo> scriptSaveVoList=JacksonUtil.readValue(json, new TypeReference<List<ScriptSaveVo>>() {
});
Set<String> strings=new HashSet<>();
AtomicInteger count = new AtomicInteger();
scriptSaveVoList.forEach(
scriptSaveVo -> {
strings.add(scriptSaveVo.getModel());
count.set(count.get() + scriptSaveVo.getNum());
}
);
return MessageFormatUtil.spellUnitAndModelAndCount(unitName,strings,count.get());
} }
......
...@@ -9,7 +9,9 @@ import com.tykj.dev.device.library.service.DeviceLibraryService; ...@@ -9,7 +9,9 @@ import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo; import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao; import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo;
import com.tykj.dev.device.packing.repository.PackingLibraryDao; import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.selfcheck.base.SelfCheckSchedulerTask; import com.tykj.dev.device.selfcheck.base.SelfCheckSchedulerTask;
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao; import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
...@@ -511,6 +513,9 @@ public class StatisticalServiceImpl implements StatisticalService { ...@@ -511,6 +513,9 @@ public class StatisticalServiceImpl implements StatisticalService {
@Autowired @Autowired
private AreaService areaService; private AreaService areaService;
@Autowired
private MatchingDeviceLibraryService matchingDeviceLibraryService;
@Override @Override
public WorkBench getWorkBenchStat() { public WorkBench getWorkBenchStat() {
Integer unit = userUtils.getCurrentUnitId(); Integer unit = userUtils.getCurrentUnitId();
...@@ -524,10 +529,22 @@ public class StatisticalServiceImpl implements StatisticalService { ...@@ -524,10 +529,22 @@ public class StatisticalServiceImpl implements StatisticalService {
workBench.setAllDeviceNum(deviceLibraries.size()); workBench.setAllDeviceNum(deviceLibraries.size());
workBench.setSelfDeviceNum(Long.valueOf(deviceLibraries.stream().filter(deviceLibrary -> workBench.setSelfDeviceNum(Long.valueOf(deviceLibraries.stream().filter(deviceLibrary ->
deviceLibrary.getOwnUnit().equals(unitName)).count()).intValue()); deviceLibrary.getOwnUnit().equals(unitName)).count()).intValue());
//查询当前登录单位的配套设备 //查询当前登录单位的配套设备 以及下级所有单位
List<MatchingDeviceLibrary> allByCreateUnitId = matchingDeviceLibraryDao.findAllByCreateUnitId(unit);
if (!allByCreateUnitId.isEmpty()){ // List<MatchingDeviceLibrary> allByCreateUnitId = matchingDeviceLibraryDao.findAllByCreateUnitId(unit);
workBench.setMatchingDeviceNum(allByCreateUnitId.size()); // if (!allByCreateUnitId.isEmpty()){
// workBench.setMatchingDeviceNum(allByCreateUnitId.size());
// }else {
// workBench.setMatchingDeviceNum(0);
// }
MatchingDeviceSelectVo matchingDeviceSelectVo = new MatchingDeviceSelectVo();
//通过单位id查询区域id
Integer currentUnitId = userUtils.getCurrentUnitId();
Units units = unitsService.findById(currentUnitId);
matchingDeviceSelectVo.setAreaId(units.getAreaId());
List<MatchingDeviceLibrary> matchingDevicePage = matchingDeviceLibraryService.getMatchingDevicePage(matchingDeviceSelectVo);
if (!matchingDevicePage.isEmpty()){
workBench.setMatchingDeviceNum(matchingDevicePage.size());
}else { }else {
workBench.setMatchingDeviceNum(0); workBench.setMatchingDeviceNum(0);
} }
......
...@@ -20,8 +20,11 @@ import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao; ...@@ -20,8 +20,11 @@ import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill; import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.user.subject.dao.UnitsDao; import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.Units; import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.util.AuthenticationUtils;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.device.usereport.repository.DeviceUseReportDao; import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport; import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import com.tykj.dev.misc.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
...@@ -63,6 +66,15 @@ public class DataInit { ...@@ -63,6 +66,15 @@ public class DataInit {
@Autowired @Autowired
private MatchingDeviceLibraryDao matchingDeviceLibraryDao; private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
@Autowired
private UserUtils userUtils;
@Autowired
private SpringUtils springUtils;
@Autowired
private com.tykj.dev.device.user.util.AuthenticationUtils AuthenticationUtils;
private void initCheckDetailUnitName() { private void initCheckDetailUnitName() {
// 对现有的数据补充unitId信息 // 对现有的数据补充unitId信息
allotBillDao.findAll().forEach(this::saveModifyDetail1); allotBillDao.findAll().forEach(this::saveModifyDetail1);
...@@ -221,6 +233,7 @@ public class DataInit { ...@@ -221,6 +233,7 @@ public class DataInit {
// @Bean // @Bean
// @DependsOn("userUtils") // @DependsOn("userUtils")
@PostConstruct
public void init2(){ public void init2(){
log.info("单位名称初始化-----"); log.info("单位名称初始化-----");
initCheckDetailUnitName(); initCheckDetailUnitName();
......
...@@ -332,11 +332,11 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -332,11 +332,11 @@ public class UnitsServiceImpl implements UnitsService {
leftNavigation = belongsArea.toLeftNavigation(); leftNavigation = belongsArea.toLeftNavigation();
LeftNavigation units = securityUser.getCurrentUserInfo().getUnits().toLeftNavigation(); LeftNavigation units = securityUser.getCurrentUserInfo().getUnits().toLeftNavigation();
List<LeftNavigation> leftNavigationList1 = new ArrayList<>(); List<LeftNavigation> leftNavigationList1 = new ArrayList<>();
systemConfigService.getStorageLocationMap().forEach( // systemConfigService.getStorageLocationMap().forEach(
(k, v) -> { // (k, v) -> {
leftNavigationList1.add(new LeftNavigation(0, v, null, v, 3, k, units.getId())); // leftNavigationList1.add(new LeftNavigation(0, v, null, v, 3, k, units.getId()));
} // }
); // );
units.setLeftNavigations(leftNavigationList1.stream().sorted(Comparator.comparing(LeftNavigation::getOrder, Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList())); units.setLeftNavigations(leftNavigationList1.stream().sorted(Comparator.comparing(LeftNavigation::getOrder, Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()));
leftNavigationList.add(units); leftNavigationList.add(units);
//把省直属组合一下 直属单位(type=2) 处室单位(type=4) //把省直属组合一下 直属单位(type=2) 处室单位(type=4)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论