提交 ccf2e40e authored 作者: 133's avatar 133

feat(用户,清退,退役,报废,销毁模块): 清退中止任务,添加缓存注解

1.清退任务: 添加维修中止任务,以及修改了清退的全部发起的业务,不需要市手动转发,系统自动转发掉。 2。退役,报废,销毁,清退模块 添加了更新缓存的注解,把使用设备的dao 换成service
上级 352d6377
...@@ -187,7 +187,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -187,7 +187,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
deviceDecommissioningDetail.setScriptJson(JacksonUtil.toJSon(decommissioningOrderOutData.getScriptSaveVos())); deviceDecommissioningDetail.setScriptJson(JacksonUtil.toJSon(decommissioningOrderOutData.getScriptSaveVos()));
// deviceDecommissioningDetail.setDeviceLibraryEntities(findInvoleDevice(deviceDecommissioningDetail.getDeviceIds())); // deviceDecommissioningDetail.setDeviceLibraryEntities(findInvoleDevice(deviceDecommissioningDetail.getDeviceIds()));
deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail); deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail);
deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.RETIRED.id,seqNumbers); deviceLibraryService.upDateSeqNumbersLeftStatus(DeviceLifeStatus.RETIRED.id,seqNumbers);
devLogAdd(seqNumbers,"发了退役任务,状态转化为退役中",userId,taskBto.getId()); devLogAdd(seqNumbers,"发了退役任务,状态转化为退役中",userId,taskBto.getId());
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);
...@@ -242,7 +242,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -242,7 +242,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
taskBto=taskService.moveToEnd(taskBto); taskBto=taskService.moveToEnd(taskBto);
deviceDecommissioningDetail.setReceiveTime(new Date()); deviceDecommissioningDetail.setReceiveTime(new Date());
deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus()); deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus());
deviceLibraryDao.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.RETIRE.id,deviceDecommissioningDetail.getReceiveUnit(),0,seqNumbers); deviceLibraryService.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())));
devLogAdd(seqNumbers,"退役任务完成,状态转化为已退役",storageDeviceDevommissiong.getUserId(),taskBto.getId()); devLogAdd(seqNumbers,"退役任务完成,状态转化为已退役",storageDeviceDevommissiong.getUserId(),taskBto.getId());
......
...@@ -147,7 +147,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -147,7 +147,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
deviceDestroyBill.setApplyFiles(FilesUtil.stringFileToList(deviceDestroyBillVo.getApplyFileList())); deviceDestroyBill.setApplyFiles(FilesUtil.stringFileToList(deviceDestroyBillVo.getApplyFileList()));
deviceDestroyBill.setReplayFiles(FilesUtil.stringFileToList(deviceDestroyBillVo.getReplayFileList())); deviceDestroyBill.setReplayFiles(FilesUtil.stringFileToList(deviceDestroyBillVo.getReplayFileList()));
deviceDestroyBill.setScriptJson(JacksonUtil.toJSon(deviceDestroyBillVo.getScripts())); deviceDestroyBill.setScriptJson(JacksonUtil.toJSon(deviceDestroyBillVo.getScripts()));
deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.IN_THE_DESTROYED.id,seqNumbers); deviceLibraryService.upDateSeqNumbersLeftStatus(DeviceLifeStatus.IN_THE_DESTROYED.id,seqNumbers);
deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill); deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill);
devLogAdd(seqNumbers,"发了销毁任务,状态转化为销毁中",securityUser.getCurrentUserInfo().getUserId(),taskBto.getId()); devLogAdd(seqNumbers,"发了销毁任务,状态转化为销毁中",securityUser.getCurrentUserInfo().getUserId(),taskBto.getId());
if (deviceDestroyBillVo.getApplyId()!=null) { if (deviceDestroyBillVo.getApplyId()!=null) {
...@@ -182,7 +182,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -182,7 +182,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
// deviceDestroyBill.setDestroyTime(new Date()); // deviceDestroyBill.setDestroyTime(new Date());
deviceDestroyBill.setDestroyStatus(taskBto.getBillStatus()); deviceDestroyBill.setDestroyStatus(taskBto.getBillStatus());
deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill); deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill);
deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.DESTROYED.id,seqNumbers); deviceLibraryService.upDateSeqNumbersLeftStatus(DeviceLifeStatus.DESTROYED.id,seqNumbers);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"销毁任务补充手续完成",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"销毁任务补充手续完成",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
devLogAdd(seqNumbers,"补充单据信息,状态转化已销毁",deviceDestroyBillVo.getOperationId(),taskBto.getId()); devLogAdd(seqNumbers,"补充单据信息,状态转化已销毁",deviceDestroyBillVo.getOperationId(),taskBto.getId());
......
...@@ -83,6 +83,11 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, ...@@ -83,6 +83,11 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
Integer countAllBySeqNumberInAndOwnUnitInAndLifeStatusIn(List<String> seqNumbers,List<String> unitNames,List<Integer> lifeStatus); Integer countAllBySeqNumberInAndOwnUnitInAndLifeStatusIn(List<String> seqNumbers,List<String> unitNames,List<Integer> lifeStatus);
List<DeviceLibrary> findAllBySeqNumberInAndOwnUnitInAndLifeStatusIn(List<String> seqNumbers,List<String> unitNames,List<Integer> lifeStatus);
List<DeviceLibrary> findAllByPackingIdInAndOwnUnitInAndLifeStatusIn(List<Integer> packingIds,List<String> unitNames,List<Integer> lifeStatus);
List<DeviceLibrary> findAllByPackingIdInAndOwnUnit(List<Integer> packingIds,String unitNames); List<DeviceLibrary> findAllByPackingIdInAndOwnUnit(List<Integer> packingIds,String unitNames);
List<DeviceLibrary> findAllByPackingIdInAndOwnUnitIn(List<Integer> packingIds,List<String> unitNames); List<DeviceLibrary> findAllByPackingIdInAndOwnUnitIn(List<Integer> packingIds,List<String> unitNames);
......
...@@ -103,7 +103,7 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -103,7 +103,7 @@ public class LossBillServiceImpl implements LossBillService {
} }
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起了装备丢失",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起了装备丢失",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
deviceLibraryDao.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());
} }
...@@ -147,7 +147,7 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -147,7 +147,7 @@ public class LossBillServiceImpl implements LossBillService {
TaskBto taskBto; TaskBto taskBto;
if (units.getLevel() == 1) { if (units.getLevel() == 1) {
taskBto= endRetrieve(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "找回装备任务", units.getUnitId()); taskBto= endRetrieve(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "找回装备任务", units.getUnitId());
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,deviceLoss.getDevIdsList()); deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,deviceLoss.getDevIdsList());
} else if (units.getLevel()==2){ } else if (units.getLevel()==2){
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId()); Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
taskBto= newRetrieveCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId()); taskBto= newRetrieveCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId());
...@@ -173,7 +173,7 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -173,7 +173,7 @@ public class LossBillServiceImpl implements LossBillService {
if (retrieveAuditvo.getType()==1){ if (retrieveAuditvo.getType()==1){
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
deviceLoss.setBackStatus(2); deviceLoss.setBackStatus(2);
deviceLibraryDao.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(),"装备找回业务审核成功",gainThisUser(user.getUserId(),user.getUnitsId())));
}else { }else {
taskService.moveToEnd(taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1403)); taskService.moveToEnd(taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1403));
......
package com.tykj.dev.misc.base; package com.tykj.dev.misc.base;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -54,6 +55,7 @@ public class BaseEntity { ...@@ -54,6 +55,7 @@ public class BaseEntity {
*/ */
@CreatedDate @CreatedDate
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
...@@ -61,6 +63,7 @@ public class BaseEntity { ...@@ -61,6 +63,7 @@ public class BaseEntity {
*/ */
@LastModifiedDate @LastModifiedDate
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime; private LocalDateTime updateTime;
/** /**
......
package com.tykj.dev.device.repair.service.impl; package com.tykj.dev.device.repair.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.blockcha.subject.entity.BcHash; import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil; import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig; import com.tykj.dev.config.TaskBeanConfig;
...@@ -165,9 +166,10 @@ public class RepairDetailServiceImpl implements RepairDetailService { ...@@ -165,9 +166,10 @@ public class RepairDetailServiceImpl implements RepairDetailService {
} }
} }
); );
List<BillVo> billVos = new ArrayList<>();
map.forEach( map.forEach(
(k,v)->{ (k,v)->{
List<BillVo> billVos = new ArrayList<>();
BillVo billVo = new BillVo(); BillVo billVo = new BillVo();
billVo.setRepairBillId(v.getDeviceRepairBillId()); billVo.setRepairBillId(v.getDeviceRepairBillId());
billVo.setDevicesId(v.getDeviceId()); billVo.setDevicesId(v.getDeviceId());
...@@ -291,12 +293,15 @@ public class RepairDetailServiceImpl implements RepairDetailService { ...@@ -291,12 +293,15 @@ public class RepairDetailServiceImpl implements RepairDetailService {
repairBillIds.forEach(integer -> { repairBillIds.forEach(integer -> {
RepairSendBill sendBill = repairSendBillDao.findByDeviceRepairBillId(integer); RepairSendBill sendBill = repairSendBillDao.findByDeviceRepairBillId(integer);
String scriptJson = sendBill.getScriptJson(); String scriptJson = sendBill.getScriptJson();
List<ScriptSaveVo> scriptSaveVos = JacksonUtil.readValueToList(scriptJson, ScriptSaveVo.class); List<ScriptSaveVo> scriptSaveVos = JacksonUtil.readValue(scriptJson, new TypeReference<List<ScriptSaveVo>>() {
});
for (ScriptSaveVo scriptSaveVo : scriptSaveVos) { for (ScriptSaveVo scriptSaveVo : scriptSaveVos) {
scriptSaveVo.setRemark(remark); if (deviceIds.contains(scriptSaveVo.getId())) {
sendBill.setScriptJson(JacksonUtil.toJSon(scriptJson)); scriptSaveVo.setRemark(remark);
repairSendBillDao.save(sendBill); }
} }
sendBill.setScriptJson(JacksonUtil.toJSon(scriptSaveVos));
repairSendBillDao.save(sendBill);
}); });
List<Integer> repairDetailIds = billVos.stream().map(BillVo::getRepairDetailId).collect(Collectors.toList()); List<Integer> repairDetailIds = billVos.stream().map(BillVo::getRepairDetailId).collect(Collectors.toList());
//删除维修详情 //删除维修详情
......
...@@ -178,7 +178,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -178,7 +178,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
scrap.setScripts(scrapOrderOutData.getScriptSaveVos()); scrap.setScripts(scrapOrderOutData.getScriptSaveVos());
scrap.setScriptJson(JacksonUtil.toJSon(scrapOrderOutData.getScriptSaveVos())); scrap.setScriptJson(JacksonUtil.toJSon(scrapOrderOutData.getScriptSaveVos()));
scrapService.saveScrap(scrap); scrapService.saveScrap(scrap);
deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.IN_THE_SCRAPPED.id,seqNumbers); deviceLibraryService.upDateSeqNumbersLeftStatus(DeviceLifeStatus.IN_THE_SCRAPPED.id,seqNumbers);
devLogAdd(seqNumbers,"发了报废任务,状态转化为报废中",userId,taskBto.getId()); devLogAdd(seqNumbers,"发了报废任务,状态转化为报废中",userId,taskBto.getId());
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);
...@@ -229,7 +229,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -229,7 +229,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
taskBto = taskService.moveToEnd(taskBto); taskBto = taskService.moveToEnd(taskBto);
scrap.setScrapStatus(taskBto.getBillStatus()); scrap.setScrapStatus(taskBto.getBillStatus());
scrap.setReceiveTime(new Date()); scrap.setReceiveTime(new Date());
deviceLibraryDao.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SCRAP_I.id,scrap.getReceiveUnit(),0,seqNumbers); deviceLibraryService.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SCRAP_I.id,scrap.getReceiveUnit(),0,seqNumbers);
scrapService.saveScrap(scrap); scrapService.saveScrap(scrap);
devLogAdd(seqNumbers,"报废任务完成,状态转化为已报废",user.getUserId(),taskBto.getId()); devLogAdd(seqNumbers,"报废任务完成,状态转化为已报废",user.getUserId(),taskBto.getId());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"报废单据上传,任务结束",gainThisUser(user.getUserId(),user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"报废单据上传,任务结束",gainThisUser(user.getUserId(),user.getUnitsId())));
......
...@@ -35,8 +35,8 @@ public class RepelDevController { ...@@ -35,8 +35,8 @@ public class RepelDevController {
@PostMapping(value ="/initiateRepel/{userId}") @PostMapping(value ="/initiateRepel/{userId}")
@ApiOperation(value = "省发布清退接口", notes = "省发布清退接口") @ApiOperation(value = "省发布清退接口", notes = "省发布清退接口")
public ResponseEntity initiateRepel(@PathVariable Integer userId,@RequestBody DeviceRepel deviceRepel){ public ResponseEntity initiateRepel(@PathVariable Integer userId,@RequestBody DeviceRepel deviceRepel,@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
repelBusinessService.initiateRepel(deviceRepel,userId); repelBusinessService.initiateRepel(deviceRepel,userId,securityUser);
return ResponseEntity.ok("发布成功"); return ResponseEntity.ok("发布成功");
} }
...@@ -179,10 +179,17 @@ public class RepelDevController { ...@@ -179,10 +179,17 @@ public class RepelDevController {
return ResponseEntity.ok("任务办结完成"); return ResponseEntity.ok("任务办结完成");
} }
@ApiOperation(value = "test", notes = "全部清退无装备办结接口") @ApiOperation(value = "清退任务撤回检查接口", notes = "清退任务撤回检查接口")
@GetMapping(value ="/test/{taskId}") @GetMapping(value ="/repelWithdraw/check/{taskId}")
public ResponseEntity test(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@PathVariable Integer taskId){ public ResponseEntity repelWithdrawCheck(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@PathVariable Integer taskId){
return ResponseEntity.ok(repelBusinessService.repelWithdraw(taskId)); return ResponseEntity.ok(repelBusinessService.repelWithdrawCherck(taskId));
}
@ApiOperation(value = "清退任务撤回接口", notes = "清退任务撤回接口")
@GetMapping(value ="/repelWithdraw/{taskId}")
public ResponseEntity repelWithdraw(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@PathVariable Integer taskId){
repelBusinessService.repelWithdraw(taskId);
return ResponseEntity.ok("清退成功");
} }
} }
package com.tykj.dev.device.sendback.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.sendback.entity.domain.RepelEscrow;
import com.tykj.dev.device.sendback.entity.vo.HistorySelectSendBillVo;
import com.tykj.dev.device.sendback.service.HistorySendBillService;
import com.tykj.dev.device.sendback.service.RepelBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* @author zjm
* @version 1.0.0
* @ClassName HistoryPepairContriller.java
* @Description TODO
* @createTime 2021年09月17日 10:21:00
*/
@RestController
@RequestMapping(value = "/historySend")
@AutoDocument
@Api(tags = "清退直属代管模块", description = "清退直属代管模块")
public class RepelEscrowContriller {
@Autowired
RepelBusinessService repelBusinessService;
@ApiOperation(value = "添加相关数据接口",notes = "分为两个阶段使用 1.选择设备阶段,需要传deviceLibraries集合,以及escrowStatus为2。第2阶段 上传签字单据,fileRetList集合以及escrowStatus为2")
@PostMapping("/addDate")
public ResponseEntity toDb(@RequestBody RepelEscrow repelEscrow ){
repelBusinessService.saveRepelEscrow(repelEscrow);
return ResponseEntity.ok("ok");
}
}
...@@ -104,7 +104,7 @@ public class RepelQueryController { ...@@ -104,7 +104,7 @@ public class RepelQueryController {
} }
@GetMapping(value ="/provinceDirectlyUnderDev/{taskId}/{type}") @GetMapping(value ="/provinceDirectlyUnderDev/{taskId}/{type}")
@ApiOperation(value = "省直属任务单位列表查询接口", notes = "省直属任务装备查询接口") @ApiOperation(value = "省直属任务单位列表查询接口", notes = "Repeles对象中 escrowStatus =2 为选择了装备 3上传了单据 根据状态判断是否全部提交 其他不变")
public ResponseEntity provinceDirectlyUnderDev(@PathVariable Integer taskId, @PathVariable Integer type){ public ResponseEntity provinceDirectlyUnderDev(@PathVariable Integer taskId, @PathVariable Integer type){
return ResponseEntity.ok(repelQueryService.directlyUnderUnitLeftNavigation(taskId,type)); return ResponseEntity.ok(repelQueryService.directlyUnderUnitLeftNavigation(taskId,type));
} }
...@@ -165,23 +165,25 @@ public class RepelQueryController { ...@@ -165,23 +165,25 @@ public class RepelQueryController {
return ResponseEntity.ok(repelQueryService.repelDeviceInList(repelManagementVo)); return ResponseEntity.ok(repelQueryService.repelDeviceInList(repelManagementVo));
} }
@GetMapping(value ="/provinceDirectlyUnder/device/{taskId}") @GetMapping(value ="/provinceDirectlyUnder/device/{taskId}")
@ApiOperation(value = "直属单位全部清退装备查询接口", notes = "直属单位全部清退装备查询接口") @ApiOperation(value = "直属单位全部清退装备查询接口", notes = "直属单位全部清退装备查询接口")
public ResponseEntity provinceDirectlyUnderDevice( @PathVariable Integer taskId){ public ResponseEntity provinceDirectlyUnderDevice( @PathVariable Integer taskId){
return ResponseEntity.ok(repelQueryService.provinceDirectlyUnderDev(taskId)); return ResponseEntity.ok(repelQueryService.provinceDirectlyUnderDev(taskId));
} }
@PostMapping(value ="/judgeFieldingIsNotNormal") @PostMapping(value ="/judgeFieldingIsNotNormal")
@ApiOperation(value = "判断发起的列装是否需要提示接口", notes = "判断发起的列装是否需要提示接口") @ApiOperation(value = "判断发起的列装是否需要提示接口", notes = "判断发起的列装是否需要提示接口")
public ResponseEntity provinceDirectlyUnderDevice(@RequestBody List<RepelFieldingVo> repelFieldingVoList){ public ResponseEntity provinceDirectlyUnderDevice(@RequestBody List<RepelFieldingVo> repelFieldingVoList){
return ResponseEntity.ok(repelQueryService.judgeFieldingIsNotNormal(repelFieldingVoList)); return ResponseEntity.ok(repelQueryService.judgeFieldingIsNotNormal(repelFieldingVoList));
} }
@GetMapping(value ="/repel/fileMap/{taskId}") @GetMapping(value ="/repel/fileMap/{taskId}")
@ApiOperation(value = "根据任务ID查询业务相关单据", notes = "根据任务ID查询业务相关单据") @ApiOperation(value = "根据任务ID查询业务相关单据", notes = "根据任务ID查询业务相关单据")
public ResponseEntity repelFileMap( @PathVariable Integer taskId){ public ResponseEntity repelFileMap( @PathVariable Integer taskId){
return ResponseEntity.ok(repelQueryService.findByTaskIdToFileMapList(taskId)); return ResponseEntity.ok(repelQueryService.findByTaskIdToFileMapList(taskId));
} }
} }
package com.tykj.dev.device.sendback.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepel;
import com.tykj.dev.device.sendback.entity.vo.CityConfirmRequest;
import com.tykj.dev.device.sendback.entity.vo.ProvinceConfirmRequest;
import com.tykj.dev.device.sendback.service.RepelBusinessService;
import com.tykj.dev.device.sendback.service.SuspensionBillBusinessService;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.beans.Transient;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName SuspensionBillController.java
* @Description TODO
* @createTime 2021年09月03日 13:49:00
*/
@RestController
@Api(tags = "中止模块", description = "中止模块相关接口")
@AutoDocument
@RequestMapping("/suspension")
public class SuspensionBillController {
@Autowired
SuspensionBillBusinessService suspensionBillBusinessService;
@PostMapping(value ="/initiateSuspensionBill")
@ApiOperation(value = "生成中止任务接口", notes = "生成中止任务接口")
public ResponseEntity initiateRepel(@RequestBody List<Integer> ids,@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
suspensionBillBusinessService.initiateSuspensionBill1(ids,securityUser);
return ResponseEntity.ok("发布成功");
}
@PostMapping(value ="/initiateSuspensionBill2")
@ApiOperation(value = "直属单位生成中止任务接口", notes = "生成中止任务接口")
public ResponseEntity initiateRepel1(@RequestBody List<Integer> ids,@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
suspensionBillBusinessService.initiateSuspensionBill2(ids,securityUser);
return ResponseEntity.ok("发布成功");
}
@ApiOperation(value = "市确认任务接口", notes = "市确认任务接口")
@PostMapping(value ="/cityConfirm")
public ResponseEntity cityConfirm(@RequestBody CityConfirmRequest cityConfirmRequest, @ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
suspensionBillBusinessService.cityConfirm(cityConfirmRequest,securityUser);
return ResponseEntity.ok("市转发省级任务成功");
}
@ApiOperation(value = "省确认任务接口", notes = "省确认任务接口")
@PostMapping(value ="/provinceConfirm")
public ResponseEntity resolveRepel(@RequestBody ProvinceConfirmRequest provinceConfirmRequest, @ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
suspensionBillBusinessService.provinceConfirm(provinceConfirmRequest,securityUser);
return ResponseEntity.ok("市转发省级任务成功");
}
@GetMapping(value = "/select/id/{taskId}")
@ApiOperation(value = "根据任务查询中止业务详情")
public ResponseEntity findByTaskId(@PathVariable Integer taskId){
return ResponseEntity.ok(suspensionBillBusinessService.findByTaskId(taskId));
}
}
...@@ -3,11 +3,13 @@ package com.tykj.dev.device.sendback.entity.domain; ...@@ -3,11 +3,13 @@ package com.tykj.dev.device.sendback.entity.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.misc.base.BaseEntity; import com.tykj.dev.misc.base.BaseEntity;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
...@@ -146,5 +148,9 @@ public class DeviceRepel extends BaseEntity { ...@@ -146,5 +148,9 @@ public class DeviceRepel extends BaseEntity {
@ApiModelProperty(value = "涉及型号集合 添加填写") @ApiModelProperty(value = "涉及型号集合 添加填写")
private List<String> models; private List<String> models;
public DeviceRepel toNew(){
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(this, DeviceRepel.class);
}
} }
package com.tykj.dev.device.sendback.entity.domain;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.Temperature;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Transient;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName RepelEscrow.java
* @Description TODO
* @createTime 2021年09月13日 16:16:00
*/
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@ApiModel("清退代管单位")
public class RepelEscrow extends BaseEntity {
/**
* 代管单位id
*/
private Integer unitId;
@Column(name = "device_ids",columnDefinition = "TEXT")
private String deviceIds;
@Column(name = "file_rets",columnDefinition = "TEXT")
private String fileRets;
/**
* 直属代管状态
*/
private Integer escrowStatus;
/**
* 清退总任务id
*/
private Integer repelId;
@Transient
private List<FileRet> fileRetList;
@Transient
private List<DeviceLibrary> deviceLibraries;
@Transient
private String unitName;
public RepelEscrow(Integer unitId, Integer escrowStatus, Integer repelId) {
this.unitId = unitId;
this.escrowStatus = escrowStatus;
this.repelId = repelId;
}
}
package com.tykj.dev.device.sendback.entity.domain;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.repair.subject.vo.BillVo;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName SuspensionBill.java
* @Description 中止业务 实体类
* @createTime 2021年08月29日 12:23:00
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@ApiModel("中止业务实体")
@NoArgsConstructor
@AllArgsConstructor
public class SuspensionBill extends BaseEntity {
/**
* 标题
*/
@ApiModelProperty(value = "单据编号")
private String title;
/**
* 编号
*/
@ApiModelProperty(value = "单据编号")
private String num;
/**
* 发件单位
*/
@ApiModelProperty(value = "发件单位id")
private Integer sendUnitId;
/**
* 收件单位
*/
@ApiModelProperty(value = "收件单位id")
private Integer receiveUnitId;
/**
* 发件方经办人id
*/
@ApiModelProperty(value = "发件方id(A岗位)")
private Integer sendUserId;
/**
* 发件方经办人名称
*/
@ApiModelProperty(value = "发件方名称(A岗位)")
private String senderUserName;
/**
* 收件单位经办人id
*/
@ApiModelProperty(value = "发件方id(A岗位)")
private Integer receiveUserId;
/**
* 收件单位经办人名称
*/
@ApiModelProperty(value = "发件方名称(A岗位)")
private String receiveUserName;
@Column(name = "bill_vos",columnDefinition = "TEXT")
private String billVos;
@ApiModelProperty(value = "相关任务ID")
private Integer relatedTaskId;
@ApiModelProperty(value = "相关任务业务类型")
private Integer businessType;
@Column(name = "sender_des",columnDefinition = "TEXT")
private String senderDes;
@Column(name = "receive_des",columnDefinition = "TEXT")
private String receiveDes;
@Column(name = "file_ret" ,columnDefinition = "TEXT")
private String fileRets;
/**
* 设备信息
*/
@Transient
private List<BillVo> billVoList = new ArrayList<>();
@Transient
private List<FileRet> fileSet;
@Transient
private String senderUnitName;
@Transient
private String relatedUnitName;
@Transient
private Boolean isEnd;
@Transient
private String iSNotCommitDes;
}
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.repair.subject.vo.BillVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName CityConfirmRequest.java
* @Description TODO
* @createTime 2021年09月02日 15:39:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("市级确认接口请求对象")
public class CityConfirmRequest {
@ApiModelProperty(value = "任务id")
private Integer taskId;
private String des;
/**
* 设备信息 do
*/
private List<BillVo> billVoList = new ArrayList<>();
}
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.repair.subject.vo.BillVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName ProvinceConfirmRequest.java
* @Description TODO
* @createTime 2021年09月02日 16:37:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("省级确认接口请求对象")
public class ProvinceConfirmRequest {
@ApiModelProperty(value = "任务id")
private Integer taskId;
@ApiModelProperty(value = "任务id")
private String des;
@ApiModelProperty(value = "任务id")
private List<BillVo> billVoList;
}
package com.tykj.dev.device.sendback.entity.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zjm
* @version 1.0.0
* @ClassName RepelLongoing.java
* @Description TODO
* @createTime 2021年08月25日 10:10:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("清退任务撤回vo")
public class RepelLongoing {
private boolean flag;
private String des;
}
...@@ -3,6 +3,13 @@ package com.tykj.dev.device.sendback.repository; ...@@ -3,6 +3,13 @@ package com.tykj.dev.device.sendback.repository;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepel; import com.tykj.dev.device.sendback.entity.domain.DeviceRepel;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface DeviceRepelDao extends JpaRepository<DeviceRepel, Integer>, JpaSpecificationExecutor<DeviceRepel> { public interface DeviceRepelDao extends JpaRepository<DeviceRepel, Integer>, JpaSpecificationExecutor<DeviceRepel> {
@Modifying
@Query(value = "update DeviceRepel d set d.deleteTag = ?1 where d.id in ?2")
int updateDeviceRepelIsDelByIds(Integer deleteTag, List<Integer> ids);
} }
...@@ -3,6 +3,7 @@ package com.tykj.dev.device.sendback.repository; ...@@ -3,6 +3,7 @@ package com.tykj.dev.device.sendback.repository;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail; import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import java.util.Date; import java.util.Date;
...@@ -15,4 +16,8 @@ public interface DeviceRepelDetailDao extends JpaRepository<DeviceRepelDetail, I ...@@ -15,4 +16,8 @@ public interface DeviceRepelDetailDao extends JpaRepository<DeviceRepelDetail, I
List<DeviceRepelDetail> findAllBySendUnitIdOrReceiveUnitId(Integer unitId); List<DeviceRepelDetail> findAllBySendUnitIdOrReceiveUnitId(Integer unitId);
List<DeviceRepelDetail> findAllByReceiveUnitIdIn(List<Integer> ids); List<DeviceRepelDetail> findAllByReceiveUnitIdIn(List<Integer> ids);
@Modifying
@Query(value = "update DeviceRepelDetail d set d.deleteTag = ?1 where d.id in ?2")
int updateDeviceRepelDetailIsDelByIds(Integer deleteTag, List<Integer> ids);
} }
package com.tykj.dev.device.sendback.repository;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.domain.RepelEscrow;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName RepelEscrowDao.java
* @Description TODO
* @createTime 2021年09月14日 15:30:00
*/
public interface RepelEscrowDao extends JpaRepository<RepelEscrow, Integer>, JpaSpecificationExecutor<RepelEscrow> {
List<RepelEscrow> findAllByRepelId(Integer repelId);
}
package com.tykj.dev.device.sendback.repository;
import com.tykj.dev.device.sendback.entity.domain.SuspensionBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface SuspensionBillDao extends JpaRepository<SuspensionBill, Integer>, JpaSpecificationExecutor<SuspensionBill> {
}
...@@ -47,4 +47,6 @@ public interface DeviceRepelDetailService { ...@@ -47,4 +47,6 @@ public interface DeviceRepelDetailService {
Map<String, List<FileRet>> findByIdToFileMapList(Integer id); Map<String, List<FileRet>> findByIdToFileMapList(Integer id);
int updateDeviceRepelDetailByIds(Integer deleteTag, List<Integer> ids);
} }
...@@ -19,4 +19,9 @@ public interface DeviceRepelService { ...@@ -19,4 +19,9 @@ public interface DeviceRepelService {
* 查询所有未完成的清退信息列表 * 查询所有未完成的清退信息列表
*/ */
List<DeviceRepel> findNotEndDeviceRepel(); List<DeviceRepel> findNotEndDeviceRepel();
/**
* 根据业务id更新删除字段
*/
int updateDeviceRepelIsDelByIds(Integer deleteTag,List<Integer> ids);
} }
...@@ -2,10 +2,8 @@ package com.tykj.dev.device.sendback.service; ...@@ -2,10 +2,8 @@ package com.tykj.dev.device.sendback.service;
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.OrderOutData; import com.tykj.dev.device.sendback.entity.domain.RepelEscrow;
import com.tykj.dev.device.sendback.entity.vo.RepelAuditResult; import com.tykj.dev.device.sendback.entity.vo.*;
import com.tykj.dev.device.sendback.entity.vo.ResolveConfirm;
import com.tykj.dev.device.sendback.entity.vo.StorageDeviceRepel;
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.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
...@@ -17,7 +15,7 @@ public interface RepelBusinessService { ...@@ -17,7 +15,7 @@ public interface RepelBusinessService {
/** /**
* 发起清退任务 * 发起清退任务
*/ */
void initiateRepel(DeviceRepel deviceRepel, Integer userId); void initiateRepel(DeviceRepel deviceRepel, Integer userId,SecurityUser securityUser);
/** /**
* 市分解任务 * 市分解任务
...@@ -151,5 +149,11 @@ public interface RepelBusinessService { ...@@ -151,5 +149,11 @@ public interface RepelBusinessService {
* 清退总任务 撤销 * 清退总任务 撤销
* 判断下面任务是否存在配发中的 有则不能撤回需要等配发结束后在撤回。 * 判断下面任务是否存在配发中的 有则不能撤回需要等配发结束后在撤回。
*/ */
List<TaskBto> repelWithdraw(Integer taskId); RepelLongoing repelWithdrawCherck(Integer taskId);
void repelWithdraw(Integer taskId);
RepelEscrow saveRepelEscrow(RepelEscrow repelEscrow);
} }
package com.tykj.dev.device.sendback.service;
import com.tykj.dev.device.sendback.entity.domain.RepelEscrow;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName RepelEscrowService.java
* @Description TODO
* @createTime 2021年09月14日 15:29:00
*/
public interface RepelEscrowService {
/**
* 保存直属单位清退信息
*/
void saveRepelEscrowService(RepelEscrow repelEscrow);
/**
* 批量保存直属单位清退信息
*/
void saveAllRepelEscrowService(List<RepelEscrow> repelEscrows);
/**
* 保存直属单位清退信息
* @param repelEscrowID 直属单位清退id
* @return 直属单位详情
*/
RepelEscrow findByRepelEscrow(Integer repelEscrowID);
/**
* 根据清退业务ID查询所有相关代管单位
* @param billId 清退ID
* @return 代管单位单位集合
*/
List<RepelEscrow> findAllBillId(Integer billId);
}
...@@ -4,6 +4,7 @@ import com.tykj.dev.device.file.entity.FileRet; ...@@ -4,6 +4,7 @@ import com.tykj.dev.device.file.entity.FileRet;
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.domain.RepelEscrow;
import com.tykj.dev.device.sendback.entity.vo.*; import com.tykj.dev.device.sendback.entity.vo.*;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -81,7 +82,7 @@ public interface RepelQueryService { ...@@ -81,7 +82,7 @@ public interface RepelQueryService {
/** /**
* 查询直属单位列表 * 查询直属单位列表
*/ */
List<DirectlyUnderNavigation> directlyUnderUnitLeftNavigation(Integer taskId,Integer type); List<RepelEscrow> directlyUnderUnitLeftNavigation(Integer taskId, Integer type);
/** /**
*省直属任务装备已选择装备列表接口 *省直属任务装备已选择装备列表接口
......
package com.tykj.dev.device.sendback.service;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.sendback.entity.domain.SuspensionBill;
import com.tykj.dev.device.sendback.entity.vo.CityConfirmRequest;
import com.tykj.dev.device.sendback.entity.vo.ProvinceConfirmRequest;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName SuspensionBillBusinessService.java
* @Description 中止业逻辑层
* @createTime 2021年09月02日 13:43:00
*/
public interface SuspensionBillBusinessService {
/**
*自动生成中止任务
*/
void initiateSuspensionBill(List<Integer> libraryList, Units units, User user);
/**
*手动触发中止任务
*/
void initiateSuspensionBill1(List<Integer> libraryList,SecurityUser securityUser);
/**
* 直属单位中止任务生成
*/
void initiateSuspensionBill2(List<Integer> libraryList,SecurityUser securityUser);
/**
* 市级确认任务 - 提交省级确认
*/
void cityConfirm(CityConfirmRequest cityConfirmRequest,SecurityUser securityUser);
/**
* 省级确认任务 - 任务结束
*/
void provinceConfirm(ProvinceConfirmRequest provinceConfirmRequest,SecurityUser securityUser);
/**
* 根据任务id查询中止业务详情
*/
SuspensionBill findByTaskId(Integer taskId);
}
package com.tykj.dev.device.sendback.service;
import com.tykj.dev.device.sendback.entity.domain.SuspensionBill;
/**
* @author zjm
* @version 1.0.0
* @ClassName SuspensionBillService.java
* @Description
* @createTime 2021年09月02日 10:35:00
*/
public interface SuspensionBillService {
/**
* 中止业务实体添加
* @param suspensionBill 中止业务实体
* @return 保存后的中止业务实体
*/
SuspensionBill saveSuspensionBill(SuspensionBill suspensionBill);
/**
* 查询中止业务实体
*/
SuspensionBill findByIdToSuspensionBill(Integer id);
}
...@@ -42,7 +42,6 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService { ...@@ -42,7 +42,6 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
@Autowired @Autowired
DeviceLibraryDao deviceLibraryDao; DeviceLibraryDao deviceLibraryDao;
@Override @Override
public DeviceRepelDetail saveDeviceRepelDetail(DeviceRepelDetail deviceRepelDetail) { public DeviceRepelDetail saveDeviceRepelDetail(DeviceRepelDetail deviceRepelDetail) {
log.info("[清退] 详情添加成功"); log.info("[清退] 详情添加成功");
...@@ -135,6 +134,12 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService { ...@@ -135,6 +134,12 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
} }
} }
@Override
public int updateDeviceRepelDetailByIds(Integer deleteTag, List<Integer> ids) {
return deviceRepelDetailDao.updateDeviceRepelDetailIsDelByIds(deleteTag,ids);
}
private Specification<DeviceRepelDetail> getFindRetiredSpecification(RepelDetailSelectVo repelDetailSelectVo) { private Specification<DeviceRepelDetail> getFindRetiredSpecification(RepelDetailSelectVo repelDetailSelectVo) {
PredicateBuilder<DeviceRepelDetail> predicateBuilder = Specifications.and(); PredicateBuilder<DeviceRepelDetail> predicateBuilder = Specifications.and();
......
...@@ -57,4 +57,9 @@ public class DeviceRepelServiceImpl implements DeviceRepelService { ...@@ -57,4 +57,9 @@ public class DeviceRepelServiceImpl implements DeviceRepelService {
public List<DeviceRepel> findNotEndDeviceRepel() { public List<DeviceRepel> findNotEndDeviceRepel() {
return deviceRepelDao.findAll().stream().filter(deviceRepel -> deviceRepel.getStatus()==0).collect(Collectors.toList()); return deviceRepelDao.findAll().stream().filter(deviceRepel -> deviceRepel.getStatus()==0).collect(Collectors.toList());
} }
@Override
public int updateDeviceRepelIsDelByIds(Integer deleteTag, List<Integer> ids) {
return deviceRepelDao.updateDeviceRepelIsDelByIds(deleteTag,ids);
}
} }
...@@ -8,6 +8,7 @@ import com.tykj.dev.device.file.entity.FileRet; ...@@ -8,6 +8,7 @@ import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.file.service.PdfService; import com.tykj.dev.device.file.service.PdfService;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryService; 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;
...@@ -15,10 +16,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary; ...@@ -15,10 +16,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
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.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.packing.repository.PackingLibraryDao; import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepel; import com.tykj.dev.device.sendback.entity.domain.*;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.domain.RepelDeviceUnit;
import com.tykj.dev.device.sendback.entity.domain.RepelTaskStatistical;
import com.tykj.dev.device.sendback.entity.vo.*; import com.tykj.dev.device.sendback.entity.vo.*;
import com.tykj.dev.device.sendback.service.*; import com.tykj.dev.device.sendback.service.*;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
...@@ -40,7 +38,6 @@ import com.tykj.dev.misc.base.StatusEnum; ...@@ -40,7 +38,6 @@ 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.*; import com.tykj.dev.misc.utils.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -50,6 +47,7 @@ import java.time.LocalDateTime; ...@@ -50,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.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -90,6 +88,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -90,6 +88,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Autowired @Autowired
UserService userService; UserService userService;
@Autowired
SuspensionBillBusinessService suspensionBillBusinessService;
@Autowired @Autowired
AreaService areaService; AreaService areaService;
...@@ -108,15 +109,18 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -108,15 +109,18 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Autowired @Autowired
PdfService pdfService; PdfService pdfService;
@Autowired
RepelEscrowService repelEscrowService;
/** /**
* 发起申请后清退任务 * 发起申请后清退任务
* *
* @param deviceRepel * @param deviceRepel
* @param userId * @param userId
*/ */
@Override // @Override
@Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public void initiateRepel(DeviceRepel deviceRepel, Integer userId) { public void initiateRepel1(DeviceRepel deviceRepel, Integer userId) {
//生成一个清退任务 省清退任务 类型为 清退统计 17 16清退 //生成一个清退任务 省清退任务 类型为 清退统计 17 16清退
//参照选择的范围给单位都发送 市清退任务待执行 //参照选择的范围给单位都发送 市清退任务待执行
//如果省本身有需要清退的型号,给省自己发起一个代办任务 本级装备待清退 //如果省本身有需要清退的型号,给省自己发起一个代办任务 本级装备待清退
...@@ -154,7 +158,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -154,7 +158,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
); );
//市区关系信息 //市区关系信息
Map<Integer, List<SupervisorVo>> supervisorMap = new HashMap<>(); Map<Integer, List<SupervisorVo>> supervisorMap = new HashMap<>();
//省直属 待考虑 //省直属 待考虑
unitNameMap.forEach((k, v) -> { unitNameMap.forEach((k, v) -> {
Units units1 = unitsService.findbyName(k); Units units1 = unitsService.findbyName(k);
...@@ -255,11 +258,219 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -255,11 +258,219 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
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), ""));
} }
if (list == null || list.size() == 0) { if (list == null || list.size() == 0) {
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1212, userId); throw new ApiException(ResponseEntity.ok("发布失败"));
// taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1212, userId);
} }
repelTaskStatisticalService.saveAllRepelTaskStatistical(list); repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
} }
//测试版本
@Override
@Transactional(rollbackFor = Exception.class)
public void initiateRepel(DeviceRepel deviceRepel, Integer userId,SecurityUser securityUser) {
//生成一个清退任务 省清退任务 类型为 清退统计 17 16清退
//参照选择的范围给单位都发送 市清退任务待执行
//如果省本身有需要清退的型号,给省自己发起一个代办任务 本级装备待清退
//生成的任务放入统计表中 关联信息
//把清退账单存储到数据表中
//写入业务日志
User user = userService.findByUser(userId);
Units units = unitsService.findById(user.getUnitsId());
Area area = areaService.findByid(units.getAreaId());
List<Integer> lifeStatus = new ArrayList<>();
lifeStatus.add(DeviceLifeStatus.IN_LIBRARY.id);
lifeStatus.add(DeviceLifeStatus.REPEL.id);
lifeStatus.add(DeviceLifeStatus.REPAIRING.id);
lifeStatus.add(DeviceLifeStatus.IN_TRANSIT.id);
lifeStatus.add(DeviceLifeStatus.USE.id);
lifeStatus.add(DeviceLifeStatus.SEND_BACK.id);
lifeStatus.add(DeviceLifeStatus.TO_BE_DESTROYED.id);
lifeStatus.add(DeviceLifeStatus.TO_BE_SCRAPPED.id);
List<Units> directlUnderUnitNames = new ArrayList<>();
AtomicBoolean directlUnderUnit = new AtomicBoolean(false);
AtomicBoolean correspondingLevel = new AtomicBoolean(false);
deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds()));
deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets()));
deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes()));
Map<String, Integer> unitNameMap = new HashMap<>();
List<String> seqNumbers = DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers());
if (seqNumbers.size() != 0) {
log.info("申请任务触发清退任务");
deviceLibraryService.findAllBySeqNumber(seqNumbers).forEach(
deviceLibrary -> {
if (!unitNameMap.containsKey(deviceLibrary.getOwnUnit())) {
unitNameMap.put(deviceLibrary.getOwnUnit(), 0);
}
}
);
//市区关系信息
Map<Integer, List<SupervisorVo>> supervisorMap = new HashMap<>();
//省直属 待考虑
unitNameMap.forEach((k, v) -> {
Units units1 = unitsService.findbyName(k);
//区
List<SupervisorVo> supervisorVoList = new ArrayList<>();
if (units1.getLevel() == 3) {
Area area1 = areaService.findByid(units1.getAreaId());
Units father = unitsService.findUnitAreaId(area1.getFatherId());
if (supervisorMap.containsKey(father.getUnitId())) {
List<SupervisorVo> supervisorVoList1 = supervisorMap.get(father.getUnitId());
supervisorVoList1.add(new SupervisorVo(units1.getName(), units1.getUnitId()));
supervisorMap.put(father.getUnitId(), supervisorVoList1);
} else {
supervisorVoList.add(new SupervisorVo(units1.getName(), units1.getUnitId()));
supervisorMap.put(father.getUnitId(), supervisorVoList);
}
} else {
if (supervisorMap.containsKey(units1.getUnitId())) {
List<SupervisorVo> supervisorVoList1 = supervisorMap.get(units1.getUnitId());
supervisorMap.put(units1.getUnitId(), supervisorVoList1);
} else {
supervisorVoList.add(new SupervisorVo(units1.getName(), units1.getUnitId()));
supervisorMap.put(units1.getUnitId(), supervisorVoList);
}
}
});
List<Integer> unitList = new ArrayList<>();
unitList.addAll(supervisorMap.keySet());
deviceRepel.setTaskScope(StringUtils.ListToString(unitList));
deviceRepel.setTaskScopes(unitList);
deviceRepel.setEquipmentInvolvingUnit(JacksonUtil.toJSon(supervisorMap));
}
DeviceRepel deviceRepel1 = deviceRepelService.saveDeviceRepel(deviceRepel);
TaskBto taskBto = statsXTask(units.getUnitId(), deviceRepel1.getId(), "["+units.getUnitDesc()+"]-"+deviceRepel.getTitle(), userId);
//给本单位其他专管员阅知
List<RepelTaskStatistical> list = new ArrayList<>();
Map<Units,List<Units>> mapUnitList=new HashMap<>();
Map<Units,Integer> unitTaskIDMap=new HashMap<>();
Map<String,List<DeviceLibrary>> unitNameDevice=toUnitListDeviceLibrary(deviceRepel.getFieldingIds(),seqNumbers,lifeStatus);
deviceRepel.getTaskScopes().forEach(
unisId -> {
Units units1 = unitsService.findById(unisId);
if (unisId != units.getUnitId()) {
if (units1.getType() == 2) {
directlUnderUnit.set(true);
directlUnderUnitNames.add(units1);
} else if (units1.getType() == 1) {
mapUnitList.put(units1,unitsService.findBySubordinateUnit(units1.getUnitId()));
}
} else {
correspondingLevel.set(true);
}
}
);
mapUnitList.forEach((k,v) ->{
AtomicReference<Integer> count= new AtomicReference<>(0);
v.forEach(units1 -> {
if (unitNameDevice.containsKey(units1.getName())) {
count.set(count.get() + unitNameDevice.get(units1.getName()).size());
}
});
if (count.get()>0){
DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1);
deviceRepelDetail.setSendUnit(k.getName());
deviceRepelDetail.setSendUnitId(k.getUnitId());
//判断是否为
//生成任务状态为1206的清退任务
if (deviceRepel.getRepelStatus()==2){
TaskBto taskBto1 = cityRepelTask(k.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "[" + k.getUnitDesc() + "]" + deviceRepel.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 5, k.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), ""));
}else {
TaskBto taskBto1 = cityRepelTask1206(k.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "[" + k.getUnitDesc() + "]" + deviceRepel.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 5, k.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), ""));
DeviceRepel deviceRepel2 = new DeviceRepel();
deviceRepel2.setTaskScopes(v.stream().map(Units::getUnitId).collect(Collectors.toList()));
deviceRepel2.setId(null);
deviceRepel2.setTitle(deviceRepel.getTitle());
deviceRepel2.setTime(deviceRepel.getTime());
deviceRepel2.setFieldingIds(deviceRepel.getFieldingIds());
deviceRepel2.setEquipmentInvolvingUnit(deviceRepel1.getEquipmentInvolvingUnit());
deviceRepel2.setSeqNumbers(deviceRepel1.getSeqNumbers());
deviceRepel2.setStatus(deviceRepel1.getStatus());
deviceRepel2.setRepelStatus(deviceRepel1.getRepelStatus());
deviceRepel2.setFileRets(deviceRepel.getFileRets());
deviceRepel2.setDescribes(deviceRepel.getDescribes());
automaticResolveRepel(deviceRepel2, taskBto1.getId(), k, v, unitNameDevice,user);
}
}
});
DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1);
deviceRepelDetail.setSendUnitId(units.getUnitId());
deviceRepelDetail.setSendUnit(units.getName());
deviceRepelDetail.setRepelType(2);
AtomicReference<Integer> count= new AtomicReference<>(0);
List<DeviceLibrary> deviceLibraries=new ArrayList<>();
//直属代管设备
List<RepelEscrow> escrows=new ArrayList<>();
directlUnderUnitNames.forEach(
units1->{
if (unitNameDevice.containsKey(units1.getName())) {
List<DeviceLibrary> deviceLibraryList=unitNameDevice.get(units1.getName());
deviceLibraries.addAll(deviceLibraryList.stream().filter(deviceLibrary -> !deviceLibrary.getLocationUnit().equals(deviceLibrary.getOwnUnit()) && deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.REPAIRING.id)).collect(Collectors.toList()));
count.set(count.get() + unitNameDevice.get(units1.getName()).size());
escrows.add(new RepelEscrow(units1.getUnitId(),1,deviceRepel1.getId()));
}
}
);
//直属单位是否存所属所在不同的设备
if (deviceLibraries.size()!=0){
suspensionBillBusinessService.initiateSuspensionBill2(deviceLibraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList()), securityUser);
}
if (directlUnderUnit.get() && count.get() != 0) {
TaskBto taskBto2 = directlyUnderTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(), "[省直属相关单位]-"+ deviceRepel.getTitle(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto2.getId(), 0, "省直属", repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), ""));
repelEscrowService.saveAllRepelEscrowService(escrows);
}
DeviceRepelDetail deviceRepelDetail1 = new DeviceRepelDetail();
deviceRepelDetail1.setRepelId(deviceRepel1.getId());
deviceRepelDetail1.setRepelStatus(1);
deviceRepelDetail1.setSendUnitId(units.getUnitId());
deviceRepelDetail1.setSendUnit(units.getName());
List<String> strings = new ArrayList<>();
strings.add(units.getName());
deviceRepelDetail1.setRepelType(3);
if (unitNameDevice.containsKey(units.getName())){
count.set(unitNameDevice.get(units.getName()).size());
}else {
count.set(0);
}
if (correspondingLevel.get() && count.get() != 0) {
TaskBto taskBto1 = oneselfTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail1).getId(), taskBto.getId(), "[省本级]-"+deviceRepel.getTitle(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, "省本级", repelStatusJudgeCount(deviceRepel.getRepelStatus(), count.get()), ""));
}
if (list == null || list.size() == 0) {
throw new ApiException(ResponseEntity.ok("发布失败"));
}
repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
}
@Autowired
DeviceLibraryCacheService deviceLibraryCacheService;
private Map<String,List<DeviceLibrary>> toUnitListDeviceLibrary(List<Integer> fieldingIds,List<String> seqNums,List<Integer> lifeStatusList){
Map<String,List<DeviceLibrary>> map=deviceLibraryService.findAllDeviceLibraryList()
.stream()
.filter(deviceLibrary -> {
if (seqNums!=null && seqNums.size()!=0){
return seqNums.contains(deviceLibrary.getSeqNumber())&&lifeStatusList.contains(deviceLibrary.getLifeStatus());
}else {
return fieldingIds.contains(deviceLibrary.getPackingId())&&lifeStatusList.contains(deviceLibrary.getLifeStatus());
}
})
.collect(Collectors.groupingBy(DeviceLibrary::getOwnUnit));
return map;
}
private Integer repelStatusJudgeCount(Integer repelStatus, Integer count) { private Integer repelStatusJudgeCount(Integer repelStatus, Integer count) {
if (repelStatus == 1) { if (repelStatus == 1) {
return count; return count;
...@@ -268,6 +479,52 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -268,6 +479,52 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
} }
} }
private void automaticResolveRepel(DeviceRepel deviceRepel, Integer taskId,Units units,List<Units> unitsList,Map<String,List<DeviceLibrary>> unitNameDevice,User user){
deviceRepel.setFielding(StringUtils.ListToString(deviceRepel.getFieldingIds()));
deviceRepel.setTaskScope(StringUtils.ListToString(deviceRepel.getTaskScopes()));
deviceRepel.setFiles(FilesUtil.stringFileToList(deviceRepel.getFileRets()));
DeviceRepel deviceRepel1 = deviceRepelService.saveDeviceRepel(deviceRepel);
TaskBto taskBto = cityTotalTask(units.getUnitId(), deviceRepel1.getId(), "["+units.getName()+"]-"+deviceRepel1.getTitle(), taskId, 0);
List<DeviceLibrary> deviceLibraries=new ArrayList<>();
List<RepelTaskStatistical> list = new ArrayList<>();
unitsList.forEach(
units1 -> {
if (!units1.getName().equals(units.getName())) {
DeviceRepelDetail deviceRepelDetail = new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1);
deviceRepelDetail.setSendUnit(units1.getName());
deviceRepelDetail.setSendUnitId(units1.getUnitId());
if (unitNameDevice.containsKey(units1.getName())) {
List<DeviceLibrary> deviceLibraryList=unitNameDevice.get(units1.getName());
deviceLibraries.addAll(deviceLibraryList.stream().filter(deviceLibrary -> !deviceLibrary.getLocationUnit().equals(deviceLibrary.getOwnUnit()) && deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.REPAIRING.id)).collect(Collectors.toList()));
TaskBto taskBto1 = countyRepelTask(units1.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "["+units1.getName()+"]-"+deviceRepel1.getTitle(), taskBto.getId(), 0);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, units1.getUnitDesc(), repelStatusJudgeCount(deviceRepel.getRepelStatus(), deviceLibraryList.size()), ""));
}
}else {
if (unitNameDevice.containsKey(units1.getName())){
deviceLibraries.addAll(unitNameDevice.get(units1.getName()).stream().filter(deviceLibrary -> !deviceLibrary.getLocationUnit().equals(deviceLibrary.getOwnUnit())&& deviceLibrary.getLifeStatus().equals(DeviceLifeStatus.REPAIRING.id)).collect(Collectors.toList()));
}
}
}
);
//判断是否有维修的设备 发起中止任务
if (deviceLibraries.size()!=0){
suspensionBillBusinessService.initiateSuspensionBill(deviceLibraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList()), units,user);
}
if (list == null || list.size() == 0) {
taskService.moveToEnd(taskBto);
}
repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void resolveRepel(DeviceRepel deviceRepel, Integer taskId, Integer userId) { public void resolveRepel(DeviceRepel deviceRepel, Integer taskId, Integer userId) {
...@@ -474,7 +731,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -474,7 +731,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//装备状态改为锁定 //装备状态改为锁定
if (resolveConfirm.getDevIds() != null && resolveConfirm.getDevIds().size() != 0) { if (resolveConfirm.getDevIds() != null && resolveConfirm.getDevIds().size() != 0) {
deviceLibraryDao.upDateLockStatus(1, resolveConfirm.getDevIds()); deviceLibraryService.upDateLockStatus(1, resolveConfirm.getDevIds());
} }
deviceRepelDetail.setDeviceIds(StringUtils.ListToString(resolveConfirm.getDevIds())); deviceRepelDetail.setDeviceIds(StringUtils.ListToString(resolveConfirm.getDevIds()));
if (resolveConfirm.getDes() != null && !resolveConfirm.getDes().equals("")) { if (resolveConfirm.getDes() != null && !resolveConfirm.getDes().equals("")) {
...@@ -512,13 +769,12 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -512,13 +769,12 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
taskBto = taskService.moveToEnd(taskBto); taskBto = taskService.moveToEnd(taskBto);
deviceRepelDetail.setRepelStatus(3); deviceRepelDetail.setRepelStatus(3);
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
// addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"清退任务审核通过,无提交装备任务结束",findUnitId(taskBto.getOwnUnit())));
} }
} else { } else {
//审核失败 //审核失败
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1206, 0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1206, 0);
if (deviceRepelDetail.getDeviceIds() != null && !deviceRepelDetail.getDeviceIds().equals("")) { if (deviceRepelDetail.getDeviceIds() != null && !deviceRepelDetail.getDeviceIds().equals("")) {
deviceLibraryDao.upDateLockStatus(0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLockStatus(0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
deviceRepelDetail.setDeviceIds(null); deviceRepelDetail.setDeviceIds(null);
} }
} }
...@@ -559,7 +815,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -559,7 +815,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList())); orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList()));
orderOutDataRepelDetail.setApplyFiles(FilesUtil.stringFileToList(orderOutData.getApplyFileList())); orderOutDataRepelDetail.setApplyFiles(FilesUtil.stringFileToList(orderOutData.getApplyFileList()));
deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail);
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.SEND_BACK_IN.id, StringUtils.stringToList(orderOutDataRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.SEND_BACK_IN.id, StringUtils.stringToList(orderOutDataRepelDetail.getDeviceIds()));
taskBto.setCreateUserId(userId); taskBto.setCreateUserId(userId);
taskBto.setOwnUnit(orderOutData.getReceiveUnitId()); taskBto.setOwnUnit(orderOutData.getReceiveUnitId());
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1209, 0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1209, 0);
...@@ -708,9 +964,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -708,9 +964,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
if (units.getLevel() == 1) { if (units.getLevel() == 1) {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} else { } else {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} }
List<DeviceLibrary> libraries = findInvoleDevice(deviceRepelDetail.getDeviceIds()); List<DeviceLibrary> libraries = findInvoleDevice(deviceRepelDetail.getDeviceIds());
libraries.forEach( libraries.forEach(
...@@ -737,9 +993,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -737,9 +993,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
repelTaskStatistical.setTaskStatus(1); repelTaskStatistical.setTaskStatus(1);
if (units.getLevel() == 1) { if (units.getLevel() == 1) {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} else { } else {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} }
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId)); taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id, taskId));
...@@ -804,9 +1060,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -804,9 +1060,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
log.info("更新数据装备以及所属单位-{}", libraries.size()); log.info("更新数据装备以及所属单位-{}", libraries.size());
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
if (units.getLevel() == 2) { if (units.getLevel() == 2) {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getSendUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SEND_BACK.id, deviceRepelDetail.getSendUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} else { } else {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getSendUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getSendUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}", System.currentTimeMillis() - time); log.info("更新数据装备以及所属单位{}", System.currentTimeMillis() - time);
} }
devLogAdd(libraries, "省本级清退,把装备转变为待清退", userId, taskId); devLogAdd(libraries, "省本级清退,把装备转变为待清退", userId, taskId);
...@@ -827,26 +1083,16 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -827,26 +1083,16 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), StatusEnum.SEND_BACK_1202); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), StatusEnum.SEND_BACK_1202);
DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel = deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
Map<String, List<Integer>> map = new HashMap<>(); List<RepelEscrow> repelEscrowList = repelEscrowService.findAllBillId(deviceRepel.getId());
List<DeviceLibrary> libraries = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); List<DeviceLibrary> libraries =new ArrayList<>();
repelEscrowList.forEach(
libraries.forEach( repelEscrow -> {
deviceLibrary -> { libraries.addAll(JacksonUtil.readValue(repelEscrow.getDeviceIds(), new TypeReference<Collection<? extends DeviceLibrary>>() {
if (map.containsKey(deviceLibrary.getOwnUnit())) { }));
List<Integer> list = map.get(deviceLibrary.getOwnUnit());
list.add(deviceLibrary.getId());
map.put(deviceLibrary.getOwnUnit(), list);
} else {
List<Integer> list = new ArrayList<>();
list.add(deviceLibrary.getId());
map.put(deviceLibrary.getOwnUnit(), list);
}
} }
); );
deviceRepelDetail.setDirectlyUnderDevices(JacksonUtil.toJSon(map));
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
devLogAdd(libraries, "省直属清退,把装备转变为待清退", securityUser.getCurrentUserInfo().getUserId(), taskBto.getId()); devLogAdd(libraries, "省直属清退,把装备转变为待清退", securityUser.getCurrentUserInfo().getUserId(), taskBto.getId());
deviceLibraryDao.upDateLeftStatusAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), 0, libraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1213, 0); taskService.moveToSpecial(taskBto, StatusEnum.SEND_BACK_1213, 0);
} }
...@@ -904,9 +1150,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -904,9 +1150,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName()); deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName());
} }
if (units.getLevel() == 3) { if (units.getLevel() == 3) {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.IN_LIBRARY.id, deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} else { } else {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getReceiveUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
} }
deviceRepelDetail.setRepelStatus(2); deviceRepelDetail.setRepelStatus(2);
TaskBto fatherTask = taskService.get(taskBto.getParentTaskId()); TaskBto fatherTask = taskService.get(taskBto.getParentTaskId());
...@@ -944,7 +1190,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -944,7 +1190,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//给同级专管员推送阅知 //给同级专管员推送阅知
//装备在待退役中展示 //装备在待退役中展示
//任务完结 //任务完结
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.REPEL.id, ids); deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.REPEL.id, ids);
} }
...@@ -982,47 +1228,82 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -982,47 +1228,82 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
task.setDeleteTag(1); task.setDeleteTag(1);
taskService.deleteById(task); taskService.deleteById(task);
DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail = deviceRepelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId());
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryService.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
fatherTaskBto.setOwnUnit(units.getUnitId()); fatherTaskBto.setOwnUnit(units.getUnitId());
if (units.getLevel() == 3) { if (units.getLevel() == 3) {
taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1205, 0); taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1205, 0);
} else { } else {
taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1206, 0); taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1206, 0);
} }
} }
@Override @Override
public List<TaskBto> repelWithdraw(Integer taskId) { public RepelLongoing repelWithdrawCherck(Integer taskId) {
//首先查询总任务,把清退任务都查询出来 //首先查询总任务,把清退任务都查询出来
//SEND_BACK_1209 SEND_BACK_1215 SEND_BACK_1218 SEND_BACK_1220 TaskBto taskBto = taskService.get(taskId);
// TaskBto taskBto = taskService.get(taskId); DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(taskBto.getBillId());
// DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(taskBto.getBillId());
//市级清退16查询 //市级清退16查询
List<Integer> statusList=new ArrayList<>();
statusList.add(StatusEnum.SEND_BACK_1209.id);
statusList.add(StatusEnum.SEND_BACK_1215.id);
statusList.add(StatusEnum.SEND_BACK_1218.id);
statusList.add(StatusEnum.SEND_BACK_1220.id);
List<TaskBto> taskBtoList = taskService.findAllBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId); List<TaskBto> taskBtoList = taskService.findAllBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId);
if (deviceRepel.getRepelStatus()==2) {
boolean statisticalResult = taskBtoList.stream().allMatch(taskBto1 -> !taskBto1.getBillStatus().equals(StatusEnum.SEND_BACK_1206));
if (!statisticalResult) {
return new RepelLongoing(statisticalResult, "");
}
}else {
boolean statisticalResult = taskBtoList.stream().allMatch(taskBto1 -> !taskBto1.getBillStatus().equals(StatusEnum.SEND_BACK_1201));
if (!statisticalResult) {
return new RepelLongoing(statisticalResult, "");
}
}
List<Integer> ids=taskBtoList.stream().map(TaskBto::getId).collect(Collectors.toList()); List<Integer> ids=taskBtoList.stream().map(TaskBto::getId).collect(Collectors.toList());
//市级清退统计任务集合 //市级清退统计任务集合
List<TaskBto> statisticalList = taskService.findAllBillTypeAndFatherIdIn(BusinessEnum.SEND_BACK_STATISTICAL.id,ids); List<TaskBto> statisticalList = taskService.findAllBillTypeAndFatherIdIn(BusinessEnum.SEND_BACK_STATISTICAL.id,ids);
ids= statisticalList.stream().map(TaskBto::getId).collect(Collectors.toList()); ids= statisticalList.stream().map(TaskBto::getId).collect(Collectors.toList());
taskBtoList.addAll( taskService.findAllBillTypeAndFatherIdIn(BusinessEnum.SEND_BACK.id,ids)); boolean flag = taskService.findAllBillTypeAndFatherIdIn(BusinessEnum.SEND_BACK.id,ids).stream().allMatch(taskBto1 -> !taskBto1.equals(StatusEnum.SEND_BACK_1205.id));
boolean flag = taskBtoList.stream().allMatch(taskBto -> !statusList.contains(taskBto.getBillStatus())); if (!flag){
// log.info("test :{}",flag); return new RepelLongoing(flag,"");
if (flag){
//可以使用
}else {
//不可以撤回
} }
//判断是否存在为哪些状态为不能清退 //判断是否存在为哪些状态为不能清退
//不能清退都则返回否 告诉前端本次存在不能撤回都情况 //不能清退都则返回否 告诉前端本次存在不能撤回都情况
//可以撤回 需要把所有都相关任务封存 //可以撤回 需要把所有都相关任务封存
return taskBtoList; return new RepelLongoing(true,"");
}
@Override
@Transactional(rollbackFor = Exception.class)
public void repelWithdraw(Integer taskId) {
TaskBto taskBto = taskService.get(taskId);
DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(taskBto.getBillId());
//市级清退16查询
List<TaskBto> taskBtoList = taskService.findAllBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId);
List<Integer> billIds = taskBtoList.stream().map(TaskBto::getBillId).collect(Collectors.toList());
deviceRepelService.updateDeviceRepelIsDelByIds(1,billIds);
List<Integer> ids=taskBtoList.stream().map(TaskBto::getId).collect(Collectors.toList());
//市级清退统计任务集合
List<TaskBto> statisticalList = taskService.findAllBillTypeAndFatherIdIn(BusinessEnum.SEND_BACK_STATISTICAL.id,ids);
ids= statisticalList.stream().map(TaskBto::getId).collect(Collectors.toList());
List<TaskBto> taskBtos16 = taskService.findAllBillTypeAndFatherIdIn(BusinessEnum.SEND_BACK.id,ids);
billIds= taskBtos16.stream().map(TaskBto::getBillId).collect(Collectors.toList());
deviceRepelDetailService.updateDeviceRepelDetailByIds(1,billIds);
taskBtoList.addAll(statisticalList);
taskBtoList.addAll(taskBtos16);
//修改任务状态
} }
@Override
public RepelEscrow saveRepelEscrow(RepelEscrow repelEscrow) {
if (repelEscrow.getFileRets()==null&&repelEscrow.getFileRetList()!=null && repelEscrow.getFileRetList().size()!=0){
repelEscrow.setFileRets(FilesUtil.stringFileToList(repelEscrow.getFileRetList()));
}
if (repelEscrow.getDeviceIds()==null && repelEscrow.getDeviceLibraries()!=null && repelEscrow.getDeviceLibraries().size()!=0){
repelEscrow.setDeviceIds(JacksonUtil.toJSon(repelEscrow.getDeviceLibraries()));
}
repelEscrowService.saveRepelEscrowService(repelEscrow);
return repelEscrow;
}
/** /**
...@@ -1090,7 +1371,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1090,7 +1371,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
private TaskBto cityTotalTask(Integer unitId, Integer repelDetailId, String title, Integer parentId, Integer userId) { private TaskBto cityTotalTask(Integer unitId, Integer repelDetailId, String title, Integer parentId, Integer userId) {
List<Integer> list = new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(-1); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1204.id, title, parentId, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 1, "shi", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1204.id, title, parentId, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 1, "shi", list));
} }
...@@ -1106,7 +1387,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1106,7 +1387,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//省清退任务待市提交 //省清退任务待市提交
List<Integer> list = new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(userId); list.add(userId);
list.add(-1); list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1200.id, title, null, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 1, "", list)); return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1200.id, title, null, ".", repelDetailId, BusinessEnum.SEND_BACK_STATISTICAL.id, unitId, 1, "", list));
} }
...@@ -1126,6 +1407,22 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1126,6 +1407,22 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
} }
/**
* 省对市发起全部清退 任务直接自动转发 生成为转发后的状态
*
* @param unitId 执行单位id
* @param repelDetailId 账单id 详情
* @param title 标题
* @return task对象
*/
private TaskBto cityRepelTask1206(Integer unitId, Integer repelDetailId, String title, Integer parentTaskId, Integer userId) {
List<Integer> list = new ArrayList<>();
list.add(userId);
list.add(0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1206.id, title, parentTaskId, ".", repelDetailId, BusinessEnum.SEND_BACK.id, unitId, 1, "", list));
}
/** /**
* 清退出库等待上传回执单 * 清退出库等待上传回执单
* *
......
package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.sendback.entity.domain.RepelEscrow;
import com.tykj.dev.device.sendback.repository.RepelEscrowDao;
import com.tykj.dev.device.sendback.service.RepelEscrowService;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
* @author zjm
* @version 1.0.0
* @ClassName RepelEscrowServiceImpl.java
* @Description TODO
* @createTime 2021年09月14日 15:42:00
*/
@Service
public class RepelEscrowServiceImpl implements RepelEscrowService {
@Autowired
RepelEscrowDao repelEscrowDao;
@Autowired
DeviceLibraryService deviceLibraryService;
@Autowired
UnitsCache unitsCache;
@Override
public void saveRepelEscrowService(RepelEscrow repelEscrow) {
repelEscrowDao.save(repelEscrow);
}
@Override
public void saveAllRepelEscrowService(List<RepelEscrow> repelEscrows) {
repelEscrowDao.saveAll(repelEscrows);
}
@Override
public RepelEscrow findByRepelEscrow(Integer repelEscrowID) {
Optional<RepelEscrow> repelEscrowOptional = repelEscrowDao.findById(repelEscrowID);
if (repelEscrowOptional.isPresent()){
RepelEscrow repelEscrow=repelEscrowOptional.get();
if (repelEscrow.getDeviceIds()!=null){
repelEscrow.setDeviceLibraries(JacksonUtil.readValue(repelEscrow.getDeviceIds(), new TypeReference<List<DeviceLibrary>>() {
}));
}
if (repelEscrow.getFileRets()!=null){
repelEscrow.setFileRetList(FilesUtil.stringFileToList(repelEscrow.getFileRets()));
}
return repelEscrowOptional.get();
}else {
throw new ApiException("[直属清退] 根据数据id查询数据详情失败 id:"+repelEscrowID);
}
}
@Override
public List<RepelEscrow> findAllBillId(Integer billId) {
List<RepelEscrow> repelEscrows=repelEscrowDao.findAllByRepelId(billId);
repelEscrows.forEach(
repelEscrow -> {
Units units = unitsCache.findById(repelEscrow.getUnitId());
repelEscrow.setUnitName(units.getName());
if (repelEscrow.getDeviceIds()!=null){
repelEscrow.setDeviceLibraries(JacksonUtil.readValue(repelEscrow.getDeviceIds(), new TypeReference<List<DeviceLibrary>>() {
}));
}
if (repelEscrow.getFileRets()!=null){
repelEscrow.setFileRetList(FilesUtil.stringFileToList(repelEscrow.getFileRets()));
}
});
return repelEscrows;
}
}
...@@ -10,6 +10,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary; ...@@ -10,6 +10,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo; import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
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.domain.RepelEscrow;
import com.tykj.dev.device.sendback.entity.vo.*; import com.tykj.dev.device.sendback.entity.vo.*;
import com.tykj.dev.device.sendback.service.*; import com.tykj.dev.device.sendback.service.*;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
...@@ -58,6 +59,8 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -58,6 +59,8 @@ public class RepelQueryServiceImpl implements RepelQueryService {
UnitsService unitsService; UnitsService unitsService;
@Autowired @Autowired
RepelDeviceUnitService deviceUnitService; RepelDeviceUnitService deviceUnitService;
@Autowired
RepelEscrowService repelEscrowService;
@Override @Override
public RepelStatisticsVo findRepelTaskStatisticals(Integer taskId, Integer billId) { public RepelStatisticsVo findRepelTaskStatisticals(Integer taskId, Integer billId) {
...@@ -69,6 +72,15 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -69,6 +72,15 @@ public class RepelQueryServiceImpl implements RepelQueryService {
public DeviceRepelDetail findDeviceRepelDetail(Integer taskId) { public DeviceRepelDetail findDeviceRepelDetail(Integer taskId) {
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto= taskService.get(taskId);
DeviceRepelDetail deviceRepelDetail= repelDetailService.findDeviceRepelDetail(taskBto.getBillId()); DeviceRepelDetail deviceRepelDetail= repelDetailService.findDeviceRepelDetail(taskBto.getBillId());
if (taskBto.getCustomInfo().equals("DirectlyUnder")){
List<DeviceLibrary> libraryList=new ArrayList<>();
repelEscrowService.findAllBillId(deviceRepelDetail.getRepelId()).forEach(
repelEscrow -> {
libraryList.addAll(repelEscrow.getDeviceLibraries());
}
);
deviceRepelDetail.setDeviceLibraryEntities(libraryList);
}
if (deviceRepelDetail.getScriptJson()!=null) { if (deviceRepelDetail.getScriptJson()!=null) {
deviceRepelDetail.setScripts(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() { deviceRepelDetail.setScripts(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {
})); }));
...@@ -373,12 +385,12 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -373,12 +385,12 @@ public class RepelQueryServiceImpl implements RepelQueryService {
map.put(deviceLibrary.getOwnUnit(), librarieList); map.put(deviceLibrary.getOwnUnit(), librarieList);
} }
} else { } else {
allDirectUnderDevVo.setUnitName(deviceLibrary.getName()); allDirectUnderDevVo.setUnitName(deviceLibrary.getOwnUnit());
allDirectUnderDevVo.setNotAbnormal(true); allDirectUnderDevVo.setNotAbnormal(true);
break; break;
} }
} else { } else {
allDirectUnderDevVo.setUnitName(deviceLibrary.getName()); allDirectUnderDevVo.setUnitName(deviceLibrary.getOwnUnit());
allDirectUnderDevVo.setNotAbnormal(true); allDirectUnderDevVo.setNotAbnormal(true);
break; break;
} }
...@@ -389,26 +401,17 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -389,26 +401,17 @@ public class RepelQueryServiceImpl implements RepelQueryService {
@Override @Override
public List<DirectlyUnderNavigation> directlyUnderUnitLeftNavigation(Integer taskId,Integer type) { public List<RepelEscrow> directlyUnderUnitLeftNavigation(Integer taskId,Integer type) {
List<DirectlyUnderNavigation> list=new ArrayList<>();
DeviceRepelDetail deviceRepelDetail; DeviceRepelDetail deviceRepelDetail;
if (type==1){ if (type==1){
TaskBto taskBto= taskService.get(taskId); TaskBto taskBto = taskService.get(taskId);
deviceRepelDetail=repelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId()); deviceRepelDetail =repelDetailService.findDeviceRepelDetailNoDev(taskBto.getBillId());
}else { }else {
deviceRepelDetail=repelDetailService.findDeviceRepelDetailNoDev(taskId); deviceRepelDetail =repelDetailService.findDeviceRepelDetailNoDev(taskId);
} }
DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
unitsService.findAllByIdIn(StringUtils.stringToList(deviceRepel.getTaskScope())).forEach(
units -> {
if (units.getType()==2){
list.add(new DirectlyUnderNavigation(units.getUnitId(),units.getName(), UUID.randomUUID().toString()));
}
}
);
return list;
}
return repelEscrowService.findAllBillId(deviceRepelDetail.getRepelId());
}
......
package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.sun.javafx.tk.Toolkit;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.repair.service.RepairDetailService;
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.repair.subject.vo.BillVo;
import com.tykj.dev.device.repair.subject.vo.ClearRepairVo;
import com.tykj.dev.device.repair.subject.vo.ClearTaskVo;
import com.tykj.dev.device.sendback.entity.domain.SuspensionBill;
import com.tykj.dev.device.sendback.entity.vo.CityConfirmRequest;
import com.tykj.dev.device.sendback.entity.vo.ProvinceConfirmRequest;
import com.tykj.dev.device.sendback.service.SuspensionBillBusinessService;
import com.tykj.dev.device.sendback.service.SuspensionBillService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.cache.UnitsCache;
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.SecurityUser;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author zjm
* @version 1.0.0
* @ClassName SuspensionBillBusinessService.java
* @Description TODO
* @createTime 2021年09月02日 16:41:00
*/
@Service
public class SuspensionBillBusinessServiceimpl implements SuspensionBillBusinessService {
@Autowired
TaskService taskService;
@Autowired
DeviceLibraryCacheService deviceLibraryCacheService;
@Autowired
SuspensionBillService suspensionBillService;
@Autowired
DeviceLibraryService deviceLibraryService;
@Autowired
RepairDetailService repairDetailService;
@Autowired
AreaService areaService;
@Autowired
MessageService messageService;
@Autowired
UserService userService;
@Autowired
UnitsService unitsService;
@Autowired
UnitsCache unitsCache;
/**
* 功能描述: <br>
* 调用维修模块的接口 输入:装备id、以及相关字段 输出:根据设备组合成一个 维修业务的集合列表
* 根据输出集合 生成对应的中止任务,根据设备的
* @return:
* @since: 1.0.0
* @Author:zjm
* @Date:
*/
@Override
public void initiateSuspensionBill(List<Integer> libraryList, Units units, User user) {
// List<ClearTaskVo> clearTaskVo =new ArrayList<>();
// clearTaskVo.add(new ClearTaskVo(1,));
Map<Integer, ClearTaskVo> clearTaskVo = repairDetailService.getClearTaskVo(libraryList);
Units parentUnit = unitsService.findUnitAreaId(areaService.findByIdTosuperiorArea(units.getAreaId()).getId());
String title= "["+units.getName()+"]-中止任务";
clearTaskVo.values().forEach(
clearTaskVo1 -> {
String files = "";
if (clearTaskVo1.getRepairSendBill().getSendFiles()!=null&& !"".equals(clearTaskVo1.getRepairSendBill().getSendFiles())){
files=clearTaskVo1.getRepairSendBill().getSendFiles();
}
if (clearTaskVo1.getRepairSendBill().getReceiveFiles()!=null&& !"".equals(clearTaskVo1.getRepairSendBill().getReceiveFiles())){
files=clearTaskVo1.getRepairSendBill().getReceiveFiles();
}
SuspensionBill suspensionBill=new SuspensionBill(title,"",units.getUnitId(),parentUnit.getUnitId(),null,null,null,null,"",null,null,null,null,null,null,null,null,null,null,null);
//保存中止业务信息
suspensionBill.setBillVos(JacksonUtil.toJSon(clearTaskVo1.getBillVos()));
suspensionBill.setRelatedTaskId(clearTaskVo1.getTaskId());
suspensionBill.setFileRets(files);
suspensionBill.setBusinessType(clearTaskVo1.getBusinessType());
suspensionBill= suspensionBillService.saveSuspensionBill(suspensionBill);
suspensionBill.setNum("NO:第" + LocalDateTime.now().getYear() + "ZZ" + suspensionBill.getId());
//生成代办任务信息
createTaskBto(user.getUserId(),title,suspensionBill.getId(),units.getUnitId());
}
);
}
@Override
public void initiateSuspensionBill1(List<Integer> libraryList,SecurityUser securityUser) {
if (securityUser.getCurrentUserInfo().getUnits().getLevel()==3){
Units parentUnit = unitsService.findUnitAreaId(areaService.findByIdTosuperiorArea(securityUser.getCurrentUserInfo().getUnits().getAreaId()).getId());
initiateSuspensionBill(libraryList,parentUnit,securityUser.getCurrentUserInfo());
}else {
initiateSuspensionBill(libraryList,securityUser.getCurrentUserInfo().getUnits(),securityUser.getCurrentUserInfo());
}
}
@Override
public void initiateSuspensionBill2(List<Integer> libraryList, SecurityUser securityUser) {
Map<Integer, ClearTaskVo> clearTaskVo = repairDetailService.getClearTaskVo(libraryList);
String title= "[直属单位]-中止任务";
clearTaskVo.values().forEach(
clearTaskVo1 -> {
List<FileRet> list=new ArrayList<>();
list.addAll(clearTaskVo1.getRepairSendBill().getReceiveFileList());
list.addAll(clearTaskVo1.getRepairSendBill().getSendFileList());
SuspensionBill suspensionBill=new SuspensionBill(title,"",securityUser.getCurrentUserInfo().getUnitsId(),securityUser.getCurrentUserInfo().getUnitsId(),securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getName(),null,null,"",null,null,null,null,null,null,null,null,null,null,null);
//保存中止业务信息
suspensionBill.setBillVos(JacksonUtil.toJSon(clearTaskVo1.getBillVos()));
suspensionBill.setRelatedTaskId(clearTaskVo1.getTaskId());
suspensionBill.setFileRets(FilesUtil.stringFileToList(list));
suspensionBill.setBusinessType(clearTaskVo1.getBusinessType());
suspensionBill= suspensionBillService.saveSuspensionBill(suspensionBill);
suspensionBill.setNum("NO:第" + LocalDateTime.now().getYear() + "ZZ" + suspensionBill.getId());
//生成代办任务信息
createTaskBto(securityUser.getCurrentUserInfo().getUserId(),title,suspensionBill.getId(),securityUser.getCurrentUserInfo().getUnits().getUnitId());
}
);
}
@Override
public void cityConfirm(CityConfirmRequest cityConfirmRequest, SecurityUser securityUser) {
TaskBto taskBto= taskService.get(cityConfirmRequest.getTaskId());
SuspensionBill suspensionBill = suspensionBillService.findByIdToSuspensionBill(taskBto.getBillId());
suspensionBill.setSenderDes(cityConfirmRequest.getDes());
suspensionBill.setSendUserId(securityUser.getCurrentUserInfo().getUserId());
suspensionBill.setSenderUserName(securityUser.getCurrentUserInfo().getName());
suspensionBill= suspensionBillService.saveSuspensionBill(suspensionBill);
taskBto.setOwnUnit(suspensionBill.getReceiveUnitId());
taskBto= taskService.addInvolveUser(taskBto,securityUser.getCurrentUserInfo().getUserId());
taskService.moveToSpecial(taskBto,StatusEnum.SUSPENSION1501,0);
}
@Override
public void provinceConfirm(ProvinceConfirmRequest provinceConfirmRequest,SecurityUser securityUser) {
Map<String,String> map=new HashMap<>();
TaskBto taskBto= taskService.get(provinceConfirmRequest.getTaskId());
SuspensionBill suspensionBill = suspensionBillService.findByIdToSuspensionBill(taskBto.getBillId());
suspensionBill.setReceiveUserId(securityUser.getCurrentUserInfo().getUserId());
suspensionBill.setReceiveDes(provinceConfirmRequest.getDes());
suspensionBill.setBillVos(JacksonUtil.toJSon(provinceConfirmRequest.getBillVoList()));
suspensionBillService.saveSuspensionBill(suspensionBill);
taskService.moveToEnd(taskBto);
//调用维修提供的接口 改变设备的状态以及所在。
suspensionBill.getBillVoList().forEach(
billVo -> {
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(billVo.getDevicesId());
map.put(deviceLibrary.getOwnUnit(),null);
}
);
repairDetailService.setDevicesOwnUnit(JacksonUtil.readValue(suspensionBill.getBillVos(), new TypeReference<List<BillVo>>() {
}));
//给相关人员发阅读
List<Integer> userId=new ArrayList<>();
map.keySet().forEach(
name->{
Units units= unitsService.findbyName(name);
userId.addAll(userService.findAllByUnite(units.getUnitId()).stream().map(User::getUserId).collect(Collectors.toList()));
}
);
userId.remove(securityUser.getCurrentUserInfo().getUserId());
messageService.add(new MessageBto(taskBto.getId(), BusinessEnum.SUSPENSION.id, securityUser.getCurrentUserInfo().getName()+"已处理维修中止业务,其中由本单位设备请查看详情", userId, suspensionBill.getId().toString()));
}
@Override
public SuspensionBill findByTaskId(Integer taskId) {
TaskBto taskBto = taskService.get(taskId);
SuspensionBill suspensionBill= suspensionBillService.findByIdToSuspensionBill(taskBto.getBillId());
suspensionBill.setBillVoList(JacksonUtil.readValue(suspensionBill.getBillVos(), new TypeReference<List<BillVo>>() {
}));
suspensionBill.setFileSet(FilesUtil.stringFileToList(suspensionBill.getFileRets()));
suspensionBill.setIsEnd(true);
Map<Integer,BillVo> billVoMap = suspensionBill.getBillVoList().stream().collect(Collectors.toMap(BillVo::getDevicesId,billVo -> billVo));
ClearRepairVo clearRepairVo = repairDetailService.underRepair(new ArrayList<>(billVoMap.keySet()));
if (clearRepairVo.getRepairingList().size()!=0){
clearRepairVo.getRepairingList().forEach(
repairDetail -> {
if (billVoMap.containsKey(repairDetail.getDeviceId())){
BillVo billVo=billVoMap.get(repairDetail.getDeviceId());
billVo.setDeviceStatusDescription("等待接收-["+repairDetail.getOwnUnit()+"]送修给["+repairDetail.getLocationUnit()+"]");
billVoMap.put(repairDetail.getDeviceId(),billVo);
}else {
throw new ApiException("[中止任务] billVoMap未找到对应key:"+repairDetail.getDeviceId());
}
}
);
suspensionBill.setISNotCommitDes("存在等待接收入库的设备");
suspensionBill.setIsEnd(false);
}
if (clearRepairVo.getExceptionList().size()!=0){
clearRepairVo.getExceptionList().forEach(
repairDetail -> {
if (billVoMap.containsKey(repairDetail.getDeviceId())){
BillVo billVo=billVoMap.get(repairDetail.getDeviceId());
billVo.setDeviceStatusDescription("设备已送往"+repairDetail.getLocationUnit());
billVoMap.put(repairDetail.getDeviceId(),billVo);
}else {
throw new ApiException("[中止任务] billVoMap未找到对应key:"+repairDetail.getDeviceId());
}
}
);
suspensionBill.setISNotCommitDes("存在设备所在单位是省外");
suspensionBill.setIsEnd(false);
}
if (clearRepairVo.getEndRepairList().size()!=0){
clearRepairVo.getEndRepairList().forEach(
repairDetail -> {
if (billVoMap.containsKey(repairDetail.getDeviceId())){
BillVo billVo=billVoMap.get(repairDetail.getDeviceId());
billVo.setDeviceStatusDescription("设备在省内单位可中止");
billVoMap.put(repairDetail.getDeviceId(),billVo);
}else {
throw new ApiException("[中止任务] billVoMap未找到对应key:"+repairDetail.getDeviceId());
}
}
);
}
suspensionBill.setBillVoList(new ArrayList<>(billVoMap.values()));
suspensionBill.setRelatedUnitName(unitsService.findById(suspensionBill.getReceiveUnitId()).getName());
suspensionBill.setSenderUnitName(unitsService.findById(suspensionBill.getSendUnitId()).getName());
return suspensionBill;
}
//
// private void updateBillVoMapValue(List<RepairDetail> repairDetails,Map<Integer,BillVo> billVoMap,){
// repairDetails.forEach(
// repairDetail -> {
// if (billVoMap.containsKey(repairDetail.getDeviceId())){
// BillVo billVo=billVoMap.get(repairDetail.getDeviceId());
// billVo.setDeviceStatusDescription("等待接收-["+repairDetail.getOwnUnit()+"]送修给["+repairDetail.getLocationUnit()+"]");
// billVoMap.put(repairDetail.getDeviceId(),billVo);
// }else {
// throw new ApiException("[中止任务] billVoMap未找到对应key:"+repairDetail.getDeviceId());
// }
// }
// );
// }
/**
*
*/
private TaskBto createTaskBto(Integer userId,String title,Integer billId,Integer unitId){
List<Integer> list = new ArrayList<>();
list.add(userId);
list.add(0);
return taskService.start(new TaskBto(StatusEnum.SUSPENSION1500.id, title, null, ".", billId, BusinessEnum.SUSPENSION.id, unitId, 1, "", list));
}
}
package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.device.repair.subject.vo.BillVo;
import com.tykj.dev.device.sendback.entity.domain.SuspensionBill;
import com.tykj.dev.device.sendback.repository.SuspensionBillDao;
import com.tykj.dev.device.sendback.service.SuspensionBillService;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
* @author zjm
* @version 1.0.0
* @ClassName SuspensionBillServiceImpl.java
* @Description TODO
* @createTime 2021年09月02日 13:35:00
*/
@Service
public class SuspensionBillServiceImpl implements SuspensionBillService {
@Autowired
SuspensionBillDao suspensionBillDao;
@Override
public SuspensionBill saveSuspensionBill(SuspensionBill suspensionBill) {
return suspensionBillDao.save(suspensionBill);
}
@Override
public SuspensionBill findByIdToSuspensionBill(Integer id) {
Optional<SuspensionBill> suspensionBillOptional = suspensionBillDao.findById(id);
if (suspensionBillOptional.isPresent()){
SuspensionBill suspensionBill=suspensionBillOptional.get();
suspensionBill.setBillVoList(JacksonUtil.readValue(suspensionBill.getBillVos(), new TypeReference<List<BillVo>>() {
}));
return suspensionBill;
}else {
throw new ApiException("[中止业务] 根据业务id查询业务详细没找到 id:"+id);
}
}
}
...@@ -1202,7 +1202,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -1202,7 +1202,7 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public List<Task> findByBillIdAndBusinessType(Integer billId, Integer businessType) { public List<Task> findByBillIdAndBusinessType(Integer billId, Integer businessType) {
List<Task> tasks = taskDao.findAllByBillIdAndBusinessType(billId, businessType); List<Task> tasks = taskDao.findAllByBillIdAndBusinessType(billId, businessType);
return tasks.stream().filter(task -> task.getBillStatus().equals(StatusEnum.REVOKEALLOTTASK.id)) return tasks.stream().filter(task -> !task.getBillStatus().equals(StatusEnum.REVOKEALLOTTASK.id))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
......
...@@ -552,6 +552,9 @@ public class TrainJobController { ...@@ -552,6 +552,9 @@ public class TrainJobController {
trainTheme.setTrainStatus(StatusEnum.TRAIN1006.id); trainTheme.setTrainStatus(StatusEnum.TRAIN1006.id);
trainTheme.setGood(gradeEntryVo.getGood()); trainTheme.setGood(gradeEntryVo.getGood());
trainTheme.setPass(gradeEntryVo.getPass()); trainTheme.setPass(gradeEntryVo.getPass());
if (gradeEntryVo.getTrainPapersFileList()!=null && gradeEntryVo.getTrainPapersFileList().size()!=0){
trainTheme.setTrainPapersFiles(FilesUtil.stringFileToList(gradeEntryVo.getTrainPapersFileList()));
}
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "申请发证", null); TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "申请发证", null);
taskLogService.addLog(taskLogBto); taskLogService.addLog(taskLogBto);
return ResponseEntity.ok(trainThemeService.save(trainTheme)); return ResponseEntity.ok(trainThemeService.save(trainTheme));
......
package com.tykj.dev.device.user.base.ret;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zjm
* @version 1.0.0
* @ClassName SubordinateUnitsSwitch.java
* @Description TODO
* @createTime 2021年08月19日 14:30:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel(value = "从属人员单位列表对象", description = "从属人员单位列表对象")
public class SubordinateUnitsSwitch {
/**
* 单位名称
*/
private String unitName;
/**
* 用户账号名
*/
private String username;
}
...@@ -237,10 +237,10 @@ public class UserController { ...@@ -237,10 +237,10 @@ public class UserController {
return ResponseEntity.ok("ok"); return ResponseEntity.ok("ok");
} }
@GetMapping("/switch/{unitId}") @GetMapping("/select/switch")
@ApiOperation(value = "切换用户") @ApiOperation(value = "查询切换用户列表")
public ResponseEntity switchUser( @PathVariable Integer unitId){ public ResponseEntity switchUser( @ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
userService.deleteById(unitId);
return ResponseEntity.ok("ok"); return ResponseEntity.ok(userService.findByIdSubordinateUnitsSwitchList(securityUser));
} }
} }
...@@ -9,16 +9,19 @@ package com.tykj.dev.device.user.subject.controller; ...@@ -9,16 +9,19 @@ package com.tykj.dev.device.user.subject.controller;
*/ */
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.service.UserLogService; import com.tykj.dev.device.user.subject.service.UserLogService;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
/** /**
* 区域视图层 * 区域视图层
...@@ -43,4 +46,11 @@ public class UserLogController { ...@@ -43,4 +46,11 @@ public class UserLogController {
public ResponseEntity selectPage1(){ public ResponseEntity selectPage1(){
throw new ApiException(ResponseEntity.status(303).body("错误")); throw new ApiException(ResponseEntity.status(303).body("错误"));
} }
@GetMapping("/test")
@ApiOperation(value = "查询用户履历", notes = "查询用户履历")
public ResponseEntity selectPage2(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
return ResponseEntity.ok(securityUser.getCurrentUserInfo());
}
} }
...@@ -35,4 +35,6 @@ public interface UserDao extends JpaRepository<User, Integer>, JpaSpecificationE ...@@ -35,4 +35,6 @@ public interface UserDao extends JpaRepository<User, Integer>, JpaSpecificationE
User findByNameAndUnitsId(String name,Integer unitsId); User findByNameAndUnitsId(String name,Integer unitsId);
List<User> findBySubordinateId(Integer userID);
} }
...@@ -129,6 +129,12 @@ public class User { ...@@ -129,6 +129,12 @@ public class User {
@ApiModelProperty(value = "用户职务", name = "position") @ApiModelProperty(value = "用户职务", name = "position")
private Integer position; private Integer position;
/**
* 从属关系
*
*/
private Integer subordinateId;
/** /**
* 培训状态 0.已培训 1.已过期 2.未培训 3.快过期 5.不是专管员 * 培训状态 0.已培训 1.已过期 2.未培训 3.快过期 5.不是专管员
*/ */
...@@ -157,7 +163,8 @@ public class User { ...@@ -157,7 +163,8 @@ public class User {
"1234", "1234",
"123@qq.com", "123@qq.com",
"123", 0, "360218199801052634", 0, 0, null, 0,0 "123", 0, "360218199801052634", 0, 0, null, 0,0
, null , null,
null
); );
} }
......
...@@ -34,4 +34,6 @@ public interface AreaService extends PublicService<Area> { ...@@ -34,4 +34,6 @@ public interface AreaService extends PublicService<Area> {
List<Integer> findIdQuerySubordinateIds(Integer areaId); List<Integer> findIdQuerySubordinateIds(Integer areaId);
Area findByIdTosuperiorArea(Integer areaId);
} }
...@@ -175,6 +175,12 @@ public interface UserService extends PublicService<User> { ...@@ -175,6 +175,12 @@ public interface UserService extends PublicService<User> {
void updateUserTrainStatus(List<Integer> userIds,Integer status); void updateUserTrainStatus(List<Integer> userIds,Integer status);
/**
* 根据用户id查询可以切换的单位权限列表
* @param securityUser 当前登入用户对象
* @return 切换单位信息列表
*/
List<SubordinateUnitsSwitch> findByIdSubordinateUnitsSwitchList(SecurityUser securityUser);
List<User> findAllByUnitId(Integer unitId); List<User> findAllByUnitId(Integer unitId);
/** /**
......
...@@ -129,6 +129,13 @@ public class AreaServiceImpl implements AreaService { ...@@ -129,6 +129,13 @@ public class AreaServiceImpl implements AreaService {
return areaId(ids,areaId); return areaId(ids,areaId);
} }
@Override
public Area findByIdTosuperiorArea(Integer areaId) {
Area area= findByid(areaId);
area= findByid(area.getFatherId());
return area;
}
private List<Integer> areaId(List<Integer> ids,Integer areaId){ private List<Integer> areaId(List<Integer> ids,Integer areaId){
List<Area> areas= areaDao.findAllByFatherId(areaId); List<Area> areas= areaDao.findAllByFatherId(areaId);
ids.add(areaId); ids.add(areaId);
......
...@@ -11,9 +11,12 @@ import com.tykj.dev.device.user.subject.entity.User; ...@@ -11,9 +11,12 @@ import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.AreaService; import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.device.user.subject.service.UnitsService; 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.misc.exception.ApiException;
import io.swagger.annotations.Api;
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.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -74,20 +77,28 @@ public class UserPublicServiceImpl implements UserPublicService { ...@@ -74,20 +77,28 @@ public class UserPublicServiceImpl implements UserPublicService {
@Override @Override
public List<String> findAllUnitNameByAreaId(Integer areaId) { public List<String> findAllUnitNameByAreaId(Integer areaId) {
List<Units> units = unitsDao.findByAreaId(areaId); List<Units> units = unitsDao.findByAreaId(areaId);
List<Integer> areaIds = areaDao.findAllByFatherId(units.get(0).getAreaId()).stream().map(Area::getId).collect(Collectors.toList()); if (units!=null && units.size()!=0) {
List<String> unitsNameList = unitsDao.findAll().stream().filter(units1 -> areaIds.contains(units1.getAreaId())).map(Units::getName).collect(Collectors.toList()); List<Integer> areaIds = areaDao.findAllByFatherId(units.get(0).getAreaId()).stream().map(Area::getId).collect(Collectors.toList());
unitsNameList.addAll(units.stream().map(Units::getName).collect(Collectors.toList())); List<String> unitsNameList = unitsDao.findAll().stream().filter(units1 -> areaIds.contains(units1.getAreaId())).map(Units::getName).collect(Collectors.toList());
return unitsNameList; unitsNameList.addAll(units.stream().map(Units::getName).collect(Collectors.toList()));
return unitsNameList;
}else {
return new ArrayList<>();
}
} }
@Override @Override
public List<String> findAllUnitNameByType2() { public List<String> findAllUnitNameByType2() {
return unitsDao.findAll().stream().filter(units1 -> units1.getType()==2).map(Units::getName).collect(Collectors.toList()); return unitsDao.findAll().stream().filter(units1 -> units1.getType()==2 && units1.getEscrow()==1).map(Units::getName).collect(Collectors.toList());
} }
@Override @Override
public Integer findUnitIdByName(String unitName) { public Integer findUnitIdByName(String unitName) {
return unitsDao.findByName(unitName).getUnitId(); Units units= unitsDao.findByName(unitName);
if (units==null){
throw new ApiException("根据单位名称查询单位对象未找到:"+unitName);
}
return units.getUnitId();
} }
/** /**
......
...@@ -7,6 +7,7 @@ import com.tykj.dev.device.user.base.req.DropDownUserLocation; ...@@ -7,6 +7,7 @@ import com.tykj.dev.device.user.base.req.DropDownUserLocation;
import com.tykj.dev.device.user.base.req.NotIsUser; import com.tykj.dev.device.user.base.req.NotIsUser;
import com.tykj.dev.device.user.base.req.UnitNameVo; import com.tykj.dev.device.user.base.req.UnitNameVo;
import com.tykj.dev.device.user.base.ret.*; import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.cache.UserCache; import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.device.user.read.service.MessageService; 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.read.subject.bto.MessageBto;
...@@ -56,6 +57,9 @@ public class UserServiceImpl implements UserService { ...@@ -56,6 +57,9 @@ public class UserServiceImpl implements UserService {
@Autowired @Autowired
AreaService areaService; AreaService areaService;
@Autowired
UnitsCache unitsCache;
@Autowired @Autowired
UserPublicService userPublicService; UserPublicService userPublicService;
...@@ -581,6 +585,27 @@ public class UserServiceImpl implements UserService { ...@@ -581,6 +585,27 @@ public class UserServiceImpl implements UserService {
userDao.upDateUserIdsAndTrainStatus(userIds,status); userDao.upDateUserIdsAndTrainStatus(userIds,status);
} }
@Override
public List<SubordinateUnitsSwitch> findByIdSubordinateUnitsSwitchList(SecurityUser securityUser) {
List<SubordinateUnitsSwitch> subordinateUnitsSwitches=new ArrayList<>();
if (securityUser.getCurrentUserInfo().getSubordinateId()==null){
userDao.findBySubordinateId(securityUser.getCurrentUserInfo().getUserId()).forEach(
user1 -> subordinateUnitsSwitches.add(new SubordinateUnitsSwitch(unitsCache.findById(user1.getUnitsId()).getName(),user1.getUsername()))
);
subordinateUnitsSwitches.add(new SubordinateUnitsSwitch(securityUser.getCurrentUserInfo().getUnits().getName(),securityUser.getUsername()));
return subordinateUnitsSwitches;
}else {
userDao.findBySubordinateId(securityUser.getCurrentUserInfo().getSubordinateId()).forEach(
user1 -> subordinateUnitsSwitches.add(new SubordinateUnitsSwitch(unitsCache.findById(user1.getUnitsId()).getName(),user1.getUsername()))
);
User user1= userDao.findById(securityUser.getCurrentUserInfo().getSubordinateId()).get();
subordinateUnitsSwitches.add(new SubordinateUnitsSwitch(unitsCache.findById(user1.getUnitsId()).getName(),user1.getUsername()));
return subordinateUnitsSwitches;
}
}
@Override @Override
public List<User> findAllByUnitId(Integer unitId) { public List<User> findAllByUnitId(Integer unitId) {
return userDao.findAllByUnitsId(unitId); return userDao.findAllByUnitsId(unitId);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论