提交 1c9acb5b authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 6d3dfc57
......@@ -14,6 +14,8 @@ import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
......@@ -113,6 +115,9 @@ public class AllotBillController {
@Autowired
private TaskDao taskDao;
@Autowired
private PackingLibraryService packingLibraryService;
@ApiOperation(value = "导入二维码获取配发装备", notes = "可以通过这个接口导入二维码获取配发装备")
@PostMapping(value = "/load")
public ResponseEntity loadDevice(@RequestBody RfidVo rfidVo) {
......@@ -177,7 +182,7 @@ public class AllotBillController {
userIds.add(0);
TaskBto saveEntity;
//纵向
if (allotBillSaveVo.getAllotType()==2) {
if (allotBillSaveVo.getAllotType()==1) {
if (allotBillSaveVo.getTaskId() == null) {
TaskBto taskBto = new TaskBto(StatusEnum.ALLOTING.id, "配发业务", null, ".", billId, 3, userPublicService.findUnitIdByName(allotBillSaveVo.getReceiveUnit()), 1, null, userIds);
saveEntity = taskService.start(taskBto);
......@@ -201,28 +206,59 @@ public class AllotBillController {
//存装备日志
String[] strings = deviceIdDetail.split("x");
List<Integer> ids = new ArrayList<>();
//横纵向列装转换map
Map<Integer,Integer> changeMap = new HashMap<>();
for (String s : strings) {
if (s.length() >= 2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
ids.add(id);
//改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
// PackingLibrary packingLibrary =
if (allotBillSaveVo.getAllotType() == 2){
// if (deviceLibraryEntity.getAllotType()!=2){
if (allotBillSaveVo.getAllotType() == 1){
if (deviceLibraryEntity.getMatchingRange()!=1){
PackingLibrary packingLibrary = packingLibraryService.getOne(deviceLibraryEntity.getPackingId());
PackingLibrary packingLibrary1 = packingLibraryService.findSamePacking(packingLibrary.getPartParentId(),1);
if (packingLibrary1==null){
Map<String,Object> map = new HashMap<>();
map.put("error","序列号为"+deviceLibraryEntity.getSeqNumber()+"的装备所属列装不存在配用范围为省对下纵向的列装装备");
return ResponseEntity.ok(map);
}
else {
deviceLibraryEntity.setPackingId(packingLibrary1.getId());
deviceLibraryEntity.setMatchingRange(1);
}
// deviceLibraryEntity.setAllotType(2);
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(2), fileVoList);
// deviceLogService.addLog(deviceLogDto);
// }
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "纵向配发将配发类型由" + deviceLibraryEntity.getMatchingRangeName() + "改为"+configCache.getMatchingRangeMap().get(1), fileVoList);
deviceLogService.addLog(deviceLogDto);
}
deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0);
}
else {
// if (deviceLibraryEntity.getAllotType()!=1){
if (deviceLibraryEntity.getMatchingRange()!=3){
if (changeMap.get(deviceLibraryEntity.getPackingId())!=null){
deviceLibraryEntity.setPackingId(changeMap.get(deviceLibraryEntity.getPackingId()));
deviceLibraryEntity.setMatchingRange(3);
}
else {
PackingLibrary packingLibrary = packingLibraryService.getOne(deviceLibraryEntity.getPackingId());
PackingLibrary packingLibrary1 = packingLibraryService.findSamePacking(packingLibrary.getPartParentId(), 3);
if (packingLibrary1 == null) {
Map<String, Object> map = new HashMap<>();
map.put("error", "序列号为" + deviceLibraryEntity.getSeqNumber() + "的装备所属列装不存在配用范围为省对下横向的列装装备");
return ResponseEntity.ok(map);
}
else {
changeMap.put(deviceLibraryEntity.getPackingId(),packingLibrary1.getId());
changeMap.put(packingLibrary1.getId(),deviceLibraryEntity.getPackingId());
deviceLibraryEntity.setPackingId(packingLibrary1.getId());
deviceLibraryEntity.setMatchingRange(3);
}
}
// deviceLibraryEntity.setAllotType(1);
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "将配发类型由" + deviceLibraryEntity.getAllotTypeName() + "改为"+configCache.getAllotTypeMap().get(1), fileVoList);
// deviceLogService.addLog(deviceLogDto);
// }
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "横向配发将配发类型由" + deviceLibraryEntity.getMatchingRangeName() + "改为"+configCache.getMatchingRangeMap().get(3), fileVoList);
deviceLogService.addLog(deviceLogDto);
}
deviceLibraryEntity.setLocationUnit(allotBillSaveVo.getReceiveUnit());
deviceLibraryEntity.setOwnUnit(allotBillSaveVo.getReceiveUnit());
}
......@@ -235,7 +271,7 @@ public class AllotBillController {
inputOutputDeviceService.addWhiteDevices(ids, userUtils.getCurrentUnitId(), 1);
//发送阅知信息
List<Integer> idList = userPublicService.findOtherUser(userId);
if (allotBillSaveVo.getAllotType()==2) {
if (allotBillSaveVo.getAllotType()==1) {
idList.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBillEntity.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
......@@ -618,6 +654,11 @@ public class AllotBillController {
allotBill.setSendUserbId(fileUploadVo.getSendUserbId());
allotBill.setAgent(userPublicService.getOne(fileUploadVo.getSendUserbId()).getName());
}
if (fileUploadVo.getReceiveUserbId()!=null){
allotBill.setReceiveUserbId(fileUploadVo.getReceiveUserbId());
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", Collections.singletonList(fileUploadVo.getReceiveUserbId()), 1);
messageService.add(messageBto);
}
List<FileVo> fileVoList = new ArrayList<>();
if (fileUploadVo.getReceiveFiles()!=null&&fileUploadVo.getReceiveFiles().size()>0){
fileUploadVo.getReceiveFiles().forEach(fileRet -> {
......@@ -671,6 +712,14 @@ public class AllotBillController {
allotBill.setReceiveUserbId(fileVo.getReceiveUserbId());
idList.add(fileVo.getReceiveUserbId());
}
if (fileVo.getSendUserbId()!=null){
allotBill.setSendUserbId(fileVo.getSendUserbId());
allotBill.setAgent(userPublicService.getOne(fileVo.getSendUserbId()).getName());
List<Integer> idList1 = new ArrayList<>();
idList1.add(fileVo.getSendUserbId());
MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为签发人", idList1, 1);
messageService.add(messageBto);
}
//保存账单
allotBill.setSendFiles(FilesUtil.stringFileToList(fileVo.getAllotFiles()));
allotBill.setAllotStatus(5);
......
......@@ -36,6 +36,9 @@ public class FileUploadVo {
@ApiModelProperty(value = "接收单位B岗")
private Integer sendUserbId;
@ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId;
@ApiModelProperty(value = "接收方配发单")
private List<FileRet> receiveFiles;
}
......@@ -33,4 +33,7 @@ public class FileVo {
@ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId;
@ApiModelProperty(value = "接收单位B岗")
private Integer sendUserbId;
}
package com.tykj.dev.device.apply.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
......@@ -111,6 +112,14 @@ public class DeviceApplyController {
@PostMapping("/addDeviceApplyBill")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity addDeviceApplyBill(@RequestBody @Validated DeviceApplySaveVo deviceApplySaveVo) {
if (deviceApplySaveVo.getApplyType()!=1) {
for (ApplyBillDetailVo applyBillDetailVo : deviceApplySaveVo.getStorageBillDetailVoList()) {
ResponseEntity responseEntity = packingController.seqsExist(applyBillDetailVo.getPackingId(), applyBillDetailVo.getStorageCount(), applyBillDetailVo.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())) {
return responseEntity;
}
}
}
//添加申请单
DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.addEntity(deviceApplySaveVo.toDo());
Integer userId = userUtils.getCurrentUserId();
......@@ -137,6 +146,7 @@ public class DeviceApplyController {
userIds.add(userId);
userIds.add(0);
taskBto = new TaskBto(StatusEnum.WAIT_APPLY_FILE.id, title, null, ".", deviceApplyBillEntity.getId(), 9,userUtils.getCurrentUnitId(), 1, "country", userIds);
taskBto.setRemark(title);
}
else {
//指定批复人
......@@ -180,7 +190,7 @@ public class DeviceApplyController {
messageService.add(messageBto);
log.info("[申请模块]:"+message);
myWebSocket.sendMessage1();
return ResponseEntity.ok(deviceApplyBillEntity);
return ResponseEntity.ok("ok");
}
@ApiOperation(value = "装备申请批复", notes = "可以通过这个接口批复")
......@@ -396,11 +406,13 @@ public class DeviceApplyController {
@PostMapping("/uploadFile")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity uploadFile(@RequestBody @Validated UploadApplyFile uploadApplyFile) {
for(ReplyVo replyVo:uploadApplyFile.getReplyVos()){
ResponseEntity responseEntity = packingController.seqsExist(replyVo.getId(),replyVo.getNum(),replyVo.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())){
if (uploadApplyFile.getReplyVos()!=null&&uploadApplyFile.getReplyVos().size()>0) {
for (ReplyVo replyVo : uploadApplyFile.getReplyVos()) {
ResponseEntity responseEntity = packingController.seqsExist(replyVo.getId(), replyVo.getNum(), replyVo.getSeqInterval());
if (!"ok".equals(responseEntity.getBody())) {
return responseEntity;
}
}
}
TaskBto taskBto = taskService.get(uploadApplyFile.getTaskId());
taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
......@@ -433,4 +445,36 @@ public class DeviceApplyController {
deviceApplyBillService.update(deviceApplyBill);
return ResponseEntity.ok("确认成功");
}
@ApiOperation(value = "判断申请业务是否清退完成", notes = "判断申请业务是否清退完成")
@GetMapping("/sendBackOver/{id}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity sendBackOver(@PathVariable("id") int taskId) {
TaskBto taskBto = taskService.get(taskId);
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
List<ReplyVo> replyVos = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBill.getReplyVos(), new TypeReference<List<ReplyVo>>() {
}));
List<String> seqs= new ArrayList<>();
for (ReplyVo replyVo : replyVos){
seqs.addAll(DeviceSeqUtil.selectDeviceSeqs(replyVo.getSeqInterval()));
}
Set<Integer> lifeStatus = deviceLibraryService.findAllBySeqNumber(seqs).stream().map(DeviceLibrary::getLifeStatus).collect(Collectors.toSet());
Set<Integer> integers = new HashSet<>();
integers.add(11);
if (deviceApplyBill.getApplyType()==2) {
integers.add(15);
}
if (deviceApplyBill.getApplyType()==3){
integers.add(17);
}
if (deviceApplyBill.getApplyType()==4){
integers.add(19);
}
if (integers.containsAll(lifeStatus)){
return ResponseEntity.ok(true);
}
else {
return ResponseEntity.ok(false);
}
}
}
......@@ -8,7 +8,7 @@ import lombok.Data;
* @author dengdiyi
*/
@Data
@ApiModel("入库详情类")
@ApiModel("申请详情类")
public class ApplyBillDetailVo {
// @NotNull(message = "packingId不能为空")
......@@ -23,4 +23,7 @@ public class ApplyBillDetailVo {
@ApiModelProperty(value = "已入库数量")
private Integer completeCount = 0;
@ApiModelProperty(value = "序列号区间", example = "1")
private String seqInterval;
}
......@@ -14,6 +14,7 @@ import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -87,6 +88,17 @@ public class DeviceApplySaveVo {
}
if (this.storageBillDetailVoList!=null){
deviceApplyBillEntity.setApplyStat(JacksonUtil.toJSon(this.storageBillDetailVoList));
if (this.applyType!=1){
List<ReplyVo> replyVos = new ArrayList<>();
for (ApplyBillDetailVo applyBillDetailVo : storageBillDetailVoList){
ReplyVo replyVo = new ReplyVo();
replyVo.setId(applyBillDetailVo.getPackingId());
replyVo.setNum(applyBillDetailVo.getStorageCount());
replyVo.setSeqInterval(applyBillDetailVo.getSeqInterval());
replyVos.add(replyVo);
}
deviceApplyBillEntity.setReplyVos(JacksonUtil.toJSon(replyVos));
}
}
deviceApplyBillEntity.setApplyDetail(stringBuffer.toString());
if(this.applyFiles!=null&&this.applyFiles.size()>0){
......
......@@ -104,7 +104,7 @@ public enum LogType {
REPAIR_BACK_6(42,REPAIR_BACK.id, WAIT_UPLOAD_BACK_SEND_FILE.id, ARCHIVE.id, "取消上传领取单"),
RETIRED_1(43,RETIRED.id, ORIGIN_STATUS.id, RETIRED_BUSINESS_NEED_CONFIRM.id, "发起退装"),
RETIRED_1(43,RETIRED.id, ORIGIN_STATUS.id, END.id, "发起退装"),
RETIRED_2(44,RETIRED.id,RETIRED_BUSINESS_NEED_CONFIRM.id, END.id, "退装审核成功"),
......
......@@ -15,15 +15,15 @@ public enum MatchingRange {
*/
MATCHINGRANGE_2(2, "中央到省"),
/**
* 省下纵向
* 省下纵向
*/
PROVINCIAL_VERTICAL(1, "省以下纵向"),
/**
* 省横向
* 省以下横向
*/
MATCHINGRANGE_3(3, "省以下横向"),
/**
* 省对下
* 其它
*/
MATCHINGRANGE_4(4, "其它");
......
......@@ -38,7 +38,6 @@ public interface DeviceLibraryService {
/**
* @param deviceLibrarySelectVo 装备查询vo
* @param pageable 获取核心装备分页
*/
List<DeviceLibrary> getCoreDevicePage(DeviceLibrarySelectVo deviceLibrarySelectVo);
......
......@@ -29,6 +29,8 @@ public class DeviceVo {
private Integer allotType;
private Integer matchingRange;
/**
* 型号
*/
......
......@@ -18,4 +18,6 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer
PackingLibrary findByShowOrder(Integer showOrder);
List<PackingLibrary> findAllByIsRootAndPackingStatus(Integer isRoot,Integer packingStatus);
List<PackingLibrary> findAllByPartParentIdAndMatchingRange(Integer partParentId,Integer matchingRange);
}
......@@ -97,10 +97,16 @@ public interface PackingLibraryService {
/**
* @param id 列装主键id
* 通过id逻辑删除该列装以及所有子列装
* 通过id退装该列装以及所有子列装
*/
void deleteAll(Integer id);
/**
* @param ids 列装主键id列表
* 通过id将退装装备恢复到列装
*/
void removeAll(List<Integer> ids);
/**
* 设置顺序的排序
*/
......@@ -131,4 +137,16 @@ public interface PackingLibraryService {
* 通过id修改该列装所有子列装型号
*/
void changeAllModel(Integer id,String model);
Boolean nameIsExist(String model,String name);
Boolean matchingRangeIsExist(Integer parentId,Integer matchingRange);
/**
* @param parentId 父列装id
* @param matchingRange 配用范围
* 查询对应横向或纵向列装
*/
PackingLibrary findSamePacking(Integer parentId,Integer matchingRange);
}
......@@ -290,6 +290,9 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
throw new ApiException(ResponseEntity.status(303).body("该列装型号已有装备,请进行退装操作"));
}
if (packingLibrary.getIsRoot()==1) {
if (packingLibraryDao.findAllByPartParentId(id).size()>0){
throw new ApiException(ResponseEntity.status(303).body("该列装型号目录下存在列装装备"));
}
Integer order = packingLibrary.getShowOrder();
getInsertList(new SelectPack()).forEach(packingLibrary1 -> {
if (packingLibrary1.getShowOrder() > order) {
......@@ -315,6 +318,29 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
messageService.add(messageBto);
}
/**
* @param ids 列装主键id列表
* 通过id将退装装备恢复到列装
*/
@Override
public void removeAll(List<Integer> ids) {
for (Integer id:ids){
PackingLibrary packingLibrary = getOne(id);
packingLibrary.setPackingStatus(2);
update(packingLibrary);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark("恢复列装");
packingLog.setPackingId(id);
packingLogService.add(packingLog);
}
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0,1,"恢复列装",userIds,0);
messageBto.setRecord(StringSplitUtil.idListToString(ids));
messageService.add(messageBto);
}
/**
* 设置顺序的排序
*/
......@@ -468,7 +494,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Override
public List<DeviceLibrary> getAllDevSeqs(Integer packingId) {
PredicateBuilder<DeviceLibrary> predicateBuilder = Specifications.and();
predicateBuilder.eq("ownUnit", userUtils.getCurrentUserUnitName());
// predicateBuilder.eq("ownUnit", userUtils.getCurrentUserUnitName());
predicateBuilder.eq("lifeStatus", 2);
predicateBuilder.eq("packingId", packingId);
return deviceLibraryDao.findAll(predicateBuilder.build());
......@@ -489,12 +515,51 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Override
public void changeAllModel(Integer id,String model) {
PackingLibrary packingLibrary = getOne(id);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark("将型号从"+packingLibrary.getModel()+"改为"+model);
packingLog.setPackingId(id);
packingLogService.add(packingLog);
packingLibrary.setModel(model);
update(packingLibrary);
List<Integer> ids = packingLibraryDao.findAllByPartParentId(id).stream().map(PackingLibrary::getId).collect(Collectors.toList());
ids.forEach(integer -> changeAllModel(integer,model));
}
@Override
public Boolean nameIsExist(String model, String name) {
PredicateBuilder<PackingLibrary> predicateBuilder = Specifications.and();
predicateBuilder.eq("isRoot", 0);
predicateBuilder.eq("model", model);
predicateBuilder.eq("name", name);
return packingLibraryDao.findAll(predicateBuilder.build()).size()>0;
}
@Override
public Boolean matchingRangeIsExist(Integer parentId,Integer matchingRange) {
PredicateBuilder<PackingLibrary> predicateBuilder = Specifications.and();
predicateBuilder.eq("isRoot", 0);
predicateBuilder.eq("partParentId", parentId);
predicateBuilder.eq("matchingRange", matchingRange);
return packingLibraryDao.findAll(predicateBuilder.build()).size()>0;
}
/**
* @param parentId 父列装id
* @param matchingRange 配用范围
* 查询对应横向或纵向列装
*/
@Override
public PackingLibrary findSamePacking(Integer parentId,Integer matchingRange) {
List<PackingLibrary> packingLibraries = packingLibraryDao.findAllByPartParentIdAndMatchingRange(parentId,matchingRange);
if (packingLibraries.isEmpty()){
return null;
}
else {
return packingLibraries.get(0);
}
}
private Specification<PackingLibrary> getSelectSpecification(PackingLibrarySelectVo packingLibrarySelectVo) {
PredicateBuilder<PackingLibrary> predicateBuilder = Specifications.and();
Integer level = userUtils.getCurrentUnitLevel();
......
package com.tykj.dev.device.packing.subject.vo;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author dengdiyi
*/
@Repository
@Data
@ApiModel("列装撤销类")
public class ConcleVo {
private List<PackingLibrary> packingLibraries;
private PackingLibrary packingLibrary1;
}
......@@ -8,7 +8,9 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.service.PackingLogService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.packing.subject.domin.PackingLog;
import com.tykj.dev.device.packing.subject.vo.PackingLibrarySelectVo;
import com.tykj.dev.device.retired.entity.domain.DeviceRetiredBill;
import com.tykj.dev.device.retired.entity.enums.RetiredStatus;
......@@ -17,6 +19,8 @@ import com.tykj.dev.device.retired.service.DeviceRetiredBillService;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.AuthenticationUtils;
......@@ -79,6 +83,12 @@ public class DeviceRetiredController {
@Autowired
private PackingLibraryDao packingLibraryDao;
@Autowired
private PackingLogService packingLogService;
@Autowired
private MessageService messageService;
public DeviceRetiredController(DeviceRetiredBillService deviceRetiredBillService, TaskService taskService, PackingLibraryService packingLibraryService, DeviceLibraryService deviceLibraryService, DeviceLogService deviceLogService, TaskLogService taskLogService) {
this.deviceRetiredBillService = deviceRetiredBillService;
this.taskService = taskService;
......@@ -116,11 +126,22 @@ public class DeviceRetiredController {
//改变列装状态
formVo.getPackings().forEach(integer -> {
PackingLibrary packingLibrary = packingLibraryService.getOne(integer);
packingLibrary.setPackingStatus(4);
packingLibrary.setPackingStatus(3);
packingLibrary.setExitTime(Timestamp.from(new Date().toInstant()));
packingLibraryService.update(packingLibrary);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark("设备退装");
packingLog.setPackingId(integer);
packingLogService.add(packingLog);
setSonsRetired(packingLibrary);
});
//生成Task
TaskBto task = taskService.start(initTaskBto(retiredBill));
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(task.getId(),task.getBusinessType(),"业务办结",userIds,0);
messageService.add(messageBto);
myWebSocket.sendMessage1();
return ResultUtil.success("退装申请成功");
}
......@@ -190,6 +211,11 @@ public class DeviceRetiredController {
packingLibrary1.setPackingStatus(3);
packingLibrary1.setExitTime(Timestamp.from(new Date().toInstant()));
packingLibraryService.update(packingLibrary1);
//添加列装日志
PackingLog packingLog = new PackingLog();
packingLog.setRemark("设备退装");
packingLog.setPackingId(packingLibrary1.getId());
packingLogService.add(packingLog);
setSonsRetired(packingLibrary1);
});
}
......@@ -247,18 +273,17 @@ public class DeviceRetiredController {
private TaskBto initTaskBto(DeviceRetiredBill retiredBill) {
//生成Task
TaskBto taskBto = new TaskBto(
StatusEnum.RETIRED_BUSINESS_NEED_CONFIRM.id,
return new TaskBto(
StatusEnum.END.id,
"退装业务",
0,
".",
retiredBill.getId(),
BusinessEnum.RETIRED.id,
userUtils.getCurrentUnitId(),
1,
0,
"",
ListUtil.createList(retiredBill.getUserAId(), retiredBill.getUserBId()));
return taskBto;
ListUtil.createList(retiredBill.getUserAId()));
}
}
......@@ -109,7 +109,7 @@ public class DeviceRetiredBill {
return new DeviceRetiredBill(
user.getUserId(),
formVo.getConfirmUserId(),
RetiredStatus.NEED_CONFIRM.getStatus(),
RetiredStatus.CONFIRM_SUCCESS.getStatus(),
packingListToString(formVo.getPackings())
);
}
......
......@@ -12,7 +12,9 @@ import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.selfcheck.base.SelfCheckSchedulerTask;
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.user.base.ret.UserSituationVo;
......@@ -24,6 +26,7 @@ import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.Area;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.rfid.entity.domin.LibraryWarningLog;
import com.tykj.dev.rfid.repository.LibraryWarningLogDao;
......@@ -86,6 +89,12 @@ public class StatisticalServiceImpl implements StatisticalService {
@Autowired
private PackingLibraryDao packingLibraryDao;
@Autowired
private TaskDao taskDao;
@Autowired
private UserUtils userUtils;
/**
* 获取装备统计信息
*/
......@@ -479,13 +488,22 @@ public class StatisticalServiceImpl implements StatisticalService {
*/
@Override
public WorkBench getWorkBenchStat() {
Integer unit = userUtils.getCurrentUnitId();
String unitName = userUtils.getCurrentUserUnitName();
WorkBench workBench = new WorkBench();
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
deviceLibrarySelectVo.setAreaId(areaCache.findByName("浙江省").getId());
workBench.setPackingNum(packingLibraryDao.findAllByIsRootAndPackingStatus(0,2).size());
workBench.setAllDeviceNum(deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo).size());
workBench.setSelfDeviceNum(deviceLibraryService.getCoreDevicePage(new DeviceLibrarySelectVo()).size());
List<DeviceLibrary> deviceLibraries = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo);
workBench.setAllDeviceNum(deviceLibraries.size());
workBench.setSelfDeviceNum(Long.valueOf(deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getOwnUnit().equals(unitName)).count()).intValue());
workBench.setMatchingDeviceNum(new Long(matchingDeviceLibraryDao.count()).intValue());
workBench.setDailyDeviceNum(Long.valueOf(deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getOwnUnit().equals(unitName)&&Arrays.asList(2,14).contains(deviceLibrary.getLifeStatus())).count()).intValue());
List<Task> tasks = taskDao.findAllByBusinessType(7);
workBench.setCheckNum(Long.valueOf(tasks.stream().filter(task -> "check".equals(task.getCustomInfo())).count()).intValue());
workBench.setCompleteCheckNum(Long.valueOf(tasks.stream().filter(task -> task.getBillStatus()==9999&&"check".equals(task.getCustomInfo())).count()).intValue());
workBench.setExamNum(Long.valueOf(tasks.stream().filter(task -> task.getParentTaskId()==0&&"exam".equals(task.getCustomInfo())&&task.getOwnUnit().equals(unit)).count()).intValue());
workBench.setExamCompleteNum(Long.valueOf(tasks.stream().filter(task -> task.getBillStatus()==9999&&task.getParentTaskId()==0&&"exam".equals(task.getCustomInfo())&&task.getOwnUnit().equals(unit)).count()).intValue());
return workBench;
}
......
......@@ -19,6 +19,8 @@ public class WorkBench {
private Integer selfDeviceNum;
private Integer dailyDeviceNum;
private Integer matchingDeviceNum;
private Integer checkNum = 0;
......
......@@ -307,25 +307,29 @@ public class StorageBillController {
if (deviceApplyBills.size()>0){
deviceApplyBills.forEach(deviceApplyBill -> {
List<ApplyBillDetailVo> applyBillDetailVos = deviceApplyBill.getApplyBillDetailVos();
boolean isEnd = true;
for (int i = 0;i<applyBillDetailVos.size();i++){
ApplyBillDetailVo applyBillDetailVo = applyBillDetailVos.get(i);
if (map.get(applyBillDetailVo.getPackingId())!=null){
applyBillDetailVo.setCompleteCount(map.get(applyBillDetailVo.getPackingId()).getCompleteCount());
applyBillDetailVos.set(i,applyBillDetailVo);
if (applyBillDetailVo.getStorageCount().equals(applyBillDetailVo.getCompleteCount())){
TaskBto taskBto1 = taskService.get(deviceApplyBill.getId(),9);
taskService.moveToEnd(taskBto1);
//发送阅知信息
MessageBto messageBto = new MessageBto();
messageBto.setContent("业务办结");
messageBto.setTaskId(taskBto1.getId());
messageBto.setIsHighLight(0);
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
messageBto.setBusinessType(taskBto1.getBusinessType());
messageService.add(messageBto);
if (!applyBillDetailVo.getStorageCount().equals(applyBillDetailVo.getCompleteCount())){
isEnd = false;
}
}
}
if (isEnd) {
TaskBto taskBto1 = taskService.get(deviceApplyBill.getId(), 9);
taskService.moveToEnd(taskBto1);
//发送阅知信息
MessageBto messageBto = new MessageBto();
messageBto.setContent("业务办结");
messageBto.setTaskId(taskBto1.getId());
messageBto.setIsHighLight(0);
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
messageBto.setBusinessType(taskBto1.getBusinessType());
messageService.add(messageBto);
}
deviceApplyBill.setApplyStat(JacksonUtil.toJSon(applyBillDetailVos));
deviceApplyBillService.update(deviceApplyBill);
});
......@@ -470,6 +474,7 @@ public class StorageBillController {
storageBillEntity.setReceiveUserA(userPublicService.getOne(storageBillEntity.getReceiveUseraId()).getName());
storageBillEntity.setReceiveUserB(userPublicService.getOne(storageBillEntity.getReceiveUserbId()).getName());
storageBillEntity.setReplyFileList(FilesUtil.stringFileToList(storageBillEntity.getReplyFiles()));
storageBillEntity.setApplyFileList(FilesUtil.stringFileToList(storageBillEntity.getApplyFiles()));
List<StorageBillDetail> storageBillDetails = JacksonUtil.readValue(storageBillEntity.getPackingDetail(), new TypeReference<List<StorageBillDetail>>() {
});
// if (storageBillDetailVos != null) {
......
......@@ -175,9 +175,15 @@ public class StorageBill {
@Column(name = "apply_files",columnDefinition = "TEXT")
private String applyFiles;
@Column(name = "allot_files",columnDefinition = "TEXT")
private String allotFiles;
@Transient
private List<FileRet> replyFileList = new ArrayList<>();
@Transient
private List<FileRet> applyFileList = new ArrayList<>();
@Transient
private List<FileRet> allotFileList = new ArrayList<>();
}
......@@ -80,6 +80,9 @@ public class StorageBillSaveVo {
@ApiModelProperty(value = "申请文号附件名")
private List<FileRet> applyFiles;
@ApiModelProperty(value = "配发单附件")
private List<FileRet> allotFiles;
// @NotNull(message = "receiveFileName不能为空")
@ApiModelProperty(value = "入库单附件名")
private String receiveFileName;
......@@ -119,6 +122,9 @@ public class StorageBillSaveVo {
if(this.applyFiles!=null&&this.applyFiles.size()>0){
storageBillEntity.setApplyFiles(FilesUtil.stringFileToList(this.applyFiles));
}
if(this.allotFiles!=null&&this.allotFiles.size()>0){
storageBillEntity.setAllotFiles(FilesUtil.stringFileToList(this.applyFiles));
}
return storageBillEntity;
}
}
package com.tykj.dev.device.task.repository;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......@@ -69,4 +68,7 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
List<Task> findAllByBillIdInAndBusinessType(List<Integer> ids,Integer type);
List<Task> findAllByBusinessTypeAndCustomInfo(Integer businessType,String customInfo);
List<Task> findAllByBusinessTypeAndCustomInfoAndBillStatus(Integer businessType,String customInfo,Integer billStatus);
}
......@@ -1047,6 +1047,12 @@ public class TaskServiceImpl implements TaskService {
if (taskSelectVo.getSelectNum() == 1) {
predicateBuilder.eq("createUserId", userUtils.getCurrentUserId());
}
if (taskSelectVo.getBillStatus()!=null){
predicateBuilder.eq("billStatus", taskSelectVo.getBillStatus());
}
if (taskSelectVo.getRemark()!=null&&taskSelectVo.getRemark().size()>0){
predicateBuilder.in("remark", taskSelectVo.getRemark());
}
return predicateBuilder.build();
}
......
......@@ -26,5 +26,8 @@ public class TaskSelectVo extends CustomPage {
private List<Integer> businessType;
@ApiModelProperty(value = "待办类型(1:省内待办,2:省外待办)", example = "1")
private Integer type;
@ApiModelProperty(value = "业务状态", example = "1")
private Integer billStatus;
@ApiModelProperty(value = "业务备注", example = "测试")
public List<String> remark;
}
......@@ -136,6 +136,7 @@ public class TaskSelectController {
storageBillEntity.setReceiveUserB(userPublicService.getOne(storageBillEntity.getReceiveUserbId()).getName());
storageBillEntity.setReplyFileList(FilesUtil.stringFileToList(storageBillEntity.getReplyFiles()));
storageBillEntity.setApplyFileList(FilesUtil.stringFileToList(storageBillEntity.getApplyFiles()));
storageBillEntity.setAllotFileList(FilesUtil.stringFileToList(storageBillEntity.getAllotFiles()));
list.add(storageBillEntity);
String str = storageBillEntity.getStorageDetail();
List<Integer> list1 = StringSplitUtil.userIdSplit(str);
......@@ -343,6 +344,7 @@ public class TaskSelectController {
deviceApplyBillEntity.setApplyUser(userPublicService.getOne(deviceApplyBillEntity.getApplyUseraId()).getName());
deviceApplyBillEntity.setReplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getReplyFiles()));
deviceApplyBillEntity.setApplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyFiles()));
deviceApplyBillEntity.setBackFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getBackFiles()));
deviceApplyBillEntity.setApplyNumFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyNumFiles()));
Map<Integer,ReplyVo> map = new HashMap<>();
if (deviceApplyBillEntity.getReplyVos()!=null) {
......
......@@ -268,9 +268,12 @@ public class LogAspect {
getFieldsParam(storageBill);
if (this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.END.id)
||this.oldStatus.equals(StatusEnum.WAIT_STORAGE.id) && this.newStatus.equals(StatusEnum.END.id)) {
if (storageBill.getFileName()!=null&&storageBill.getFileUrl()!=null) {
this.fileVos.add(new FileVo("配发单", storageBill.getFileName(), storageBill.getFileUrl()));
}
FilesUtil.stringFileToList(storageBill.getAllotFiles()).forEach(fileRet -> {
this.fileVos.add(new FileVo("配发单", fileRet.getName(), fileRet.getPreviewPath()));
});
// if (storageBill.getFileName()!=null&&storageBill.getFileUrl()!=null) {
// this.fileVos.add(new FileVo("配发单", storageBill.getFileName(), storageBill.getFileUrl()));
// }
// this.fileVos.add(new FileVo("入库确认单", storageBill.getReceiveFileName(), storageBill.getReceiveFileUrl()));
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论