提交 7ab068f7 authored 作者: 133's avatar 133

[用户 退役 报废 销毁] 手动发起的 调用申请任务接口 看是否为申请的装备 并查看申请任务是否可以办结

上级 57945104
...@@ -457,7 +457,7 @@ public class DeviceApplyController { ...@@ -457,7 +457,7 @@ public class DeviceApplyController {
seqs.addAll(DeviceSeqUtil.selectDeviceSeqs(r.getSeqInterval())); seqs.addAll(DeviceSeqUtil.selectDeviceSeqs(r.getSeqInterval()));
} }
} }
deviceLibraryDao.upDateSeqNumbersApplyTaskId(deviceApplyBill1.getId(),seqs); deviceLibraryDao.upDateSeqNumbersApplyTaskId(taskBto.getId(),seqs);
} }
return ResponseEntity.ok("ok"); return ResponseEntity.ok("ok");
} }
......
...@@ -119,7 +119,7 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService { ...@@ -119,7 +119,7 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
DeviceSeqUtil.selectDeviceSeqs(s.getSeqNumber()).forEach(s1 -> deviceLibraries.add(seqMap.get(s1))); DeviceSeqUtil.selectDeviceSeqs(s.getSeqNumber()).forEach(s1 -> deviceLibraries.add(seqMap.get(s1)));
} }
} }
Map<Integer,List<DeviceLibrary>> taskIdMap= deviceLibraries.stream().collect(groupingBy(DeviceLibrary::getApplyTaskId)); Map<Integer,List<DeviceLibrary>> taskIdMap= deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getApplyTaskId()!=null).collect(groupingBy(DeviceLibrary::getApplyTaskId));
for (Integer taskId:taskIdMap.keySet()) { for (Integer taskId:taskIdMap.keySet()) {
Map<Integer,List<DeviceLibrary>> map = taskIdMap.get(taskId).stream().collect(groupingBy(DeviceLibrary::getPackingId)); Map<Integer,List<DeviceLibrary>> map = taskIdMap.get(taskId).stream().collect(groupingBy(DeviceLibrary::getPackingId));
TaskBto taskBto = taskMap.get(taskId).parse2Bto(); TaskBto taskBto = taskMap.get(taskId).parse2Bto();
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
<artifactId>misc</artifactId> <artifactId>misc</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-apply</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId> <artifactId>dev-file</artifactId>
......
...@@ -184,8 +184,6 @@ public class DeviceDecommissioningDetail extends BaseEntity { ...@@ -184,8 +184,6 @@ public class DeviceDecommissioningDetail extends BaseEntity {
@Column(name = "auditing_feedback",columnDefinition = "TEXT") @Column(name = "auditing_feedback",columnDefinition = "TEXT")
private String auditingFeedback; private String auditingFeedback;
@ApiModelProperty(value = "清退状态",name = "1.清退中,2.清退完成")
private Integer repelStatus;
@ApiModelProperty(value = "批复文号文件") @ApiModelProperty(value = "批复文号文件")
@Column(name = "reply_files",columnDefinition = "TEXT") @Column(name = "reply_files",columnDefinition = "TEXT")
......
...@@ -3,6 +3,7 @@ package com.tykj.dev.device.decommissioning.service.impl; ...@@ -3,6 +3,7 @@ package com.tykj.dev.device.decommissioning.service.impl;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.sun.org.apache.bcel.internal.generic.NEW; import com.sun.org.apache.bcel.internal.generic.NEW;
import com.tykj.dev.config.base.DeviceLifeStatus; import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.decommissioning.entity.DeviceDecommissioningDetail; import com.tykj.dev.device.decommissioning.entity.DeviceDecommissioningDetail;
import com.tykj.dev.device.decommissioning.entity.vo.DecommissioningOrderOutData; import com.tykj.dev.device.decommissioning.entity.vo.DecommissioningOrderOutData;
import com.tykj.dev.device.decommissioning.entity.vo.StorageDeviceDevommissiong; import com.tykj.dev.device.decommissioning.entity.vo.StorageDeviceDevommissiong;
...@@ -83,6 +84,8 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -83,6 +84,8 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
@Autowired @Autowired
MessageService messageService; MessageService messageService;
@Autowired
DeviceApplyBillService deviceApplyBillService;
@Override @Override
public TaskBto saveDeviceDecommissioningDraft(Integer userId, DecommissioningOrderOutData decommissioningOrderOutData) { public TaskBto saveDeviceDecommissioningDraft(Integer userId, DecommissioningOrderOutData decommissioningOrderOutData) {
...@@ -162,6 +165,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -162,6 +165,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
deviceDecommissioningDetail.setNum("NO:第" + LocalDateTime.now().getYear() + "QT" + deviceDecommissioningDetail.getId()); deviceDecommissioningDetail.setNum("NO:第" + LocalDateTime.now().getYear() + "QT" + deviceDecommissioningDetail.getId());
deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus()); deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus());
} }
deviceDecommissioningDetail.setReplyFiles(FilesUtil.stringFileToList(decommissioningOrderOutData.getReplyFileList())); deviceDecommissioningDetail.setReplyFiles(FilesUtil.stringFileToList(decommissioningOrderOutData.getReplyFileList()));
deviceDecommissioningDetail.setApplyFiles(FilesUtil.stringFileToList(decommissioningOrderOutData.getApplyFileList())); deviceDecommissioningDetail.setApplyFiles(FilesUtil.stringFileToList(decommissioningOrderOutData.getApplyFileList()));
deviceDecommissioningDetail.setDeviceIds(StringUtils.ListToString(decommissioningOrderOutData.getDevIds())); deviceDecommissioningDetail.setDeviceIds(StringUtils.ListToString(decommissioningOrderOutData.getDevIds()));
...@@ -175,8 +179,10 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -175,8 +179,10 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
if (decommissioningOrderOutData.getApplyId()!=null) { if (decommissioningOrderOutData.getApplyId()!=null) {
Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(decommissioningOrderOutData.getApplyId(), BusinessEnum.APPLY.id); Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(decommissioningOrderOutData.getApplyId(), BusinessEnum.APPLY.id);
taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto()); taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto());
}else {
//2:退役申请,3:报废申请,4:销毁申请
deviceApplyBillService.updateCompleteNum(2,scriptSaveVos);
} }
return deviceDecommissioningDetail; return deviceDecommissioningDetail;
} }
...@@ -211,9 +217,14 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -211,9 +217,14 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
if (storageDeviceDevommissiong.getUserAName()!=null) { if (storageDeviceDevommissiong.getUserAName()!=null) {
deviceDecommissioningDetail.setReceiveUserA(storageDeviceDevommissiong.getUserAName()); deviceDecommissioningDetail.setReceiveUserA(storageDeviceDevommissiong.getUserAName());
} }
if (storageDeviceDevommissiong.getSenderId()!=null){
deviceDecommissioningDetail.setSendUserbId(storageDeviceDevommissiong.getSenderId());
}
if (storageDeviceDevommissiong.getSenderName()!=null){
deviceDecommissioningDetail.setSenderUserB(storageDeviceDevommissiong.getSenderName());
}
taskBto=taskService.moveToEnd(taskBto); taskBto=taskService.moveToEnd(taskBto);
deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus()); deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus());
deviceDecommissioningDetail.setRepelStatus(2);
deviceLibraryDao.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.RETIRE.id,deviceDecommissioningDetail.getReceiveUnit(),0,seqNumbers); deviceLibraryDao.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.RETIRE.id,deviceDecommissioningDetail.getReceiveUnit(),0,seqNumbers);
deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail); deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"退役任务回执单据上传成功任务结束",gainThisUser(user.getUserId(),user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"退役任务回执单据上传成功任务结束",gainThisUser(user.getUserId(),user.getUnitsId())));
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-library</artifactId> <artifactId>dev-library</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-apply</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-task</artifactId> <artifactId>dev-task</artifactId>
......
package com.tykj.dev.device.destroy.service.Impl; package com.tykj.dev.device.destroy.service.Impl;
import com.tykj.dev.config.base.DeviceLifeStatus; import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.destroy.entity.domain.DeviceDestroyBill; import com.tykj.dev.device.destroy.entity.domain.DeviceDestroyBill;
import com.tykj.dev.device.destroy.entity.vo.DeviceDestroyBillVo; import com.tykj.dev.device.destroy.entity.vo.DeviceDestroyBillVo;
import com.tykj.dev.device.destroy.service.DeviceDestroyBillService; import com.tykj.dev.device.destroy.service.DeviceDestroyBillService;
...@@ -66,6 +67,9 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -66,6 +67,9 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
@Autowired @Autowired
UserService userService; UserService userService;
@Autowired
DeviceApplyBillService deviceApplyBillService;
@Override @Override
public TaskBto saveDeviceDestroyBill(SecurityUser securityUser, DeviceDestroyBillVo deviceDestroyBillVo) { public TaskBto saveDeviceDestroyBill(SecurityUser securityUser, DeviceDestroyBillVo deviceDestroyBillVo) {
...@@ -131,6 +135,9 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -131,6 +135,9 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
if (deviceDestroyBillVo.getApplyId()!=null) { if (deviceDestroyBillVo.getApplyId()!=null) {
Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(deviceDestroyBillVo.getApplyId(), BusinessEnum.APPLY.id); Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(deviceDestroyBillVo.getApplyId(), BusinessEnum.APPLY.id);
taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto()); taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto());
}else {
//2:退役申请,3:报废申请,4:销毁申请
deviceApplyBillService.updateCompleteNum(4,deviceDestroyBillVo.getScripts());
} }
return deviceDestroyBill; return deviceDestroyBill;
} }
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>blockcha</artifactId> <artifactId>blockcha</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-apply</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-task</artifactId> <artifactId>dev-task</artifactId>
......
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.scrap.service.impl; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.scrap.service.impl;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.base.DeviceLifeStatus; import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
...@@ -54,6 +55,9 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -54,6 +55,9 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
@Autowired @Autowired
UserService userService; UserService userService;
@Autowired
DeviceApplyBillService deviceApplyBillService;
@Autowired @Autowired
UnitsService unitsService; UnitsService unitsService;
...@@ -168,6 +172,8 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -168,6 +172,8 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
if (scrapOrderOutData.getApplyId()!=null) { if (scrapOrderOutData.getApplyId()!=null) {
Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(scrapOrderOutData.getApplyId(), BusinessEnum.APPLY.id); Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(scrapOrderOutData.getApplyId(), BusinessEnum.APPLY.id);
taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto()); taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto());
}else {
deviceApplyBillService.updateCompleteNum(3,scriptSaveVos);
} }
return scrap; return scrap;
} }
......
...@@ -132,9 +132,9 @@ public class RepelQueryController { ...@@ -132,9 +132,9 @@ public class RepelQueryController {
} }
@ApiOperation(value = "查询清退单列表") @ApiOperation(value = "查询清退单列表")
@GetMapping("/getList") @PostMapping("/getList")
public ResponseEntity getList(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) { public ResponseEntity getList(@RequestBody RepelDetailSelectVo repelDetailSelectVo) {
return ResponseEntity.ok(repelQueryService.getList(securityUser)); return ResponseEntity.ok(repelQueryService.getList(repelDetailSelectVo));
} }
@ApiOperation(value = "查询清退任务", notes = "可以通过这个接口查询查询清退任务") @ApiOperation(value = "查询清退任务", notes = "可以通过这个接口查询查询清退任务")
......
...@@ -161,53 +161,6 @@ public class DeviceRepelDetail extends BaseEntity { ...@@ -161,53 +161,6 @@ public class DeviceRepelDetail extends BaseEntity {
@Column(name = "in_file",columnDefinition = "TEXT") @Column(name = "in_file",columnDefinition = "TEXT")
private String inFile; private String inFile;
/**
* 退回状态(1:退回待审核,2:退回审核失败,3:退回中,4:退回接收待审核,5:退回接收审核失败,6:退回成功)
*/
@ApiModelProperty(value = "退回状态(1:退回待审核,2:退回审核失败,3:退回中,4:退回接收待审核,5:退回接收审核失败,6:退回成功)")
private Integer sendBackStatus;
/**
* 退回装备数量
*/
@ApiModelProperty(value = "退回装备数量")
private Integer sendBackCount;
/**
* 已出库装备数量
*/
@ApiModelProperty(value = "已出库装备数量")
private Integer sendedCount;
/**
* 已接收装备数量
*/
@ApiModelProperty(value = "已接收装备数量")
private Integer receiveCount;
/**
* 出库检查详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配
*/
@Column(name = "send_check_detail",columnDefinition = "TEXT")
@ApiModelProperty(value = "出库检查详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配")
private String sendCheckDetail;
/**
* 出库检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条
*/
@ApiModelProperty(value = "出库检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条")
@Column(name = "send_check_result",columnDefinition = "TEXT")
private String sendCheckResult;
/**
* 接收方入库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配
*/
@ApiModelProperty(value = "接收方入库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配")
@Column(name = "receive_check_detail",columnDefinition = "TEXT")
private String receiveCheckDetail;
/**
* 接收方检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条
*/
@ApiModelProperty(value = "接收方检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条")
@Column(name = "receive_check_result",columnDefinition = "TEXT")
private String receiveCheckResult;
@ApiModelProperty(value = "装备id集合") @ApiModelProperty(value = "装备id集合")
@Column(name = "device_ids",columnDefinition = "TEXT") @Column(name = "device_ids",columnDefinition = "TEXT")
private String deviceIds; private String deviceIds;
...@@ -221,15 +174,10 @@ public class DeviceRepelDetail extends BaseEntity { ...@@ -221,15 +174,10 @@ public class DeviceRepelDetail extends BaseEntity {
@ApiModelProperty(value = "区块链RID",name = "recordId") @ApiModelProperty(value = "区块链RID",name = "recordId")
private String recordId; private String recordId;
/**
* 提交描述
*/
@ApiModelProperty(value = "提交描述") @ApiModelProperty(value = "提交描述")
@Column(name = "submit_description",columnDefinition = "TEXT") @Column(name = "submit_description",columnDefinition = "TEXT")
private String submitDescription; private String submitDescription;
/**
* 审核反馈
*/
@ApiModelProperty(value = "审核反馈") @ApiModelProperty(value = "审核反馈")
@Column(name = "auditing_feedback",columnDefinition = "TEXT") @Column(name = "auditing_feedback",columnDefinition = "TEXT")
private String auditingFeedback; private String auditingFeedback;
...@@ -237,6 +185,9 @@ public class DeviceRepelDetail extends BaseEntity { ...@@ -237,6 +185,9 @@ public class DeviceRepelDetail extends BaseEntity {
@ApiModelProperty(value = "清退状态",name = "1.清退中,2.清退完成") @ApiModelProperty(value = "清退状态",name = "1.清退中,2.清退完成")
private Integer repelStatus; private Integer repelStatus;
@ApiModelProperty(value = "清退单据类型",name = "1.出入库,2.直属 3.本级")
private Integer repelType=1;
@ApiModelProperty(value = "批复文号文件") @ApiModelProperty(value = "批复文号文件")
@Column(name = "reply_files",columnDefinition = "TEXT") @Column(name = "reply_files",columnDefinition = "TEXT")
private String replyFiles; private String replyFiles;
...@@ -254,8 +205,6 @@ public class DeviceRepelDetail extends BaseEntity { ...@@ -254,8 +205,6 @@ public class DeviceRepelDetail extends BaseEntity {
@Column(name = "directly_under_devices",columnDefinition = "TEXT") @Column(name = "directly_under_devices",columnDefinition = "TEXT")
private String directlyUnderDevices; private String directlyUnderDevices;
@Transient @Transient
private List<ScriptSaveVo> scripts = new ArrayList<>(); private List<ScriptSaveVo> scripts = new ArrayList<>();
......
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* @author zjm
* @version 1.0.0
* @ClassName RepelManagementVo.java
* @Description 清退管理 清退清退vo
* @createTime 2021年01月23日 12:42:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("退役业务分页查询业务")
public class RepelDetailSelectVo extends CustomPage {
@ApiModelProperty(name = "开始清退的年份 默认各式 2020-01-01 00:00:00")
private LocalDateTime startTime;
@ApiModelProperty(name = "开始清退的年份 默认各式 2020-01-01 00:00:00")
private LocalDateTime endTime;
@ApiModelProperty(name = "单位id")
private Integer unitId;
}
...@@ -2,6 +2,8 @@ package com.tykj.dev.device.sendback.service; ...@@ -2,6 +2,8 @@ package com.tykj.dev.device.sendback.service;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail; import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.vo.RepelDetailSelectVo;
import org.springframework.data.domain.Page;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -38,4 +40,7 @@ public interface DeviceRepelDetailService { ...@@ -38,4 +40,7 @@ public interface DeviceRepelDetailService {
List<DeviceRepelDetail> findUnitIdSendOrReceive(Integer unitId); List<DeviceRepelDetail> findUnitIdSendOrReceive(Integer unitId);
List<DeviceRepelDetail> findIdsReceiptUnits(List<Integer> unitIds); List<DeviceRepelDetail> findIdsReceiptUnits(List<Integer> unitIds);
Page<DeviceRepelDetail> findPageDeviceRepelDetail(RepelDetailSelectVo repelDetailSelectVo);
} }
package com.tykj.dev.device.sendback.service; package com.tykj.dev.device.sendback.service;
import com.sun.xml.internal.bind.v2.runtime.reflect.Lister;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepel; import com.tykj.dev.device.sendback.entity.domain.DeviceRepel;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail; import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.vo.*; import com.tykj.dev.device.sendback.entity.vo.*;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.entity.SecurityUser; import com.tykj.dev.device.user.subject.entity.SecurityUser;
import org.springframework.data.domain.Page;
import java.util.List; import java.util.List;
...@@ -96,7 +98,7 @@ public interface RepelQueryService { ...@@ -96,7 +98,7 @@ public interface RepelQueryService {
/** /**
查询清退单 查询清退单
*/ */
List<DeviceRepelDetail> getList(SecurityUser securityUser); Page<DeviceRepelDetail> getList(RepelDetailSelectVo repelDetailSelectVo);
/** /**
......
package com.tykj.dev.device.sendback.service.impl; package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
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.ScriptSaveVo;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail; import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.vo.RepelDetailSelectVo;
import com.tykj.dev.device.sendback.repository.DeviceRepelDetailDao; import com.tykj.dev.device.sendback.repository.DeviceRepelDetailDao;
import com.tykj.dev.device.sendback.service.DeviceRepelDetailService; import com.tykj.dev.device.sendback.service.DeviceRepelDetailService;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.StringUtils; import com.tykj.dev.misc.utils.StringUtils;
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.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -92,6 +101,40 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService { ...@@ -92,6 +101,40 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
return deviceRepelDetailDao.findAllByReceiveUnitIdIn(unitIds); return deviceRepelDetailDao.findAllByReceiveUnitIdIn(unitIds);
} }
@Override
public Page<DeviceRepelDetail> findPageDeviceRepelDetail(RepelDetailSelectVo repelDetailSelectVo) {
return deviceRepelDetailDao.findAll(getFindRetiredSpecification(repelDetailSelectVo),repelDetailSelectVo.getPageable()).map(deviceRepelDetail -> {
deviceRepelDetail.setScripts(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {
}));
deviceRepelDetail.setBillFiles(FilesUtil.stringFileToList(deviceRepelDetail.getBillFile()));
deviceRepelDetail.setOutboundFiles(FilesUtil.stringFileToList(deviceRepelDetail.getOutboundFile()));
deviceRepelDetail.setInFiles(FilesUtil.stringFileToList(deviceRepelDetail.getInFile()));
deviceRepelDetail.setReplyFileList(FilesUtil.stringFileToList(deviceRepelDetail.getReplyFiles()));
deviceRepelDetail.setApplyFileList(FilesUtil.stringFileToList(deviceRepelDetail.getApplyFiles()));
return deviceRepelDetail;
});
}
private Specification<DeviceRepelDetail> getFindRetiredSpecification(RepelDetailSelectVo repelDetailSelectVo) {
PredicateBuilder<DeviceRepelDetail> predicateBuilder = Specifications.and();
// List<Integer> leftStatus=new ArrayList<>();
// leftStatus.add(com.tykj.dev.config.base.DeviceLifeStatus.RETIRED.id);
if (repelDetailSelectVo.getStartTime() != null) {
predicateBuilder.gt("createTime", repelDetailSelectVo.getStartTime());
}
if (repelDetailSelectVo.getEndTime() != null) {
predicateBuilder.lt("createTime", repelDetailSelectVo.getEndTime());
}
predicateBuilder.eq("repelStatus", 2);
predicateBuilder.eq("repelType",1,2);
predicateBuilder.eq("sendUnitId",repelDetailSelectVo.getUnitId());
return predicateBuilder.build();
}
private List<DeviceLibrary> findInvoleDevice(String involeDevice){ private List<DeviceLibrary> findInvoleDevice(String involeDevice){
if (involeDevice!=null && !involeDevice.equals(",") ) { if (involeDevice!=null && !involeDevice.equals(",") ) {
List<String> idStringList = Arrays.asList(involeDevice.split(",")); List<String> idStringList = Arrays.asList(involeDevice.split(","));
......
...@@ -225,6 +225,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -225,6 +225,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setSendUnitId(units.getUnitId()); deviceRepelDetail.setSendUnitId(units.getUnitId());
deviceRepelDetail.setSendUnit(units.getName()); deviceRepelDetail.setSendUnit(units.getName());
deviceRepelDetail.setId(null); deviceRepelDetail.setId(null);
deviceRepelDetail.setRepelType(2);
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),directlUnderUnitNames,seqNumbers,lifeStatus); Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),directlUnderUnitNames,seqNumbers,lifeStatus);
if (directlUnderUnit.get()&&count!=0){ if (directlUnderUnit.get()&&count!=0){
TaskBto taskBto2 = directlyUnderTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(),deviceRepel.getTitle(),userId); TaskBto taskBto2 = directlyUnderTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(),deviceRepel.getTitle(),userId);
...@@ -233,8 +234,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -233,8 +234,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setId(null); deviceRepelDetail.setId(null);
List<String> strings=new ArrayList<>(); List<String> strings=new ArrayList<>();
strings.add(units.getName()); strings.add(units.getName());
deviceRepelDetail.setRepelType(3);
count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),strings, seqNumbers,lifeStatus); count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),strings, seqNumbers,lifeStatus);
if (correspondingLevel.get()&&count!=0){ if (correspondingLevel.get()&&count!=0){
TaskBto taskBto1 = oneselfTask(units.getUnitId(),deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(),deviceRepel.getTitle(),userId); TaskBto taskBto1 = oneselfTask(units.getUnitId(),deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(),deviceRepel.getTitle(),userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(),taskBto.getId(),taskBto1.getId(),0,"省本级",repelStatusJudgeCount(deviceRepel.getRepelStatus(),count),"")); list.add(new RepelTaskStatistical(deviceRepel1.getId(),taskBto.getId(),taskBto1.getId(),0,"省本级",repelStatusJudgeCount(deviceRepel.getRepelStatus(),count),""));
...@@ -317,6 +318,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -317,6 +318,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setId(null); deviceRepelDetail.setId(null);
deviceRepelDetail.setSendUnit(units.getName()); deviceRepelDetail.setSendUnit(units.getName());
deviceRepelDetail.setSendUnitId(units.getUnitId()); deviceRepelDetail.setSendUnitId(units.getUnitId());
deviceRepelDetail.setRepelType(3);
List<String> unitNames=new ArrayList<>(); List<String> unitNames=new ArrayList<>();
unitNames.add(units.getName()); unitNames.add(units.getName());
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitNames, DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()),lifeStatus); Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitNames, DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()),lifeStatus);
......
...@@ -368,31 +368,8 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -368,31 +368,8 @@ public class RepelQueryServiceImpl implements RepelQueryService {
} }
@Override @Override
public List<DeviceRepelDetail> getList(SecurityUser securityUser) { public Page<DeviceRepelDetail> getList(RepelDetailSelectVo repelDetailSelectVo) {
List<DeviceRepelDetail> list=new ArrayList<>(); return repelDetailService.findPageDeviceRepelDetail(repelDetailSelectVo);
List<DeviceRepelDetail> deviceRepelDetails=new ArrayList<>();
Units units=securityUser.getCurrentUserInfo().getUnits();
if (securityUser.getCurrentUserInfo().getUnits().getLevel()!=1){
deviceRepelDetails=repelDetailService.findUnitIdSendOrReceive(units.getUnitId());
}else {
deviceRepelDetails=repelDetailService.findAll();
}
deviceRepelDetails.stream().filter(i-> i.getRepelStatus()!=null&&i.getRepelStatus()==2).forEach(
deviceRepelDetail -> {
if (deviceRepelDetail.getBillFile()!=null){
deviceRepelDetail.setBillFiles(FilesUtil.stringFileToList(deviceRepelDetail.getBillFile()));
}
if (deviceRepelDetail.getOutboundFile()!=null){
deviceRepelDetail.setOutboundFiles(FilesUtil.stringFileToList(deviceRepelDetail.getOutboundFile()));
}
deviceRepelDetail.setScripts(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {}));
deviceRepelDetail.setDeviceLibraryEntities(deviceLibraryDao.findAllById(StringUtils.stringToList(deviceRepelDetail.getDeviceIds())).stream().map(DeviceLibrary::setConfigName).collect(Collectors.toList()));
list.add(deviceRepelDetail);
}
);
return list;
} }
......
...@@ -32,6 +32,8 @@ public interface UnitsDao extends JpaRepository<Units, Integer>, JpaSpecificatio ...@@ -32,6 +32,8 @@ public interface UnitsDao extends JpaRepository<Units, Integer>, JpaSpecificatio
@Query("select o.areaId from Units o where o.unitId=?1") @Query("select o.areaId from Units o where o.unitId=?1")
int findAreaId(int id); int findAreaId(int id);
Units findTopByOrderByShowOrderDesc();
Units findByAreaIdAndLevel(Integer areaId, Integer level); Units findByAreaIdAndLevel(Integer areaId, Integer level);
Units findByAreaIdEquals(Integer areaId); Units findByAreaIdEquals(Integer areaId);
......
...@@ -64,7 +64,7 @@ public class Units { ...@@ -64,7 +64,7 @@ public class Units {
* 是否删除 * 是否删除
*/ */
@ApiModelProperty(value = "是否删除", name = "idDel", example = "12321L") @ApiModelProperty(value = "是否删除", name = "idDel", example = "12321L")
private Integer idDel; private Integer idDel=0;
/** /**
序列号 序列号
...@@ -76,7 +76,7 @@ public class Units { ...@@ -76,7 +76,7 @@ public class Units {
* 2.省直属单位 areaid 0 * 2.省直属单位 areaid 0
* 3.省上级单位 areaid 0 * 3.省上级单位 areaid 0
*/ */
private Integer type; private Integer type=1;
/** /**
* 区域id * 区域id
*/ */
......
...@@ -288,13 +288,17 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -288,13 +288,17 @@ public class UnitsServiceImpl implements UnitsService {
Optional<Area> optionalArea = areaDao.findById(units.getAreaId()); Optional<Area> optionalArea = areaDao.findById(units.getAreaId());
if (optionalArea.isPresent()) { if (optionalArea.isPresent()) {
units.setLevel(optionalArea.get().getType()); units.setLevel(optionalArea.get().getType());
units.setType(1);
} else { } else {
throw new ApiException(ResponseEntity.ok("[单位] 没找到对应的区域,请检查")); throw new ApiException(ResponseEntity.ok("[单位] 没找到对应的区域,请检查"));
} }
} }
else { else {
units.setLevel(4); units.setLevel(4);
units.setType(3);
} }
Integer maxShowCode= unitsDao.findTopByOrderByShowOrderDesc().getShowOrder();
units.setShowOrder(maxShowCode+1);
Units units1 = unitsDao.save(units); Units units1 = unitsDao.save(units);
unitsCache.refresh(unitsDao.findAll()); unitsCache.refresh(unitsDao.findAll());
return units1; return units1;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论