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

[清退] 代码提交

上级 30d8b4fa
......@@ -3,6 +3,7 @@ package com.tykj.dev.config;
import com.tykj.dev.misc.base.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -12,7 +13,7 @@ import java.util.stream.Collectors;
*/
public class GlobalMap {
private static final Map<Integer, StatusEnum> statusEnumMap;
public static final Map<Integer, StatusEnum> statusEnumMap;
private static final Map<Integer, RepairStatusEnum> repairStatusMap;
......@@ -86,4 +87,6 @@ public class GlobalMap {
public static Map<Integer, DeviceInvisibleRange> getDeviceInvisibleRangeMap() {
return deviceInvisibleRangeMap;
}
}
......@@ -196,6 +196,8 @@ public enum LogType {
SEND_BACK_28(100018,SEND_BACK.id, SEND_BACK_1213.id,END.id , "上传了直属单位清退签字单据"),
SEND_BACK_29(100019,SEND_BACK.id, SEND_BACK_1209.id,SEND_BACK_1215.id , "单据未上传,继续等待单据上传"),
SEND_BACK_30(100020,SEND_BACK.id, SEND_BACK_1215.id,END.id , "接收单据已上传,清退装备配送完成"),
//重新入库
AGAINSTORAGE_01(100021,AGAINSTORAGE.id, ORIGIN_STATUS.id,END.id , "发起了重新入库"),
LOSS_1(9000,LOSS.id,ORIGIN_STATUS.id,LOSS1300.id,"发起装备丢失上报"),
......
......@@ -74,8 +74,12 @@ public enum DeviceLifeStatus {
/**
* 待退役
*/
REPEL(15,"待退役");
REPEL(15,"待退役"),
/**
* 退役中
*/
RETIRED(16,"退役中");
public Integer id;
......
......@@ -54,7 +54,10 @@
<version>2.3.19</version>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-library</artifactId>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId>
......
......@@ -102,31 +102,33 @@ public class FileController {
*/
@ApiOperation(value = "生成单据1")
@GetMapping("/printDocuments1")
public ResponseEntity printDocuments(HttpServletResponse response) throws IOException, DocumentException {
Documents documents=new Documents();
documents.setNumber("NO:第221321134号");
documents.setReceiveUnit("杭州机要");
documents.setReplyNum("123123123131");
documents.setSenderUnit("浙江省");
documents.setTitle("密码装备清退单");
List<DocumentDevice> documentDevices=new ArrayList<>();
for (int i=0;i<20;i++){
DocumentDevice documentDevice=new DocumentDevice();
documentDevice.setCount(i);
documentDevice.setModel("MM001");
documentDevice.setRemark("备注");
documentDevice.setApplicationField("省一级");
documentDevice.setDeviceSerialNumber("asdq1231232");
documentDevice.setProductionSerialNumber("12312312312");
documentDevice.setParts("密码机");
documentDevice.setCategory("装备");
documentDevice.setSecurityClassification("机密");
documentDevices.add(documentDevice);
}
documents.setDocumentDevices(documentDevices);
String[] content = JavaToPdfHtmlFreeMarker.freeMarkerRender(documents,url+"htmlModel/");
showPdf(response,JavaToPdfHtmlFreeMarker.createPdf(content,url,preview,"documents/").getFilePath());
public ResponseEntity printDocuments(HttpServletResponse response,HttpServletRequest request) throws IOException, DocumentException {
int interval = request.getSession().getMaxInactiveInterval();
System.out.println("-------"+interval);
// Documents documents=new Documents();
// documents.setNumber("NO:第221321134号");
// documents.setReceiveUnit("杭州机要");
// documents.setReplyNum("123123123131");
// documents.setSenderUnit("浙江省");
// documents.setTitle("密码装备清退单");
// List<DocumentDevice> documentDevices=new ArrayList<>();
// for (int i=0;i<20;i++){
// DocumentDevice documentDevice=new DocumentDevice();
// documentDevice.setCount(i);
// documentDevice.setModel("MM001");
// documentDevice.setRemark("备注");
// documentDevice.setApplicationField("省一级");
// documentDevice.setDeviceSerialNumber("asdq1231232");
// documentDevice.setProductionSerialNumber("12312312312");
// documentDevice.setParts("密码机");
// documentDevice.setCategory("装备");
// documentDevice.setSecurityClassification("机密");
// documentDevices.add(documentDevice);
// }
// documents.setDocumentDevices(documentDevices);
//
// String[] content = JavaToPdfHtmlFreeMarker.freeMarkerRender(documents,url+"htmlModel/");
// showPdf(response,JavaToPdfHtmlFreeMarker.createPdf(content,url,preview,"documents/").getFilePath());
return ResponseEntity.ok("ok");
}
......
package com.tykj.dev.device.file.entity;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -22,18 +23,25 @@ import java.util.List;
public class Documents {
@ApiModelProperty(name = "单据号")
private String number;
@ApiModelProperty(name = "单据标题")
private String title;
@ApiModelProperty(name = "接收单位")
private String receiveUnit;
@ApiModelProperty(name = "批复文号")
private String replyNum;
@ApiModelProperty(name = "相关装备")
private List<DocumentDevice> documentDevices;
@ApiModelProperty(name = "发件单位")
private String senderUnit;
@ApiModelProperty(name = "签章数据")
private String srcA;
@ApiModelProperty(name = "签章数据")
private String srcB;
......@@ -49,4 +57,21 @@ public class Documents {
@ApiModelProperty(name = "接收方人员")
private String nameB1;
@ApiModelProperty(name = "后端转换使用")
private List<ScriptSaveVo> scriptSaveVos;
public Documents(String number, String title, String receiveUnit, String replyNum, String senderUnit, String srcA, String srcB, String nameA, String nameA1, String nameB, String nameB1, List<ScriptSaveVo> scriptSaveVos) {
this.number = number;
this.title = title;
this.receiveUnit = receiveUnit;
this.replyNum = replyNum;
this.senderUnit = senderUnit;
this.srcA = srcA;
this.srcB = srcB;
this.nameA = nameA;
this.nameA1 = nameA1;
this.nameB = nameB;
this.nameB1 = nameB1;
this.scriptSaveVos = scriptSaveVos;
}
}
package com.tykj.dev.device.file.service.Impl;
import com.tykj.dev.device.file.entity.DocumentDevice;
import com.tykj.dev.device.file.entity.Documents;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.PdfService;
import com.tykj.dev.device.file.util.JavaToPdfHtmlFreeMarker;
import com.tykj.dev.device.library.subject.vo.Script;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.stream.Collectors;
/**
* @author zjm
* @version 1.0.0
* @ClassName PdfServiceImpl.java
* @Description TODO
* @createTime 2021年03月17日 16:03:00
*/
@Service
@Slf4j
public class PdfServiceImpl implements PdfService {
@Value("${file.path}")
public String url;
@Value("${preview.path}")
public String preview;
@Override
public FileRet billPdf(Documents documents) {
documents.setDocumentDevices(documents.getScriptSaveVos().stream().map(this::toDocDev).collect(Collectors.toList()));
String[] content = JavaToPdfHtmlFreeMarker.freeMarkerRender(documents,url+"htmlModel/");
log.info("[file] 调用了生成出入单据对接口 documents");
return JavaToPdfHtmlFreeMarker.createPdf(content,url,preview,"documents/");
}
private DocumentDevice toDocDev(ScriptSaveVo scriptSaveVo){
return new DocumentDevice(null,scriptSaveVo.getModel(),null,scriptSaveVo.getType(),scriptSaveVo.getSecretLevel(),scriptSaveVo.getInvisibleRange(),scriptSaveVo.getNum(),scriptSaveVo.getSeqNumber(),null,scriptSaveVo.getRemark());
}
}
package com.tykj.dev.device.file.service;
import com.tykj.dev.device.file.entity.Documents;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.util.JavaToPdfHtmlFreeMarker;
/**
* @author zjm
* @version 1.0.0
* @ClassName PdfService.java
* @Description TODO
* @createTime 2021年03月17日 15:49:00
*/
public interface PdfService {
/**
* 根据单据信息生成单据pdf
* @param documents 单据信息
* @return 单据地址信息
*/
FileRet billPdf(Documents documents);
}
......@@ -106,7 +106,12 @@ public enum BusinessEnum {
/**
* 找回
*/
RETRIEVE(25,"找回");
RETRIEVE(25,"找回"),
/**
* 重新入库
*/
AGAINSTORAGE(26,"重新入库");
public Integer id;
......
......@@ -7,6 +7,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.packing.subject.vo.*;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -50,6 +51,7 @@ public class PackingLibraryController {
@ApiOperation(value = "获取装备单据显示", notes = "获取装备单据显示")
@PostMapping("/getScript")
public ResponseEntity setRecord(@RequestBody List<Integer> ids){
// throw new ApiException(ResponseEntity.status(303).body("aaa"));
return ResponseEntity.ok(packingLibraryService.getDevcieScript(ids));
}
......
......@@ -37,5 +37,6 @@
<groupId>com.tykj.dev</groupId>
<artifactId>config</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -3,6 +3,7 @@ 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.*;
import com.tykj.dev.device.sendback.service.AgainStorageBillService;
import com.tykj.dev.device.sendback.service.RepelBusinessService;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import io.swagger.annotations.Api;
......@@ -30,6 +31,9 @@ public class RepelDevController {
@Autowired
RepelBusinessService repelBusinessService;
@Autowired
AgainStorageBillService againStorageBillService;
@PostMapping(value ="/initiateRepel/{userId}")
@ApiOperation(value = "省发布清退接口", notes = "省发布清退接口")
public ResponseEntity initiateRepel(@PathVariable Integer userId,@RequestBody DeviceRepel deviceRepel){
......@@ -198,6 +202,17 @@ public class RepelDevController {
return ResponseEntity.ok("重新入库成功");
}
/**
* 重新入库接口会生成业务记录
*/
@ApiOperation(value = "重新入库接口会生成业务记录", notes = "重新入库接口会生成业务记录")
@PostMapping(value ="/againPutInStorage/business")
public ResponseEntity againPutInStorage1( @RequestBody List<Integer> ids,@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
againStorageBillService.againPutInStorage(ids,securityUser);
return ResponseEntity.ok("重新入库成功");
}
/**
* 测试
*/
......
......@@ -187,4 +187,56 @@ public class RepelQueryController {
public ResponseEntity findOutsideTheProvince() {
return ResponseEntity.ok(repelQueryService.findOutsideTheProvince());
}
// /**
// * 查询清退任务
// * @param
// * @return
// */
// @ApiOperation(value = "查询退役中的装备列表", notes = "可以通过这个接口查询查询清退任务")
// @PostMapping(value = "/findRetired")
// public ResponseEntity selectRepairTasks(@RequestBody ModelAndTypeVo modelAndTypeVo){
//
// return ResponseEntity.ok(repelQueryService.findRetired(modelAndTypeVo));
// }
/**
* 待清退 待退役
*/
@PostMapping(value ="/toBeRetiredDeviceList")
@ApiOperation(value = "待清退", notes = "待清退列表")
public ResponseEntity clearedList1(@RequestBody RepelManagementVo repelManagementVo){
return ResponseEntity.ok(repelQueryService.toBeRetiredDeviceList(repelManagementVo));
}
/**
* 退役中
*/
@PostMapping(value ="/findRetired")
@ApiOperation(value = "退役中", notes = "退役中列表")
public ResponseEntity clearedList2(@RequestBody RepelManagementVo repelManagementVo){
return ResponseEntity.ok(repelQueryService.findRetired(repelManagementVo));
}
/**
* 已清退列表
*/
@PostMapping(value ="/clearedDeviceList")
@ApiOperation(value = "已清退", notes = "已清退列表")
public ResponseEntity clearedList3(@RequestBody RepelManagementVo repelManagementVo){
return ResponseEntity.ok(repelQueryService.clearedDeviceList(repelManagementVo));
}
/**
* 已退役
*/
@PostMapping(value ="/retiredDeviceList")
@ApiOperation(value = "已退役", notes = "已清退列表")
public ResponseEntity clearedList4(@RequestBody RepelManagementVo repelManagementVo){
return ResponseEntity.ok(repelQueryService.retiredDeviceList(repelManagementVo));
}
}
package com.tykj.dev.device.sendback.entity.domain;
import com.tykj.dev.misc.base.BaseEntity;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
/**
* @author zjm
* @version 1.0.0
* @ClassName AgainStorageBill.java
* @Description TODO
* @createTime 2021年03月16日 16:27:00
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@ApiModel("重新入库业务")
public class AgainStorageBill extends BaseEntity {
@Column(name = "dev_ids", columnDefinition = "TEXT")
private String DevIds;
public AgainStorageBill(String devIds) {
DevIds = devIds;
}
}
package com.tykj.dev.device.sendback.entity.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.Documents;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
......@@ -43,19 +44,20 @@ public class DeviceRepelDetail extends BaseEntity {
private Integer repelId;
/**
* 编号
* 标题
*/
@ApiModelProperty(value = "单据编号")
private String num;
private String title;
/**
* 申请文
*
*/
@ApiModelProperty(value = "单据编号")
private String num;
@ApiModelProperty(value = "申请文号")
private String applyNumber;
/**
* 批复文号
*/
@ApiModelProperty(value = "批复文号")
private String replayNumber;
/**
......@@ -235,9 +237,14 @@ public class DeviceRepelDetail extends BaseEntity {
@ApiModelProperty(value = "清退状态",name = "1.清退中,2.清退完成")
private Integer repelStatus;
@ApiModelProperty(value = "批复文号文件")
@Column(name = "reply_files",columnDefinition = "TEXT")
private String replyFiles;
@ApiModelProperty(value = "申请文号文件")
@Column(name = "apply_files",columnDefinition = "TEXT")
private String applyFiles;
@Column(name = "send_files",columnDefinition = "TEXT")
private String sendFiles;
......@@ -248,12 +255,17 @@ public class DeviceRepelDetail extends BaseEntity {
private List<ScriptSaveVo> scripts = new ArrayList<>();
@Transient
private List<FileRet> replyFileList = new ArrayList<>();
@Transient
private List<FileRet> sendFileList = new ArrayList<>();
@Transient
@ApiModelProperty(value = "批复文号文件集合")
private List<FileRet> replyFileList = new ArrayList<>();
@Transient
@ApiModelProperty(value = "申请文号文件集合")
private List<FileRet> applyFileList = new ArrayList<>();
@Transient
@ApiModelProperty(value = "装备List")
......@@ -272,6 +284,8 @@ public class DeviceRepelDetail extends BaseEntity {
private List<FileRet> outboundFiles ;
public Documents toDoc(){
return new Documents(num,"装备清退单据",receiveUnit,replayNumber,sendUnit,null,null,senderUserA,senderUserB,receiveUserA,receiveUserB,null);
}
}
......@@ -38,6 +38,7 @@ public class OrderOutData {
*/
@ApiModelProperty(value = "批复文号")
private String replayNumber;
/**
* 发件单位
*/
......@@ -173,12 +174,15 @@ public class OrderOutData {
@ApiModelProperty(value = "清退单文件")
private List<FileRet> billFileList;
@ApiModelProperty(value = "发件单位签章id")
private String leftSignatureId;
@ApiModelProperty(value = "批复文号文件集合")
private List<FileRet> replyFileList = new ArrayList<>();
@ApiModelProperty(value = "申请文号文件集合")
private List<FileRet> applyFileList = new ArrayList<>();
private List<FileRet> sendFileList = new ArrayList<>();
@ApiModelProperty(value = "单据装备数据信息")
......
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PagingVo {
private Integer total;
private Integer page;
private Integer size;
private List<DeviceLibrary> data;
}
\ No newline at end of file
package com.tykj.dev.device.sendback.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -20,7 +21,7 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("清退管理 清退清退vo")
public class RepelManagementVo {
public class RepelManagementVo extends CustomPage {
@ApiModelProperty(name = "开始清退的年份 默认各式 2020-01-01 00:00:00")
private Long time;
......@@ -29,4 +30,37 @@ public class RepelManagementVo {
@ApiModelProperty(name = "单位id")
private Integer unitId;
@ApiModelProperty(name = "单位名称")
private String unitName;
@ApiModelProperty(value = "型号", example = "bmxx")
public String model;
@ApiModelProperty(value = "类型", example = "1")
public Integer type;
@ApiModelProperty(value = "密级", example = "1")
public Integer secretLevel;
@ApiModelProperty(value = "可见范围(应用领域)", example = "1")
public Integer invisibleRange;
@ApiModelProperty(value = "名称", example = "BM-1")
public String name;
@ApiModelProperty(value = "配用范围", example = "1")
public Integer matchingRange;
@ApiModelProperty(value = "入库类型", example = "1")
public Integer storageType;
@ApiModelProperty(value = "管理状态", example = "1")
public Integer manageStatus;
@ApiModelProperty(value = "模糊查询内容", example = "测试")
public String content;
}
......@@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.print.attribute.standard.Sides;
import java.util.List;
/**
......@@ -37,6 +38,7 @@ public class StorageDeviceRepel {
private Integer isIgnore;
private Integer userId;
private Integer taskId;
......@@ -51,5 +53,22 @@ public class StorageDeviceRepel {
private String senderName;
private String senderId;
private Integer senderId;
/**
* 电子签章发件方
*/
private String srcA;
/**
* 电子签章收件方
*/
private String srcB;
/**
* 接收方、发件方都使用电子签章
*/
private Integer isNotTwoSides;
}
package com.tykj.dev.device.sendback.repository;
import com.tykj.dev.device.sendback.entity.domain.AgainStorageBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author zjm
* @version 1.0.0
* @ClassName AgainStorageBillDao.java
* @Description TODO
* @createTime 2021年03月16日 16:48:00
*/
public interface AgainStorageBillDao extends JpaRepository<AgainStorageBill, Integer>, JpaSpecificationExecutor<AgainStorageBill> {
}
package com.tykj.dev.device.sendback.service;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName AgainStorageBillService.java
* @Description TODO
* @createTime 2021年03月16日 17:05:00
*/
public interface AgainStorageBillService {
/**
* 装备重新入库 改变装备的生命状态
* @param ids 装备id
*/
void againPutInStorage(List<Integer> ids, SecurityUser securityUser);
}
......@@ -32,7 +32,7 @@ public interface DeviceRepelDetailService {
/**
* 根据年份以及单位 查询清退的装备列表
*/
List<DeviceLibrary> findYearAndUnitToDeviceList(Date time,Date endTime,Integer unitId);
List<Integer> findYearAndUnitToDeviceList(Date time,Date endTime,Integer unitId);
List<DeviceRepelDetail> findUnitIdSendOrReceive(Integer unitId);
......
......@@ -41,14 +41,11 @@ public interface RepelBusinessService {
* 修改repeltask的状态
* 以及修改账单的详情把装备写入到实体中
*/
void resolveConfirm(Integer taskId,Integer userId);
/**
* 选择装备 与账单和task关联
*/
void submitChooseDevice(Integer taskId, ResolveConfirm resolveConfirm);
/**
......@@ -72,7 +69,6 @@ public interface RepelBusinessService {
void storageDeviceRepel(Integer taskId, StorageDeviceRepel storageDeviceRepel);
/**
* 本级装备待清退提交
*/
......@@ -100,7 +96,6 @@ public interface RepelBusinessService {
*/
DeviceRepelDetail provinceSendOutSuperior(Integer userId, OrderOutData orderOutData);
/**
* 上传中办的回执单
* @param taskId 任务ID
......@@ -125,4 +120,11 @@ public interface RepelBusinessService {
* @param ids 装备id
*/
void againPutInStorage(List<Integer> ids);
/**
* 省直接从在库到待退役
* 装备装备 在库-》待退役
*/
void directlyRetired(List<Integer> ids);
}
......@@ -48,6 +48,11 @@ public interface RepelQueryService {
List<ModelNameGroup> toRepelList(RepelManagementVo repelManagementVo);
/**
* 待清退列表 省
*/
List<DeviceLibrary> toRepelListDev(RepelManagementVo repelManagementVo);
/**
* 待清退页面查询统计查询接口
*/
......@@ -101,4 +106,28 @@ public interface RepelQueryService {
*/
DeviceChooseRepel findDeviceChooseRepel1(List<Integer> fielding,Integer unitId);
/**
* 查看退役中装备列表
* @param repelManagementVo
* @return
*/
PagingVo findRetired(RepelManagementVo repelManagementVo);
/**
* 查看待退役列表装备
*/
PagingVo toBeRetiredDeviceList(RepelManagementVo repelManagementVo);
/**
* 查看已清退装备列表
*/
PagingVo clearedDeviceList(RepelManagementVo repelManagementVo);
/**
* 查看已退役装备列表
*/
PagingVo retiredDeviceList(RepelManagementVo repelManagementVo);
}
package com.tykj.dev.device.sendback.service.impl;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.sendback.entity.domain.AgainStorageBill;
import com.tykj.dev.device.sendback.repository.AgainStorageBillDao;
import com.tykj.dev.device.sendback.service.AgainStorageBillService;
import com.tykj.dev.device.sendback.util.StringUtils;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.base.StatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zjm
* @version 1.0.0
* @ClassName AgainStorageBillServiceImpl.java
* @Description TODO
* @createTime 2021年03月16日 17:07:00
*/
@Service
public class AgainStorageBillServiceImpl implements AgainStorageBillService {
@Autowired
DeviceLibraryDao deviceLibraryDao;
@Autowired
AgainStorageBillDao againStorageBillDao;
@Autowired
TaskService taskService;
@Autowired
MessageService messageService;
@Autowired
UserService userService;
@Override
public void againPutInStorage(List<Integer> ids, SecurityUser securityUser) {
List<DeviceLibrary> deviceLibraries= deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(ids);
deviceLibraries.forEach(
deviceLibrary -> deviceLibrary.setLifeStatus(DeviceLifeStatus.IN_LIBRARY.id)
);
deviceLibraryDao.saveAll(deviceLibraries);
AgainStorageBill againStorageBill= againStorageBillDao.save(new AgainStorageBill(StringUtils.ListToString(ids)));
TaskBto taskBto=againStorageTask(securityUser.getCurrentUserInfo().getUnitsId(),againStorageBill.getId(),securityUser.getCurrentUserInfo().getUserId());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),securityUser.getUsername()+"发起了重新入库",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
}
/**
* 重新入库任务发起
* 这里应为重新入库直接完结所有发起task任务为完结状态
*/
private TaskBto againStorageTask(Integer unitId, Integer againStorageId , Integer userId){
List<Integer> list=new ArrayList<>();
list.add(userId);
return taskService.start(new TaskBto(StatusEnum.END.id, LocalDateTime.now().atZone(ZoneOffset.ofHours(8)).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "重新入库", null, ".", againStorageId, BusinessEnum.AGAINSTORAGE.id, unitId, 0, null, list));
}
private void addMessage(MessageBto messageBto){
messageService.add(messageBto);
}
private List<Integer> gainThisUser(Integer userId,Integer unitId){
return userService.findAllByUnite(unitId).stream().filter(user -> user.getUnitsId()!=userId).map(User::getUserId).collect(Collectors.toList());
}
}
......@@ -6,6 +6,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.repository.DeviceRepelDetailDao;
import com.tykj.dev.device.sendback.service.DeviceRepelDetailService;
import com.tykj.dev.device.sendback.util.StringUtils;
import com.tykj.dev.misc.exception.ApiException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -71,10 +72,10 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
}
@Override
public List<DeviceLibrary> findYearAndUnitToDeviceList(Date time,Date endTime,Integer unitId) {
Set<DeviceLibrary> libraries=new HashSet<>();
public List<Integer> findYearAndUnitToDeviceList(Date time,Date endTime,Integer unitId) {
Set<Integer> libraries=new HashSet<>();
deviceRepelDetailDao.findAllBySendTimeBetweenAndSendUnitIdAndRepelStatus(time,endTime,unitId,2).forEach(
deviceRepelDetail -> libraries.addAll(findInvoleDevice(deviceRepelDetail.getDeviceIds()))
deviceRepelDetail -> libraries.addAll(StringUtils.stringToList(deviceRepelDetail.getDeviceIds()))
);
return new ArrayList<>(libraries);
}
......
......@@ -2,15 +2,18 @@ package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.device.file.entity.Documents;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.file.service.PdfService;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.library.subject.vo.LifeStatusVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
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.DeviceRepelDetail;
......@@ -32,14 +35,11 @@ import com.tykj.dev.device.user.subject.service.GroupService;
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.DeviceLifeStatus;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.TaskDisposeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
......@@ -100,6 +100,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
@Autowired
MessageService messageService;
@Autowired
PdfService pdfService;
@Override
public void initiateRepel(DeviceRepel deviceRepel, Integer userId) {
......@@ -129,7 +132,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
DeviceRepelDetail deviceRepelDetail=new DeviceRepelDetail();
deviceRepelDetail.setRepelId(deviceRepel1.getId());
deviceRepelDetail.setRepelStatus(1);
TaskBto taskBto= statsXTask(units.getUnitId(),deviceRepel1.getId(),deviceRepel.getTitle());
TaskBto taskBto = statsXTask(units.getUnitId(),deviceRepel1.getId(),deviceRepel.getTitle());
//给本单位其他专管员阅知
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"发起清退任务["+deviceRepel1.getTitle()+"]",gainThisUser(userId,units.getUnitId())));
......@@ -267,7 +270,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
TaskBto currentTask= taskService.get(taskId);
log.info("------{}",currentTask);
DeviceRepelDetail deviceRepelDetail1 = deviceRepelDetailService.findDeviceRepelDetail(currentTask.getBillId());
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(currentTask.getId(),deviceRepelDetail1.getRepelId());
repelTaskStatistical.setTaskStatus(5);
......@@ -470,7 +472,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
//1 审核通过
if (repelAuditResult.getType()==1){
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1208,0);
// deviceLibraryDao.upDateLeftStatus(15,StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
//deviceLibraryDao.upDateLeftStatus(15,StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
}else {
//审核失败
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1206,0);
......@@ -478,9 +480,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
deviceRepelDetail.setAuditingFeedback(repelAuditResult.getDes());
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
//判读是否还有需要审核待task
// 判读是否还有需要审核待task
isCommission(taskBto,deviceRepelDetail.getRepelId());
//检查上级任务是完成
// 检查上级任务是完成
// 修改当前任务的状态 清退提交装备待出库
// 修改上级任务是否代办
// 修改统计表中的数据信息 状态
......@@ -509,13 +511,15 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
orderOutDataRepelDetail.setSendFiles(FilesUtil.stringFileToList(orderOutData.getSendFileList()));
orderOutDataRepelDetail.setScriptJson(JacksonUtil.toJSon(orderOutData.getScriptSaveVos()));
orderOutDataRepelDetail.setScripts(orderOutData.getScriptSaveVos());
orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList()));
orderOutDataRepelDetail.setApplyFiles(FilesUtil.stringFileToList(orderOutData.getApplyFileList()));
deviceRepelDetailService.saveDeviceRepelDetail(orderOutDataRepelDetail);
deviceLibraryDao.upDateLeftStatusAndOwnUnitName(DeviceLifeStatus.REPEL.id,orderOutData.getReceiveUnit(),StringUtils.stringToList(orderOutDataRepelDetail.getDeviceIds()));
taskBto.setCreateUserId(userId);
taskBto.setOwnUnit(orderOutData.getReceiveUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1209,0);
DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
waitingReceiptsTask(orderOutData.getSendUnitId(),deviceRepelDetail.getId(),taskBto.getParentTaskId(),"清退装备出库等待上传回执单");
waitingReceiptsTask(orderOutData.getSendUnitId(),deviceRepelDetail.getId(),taskBto.getId(),"清退装备出库等待上传回执单");
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"根据["+deviceRepel.getTitle()+"]任务,已完成退回出库",gainThisUser(userId,user.getUnitsId())));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),deviceRepelDetail.getSendUnit()+"装备清退出库"+",等待"+deviceRepelDetail.getReceiveUnit()+"接收",userId);
......@@ -549,6 +553,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
if (storageDeviceRepel.getUserBName()!=null) {
deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserBName());
}
if (storageDeviceRepel.getSenderId()!=null) {
deviceRepelDetail.setSendUserbId(storageDeviceRepel.getSenderId());
}
if (storageDeviceRepel.getSenderName()!=null) {
deviceRepelDetail.setSenderUserB(storageDeviceRepel.getSenderName());
}
//判断是否为入库单据待补充 还是直接入库。
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId());
......@@ -561,7 +573,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setBillFile(FilesUtil.stringFileToList(storageDeviceRepel.getFileRets()));
deviceRepelDetail.setRepelStatus(2);
repelTaskStatistical.setTaskStatus(1);
taskService.moveToEnd(taskBto);
} else {
if (storageDeviceRepel.getIsIgnore()==null) {
......@@ -572,6 +583,14 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}else {
repelTaskStatistical.setTaskStatus(1);
taskService.moveToEnd(taskBto);
Documents documents= deviceRepelDetail.toDoc();
documents.setSrcA(storageDeviceRepel.getSrcA());
documents.setSrcB(storageDeviceRepel.getSrcB());
documents.setScriptSaveVos(JacksonUtil.readValue(deviceRepelDetail.getScriptJson(), new TypeReference<List<ScriptSaveVo>>() {
}));
FileRet fileRet= pdfService.billPdf(documents);
deviceRepelDetail.setOutboundFile(JacksonUtil.toJSon(fileRet));
deviceRepelDetail.setSendFiles(JacksonUtil.toJSon(fileRet));
}
}
......@@ -596,7 +615,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
long time=System.currentTimeMillis();
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(inStock,deviceRepelDetail.getReceiveUnit(),0,StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time);
repelDeviceUnitService.saveAllRepelDeviceUnit(list);
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
......@@ -694,7 +712,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+deviceRepelDetail.getId());
deviceRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
deviceLibraryDao.upDateLeftStatusAndOwnUnitName(DeviceLifeStatus.REPEL.id,orderOutData.getReceiveUnit(),orderOutData.getDevIds());
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.RETIRED.id,orderOutData.getDevIds());
TaskBto taskBto= sendOutSuperior(units.getUnitId(),deviceRepelDetail.getId(),null);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起退役任务,待上传回执单据",gainThisUser(user.getUserId(),user.getUnitsId())));
return deviceRepelDetail;
......@@ -724,19 +742,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
taskService.moveToEnd(taskBto);
deviceRepelDetail.setRepelStatus(2);
List<DeviceLibrary> libraries= findInvoleDevice(deviceRepelDetail.getDeviceIds());
libraries.forEach(
deviceLibrary -> {
// deviceLibrary.setLocationUnit(deviceRepelDetail.getReceiveUnit());
// deviceLibrary.setOwnUnit(deviceRepelDetail.getReceiveUnit());
// deviceLibrary.setLifeStatus(2);
list.add(new RepelDeviceUnit(deviceLibrary.getId(),deviceRepelDetail.getSendUnitId()));
}
);
log.info("更新数据装备以及所属单位-{}",libraries.size());
long time=System.currentTimeMillis();
deviceLibraryDao.upDateLeftStatusAndLockStatus(DeviceLifeStatus.RETIRE.id,0,StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}",System.currentTimeMillis()-time);
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.RETIRE.id,deviceRepelDetail.getReceiveUnit(),0,StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
// deviceLibraryDao.saveAll(libraries);
......@@ -756,9 +763,30 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SEND_BACK_1214);
taskService.moveToEnd(taskBto);
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setSenderUserB(storageDeviceRepel.getUserBName());
deviceRepelDetail.setSendUserbId(storageDeviceRepel.getUserB());
if (storageDeviceRepel.getSenderName()!=null) {
deviceRepelDetail.setSenderUserB(storageDeviceRepel.getSenderName());
}
if (storageDeviceRepel.getSenderId()!=null)
deviceRepelDetail.setSendUserbId(storageDeviceRepel.getSenderId());
deviceRepelDetail.setOutboundFile(FilesUtil.stringFileToList(storageDeviceRepel.getOutFiles()));
if (storageDeviceRepel.getUserBName()!=null) {
deviceRepelDetail.setReceiveUserB(storageDeviceRepel.getUserBName());
}
if (storageDeviceRepel.getUserB()!=null){
deviceRepelDetail.setReceiveUserbId(storageDeviceRepel.getUserB());
}
if (storageDeviceRepel.getUserA()!=null){
deviceRepelDetail.setReceiveUseraId(storageDeviceRepel.getUserA());
}
if (storageDeviceRepel.getUserAName()!=null) {
deviceRepelDetail.setReceiveUserA(storageDeviceRepel.getUserAName());
}
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.RETIRE.id,deviceRepelDetail.getReceiveUnit(),0,StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
TaskBto fatherTask=taskService.get(taskBto.getParentTaskId());
taskService.moveToEnd(fatherTask);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
}
......@@ -769,6 +797,9 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
DeviceRepelDetail deviceRepelDetail=deviceRepelDetailService.findDeviceRepelDetail(taskBto.getBillId());
deviceRepelDetail.setSenderUserB(storageDeviceRepel.getUserBName());
deviceRepelDetail.setSendUserbId(storageDeviceRepel.getUserB());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"选择了你为签发人请阅知",new ArrayList<>(storageDeviceRepel.getUserB())));
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
}
......@@ -782,6 +813,16 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceLibraryDao.saveAll(deviceLibraries);
}
@Override
public void directlyRetired(List<Integer> ids) {
//更新所选装备的生命状态
//给同级专管员推送阅知
//装备在待退役中展示
//任务完结
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.REPEL.id,ids);
}
/**
* 生成区清退任务
......@@ -966,7 +1007,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
public void addMessage(MessageBto messageBto){
private void addMessage(MessageBto messageBto){
messageService.add(messageBto);
}
......
package com.tykj.dev.device.sendback.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
......@@ -21,8 +23,12 @@ import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
......@@ -133,6 +139,11 @@ public class RepelQueryServiceImpl implements RepelQueryService {
return toModelNameGroup(deviceLibraryDao.findAllByOwnUnitAndLocationUnitAndLifeStatus(units.getName(),units.getName(),DeviceLifeStatus.REPEL.id).stream().map(DeviceLibrary::setConfigName).filter(deviceLibrary ->deviceLibrary.getUpdateTime()==null ||(deviceLibrary.getUpdateTime().getTime()>=repelManagementVo.getTime()&&deviceLibrary.getUpdateTime().getTime()<=repelManagementVo.getEndTime())).collect(Collectors.toList()));
}
@Override
public List<DeviceLibrary> toRepelListDev(RepelManagementVo repelManagementVo) {
return null;
}
private List<ModelNameGroup> toModelNameGroup(List<DeviceLibrary> deviceLibraries){
Map<String,ModelNameGroup> modelNameGroupMap=new HashMap<>();
deviceLibraries.forEach(
......@@ -180,7 +191,8 @@ public class RepelQueryServiceImpl implements RepelQueryService {
@Override
public List<ModelNameGroup> clearedList(RepelManagementVo repelManagementVo) {
new Date(repelManagementVo.getTime());
return toModelNameGroup(repelDetailService.findYearAndUnitToDeviceList(new Date(repelManagementVo.getTime()),new Date(repelManagementVo.getEndTime()),repelManagementVo.getUnitId()));
// return toModelNameGroup(repelDetailService.findYearAndUnitToDeviceList(new Date(repelManagementVo.getTime()),new Date(repelManagementVo.getEndTime()),repelManagementVo.getUnitId()));
return new ArrayList<>();
}
@Override
......@@ -297,6 +309,24 @@ public class RepelQueryServiceImpl implements RepelQueryService {
);
return new DeviceChooseRepel(deviceLibraries,deviceLibrariesAbnormal,1);
}
//装备有现成的接口直接调用
@Override
public PagingVo findRetired(RepelManagementVo repelManagementVo) {
Page<DeviceLibrary> page= deviceLibraryDao.findAll(getFindRetiredSpecification(repelManagementVo),repelManagementVo.getPageable());
return PagingVo.builder()
.data(page.getContent().stream().map(DeviceLibrary::setConfigName).collect(Collectors.toList())).page(repelManagementVo.getPage())
.size(repelManagementVo.getSize()).total((int)page.getTotalElements()).build();
}
private Specification<DeviceLibrary> getFindRetiredSpecification(RepelManagementVo repelManagementVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(repelManagementVo);
// List<Integer> leftStatus=new ArrayList<>();
// leftStatus.add(com.tykj.dev.config.base.DeviceLifeStatus.RETIRED.id);
predicateBuilder.in("lifeStatus", com.tykj.dev.config.base.DeviceLifeStatus.RETIRED.id);
return predicateBuilder.build();
}
private DevRepelVo devRepelVo(DeviceLibrary deviceLibrary){
return new DevRepelVo(deviceLibrary.getId(),deviceLibrary.getName(),deviceLibrary.getModel(),deviceLibrary.getSeqNumber(),deviceLibrary.getType(),deviceLibrary.getTypeName(),deviceLibrary.getUpdateTime());
......@@ -314,4 +344,133 @@ public class RepelQueryServiceImpl implements RepelQueryService {
}
}
/**
* 查询已清退装备列表
*/
@Override
public PagingVo retiredDeviceList(RepelManagementVo repelManagementVo) {
Page<DeviceLibrary> page= deviceLibraryDao.findAll(getRetiredSpecification(repelManagementVo),repelManagementVo.getPageable());
return PagingVo.builder()
.data(page.getContent().stream().map(DeviceLibrary::setConfigName).collect(Collectors.toList())).page(repelManagementVo.getPage())
.size(repelManagementVo.getSize()).total((int)page.getTotalElements()).build();
}
private Specification<DeviceLibrary> getRetiredSpecification(RepelManagementVo repelManagementVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(repelManagementVo);
predicateBuilder.in("lifeStatus", DeviceLifeStatus.REPEL.id);
return predicateBuilder.build();
}
/**
* 查询已清退装备列表
*/
@Override
public PagingVo clearedDeviceList(RepelManagementVo repelManagementVo) {
Page<DeviceLibrary> page=deviceLibraryDao.findAll(getClearedSpecification(repelManagementVo),repelManagementVo.getPageable());
return PagingVo.builder()
.data(page.getContent().stream().map(DeviceLibrary::setConfigName).collect(Collectors.toList())).page(repelManagementVo.getPage())
.size(repelManagementVo.getSize()).total((int)page.getTotalElements()).build();
}
private Specification<DeviceLibrary> getClearedSpecification(RepelManagementVo repelManagementVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(repelManagementVo);
//unitId为空,默认查询当前单位
predicateBuilder.in("id",repelDetailService.findYearAndUnitToDeviceList(new Date(repelManagementVo.getTime()),new Date(repelManagementVo.getEndTime()),repelManagementVo.getUnitId()));
return predicateBuilder.build();
}
/**
* 查询待退役列表
* @param repelManagementVo 条件对象
* @return 退役对象
*/
@Override
public PagingVo toBeRetiredDeviceList(RepelManagementVo repelManagementVo) {
Page<DeviceLibrary> page = deviceLibraryDao.findAll(getSelectSpecification(repelManagementVo),repelManagementVo.getPageable());
// deviceLibraryDao.findAll(getSelectSpecification(repelManagementVo),repelManagementVo.getPageable())
// deviceLibrarySelectVo.setLifeStatus(leftStatus);
return PagingVo.builder()
.data(page.getContent().stream().map(DeviceLibrary::setConfigName).collect(Collectors.toList())).page(repelManagementVo.getPage())
.size(repelManagementVo.getSize()).total((int)page.getTotalElements()).build();
}
private Specification<DeviceLibrary> getSelectSpecification(RepelManagementVo repelManagementVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(repelManagementVo);
//unitId为空,默认查询当前单位
// List<Integer> leftStatus=new ArrayList<>();
// leftStatus.add(DeviceLifeStatus.REPEL.id);
predicateBuilder.eq("lifeStatus", DeviceLifeStatus.REPEL.id);
predicateBuilder.eq("locationUnit", repelManagementVo.getUnitName());
predicateBuilder.eq("ownUnit", repelManagementVo.getUnitName());
return predicateBuilder.build();
}
private PredicateBuilder<DeviceLibrary> getPredicateBuilder(RepelManagementVo repelManagementVo) {
PredicateBuilder<DeviceLibrary> predicateBuilder = Specifications.and();
if (repelManagementVo != null) {
if (repelManagementVo.getModel() != null) {
predicateBuilder.eq("model", repelManagementVo.getModel());
}
if (repelManagementVo.getName() != null) {
predicateBuilder.eq("name", repelManagementVo.getName());
}
if (repelManagementVo.getSecretLevel() != null) {
predicateBuilder.eq("secretLevel", repelManagementVo.getSecretLevel());
}
if (repelManagementVo.getMatchingRange() != null) {
predicateBuilder.eq("matchingRange", repelManagementVo.getMatchingRange());
}
if (repelManagementVo.getStorageType() != null) {
predicateBuilder.eq("storageType", repelManagementVo.getStorageType());
}
if (repelManagementVo.getManageStatus() != null) {
predicateBuilder.eq("manageStatus", repelManagementVo.getManageStatus());
}
if (repelManagementVo.getInvisibleRange() != null) {
predicateBuilder.eq("invisibleRange", repelManagementVo.getInvisibleRange());
}
// if (repelManagementVo.getTime()!=null){
// predicateBuilder.gt("updateTime",new Date(repelManagementVo.getTime()));
// }
// if (repelManagementVo.getEndTime()!=null){
// predicateBuilder.lt("updateTime",new Date(repelManagementVo.getEndTime()));
//
// }
if (repelManagementVo.getContent() != null) {
Class<DeviceLibrary> deviceLibraryEntity = DeviceLibrary.class;
Field[] declaredFields = deviceLibraryEntity.getDeclaredFields();
PredicateBuilder<DeviceLibrary> p = Specifications.or();
for (Field field : declaredFields) {
if (field.getType().equals(String.class) && field.getAnnotation(Transient.class) == null) {
p.like(field.getName(), "%" + repelManagementVo.getContent() + "%");
}
}
predicateBuilder.predicate(p.build());
}
// if (repelManagementVo.getEndTime() != null) {
// predicateBuilder.lt("updateTime", repelManagementVo.getEndTime());
// }
}
return predicateBuilder;
}
}
......@@ -45,11 +45,13 @@ public class RepelTaskStatisticalServiceImpl implements RepelTaskStatisticalServ
return list;
}
@Override
public void saveAllRepelTaskStatistical(List<RepelTaskStatistical> repelTaskStatisticalList) {
repelTaskStatisticalDao.saveAll(repelTaskStatisticalList);
}
@Override
public RepelTaskStatistical findRepelTaskStatistical(Integer taskId, Integer repelId) {
return repelTaskStatisticalDao.findByTaskIdAndAndRepelId(taskId, repelId);
......
package com.tykj.dev.device.task.repository;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......@@ -55,8 +56,7 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
@Query("select o.billId from Task o where o.id=?1 and o.businessType=?2")
Integer findBillId(int id, int businessType);
@Query("select o.billId from Task o where o.parentTaskId = ?1 and o. businessType = ?2")
Integer findBillIdByParentId(int parentTaskId, int businessType);
TaskBto findByParentTaskIdAndBusinessType(int parentTaskId, int businessType);
List<Task> findTaskEntitiesByParentTaskIdAndAndBusinessType(Integer parentTaskId,Integer businessType);
......
......@@ -187,4 +187,9 @@ public interface TaskService {
* 将父Task所有子Task办结
*/
void moveAllSonNodeToEnd(Integer taaskId);
/**
* 根据上级id以及billType 查询task
*/
TaskBto findBillTypeAndFatherId(Integer billType,Integer fatherId);
}
......@@ -21,6 +21,7 @@ import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.CustomOrder;
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;
......@@ -789,6 +790,12 @@ public class TaskServiceImpl implements TaskService {
return taskDao.findAllByBusinessType(billType).stream().map(Task::parse2Bto).collect(Collectors.toList());
}
@Override
public TaskBto findBillTypeAndFatherId(Integer billType, Integer fatherId) {
return taskDao.findByParentTaskIdAndBusinessType(fatherId,billType);
}
@Override
public void moveAllSonNodeToEnd(Integer taaskId) {
List<Task> tasks = taskDao.findAllByParentTaskId(taaskId);
......
......@@ -5,6 +5,7 @@ import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.VenitalisService;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
......@@ -23,6 +24,7 @@ import java.util.Map;
/**
* @author zjm
*/
@Slf4j
public class MyFilter extends UsernamePasswordAuthenticationFilter {
@Autowired
SessionRegistry sessionRegistry;
......@@ -73,6 +75,13 @@ public class MyFilter extends UsernamePasswordAuthenticationFilter {
SecurityUser principal = new SecurityUser();
principal.setUsername(username);
sessionRegistry.registerNewSession(request.getSession(true).getId(), principal);
log.info("session:{}",request.getSession(true).getId());
// sessionRegistry.getAllPrincipals().forEach(
// u->{
// log.info("see对应{}",u);
// log.info("see-id:{}",sessionRegistry.getAllSessions(u, false).get(0).getSessionId());
// }
// );
return this.getAuthenticationManager().authenticate(authRequest);
} else {
SecurityUser principal = new SecurityUser();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论