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

更新业务查询

上级 4d7b4d18
......@@ -8,11 +8,17 @@ import com.tykj.dev.device.allot.subject.vo.AllotBillSaveVo;
import com.tykj.dev.device.allot.subject.vo.AllotReceiveConfirmVo;
import com.tykj.dev.device.allot.subject.vo.AllotReceiveVo;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.task.subject.common.StatusEnum;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.FileVo;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.TimestampUtil;
......@@ -52,8 +58,14 @@ public class AllotBillController {
@Autowired
private DeviceLibraryService deviceLibraryService;
// @Autowired
// private DeviceLogService deviceLogService;
@Autowired
private DeviceLogService deviceLogService;
@Autowired
private TaskLogService taskLogService;
@Autowired
private UserPublicService userPublicService;
@ApiOperation(value = "发起配发业务",notes = "可以通过这个接口发起配发任务")
@PostMapping(value = "/addAllotBill")
......@@ -65,8 +77,8 @@ public class AllotBillController {
Calendar calendar = Calendar.getInstance();
calendar.setTime(allotBillEntity.getCreateTime());
int year = calendar.get(Calendar.YEAR);
String s ="NO:第"+year+"PF"+allotBillEntity.getId()+"号";
allotBillEntity.setNum(s);
String num ="NO:第"+year+"PF"+allotBillEntity.getId()+"号";
allotBillEntity.setNum(num);
allotBillService.update(allotBillEntity);
Integer billId = allotBillEntity.getId();
Integer userId = userUtils.getCurrentUserId();
......@@ -77,18 +89,20 @@ public class AllotBillController {
userIds.add(allotBillSaveVo.getSendUserbId());
TaskBto taskBto = new TaskBto(StatusEnum.ALLOT_SEND_CONFIRM.id,"配发业务",null,".",billId,3,userUtils.getCurrentUnitId(),1,null,userIds);
Task saveEntity = taskService.start(taskBto);
// String[] strings = deviceIdDetail.split("x");
// for (String s:strings) {
// if (s.length()>=2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ"+allotBillEntity.getFileName()+"Ǒ"+allotBillEntity.getFileUrl()+"Ǒ"+"出库确认单"+"Ǵ");
// bussinessLogVo.setRemark("对"+allotBillEntity.getReceiveUnit()+"发起配发");
// bussinessLogVo.setTaskId(saveEntity.getId());
// deviceLogService.addLog(bussinessLogVo);
// }
// }
//存业务日志
List<FileVo> fileVoList = new ArrayList<>();
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");
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"对"+allotBillEntity.getReceiveUnit()+"发起配发",fileVoList);
deviceLogService.addLog(deviceLogDto);
}
}
return ResultUtil.success(allotBillEntity);
}
......@@ -102,7 +116,11 @@ public class AllotBillController {
allotBillEntity.setAllotStatus(2);
allotBillEntity.setSendTime(TimestampUtil.getCurrentTimestamp());
allotBillService.update(allotBillEntity);
taskService.update(taskService.moveToNext(taskBto,allotBillEntity.getReceiveUseraId()));
TaskBto taskBto1 = taskService.moveToNext(taskBto,allotBillEntity.getReceiveUseraId());
taskBto1.setOwnUnit(userPublicService.findUnitIdByName(allotBillEntity.getReceiveUnit()));
taskService.update(taskBto1);
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"审核成功并出库",null);
taskLogService.addLog(taskLogBto);
String deviceIdDetail = allotBillEntity.getAllotCheckDetail();
String[] strings = deviceIdDetail.split("x");
for (String s:strings) {
......@@ -111,12 +129,8 @@ public class AllotBillController {
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(3);
deviceLibraryEntity.setManageStatus(0);
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("审核成功并出库");
// bussinessLogVo.setTaskId(taskBto.getId());
// deviceLogService.addLog(bussinessLogVo);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"审核成功并出库",null);
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
}
}
......@@ -125,22 +139,20 @@ public class AllotBillController {
//2.审核失败,审核任务完成,发起一个通知任务,配发业务结束
if (allotBillConfirmVo.getStatus()==1){
taskService.update(taskService.moveToArchive(taskBto));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"配发出库审核失败",null);
taskLogService.addLog(taskLogBto);
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
allotBillEntity.setAllotStatus(1);
allotBillService.update(allotBillEntity);
// String deviceIdDetail = allotBillEntity.getAllotCheckDetail();
// String[] strings = deviceIdDetail.split("x");
// for (String s:strings) {
// if (s.length()>=2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("配发出库审核失败");
// bussinessLogVo.setTaskId(taskBto.getId());
// deviceLogService.addLog(bussinessLogVo);
// }
// }
String deviceIdDetail = allotBillEntity.getAllotCheckDetail();
String[] strings = deviceIdDetail.split("x");
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"配发出库审核失败",null);
deviceLogService.addLog(deviceLogDto);
}
}
return ResultUtil.success("配发审核失败");
}
else {
......@@ -155,6 +167,11 @@ public class AllotBillController {
TaskBto taskBto = taskService.get(allotReceiveVo.getTaskId());
taskService.update(taskService.moveToNext(taskBto,allotReceiveVo.getReceiveUserbId()));
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("配发单",allotBillEntity.getBillFileName(),allotBillEntity.getBillFileUrl()));
fileVoList.add(new FileVo("入库确认单",allotBillEntity.getReceiveFileName(),allotBillEntity.getReceiveFileUrl()));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"接收并发起入库",fileVoList);
taskLogService.addLog(taskLogBto);
//更新任务和账单
allotBillEntity.setAllotStatus(3);
BeanUtils.copyProperties(allotReceiveVo,allotBillEntity);
......@@ -169,24 +186,16 @@ public class AllotBillController {
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(0);
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ"+allotBillEntity.getBillFileName()+"Ǒ"+allotBillEntity.getBillFileUrl()+"Ǒ"+"配发单"+"Ǵ"+allotBillEntity.getReceiveFileName()+"Ǒ"+allotBillEntity.getReceiveFileUrl()+"Ǒ"+"入库确认单"+"Ǵ");
// bussinessLogVo.setRemark("接收并发起入库");
// bussinessLogVo.setTaskId(taskBto.getId());
// deviceLogService.addLog(bussinessLogVo);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"接收并发起入库",fileVoList);
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
}
if ("0".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(11);
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ"+allotBillEntity.getBillFileName()+"Ǒ"+allotBillEntity.getBillFileUrl()+"Ǒ"+"配发单"+"Ǵ"+allotBillEntity.getReceiveFileName()+"Ǒ"+allotBillEntity.getReceiveFileUrl()+"Ǒ"+"入库确认单"+"Ǵ");
// bussinessLogVo.setRemark("接收入库丢失");
// bussinessLogVo.setTaskId(taskBto.getId());
// deviceLogService.addLog(bussinessLogVo);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"接收入库丢失",fileVoList);
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
}
}
......@@ -204,6 +213,8 @@ public class AllotBillController {
//审核通过
if(allotReceiveConfirmVo.getStatus()==0){
taskService.update(taskService.moveToEnd(taskBto));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"审核成功并入库",null);
taskLogService.addLog(taskLogBto);
allotBillEntity.setAllotStatus(5);
allotBillService.update(allotBillEntity);
for (String s:strings) {
......@@ -213,12 +224,8 @@ public class AllotBillController {
deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1);
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("审核成功并入库");
// bussinessLogVo.setTaskId(taskBto.getId());
// deviceLogService.addLog(bussinessLogVo);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"审核成功并入库",null);
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
}
}
......@@ -227,6 +234,8 @@ public class AllotBillController {
//审核失败
if (allotReceiveConfirmVo.getStatus()==1){
taskService.update(taskService.moveToArchive(taskBto));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"配发入库审核失败",null);
taskLogService.addLog(taskLogBto);
AllotBill allotBillEntity2 = allotBillService.getOne(taskBto.getBillId());
allotBillEntity2.setAllotStatus(4);
allotBillService.update(allotBillEntity2);
......@@ -235,12 +244,8 @@ public class AllotBillController {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(1);
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("配发入库审核失败");
// bussinessLogVo.setTaskId(taskBto.getId());
// deviceLogService.addLog(bussinessLogVo);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"配发入库审核失败",null);
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
}
}
......
......@@ -10,6 +10,23 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>device-apply</artifactId>
<dependencies>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>device-user</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>device-task</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>device-allot</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>device-library</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.tykj.dev.device.apply;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author zjm
* @version 1.0.0
* @ClassName userApp.java
* @Description TODO
* @createTime 2020年09月01日 14:32:00
*/
@SpringBootApplication(scanBasePackages={
"com.tykj.dev.*",
}
)
public class applyApp {
public static void main(String[] args) {
SpringApplication.run(applyApp.class, args);
}
}
package com.tykj.dev.device.apply.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.apply.subject.vo.DeviceApplyAllotSaveVo;
import com.tykj.dev.device.apply.subject.vo.DeviceApplyConfirmVo;
import com.tykj.dev.device.apply.subject.vo.DeviceApplySaveVo;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.task.subject.common.StatusEnum;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.FileVo;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author dengdiyi
*/
@RestController
@Api(tags = "装备申请模块",description = "申请模块")
@AutoDocument
@RequestMapping("/apply")
public class DeviceApplyController {
@Autowired
private DeviceApplyBillService deviceApplyBillService;
@Autowired
private UserUtils userUtils;
@Autowired
private TaskService taskService;
@Autowired
private DeviceLogService deviceLogService;
@Autowired
private UserPublicService userPublicService;
@Autowired
private AllotBillService allotBillService;
@Autowired
private TaskLogService taskLogService;
@ApiOperation(value = "发起装备申请",notes = "可以通过这个接口发起装备申请")
@PostMapping("/addDeviceApplyBill")
public ResponseEntity<DeviceApplyBill> addDeviceApplyBill(@RequestBody DeviceApplySaveVo deviceApplySaveVo){
//添加申请单
DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.addEntity(deviceApplySaveVo.toDo());
Integer userId = userUtils.getCurrentUserId();
//发起任务
TaskBto taskBto;
if (deviceApplySaveVo.getReplyUseraId()!=null) {
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
userIds.add(deviceApplySaveVo.getReplyUseraId());
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
}
else{
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
userIds.add(0);
taskBto = new TaskBto(StatusEnum.DEVICE_APPLY_CONFIRM.id, "申请业务", null, ".", deviceApplyBillEntity.getId(), 9, userPublicService.findUnitIdByName(deviceApplySaveVo.getReplyUnit()), 1, null, userIds);
}
Task saveEntity = taskService.start(taskBto);
TaskLogBto taskLogBto = new TaskLogBto(saveEntity.getId(),"发起装备申请",null);
taskLogService.addLog(taskLogBto);
return ResultUtil.success(deviceApplyBillEntity);
}
@ApiOperation(value = "装备申请批复",notes = "可以通过这个接口批复")
@PostMapping("/replay")
public ResponseEntity<TaskBto> addDeviceApplyBillReplay(@RequestBody DeviceApplyConfirmVo deviceApplyConfirmVo){
TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId());
Integer userId = userUtils.getCurrentUserId();
DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId());
if (deviceApplyConfirmVo.getReplyNumber()!=null){
applyBillEntity.setReplayNumber(deviceApplyConfirmVo.getReplyNumber());
}
//批复驳回
if (deviceApplyConfirmVo.getStatus()==1){
applyBillEntity.setApplyStatus(1);
taskService.update(taskService.moveToArchive(taskBto));
deviceApplyBillService.update(applyBillEntity);
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"装备申请批复驳回",null);
taskLogService.addLog(taskLogBto);
return ResultUtil.success(taskBto);
}
//批复成功
if (deviceApplyConfirmVo.getStatus()==0){
applyBillEntity.setApplyStatus(2);
taskService.update(taskService.moveToEnd(taskBto));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"装备申请批复通过",null);
taskLogService.addLog(taskLogBto);
//生成配发子任务
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_ALLOT.id, "配发业务", taskBto.getId(), "."+taskBto.getId()+".", 0, 3, userUtils.getCurrentUnitId(), 0, null, userIds);
Task task = taskService.start(taskBto1);
deviceApplyBillService.update(applyBillEntity);
return ResultUtil.success(task.parse2Bto());
}
else {
return ResultUtil.failed();
}
}
@ApiOperation(value = "装备申请后发起配发",notes = "可以通过这个接口装备申请后发起配发")
@PostMapping("/allot")
public ResponseEntity<String> allot(@RequestBody DeviceApplyAllotSaveVo deviceApplyAllotSaveVo){
TaskBto taskBto = taskService.get(deviceApplyAllotSaveVo.getTaskId());
TaskBto applyTask = taskService.get(taskBto.getParentTaskId());
Integer userId = userUtils.getCurrentUserId();
DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.getOne(applyTask.getBillId());
AllotBill allotBillEntity = new AllotBill();
BeanUtils.copyProperties(deviceApplyAllotSaveVo,allotBillEntity);
allotBillEntity.setTitle("申请后配发");
allotBillEntity.setSendUseraId(userId);
allotBillEntity.setReceiveUseraId(applyTask.getCreateUserId());
allotBillEntity.setApplyNumber(deviceApplyBillEntity.getApplyNumber());
allotBillEntity.setReplayNumber(deviceApplyBillEntity.getReplayNumber());
allotBillEntity.setSendUnit(deviceApplyBillEntity.getReplyUnit());
allotBillEntity.setReceiveUnit(deviceApplyBillEntity.getApplyUnit());
allotBillEntity.setSendTime(new Date());
allotBillEntity.setAllotType(2);
allotBillEntity.setAllotStatus(0);
AllotBill allotBillEntity1 = allotBillService.addEntity(allotBillEntity);
taskBto.setBillId(allotBillEntity1.getId());
taskService.update(taskService.moveToNext(taskBto,deviceApplyAllotSaveVo.getSendUserbId()));
List<FileVo> fileVoList = new ArrayList<>();
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());
if (integerList.size()>0) {
for (Integer id : integerList) {
if (id > 0) {
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"对" + allotBillEntity.getReceiveUnit() + "发起配发",fileVoList);
deviceLogService.addLog(deviceLogDto);
}
}
}
return ResultUtil.success("发起配发成功");
}
}
package com.tykj.dev.device.apply.repository;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author dengdiyi
*/
public interface DeviceApplyBillDao extends JpaRepository<DeviceApplyBill,Integer>, JpaSpecificationExecutor<DeviceApplyBill> {
}
package com.tykj.dev.device.apply.service;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
/**
* @author dengdiyi
*/
public interface DeviceApplyBillService {
DeviceApplyBill addEntity(DeviceApplyBill deviceApplyBillEntity);
DeviceApplyBill update(DeviceApplyBill deviceApplyBillEntity);
DeviceApplyBill getOne(Integer id);
}
package com.tykj.dev.device.apply.service.impl;
import com.tykj.dev.device.apply.repository.DeviceApplyBillDao;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
/**
* @author dengdiyi
*/
@Service
public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
@Autowired
private DeviceApplyBillDao deviceApplyBillDao;
@Override
public DeviceApplyBill addEntity(DeviceApplyBill deviceApplyBillEntity) {
return deviceApplyBillDao.save(deviceApplyBillEntity);
}
@Override
public DeviceApplyBill update(DeviceApplyBill deviceApplyBillEntity) {
return deviceApplyBillDao.save(deviceApplyBillEntity);
}
@Override
public DeviceApplyBill getOne(Integer id) {
Optional<DeviceApplyBill> deviceApplyBillEntity = deviceApplyBillDao.findById(id);
return deviceApplyBillEntity.orElse(null);
}
}
package com.tykj.dev.device.apply.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;
/**
* entity class for device_apply_bill
* 申请账单
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update device_apply_bill set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("申请账单")
public class DeviceApplyBill {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(name = "主键id")
private Integer id;
/**
* 申请文号
*/
@ApiModelProperty(value = "申请文号")
private String applyNumber;
/**
* 批复文号
*/
@ApiModelProperty(value = "批复文号")
private String replayNumber;
/**
* 申请单位
*/
@ApiModelProperty(value = "申请单位")
private String applyUnit;
/**
* 批复单位
*/
@ApiModelProperty(value = "批复单位")
private String replyUnit;
/**
* 经办人
*/
@ApiModelProperty(value = "经办人")
private String agent;
/**
* 配发单id
*/
@ApiModelProperty(value = "配发单id")
private Integer allotId;
/**
* 申请方id(A岗位)
*/
@ApiModelProperty(value = "申请方id(A岗位)")
private Integer applyUseraId;
/**
* 批复方id(A岗位)
*/
@ApiModelProperty(value = "批复方id(A岗位)")
private Integer replyUseraId;
/**
* 申请状态(0:申请待审核,1:申请审核失败,2:申请中,3:已批复待审核,4:批复审核失败,5:申请成功)
*/
@ApiModelProperty(value = "申请状态(0:申请待审核,1:申请审核失败,2:申请中,3:驳回,4:申请成功)")
private Integer applyStatus;
/**
* 列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件
*/
@ApiModelProperty(value = "列装库主键idx数量(,作为分隔符),例如1x2,2x3,意为列装库id为1的申请2件,id为2的申请3件")
private String applyDetail;
/**
* 创建用户id
*/
@CreatedBy
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
/**
* 创建时间
*/
@CreatedDate
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新用户id
*/
@LastModifiedBy
@ApiModelProperty(value = "更新用户id")
private Integer updateUserId;
/**
* 更新时间
*/
@LastModifiedDate
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 删除标记(0:未删除,1:已删除)
*/
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0;
@ApiModelProperty(value = "申请人")
@Transient
private String applyUser;
}
package com.tykj.dev.device.apply.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author dengdiyi
*/
@Data
@ApiModel("入库详情类")
public class ApplyBillDetailVo {
@ApiModelProperty(value = "列装id")
private Integer packingId;
@ApiModelProperty(value = "申请数量")
private Integer storageCount;
@ApiModelProperty(value = "配件列表")
List<ApplyBillDetailVo> list;
}
package com.tykj.dev.device.apply.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@ApiModel("申请后配发类")
public class DeviceApplyAllotSaveVo {
@ApiModelProperty(value = "发件方(B岗位)")
private Integer sendUserbId;
@ApiModelProperty(value = "账单文件名")
private String fileName;
@ApiModelProperty(value = "账单文件地址URL")
private String fileUrl;
@ApiModelProperty(value = "配发设备数量")
private Integer allotCount;
@ApiModelProperty(value = "已配发设备数量")
private Integer allotedCount;
@ApiModelProperty(value = "配发出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配)")
private String allotCheckDetail;
@ApiModelProperty(value = "配发出库检查结果")
private String allotCheckResult;
@ApiModelProperty(value = "对应任务ID",example = "1")
private Integer taskId;
}
package com.tykj.dev.device.apply.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@ApiModel("申请审核类")
public class DeviceApplyConfirmVo {
@ApiModelProperty(value = "对应任务ID",example = "1")
private Integer taskId;
@ApiModelProperty(name = "需要修改的状态",example = "0",value = "0为审核通过,1为驳回")
private Integer status;
@ApiModelProperty(value = "批复文号")
private String replyNumber;
}
package com.tykj.dev.device.apply.subject.vo;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.util.List;
/**
* @author dengdiyi
*/
@Data
@ApiModel("装备申请存储类")
public class DeviceApplySaveVo {
@ApiModelProperty(value = "申请文号")
private String applyNumber;
@ApiModelProperty(value = "批复文号")
private String replayNumber;
@ApiModelProperty(value = "申请单位")
private String applyUnit;
@ApiModelProperty(value = "批复单位")
private String replyUnit;
@ApiModelProperty(value = "经办人")
private String agent;
@ApiModelProperty(value = "申请人id")
private Integer applyUseraId;
@ApiModelProperty(value = "批复人id")
private Integer replyUseraId;
@ApiModelProperty(value = "入库列装数量详情")
private List<ApplyBillDetailVo> storageBillDetailVoList;
public DeviceApplyBill toDo(){
DeviceApplyBill deviceApplyBillEntity = new DeviceApplyBill();
BeanUtils.copyProperties(this,deviceApplyBillEntity);
deviceApplyBillEntity.setApplyStatus(0);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("x");
if (this.storageBillDetailVoList.size()>0){
for (ApplyBillDetailVo s:storageBillDetailVoList) {
stringBuffer.append(s.getPackingId()).append("x");
stringBuffer.append(s.getStorageCount()).append("x");
}
}
deviceApplyBillEntity.setApplyDetail(stringBuffer.toString());
return deviceApplyBillEntity;
}
}
......@@ -11,7 +11,7 @@
<dependencies>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>device-task</artifactId>
<artifactId>device-user</artifactId>
</dependency>
</dependencies>
<artifactId>device-library</artifactId>
......
......@@ -2,7 +2,6 @@ package com.tykj.dev.device.library.service;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.task.subject.vo.BussinessLogVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......@@ -28,8 +27,6 @@ public interface DeviceLibraryService {
List<String> getAllName();
List<BussinessLogVo> getDeviceLog(Integer id);
List<DeviceLibrary> getList(DeviceLibrarySelectVo deviceLibrarySelectVo);
List<DeviceLibrary> getAllList(DeviceLibrarySelectVo deviceLibrarySelectVo);
......
......@@ -6,7 +6,6 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.task.subject.vo.BussinessLogVo;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException;
......@@ -272,12 +271,6 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return new ArrayList<>(s);
}
@Override
public List<BussinessLogVo> getDeviceLog(Integer id) {
return null;
}
@Override
public List<DeviceLibrary> getList(DeviceLibrarySelectVo deviceLibrarySelectVo) {
List<DeviceLibrary> deviceLibraryEntities = deviceLibraryDao.findAll(getSelectSpecification(deviceLibrarySelectVo));
......
......@@ -4,15 +4,11 @@ import com.tykj.dev.device.library.repository.DeviceLogDao;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Optional;
......
package com.tykj.dev.device.library.subject.Dto;
import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.task.subject.vo.FileVo;
import com.tykj.dev.device.library.subject.vo.FileVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......
package com.tykj.dev.device.library.subject.domin;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.vo.FileVo;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.StringSplitUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
package com.tykj.dev.device.library.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author dengdiyi
*/
@Data
@ApiModel("装备详情日志返回类")
public class DeviceLogVo {
@ApiModelProperty(value = "时间")
private Date time;
@ApiModelProperty(value = "单位")
private String unit;
@ApiModelProperty(value = "用户")
private String user;
@ApiModelProperty(value = "操作")
private String operation;
@ApiModelProperty(value = "单据列表")
private List<FileVo> fileVoList;
}
package com.tykj.dev.device.library.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author dengdiyi
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("附件信息返回类")
public class FileVo {
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "附件名")
private String fileName;
@ApiModelProperty(value = "附件url")
private String fileUrl;
}
......@@ -3,13 +3,16 @@ package com.tykj.dev.device.selfcheck.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.selfcheck.service.SelfCheckBillService;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.selfcheck.subject.vo.*;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.task.subject.common.StatusEnum;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.subject.service.UserPublicService;
......@@ -43,20 +46,17 @@ public class SelfCheckController {
@Autowired
private TaskService taskService;
@Autowired
private TaskDao taskDao;
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
private DeviceLibraryDao deviceLibraryDao;
// @Autowired
// private DeviceLogService deviceLogService;
//
// @Autowired
// private DeviceLogDao deviceLogDao;
@Autowired
private DeviceLogService deviceLogService;
@Autowired
private TaskLogService taskLogService;
@Autowired
private UserPublicService userPublicService;
......@@ -151,17 +151,15 @@ public class SelfCheckController {
userIds.add(selfExaminationBillEntity1.getUserbId());
TaskBto taskBto = new TaskBto(StatusEnum.SELF_CHECK_CONFIRM.id,"自查业务",null,".",selfExaminationBillEntity1.getId(),4,userUtils.getCurrentUnitId(),1,null,userIds);
Task saveEntity = taskService.start(taskBto);
// for (String s:strings) {
// if (s.length()>=2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("发起自查");
// bussinessLogVo.setTaskId(saveEntity.getId());
// deviceLogService.addLog(bussinessLogVo);
// }
// }
TaskLogBto taskLogBto = new TaskLogBto(saveEntity.getId(),"发起自查",null);
taskLogService.addLog(taskLogBto);
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",null);
deviceLogService.addLog(deviceLogDto);
}
}
return ResultUtil.success(selfExaminationBillEntity1);
}
......@@ -175,37 +173,33 @@ public class SelfCheckController {
//审核通过,改变账单和任务状态,发起确认的任务
if (selfExaminationConfirmVo.getStatus()==0){
taskService.update(taskService.moveToEnd(taskBto));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"自查审核成功",null);
taskLogService.addLog(taskLogBto);
selfExaminationBillEntity.setCheckStatus(2);
selfExaminationBillService.update(selfExaminationBillEntity);
// for (String s:strings) {
// if (s.length()>=2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("自查审核成功");
// bussinessLogVo.setTaskId(taskBto.getId());
// deviceLogService.addLog(bussinessLogVo);
// }
// }
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"自查审核成功",null);
deviceLogService.addLog(deviceLogDto);
}
}
return ResultUtil.success("审核通过自查完成");
}
//审核不通过,改变账单和任务状态
if (selfExaminationConfirmVo.getStatus()==1){
taskService.update(taskService.moveToArchive(taskBto));
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"自查审核失败",null);
taskLogService.addLog(taskLogBto);
selfExaminationBillEntity.setCheckStatus(1);
selfExaminationBillService.update(selfExaminationBillEntity);
// for (String s:strings) {
// if (s.length()>=2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("自查审核失败");
// bussinessLogVo.setTaskId(taskBto.getId());
// deviceLogService.addLog(bussinessLogVo);
// }
// }
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"自查审核失败",null);
deviceLogService.addLog(deviceLogDto);
}
}
return ResultUtil.success("自查审核失败");
}
else {
......
......@@ -117,7 +117,7 @@ public class StorageBillController {
//2.发起入库任务
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
userIds.add(storageBillSaveVo.getReceiveUserBId());
userIds.add(storageBillSaveVo.getReceiveUserbId());
TaskBto taskBto = new TaskBto(StatusEnum.STORAGE_CONFIRM.id,"入库业务",null,".",storageBillEntity.getId(),2,userUtils.getCurrentUnitId(),1,null,userIds);
Task taskEntity1 = taskService.start(taskBto);
//存业务日志
......
......@@ -32,10 +32,10 @@ public class StorageBillSaveVo {
private Date sendTime;
@ApiModelProperty(value = "接收单位A岗")
private Integer receiveUserAId;
private Integer receiveUseraId;
@ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserBId;
private Integer receiveUserbId;
@ApiModelProperty(value = "配发单附件名")
private String fileName;
......
......@@ -21,6 +21,10 @@
<groupId>com.tykj.dev</groupId>
<artifactId>device-user</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>device-library</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.tykj.dev.device.task.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.repository.DeviceLogDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author dengdiyi
*/
@RestController
@Api(tags = "业务模块",description = "业务模块")
@AutoDocument
@RequestMapping("/business")
public class TaskController {
@Autowired
private TaskService taskService;
@Autowired
private UserUtils userUtils;
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
private UserPublicService userPublicService;
@Autowired
private DeviceLogDao deviceLogDao;
// @ApiOperation(value = "业务分页查询",notes = "可以通过这个接口分页查询业务")
// @RequestMapping(method = RequestMethod.POST , value = "/manage/summary",produces = MediaType.APPLICATION_JSON_VALUE)
// public ResultObj getTaskPage(@RequestBody TaskSelectVo taskSelectVo){
// List<TaskEntity> taskServicePage = taskService.getPage(taskSelectVo, taskSelectVo.getPageable());
// List<TaskEntity> list = new ArrayList<>();
// List<TaskEntity> list1 = new ArrayList<>();
// List<TaskEntity> list2 = new ArrayList<>();
// for (TaskEntity t:taskServicePage) {
// if (t.getIsTop()==1){
// list1.add(t);
// }
// }
// for (TaskEntity t:list1) {
// if (t.getIsRead()==0){
// list.add(t);
// }
// }
// for (TaskEntity t:list1) {
// if (t.getIsRead()==1){
// list.add(t);
// }
// }
// for (TaskEntity t:taskServicePage) {
// if (t.getIsTop()==0){
// list2.add(t);
// }
// }
// for (TaskEntity t:list2) {
// if (t.getIsRead()==0){
// list.add(t);
// }
// }
// for (TaskEntity t:list2) {
// if (t.getIsRead()==1){
// list.add(t);
// }
// }
// if (list.size()<=taskSelectVo.getSize()) {
// return new ResultObj(new PageImpl<>(list, taskSelectVo.getPageable(), list.size()),"查询成功");
// }
// else {
// Double d = Math.ceil(list.size()/taskSelectVo.getSize().doubleValue());
// int value = new Double(d).intValue();
// if (taskSelectVo.getPage()>=value){
// return null;
// }
// else {
// int index = taskSelectVo.getPage()*taskSelectVo.getSize();
// if (taskSelectVo.getPage()==value){
// return new ResultObj(new PageImpl<>(list.subList(index,list.size()), taskSelectVo.getPageable(), list.size()),"查询成功");
// }
// return new ResultObj(new PageImpl<>(list.subList(index,index+taskSelectVo.getSize()), taskSelectVo.getPageable(), list.size()),"查询成功");
// }
// }
// }
@ApiOperation(value = "业务跟踪待办列表查询",notes = "可以通过这个接口查询业务")
@RequestMapping(method = RequestMethod.POST , value = "/getTaskList",produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<TaskUserVo>> getTaskList(@RequestBody TaskSelectVo taskSelectVo){
List<TaskUserVo> taskEntities = taskService.getList(taskSelectVo);
//按置顶第一顺序,未读第二顺序排序输出
List<TaskUserVo> list = new ArrayList<>();
List<TaskUserVo> list1 = new ArrayList<>();
List<TaskUserVo> list2 = new ArrayList<>();
//将置顶筛选到list1
for (TaskUserVo t:taskEntities) {
if (t.getIsTop()==1){
list1.add(t);
}
}
//list1中将未读的放在list最前面
for (TaskUserVo t:list1) {
if (t.getIsRead()==0){
list.add(t);
}
}
//list1中将已读的放在list最后面
for (TaskUserVo t:list1) {
if (t.getIsRead()==1){
list.add(t);
}
}
//将未置顶的放入list2中
for (TaskUserVo t:taskEntities) {
if (t.getIsTop()==0){
list2.add(t);
}
}
//将未读的优先放入list中
for (TaskUserVo t:list2) {
if (t.getIsRead()==0){
list.add(t);
}
}
//将已读的放入list
for (TaskUserVo t:list2) {
if (t.getIsRead()==1){
list.add(t);
}
}
return ResultUtil.success(list);
}
// @ApiOperation(value = "置顶设置",notes = "可以通过这个接口置顶业务")
// @RequestMapping(method = RequestMethod.PUT , value = "/setTop",produces = MediaType.APPLICATION_JSON_VALUE)
// public ResultObj setTop(@RequestBody TaskTopVo taskTopVo){
// TaskEntity taskEntity = taskService.getOne(taskTopVo.getTaskId());
// Integer userId = userUtils.getCurrentUserId();
// if (taskTopVo.getTopFlag()==1) {
// if (taskEntity.getTopFlagDetail()!=null) {
// taskEntity.setTopFlagDetail(taskEntity.getTopFlagDetail() + userId + "x");
// }
// else {
// taskEntity.setTopFlagDetail("x" + userId + "x");
// }
// }
// if (taskTopVo.getTopFlag()==0){
// List<Integer> idList = StringSplitUtil.userIdSplit(taskEntity.getTopFlagDetail());
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append("x");
// if (idList.size()>0){
// for (Integer id:idList) {
// if (!id.equals(userId)){
// stringBuffer.append(id+"x");
// }
// }
// }
// taskEntity.setTopFlagDetail(stringBuffer.toString());
// }
// TaskEntity taskEntityUpdated = taskService.update(taskEntity);
// return new ResultObj(taskEntityUpdated,"修改置顶标志成功");
// }
//
// @ApiOperation(value = "是否已读设置",notes = "可以通过这个接口设置业务的是否已读")
// @PostMapping("/setRead")
// public ResultObj setRead(@RequestBody TaskTopVo taskTopVo){
// TaskEntity taskEntity = taskService.getOne(taskTopVo.getTaskId());
// Integer userId = userUtils.getCurrentUserId();
// if (taskTopVo.getTopFlag()==1) {
// if (taskEntity.getUserReadDetail()!=null) {
// taskEntity.setUserReadDetail(taskEntity.getUserReadDetail() + userId + "x");
// }
// else {
// taskEntity.setUserReadDetail("x" + userId + "x");
// }
// }
// if (taskTopVo.getTopFlag()==0){
// List<Integer> idList = StringSplitUtil.userIdSplit(taskEntity.getUserReadDetail());
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append("x");
// if (idList.size()>0){
// for (Integer id:idList) {
// if (!id.equals(userId)){
// stringBuffer.append(id+"x");
// }
// }
// }
// taskEntity.setUserReadDetail(stringBuffer.toString());
// }
// TaskEntity taskEntityUpdated = taskService.update(taskEntity);
// return new ResultObj(taskEntityUpdated,"修改阅读标志成功");
// }
// @ApiOperation(value = "查询业务对应页面的数据",notes = "可以通过这个接口查询业务对应页面的数据")
// @GetMapping("/manage/detail/{id}")
// public ResultObj selectData(@PathVariable("id") int taskId){
// TaskEntity taskEntity = taskService.getOne(taskId);
// taskEntity.setJobId(taskUtils.getCurrentJob(taskId).getId());
// Integer bussinessType = taskEntity.getBussinessType();
// Integer billId = taskEntity.getBillId();
// List<Object> list = new ArrayList<>();
// list.add(taskEntity);
// switch (bussinessType){
// case 1:
// PackingLibraryEntity packingLibraryEntity = packingLibraryService.getOne(billId);
// packingLibraryEntity.setUserA(userPublicService.getOne(packingLibraryEntity.getUserAId()).getName());
// packingLibraryEntity.setUserB(userPublicService.getOne(packingLibraryEntity.getUserBId()).getName());
// list.add(packingLibraryEntity);
// List<PackingLibraryEntity> packingLibraryEntities= packingLibraryService.selectAllPart(billId);
// list.add(packingLibraryEntities);
// return new ResultObj(list,"查询成功");
// case 2:
// StorageBillEntity storageBillEntity = storageBillService.getOne(billId);
// storageBillEntity.setReceiveUserA(userPublicService.getOne(storageBillEntity.getReceiveUserAId()).getName());
// storageBillEntity.setReceiveUserB(userPublicService.getOne(storageBillEntity.getReceiveUserBId()).getName());
// list.add(storageBillEntity);
// String str = storageBillEntity.getStorageDetail();
// List<Integer> list1= StringSplitUtil.userIdSplit(str);
// List<DeviceLibraryEntity> libraryEntities = new ArrayList<>();
// for (Integer id:list1) {
// DeviceLibraryEntity deviceLibraryEntity = deviceLibraryService.getOne(id);
// libraryEntities.add(deviceLibraryEntity);
// }
// list.add(libraryEntities);
// return new ResultObj(list,"查询成功");
// case 3:
// if (taskEntity.getBillId()==0){
// TaskEntity applyTask = taskService.getOne(taskEntity.getParentTaskId());
// DeviceApplyBillEntity deviceApplyBillEntity = deviceApplyBillService.getOne(applyTask.getBillId());
// List<Integer> idList = StringSplitUtil.userIdSplit(deviceApplyBillEntity.getApplyDetail());
// List<Integer> packingIdList = new ArrayList<>();
// List<Integer> numList = new ArrayList<>();
// List<PackingLibraryEntity> packingLibraryEntityList = new ArrayList<>();
// if (idList.size()>0){
// for (int i=1;i<=idList.size();i++) {
// if (i%2==1){
// packingIdList.add(idList.get(i-1));
// }
// else {
// numList.add(idList.get(i-1));
// }
// }
// }
// if (packingIdList.size()==numList.size()){
// for (int i=0;i<packingIdList.size();i++) {
// PackingLibraryEntity p = packingLibraryService.getOne(packingIdList.get(i));
// p.setApplyNum(numList.get(i));
// packingLibraryEntityList.add(p);
// }
// }
// list.add(packingLibraryEntityList);
// //查询可配发相同类型装备列表
// list.add(deviceLibraryService.getAllotPage(new DeviceLibrarySelectVo()).stream().filter(deviceLibraryEntity -> packingIdList.contains(deviceLibraryEntity.getPackingId())).sorted(Comparator.comparing(DeviceLibraryEntity::getPackingId)).collect(Collectors.toList()));
// return new ResultObj(list,"查询成功");
// }
// AllotBillEntity allotBillEntity = allotBillService.getOne(billId);
// allotBillEntity.setSenderUserA(userPublicService.getOne(allotBillEntity.getSendUserAId()).getName());
// allotBillEntity.setSenderUserB(userPublicService.getOne(allotBillEntity.getSendUserBId()).getName());
// allotBillEntity.setReceiveUserA(userPublicService.getOne(allotBillEntity.getReceiveUserAId()).getName());
// Date date = allotBillEntity.getCreateTime();
// int year = date.getYear()+1900;
// String s1 ="NO:第"+year+"PF"+allotBillEntity.getId()+"号";
// allotBillEntity.setNum(s1);
// if (allotBillEntity.getReceiveUserBId()!=null){
// allotBillEntity.setReceiveUserB(userPublicService.getOne(allotBillEntity.getReceiveUserBId()).getName());
// }
// list.add(allotBillEntity);
// String str2 = allotBillEntity.getAllotCheckDetail();
// String[] strings1 = str2.split("x");
// List<DeviceLibraryEntity> deviceLibraryEntities = new ArrayList<>();
// 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));
// DeviceLibraryEntity deviceLibraryEntity = deviceLibraryService.getOne(id);
// deviceLibraryEntity.setCheckResult(checkResult);
// deviceLibraryEntities.add(deviceLibraryEntity);
// }
// }
// list.add(deviceLibraryEntities);
// return new ResultObj(list,"查询成功");
// case 4:
// SelfExaminationBillEntity selfExaminationBillEntity = selfExaminationBillService.getOne(billId);
// if (selfExaminationBillEntity.getUserAId()!=0) {
// selfExaminationBillEntity.setCheckUser(userPublicService.getOne(selfExaminationBillEntity.getUserAId()).getName());
// }
// if (selfExaminationBillEntity.getUserBId()!=0) {
// selfExaminationBillEntity.setConfirmUser(userPublicService.getOne(selfExaminationBillEntity.getUserBId()).getName());
// }
// list.add(selfExaminationBillEntity);
// String str3 = selfExaminationBillEntity.getCheckDetail();
// String str4 = selfExaminationBillEntity.getNewDeviceDetail();
// String[] split = str3.split("x");
// if (str4!=null) {
// String[] split2 = str4.split("\\.");
// List<DeviceLibraryEntity> newDeviceList = new ArrayList<>();
// for (String rfid:split2){
// if (rfid.length()>0){
// DeviceLibraryEntity d = new DeviceLibraryEntity();
// d.setCheckResult(2);
// d.setSeqNumber("-");
// d.setName("-");
// d.setType(0);
// d.setRfidSurfaceId("-");
// d.setProdNumber("-");
// d.setRfidCardId(rfid);
// newDeviceList.add(d);
// }
// }
// list.add(newDeviceList);
// }
// if (str4==null){
// List<DeviceLibraryEntity> newDeviceList = new ArrayList<>();
// list.add(newDeviceList);
// }
// List<DeviceLibraryEntity> libraryEntities1 = new ArrayList<>();
// for (String s:split) {
// if (s.length()>=2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// Integer checkResult = Integer.parseInt(s.substring(s.length()-1));
// DeviceLibraryEntity deviceLibraryEntity = deviceLibraryService.getOne(id);
// deviceLibraryEntity.setCheckResult(checkResult);
// libraryEntities1.add(deviceLibraryEntity);
// }
// }
// list.add(libraryEntities1);
// return new ResultObj(list,"查询成功");
// case 19:
// MatchingDeviceBillEntity matchingDeviceBillEntity = matchingDeviceBillService.getOne(billId);
// list.add(matchingDeviceBillEntity);
// List<Integer> integerList = StringSplitUtil.userIdSplit(matchingDeviceBillEntity.getDeviceDetail());
// List<MatchingDeviceLibraryEntity> matchingDeviceLibraryEntities = new ArrayList<>();
// if (integerList.size()>0){
// for (Integer id:integerList) {
// if (id>0){
// matchingDeviceLibraryEntities.add(matchingDeviceLibraryService.getOne(id));
// }
// }
// }
// list.add(matchingDeviceLibraryEntities);
// return new ResultObj(list,"查询成功");
// case 9:
// DeviceApplyBillEntity deviceApplyBillEntity = deviceApplyBillService.getOne(taskEntity.getBillId());
// deviceApplyBillEntity.setApplyUser(userPublicService.getOne(deviceApplyBillEntity.getApplyUserAId()).getName());
// list.add(deviceApplyBillEntity);
// List<Integer> idList = StringSplitUtil.userIdSplit(deviceApplyBillEntity.getApplyDetail());
// List<Integer> packingIdList = new ArrayList<>();
// List<Integer> numList = new ArrayList<>();
// List<PackingLibraryEntity> packingLibraryEntityList = new ArrayList<>();
// if (idList.size()>0){
// for (int i=1;i<=idList.size();i++) {
// if (i%2==1){
// packingIdList.add(idList.get(i-1));
// }
// else {
// numList.add(idList.get(i-1));
// }
// }
// }
// if (packingIdList.size()==numList.size()){
// for (int i=0;i<packingIdList.size();i++) {
// PackingLibraryEntity p = packingLibraryService.getOne(packingIdList.get(i));
// p.setApplyNum(numList.get(i));
// packingLibraryEntityList.add(p);
// }
// }
// list.add(packingLibraryEntityList);
// list.add(deviceLibraryService.getAllotPage(new DeviceLibrarySelectVo()).stream().filter(deviceLibraryEntity -> packingIdList.contains(deviceLibraryEntity.getPackingId())).sorted(Comparator.comparing(DeviceLibraryEntity::getPackingId)).collect(Collectors.toList()));
// return new ResultObj(list,"查询成功");
// default: return null;
// }
// }
//
// private List<DeviceLogEntity> orderByTime(List<DeviceLogEntity> list){
// Collections.sort(list, (o1, o2) -> {
// int flag = o1.getLogTime().compareTo(o2.getLogTime());
// return flag;
// });
// return list;
// }
//
// @ApiOperation(value = "查询业务日志",notes = "可以通过这个接口查询查询业务日志")
// @GetMapping("/manage/detail/log/{id}")
// public ResultObj selectLog(@PathVariable("id") int taskId){
// Set<String> remarkList = new HashSet<>();
// List<DeviceLogEntity> deviceLogEntities = new ArrayList<>();
// List<DeviceLogEntity> logEntities = orderByTime(deviceLogDao.getAllByTaskId(taskId));
// if (logEntities.size()>0){
// logEntities.forEach(deviceLogEntity -> {
// if (!remarkList.contains(deviceLogEntity.getRemark())){
// deviceLogEntities.add(deviceLogEntity);
// remarkList.add(deviceLogEntity.getRemark());
// }
// });
// }
// for (DeviceLogEntity d:deviceLogEntities) {
// d.setUser(userPublicService.getOne(d.getUserId()).getName());
// d.setUnit(userPublicService.findUnitsNameByUserId(d.getUserId()));
// String[] strings = d.getFileDetail().split("Ǵ");
// List<FileVo> fileVos = new ArrayList<>();
// if (strings.length>0){
// for (String s:strings) {
// if (s.length()>0){
// String[] strings1 = s.split("Ǒ");
// if ("".equals(strings1[0])&&strings1.length==4){
// FileVo fileVo = new FileVo();
// fileVo.setFileName(strings1[1]);
// fileVo.setFileUrl(strings1[2]);
// fileVo.setTitle(strings1[3]);
// fileVos.add(fileVo);
// }
// if (!"".equals(strings1[0])&&strings1.length==3){
// FileVo fileVo = new FileVo();
// fileVo.setFileName(strings1[0]);
// fileVo.setFileUrl(strings1[1]);
// fileVo.setTitle(strings1[2]);
// fileVos.add(fileVo);
// }
// }
// }
// }
// d.setFileVoList(fileVos);
// }
// return new ResultObj(deviceLogEntities,"查询成功");
// }
}
......@@ -4,6 +4,7 @@ import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.common.StatusEnum;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import java.util.List;
......@@ -95,5 +96,5 @@ public interface TaskService {
* @param taskSelectVo
* 获取跟踪和待办业务列表
*/
List<Task> getList(TaskSelectVo taskSelectVo);
List<TaskUserVo> getList(TaskSelectVo taskSelectVo);
}
package com.tykj.dev.device.task.service.impl;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.repository.TaskLogDao;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.common.StatusEnum;
import com.tykj.dev.device.task.subject.common.GlobalMap;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.domin.TaskLog;
import com.tykj.dev.device.task.subject.vo.TaskSelectVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.task.utils.TaskUtils;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
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 org.springframework.web.bind.annotation.ExceptionHandler;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author dengdiyi
*/
@Service
public class TaskServiceImpl implements TaskService {
@Autowired
private TaskDao taskDao;
@Autowired
private TaskUtils taskUtils;
@Autowired
private UserUtils userUtils;
@Autowired
private UserPublicService userPublicService;
@Autowired
private TaskLogDao taskLogDao;
/**
* <p>业务进行到下一个状态</p>
* <li>不指定待办用户</li>
......@@ -29,10 +52,10 @@ public class TaskServiceImpl implements TaskService {
@Override
public TaskBto moveToNext(TaskBto taskBto) {
//status++
taskBto.setBillStatus(GlobalMap.getHashMap().getOrDefault(taskBto.getBillStatus()+1, StatusEnum.END).id);
taskBto.setBillStatus(GlobalMap.getStatusEnumMap().getOrDefault(taskBto.getBillStatus() + 1, StatusEnum.END).id);
//list add 0,point++
taskBto.getInvolveUserIdList().add(0);
taskBto.setCurrentPoint(taskBto.getCurrentPoint()+1);
taskBto.setCurrentPoint(taskBto.getCurrentPoint() + 1);
//set readList empty
taskBto.setUserReadDetailList(Collections.emptyList());
return taskBto;
......@@ -47,10 +70,10 @@ public class TaskServiceImpl implements TaskService {
@Override
public TaskBto moveToNext(TaskBto taskBto, String customInfo) {
//status++
taskBto.setBillStatus(GlobalMap.getHashMap().getOrDefault(taskBto.getBillStatus()+1,StatusEnum.END).id);
taskBto.setBillStatus(GlobalMap.getStatusEnumMap().getOrDefault(taskBto.getBillStatus() + 1, StatusEnum.END).id);
//list add 0,point++
taskBto.getInvolveUserIdList().add(0);
taskBto.setCurrentPoint(taskBto.getCurrentPoint()+1);
taskBto.setCurrentPoint(taskBto.getCurrentPoint() + 1);
//set readList empty
taskBto.setUserReadDetailList(Collections.emptyList());
//set customInfo
......@@ -66,10 +89,10 @@ public class TaskServiceImpl implements TaskService {
@Override
public TaskBto moveToNext(TaskBto taskBto, Integer userId) {
//status++
taskBto.setBillStatus(GlobalMap.getHashMap().getOrDefault(taskBto.getBillStatus()+1,StatusEnum.END).id);
taskBto.setBillStatus(GlobalMap.getStatusEnumMap().getOrDefault(taskBto.getBillStatus() + 1, StatusEnum.END).id);
//list add userId,point++
taskBto.getInvolveUserIdList().add(userId);
taskBto.setCurrentPoint(taskBto.getCurrentPoint()+1);
taskBto.setCurrentPoint(taskBto.getCurrentPoint() + 1);
//set readList empty
taskBto.setUserReadDetailList(Collections.emptyList());
return taskBto;
......@@ -85,10 +108,10 @@ public class TaskServiceImpl implements TaskService {
@Override
public TaskBto moveToNext(TaskBto taskBto, Integer userId, String customInfo) {
//status++
taskBto.setBillStatus(GlobalMap.getHashMap().getOrDefault(taskBto.getBillStatus()+1,StatusEnum.END).id);
taskBto.setBillStatus(GlobalMap.getStatusEnumMap().getOrDefault(taskBto.getBillStatus() + 1, StatusEnum.END).id);
//list add userId,point++
taskBto.getInvolveUserIdList().add(userId);
taskBto.setCurrentPoint(taskBto.getCurrentPoint()+1);
taskBto.setCurrentPoint(taskBto.getCurrentPoint() + 1);
//set readList empty
taskBto.setUserReadDetailList(Collections.emptyList());
//set customInfo
......@@ -107,7 +130,7 @@ public class TaskServiceImpl implements TaskService {
taskBto.setBillStatus(statusEnum.id);
//list add 0,point++
taskBto.getInvolveUserIdList().add(0);
taskBto.setCurrentPoint(taskBto.getCurrentPoint()+1);
taskBto.setCurrentPoint(taskBto.getCurrentPoint() + 1);
//set readList empty
taskBto.setUserReadDetailList(Collections.emptyList());
return taskBto;
......@@ -126,7 +149,7 @@ public class TaskServiceImpl implements TaskService {
taskBto.setBillStatus(statusEnum.id);
//list add 0,point++
taskBto.getInvolveUserIdList().add(0);
taskBto.setCurrentPoint(taskBto.getCurrentPoint()+1);
taskBto.setCurrentPoint(taskBto.getCurrentPoint() + 1);
//set readList empty
taskBto.setUserReadDetailList(Collections.emptyList());
//set customInfo
......@@ -146,7 +169,7 @@ public class TaskServiceImpl implements TaskService {
taskBto.setBillStatus(statusEnum.id);
//list add userId,point++
taskBto.getInvolveUserIdList().add(userId);
taskBto.setCurrentPoint(taskBto.getCurrentPoint()+1);
taskBto.setCurrentPoint(taskBto.getCurrentPoint() + 1);
//set readList empty
taskBto.setUserReadDetailList(Collections.emptyList());
return taskBto;
......@@ -166,7 +189,7 @@ public class TaskServiceImpl implements TaskService {
taskBto.setBillStatus(statusEnum.id);
//list add userId,point++
taskBto.getInvolveUserIdList().add(userId);
taskBto.setCurrentPoint(taskBto.getCurrentPoint()+1);
taskBto.setCurrentPoint(taskBto.getCurrentPoint() + 1);
//set readList empty
taskBto.setUserReadDetailList(Collections.emptyList());
//set customInfo
......@@ -205,8 +228,6 @@ public class TaskServiceImpl implements TaskService {
/**
* 更新Task
*
* @param taskBto
*/
@Override
public Task update(TaskBto taskBto) {
......@@ -215,8 +236,6 @@ public class TaskServiceImpl implements TaskService {
/**
* 根据id获得Task
*
* @param id
*/
@Override
public TaskBto get(Integer id) {
......@@ -226,20 +245,182 @@ public class TaskServiceImpl implements TaskService {
/**
* 根据billId和businessType获得Task
*
* @param billId
* @param businessType
*/
@Override
public TaskBto get(Integer billId, Integer businessType) {
return taskDao.findByBillIdAndBusinessType(billId,businessType).parse2Bto();
return taskDao.findByBillIdAndBusinessType(billId, businessType).parse2Bto();
}
/**
* @param taskSelectVo 获取跟踪和待办业务列表
* @param taskSelectVo
* 获取跟踪和待办业务列表
*/
@Override
public List<Task> getList(TaskSelectVo taskSelectVo) {
public List<TaskUserVo> getList(TaskSelectVo taskSelectVo) {
List<TaskUserVo> taskEntities = getTaskUserVoList(taskSelectVo);
if (taskSelectVo.getOrders() != null) {
//根据vo待办和跟踪时间的查询顺序按顺序或降序排序输出
if (taskSelectVo.getSelectNum() == 2 && "trackingTime".equals(taskSelectVo.getOrders().get(0).getCoulmn())) {
if ("ASC".equals(taskSelectVo.getOrders().get(0).getDirection().toString())) {
return taskUtils.orderByTrackingTimeDateAsc(taskEntities);
}
if ("DESC".equals(taskSelectVo.getOrders().get(0).getDirection().toString())) {
return taskUtils.orderByTrackingTimeDateDesc(taskEntities);
}
}
if (taskSelectVo.getSelectNum() == 3 && "userTime".equals(taskSelectVo.getOrders().get(0).getCoulmn())) {
if ("ASC".equals(taskSelectVo.getOrders().get(0).getDirection().toString())) {
return taskUtils.orderByUserTimeDateAsc(taskEntities);
}
if ("DESC".equals(taskSelectVo.getOrders().get(0).getDirection().toString())) {
return taskUtils.orderByUserTimeDateDesc(taskEntities);
}
}
}
return taskEntities;
}
/**
* @param taskSelectVo 查询vo
* 查询跟踪和待办列表
* @return taskUserVo列表
*/
private List<TaskUserVo> getTaskUserVoList(TaskSelectVo taskSelectVo) {
Integer userId = userUtils.getCurrentUserId();
Integer bussinessType = taskSelectVo.getBussinessType();
//筛选出未完结和封存业务,映射成bto
List<TaskBto> taskBtos = taskDao.findAll().stream()
.filter(task -> (!task.getBillStatus().equals(StatusEnum.END.id))&&(!task.getBillStatus().equals(StatusEnum.ARCHIVE.id)))
.map(Task::parse2Bto)
.collect(Collectors.toList());
//查询待办
if (taskSelectVo.getSelectNum() == 2) {
//当前指针对应userId是当前用户或者为0且所属单位为当前单位
List<TaskBto> taskBtoList = taskBtos.stream()
.filter(taskBto -> userId.equals(taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint())) || (taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint()) == 0 && taskBto.getOwnUnit().equals(userUtils.getCurrentUnitId())))
.collect(Collectors.toList());
//查询所有的业务
if (bussinessType == null) {
List<TaskUserVo> taskUserVos = taskBtoList.stream().map(TaskBto::toVo).collect(Collectors.toList());
return setTaskUserVo(taskUserVos,0);
} else {
//查询工作台其它业务
if (bussinessType == 0) {
List<TaskUserVo> taskUserVos = taskBtoList.stream()
.filter(taskBto -> !new ArrayList<>(Arrays.asList(3,4,5,6)).contains(taskBto.getBusinessType()))
.map(TaskBto::toVo)
.collect(Collectors.toList());
return setTaskUserVo(taskUserVos,0);
}
//查询某一业务
else {
List<TaskUserVo> taskUserVos = taskBtoList.stream()
.filter(taskBto -> taskBto.getBusinessType().equals(bussinessType))
.map(TaskBto::toVo)
.collect(Collectors.toList());
return setTaskUserVo(taskUserVos,0);
}
}
}
//查询跟踪
if (taskSelectVo.getSelectNum() == 3) {
//涉及人员包括当前用户且指针对应UserId不是当前用户
List<TaskBto> taskBtoList = taskBtos.stream()
.filter(taskBto -> taskBto.getInvolveUserIdList().contains(userId)&&!userId.equals(taskBto.getInvolveUserIdList().get(taskBto.getCurrentPoint())))
.collect(Collectors.toList());
//查询所有业务
if (bussinessType == null) {
List<TaskUserVo> taskUserVos = taskBtoList.stream().map(TaskBto::toVo).collect(Collectors.toList());
return setTaskUserVo(taskUserVos,1);
} else {
//查询工作台其它业务
if (bussinessType == 0) {
List<TaskUserVo> taskUserVos = taskBtoList.stream()
.filter(taskBto -> !new ArrayList<>(Arrays.asList(3,4,5,6)).contains(taskBto.getBusinessType()))
.map(TaskBto::toVo)
.collect(Collectors.toList());
return setTaskUserVo(taskUserVos,1);
}
//查询某一业务
else {
List<TaskUserVo> taskUserVos = taskBtoList.stream()
.filter(taskBto -> taskBto.getBusinessType().equals(bussinessType))
.map(TaskBto::toVo)
.collect(Collectors.toList());
return setTaskUserVo(taskUserVos,1);
}
}
} else {
throw new ApiException(ResultUtil.failed("selectNum只能为2或3"));
}
}
/**
* @param list taskUserVos
* @param type 0:set待办 1:set跟踪
* set一些输出给前端的值
*/
private List<TaskUserVo> setTaskUserVo(List<TaskUserVo> list, int type) {
Integer userId = userUtils.getCurrentUserId();
list.forEach(taskUserVo -> {
List<Integer> idList = taskUserVo.getUserReadDetailList();
List<Integer> idList2 = taskUserVo.getTopFlagDetailList();
if (taskUserVo.getInvolveUserIdList() != null && taskUserVo.getInvolveUserIdList().size() > 0) {
//筛选出userId大于0的
List<Integer> userIds = taskUserVo.getInvolveUserIdList().stream().filter(integer -> integer > 0).collect(Collectors.toList());
if (userIds.size() > 0) {
//List最后一个id即为最新经办人
taskUserVo.setProcessingUser(userPublicService.getOne(userIds.get(userIds.size() - 1)).getName());
}
}
//判断当前用户是否已读
if (idList.contains(userId)) {
taskUserVo.setIsRead(1);
}
//判断当前用户是否置顶
if (idList2.contains(userId)) {
taskUserVo.setIsTop(1);
}
//set待办时间
if (type == 0) {
long time = System.currentTimeMillis() - taskUserVo.getUpdateTime().getTime();
int day = new Long(time / 86_400_000).intValue();
int hour = new Long((time % 86_400_000) / 3_600_000).intValue();
taskUserVo.setTrackingTime(day + "天" + hour + "小时");
taskUserVo.setTrackingTimeDate(new Date(time));
}
//set跟踪时间
if (type == 1) {
Date userTime = getUserTime(taskUserVo.getId());
if (userTime == null) {
taskUserVo.setUserTime("0天0小时");
taskUserVo.setUserTimeDate(new Date(0));
}
else {
long time = System.currentTimeMillis() - userTime.getTime();
int day = new Long(time / 86_400_000).intValue();
int hour = new Long((time % 86_400_000) / 3_600_000).intValue();
taskUserVo.setUserTime(day + "天" + hour + "小时");
taskUserVo.setUserTimeDate(new Date(time));
}
}
});
return list;
}
/**
* @param taskId 业务id
* 获取当前用户上次处理业务时间
*/
private Date getUserTime(Integer taskId) {
List<TaskLog> list = taskLogDao.getAllByTaskId(taskId);
if (list.size()>0) {
//筛选出当前用户操作该业务的所有日志,根据业务日志的创建时间降序排列,得到最新的上一次操作时间
List<TaskLog> taskLogs = taskUtils.orderByCreateTimeDesc(list.stream().filter(taskLog -> taskLog.getCreateUserId().equals(userUtils.getCurrentUserId())).collect(Collectors.toList()));
return taskLogs.get(0).getCreateTime();
}
else {
return null;
}
}
}
package com.tykj.dev.device.task.subject.bto;
import com.tykj.dev.device.task.subject.common.GlobalMap;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.StringSplitUtil;
import io.swagger.annotations.ApiModelProperty;
......@@ -9,11 +11,10 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -22,8 +23,12 @@ import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Repository
public class TaskBto {
@Autowired
private UserPublicService userPublicService;
@ApiModelProperty(value = "主键id")
private Integer id;
......@@ -54,6 +59,15 @@ public class TaskBto {
@ApiModelProperty(value = "自定义信息,针对不同业务需要保存一些自定信息")
private String customInfo;
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "置顶用户id的List")
private List<Integer> topFlagDetailList;
......@@ -86,7 +100,9 @@ public class TaskBto {
//复制相同属性
ModelMapper modelMapper = BeanHelper.getUserMapper();
TaskUserVo taskUserVo = modelMapper.map(this,TaskUserVo.class);
//set vo字段 toDo
//set vo字段
taskUserVo.setStartUnit(userPublicService.findUnitsNameByUserId(this.createUserId));
taskUserVo.setStatus(GlobalMap.getStatusEnumMap().get(this.billStatus).name);
return taskUserVo;
}
......
......@@ -17,7 +17,7 @@ public class GlobalMap {
.collect(Collectors.toMap(statusEnum -> statusEnum.id, Function.identity()));
}
public static Map<Integer, StatusEnum> getHashMap() {
public static Map<Integer, StatusEnum> getStatusEnumMap() {
return statusEnumMap;
}
}
......@@ -85,7 +85,13 @@ public enum StatusEnum {
/**
* 自查待审核
*/
SELF_CHECK_CONFIRM(401,"自查待审核");
SELF_CHECK_CONFIRM(401,"自查待审核"),
/**
* 装备申请待批复
*/
DEVICE_APPLY_CONFIRM(500,"装备申请待批复"),
;
public Integer id;
......
......@@ -53,6 +53,12 @@ public class TaskUserVo {
@ApiModelProperty(value = "工作涉及人员id")
private List<Integer> involveUserIdList;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "跟踪时间")
@Transient
private String userTime;
......
package com.tykj.dev.device.task.utils;
import com.tykj.dev.device.task.subject.domin.TaskLog;
import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
/**
* @author dengdiyi
* task工具类
*/
@Component
public class TaskUtils {
/**
* @param list 业务日志list
* 按照日志创建时间降序排列
*/
public List<TaskLog> orderByCreateTimeDesc(List<TaskLog> list){
Collections.sort(list, (o1, o2) -> {
int flag = o2.getCreateTime().compareTo(o1.getCreateTime());
return flag;
});
return list;
}
/**
* @param list taskUserVo list
* 按照跟踪时间增序排列
*/
public List<TaskUserVo> orderByUserTimeDateAsc(List<TaskUserVo> list){
Collections.sort(list, (o1, o2) -> {
int flag = o1.getUserTimeDate().compareTo(o2.getUserTimeDate());
return flag;
});
return list;
}
/**
* @param list taskUserVo list
* 按照跟踪时间降序排列
*/
public List<TaskUserVo> orderByUserTimeDateDesc(List<TaskUserVo> list){
Collections.sort(list, (o1, o2) -> {
int flag = o2.getUserTimeDate().compareTo(o1.getUserTimeDate());
return flag;
});
return list;
}
/**
* @param list taskUserVo list
* 按照待办时间增序排列
*/
public List<TaskUserVo> orderByTrackingTimeDateAsc(List<TaskUserVo> list){
Collections.sort(list, (o1, o2) -> {
int flag = o1.getTrackingTimeDate().compareTo(o2.getTrackingTimeDate());
return flag;
});
return list;
}
/**
* @param list taskUserVo list
* 按照待办时间降序排列
*/
public List<TaskUserVo> orderByTrackingTimeDateDesc(List<TaskUserVo> list){
Collections.sort(list, (o1, o2) -> {
int flag = o2.getTrackingTimeDate().compareTo(o1.getTrackingTimeDate());
return flag;
});
return list;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论