提交 2e7d8862 authored 作者: 133's avatar 133

1

上级 d759eb9d
......@@ -50,6 +50,22 @@ public enum StatusEnum {
CHECK_DETAIL_3(123, "等待核查员B处理"),
/**
* 清退任务
*/
//以下为stat状态
SEND_BACK_1200(1200, "省清退查看"),
SEND_BACK_1201(1201, "统计数据等待办结"),
SEND_BACK_1202(1202, "待审核"),
SEND_BACK_1203(1203, "出库待校验"),
SEND_BACK_1204(1204, "入库待审核"),
SEND_BACK_1205(1205, "装备入库发起成功等待审核"),
// SEND_BACK_1204(1204, "入库待审核"),
/**
* 业务完结
*/
......@@ -76,6 +92,8 @@ public enum StatusEnum {
TRAIN1009(1009,"成绩确认"),
//
TRAIN1010(1010,"待培训"),
WORKHANDOVER1011(1011,"待上传签字单"),
//
// TRAIN1011(1011,""),
//
......
package com.tykj.dev.device.sendback.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.sendback.entity.domain.SendBackBillDetail;
import com.tykj.dev.device.sendback.entity.vo.SendBackOutFormVo;
import com.tykj.dev.device.sendback.entity.vo.SendBackOutVo;
import com.tykj.dev.device.sendback.entity.vo.SendBackRequst;
import com.tykj.dev.device.sendback.entity.vo.SendBackVo;
import com.tykj.dev.device.sendback.service.SendBackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* <h4>Description : </h4>
*
* @Author czq
* @Date 2020-08-18 10:39
* @Version 1.0
*/
@RestController
@Api(tags = "装备清退",description = "包括装备清退、装备异常处理、装备出库、装备入库")
@AutoDocument
@RequestMapping("/sendBack")
public class SendBackController {
private final SendBackService sendBackService;
@Autowired
public SendBackController(SendBackService sendBackService) {
this.sendBackService = sendBackService;
}
@ApiOperation(value = "选择装备,返回清退单",notes = "根据待清退装备的id集合查看清退单")
@PostMapping("/addDeviceToSendBack")
public ResponseEntity addDeviceToSendBack(@RequestBody SendBackRequst sendBackRequst){
return sendBackService.addDeviceToSendBack(sendBackRequst.getDeviceIdList(),sendBackRequst.getType());
}
@ApiOperation(value = "确定清退装备,生成Task",notes = "点击确定,生成清退单")
@PostMapping("/addSendBackTask/{userId}")
ResponseEntity addSendBackTask(@RequestBody SendBackVo sendBackVo, @PathVariable("userId") Integer userId){
return sendBackService.addSendBackTask(sendBackVo,userId);
}
@ApiOperation(value = "点击查看Task",notes = "查看清退相关的task都在这里")
@GetMapping("/getSendBackByTask/{taskId}")
ResponseEntity getSendBackByTask(@PathVariable("taskId") Integer taskId){
return sendBackService.getSendBackByTask(taskId);
}
@ApiOperation(value = "异常装备提交",notes = "上报需要上报异常的装备")
@PostMapping("/exceptionTask/{taskId}/{userId}")
ResponseEntity exceptionTask(@RequestBody SendBackRequst sendBackRequst,@PathVariable("taskId") Integer taskId,@PathVariable("userId") Integer userId){
return sendBackService.exceptionTask(sendBackRequst,taskId,userId);
}
@ApiOperation(value = "处理异常,修改装备的所属单位",notes = "处理异常,修改装备的所属单位")
@PostMapping("/endException/{userId}/{taskId}")
ResponseEntity endException(@PathVariable("userId") Integer userId,@PathVariable("taskId") Integer taskId){
return sendBackService.endException(taskId,userId);
}
@ApiOperation(value = "清退装备校对发起——专管员A",notes = "清退装备校对发起——专管员A")
@PostMapping("/sendBackOutCheck/{userId}/{taskId}")
ResponseEntity sendBackOutCheck(@PathVariable("taskId") Integer taskId,@PathVariable("userId") Integer userId){
return sendBackService.sendBackOutCheck(taskId,userId);
}
@ApiOperation(value = "装备出库发起——专管员A",notes = "装备出库发起——专管员A")
@PostMapping("/sendBackOut/{taskId}/{userId}")
ResponseEntity sendBackOut(@PathVariable("taskId") Integer taskId, @RequestBody SendBackOutVo sendBackOut, @PathVariable("userId") Integer userId){
return sendBackService.sendBackOut(taskId,sendBackOut,userId);
}
/**
*装备出库审核——专管员B
* @return 成,
*/
@ApiOperation(value = "装备出库审核——专管员B",notes = "装备出库审核——专管员B")
@GetMapping("/sendBackOutExamine/{taskId}/{userId}/{type}")
ResponseEntity sendBackOutExamine(@PathVariable("taskId") Integer taskId,@PathVariable("userId") Integer userId,@PathVariable("type") Integer type){
return sendBackService.sendBackOutExamine(taskId,userId,type);
}
/**
* 入库-专管员B
* 1、通过,完结task
* 2、修改装备的所属地
* @return 成功
*/
@ApiOperation(value = "入库-专管员B",notes = "入库-专管员B")
@GetMapping("/sendBackIn/{taskId}/{userId}/{type}")
ResponseEntity sendBackIn(@PathVariable("taskId") Integer taskId,@PathVariable("userId") Integer userId,@PathVariable("type")Integer type){
return sendBackService.sendBackIn(taskId,userId,type);
}
@ApiOperation(value = "业务详情")
@GetMapping("/bussiness/{taskId}")
public ResponseEntity bussiness(@PathVariable("taskId") Integer task){
return sendBackService.bussiness(task);
}
@ApiOperation(value = "查询清退单列表")
@PostMapping("/getList")
public ResponseEntity getList(@RequestBody SendBackOutFormVo sendBackOutFormVo){
return sendBackService.getList(sendBackOutFormVo);
}
@ApiModelProperty(value = "查看某个型号的装备")
@PostMapping("/getDeviceByModel")
public ResponseEntity getDeviceByModel(@RequestBody SendBackRequst sendBackRequst){
return sendBackService.getDeviceByModel(sendBackRequst.getDeviceIdList());
}
@ApiOperation(value = "造数据用")
@PostMapping("/save")
public ResponseEntity save(@RequestBody SendBackBillDetail sendBackBillDetailEntity){
return sendBackService.save(sendBackBillDetailEntity);
}
@ApiOperation(value = "保存入库单")
@PostMapping("/saveBill")
public ResponseEntity saveSendBackBillDetailEntity(@RequestBody SendBackBillDetail sendBackBillDetailEntity){
return sendBackService.saveSendBackBillDetailEntity(sendBackBillDetailEntity);
}
@ApiOperation(value = "清退办结")
@GetMapping("/end/{taskId}")
public ResponseEntity endTask(@PathVariable("taskId") Integer taskId){
return sendBackService.endTask(taskId);
}
@ApiOperation(value = "入库申请")
@PostMapping("/sendBackInCheck/{taskId}/{userId}")
public ResponseEntity sendBackInCheck(@PathVariable("taskId") Integer taskId,@RequestBody SendBackOutVo sendBackOut,@PathVariable("userId") Integer userId) {
return sendBackService.sendBackInCheck(taskId,sendBackOut,userId);
}
}
package com.tykj.dev.device.sendback.subject.domin;
package com.tykj.dev.device.sendback.entity.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tykj.dev.device.sendback.subject.domin;
package com.tykj.dev.device.sendback.entity.domain;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import io.swagger.annotations.ApiModel;
......@@ -33,150 +33,179 @@ public class SendBackBillDetail {
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id",columnDefinition = "not null int(11) 主键id")
@ApiModelProperty(name = "主键id")
private Integer id;
/**
* 申请文号
*/
@Column(name = "apply_number",columnDefinition = "not null varchar(255) 申请文号")
@ApiModelProperty(value = "申请文号")
private String applyNumber;
/**
* 批复文号
*/
@Column(name = "replay_number",columnDefinition = "not null varchar(255) 批复文号")
@ApiModelProperty(value = "批复文号")
private String replayNumber;
/**
* 发件单位
*/
@Column(name = "send_unit",columnDefinition = "not null varchar(32) 发件单位")
@ApiModelProperty(value = "发件单位")
private String sendUnit;
/**
* 收件单位
*/
@Column(name = "receive_unit",columnDefinition = "not null varchar(32) 收件单位")
@ApiModelProperty(value = "收件单位")
private String receiveUnit;
/**
* 配发时间
*/
@Column(name = "send_time",columnDefinition = "not null datetime 配发时间")
@ApiModelProperty(value = "配发时间")
private Date sendTime;
/**
* 接收时间
*/
@Column(name = "receive_time",columnDefinition = "null datetime 接收时间")
@ApiModelProperty(value = "接收时间")
private Date receiveTime;
/**
* 发件方id(A岗位)
*/
@Column(name = "send_userA_id",columnDefinition = "not null int(11) 发件方id(A岗位)")
@ApiModelProperty(value = "发件方id(A岗位)")
private Integer sendUseraId;
private Integer sendUserAId;
/**
* 发件方id(B岗位)
*/
@Column(name = "send_userB_id",columnDefinition = "not null int(11) 发件方id(B岗位)")
@ApiModelProperty(value = "发件方id(B岗位)")
private Integer sendUserbId;
private Integer sendUserBId;
/**
* 收件方id(A岗位)
*/
@Column(name = "receive_userA_id",columnDefinition = "not null int(11) 收件方id(A岗位)")
@ApiModelProperty(value = "收件方id(A岗位)")
private Integer receiveUseraId;
private Integer receiveUserAId;
/**
* 收件方id(B岗位)
*/
@Column(name = "receive_userB_id",columnDefinition = "null int(11) 收件方id(B岗位)")
@ApiModelProperty(value = "收件方id(B岗位)")
private Integer receiveUserbId;
private Integer receiveUserBId;
/**
* 出库附件文件名
*/
@Column(name = "file_name",columnDefinition = "not null varchar(32) 出库附件文件名")
@ApiModelProperty(value = "出库附件文件名")
private String fileName;
/**
* 出库附件文件地址URL
*/
@Column(name = "file_url",columnDefinition = "not null varchar(255) 出库附件文件地址URL")
@ApiModelProperty(value = "出库附件文件地址URL")
private String fileUrl;
/**
* 账单文件名
*/
@Column(name = "bill_file_name",columnDefinition = "null varchar(32) 账单文件名")
@ApiModelProperty(value = "账单文件名")
private String billFileName;
/**
* 账单文件地址URL
*/
@Column(name = "bill_file_url",columnDefinition = "null varchar(255) 账单文件地址URL")
@ApiModelProperty(value = "账单文件地址URL")
private String billFileUrl;
/**
* 退回状态(1:退回待审核,2:退回审核失败,3:退回中,4:退回接收待审核,5:退回接收审核失败,6:退回成功)
*/
@Column(name = "send_back_status",columnDefinition = "not null int(11) 退回状态(1:退回待审核,2:退回审核失败,3:退回中,4:退回接收待审核,5:退回接收审核失败,6:退回成功)")
@ApiModelProperty(value = "退回状态(1:退回待审核,2:退回审核失败,3:退回中,4:退回接收待审核,5:退回接收审核失败,6:退回成功)")
private Integer sendBackStatus;
/**
* 退回装备数量
*/
@Column(name = "send_back_count",columnDefinition = "not null int(11) 退回装备数量")
@ApiModelProperty(value = "退回装备数量")
private Integer sendBackCount;
/**
* 已出库装备数量
*/
@Column(name = "sended_count",columnDefinition = "not null int(11) 已出库装备数量")
@ApiModelProperty(value = "已出库装备数量")
private Integer sendedCount;
/**
* 已接收装备数量
*/
@Column(name = "receive_count",columnDefinition = "null int(11) 已接收装备数量")
@ApiModelProperty(value = "已接收装备数量")
private Integer receiveCount;
/**
* 出库检查详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配
*/
@Column(name = "send_check_detail",columnDefinition = "not null text 出库检查详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配")
@ApiModelProperty(value = "出库检查详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配")
private String sendCheckDetail;
/**
* 出库检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条
*/
@Column(name = "send_check_result",columnDefinition = "not null varchar(32) 出库检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条")
@ApiModelProperty(value = "出库检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条")
private String sendCheckResult;
/**
* 接收方入库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配
*/
@Column(name = "receive_check_detail",columnDefinition = "null text 接收方入库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配")
@ApiModelProperty(value = "接收方入库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如x10x21x32x,意为主键id为1的装备缺失,为2的无误,为3的不匹配")
private String receiveCheckDetail;
/**
* 接收方检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条
*/
@Column(name = "receive_check_result",columnDefinition = "null varchar(32) 接收方检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条")
@ApiModelProperty(value = "接收方检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条")
private String receiveCheckResult;
/**
* Ǵ作为分隔符,维修装备的主键id加备注,例如x1Ǵ备注1Ǵx2Ǵ备注2Ǵx,意为id为1的装备在维修,备注为备注1,id为2的装备在维修,备注为备注2
*/
@Column(name = "repair_device_detail",columnDefinition = "null text Ǵ作为分隔符,维修装备的主键id加备注,例如x1Ǵ备注1Ǵx2Ǵ备注2Ǵx,意为id为1的装备在维修,备注为备注1,id为2的装备在维修,备注为备注2")
@ApiModelProperty(value = "Ǵ作为分隔符,维修装备的主键id加备注,例如x1Ǵ备注1Ǵx2Ǵ备注2Ǵx,意为id为1的装备在维修,备注为备注1,id为2的装备在维修,备注为备注2")
private String repairDeviceDetail;
/**
* 创建用户id
*/
@CreatedBy
@Column(name = "create_user_id",columnDefinition = "not null int(11) 创建用户id")
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
/**
* 创建时间
*/
@CreatedDate
@Column(name = "create_time",columnDefinition = "not null datetime 创建时间")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新用户id
*/
@LastModifiedBy
@Column(name = "update_user_id",columnDefinition = "not null int(11) 更新用户id")
@ApiModelProperty(value = "更新用户id")
private Integer updateUserId;
/**
* 更新时间
*/
@LastModifiedDate
@Column(name = "update_time",columnDefinition = "not null datetime 更新时间")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 删除标记(0:未删除,1:已删除)
*/
@Column(name = "delete_tag",columnDefinition = "not null int(11) 删除标记(0:未删除,1:已删除)")
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag;
......@@ -186,16 +215,16 @@ public class SendBackBillDetail {
@ApiModelProperty(value = "发件方名称(A岗位)")
private String sendUseraName;
private String sendUserAName;
@ApiModelProperty(value = "发件方名称(B岗位)")
private String sendUserbName;
private String sendUserBName;
@ApiModelProperty(value = "收件方名称(A岗位)")
private String receiveUseraName;
private String receiveUserAName;
@ApiModelProperty(value = "收件方名称(B岗位)")
private String receiveUserbName;
private String receiveUserBName;
@ApiModelProperty(value = "装备id")
private String deviceIds;
......@@ -207,4 +236,10 @@ public class SendBackBillDetail {
@ApiModelProperty(value = "装备List")
private List<DeviceLibrary> deviceLibraryEntities;
@ApiModelProperty(value = "不知道是什么的号码")
private String num;
@ApiModelProperty(value = "截至日期")
private Date time;
}
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.device.sendback.entity.domain.SendBackBillDetail;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
/**
* <h4>Description : </h4>
*
* @Author czq
* @Date 2020-08-19 19:09
* @Version 1.0
*/
@Data
@AllArgsConstructor
@ApiModel("返回查询列表")
public class ListVo {
private long count;
private List<SendBackBillDetail> sendBackBillDetailEntities;
}
package com.tykj.dev.device.sendback.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
/**
* <h4>Description : </h4>
*
* @Author czq
* @Date 2020-08-17 17:26
* @Version 1.0
*/
@Data
@ApiModel("清退出库表单")
public class SendBackOutFormVo {
/**
* 申请文号
*/
@Column(name = "apply_number",columnDefinition = "not null varchar(255) 申请文号")
@ApiModelProperty(value = "申请文号")
private String applyNumber;
/**
* 批复文号
*/
@Column(name = "replay_number",columnDefinition = "not null varchar(255) 批复文号")
@ApiModelProperty(value = "批复文号")
private String replayNumber;
/**
* 发件单位
*/
@Column(name = "send_unit",columnDefinition = "not null varchar(32) 发件单位")
@ApiModelProperty(value = "发件单位")
private String sendUnit;
/**
* 收件单位
*/
@Column(name = "receive_unit",columnDefinition = "not null varchar(32) 收件单位")
@ApiModelProperty(value = "收件单位")
private String receiveUnit;
/**
* 配发时间
*/
@Column(name = "send_time",columnDefinition = "not null datetime 配发时间")
@ApiModelProperty(value = "配发时间")
private Date sendTime;
/**
* 接收时间
*/
@Column(name = "receive_time",columnDefinition = "null datetime 接收时间")
@ApiModelProperty(value = "接收时间")
private Date receiveTime;
/**
* 发件方id(A岗位)
*/
@Column(name = "send_userA_id",columnDefinition = "not null int(11) 发件方id(A岗位)")
@ApiModelProperty(value = "发件方id(A岗位)")
private String sendUserAName;
/**
* 发件方id(B岗位)
*/
@Column(name = "send_userB_id",columnDefinition = "not null int(11) 发件方id(B岗位)")
@ApiModelProperty(value = "发件方id(B岗位)")
private String sendUserBName;
/**
* 收件方id(A岗位)
*/
@Column(name = "receive_userA_id",columnDefinition = "not null int(11) 收件方id(A岗位)")
@ApiModelProperty(value = "收件方id(A岗位)")
private String receiveUserAName;
/**
* 收件方id(B岗位)
*/
@Column(name = "receive_userB_id",columnDefinition = "null int(11) 收件方id(B岗位)")
@ApiModelProperty(value = "收件方id(B岗位)")
private String receiveUserBName;
private Date startTime;
private Date endTime;
private Integer page;
private Integer size;
}
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* <h4>Description : 清退装备出库</h4>
*
* @Author czq
* @Date 2020-08-17 14:38
* @Version 1.0
*/
@Data
@ApiModel("清退装备出库")
public class SendBackOutVo {
@ApiModelProperty(value = "经办人")
private String name;
@ApiModelProperty(value = "经办人id")
private Integer id;
@ApiModelProperty(value = "截止时间")
private Date time;
@ApiModelProperty(value = "应出库")
private Integer shouldOut;
@ApiModelProperty(value = "实出库")
private Integer actualOut;
@ApiModelProperty(value = "出库确认单")
private String url;
@ApiModelProperty(value = "文件名")
private String fileName;
@ApiModelProperty(value = "审核人姓名")
private String reviewerName;
@ApiModelProperty(value = "审核人id")
private Integer reviewerNameId;
@ApiModelProperty(value = "发起人")
private String startUserIdName;
@ApiModelProperty(value = "出库装备清单")
private List<DeviceLibrary> deviceLibraryEntities;
//
// @ApiModelProperty(value = "非在库装备")
// private List<DeviceLibraryEntity> unDeviceLibraryEntities;
//
// @ApiModelProperty(value = "非在库装备备注")
// private HashMap<Integer,String> unDeviceDes;
@ApiModelProperty(value = "出库装备审核结果")
private HashMap<Integer,Integer> DeviceDes;
@ApiModelProperty(value = "清退单url")
private String returnNoteUrl;
@ApiModelProperty(value = "清退单name")
private String returnNoteName;
}
package com.tykj.dev.device.sendback.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.HashMap;
import java.util.List;
/**
* <h4>Description : </h4>
*
* @Author czq
* @Date 2020-08-18 12:19
* @Version 1.0
*/
@Data
@ApiModel("用于数据接收")
public class SendBackRequst {
@ApiModelProperty(value = "装备数组")
private List<Integer> deviceIdList;
@ApiModelProperty(value = "父task的Id")
private Integer parentTaskId;
@ApiModelProperty(value = "为在库装备备注")
private HashMap<Integer,UnDeviceDesVo> unDeviceDes;
@ApiModelProperty(value = "查询类型,0:省级 1:市级 2:区县级")
private Integer type;
}
package com.tykj.dev.device.sendback.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* <h4>Description : 待清退装备统计清单</h4>
*
* @Author czq
* @Date 2020-08-15 17:13
* @Version 1.0
*/
@Data
@ApiModel("待清退装备统计清单")
public class SendBackStatisticalVo {
@ApiModelProperty(value = "装备名称",example = "xxx装备")
public String name;
@ApiModelProperty(value = "统计总数",example = "200")
public Integer count = 0;
@ApiModelProperty(value = "装备id集合",example = "[1,2,3]")
private List<Integer> deviceIdList = new ArrayList<>();
@ApiModelProperty(value = "型号",example = "BM-001")
private String model;
@ApiModelProperty(value = "统计省或各市待清退统计单的数量,key为各市或各单位名称")
private HashMap<String,StatisticalVo> statistical = new HashMap<>();
}
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* <h4>Description : </h4>
*
* @Author czq
* @Date 2020-08-16 11:13
* @Version 1.0
*/
@Data
@ApiModel("清退表的表头、截至日期和经办人")
public class SendBackVo {
@ApiModelProperty(value = "经办人姓名")
private String name;
@ApiModelProperty(value = "截至日期")
private Date time;
@ApiModelProperty(value = "是否可以办结")
private Integer status;
@ApiModelProperty(value = "清退单的表头")
private List<String> header;
@ApiModelProperty(value = "清退表单内容,key为型号,value为表单内容")
private HashMap<String,HashMap<String,StatisticalVo>> map;
@ApiModelProperty(value = "所有清退装备的id")
private List<Integer> deviceIdList;
// @ApiModelProperty(value = "用于前端取值")
// private List<SendBackStatisticalVo> sendBackStatisticalVo;
//
// @ApiModelProperty(value = "将清退装备的id根据市或县分类,key为市名或县名,value该市或该县的idStrong")
// private HashMap<String,StringBuffer> cityClassify;
//
@ApiModelProperty(value = "异常装备")
private List<DeviceLibrary> unDevice;
@ApiModelProperty(value = "异常装备描述")
private List<UnDeviceDesVo> unDeviceDes;
@ApiModelProperty(value = "区域和任务id")
private HashMap<String,Integer> areaToTaskId;
@ApiModelProperty(value = "前段取值")
private List<HashMap<String,StatisticalVo>> dataList;
@ApiModelProperty(value = "查看某个区域")
private HashMap<String,List<Integer>> areaToIds;
@ApiModelProperty(value = "查看某个模板")
private HashMap<String,List<Integer>> modelToIds;
}
package com.tykj.dev.device.sendback.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* <h4>Description : 统计省或各市待清退统计单的数量</h4>
*
* @Author czq
* @Date 2020-08-15 17:26
* @Version 1.0
*/
@Data
@ApiModel("统计省或各市待清退统计单的数量")
public class StatisticalVo {
@ApiModelProperty(value = "装备名称")
private String name = "";
@ApiModelProperty(value = "所有装备的数量",example = "20")
private Integer allCount = 0;
@ApiModelProperty(value = "已清退装备的数量",example = "10")
private Integer valCount = 0;
@ApiModelProperty(value = "状态",example = "1")
private Integer status = 3;
@ApiModelProperty(value = "各市或各单位的id集合",example = "[1,2,3]")
private List<Integer> deviceIdList = new ArrayList<>();
public Integer status(Integer status){
/*
判断是否可办结
*/
int allStatus = 0;
if(allCount != 0 && valCount == 0){
/*
清退完成
*/
this.status = 3;
return 0;
}else if(allCount != 0){
/*
清退未完成
*/
this.status = status;
allStatus = 1;
}
return allStatus;
}
}
package com.tykj.dev.device.sendback.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* <h4>Description : </h4>
*
* @Author czq
* @Date 2020-08-19 14:41
* @Version 1.0
*/
@Data
@ApiModel("未在库装备说明")
public class UnDeviceDesVo {
@ApiModelProperty(value = "时间")
private Date time;
@ApiModelProperty(value = "用户名称")
private String name;
@ApiModelProperty(value = "单位名称")
private String unitName;
@ApiModelProperty(value = "备注")
private String des;
}
package com.tykj.dev.device.sendback.repository;
import com.tykj.dev.device.sendback.subject.domin.SendBackBill;
import com.tykj.dev.device.sendback.entity.domain.SendBackBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.tykj.dev.device.sendback.repository;
import com.tykj.dev.device.sendback.subject.domin.SendBackBillDetail;
import com.tykj.dev.device.sendback.entity.domain.SendBackBillDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.tykj.dev.device.sendback.response;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Description : file-server
* Date : 2018/1/9 16:04
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FileServerResponse<T> {
/**
* 错误码
*/
private Integer code;
/**
* 提示信息
*/
@JSONField(ordinal = 2)
private String msg;
/**
* 具体的内容
*/
@JSONField(ordinal = 3)
private T data;
}
package com.tykj.dev.device.sendback.response;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* <p>Description : 异常结果枚举类,用于统一异常状态码与相关描述信息
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
* @Date : 2017/12/13 0:51
*/
@AllArgsConstructor
@Getter
public enum ResponseCode {
/**
* 服务器成功返回用户请求的数据
*/
OK(200, "[GET]:服务器成功返回用户请求的数据,返回资源对象"),
/**
* 用户新建或修改数据成功
*/
CREATED(201, "[POST/PUT/PATCH]:用户新建或修改数据成功,返回新生成或修改的资源对象"),
/**
* 表示一个请求已经进入后台排队(异步任务)
*/
ACCEPTED(202, "[*]:表示一个请求已经进入后台排队(异步任务)"),
/**
* 用户上传文件成功
*/
UPLOADED(203, "[POST]文件上传成功"),
/**
* 用户删除数据成功
*/
NO_CONTENT(204, " [DELETE]:用户删除数据成功"),
/**
* 用户发出的请求有错误,服务器没有进行新建或修改数据的操作
*/
INVALID_REQUEST(400, "[POST/PUT/PATCH]:用户发出的请求有错误,服务器没有进行新建或修改数据的操作"),
/**
* 表示用户没有权限(令牌、用户名、密码错误)
*/
UNAUTHORIZED(401, " [*]:表示用户没有权限(令牌、用户名、密码错误)"),
/**
* 表示用户登录超时
*/
LOGINOUTTIME(402, " [*]:表示用户登录超时"),
/**
* 表示用户得到授权(与401错误相对),但是访问是被禁止的
*/
FORBIDDEN(403, " [*] 表示用户得到授权(与401错误相对),但是访问是被禁止的"),
/**
* 用户发出的请求针对的是不存在的记录,服务器没有进行操作,该操作是幂等的
*/
NOT_FOUND(404, " [*]:用户发出的请求针对的是不存在的记录,服务器没有进行操作"),
/**
* 非法参数,请求中附带的参数不符合要求规范
*/
ILLEGAL_PARAMETER(405, "[*]:非法参数,请求中附带的参数不符合要求规范"),
/**
* 用户请求的格式不可得(比如用户请求JSON格式,但是只有XML格式)
*/
NOT_ACCEPTABLE(406, " [GET]:用户请求的格式不可得(比如用户请求JSON格式,但是只有XML格式)"),
/**
* 用户的参数不得为空
*/
NOT_NULL_PARAMETER(408, "传递的参数不能为空"),
/**
* 用户请求的资源被永久删除,且不会再得到的
*/
GONE(413, "[GET]:用户请求的资源被永久删除,且不会再得到的"),
/**
* [PUT,PATCH,POST,DELETE]:操作没有成功,并没有数据发生变化
*/
NO_CHANGED(414, "[PUT,PATCH,POST,DELETE]:操作没有成功,并没有数据发生变化"),
/**
* 创建一个对象时,发生一个验证错误
*/
UNPROCESSABLE_ENTITY(422, "[POST/PUT/PATCH] 当创建一个对象时,发生一个验证错误"),
/**
* 服务器发生错误
*/
INTERNAL_SERVER_ERROR(500, "服务器发生错误");
/**
* 结果代码编号
*/
private Integer code;
/**
* 结果信息
*/
private String msg;
}
package com.tykj.dev.device.sendback.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Description : 文件服务器上传的返回数据类
* Date : 2018/1/9 16:16
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class fileDataStruct {
/**
* 原始文件名
*/
private String originalFileName;
/**
* 在服务器中的文件名
*/
private String serverFileName;
/**
* 服务器中的文件路径
*/
private String serverFilePath;
}
package com.tykj.dev.device.sendback.service;
import com.tykj.dev.device.sendback.entity.domain.SendBackBillDetail;
import com.tykj.dev.device.sendback.entity.vo.SendBackOutFormVo;
import com.tykj.dev.device.sendback.entity.vo.SendBackOutVo;
import com.tykj.dev.device.sendback.entity.vo.SendBackRequst;
import com.tykj.dev.device.sendback.entity.vo.SendBackVo;
import org.springframework.http.ResponseEntity;
import java.util.List;
/**
* <h4>Description : </h4>
*
* @Author czq
* @Date 2020-08-15 18:15
* @Version 1.0
*/
public interface SendBackService {
/**
* 选择装备,返回清退单
* @param deviceIdList 待清退装备的id集合
* @return 清退单
*/
ResponseEntity addDeviceToSendBack(List<Integer> deviceIdList, Integer type);
/**
* 确定清退装备,生成Task
* @param sendBackVo 待清退装备的表单
* @return 成功
*/
ResponseEntity addSendBackTask(SendBackVo sendBackVo, Integer startUserId);
/**
* 点击查看Task,返回请退单
* @return 清退单
*/
ResponseEntity getSendBackByTask(Integer taskId);
/**
* 异常提交
* @return 成功
*/
ResponseEntity exceptionTask(SendBackRequst sendBackRequst, Integer parentTaskId, Integer userId);
/**
* 处理异常,修改装备的所属单位
* @param taskId 上报异常的taskid
* @return 成功
*/
ResponseEntity endException(Integer taskId, Integer userId);
/**
* 清退装备校对发起——专管员A
* @param taskId 上级下发的清退装备的task
* @return 成功
*/
ResponseEntity sendBackOutCheck(Integer taskId, Integer userId);
/**
* 装备出库发起——专管员A
* @return 成功
*/
ResponseEntity sendBackOut(Integer taskId, SendBackOutVo sendBackOut, Integer userId);
/**
*装备出库审核——专管员B
* @return 成,
*/
ResponseEntity sendBackOutExamine(Integer taskId, Integer startUserId, Integer type);
/**
* 入库-专管员B
* 1、通过,完结task
* 2、修改装备的所属地
* @return 成功
*/
ResponseEntity sendBackIn(Integer taskIdy, Integer userId, Integer type);
/*
查看业务详情,只显示表格和异常装备
*/
ResponseEntity bussiness(Integer task);
/*
查询清退单
*/
ResponseEntity getList(SendBackOutFormVo sendBackOutFormVo);
/*
造数据用
*/
ResponseEntity save(SendBackBillDetail sendBackBillDetailEntity);
/*
查看此次清退的某个型号的装备
*/
ResponseEntity getDeviceByModel(List<Integer> deviceList);
ResponseEntity saveSendBackBillDetailEntity(SendBackBillDetail sendBackBillDetailEntity);
ResponseEntity sendBackInCheck(Integer taskId, SendBackOutVo sendBackOut, Integer userId);
/**
* 办结清退任务
* @param taskId 任务id
* @return 成功
*/
ResponseEntity endTask(Integer taskId);
}
package com.tykj.dev.device.sendback.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.LogVo;
import com.tykj.dev.device.sendback.entity.domain.SendBackBill;
import com.tykj.dev.device.sendback.entity.domain.SendBackBillDetail;
import com.tykj.dev.device.sendback.entity.vo.*;
import com.tykj.dev.device.sendback.repository.SendBackBillDao;
import com.tykj.dev.device.sendback.repository.SendBackBillDetailDao;
import com.tykj.dev.device.sendback.service.SendBackService;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.Area;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* <h4>Description : 装备清退</h4>
*
* @Author czq
* @Date 2020-08-15 18:15
* @Version 1.0
*/
@Service
public class SendBackServiceImpl implements SendBackService {
private final DeviceLibraryDao deviceLibraryDao;
private final SendBackBillDao sendBackBillEntityDao;
private final TaskDao taskDao;
private final UnitsDao unitsDao;
private final AreaDao areaDao;
private final TaskService taskService;
private final UserDao userDao;
private final SendBackBillDetailDao sendBackBillDetailEntityDao;
private final DeviceLogService deviceLogService;
@Autowired
public SendBackServiceImpl(TaskService taskService,DeviceLibraryDao deviceLibraryDao, SendBackBillDao sendBackBillEntityDao, TaskDao taskDao, UnitsDao unitsDao, AreaDao areaDao, UserDao userDao, UserDao userDao1, SendBackBillDetailDao sendBackBillDetailEntityDao, DeviceLogService deviceLogService) {
this.taskService=taskService;
this.deviceLibraryDao = deviceLibraryDao;
this.sendBackBillEntityDao = sendBackBillEntityDao;
this.taskDao = taskDao;
this.unitsDao = unitsDao;
this.areaDao = areaDao;
this.userDao = userDao1;
this.sendBackBillDetailEntityDao = sendBackBillDetailEntityDao;
this.deviceLogService = deviceLogService;
}
/**
* 添加设备
* @param deviceIdList 待清退装备的id集合
* @return 清退单
*/
@Override
public ResponseEntity addDeviceToSendBack(List<Integer> deviceIdList, Integer type) {
if(type == 2){
return ResponseEntity.ok(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(deviceIdList));
}else {
SendBackVo newSend = newStatistical(deviceIdList, type, null, true);
List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>(newSend.getMap().values());
newSend.setDataList(dataList);
return ResponseEntity.ok(newSend);
}
}
/**
* 确定待审核清退单
* @param sendBackVo 待清退装备的表单
* @param startUserId 操作用户id
* @return 成功
*/
@Transactional
@Override
public ResponseEntity addSendBackTask(SendBackVo sendBackVo,Integer startUserId) {
/*
1、获取清退装备的idList
*/
List<Integer> deviceIdList = sendBackVo.getDeviceIdList();
/*
2、根据idList生成待清退装备的初始表单,浙江省的id
*/
SendBackVo sendBack = newStatistical(deviceIdList, 0,null,true);
sendBack.setName(sendBackVo.getName());
sendBack.setTime(sendBackVo.getTime());
sendBack.setDeviceIdList(null);
StringBuilder idString = new StringBuilder();
deviceIdList.forEach(id -> idString.append("x").append(id));
/*
添加省级任务和账单
*/
List<Area> area = areaDao.findByFatherId(null);
TaskBto taskBto = addTaskStatus(0, JSON.toJSONString(sendBack), idString.toString(),area.get(0).getId(),startUserId,sendBackVo.getTime());
/*
添加各单位的Task
*/
addTaskById(deviceIdList,taskBto.getId(),startUserId,sendBackVo.getTime(),sendBackVo.getName());
return ResponseEntity.ok(taskBto.getId());
}
/**
* 点击查看Task,返回请退单或出库单
* @return 清退单
*/
@Transactional
@Override
public ResponseEntity getSendBackByTask(Integer taskId) {
TaskBto taskBto = taskService.get(taskId);
/*
判断任务状态,5为进行中,返回列表或统计表,16位出库待审核,返回出库单
*/
Integer billStatus = taskBto.getBillStatus();
/*
获取账单信息
*/
SendBackBill billEntity = sendBackBillEntityDao.getOne(taskBto.getBillId());
List<Integer> idList = stringToList(billEntity.getInvoleDevice());
String send = billEntity.getSendBackStatistical();
if(billStatus == 5){
Units unit = unitsDao.getOne(taskBto.getOwnUnit());
HashMap<String,Integer> areaToTaskId = areaToTask(unit,taskBto);
/*
统计单
*/
if(send == null || send.equals("null")){
if(unit.getLevel() == 2){
SendBackVo sendBackVo = newStatistical(idList, 1, null, true);
TaskBto parentTask = taskService.get(taskBto.getParentTaskId());
SendBackBill parentBill = sendBackBillEntityDao.getOne(parentTask.getBillId());
SendBackVo parentVo = JSONObject.parseObject(parentBill.getSendBackStatistical(),SendBackVo.class);
sendBackVo.setName(parentVo.getName());
sendBackVo.setTime(parentVo.getTime());
billEntity.setSendBackStatistical(JSON.toJSONString(sendBackVo));
sendBackVo.setAreaToTaskId(areaToTaskId);
List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>(sendBackVo.getMap().values());
sendBackVo.setDataList(dataList);
return ResponseEntity.ok(sendBackVo);
}else {
return ResponseEntity.ok(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList));
}
}else {
SendBackVo sendBackVo = JSONObject.parseObject(send,SendBackVo.class);
SendBackVo newSend = newStatistical(idList, 1, sendBackVo, false);
newSend.setAreaToTaskId(areaToTaskId);
newSend.setTime(sendBackVo.getTime());
newSend.setName(sendBackVo.getName());
List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>(newSend.getMap().values());
newSend.setDataList(dataList);
return ResponseEntity.ok(newSend);
}
}else if(billStatus == 27 || billStatus == 18){
String sendBackOut = billEntity.getSendBackOut();
return ResponseEntity.ok(JSON.parseObject(sendBackOut,new TypeReference<SendBackOutVo>() {}));
}else if(billStatus == 10 || billStatus == 28 || billStatus == 19){
SendBackBillDetail one = sendBackBillDetailEntityDao.findSendBackBillDetailEntityById(billEntity.getFormId());
one.setDeviceLibraryEntities(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList));
SendBackVo sendBackVo = JSONObject.parseObject(send,SendBackVo.class);
one.setTime(sendBackVo.getTime());
SendBackOutVo sendBackOutVo = JSONObject.parseObject(billEntity.getSendBackOut(), SendBackOutVo.class);
one.setBillFileName(sendBackOutVo.getReturnNoteName());
one.setBillFileUrl(sendBackOutVo.getReturnNoteUrl());
return ResponseEntity.ok(one);
}
return ResponseEntity.ok("*****");
}
/**
* 异常提交
* @return 成功
*/
@Transactional
@Override
public ResponseEntity exceptionTask(SendBackRequst sendBackRequst, Integer parentTaskId, Integer userId) {
List<Integer> deviceIdList = sendBackRequst.getDeviceIdList();
HashMap<Integer, UnDeviceDesVo> unDeviceDes = sendBackRequst.getUnDeviceDes();
/*
将异常的装备根据所在进行分类,然后给所在地task
*/
List<DeviceLibrary> deviceLibraryEntitiesByIdIn = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(deviceIdList);
HashMap<String,List<Integer>> locationUnitList = new HashMap<>();
HashMap<String,List<UnDeviceDesVo>> desList = new HashMap<>();
for (DeviceLibrary DeviceLibrary : deviceLibraryEntitiesByIdIn) {
String locationUnit = DeviceLibrary.getLocationUnit();
List<Integer> ids = locationUnitList.get(locationUnit);
if(ids == null){
ids = new ArrayList<>();
}
ids.add(DeviceLibrary.getId());
locationUnitList.put(locationUnit,ids);
List<UnDeviceDesVo> unDeviceDesVos = desList.get(locationUnit);
if(unDeviceDesVos == null){
unDeviceDesVos = new ArrayList<>();
}
unDeviceDesVos.add(unDeviceDes.get(DeviceLibrary.getId()));
desList.put(locationUnit,unDeviceDesVos);
}
Set<String> locationKey = locationUnitList.keySet();
for (String location:locationKey) {
TaskBto taskSaveVo = new TaskBto();
/*
一个task,绑定一个账单,账单中存放装备ID
*/
SendBackBill sendBackBillEntity = new SendBackBill();
StringBuffer idString = new StringBuffer();
locationUnitList.get(location).forEach(id -> idString.append("x").append(id));
sendBackBillEntity.setInvoleDevice(idString.toString());
sendBackBillEntity.setExceptionDes(JSON.toJSONString(desList.get(location)));
sendBackBillEntity.setDeadLine(new Date());
sendBackBillEntity.setReviewUserId(0);
sendBackBillEntity.setTitle("装备异常报告");
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
/*
账单与task关联
*/
taskSaveVo.setTitle("装备异常报告");
taskSaveVo.setBillId(billEntity.getId());
/*
待审核
*/
taskSaveVo.setBillStatus(StatusEnum.SEND_BACK_1202.id);
taskSaveVo.setBusinessType(BusinessEnum.SEND_BACK_EXCEPTION.id);
/*
设置所属单位
*/
Units unit = unitsDao.findByName(location);
taskSaveVo.setOwnUnit(unit.getUnitId());
taskSaveVo.setParentTaskId(parentTaskId);
taskSaveVo.setNodeIdDetail("");
List<Integer> integerList=new ArrayList<>();
integerList.add(userId);
taskSaveVo.setInvolveUserIdList(integerList);
taskSaveVo.setCustomInfo("0");
/*
保存task
*/
taskService.start(taskSaveVo);
/*
生成一条代办的job,生成一条跟踪的job
*/
// addJob(task.getId(),task.getBillStatus(),userId,null,0,0);
}
TaskBto parentTask = taskService.get(parentTaskId);
SendBackBill billEntity = sendBackBillEntityDao.getOne(parentTask.getBillId());
billEntity.setExceptionDes(JSON.toJSONString(unDeviceDes.values()));
return ResponseEntity.ok("提交成功");
}
/**
* 点击"确认后",开始处理异常
* 1、将装备的所属单位改为处理人的所属单位
* @param
* @return 成功
*/
@Transactional
@Override
public ResponseEntity endException(Integer taskId,Integer userId) {
User user = userDao.getOne(userId);
Units units = unitsDao.getOne(user.getUnitsId());
TaskBto taskBto=taskService.get(taskId);
/*
获取该Task的账单
*/
Integer billId = taskBto.getBillId();
SendBackBill sendBackBill = sendBackBillEntityDao.getOne(billId);
/*
获取关联的设备id
*/
String involeDevice = sendBackBill.getInvoleDevice();
String[] idString = involeDevice.split("x");
List<Integer> idList = new ArrayList<>();
for (String id:idString) {
idList.add(Integer.parseInt(id));
}
/*
根据idList查询装备列表
*/
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
deviceList.forEach(devices -> devices.setOwnUnit(units.getName()));
/*
在parentTask的账单中移除id
*/
TaskBto parentTask = taskService.get(taskBto.getParentTaskId());
Integer parentTaskBillId = parentTask.getBillId();
SendBackBill parentTaskBill = sendBackBillEntityDao.getOne(parentTaskBillId);
parentTaskBill.setInvoleDevice(parentTaskBill.getInvoleDevice().replaceAll(involeDevice,""));
taskService.moveToEnd(taskBto);
/*
结束这个task
*/
// taskBto.setBillStatus(13);
// /*
// 结束job
// */
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(),1);
// job.setBillStatus(13);
//
// taskDao.save(taskEntity);
// addLog(taskEntity.getId(),idList,"装备异常处理","");
return ResponseEntity.ok("异常处理成功");
}
/**
* 清退装备出库校验
* @return 成功
*/
@Transactional
@Override
public ResponseEntity sendBackOutCheck(Integer taskId,Integer userId) {
TaskBto taskEntity = taskService.get(taskId);
/*
这里不用生成新的task,修改task状态即可,出库待校验的状态
*/
// taskEntity.setBillStatus(27);
/*
获取账单信息,根据账单的id,出库装备
*/
SendBackBill billEntity = sendBackBillEntityDao.getOne(taskEntity.getBillId());
List<String> idStringList = Arrays.asList(billEntity.getInvoleDevice().split("x"));
List<String> idListString = idStringList.stream().filter(list2->!list2.equals("")).collect(Collectors.toList());
System.out.println(idListString);
List<Integer> idList = idListString.stream().map(Integer::parseInt).collect(Collectors.toList());
/*
返回出库单
*/
SendBackOutVo sendBackOutVo = new SendBackOutVo();
sendBackOutVo.setTime(billEntity.getDeadLine());
/*
计算应出库和实出库,应出库为实出库加异常的数量(目前不管异常设备)
*/
sendBackOutVo.setActualOut(idList.size());
sendBackOutVo.setShouldOut(idList.size());
sendBackOutVo.setDeviceLibraryEntities(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList));
billEntity.setSendBackOut(JSON.toJSONString(sendBackOutVo));
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,userId);
/*
结束上一个job,生成新的job
*/
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,userId,0);
//
// /*
// 生成log
// */
// User user = userDao.getOne(userId);
// addLog(taskEntity.getId(),idList,user.getName()+"发起装备校验","");
return ResponseEntity.ok(sendBackOutVo);
}
/**
* 装备出库发起——专管员A
* @return 成功
*/
@Transactional
@Override
public ResponseEntity sendBackOut(Integer taskId,SendBackOutVo sendBackOut,Integer userId) {
/*
保存出库清单
*/
TaskBto taskEntity = taskService.get(taskId);
// taskEntity.setBillStatus(18);
SendBackBill bill = sendBackBillEntityDao.getOne(taskEntity.getBillId());
bill.setSendBackOut(JSON.toJSONString(sendBackOut));
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1204,sendBackOut.getReviewerNameId());
/*
新增job
*/
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,sendBackOut.getReviewerNameId(),0);
/*
生成日志
*/
// User user = userDao.getOne(userId);
// addLog(taskId,stringToList(bill.getInvoleDevice()),user.getName()+"发起申请,待"+sendBackOut.getReviewerName()+"审核","Ǒ"+sendBackOut.getUrl()+"Ǒ"+sendBackOut.getFileName());
return ResponseEntity.ok("装备出库发起成功等待审核");
}
/**
* 装备出库审核
* 1、修改task状态
* 2、生成清退单详情
* 3、生成入库的Task
* @return 成功
*/
@Transactional
@Override
public ResponseEntity sendBackOutExamine(Integer taskId,Integer userId,Integer type) {
TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.getOne(taskEntity.getOwnUnit());
Area area = areaDao.getOne(unit.getAreaId());
List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId());
taskService.moveToEnd(taskEntity);
// taskEntity.setBillStatus(13);
//
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1);
// System.out.println(job.getId());
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,userId,0);
/*
获取账单
*/
SendBackBill sendBackBill = sendBackBillEntityDao.getOne(taskEntity.getBillId());
SendBackOutVo sendBackOutVo = JSON.parseObject(sendBackBill.getSendBackOut(), new TypeReference<SendBackOutVo>() {
});
/*
生成清退的表格
*/
SendBackBillDetail sendBackBillDetailEntity = new SendBackBillDetail();
sendBackBillDetailEntity.setSendUnit(unit.getName());
sendBackBillDetailEntity.setSendUserAName(sendBackOutVo.getName());
sendBackBillDetailEntity.setSendUserAId(sendBackOutVo.getId());
sendBackBillDetailEntity.setSendUserBName(sendBackOutVo.getReviewerName());
sendBackBillDetailEntity.setSendUserBId(sendBackOutVo.getReviewerNameId());
sendBackBillDetailEntity.setSendTime(new Date());
sendBackBillDetailEntity.setSendedCount(sendBackOutVo.getShouldOut());
sendBackBillDetailEntity.setSendBackCount(sendBackOutVo.getActualOut());
sendBackBillDetailEntity.setSendBackStatus(1);
sendBackBillDetailEntity.setFileName(sendBackOutVo.getFileName());
sendBackBillDetailEntity.setFileUrl(sendBackOutVo.getUrl());
sendBackBillDetailEntity.setDeleteTag(0);
sendBackBillDetailEntity.setApplyNumber("");
sendBackBillDetailEntity.setReplayNumber("");
sendBackBillDetailEntity.setReceiveUnit(fatherUnit.get(0).getName());
sendBackBillDetailEntity.setReceiveUserAId(0);
sendBackBillDetailEntity.setSendCheckDetail("");
sendBackBillDetailEntity.setSendCheckResult("");
sendBackBillDetailEntity.setNum("第"+new Date().getYear()+"QT"+taskEntity.getBillId()+"号");
SendBackBillDetail backBillDetailEntity = sendBackBillDetailEntityDao.save(sendBackBillDetailEntity);
sendBackBill.setFormId(backBillDetailEntity.getId());
User user = userDao.getOne(userId);
List<Integer> ids = stringToList(sendBackBill.getInvoleDevice());
// addLog(taskId,ids,user.getName()+"通过审核,装备出库","");
/*
生成新的Task
*/
TaskBto taskSaveVo = new TaskBto();
/*
账单与task关联18
*/
taskSaveVo.setTitle("装备入库申请");
taskSaveVo.setBillId(taskEntity.getBillId());
taskSaveVo.setBillStatus(28);
taskSaveVo.setParentTaskId(taskEntity.getId());
taskSaveVo.setBillStatus(StatusEnum.SEND_BACK_1204.id);
taskSaveVo.setOwnUnit(fatherUnit.get(0).getUnitId());
List<Integer> integerList=new ArrayList<>();
integerList.add(userId);
taskSaveVo.setInvolveUserIdList(integerList);
taskSaveVo.setCustomInfo("0");
taskSaveVo.setNodeIdDetail("");
/*
保存task
*/
taskService.start(taskEntity);
// TaskEntity task = taskDao.save(taskSaveVo.toDo());
// addJob(task.getId(),task.getBillStatus(),userId,null,0,0);
// addLog(task.getId(),ids,user.getName()+"发起入库申请","");
return ResponseEntity.ok("装配入库申请发送成功");
}
/**
* 入库-专管员B
* 1、通过,完结task
* 2、修改装备的所属地
* 3、通知fatherTask,清退完成
* @return 成功
*/
@Transactional
@Override
public ResponseEntity sendBackIn(Integer taskId,Integer userId,Integer type) {
TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.getOne(taskEntity.getOwnUnit());
/*
已完结
*/
// taskEntity.setBillStatus(13);
taskService.moveToEnd(taskEntity);
/*
结束job
*/
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,userId,1);
/*
结束上级task和job
*/
TaskBto parentTask = taskService.get(taskEntity.getParentTaskId());
// parentTask.setBillStatus(13);
// JobEntity parentJob = jobDao.findByTaskIdAndIsDone(taskEntity.getParentTaskId(), 0);
// parentJob.setIsDone(1);
// addJob(parentTask.getId(),parentTask.getBillStatus(),userId,job,parentJob.getBelongUserId(),1);
//
//
// taskDao.save(taskEntity);
taskService.moveToEnd(parentTask);
/*
修改装备是所属单位
*/
Integer billId = taskEntity.getBillId();
SendBackBill bill = sendBackBillEntityDao.getOne(billId);
List<Integer> idList = stringToList(bill.getInvoleDevice());
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
for (DeviceLibrary d:deviceList) {
d.setLocationUnit(unit.getName());
d.setOwnUnit(unit.getName());
d.setManageStatus(1);
}
/*
将入库结果反馈给下级,由于两个task使用的是同一个账单,所以数据已反馈
*/
return ResponseEntity.ok("装备已入库");
}
/**
* 业务详情
* @param taskId taskid
* @return 成功
*/
@Override
public ResponseEntity bussiness(Integer taskId) {
TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.getOne(taskEntity.getOwnUnit());
/*
区域对应的Task,方便点击进入下一级
*/
HashMap<String,Integer> areaToTaskId = areaToTask(unit,taskEntity);
/*
获取账单信息
*/
SendBackBill billEntity = sendBackBillEntityDao.getOne(taskEntity.getBillId());
List<Integer> idList = stringToList(billEntity.getInvoleDevice());
/*
统计单
*/
String send = billEntity.getSendBackStatistical();
if(send == null || send.equals("null") || send.equals("")){
if(unit.getLevel() == 2){
SendBackVo sendBackVo = newStatistical(idList, 1, null, true);
billEntity.setSendBackStatistical(JSON.toJSONString(sendBackVo));
sendBackVo.setUnDeviceDes(JSONObject.parseObject(billEntity.getExceptionDes(), new TypeReference<List<UnDeviceDesVo>>() {
}));
sendBackVo.setAreaToTaskId(areaToTaskId);
List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>(sendBackVo.getMap().values());
sendBackVo.setDataList(dataList);
return ResponseEntity.ok(sendBackVo);
}else {
return ResponseEntity.ok(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList));
}
}else {
int type = 1;
if(unit.getLevel() == 1){
type = 0;
}
SendBackVo sendBackVo = JSONObject.parseObject(send, new TypeReference<SendBackVo>() {
});
SendBackVo backVo = newStatistical(idList, type, sendBackVo, false);
backVo.setUnDeviceDes(JSONObject.parseObject(billEntity.getExceptionDes(), new TypeReference<List<UnDeviceDesVo>>() {
}));
List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>(backVo.getMap().values());
backVo.setDataList(dataList);
backVo.setAreaToTaskId(areaToTaskId);
backVo.setTime(sendBackVo.getTime());
backVo.setName(sendBackVo.getName());
return ResponseEntity.ok(backVo);
}
}
/**
* 业务详情列表查询
* @param sendBackOutFormVo 查询条件
* @return 数量和列表
*/
@Override
public ResponseEntity getList(SendBackOutFormVo sendBackOutFormVo) {
Specification<SendBackBillDetail> specification = Specifications.<SendBackBillDetail>and()
.eq(sendBackOutFormVo.getSendUnit() != null, "sendUnit", sendBackOutFormVo.getSendUnit())
.eq(sendBackOutFormVo.getReceiveUnit() != null, "receiveUnit", sendBackOutFormVo.getReceiveUnit())
.gt(sendBackOutFormVo.getStartTime() != null, "sendTime", sendBackOutFormVo.getStartTime())
.lt(sendBackOutFormVo.getEndTime() != null, "sendTime", sendBackOutFormVo.getEndTime())
.build();
Pageable pageable = PageRequest.of(sendBackOutFormVo.getPage() - 1, sendBackOutFormVo.getSize(), Sort.Direction.DESC, "id");
List<SendBackBillDetail> list = sendBackBillDetailEntityDao.findAll(specification, pageable).getContent();
for (SendBackBillDetail s:list) {
String deviceIds = s.getDeviceIds();
String[] idString = deviceIds.split("x");
List<String> idStringList = Arrays.asList(idString);
List<String> idListString = idStringList.stream().filter(list2->!list2.equals("")).collect(Collectors.toList());
System.out.println();
List<Integer> idList = idListString.stream().map(Integer::parseInt).collect(Collectors.toList());
s.setDeviceLibraryEntities(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList));
}
long count = sendBackBillDetailEntityDao.count(specification);
return ResponseEntity.ok(new ListVo(count,list));
}
/**
* 造数据用
* @param sendBackBillDetailEntity 保存的清退单
* @return null
*/
@Override
public ResponseEntity save(SendBackBillDetail sendBackBillDetailEntity) {
sendBackBillDetailEntityDao.save(sendBackBillDetailEntity);
return ResponseEntity.ok("完成");
}
/**
* 查看某个型号的装备
* @param deviceList 装备list
* @return 装备
*/
@Override
public ResponseEntity getDeviceByModel(List<Integer> deviceList) {
return ResponseEntity.ok(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(deviceList));
}
/**
* 保存入库单
* @param sendBackBillDetailEntity 清退单
* @return 成功
*/
@Override
public ResponseEntity saveSendBackBillDetailEntity(SendBackBillDetail sendBackBillDetailEntity) {
sendBackBillDetailEntityDao.save(sendBackBillDetailEntity);
return ResponseEntity.ok("清退单保存单");
}
@Transactional
@Override
public ResponseEntity sendBackInCheck(Integer taskId, SendBackOutVo sendBackOut, Integer userId) {
/*
保存出库清单
*/
TaskBto taskEntity = taskService.get(taskId);
// taskEntity.setBillStatus(19);
SendBackBill bill = sendBackBillEntityDao.getOne(taskEntity.getBillId());
bill.setSendBackOut(JSON.toJSONString(sendBackOut));
User user = userDao.getOne(userId);
SendBackBillDetail form = sendBackBillDetailEntityDao.getOne(bill.getFormId());
form.setReceiveUserAId(userId);
form.setReceiveUserAName(user.getName());
form.setBillFileUrl(sendBackOut.getReturnNoteUrl());
form.setBillFileName(sendBackOut.getReturnNoteName());
form.setReceiveUserBId(sendBackOut.getReviewerNameId());
form.setReceiveUserBName(sendBackOut.getReviewerName());
/*
task 推入 19
*/
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1205,sendBackOut.getReviewerNameId());
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,sendBackOut.getReviewerNameId(),0);
/*
生成日志
*/
// addLog(taskId,stringToList(bill.getInvoleDevice()),user.getName()+"发起装备入库申请,待"+sendBackOut.getReviewerName()+"审核","Ǒ"+sendBackOut.getUrl()+"Ǒ"+sendBackOut.getFileName());
return ResponseEntity.ok("装备入库发起成功等待审核");
}
/**
* 办结任务
* @param taskId 任务id
* @return 成功
*/
@Override
public ResponseEntity endTask(Integer taskId) {
TaskBto taskEntity = taskService.get(taskId);
taskService.moveToEnd(taskEntity);
// taskEntity.setBillStatus(13);
// SendBackBillEntity bill = sendBackBillEntityDao.getOne(taskEntity.getBillId());
// addLog(taskId,stringToList(bill.getInvoleDevice()),"清退成功","");
return ResponseEntity.ok("清退已办结");
}
/**
* 新建task
* @param sendBackVo 初始清退表单
* @param idString id集合
*/
private TaskBto addTask(int parentTaskId, String sendBackVo, String idString, Integer unitId, Integer startUserId, Date deadLine){
/*
一个task,绑定一个账单,账单中存放装备ID和初始化清退单
*/
SendBackBill sendBackBillEntity = new SendBackBill();
sendBackBillEntity.setSendBackStatistical(sendBackVo);
sendBackBillEntity.setInvoleDevice(idString);
sendBackBillEntity.setDeadLine(deadLine);
sendBackBillEntity.setReviewUserId(startUserId);
sendBackBillEntity.setTitle("清退账单");
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
/*
生成省级及以下的Task
*/
List<Integer> integers=new ArrayList<>();
integers.add(startUserId);
/*
保存省级的task
*/
// addJob(task.getId(),task.getBillStatus(),startUserId,null,0,0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1200.id,"装备清退",parentTaskId,".",billEntity.getId(), BusinessEnum.SEND_BACK.id,unitId,0,null,integers)).parse2Bto();
}
/**
* 新建task
* @param sendBackVo 初始清退表单
* @param idString id集合
*/
private TaskBto addTaskStatus(int parentTaskId, String sendBackVo, String idString, Integer unitId, Integer startUserId, Date deadLine){
/*
一个task,绑定一个账单,账单中存放装备ID和初始化清退单
*/
SendBackBill sendBackBillEntity = new SendBackBill();
sendBackBillEntity.setSendBackStatistical(sendBackVo);
sendBackBillEntity.setInvoleDevice(idString);
sendBackBillEntity.setDeadLine(deadLine);
sendBackBillEntity.setReviewUserId(startUserId);
sendBackBillEntity.setTitle("清退账单");
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
/*
生成省级及以下的Task
*/
List<Integer> integers=new ArrayList<>();
integers.add(startUserId);
integers.add(-1);
/*
保存省级的task
*/
// addJob(task.getId(),task.getBillStatus(),startUserId,null,0,0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1200.id,"装备清退",parentTaskId,".",billEntity.getId(), BusinessEnum.SEND_BACK.id,unitId,1,null,integers)).parse2Bto();
}
/**
* 添加一个job,结束上一个job
* @param taskId 任务id
* @param billStatus 任务状态
* @param involeUserId 用户id
*/
// private void addJob(Integer taskId,Integer billStatus,Integer involeUserId,JobEntity oldJob,Integer belongUserId,Integer isDone){
//
// /*
// 新增一个job
// */
// JobEntity jobEntity = new JobEntity();
// /*
// 结束上一个,继承参与人的字段
// */
// String involeUser = "";
// if(oldJob != null){
// involeUser = oldJob.getInvoleUserId();
// }
// if(!involeUser.contains("x" + involeUserId)){
// jobEntity.setInvoleUserId(involeUser+"x"+involeUserId);
// }else {
// jobEntity.setInvoleUserId(involeUser);
// }
// /*
// 任务id
// */
// jobEntity.setTaskId(taskId);
// /*
// 任务状态
// */
// jobEntity.setBillStatus(billStatus);
// /*
// 所属人id
// */
// jobEntity.setBelongUserId(belongUserId);
//
// /*
// job状态
// */
// jobEntity.setIsDone(isDone);
// jobDao.save(jobEntity);
//
// }
/**
* 按照需求返回单位和区域的映射关系
* @param type 0:单位-市和省 1:单位-区
* @return
*/
private HashMap<String,Area> unitToArea(Integer type){
/*
查询所有的区域
*/
HashMap<Integer,Area> areaHashMap = new HashMap<>();
areaDao.findAll().forEach(area -> areaHashMap.put(area.getId(),area));
/*
查询所有单位
*/
List<Units> units = unitsDao.findByIdDel(0);
/*
单位和区域的映射关系
*/
HashMap<String,Area> unitToArea = new HashMap<>();
for (Units unit:units) {
/*
根据等级判断单位的区域
*/
Integer level = unit.getLevel();
Area localArea = areaHashMap.get(unit.getAreaId());
if(type == 0 && level>2){
/*
单位与市的映射关系,区级设备需要找到上级区域;
*/
Area fatherArea = areaHashMap.get(localArea.getFatherId());
unitToArea.put(unit.getName(),fatherArea);
}else {
unitToArea.put(unit.getName(),localArea);
}
}
return unitToArea;
}
/**
* 统计表
*/
private SendBackVo newStatistical(List<Integer> idList,Integer type,SendBackVo sendBack,boolean first){
HashMap<String,HashMap<String,StatisticalVo>> list;
if(sendBack == null){
list = new HashMap<>();
}else {
list = sendBack.getMap();
}
/*
映射表 0:单位-市 1:单位-区县
String 单位名称 Area 区域对象
*/
HashMap<String, Area> unitToArea = unitToArea(type);
//根据所有装备id集合-获取装备集合
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
/*
未在库装备
*/
List<DeviceLibrary> unDevice = new ArrayList<>();
List<String> modelList = new ArrayList<>();
List<String> areaList = new ArrayList<>();
for (DeviceLibrary DeviceLibrary:deviceList) {
//装备信号型号
String model = DeviceLibrary.getModel();
if(!modelList.contains(model)){
modelList.add(model);
}
String areaName = unitToArea.get(DeviceLibrary.getOwnUnit()).getName();
if(!areaList.contains(areaName)){
areaList.add(areaName);
}
if(DeviceLibrary.getManageStatus() == 0){
unDevice.add(DeviceLibrary);
}
}
//类型-(区域,统计)
HashMap<String,HashMap<String,StatisticalVo>> newList = new HashMap<>();
//延迟状态
int delayStatus = 1;
if(sendBack == null){
/*
生成一张新的空表
*/
for (String model:modelList) {
HashMap<String,StatisticalVo> areaMap = new HashMap<>();
for ( String area:areaList) {
areaMap.put(area,new StatisticalVo());
}
areaMap.put("总数",new StatisticalVo());
newList.put(model,areaMap);
}
}else {
/*
初始化旧的表格
*/
HashMap<String, HashMap<String, StatisticalVo>> map = sendBack.getMap();
Collection<HashMap<String, StatisticalVo>> values = map.values();
values.forEach(value -> value.values().forEach(v -> v.setValCount(0)));
newList = map;
/*
判断是否延期
*/
if(new Date().getTime() > sendBack.getTime().getTime()){
delayStatus = 2;
}
}
/*
存放区域所对应的idList
*/
HashMap<String,List<Integer>> areaIdList = new HashMap<>();
/*
存放型号所对应的idList
*/
HashMap<String,List<Integer>> modelIdList = new HashMap<>();
/*
向表中填数据
*/
for (DeviceLibrary d : deviceList) {
String model = d.getModel();
String areaName = unitToArea.get(d.getOwnUnit()).getName();
/*
按型号归类
*/
List<Integer> modelIds = modelIdList.getOrDefault(model, new ArrayList<>());
modelIds.add(d.getId());
modelIdList.put(model,modelIds);
/*
按区域归类
*/
List<Integer> areaIds = areaIdList.getOrDefault(areaName, new ArrayList<>());
areaIds.add(d.getId());
areaIdList.put(areaName,areaIds);
StatisticalVo statisticalVo = newList.get(model).get(areaName);
statisticalVo.setValCount(statisticalVo.getValCount() + 1);
if(first){
statisticalVo.setAllCount(statisticalVo.getAllCount() + 1);
}else {
statisticalVo.setAllCount(list.get(model).get(areaName).getAllCount());
}
statisticalVo.getDeviceIdList().add(d.getId());
/*
存放总数和名字
*/
if(first){
StatisticalVo all = newList.get(model).getOrDefault("总数",new StatisticalVo());
all.setAllCount(all.getAllCount() + 1);
newList.get(model).put("总数",all);
StatisticalVo name = newList.get(model).getOrDefault("名称",new StatisticalVo());
name.setName(d.getName());
newList.get(model).put("名称",name);
StatisticalVo deviceModel = newList.get(model).getOrDefault("型号",new StatisticalVo());
deviceModel.setName(model);
newList.get(model).put("型号",deviceModel);
}
}
/*
返回的对象
*/
SendBackVo sendBackVo = new SendBackVo();
sendBackVo.setHeader(areaList);
sendBackVo.setDeviceIdList(idList);
sendBackVo.setUnDevice(unDevice);
sendBackVo.setAreaToIds(areaIdList);
sendBackVo.setModelToIds(modelIdList);
/*
计算状态 判断是否可以办结
*/
int allStatus = 0;
Set<String> strings = newList.keySet();
// List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>();
for (String s:strings) {
HashMap<String, StatisticalVo> stringStatisticalVoHashMap = newList.get(s);
List<StatisticalVo> statisticalVos = new ArrayList<>(stringStatisticalVoHashMap.values());
for (StatisticalVo statisticalVo:statisticalVos) {
Integer status = statisticalVo.status(delayStatus);
if(status == 1){
allStatus = 1;
}
}
// dataList.add(stringStatisticalVoHashMap);
}
sendBackVo.setStatus(allStatus);
sendBackVo.setMap(newList);
return sendBackVo;
}
/*
计算各单位的清退装备,市的清退装备包括市本级和下属单位
*/
private HashMap<Integer,StringBuffer> addTaskById(List<Integer> idList,Integer parentId,Integer userId,Date time,String name){
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
/*
单位名-市级的区域
*/
HashMap<String, Area> unitToArea = unitToArea(0);
/*
存放各单位需清退的装备id,用于生成task
*/
HashMap<Integer,StringBuffer> unitDeviceIds = new HashMap<>();
/*
存放各单位的装备集合
*/
HashMap<Integer,List<Integer>> unitDevices = new HashMap<>();
for (DeviceLibrary device:deviceList) {
Units unit = unitsDao.findByName(device.getOwnUnit());
Integer level = unit.getLevel();
/*
省级装备不参与分类
*/
if(level == 1){
List<Integer> deviceIds = unitDevices.getOrDefault(unit.getUnitId(), new ArrayList<>());
deviceIds.add(device.getId());
unitDevices.put(0,deviceIds);
continue;
}
List<Integer> deviceIds = unitDevices.getOrDefault(unit.getUnitId(), new ArrayList<>());
deviceIds.add(device.getId());
unitDevices.put(unit.getUnitId(),deviceIds);
/*
将装备加入所属的单位
*/
StringBuffer localIds = unitDeviceIds.getOrDefault(unit.getUnitId(),new StringBuffer());
localIds.append("x").append(device.getId());
unitDeviceIds.put(unit.getUnitId(),localIds);
/*
判断是否为区县级的单位,如果是区县级单位,需要将id也添加到所属市的单位
*/
if(level == 3){
/*
所属市
*/
Area parentArea = unitToArea.get(unit.getName());
Units parentUnit = unitsDao.findByAreaIdAndLevel(parentArea.getId(), 2);
/*
将装备加入上属的市
*/
StringBuffer parentIds = unitDeviceIds.getOrDefault(parentUnit.getUnitId(),new StringBuffer());
parentIds.append("x").append(device.getId());
unitDeviceIds.put(parentUnit.getUnitId(),parentIds);
}
}
Set<Integer> keySet = unitDeviceIds.keySet();
for (Integer key:keySet) {
StringBuffer ids = unitDeviceIds.get(key);
TaskBto taskBto = addTask(parentId, null, ids.toString(), key, userId, time);
// List<Integer> idToAddLog= unitDevices.get(key);
// addLog(task.getId(),idToAddLog,name + "发起装备清退","");
}
/*
添加省级装备的log
*/
// addLog(parentId,unitDevices.get(0),name + "发起装备清退","");
return unitDeviceIds;
}
/*
批量添加task
*/
private void addLog(Integer taskId,List<Integer> deviceList,String des,String files){
/*
* 相关附件信息(Ǵ作为每个附件分隔符,Ǒ作为附件内部分隔符,例如name1Ǒurl1Ǒ配发单Ǵname2Ǒurl2Ǒ入库确认单Ǵ)
*/
// deviceList.forEach(deviceId -> deviceLogService.addLog(new LogVo(deviceId,taskId,des,files,0)));
}
/*
x1x2x1 -> [1,2,3]
*/
private List<Integer> stringToList(String idString){
String[] ids = idString.split("x");
List<String> idStringList = Arrays.asList(ids);
List<String> idListString = idStringList.stream().filter(list2->!list2.equals("")).collect(Collectors.toList());
List<Integer> idList = idListString.stream().map(Integer::parseInt).collect(Collectors.toList());
return idList;
}
/*
区域名对应的任务id,方便进入下一级
*/
private HashMap<String,Integer> areaToTask(Units unit,TaskBto taskBto){
HashMap<String,Integer> areaToTaskId = new HashMap<>();
List<TaskBto> kidTask = new ArrayList<>();
if(unit.getLevel() == 1){
/*
省级的业务详情
*/
kidTask = taskDao.findTaskEntitiesByParentTaskId(taskBto.getId()).stream().map(Task::parse2Bto).collect(Collectors.toList());
}else if(unit.getLevel() == 2){
/*
市级的业务详情
*/
kidTask = taskDao.findTaskEntitiesByParentTaskId(taskBto.getParentTaskId()).stream().map(Task::parse2Bto).collect(Collectors.toList());
}
/*
区域名和任务id的映射,方便进入下一级
*/
for (TaskBto t:kidTask) {
Integer ownUnit = t.getOwnUnit();
Units units = unitsDao.getOne(ownUnit);
Area area = areaDao.getOne(units.getAreaId());
areaToTaskId.put(area.getName(),t.getId());
}
return areaToTaskId;
}
}
......@@ -34,5 +34,4 @@
<artifactId>dev-library</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -47,4 +47,7 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
@Query("select o.billId from Task o where o.parentTaskId = ?1 and o. businessType = ?2")
Integer findBillIdByParentId(int parentTaskId, int businessType);
List<Task> findTaskEntitiesByParentTaskId(Integer parentTaskId);
}
......@@ -2,7 +2,10 @@ package com.tykj.dev.device.train.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.train.entity.vo.HandoverVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverEndAddVo;
import com.tykj.dev.device.train.service.TrainThemeService;
import com.tykj.dev.device.train.service.WorkHandoverService;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.service.MgrcertService;
......@@ -29,11 +32,7 @@ import springfox.documentation.annotations.ApiIgnore;
public class HandoverController {
@Autowired
TrainThemeService trainThemeService;
@Autowired
MgrcertService mgrcertService;
@Autowired
UnitsDao unitsDao;
WorkHandoverService workHandoverService;
@Autowired
UserService userService;
......@@ -44,27 +43,25 @@ public class HandoverController {
return ResponseEntity.ok(userService.findByIdHandoverUser(userId));
}
@PostMapping(value = "/job")
@ApiOperation(value = "用户工作交接")
public ResponseEntity getHandoverUser(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody HandoverVo handoverVo) {
@PostMapping(value = "/create")
@ApiOperation(value = "新建工作交接")
public ResponseEntity getHandoverUser(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody WorkHandoverAddVo workHandoverAddVo) {
return ResponseEntity.ok(workHandoverService.createWorkHandover(workHandoverAddVo,securityUser));
}
@PostMapping(value = "/uploadDocuments")
@ApiOperation(value = "完结工作交接")
public ResponseEntity getHandoverUser( @RequestBody WorkHandoverEndAddVo workHandoverEndAddVo) {
return ResponseEntity.ok(workHandoverService.endWorkHandover(workHandoverEndAddVo));
}
// jobService.findByIdsList(handoverVo.getCommissionJobIds()).forEach(
// jobEntity -> {
// if (jobEntity.getBelongUserId()==handoverVo.getHandoverUserId()) {
// jobEntity.setBelongUserId(handoverVo.getBeHandoverUserId());
// jobEntity.setInvoleUserId(jobEntity.getInvoleUserId().replace(handoverVo.getHandoverUserId().toString(),handoverVo.getBeHandoverUserId().toString()));
// jobService.update(jobEntity);
// }
// }
// );
// jobService.findByIdsList(handoverVo.getTrackingJobIds()).forEach(
// jobEntity -> {
// jobEntity.setInvoleUserId(jobEntity.getInvoleUserId().replace(handoverVo.getHandoverUserId().toString(),handoverVo.getBeHandoverUserId().toString()));
// jobService.update(jobEntity);
// }
// );
@GetMapping(value = "/query/{workId}")
@ApiOperation(value = "完结工作交接")
public ResponseEntity getHandoverUser( @PathVariable Integer workId) {
return ResponseEntity.ok("成功");
return ResponseEntity.ok(workHandoverService.findById(workId));
}
......
package com.tykj.dev.device.train.entity;
import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
......@@ -58,4 +64,28 @@ public class WorkHandover {
* 文件集合(装备列表签字文件集合)
*/
private String fileLists;
/**
* 状态 1.新建 2.完成
*/
private Integer status;
/**
* 创建时间
*/
@CreatedDate
private Integer createTime;
/**
* 更新时间
*/
@LastModifiedDate
private Integer updateTime;
public WorkHandoverVo toWorkHandover(){
ModelMapper mapper= BeanHelper.getUserMapper();
WorkHandoverVo workHandoverVo= mapper.map(this, WorkHandoverVo.class);
return workHandoverVo;
}
}
package com.tykj.dev.device.train.entity.vo;
import com.tykj.dev.device.train.entity.WorkHandover;
import com.tykj.dev.misc.base.BeanHelper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
/**
* @author zjm
......@@ -15,10 +18,6 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
public class WorkHandoverAddVo {
/**
* 工作交接id
*/
private Integer workHandoverId;
/**
* 交接人
......@@ -34,4 +33,14 @@ public class WorkHandoverAddVo {
* 监交人
*/
private String inUserName;
public WorkHandover toWorkHandover(){
ModelMapper mapper= BeanHelper.getUserMapper();
WorkHandover workHandover= mapper.map(this, WorkHandover.class);
workHandover.setStatus(1);
return workHandover;
}
}
......@@ -3,6 +3,8 @@ package com.tykj.dev.device.train.service;
import com.tykj.dev.device.train.entity.WorkHandover;
import com.tykj.dev.device.train.entity.vo.WorkHandoverAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverEndAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
/**
* @author zjm
......@@ -16,11 +18,16 @@ public interface WorkHandoverService {
/**
* 新建工作交接流程
*/
WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo);
WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo, SecurityUser securityUser);
/**
* 完结工作交接
*/
WorkHandover endWorkHandover(WorkHandoverEndAddVo workHandoverEndAddVo);
/**
* 查询工作交接详情
*/
WorkHandoverVo findById(Integer workHandoverId);
}
package com.tykj.dev.device.train.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.train.dao.WorkHandoverDao;
import com.tykj.dev.device.train.entity.WorkHandover;
import com.tykj.dev.device.train.entity.vo.WorkHandoverAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverEndAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.device.train.service.TrainTaskService;
import com.tykj.dev.device.train.service.WorkHandoverService;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* @author zjm
* @version 1.0.0
......@@ -17,6 +35,7 @@ import org.springframework.stereotype.Service;
* @createTime 2020年09月17日 16:09:00
*/
@Service
@Slf4j
public class WorkHandoverServiceImpl implements WorkHandoverService {
@Autowired
TaskService taskService;
......@@ -24,13 +43,55 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
@Autowired
WorkHandoverDao workHandoverDao;
@Autowired
TrainTaskService trainTaskService;
@Override
public WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo) {
return null;
public WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo, SecurityUser securityUser) {
log.info("[workHandover] 新建工作交接");
//创建workHandoverDB 存储数据库
WorkHandover workHandover=workHandoverDao.save(workHandoverAddVo.toWorkHandover());
List<Integer> integers=new ArrayList<>();
integers.add(securityUser.getCurrentUserInfo().getUserId());
Task task= taskService.start(new TaskBto(StatusEnum.WORKHANDOVER1011.id,"工作交接",null,null,workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id,securityUser.getCurrentUserInfo().getUnitsId(),0,null,integers));
return workHandover;
}
@Override
public WorkHandover endWorkHandover(WorkHandoverEndAddVo workHandoverEndAddVo) {
return null;
//更新workHamdoverDb状态
WorkHandover workHandover;
Optional<WorkHandover> workHandoverOptional = workHandoverDao.findById(workHandoverEndAddVo.getWorkHandoverId());
if (workHandoverOptional.isPresent()){
workHandover=workHandoverOptional.get();
}else {
log.info("[WorkHandover] 未找到id:{} 工作交接业务",workHandoverEndAddVo.getWorkHandoverId());
throw new ApiException(ResponseEntity.status(500).body("未找到id为"+workHandoverEndAddVo.getWorkHandoverId()+" 工作交接业务"));
}
workHandover.setStatus(2);
workHandover.setFileLists(JacksonUtil.toJSon(workHandoverEndAddVo.getFileLists()));
workHandover= workHandoverDao.save(workHandover);
//把移交人的所有代办任务和跟踪任务替换名称,换成交接人
taskService.workHandover(workHandover.getHandoverUserId(),workHandover.getTurnOverUserId());
//推入完结状态
TaskBto taskBto= trainTaskService.selectFatherIsNullAndBillidAndBillType(workHandover.getWorkHandoverId(),BusinessEnum.WORK_HANDOVER.id);
taskService.moveToEnd(taskBto);
return workHandover;
}
@Override
public WorkHandoverVo findById(Integer workHandoverId) {
Optional<WorkHandover> optionalWorkHandover = workHandoverDao.findById(workHandoverId);
if (optionalWorkHandover.isPresent()){
WorkHandover workHandover=optionalWorkHandover.get();
WorkHandoverVo workHandoverVo=workHandover.toWorkHandover();
workHandoverVo.setFileLists(JacksonUtil.readValue(workHandover.getFileLists(), new TypeReference<List<FileRet>>() {}));
workHandoverVo.setCommissionWord(JacksonUtil.readValue(workHandover.getCommissionWord(), new TypeReference<List<TaskUserVo>>() {}));
workHandoverVo.setTrackingWord(JacksonUtil.readValue(workHandover.getTrackingWord(), new TypeReference<List<TaskUserVo>>() {}));
return workHandoverVo;
}else {
throw new ApiException(ResponseEntity.status(500).body("没有这个id:"+workHandoverId));
}
}
}
......@@ -13,4 +13,4 @@ server.servlet.session.timeout=PT1H
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
file.path=/Users/zjm/code/
preview.path=http://192.168.102.26:8088/file/
\ No newline at end of file
preview.path=http://192.168.102.26:8087/file/
\ No newline at end of file
//package com.tykj.dev.train;
//
//import com.github.wenhao.jpa.Specifications;
//import com.google.common.collect.Lists;
//import com.tykj.dev.device.confirmcheck.entity.vo.CheckBillVo;
//import com.tykj.dev.device.confirmcheck.entity.vo.CheckDetailVo;
//import com.tykj.dev.device.confirmcheck.entity.vo.DevLibVo;
//import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
//import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatRepo;
//import com.tykj.dev.device.confirmcheck.utils.ObjTransUtil;
//import com.tykj.dev.device.task.repository.TaskDao;
//import com.tykj.dev.device.task.subject.domin.Task;
//import com.tykj.dev.misc.base.StatusEnum;
//import com.tykj.dev.union.BaseTest;
//import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.security.test.context.support.WithMockUser;
//import org.springframework.test.context.ActiveProfiles;
//import org.springframework.test.web.servlet.MockMvc;
//import org.springframework.test.web.servlet.RequestBuilder;
//
//import java.util.HashMap;
//import java.util.Map;
//import java.util.StringJoiner;
//
//import static com.tykj.dev.misc.utils.JacksonUtil.toJSon;
//import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
//import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
//
///**
// * DeviceCheckControllerTest.
// *
// * @author Matrix <xhyrzldf@gmail.com>
// * @since 2020/9/15 at 11:17 上午
// */
//@SuppressWarnings("ALL")
//@WithMockUser(username = "shena", password = "qwer1234", authorities = "省A专管员")
//@ActiveProfiles("dev")
//class DeviceCheckControllerTest extends BaseTest {
//
// @Autowired
// protected MockMvc mockMvc;
// @Autowired
//
//
// @Test
// void startManualCheck() throws Exception {
//
//
// CheckBillVo param = new CheckBillVo();
// param.setUnitId(1);
// param.setAreaRange(Lists.newArrayList(1));
// param.setCheckTitle("单元测试手动核查");
// param.setRemark("这是一段测试用的数据");
// param.setUserAId(1);
// param.setUserBId(2);
//
// // 测试
// RequestBuilder request;
//
// request = post("/check/confirm/check/bill")
// .header("Origin", "*")
// .contentType(MediaType.APPLICATION_JSON)
// .content(toJSon(param));
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(mvcResult1 -> System.out.println("[测试结果] 手动发起核查任务测试通过"));
//
// // checkUserA 接口
// Task initTask = taskRepo.findAll(Specifications.<Task>and()
// .eq("billStatus", StatusEnum.CHECK_DETAIL_0.id)
// .build())
// .get(0);
// Integer detailBillId = initTask.getBillId();
//
// CheckDetailVo detailVoList = detailRepo.findById(detailBillId)
// .map(transUtil::CheckDetailDo2Vo)
// .orElse(null);
//
// DevLibVo devLibVo = new DevLibVo(detailVoList.getDevInLibrary(), detailVoList.getDevNotInLibrary());
//
//
// Map<String, String> paramMap = new HashMap<>();
// paramMap.put("assignUserId", "2");
// paramMap.put("checkResult", "\"检查结果无误\"");
//
// String baseUrl = "/check/confirm/detail/";
// String url_a = baseUrl + "A/" + detailBillId;
// StringJoiner joiner = new StringJoiner("&", "?", "");
//
// for (Map.Entry<String, String> entry : paramMap.entrySet()) {
// String k = entry.getKey();
// String v = entry.getValue();
// joiner.add(k + "=" + v);
// }
// url_a += joiner.toString();
// System.out.println("url is " + url_a);
// request = put(url_a)
// .header("Origin", "*")
// .contentType(MediaType.APPLICATION_JSON)
// .content(toJSon(devLibVo));
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(s -> System.out.println(
// String.format("[测试结果] 对任务id=%d的任务执行岗位A详情审核操作成功,审核的详情表id为%d",
// initTask.getId(),
// initTask.getBillId())));
//
// // checkUserB 接口 测试审核通过
// String url_b = baseUrl + "B/" + detailBillId + "?" + "checkStatus=1";
// request = put(url_b)
// .header("Origin", "*");
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(s -> System.out.println(
// String.format("[测试结果] 对任务id=%d的任务执行岗位B详情审核操作成功,审核的详情表id为%d",
// initTask.getId(),
// initTask.getBillId())));
//
// // checkUserC - C 接口 测试审核通过
// String url_c = baseUrl + "C/" + detailBillId + "?" + "pass=1";
// request = put(url_c)
// .header("Origin", "*");
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(s -> System.out.println(
// String.format("[测试结果] 对任务id=%d的任务执行岗位C详情审核操作成功,审核的详情表id为%d",
// initTask.getId(),
// initTask.getBillId())));
//
// // checkUserC - D 接口 测试审核通过
// String url_d = baseUrl + "C/" + detailBillId + "?" + "pass=1";
// request = put(url_c)
// .header("Origin", "*");
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(s -> System.out.println(
// String.format("[测试结果] 对任务id=%d的任务执行岗位D详情审核操作成功,审核的详情表id为%d",
// initTask.getId(),
// initTask.getBillId())));
//
// // 统计数据确认接口
// // 获取父级的billId
// Integer statTaskId = initTask.getParentTaskId();
// Integer statId = taskRepo.findById(statTaskId).get().getBillId();
// String url_verify = "/check/confirm/stat/verify?statId=" + statId;
// request = post(url_verify)
// .header("Origin", "*");
//
// mockMvc.perform(request)
// .andExpect(status().isOk())
// .andDo(s -> System.out.println(
// String.format("[测试结果] 对任务id=%d的任务执行统计数据确认操作成功,审核的数据表id为%d",
// statTaskId,
// statId)));
//
// // 结束之后删除本次建立的数据 包括 task 以及相应的业务表数据
// // 删除父级任务
//// Task fatherTask = taskRepo.findById(statTaskId).get();
//// Integer statBillId = fatherTask.getBillId();
//// taskRepo.deleteById(fatherTask.getId());
//// statRepo.deleteById(statBillId);
////
//// List<Task> childTask = taskRepo.findAllByParentTaskId(statTaskId);
//// List<Integer> childTaskIds = childTask.stream().map(Task::getId).collect(toList());
//// List<Integer> childBillIds = childTask.stream().map(Task::getBillId).collect(toList());
//
// }
//}
\ No newline at end of file
......@@ -19,7 +19,7 @@ import java.util.List;
public interface AreaDao extends JpaRepository<Area, Integer>, JpaSpecificationExecutor<Area> {
List<Area> findAllByFatherId(Integer areaId);
List<Area> findByFatherId(Integer areaId);
List<Area> findByFatherId(Integer fatherId);
List<Area> findAreasByType(Integer type);
......
......@@ -32,5 +32,6 @@ public interface UnitsDao extends JpaRepository<Units, Integer>, JpaSpecificatio
@Query("select o.areaId from Units o where o.unitId=?1")
int findAreaId(int id);
Units findByAreaIdAndLevel(Integer areaId , Integer level);
}
......@@ -13,8 +13,8 @@ import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.sendback.entity.domain.SendBackBillDetail;
import com.tykj.dev.device.sendback.repository.SendBackBillDetailDao;
import com.tykj.dev.device.sendback.subject.domin.SendBackBillDetail;
import com.tykj.dev.device.storage.repository.StorageBillDao;
import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.device.user.subject.service.UserPublicService;
......@@ -55,6 +55,9 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
@Autowired
private StorageBillDao storageBillDao;
@Autowired
SendBackBillDetailDao sendBackBillDetailDao;
@Autowired
private UserPublicService userPublicService;
......@@ -64,8 +67,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
@Autowired
private DeviceDestroyBillDao deviceDestroyBillDao;
@Autowired
private SendBackBillDetailDao sendBackBillDetailDao;
@Autowired
private PackingLibraryDao packingLibraryDao;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论