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

[配发模块]增加配发退回接口

上级 c0fd8ac5
...@@ -92,11 +92,8 @@ public class AllotBillController { ...@@ -92,11 +92,8 @@ public class AllotBillController {
userIds.add(allotBillSaveVo.getSendUserbId()); userIds.add(allotBillSaveVo.getSendUserbId());
TaskBto taskBto = new TaskBto(StatusEnum.ALLOT_SEND_CONFIRM.id,"配发业务",null,".",billId,3,userUtils.getCurrentUnitId(),1,null,userIds); TaskBto taskBto = new TaskBto(StatusEnum.ALLOT_SEND_CONFIRM.id,"配发业务",null,".",billId,3,userUtils.getCurrentUnitId(),1,null,userIds);
TaskBto saveEntity = taskService.start(taskBto); TaskBto saveEntity = taskService.start(taskBto);
//存业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("出库确认单",allotBillEntity.getFileName(),allotBillEntity.getFileUrl())); fileVoList.add(new FileVo("出库确认单",allotBillEntity.getFileName(),allotBillEntity.getFileUrl()));
TaskLogBto taskLogBto = new TaskLogBto(saveEntity.getId(),"对"+allotBillEntity.getReceiveUnit()+"发起配发",fileVoList);
taskLogService.addLog(taskLogBto);
//存装备日志 //存装备日志
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
for (String s:strings) { for (String s:strings) {
...@@ -125,9 +122,6 @@ public class AllotBillController { ...@@ -125,9 +122,6 @@ public class AllotBillController {
TaskBto taskBto1 = taskService.moveToNext(taskBto, allotBillEntity.getReceiveUseraId()); TaskBto taskBto1 = taskService.moveToNext(taskBto, allotBillEntity.getReceiveUseraId());
taskBto1.setOwnUnit(userPublicService.findUnitIdByName(allotBillEntity.getReceiveUnit())); taskBto1.setOwnUnit(userPublicService.findUnitIdByName(allotBillEntity.getReceiveUnit()));
taskService.update(taskBto1); taskService.update(taskBto1);
//存业务日志
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"审核成功并出库",null);
taskLogService.addLog(taskLogBto);
//获取装备信息 //获取装备信息
String deviceIdDetail = allotBillEntity.getAllotCheckDetail(); String deviceIdDetail = allotBillEntity.getAllotCheckDetail();
String[] strings = deviceIdDetail.split("x"); String[] strings = deviceIdDetail.split("x");
...@@ -151,9 +145,6 @@ public class AllotBillController { ...@@ -151,9 +145,6 @@ public class AllotBillController {
if (allotBillConfirmVo.getStatus()==1){ if (allotBillConfirmVo.getStatus()==1){
//业务封存 //业务封存
taskService.update(taskService.moveToArchive(taskBto)); taskService.update(taskService.moveToArchive(taskBto));
//存业务日志
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"配发出库审核失败",null);
taskLogService.addLog(taskLogBto);
//更新账单状态 //更新账单状态
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId()); AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
allotBillEntity.setAllotStatus(1); allotBillEntity.setAllotStatus(1);
...@@ -182,12 +173,9 @@ public class AllotBillController { ...@@ -182,12 +173,9 @@ public class AllotBillController {
//获取当前任务 //获取当前任务
TaskBto taskBto = taskService.get(allotReceiveVo.getTaskId()); TaskBto taskBto = taskService.get(allotReceiveVo.getTaskId());
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId()); AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
//添加业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("配发单", allotReceiveVo.getBillFileName(), allotReceiveVo.getBillFileUrl())); fileVoList.add(new FileVo("配发单", allotReceiveVo.getBillFileName(), allotReceiveVo.getBillFileUrl()));
fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl())); fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl()));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "接收并发起入库", fileVoList);
taskLogService.addLog(taskLogBto);
//更新账单状态 //更新账单状态
allotBillEntity.setAllotStatus(3); allotBillEntity.setAllotStatus(3);
BeanUtils.copyProperties(allotReceiveVo,allotBillEntity); BeanUtils.copyProperties(allotReceiveVo,allotBillEntity);
...@@ -241,8 +229,6 @@ public class AllotBillController { ...@@ -241,8 +229,6 @@ public class AllotBillController {
if (allotReceiveConfirmVo.getStatus() == 0) { if (allotReceiveConfirmVo.getStatus() == 0) {
//业务完结 //业务完结
taskService.update(taskService.moveToEnd(taskBto)); taskService.update(taskService.moveToEnd(taskBto));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "审核成功并入库", null);
taskLogService.addLog(taskLogBto);
//更新账单 //更新账单
allotBillEntity.setAllotStatus(5); allotBillEntity.setAllotStatus(5);
allotBillService.update(allotBillEntity); allotBillService.update(allotBillEntity);
...@@ -266,8 +252,6 @@ public class AllotBillController { ...@@ -266,8 +252,6 @@ public class AllotBillController {
if (allotReceiveConfirmVo.getStatus()==1){ if (allotReceiveConfirmVo.getStatus()==1){
//业务封存 //业务封存
taskService.update(taskService.moveToArchive(taskBto)); taskService.update(taskService.moveToArchive(taskBto));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"配发入库审核失败",null);
taskLogService.addLog(taskLogBto);
//更新账单状态 //更新账单状态
AllotBill allotBillEntity2 = allotBillService.getOne(taskBto.getBillId()); AllotBill allotBillEntity2 = allotBillService.getOne(taskBto.getBillId());
allotBillEntity2.setAllotStatus(4); allotBillEntity2.setAllotStatus(4);
......
package com.tykj.dev.device.allot.repository;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author dengdiyi
*/
public interface AllotBackBillDao extends JpaRepository<AllotBackBill,Integer>, JpaSpecificationExecutor<AllotBackBill> {
}
package com.tykj.dev.device.allot.service;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
/**
* @author dengdiyi
*/
public interface AllotBackBillService {
AllotBackBill addEntity(AllotBackBill allotBackBill);
AllotBackBill update(AllotBackBill allotBackBill);
AllotBackBill getOne(Integer id);
}
package com.tykj.dev.device.allot.service.impl;
import com.tykj.dev.device.allot.repository.AllotBackBillDao;
import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
/**
* @author dengdiyi
*/
@Service
public class AllotBackBillServiceImpl implements AllotBackBillService {
@Autowired
private AllotBackBillDao allotBackBillDao;
@Override
public AllotBackBill addEntity(AllotBackBill allotBackBill) {
return allotBackBillDao.save(allotBackBill);
}
@Override
public AllotBackBill update(AllotBackBill allotBackBill) {
return allotBackBillDao.save(allotBackBill);
}
@Override
public AllotBackBill getOne(Integer id) {
Optional<AllotBackBill> allotBackBill = allotBackBillDao.findById(id);
if (allotBackBill.isPresent()){
return allotBackBill.get();
}
else {
throw new ApiException(ResultUtil.failed("查询的Id不存在"));
}
}
}
package com.tykj.dev.device.allot.subject.domin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
* @author dengdiyi
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update allot_back_bill set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("配发退回账单")
public class AllotBackBill {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(name = "主键id")
private Integer id;
@ApiModelProperty(name = "配发单主键id")
private Integer allotBillId;
@ApiModelProperty(value = "申请文号")
private String applyNumber;
@ApiModelProperty(value = "批复文号")
private String replayNumber;
@ApiModelProperty(value = "发件单位")
private String sendUnit;
@ApiModelProperty(value = "收件单位")
private String receiveUnit;
@ApiModelProperty(value = "发件签发人")
private String agent;
@ApiModelProperty(value = "发件经办人id(A岗位)")
private Integer sendUseraId;
@ApiModelProperty(value = "收件经办人id(A岗位)")
private Integer receiveUseraId;
@ApiModelProperty(value = "收件方审核人id(B岗位)")
private Integer receiveUserbId;
@ApiModelProperty(value = "出库附件文件名")
private String fileName;
@ApiModelProperty(value = "出库附件文件地址URL")
private String fileUrl;
@ApiModelProperty(value = "入库附件文件名")
private String receiveFileName;
@ApiModelProperty(value = "入库附件文件地址URL")
private String receiveFileUrl;
@ApiModelProperty(value = "账单文件名")
private String billFileName;
@ApiModelProperty(value = "账单文件地址URL")
private String billFileUrl;
@ApiModelProperty(value = "配发退回状态(0:退回中,1:退回接收待审核,2:退回接收审核失败,3:退回完成)")
private Integer backStatus;
@CreatedBy
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
@CreatedDate
@ApiModelProperty(value = "创建时间")
private Date createTime;
@LastModifiedBy
@ApiModelProperty(value = "更新用户id")
private Integer updateUserId;
@LastModifiedDate
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "退回装备数量")
private Integer backCount;
@ApiModelProperty(value = "已配发出库装备数量")
private Integer backedCount;
@ApiModelProperty(value = "已接收装备数量")
private Integer receiveCount;
@ApiModelProperty(value = "退回出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配")
private String backCheckDetail;
@ApiModelProperty(value = "退回出库检查结果")
private String backCheckResult;
@ApiModelProperty(value = "退回接收方检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配")
private String receiveCheckDetail;
@ApiModelProperty(value = "接收方检查结果")
private String receiveCheckResult;
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0;
@ApiModelProperty(value = "发件经办人(A岗位)")
@Transient
private String sendUsera;
@ApiModelProperty(value = "收件经办人(A岗位)")
@Transient
private String receiveUsera;
@ApiModelProperty(value = "收件方审核人(B岗位)")
@Transient
private String receiveUserb;
}
package com.tykj.dev.device.allot.subject.vo;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
/**
* @author dengdiyi
*/
@Data
@ApiModel("配发退回单存储类")
public class AllotBackBillSaveVo {
@ApiModelProperty(name = "配发业务主键id")
private Integer taskId;
@ApiModelProperty(value = "申请文号")
private String applyNumber;
@ApiModelProperty(value = "批复文号")
private String replayNumber;
@ApiModelProperty(value = "发件单位")
private String sendUnit;
@ApiModelProperty(value = "接收单位")
private String receiveUnit;
@ApiModelProperty(value = "收件方(A岗位)")
private Integer receiveUseraId;
@ApiModelProperty(value = "账单文件名")
private String fileName;
@ApiModelProperty(value = "账单文件地址URL")
private String fileUrl;
@ApiModelProperty(value = "退回设备数量")
private Integer backCount;
@ApiModelProperty(value = "已退回设备数量")
private Integer backedCount;
@ApiModelProperty(value = "退回出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配)")
private String backCheckDetail;
@ApiModelProperty(value = "退回出库检查结果")
private String backCheckResult;
@ApiModelProperty(value = "签发人")
private String agent;
public AllotBackBill toDo(){
AllotBackBill allotBackBill = new AllotBackBill();
BeanUtils.copyProperties(this,allotBackBill);
allotBackBill.setBackStatus(0);
return allotBackBill;
}
}
package com.tykj.dev.device.allot.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@ApiModel("配发接收类")
public class AllotBackReceiveVo {
@ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId;
@ApiModelProperty(value = "任务Id")
private Integer taskId;
@ApiModelProperty(value = "配发单附件名字")
private String billFileName;
@ApiModelProperty(value = "配发单附件URL")
private String billFileUrl;
@ApiModelProperty(value = "入库附件名字")
private String receiveFileName;
@ApiModelProperty(value = "入库附件URL")
private String receiveFileUrl;
@ApiModelProperty(value = "接收入库数量")
private Integer receiveCount;
@ApiModelProperty(value = "接收入库检查详情")
private String receiveCheckDetail;
@ApiModelProperty(value = "接收入库检查结果")
private String receiveCheckResult;
}
...@@ -106,10 +106,7 @@ public class DeviceApplyController { ...@@ -106,10 +106,7 @@ public class DeviceApplyController {
userIds.add(0); userIds.add(0);
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds); taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
} }
TaskBto saveEntity = taskService.start(taskBto); taskService.start(taskBto);
//添加业务日志
// TaskLogBto taskLogBto = new TaskLogBto(saveEntity.getId(),"发起装备申请",null);
// taskLogService.addLog(taskLogBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(deviceApplyBillEntity); return ResponseEntity.ok(deviceApplyBillEntity);
} }
...@@ -129,8 +126,6 @@ public class DeviceApplyController { ...@@ -129,8 +126,6 @@ public class DeviceApplyController {
applyBillEntity.setApplyStatus(1); applyBillEntity.setApplyStatus(1);
taskService.update(taskService.moveToArchive(taskBto)); taskService.update(taskService.moveToArchive(taskBto));
deviceApplyBillService.update(applyBillEntity); deviceApplyBillService.update(applyBillEntity);
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"装备申请批复驳回",null);
// taskLogService.addLog(taskLogBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(taskBto); return ResponseEntity.ok(taskBto);
} }
...@@ -138,8 +133,6 @@ public class DeviceApplyController { ...@@ -138,8 +133,6 @@ public class DeviceApplyController {
if (deviceApplyConfirmVo.getStatus()==0){ if (deviceApplyConfirmVo.getStatus()==0){
applyBillEntity.setApplyStatus(2); applyBillEntity.setApplyStatus(2);
taskService.update(taskService.moveToEnd(taskBto)); taskService.update(taskService.moveToEnd(taskBto));
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"装备申请批复通过",null);
// taskLogService.addLog(taskLogBto);
//生成配发子任务 //生成配发子任务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(userId); userIds.add(userId);
...@@ -190,8 +183,6 @@ public class DeviceApplyController { ...@@ -190,8 +183,6 @@ public class DeviceApplyController {
//添加业务日志 //添加业务日志
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("出库确认单",allotBillEntity.getFileName(),allotBillEntity.getFileUrl())); fileVoList.add(new FileVo("出库确认单",allotBillEntity.getFileName(),allotBillEntity.getFileUrl()));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"对" + allotBillEntity.getReceiveUnit() + "发起配发",fileVoList);
taskLogService.addLog(taskLogBto);
//添加装备日志 //添加装备日志
List<Integer> integerList = StringSplitUtil.split(allotBillEntity.getAllotCheckDetail()); List<Integer> integerList = StringSplitUtil.split(allotBillEntity.getAllotCheckDetail());
if (integerList.size()>0) { if (integerList.size()>0) {
......
...@@ -5,11 +5,8 @@ import lombok.AllArgsConstructor; ...@@ -5,11 +5,8 @@ import lombok.AllArgsConstructor;
import static com.tykj.dev.misc.base.StatusEnum.*; import static com.tykj.dev.misc.base.StatusEnum.*;
/** /**
* Type * @author dengdiyi
* */
* @author Lunhao Hu
* @date 2019-01-30 17:12
**/
@AllArgsConstructor @AllArgsConstructor
public enum LogType { public enum LogType {
...@@ -68,8 +65,6 @@ public enum LogType { ...@@ -68,8 +65,6 @@ public enum LogType {
DESTROY_1(24, ORIGIN_STATUS.id, DESTROY_BUSINESS_NEED_CONFIRM.id, "发起销毁"), DESTROY_1(24, ORIGIN_STATUS.id, DESTROY_BUSINESS_NEED_CONFIRM.id, "发起销毁"),
DESTROY_2(25, DESTROY_BUSINESS_NEED_CONFIRM.id, END.id, "销毁出库审核成功"),
DESTROY_3(26, DESTROY_BUSINESS_NEED_CONFIRM.id, ARCHIVE.id, "销毁出库审核失败"), DESTROY_3(26, DESTROY_BUSINESS_NEED_CONFIRM.id, ARCHIVE.id, "销毁出库审核失败"),
MATCHING_1(27, ORIGIN_STATUS.id, ADD_MATCHING_DEVICE_CONFIRM.id, "发起新增配套设备"), MATCHING_1(27, ORIGIN_STATUS.id, ADD_MATCHING_DEVICE_CONFIRM.id, "发起新增配套设备"),
...@@ -82,10 +77,14 @@ public enum LogType { ...@@ -82,10 +77,14 @@ public enum LogType {
REPAIR_SEND_2(31, REPAIR_SEND_CONFIRM.id, WAIT_RECEIVE.id, "审核成功并出库"), REPAIR_SEND_2(31, REPAIR_SEND_CONFIRM.id, WAIT_RECEIVE.id, "审核成功并出库"),
DESTROY_2(25,DESTROY_BUSINESS_NEED_CONFIRM.id,WAIT_UPLOAD_BILL_FILE.id,"销毁出库审核成功"),
REPAIR_SEND_3(32, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"), REPAIR_SEND_3(32, REPAIR_SEND_CONFIRM.id, ARCHIVE.id, "维修出库审核失败"),
REPAIR_SEND_4(33, WAIT_RECEIVE.id, REPAIR_RECEIVE_CONFIRM.id, "接收维修装备并发起入库"), REPAIR_SEND_4(33, WAIT_RECEIVE.id, REPAIR_RECEIVE_CONFIRM.id, "接收维修装备并发起入库"),
DESTROY_4(100,WAIT_UPLOAD_BILL_FILE.id,END.id,"上传销毁单"),
REPAIR_SEND_5(34, REPAIR_RECEIVE_CONFIRM.id, REPAIRING.id, "审核成功并入库维修"), REPAIR_SEND_5(34, REPAIR_RECEIVE_CONFIRM.id, REPAIRING.id, "审核成功并入库维修"),
REPAIR_SEND_6(35, REPAIR_RECEIVE_CONFIRM.id, ARCHIVE.id, "维修装备入库审核失败"), REPAIR_SEND_6(35, REPAIR_RECEIVE_CONFIRM.id, ARCHIVE.id, "维修装备入库审核失败"),
...@@ -127,10 +126,20 @@ public enum LogType { ...@@ -127,10 +126,20 @@ public enum LogType {
CONFIRM_CHECK_DETAIL_OTHER_3(53, CHECK_DETAIL_2.id, CHECK_DETAIL_0.id, "核查组成员A审核失败,跳回A岗人员操作"), CONFIRM_CHECK_DETAIL_OTHER_3(53, CHECK_DETAIL_2.id, CHECK_DETAIL_0.id, "核查组成员A审核失败,跳回A岗人员操作"),
CONFIRM_CHECK_DETAIL_OTHER_4(54, CHECK_DETAIL_3.id, CHECK_DETAIL_0.id, "核查组成员B审核失败,跳回A岗人员操作"), CONFIRM_CHECK_DETAIL_OTHER_4(54, CHECK_DETAIL_3.id, CHECK_DETAIL_0.id, "核查组成员B审核失败,跳回A岗人员操作"),
CONFIRM_CHECK_DETAIL_STAT_1(55, CHECK_STAT_0.id, CHECK_STAT_1.id, "地区数据已统计完毕,等待确认"), CONFIRM_CHECK_DETAIL_STAT_1(55, CHECK_STAT_0.id, CHECK_STAT_1.id, "地区数据已统计完毕,等待确认"),
CONFIRM_CHECK_DETAIL_STAT_2(56, CHECK_STAT_1.id, END.id, "地区数据已确认完毕,将统计上传,任务完结"); CONFIRM_CHECK_DETAIL_STAT_2(56, CHECK_STAT_1.id, END.id, "地区数据已确认完毕,将统计上传,任务完结"),
ALLOT_BACK_1(57,ORIGIN_STATUS.id,ALLOT_BACKING.id,"配发退回装备出库成功"),
ALLOT_BACK_2(58,ALLOT_BACKING.id,ALLOT_BACK_CONFIRM.id,"配发退回装备接收成功"),
ALLOT_BACK_3(59,ALLOT_BACK_CONFIRM.id,END.id,"配发退回装备接收审核成功"),
ALLOT_BACK_4(60,ALLOT_BACK_CONFIRM.id,ARCHIVE.id,"配发退回装备接收审核失败");
public Integer id; public Integer id;
...@@ -149,7 +158,5 @@ public enum LogType { ...@@ -149,7 +158,5 @@ public enum LogType {
*/ */
public String operation; public String operation;
public String getOperation() { public String getOperation() { return this.operation; }
return this.operation;
}
} }
...@@ -174,12 +174,6 @@ public class DeviceDestroyController { ...@@ -174,12 +174,6 @@ public class DeviceDestroyController {
//初始化需要的数据 //初始化需要的数据
TaskBto task = taskService.get(deviceDestoryConfirmVo.getTaskId()); TaskBto task = taskService.get(deviceDestoryConfirmVo.getTaskId());
DeviceDestroyBill deviceDestroyBill = deviceDestroyBillService.getOne(task.getBillId()); DeviceDestroyBill deviceDestroyBill = deviceDestroyBillService.getOne(task.getBillId());
if (deviceDestoryConfirmVo.getDestroyFileName()!= null){
deviceDestroyBill.setDestroyFileName(deviceDestoryConfirmVo.getDestroyFileName());
}
if (deviceDestoryConfirmVo.getDestroyFileUrl()!= null){
deviceDestroyBill.setDestroyFileUrl(deviceDestoryConfirmVo.getDestroyFileUrl());
}
//判断审核结果 0为审核通过,1为审核不通过 //判断审核结果 0为审核通过,1为审核不通过
if (deviceDestoryConfirmVo.getResult() == 1) { if (deviceDestoryConfirmVo.getResult() == 1) {
//更改账单状态 //更改账单状态
...@@ -188,7 +182,6 @@ public class DeviceDestroyController { ...@@ -188,7 +182,6 @@ public class DeviceDestroyController {
this.deviceDestroyBillService.updateEntity(deviceDestroyBill); this.deviceDestroyBillService.updateEntity(deviceDestroyBill);
//将任务推进至封存 //将任务推进至封存
taskService.moveToArchive(task); taskService.moveToArchive(task);
taskService.update(task);
} else { } else {
//更改账单状态 //更改账单状态
deviceDestroyBill.setDestroyStatus(DestroyStatus.CONFIRM_SUCCESS.getStatus()); deviceDestroyBill.setDestroyStatus(DestroyStatus.CONFIRM_SUCCESS.getStatus());
...@@ -198,23 +191,54 @@ public class DeviceDestroyController { ...@@ -198,23 +191,54 @@ public class DeviceDestroyController {
deviceDestroyBill.setDocNumber(this.deviceDestroyBillService.getNewDocNumber()); deviceDestroyBill.setDocNumber(this.deviceDestroyBillService.getNewDocNumber());
//更新销毁账单 //更新销毁账单
this.deviceDestroyBillService.updateEntity(deviceDestroyBill); this.deviceDestroyBillService.updateEntity(deviceDestroyBill);
//将任务推进至完结 //将任务推进至下一步
taskService.moveToEnd(task); taskService.moveToNext(task,deviceDestroyBill.getStartUserBId());
taskService.update(task);
} }
//生成日志所需的文件列表 //生成日志所需的文件列表
ArrayList<FileVo> billList = ListUtil.createList( // ArrayList<FileVo> billList = ListUtil.createList(
deviceDestroyBill.getDestroyFileName()!=null&&deviceDestroyBill.getDestroyFileUrl()!=null? // deviceDestroyBill.getDestroyFileName()!=null&&deviceDestroyBill.getDestroyFileUrl()!=null?
new FileVo("销毁单据", deviceDestroyBill.getDestroyFileName(), deviceDestroyBill.getDestroyFileUrl()):null // new FileVo("销毁单据", deviceDestroyBill.getDestroyFileName(), deviceDestroyBill.getDestroyFileUrl()):null
); // );
//更改对应装备的状态为销毁 //更改对应装备的状态为销毁
handleDeviceDetail(deviceDestroyBill,billList,deviceDestoryConfirmVo.getResult()); handleDeviceDetail(deviceDestroyBill,null,deviceDestoryConfirmVo.getResult());
// //生成任务日志 // //生成任务日志
// taskLogService.addLog(new TaskLogBto(task.getId(),deviceDestoryConfirmVo.getResult() == 0?"销毁成功":"销毁审核失败",billList)); // taskLogService.addLog(new TaskLogBto(task.getId(),deviceDestoryConfirmVo.getResult() == 0?"销毁成功":"销毁审核失败",billList));
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return selectDestroyDetail(deviceDestroyBill.getId()); return selectDestroyDetail(deviceDestroyBill.getId());
} }
@ApiOperation(value = "上传销毁单", notes = "可以通过这个上传销毁单")
@PostMapping(value = "/upload")
public ResponseEntity uploadDestroyFile(@RequestBody UploadDestroyFileVo uploadDestroyFileVo){
//获取当前task
TaskBto taskBto = taskService.get(uploadDestroyFileVo.getTaskId());
//获取销毁单
DeviceDestroyBill deviceDestroyBill = deviceDestroyBillService.getOne(taskBto.getBillId());
//更新销毁单
if (uploadDestroyFileVo.getDestroyFileUrl()!=null) {
deviceDestroyBill.setDestroyFileUrl(uploadDestroyFileVo.getDestroyFileUrl());
}
if (uploadDestroyFileVo.getDestroyFileName()!=null) {
deviceDestroyBill.setDestroyFileName(uploadDestroyFileVo.getDestroyFileName());
}
deviceDestroyBillService.updateEntity(deviceDestroyBill);
//任务完结
taskService.moveToEnd(taskBto);
//生成日志所需的文件列表
ArrayList<FileVo> billList = ListUtil.createList(
deviceDestroyBill.getDestroyFileName()!=null&&deviceDestroyBill.getDestroyFileUrl()!=null?
new FileVo("销毁单据", deviceDestroyBill.getDestroyFileName(), deviceDestroyBill.getDestroyFileUrl()):null
);
List<Integer> list = StringSplitUtil.split(deviceDestroyBill.getDestroyDeviceDetail());
for (Integer id : list) {
if (id > 0) {
//生成装备日志
deviceLogService.addLog(new DeviceLogDto(id,"上传销毁单",billList));
}
}
return ResponseEntity.ok("上传成功");
}
private void handleDeviceDetail(DeviceDestroyBill deviceDestroyBill,ArrayList<FileVo> billList,Integer flag) { private void handleDeviceDetail(DeviceDestroyBill deviceDestroyBill,ArrayList<FileVo> billList,Integer flag) {
List<Integer> list = StringSplitUtil.split(deviceDestroyBill.getDestroyDeviceDetail()); List<Integer> list = StringSplitUtil.split(deviceDestroyBill.getDestroyDeviceDetail());
for (Integer id : list) { for (Integer id : list) {
......
...@@ -23,10 +23,4 @@ public class DeviceDestroyConfirmVo { ...@@ -23,10 +23,4 @@ public class DeviceDestroyConfirmVo {
@NotNull @NotNull
@ApiModelProperty(value = "审核结果 0为不通过 1为通过 ",example = "1") @ApiModelProperty(value = "审核结果 0为不通过 1为通过 ",example = "1")
private Integer result; private Integer result;
@ApiModelProperty(value = "销毁附件文件名")
private String destroyFileName ;
@ApiModelProperty(value = "销毁附件文件地址URL")
private String destroyFileUrl ;
} }
package com.tykj.dev.device.destroy.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@ApiModel("上传销毁单")
@Data
public class UploadDestroyFileVo {
@ApiModelProperty(name = "业务id")
private Integer taskId;
@ApiModelProperty(value = "销毁附件文件名")
private String destroyFileName ;
@ApiModelProperty(value = "销毁附件文件地址URL")
private String destroyFileUrl ;
}
...@@ -109,5 +109,4 @@ public interface DeviceLibraryService { ...@@ -109,5 +109,4 @@ public interface DeviceLibraryService {
* 查询拥有装备的所有单位 * 查询拥有装备的所有单位
*/ */
List<String> getAllUnit(); List<String> getAllUnit();
} }
...@@ -88,7 +88,11 @@ public enum BusinessEnum { ...@@ -88,7 +88,11 @@ public enum BusinessEnum {
/** /**
* 工作交接 * 工作交接
*/ */
WORK_HANDOVER(21,"工作交接") WORK_HANDOVER(21,"工作交接"),
/**
* 配发退回
*/
ALLOT_BACK(22,"配发退回")
; ;
public Integer id; public Integer id;
......
...@@ -26,6 +26,7 @@ public enum StatusEnum { ...@@ -26,6 +26,7 @@ public enum StatusEnum {
*/ */
CREATE_DESTROY_BUSINESS(8110,"装备销毁业务开始"), CREATE_DESTROY_BUSINESS(8110,"装备销毁业务开始"),
DESTROY_BUSINESS_NEED_CONFIRM(8111,"等待审核"), DESTROY_BUSINESS_NEED_CONFIRM(8111,"等待审核"),
WAIT_UPLOAD_BILL_FILE(8112,"等待上传销毁单"),
/** /**
* 退装业务 * 退装业务
...@@ -167,7 +168,13 @@ public enum StatusEnum { ...@@ -167,7 +168,13 @@ public enum StatusEnum {
*/ */
REPAIR_BACK_CONFIRM(800,"维修退回装备出库待审核"), REPAIR_BACK_CONFIRM(800,"维修退回装备出库待审核"),
WAIT_BACK_RECEIVE(801,"等待接收维修退回装备"), WAIT_BACK_RECEIVE(801,"等待接收维修退回装备"),
REPAIR_BACK_RECEIVE_CONFIRM(802,"接收维修退回装备待审核") REPAIR_BACK_RECEIVE_CONFIRM(802,"接收维修退回装备待审核"),
/**
* 配发退回状态
*/
ALLOT_BACKING(900,"配发退回中"),
ALLOT_BACK_CONFIRM(901,"配发退回入库待审核")
; ;
public Integer id; public Integer id;
......
package com.tykj.dev.device.taskselect.controller; package com.tykj.dev.device.taskselect.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.service.AllotBillService; import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill; import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.apply.service.DeviceApplyBillService; import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill; import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
...@@ -76,7 +78,8 @@ public class TaskSelectController { ...@@ -76,7 +78,8 @@ public class TaskSelectController {
@Autowired @Autowired
private MatchingDeviceLibraryService matchingDeviceLibraryService; private MatchingDeviceLibraryService matchingDeviceLibraryService;
@Autowired
private AllotBackBillService allotBackBillService;
@ApiOperation(value = "查询业务对应页面的数据", notes = "可以通过这个接口查询业务对应页面的数据") @ApiOperation(value = "查询业务对应页面的数据", notes = "可以通过这个接口查询业务对应页面的数据")
@GetMapping("/manage/detail/{id}") @GetMapping("/manage/detail/{id}")
...@@ -170,6 +173,34 @@ public class TaskSelectController { ...@@ -170,6 +173,34 @@ public class TaskSelectController {
} }
list.add(deviceLibraryEntities); list.add(deviceLibraryEntities);
return ResponseEntity.ok(new ResultObj(list,"查询成功")); return ResponseEntity.ok(new ResultObj(list,"查询成功"));
case 22:
AllotBackBill allotBackBill = allotBackBillService.getOne(billId);
if (allotBackBill.getSendUseraId()!=null){
allotBackBill.setSendUsera(userPublicService.getOne(allotBackBill.getSendUseraId()).getName());
}
if (allotBackBill.getReceiveUseraId()!=null){
allotBackBill.setReceiveUsera(userPublicService.getOne(allotBackBill.getReceiveUseraId()).getName());
}
if (allotBackBill.getReceiveUserbId()!=null){
allotBackBill.setReceiveUserb(userPublicService.getOne(allotBackBill.getReceiveUserbId()).getName());
}
list.add(allotBackBill);
String detail = allotBackBill.getBackCheckDetail();
List<DeviceLibrary> libraryArrayList = new ArrayList<>();
if (detail!=null) {
String[] strings1 = detail.split("x");
for (String s : strings1) {
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setCheckResult(checkResult);
libraryArrayList.add(deviceLibraryEntity);
}
}
}
list.add(libraryArrayList);
return ResponseEntity.ok(new ResultObj(list,"查询成功"));
case 4: case 4:
SelfCheckBill selfExaminationBillEntity = selfCheckBillService.getOne(billId); SelfCheckBill selfExaminationBillEntity = selfCheckBillService.getOne(billId);
if (selfExaminationBillEntity.getUseraId()!=0) { if (selfExaminationBillEntity.getUseraId()!=0) {
......
...@@ -6,7 +6,9 @@ import com.tykj.dev.config.Log; ...@@ -6,7 +6,9 @@ import com.tykj.dev.config.Log;
import com.tykj.dev.config.Param; import com.tykj.dev.config.Param;
import com.tykj.dev.config.LogType; import com.tykj.dev.config.LogType;
import com.tykj.dev.device.allot.repository.AllotBillDao; import com.tykj.dev.device.allot.repository.AllotBillDao;
import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.service.AllotBillService; import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill; import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.apply.service.DeviceApplyBillService; import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBillEntity; import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBillEntity;
...@@ -53,6 +55,7 @@ import com.tykj.dev.misc.base.StatusEnum; ...@@ -53,6 +55,7 @@ import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.SpringUtils; import com.tykj.dev.misc.utils.SpringUtils;
import com.tykj.dev.rfid.entity.domin.RfidChangeBill; import com.tykj.dev.rfid.entity.domin.RfidChangeBill;
import com.tykj.dev.rfid.service.RfidChangeBillService; import com.tykj.dev.rfid.service.RfidChangeBillService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
...@@ -72,6 +75,7 @@ import java.util.*; ...@@ -72,6 +75,7 @@ import java.util.*;
* 业务操作日志aop * 业务操作日志aop
* @author dengdiyi * @author dengdiyi
*/ */
@Slf4j
@Aspect @Aspect
@Component @Component
public class LogAspect { public class LogAspect {
...@@ -148,7 +152,7 @@ public class LogAspect { ...@@ -148,7 +152,7 @@ public class LogAspect {
this.args = point.getArgs(); this.args = point.getArgs();
//找到输入的taskBto //找到输入的taskBto
for (Object o:this.args) { for (Object o:this.args) {
if ("com.tykj.dev.device.task.subject.bto.TaskBto".equals(o.getClass().getName())){ if ("TaskBto".equals(o.getClass().getSimpleName())){
ModelMapper modelMapper = BeanHelper.getUserMapper(); ModelMapper modelMapper = BeanHelper.getUserMapper();
modelMapper.map(o,this.inputTask); modelMapper.map(o,this.inputTask);
this.oldStatus = this.inputTask.getBillStatus(); this.oldStatus = this.inputTask.getBillStatus();
...@@ -160,8 +164,8 @@ public class LogAspect { ...@@ -160,8 +164,8 @@ public class LogAspect {
/** /**
* 新增结果返回后触发 * 新增结果返回后触发
*/ */
@AfterReturning(returning = "returnValue", pointcut = "operationLog() && @annotation(log)") @AfterReturning(returning = "returnValue", pointcut = "operationLog() && @annotation(log1)")
public void doAfterReturning(JoinPoint point, Object returnValue, Log log) { public void doAfterReturning(JoinPoint point, Object returnValue,Log log1) {
try { try {
//输出的taskBto //输出的taskBto
this.outPutTask = (TaskBto)returnValue; this.outPutTask = (TaskBto)returnValue;
...@@ -187,12 +191,18 @@ public class LogAspect { ...@@ -187,12 +191,18 @@ public class LogAspect {
params = new Param(); params = new Param();
//获取账单的所有属性名称 //获取账单的所有属性名称
this.getBillParam(); this.getBillParam();
if (!opreation.isEmpty()) { if (opreation!=null&&!opreation.isEmpty()) {
// 将模板中的参数全部替换掉 // 将模板中的参数全部替换掉
opreation = this.replaceParam(opreation); opreation = this.replaceParam(opreation);
} }
TaskLogBto taskLogBto = new TaskLogBto(this.outPutTask.getId(), this.opreation,this.fileVos); if (this.opreation==null){
taskLogService.addLog(taskLogBto); log.warn("[业务操作日志]存储失败:找不到旧状态为"+this.oldStatus+",新状态为"+this.newStatus+"的日志模板");
}
else {
TaskLogBto taskLogBto = new TaskLogBto(this.outPutTask.getId(), this.opreation, this.fileVos);
taskLogService.addLog(taskLogBto);
this.fileVos = new ArrayList<>();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -288,6 +298,20 @@ public class LogAspect { ...@@ -288,6 +298,20 @@ public class LogAspect {
} }
} }
break; break;
case 22:
AllotBackBillService allotBackBillService = SpringUtils.getBean("allotBackBillServiceImpl");
if (allotBackBillService != null) {
AllotBackBill allotBackBill = allotBackBillService.getOne(outPutTask.getBillId());
getFieldsParam(allotBackBill);
if ((this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id)&&this.newStatus.equals(StatusEnum.ALLOT_BACKING.id))){
this.fileVos.add(new FileVo("出库确认单",allotBackBill.getFileName(),allotBackBill.getFileUrl()));
}
if ((this.oldStatus.equals(StatusEnum.ALLOT_BACKING.id)&&this.newStatus.equals(StatusEnum.ALLOT_BACK_CONFIRM.id))){
this.fileVos.add(new FileVo("退回单", allotBackBill.getBillFileName(), allotBackBill.getBillFileUrl()));
this.fileVos.add(new FileVo("入库确认单", allotBackBill.getReceiveFileName(), allotBackBill.getReceiveFileUrl()));
}
}
break;
case 4: case 4:
SelfCheckBillService selfCheckBillService = SpringUtils.getBean("selfCheckBillServiceImpl"); SelfCheckBillService selfCheckBillService = SpringUtils.getBean("selfCheckBillServiceImpl");
if (selfCheckBillService != null) { if (selfCheckBillService != null) {
...@@ -362,7 +386,7 @@ public class LogAspect { ...@@ -362,7 +386,7 @@ public class LogAspect {
if ((this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id)&&this.newStatus.equals(StatusEnum.DESTROY_BUSINESS_NEED_CONFIRM.id))){ if ((this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id)&&this.newStatus.equals(StatusEnum.DESTROY_BUSINESS_NEED_CONFIRM.id))){
this.fileVos.add(new FileVo("出库确认单", deviceDestroyBill.getFileName(), deviceDestroyBill.getFileUrl())); this.fileVos.add(new FileVo("出库确认单", deviceDestroyBill.getFileName(), deviceDestroyBill.getFileUrl()));
} }
if ((this.oldStatus.equals(StatusEnum.DESTROY_BUSINESS_NEED_CONFIRM.id)&&this.newStatus.equals(StatusEnum.END.id))){ if ((this.oldStatus.equals(StatusEnum.WAIT_UPLOAD_BILL_FILE.id)&&this.newStatus.equals(StatusEnum.END.id))){
this.fileVos.add(new FileVo("销毁单", deviceDestroyBill.getDestroyFileName(), deviceDestroyBill.getDestroyFileUrl())); this.fileVos.add(new FileVo("销毁单", deviceDestroyBill.getDestroyFileName(), deviceDestroyBill.getDestroyFileUrl()));
} }
} }
......
package com.tykj.dev.AllotBack;
import com.tykj.dev.device.task.repository.TaskDao;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
@SuppressWarnings("ALL")
@WithMockUser(username = "shia", password = "qwer1234", authorities = "市A专管员")
@ActiveProfiles("dev")
public class AllotBackControllerTest {
@Autowired
protected MockMvc mockMvc;
@Autowired
private TaskDao taskDao;
static int taskId;
/**
* 发起配发退回单元测试
*/
@Test
public void createAllotBackTest() throws Exception{
}
}
...@@ -41,8 +41,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -41,8 +41,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
@WithMockUser(username = "shia", password = "qwer1234", authorities = "市A专管员") @WithMockUser(username = "shia", password = "qwer1234", authorities = "市A专管员")
@ActiveProfiles("dev") @ActiveProfiles("dev")
//@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(classes= BeanConfig.class)
public class RepairControllerTest extends BaseTest { public class RepairControllerTest extends BaseTest {
@Autowired @Autowired
......
...@@ -55,6 +55,10 @@ ...@@ -55,6 +55,10 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>config</artifactId> <artifactId>config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-scrap</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.tykj.dev.device.usereport.service; package com.tykj.dev.device.usereport.service;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport; import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import com.tykj.dev.device.usereport.subject.vo.DeviceStatistics;
import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportCreateVo; import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportCreateVo;
import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportSelectVo; import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportSelectVo;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Date;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -21,5 +25,33 @@ public interface DeviceUseReportService { ...@@ -21,5 +25,33 @@ public interface DeviceUseReportService {
DeviceUseReport createReport(DeviceUseReportCreateVo deviceUseReportCreateVo); DeviceUseReport createReport(DeviceUseReportCreateVo deviceUseReportCreateVo);
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省入库的统计
*/
List<DeviceStatistics> getStorageStatistics(Date startDate,Date endDate);
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省送国家维修的统计
*/
List<DeviceStatistics> getRepairStatistics(Date startDate,Date endDate);
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省销毁的统计
*/
List<DeviceStatistics> getDestroyStatistics(Date startDate,Date endDate);
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省报废的统计
*/
List<DeviceStatistics> getScrapStatistics(Date startDate,Date endDate);
void delete(Integer id); void delete(Integer id);
} }
...@@ -7,12 +7,18 @@ import com.tykj.dev.device.allot.subject.domin.AllotBill; ...@@ -7,12 +7,18 @@ import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.destroy.entity.domain.DeviceDestroyBill; import com.tykj.dev.device.destroy.entity.domain.DeviceDestroyBill;
import com.tykj.dev.device.destroy.repository.DeviceDestroyBillDao; import com.tykj.dev.device.destroy.repository.DeviceDestroyBillDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
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.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo; import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.packing.repository.PackingLibraryDao; import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary; import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.repair.repository.RepairDetailDao; import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.repository.RepairSendBillDao;
import com.tykj.dev.device.repair.subject.domin.RepairBill;
import com.tykj.dev.device.repair.subject.domin.RepairDetail; import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
import com.tykj.dev.device.scrap.repository.ScrapBillDao;
import com.tykj.dev.device.scrap.subject.domin.ScrapBill;
import com.tykj.dev.device.sendback.entity.domain.SendBackBillDetail; import com.tykj.dev.device.sendback.entity.domain.SendBackBillDetail;
import com.tykj.dev.device.sendback.repository.SendBackBillDetailDao; import com.tykj.dev.device.sendback.repository.SendBackBillDetailDao;
import com.tykj.dev.device.storage.repository.StorageBillDao; import com.tykj.dev.device.storage.repository.StorageBillDao;
...@@ -22,6 +28,7 @@ import com.tykj.dev.device.user.util.UserUtils; ...@@ -22,6 +28,7 @@ import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.device.usereport.repository.DeviceUseReportDao; import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
import com.tykj.dev.device.usereport.service.DeviceUseReportService; import com.tykj.dev.device.usereport.service.DeviceUseReportService;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport; import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import com.tykj.dev.device.usereport.subject.vo.DeviceStatistics;
import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportCreateVo; import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportCreateVo;
import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportSelectVo; import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportSelectVo;
import com.tykj.dev.misc.utils.StringSplitUtil; import com.tykj.dev.misc.utils.StringSplitUtil;
...@@ -67,7 +74,11 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -67,7 +74,11 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
@Autowired @Autowired
private DeviceDestroyBillDao deviceDestroyBillDao; private DeviceDestroyBillDao deviceDestroyBillDao;
@Autowired
private RepairSendBillDao repairSendBillDao;
@Autowired
private ScrapBillDao scrapBillDao;
@Autowired @Autowired
private PackingLibraryDao packingLibraryDao; private PackingLibraryDao packingLibraryDao;
...@@ -123,7 +134,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -123,7 +134,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
List<DeviceLibrary> deviceLibraryEntities = deviceLibraryService.getPage(deviceLibrarySelectVo,deviceLibrarySelectVo.getPageable()).getContent(); List<DeviceLibrary> deviceLibraryEntities = deviceLibraryService.getPage(deviceLibrarySelectVo,deviceLibrarySelectVo.getPageable()).getContent();
int num = deviceLibraryEntities.size(); int num = deviceLibraryEntities.size();
int inLibraryNum = 0; int inLibraryNum = 0;
int repairNum = 0; int repairNum;
int destoryNum=0; int destoryNum=0;
int allotNum = 0; int allotNum = 0;
int sendBackNum = 0; int sendBackNum = 0;
...@@ -219,6 +230,113 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -219,6 +230,113 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
return deviceUseReportDao.save(deviceUseReportEntity); return deviceUseReportDao.save(deviceUseReportEntity);
} }
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省入库的统计
*/
@Override
public List<DeviceStatistics> getStorageStatistics(Date startDate, Date endDate) {
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
//获取这一段时间所有入库的装备
//筛选出日期范围内所有入库账单
List<StorageBill> storageBillEntities = storageBillDao.findAll().stream()
.filter(storageBillEntity -> storageBillEntity.getStorageStatus()==2&&userPublicService.findByUnitsToname(1).equals(userPublicService.findUnitsNameByUserId(storageBillEntity.getReceiveUseraId()))&&storageBillEntity.getUpdateTime().after(startDate)&&storageBillEntity.getUpdateTime().before(endDate))
.collect(Collectors.toList());
//获取所有入库的装备
if (storageBillEntities.size()>0){
for (StorageBill s:storageBillEntities) {
List<Integer> integerList = StringSplitUtil.userIdSplit(s.getStorageDetail());
integerList.forEach(integer -> deviceLibraries.add(deviceLibraryService.getOne(integer)));
}
}
return getDeviceStatistics(deviceLibraries);
}
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省送国家维修的统计
*/
@Override
public List<DeviceStatistics> getRepairStatistics(Date startDate, Date endDate) {
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
//筛选出日期范围内所有送修账单
List<RepairSendBill> repairSendBills = repairSendBillDao.findAll().stream()
.filter(repairSendBill -> repairSendBill.getRepairStatus()==5&&userPublicService.findByUnitsToname(1).equals(repairSendBill.getSendUnit())&&repairSendBill.getSendTime().after(startDate)&&repairSendBill.getSendTime().before(endDate))
.collect(Collectors.toList());
//获取所有维修的装备
if (repairSendBills.size()>0){
for (RepairSendBill s:repairSendBills) {
String[] strings = s.getRepairDeviceCheckResult().split("x");
for (String s1:strings) {
if (s1.length()>=2){
//出库无误装备
if ("1".equals(s1.substring(s1.length() - 1))) {
Integer id = Integer.parseInt(s1.substring(0, s1.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraries.add(deviceLibraryEntity);
}
}
}
}
}
return getDeviceStatistics(deviceLibraries);
}
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省销毁的统计
*/
@Override
public List<DeviceStatistics> getDestroyStatistics(Date startDate, Date endDate) {
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
//筛选出日期范围内所有销毁账单
List<DeviceDestroyBill> deviceDestroyBills = deviceDestroyBillDao.findAll().stream()
.filter(deviceDestroyBill -> deviceDestroyBill.getDestroyStatus()==2&&deviceDestroyBill.getDestroyTime().after(startDate)&&deviceDestroyBill.getDestroyTime().before(endDate))
.collect(Collectors.toList());
//获取所有销毁的装备
if (deviceDestroyBills.size()>0){
for (DeviceDestroyBill s:deviceDestroyBills) {
String[] strings = s.getDestroyDeviceDetail().split("x");
for (String s1:strings) {
if (s1.length()>=2){
//出库无误装备
if ("1".equals(s1.substring(s1.length() - 1))) {
Integer id = Integer.parseInt(s1.substring(0, s1.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraries.add(deviceLibraryEntity);
}
}
}
}
}
return getDeviceStatistics(deviceLibraries);
}
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省报废的统计
*/
@Override
public List<DeviceStatistics> getScrapStatistics(Date startDate, Date endDate) {
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
//筛选出日期范围内所有报废账单
List<ScrapBill> scrapBills = scrapBillDao.findAll().stream()
.filter(scrapBill -> scrapBill.getScrapUnit().equals(userPublicService.findByUnitsToname(1))&&scrapBill.getScrapTime().after(startDate)&&scrapBill.getScrapTime().before(endDate))
.collect(Collectors.toList());
//获取所有报废的装备
if (scrapBills.size()>0){
for (ScrapBill s:scrapBills) {
List<Integer> integerList = StringSplitUtil.userIdSplit(s.getScrapDetail());
integerList.forEach(integer -> deviceLibraries.add(deviceLibraryService.getOne(integer)));
}
}
return getDeviceStatistics(deviceLibraries);
}
@Override @Override
public void delete(Integer id) { public void delete(Integer id) {
deviceUseReportDao.deleteById(id); deviceUseReportDao.deleteById(id);
...@@ -247,4 +365,24 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -247,4 +365,24 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
} }
return predicateBuilder.build(); return predicateBuilder.build();
} }
/**
* 按型号,名称,类型组合
*/
private List<DeviceStatistics> getDeviceStatistics(List<DeviceLibrary> deviceLibraries){
List<DeviceStatistics> deviceStatisticsList = new ArrayList<>();
Map<String,List<DeviceLibrary>> map = deviceLibraries.stream().collect(Collectors.groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()+"Ǵ"+deviceLibrary.getType()));
map.forEach((s, deviceLibraries1) -> {
String[] strings = s.split("Ǵ");
if (strings.length==3){
DeviceStatistics deviceStatistics = new DeviceStatistics();
deviceStatistics.setModel(strings[0]);
deviceStatistics.setName(strings[1]);
deviceStatistics.setType(Integer.valueOf(strings[2]));
deviceStatistics.setNum(deviceLibraries1.size());
deviceStatisticsList.add(deviceStatistics);
}
});
return deviceStatisticsList;
}
} }
package com.tykj.dev.device.usereport.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@ApiModel("装备统计类")
public class DeviceStatistics {
@ApiModelProperty(value = "型号",example = "bmxx")
public String model;
@ApiModelProperty(value = "名称",example = "BM-1")
public String name;
@ApiModelProperty(value = "装备类型",example = "100")
private Integer type;
@ApiModelProperty(value = "数量",example = "10")
private Integer num;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论