提交 1fdf171f authored 作者: 133's avatar 133

[清退] 代码提交

上级 f12f5dfb
......@@ -209,4 +209,11 @@ public class DeviceLibrary {
childs.add(deviceLibraryEntity);
}
public DeviceLibrary toVo(){
if (!this.locationUnit.equals(this.ownUnit)){
this.manageStatus=0;
}
return this;
}
}
......@@ -54,12 +54,15 @@ public enum StatusEnum {
* 清退任务
*/
//以下为stat状态
SEND_BACK_1200(1200, "省清退查看"),
SEND_BACK_1200(1200, "省清退查看"),
SEND_BACK_1201(1201, "统计数据等待办结"),
SEND_BACK_1202(1202, "待审核"),
SEND_BACK_1202(1202, "出库待审核"),
SEND_BACK_1203(1203, "出库待校验"),
SEND_BACK_1204(1204, "入库待审核"),
SEND_BACK_1205(1205, "装备入库发起成功等待审核"),
SEND_BACK_1205(1205, "异常装备待描述"),
SEND_BACK_1206(1206, "入库待校验"),
SEND_BACK_1207(1207, "异常装备确认"),
// SEND_BACK_1204(1204, "入库待审核"),
......
......@@ -71,7 +71,7 @@ public class SendBackController {
@ApiOperation(value = "清退装备校对发起——专管员A",notes = "清退装备校对发起——专管员A")
@PostMapping("/sendBackOutCheck/{userId}/{taskId}")
@GetMapping("/sendBackOutCheck/{userId}/{taskId}")
ResponseEntity sendBackOutCheck(@PathVariable("taskId") Integer taskId,@PathVariable("userId") Integer userId){
return sendBackService.sendBackOutCheck(taskId,userId);
}
......@@ -79,7 +79,7 @@ public class SendBackController {
@ApiOperation(value = "装备出库发起——专管员A",notes = "装备出库发起——专管员A")
@PostMapping("/sendBackOut/{taskId}/{userId}")
@PostMapping("/sendBackOut/{userId}/{taskId}")
ResponseEntity sendBackOut(@PathVariable("taskId") Integer taskId, @RequestBody SendBackOutVo sendBackOut, @PathVariable("userId") Integer userId){
return sendBackService.sendBackOut(taskId,sendBackOut,userId);
......
......@@ -98,4 +98,6 @@ public class SendBackBill {
@ApiModelProperty(value = "清退单id")
private Integer formId;
@ApiModelProperty(value = "是否完成")
private Integer isComplete;
}
......@@ -52,6 +52,18 @@ public class SendBackOutVo {
@ApiModelProperty(value = "出库装备清单")
private List<DeviceLibrary> deviceLibraryEntities;
/**
* 接收方入库检查详情(装备主键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台,新增一条
*/
@ApiModelProperty(value = "接收方检查结果(缺失数量x新增数量),例如1x1,意为缺失1台,新增一条")
private String receiveCheckResult;
//
// @ApiModelProperty(value = "非在库装备")
// private List<DeviceLibraryEntity> unDeviceLibraryEntities;
......
......@@ -24,7 +24,7 @@ public class SendBackRequst {
@ApiModelProperty(value = "父task的Id")
private Integer parentTaskId;
@ApiModelProperty(value = "在库装备备注")
@ApiModelProperty(value = "在库装备备注")
private HashMap<Integer,UnDeviceDesVo> unDeviceDes;
@ApiModelProperty(value = "查询类型,0:省级 1:市级 2:区县级")
......
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -37,13 +38,7 @@ public class SendBackVo {
@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;
......
......@@ -13,6 +13,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
*/
public interface SendBackBillDetailDao extends JpaRepository<SendBackBillDetail,Integer>, JpaSpecificationExecutor<SendBackBillDetail> {
SendBackBillDetail findSendBackBillDetailEntityById(Integer id);
SendBackBillDetail findSendBackBillDetailById(Integer id);
}
......@@ -75,6 +75,8 @@ public interface SendBackService {
*/
ResponseEntity sendBackOutExamine(Integer taskId, Integer startUserId, Integer type);
/**
* 入库-专管员B
* 1、通过,完结task
......@@ -107,6 +109,7 @@ public interface SendBackService {
ResponseEntity saveSendBackBillDetailEntity(SendBackBillDetail sendBackBillDetailEntity);
ResponseEntity sendBackInCheck(Integer taskId, SendBackOutVo sendBackOut, Integer userId);
/**
......
......@@ -5,9 +5,8 @@ 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.service.DeviceLibraryService;
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.*;
......@@ -65,21 +64,19 @@ public class SendBackServiceImpl implements SendBackService {
private final SendBackBillDetailDao sendBackBillDetailEntityDao;
private final DeviceLogService deviceLogService;
@Autowired
DeviceLibraryService deviceLibraryService;
@Autowired
public SendBackServiceImpl(TaskService taskService,DeviceLibraryDao deviceLibraryDao, SendBackBillDao sendBackBillEntityDao, TaskDao taskDao, UnitsDao unitsDao, AreaDao areaDao, UserDao userDao, UserDao userDao1, SendBackBillDetailDao sendBackBillDetailEntityDao, DeviceLogService deviceLogService) {
public SendBackServiceImpl(TaskService taskService,DeviceLibraryDao deviceLibraryDao, SendBackBillDao sendBackBillEntityDao, TaskDao taskDao, UnitsDao unitsDao, AreaDao areaDao, UserDao userDao, UserDao userDao1, SendBackBillDetailDao sendBackBillDetailEntityDao) {
this.taskService=taskService;
this.deviceLibraryDao = deviceLibraryDao;
this.sendBackBillEntityDao = sendBackBillEntityDao;
this.taskDao = taskDao;
this.unitsDao = unitsDao;
this.areaDao = areaDao;
this.userDao = userDao1;
this.userDao = userDao;
this.sendBackBillDetailEntityDao = sendBackBillDetailEntityDao;
this.deviceLogService = deviceLogService;
}
/**
......@@ -127,7 +124,7 @@ public class SendBackServiceImpl implements SendBackService {
添加省级任务和账单
*/
List<Area> area = areaDao.findByFatherId(null);
TaskBto taskBto = addTaskStatus(0, JSON.toJSONString(sendBack), idString.toString(),area.get(0).getId(),startUserId,sendBackVo.getTime());
TaskBto taskBto = addTaskStatus( JSON.toJSONString(sendBack), idString.toString(),area.get(0).getId(),startUserId,sendBackVo.getTime());
/*
添加各单位的Task
......@@ -147,7 +144,6 @@ public class SendBackServiceImpl implements SendBackService {
@Override
public ResponseEntity getSendBackByTask(Integer taskId) {
TaskBto taskBto = taskService.get(taskId);
/*
判断任务状态,5为进行中,返回列表或统计表,16位出库待审核,返回出库单
*/
......@@ -159,15 +155,13 @@ public class SendBackServiceImpl implements SendBackService {
List<Integer> idList = stringToList(billEntity.getInvoleDevice());
String send = billEntity.getSendBackStatistical();
if(billStatus == 5){
if(billStatus == 1200 || billStatus.equals(StatusEnum.SEND_BACK_1201.id)){
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);
......@@ -186,21 +180,50 @@ public class SendBackServiceImpl implements SendBackService {
}
}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);
// SendBackVo newSend = newStatistical(idList, 1, sendBackVo, false);
sendBackVo.setAreaToTaskId(areaToTaskId);
sendBackVo.setTime(sendBackVo.getTime());
sendBackVo.setName(sendBackVo.getName());
List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>(sendBackVo.getMap().values());
sendBackVo.setDataList(dataList);
return ResponseEntity.ok(sendBackVo);
}
}else if(billStatus == 27 || billStatus == 18){
//27 出库待校验 18 入库待审核
}else if(billStatus.equals(StatusEnum.SEND_BACK_1202.id) ){
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());
}else if (billStatus.equals(StatusEnum.SEND_BACK_1204.id)){
SendBackBillDetail sendBackBillDetail= sendBackBillDetailEntityDao.findSendBackBillDetailById(billEntity.getFormId());
List<DeviceLibrary> deviceLibraryEntities = new ArrayList<>();
String str2=sendBackBillDetail.getReceiveCheckDetail();
if (str2!=null) {
String[] strings1 = str2.split("x");
for (String s : strings1) {
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setCheckResult(checkResult);
deviceLibraryEntities.add(deviceLibraryEntity);
}
}
}
sendBackBillDetail.setDeviceLibraryEntities(deviceLibraryEntities);
return ResponseEntity.ok(sendBackBillDetail);
} else if(billStatus == 10 || billStatus.equals(StatusEnum.SEND_BACK_1206.id)){
//10待审核 28入库待校验
if (send==null || send.equals("null")){
send=billEntity.getSendBackOut();
}
SendBackBillDetail one = sendBackBillDetailEntityDao.findSendBackBillDetailById(billEntity.getFormId());
one.setDeviceLibraryEntities(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList));
SendBackVo sendBackVo = JSONObject.parseObject(send,SendBackVo.class);
one.setTime(sendBackVo.getTime());
......@@ -214,13 +237,9 @@ public class SendBackServiceImpl implements SendBackService {
return ResponseEntity.ok("*****");
}
/**
* 异常提交
* @return 成功
*/
@Transactional
@Override
public ResponseEntity exceptionTask(SendBackRequst sendBackRequst, Integer parentTaskId, Integer userId) {
public ResponseEntity exceptionTask(SendBackRequst sendBackRequst,Integer parentTaskId,Integer userId) {
List<Integer> deviceIdList = sendBackRequst.getDeviceIdList();
......@@ -232,21 +251,22 @@ public class SendBackServiceImpl implements SendBackService {
HashMap<String,List<Integer>> locationUnitList = new HashMap<>();
HashMap<String,List<UnDeviceDesVo>> desList = new HashMap<>();
for (DeviceLibrary DeviceLibrary : deviceLibraryEntitiesByIdIn) {
String locationUnit = DeviceLibrary.getLocationUnit();
for (DeviceLibrary deviceLibraryEntity : deviceLibraryEntitiesByIdIn) {
String locationUnit = deviceLibraryEntity.getLocationUnit();
List<Integer> ids = locationUnitList.get(locationUnit);
if(ids == null){
ids = new ArrayList<>();
}
ids.add(DeviceLibrary.getId());
ids.add(deviceLibraryEntity.getId());
locationUnitList.put(locationUnit,ids);
List<UnDeviceDesVo> unDeviceDesVos = desList.get(locationUnit);
if(unDeviceDesVos == null){
unDeviceDesVos = new ArrayList<>();
}
unDeviceDesVos.add(unDeviceDes.get(DeviceLibrary.getId()));
unDeviceDesVos.add(unDeviceDes.get(deviceLibraryEntity.getId()));
desList.put(locationUnit,unDeviceDesVos);
}
......@@ -274,9 +294,8 @@ public class SendBackServiceImpl implements SendBackService {
/*
待审核
*/
taskSaveVo.setBillStatus(StatusEnum.SEND_BACK_1202.id);
taskSaveVo.setBusinessType(BusinessEnum.SEND_BACK_EXCEPTION.id);
taskSaveVo.setBillStatus(StatusEnum.SEND_BACK_1207.id);
taskSaveVo.setBusinessType(BusinessEnum.SEND_BACK.id);
/*
设置所属单位
*/
......@@ -285,13 +304,14 @@ public class SendBackServiceImpl implements SendBackService {
taskSaveVo.setParentTaskId(parentTaskId);
taskSaveVo.setNodeIdDetail("");
List<Integer> integerList=new ArrayList<>();
integerList.add(userId);
integerList.add(0);
taskSaveVo.setCurrentPoint(0);
taskSaveVo.setInvolveUserIdList(integerList);
taskSaveVo.setCustomInfo("0");
taskService.start(taskSaveVo);
/*
保存task
*/
taskService.start(taskSaveVo);
/*
生成一条代办的job,生成一条跟踪的job
*/
......@@ -402,11 +422,12 @@ public class SendBackServiceImpl implements SendBackService {
*/
sendBackOutVo.setActualOut(idList.size());
sendBackOutVo.setShouldOut(idList.size());
sendBackOutVo.setDeviceLibraryEntities(deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList));
List<DeviceLibrary> deviceLibraries= deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).stream().map(DeviceLibrary::toVo).collect(Collectors.toList());
sendBackOutVo.setDeviceLibraryEntities(deviceLibraries);
billEntity.setSendBackOut(JSON.toJSONString(sendBackOutVo));
// billEntity.setSendBackOut(JSON.toJSONString(sendBackOutVo));
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,userId);
// taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,userId);
/*
结束上一个job,生成新的job
*/
......@@ -433,11 +454,44 @@ public class SendBackServiceImpl implements SendBackService {
保存出库清单
*/
TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.getOne(taskEntity.getOwnUnit());
Area area = areaDao.getOne(unit.getAreaId());
List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId());
// taskEntity.setBillStatus(18);
SendBackBill bill = sendBackBillEntityDao.getOne(taskEntity.getBillId());
bill.setSendBackOut(JSON.toJSONString(sendBackOut));
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1204,sendBackOut.getReviewerNameId());
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,sendBackOut.getReviewerNameId());
/*
生成清退的表格
*/
SendBackBillDetail sendBackBillDetailEntity = new SendBackBillDetail();
sendBackBillDetailEntity.setSendUnit(unit.getName());
sendBackBillDetailEntity.setSendUserAName(sendBackOut.getName());
sendBackBillDetailEntity.setSendUserAId(sendBackOut.getId());
sendBackBillDetailEntity.setSendUserBName(sendBackOut.getReviewerName());
sendBackBillDetailEntity.setSendUserBId(sendBackOut.getReviewerNameId());
sendBackBillDetailEntity.setSendTime(new Date());
sendBackBillDetailEntity.setSendedCount(sendBackOut.getShouldOut());
sendBackBillDetailEntity.setSendBackCount(sendBackOut.getActualOut());
sendBackBillDetailEntity.setSendBackStatus(1);
sendBackBillDetailEntity.setFileName(sendBackOut.getFileName());
sendBackBillDetailEntity.setFileUrl(sendBackOut.getUrl());
sendBackBillDetailEntity.setDeleteTag(0);
sendBackBillDetailEntity.setApplyNumber("");
sendBackBillDetailEntity.setReplayNumber("");
sendBackBillDetailEntity.setReceiveUnit(fatherUnit.get(0).getName());
sendBackBillDetailEntity.setReceiveUserAId(0);
sendBackBillDetailEntity.setSendCheckDetail(sendBackOut.getReceiveCheckDetail());
sendBackBillDetailEntity.setSendCheckResult(sendBackOut.getReceiveCheckResult());
sendBackBillDetailEntity.setNum("第"+new Date().getYear()+"QT"+taskEntity.getBillId()+"号");
SendBackBillDetail backBillDetailEntity = sendBackBillDetailEntityDao.save(sendBackBillDetailEntity);
bill.setFormId(backBillDetailEntity.getId());
/*
新增job
*/
......@@ -471,8 +525,8 @@ public class SendBackServiceImpl implements SendBackService {
Area area = areaDao.getOne(unit.getAreaId());
List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId());
taskService.moveToEnd(taskEntity);
taskEntity.setOwnUnit(fatherUnit.get(0).getUnitId());
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1206,0);
// taskEntity.setBillStatus(13);
//
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
......@@ -483,67 +537,68 @@ public class SendBackServiceImpl implements SendBackService {
/*
获取账单
*/
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()+"通过审核,装备出库","");
// SendBackBill sendBackBill = sendBackBillEntityDao.getOne(taskEntity.getBillId());
// SendBackOutVo sendBackOutVo = JSON.parseObject(sendBackBill.getSendBackOut(), new TypeReference<SendBackOutVo>() {
// });
/*
生成新的Task
*/
TaskBto taskSaveVo = new TaskBto();
// 生成清退的表格
// */
// 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());
/*
账单与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);
// 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.setBusinessType(BusinessEnum.SEND_BACK.id);
// taskSaveVo.setParentTaskId(taskEntity.getId());
// taskSaveVo.setBillStatus(StatusEnum.SEND_BACK_1206.id);
// taskSaveVo.setOwnUnit(fatherUnit.get(0).getUnitId());
// List<Integer> integerList=new ArrayList<>();
// integerList.add(userId);
// integerList.add(0);
// taskSaveVo.setInvolveUserIdList(integerList);
// taskSaveVo.setCurrentPoint(1);
// 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()+"发起入库申请","");
......@@ -551,6 +606,7 @@ public class SendBackServiceImpl implements SendBackService {
return ResponseEntity.ok("装配入库申请发送成功");
}
/**
* 入库-专管员B
* 1、通过,完结task
......@@ -579,7 +635,7 @@ public class SendBackServiceImpl implements SendBackService {
/*
结束上级task和job
*/
TaskBto parentTask = taskService.get(taskEntity.getParentTaskId());
// TaskBto parentTask = taskService.get(taskEntity.getParentTaskId());
// parentTask.setBillStatus(13);
// JobEntity parentJob = jobDao.findByTaskIdAndIsDone(taskEntity.getParentTaskId(), 0);
// parentJob.setIsDone(1);
......@@ -587,13 +643,15 @@ public class SendBackServiceImpl implements SendBackService {
//
//
// taskDao.save(taskEntity);
taskService.moveToEnd(parentTask);
// taskService.moveToEnd(parentTask);
/*
修改装备是所属单位
*/
Integer billId = taskEntity.getBillId();
SendBackBill bill = sendBackBillEntityDao.getOne(billId);
bill.setIsComplete(1);
sendBackBillEntityDao.save(bill);
List<Integer> idList = stringToList(bill.getInvoleDevice());
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
for (DeviceLibrary d:deviceList) {
......@@ -601,13 +659,67 @@ public class SendBackServiceImpl implements SendBackService {
d.setOwnUnit(unit.getName());
d.setManageStatus(1);
}
deviceLibraryDao.saveAll(deviceList);
/*
//父类task
TaskBto fatherTaskBto = taskService.get(taskEntity.getParentTaskId());;
SendBackBill fatherBill = sendBackBillEntityDao.getOne(fatherTaskBto.getBillId());
String send=fatherBill.getSendBackStatistical();
SendBackVo sendBackVo= JSONObject.parseObject(send,SendBackVo.class);
/*
将入库结果反馈给下级,由于两个task使用的是同一个账单,所以数据已反馈
*/
SendBackBillDetail sendBackBillDetail= sendBackBillDetailEntityDao.findSendBackBillDetailById(bill.getFormId());
Units units= unitsDao.findByName(sendBackBillDetail.getSendUnit());
Area area= areaDao.findById(units.getAreaId()).get();
updateStatistical(idList,area.getName(),sendBackVo);
//查询当前task上级task
//查询当前task上级task所有子task
List<Task> taskList=taskDao.findAllByParentTaskId(fatherTaskBto.getId());
//判断对应的bill是否完成
List<Integer> integers=taskList.stream().map(Task::getBillId).collect(Collectors.toList());
boolean flag = sendBackBillEntityDao.findAllById(integers).stream().allMatch(e->e.getIsComplete()==1);
if (flag){
if (fatherTaskBto.getParentTaskId()!=null) {
taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1203, 0);
SendBackBill billEntity = sendBackBillEntityDao.getOne(fatherTaskBto.getBillId());
List<Integer> integerList= findInvoleDevice(billEntity.getInvoleDevice()).stream().map(DeviceLibrary::getId).collect(Collectors.toList());
addExceptionTask(fatherTaskBto.getId(),integerList,fatherTaskBto.getOwnUnit(),0,fatherBill.getDeadLine());
}else {
sendBackVo.setStatus(0);
fatherBill.setSendBackStatistical(JSON.toJSONString(sendBackVo));
sendBackBillEntityDao.save(fatherBill);
taskService.moveToSpecial(fatherTaskBto,StatusEnum.SEND_BACK_1201,fatherTaskBto.getCreateUserId());
}
}
return ResponseEntity.ok("装备已入库");
}
private List<DeviceLibrary> findInvoleDevice(String involeDevice){
List<String> idStringList = Arrays.asList(involeDevice.split("x"));
List<String> idListString = idStringList.stream().filter(list2->!list2.equals("")).collect(Collectors.toList());
System.out.println(idListString);
List<Integer> devIds = idListString.stream().map(Integer::parseInt).collect(Collectors.toList());
return deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(devIds);
}
private TaskBto task(Integer taskId){
TaskBto taskBto = taskService.get(taskId);
if ( taskBto.getParentTaskId()==null){
return taskBto;
}
return task(taskBto.getParentTaskId());
}
/**
* 业务详情
* @param taskId taskid
......@@ -743,14 +855,19 @@ public class SendBackServiceImpl implements SendBackService {
SendBackBillDetail form = sendBackBillDetailEntityDao.getOne(bill.getFormId());
form.setReceiveUserAId(userId);
form.setReceiveUserAName(user.getName());
form.setBillFileUrl(sendBackOut.getReturnNoteUrl());
form.setBillFileName(sendBackOut.getReturnNoteName());
form.setBillFileUrl(sendBackOut.getUrl());
form.setBillFileName(sendBackOut.getFileName());
form.setReceiveCheckDetail(sendBackOut.getReceiveCheckDetail());
form.setReceiveCheckResult(sendBackOut.getReceiveCheckResult());
form.setReceiveCount(sendBackOut.getActualOut());
form.setSendedCount(sendBackOut.getShouldOut());
form.setReceiveUserBId(sendBackOut.getReviewerNameId());
form.setReceiveUserBName(sendBackOut.getReviewerName());
sendBackBillDetailEntityDao.save(form);
/*
task 推入 19
*/
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1205,sendBackOut.getReviewerNameId());
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1204,sendBackOut.getReviewerNameId());
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,sendBackOut.getReviewerNameId(),0);
......@@ -798,6 +915,78 @@ public class SendBackServiceImpl implements SendBackService {
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
/*
生成省级及以下的Task
*/
List<Integer> integers=new ArrayList<>();
integers= userDao.findAllByUnitsId(unitId).stream().map(User::getUserId).collect(Collectors.toList());
integers.add(-1);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1200.id,"装备清退",parentTaskId,".",billEntity.getId(), BusinessEnum.SEND_BACK.id,unitId,integers.size()-1,null,integers));
}
/**
* 代办
* @param parentTaskId
* @param sendBackVo
* @param idString
* @param unitId
* @param startUserId
* @param deadLine
* @return
*/
private TaskBto addTask1203(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(0);
/*
保存省级的task
*/
// addJob(task.getId(),task.getBillStatus(),startUserId,null,0,0);
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1203.id,"装备清退",parentTaskId,".",billEntity.getId(), BusinessEnum.SEND_BACK.id,unitId,0,null,integers));
}
/**
* 县生成异常事件
*
*/
private TaskBto addExceptionTask(int parentTaskId, List<Integer> idString, Integer unitId, Integer startUserId, Date deadLine){
/*
一个task,绑定一个账单,账单中存放装备ID和初始化清退单
*/
StringBuffer localIds =new StringBuffer();
idString.forEach(
id-> localIds.append("x").append(id)
);
SendBackBill sendBackBillEntity = new SendBackBill();
sendBackBillEntity.setSendBackStatistical(null);
sendBackBillEntity.setInvoleDevice(localIds.toString());
sendBackBillEntity.setDeadLine(deadLine);
sendBackBillEntity.setTitle("异常装备处理");
SendBackBill billEntity = sendBackBillEntityDao.save(sendBackBillEntity);
/*
生成省级及以下的Task
*/
......@@ -811,15 +1000,16 @@ public class SendBackServiceImpl implements SendBackService {
// 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));
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1205.id,"异常装备描述",parentTaskId,".",billEntity.getId(), BusinessEnum.SEND_BACK.id,unitId,0,null,integers));
}
/**
* 新建task
* @param sendBackVo 初始清退表单
* @param idString id集合
*/
private TaskBto addTaskStatus(int parentTaskId, String sendBackVo, String idString, Integer unitId, Integer startUserId, Date deadLine){
private TaskBto addTaskStatus( String sendBackVo, String idString, Integer unitId, Integer startUserId, Date deadLine){
/*
一个task,绑定一个账单,账单中存放装备ID和初始化清退单
......@@ -847,7 +1037,7 @@ public class SendBackServiceImpl implements SendBackService {
// 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));
return taskService.start(new TaskBto(StatusEnum.SEND_BACK_1200.id,"装备清退",null,".",billEntity.getId(), BusinessEnum.SEND_BACK.id,unitId,1,null,integers));
}
/**
......@@ -938,6 +1128,28 @@ public class SendBackServiceImpl implements SendBackService {
return unitToArea;
}
/**
* 修改统计内容 有提交需要修改提交状态
*/
private SendBackVo updateStatistical(List<Integer> idList,String areaName,SendBackVo sendBack){
HashMap<String,HashMap<String,StatisticalVo>> list= sendBack.getMap();
HashMap<String,String> map=new HashMap<>();
idList.forEach(
id -> {
DeviceLibrary deviceLibrary= deviceLibraryService.getOne(id);
map.put(deviceLibrary.getName(),"");
}
);
for (String name:map.keySet()){
StatisticalVo statisticalVo = list.get(name).get(areaName);
statisticalVo.setStatus(3);
}
return sendBack;
}
/**
* 统计表
*/
......@@ -967,7 +1179,7 @@ public class SendBackServiceImpl implements SendBackService {
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);
......@@ -976,7 +1188,7 @@ public class SendBackServiceImpl implements SendBackService {
if(!areaList.contains(areaName)){
areaList.add(areaName);
}
if(DeviceLibrary.getManageStatus() == 0){
if(!DeviceLibrary.getOwnUnit().equals(DeviceLibrary.getLocationUnit())){
unDevice.add(DeviceLibrary);
}
......@@ -987,6 +1199,7 @@ public class SendBackServiceImpl implements SendBackService {
//延迟状态
int delayStatus = 1;
if(sendBack == null){
/*
生成一张新的空表
......@@ -1050,16 +1263,17 @@ public class SendBackServiceImpl implements SendBackService {
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());
}
if (statisticalVo!=null) {
statisticalVo.setValCount(statisticalVo.getValCount() + 1);
statisticalVo.getDeviceIdList().add(d.getId());
if (first) {
statisticalVo.setAllCount(statisticalVo.getAllCount() + 1);
} else {
statisticalVo.setAllCount(list.get(model).get(areaName).getAllCount());
}
statisticalVo.getDeviceIdList().add(d.getId());
}
/*
存放总数和名字
*/
......@@ -1083,12 +1297,7 @@ public class SendBackServiceImpl implements SendBackService {
/*
返回的对象
*/
SendBackVo sendBackVo = new SendBackVo();
sendBackVo.setHeader(areaList);
sendBackVo.setDeviceIdList(idList);
sendBackVo.setUnDevice(unDevice);
sendBackVo.setAreaToIds(areaIdList);
sendBackVo.setModelToIds(modelIdList);
/*
计算状态 判断是否可以办结
......@@ -1108,11 +1317,22 @@ public class SendBackServiceImpl implements SendBackService {
}
// dataList.add(stringStatisticalVoHashMap);
}
if (sendBack==null) {
SendBackVo sendBackVo = new SendBackVo();
sendBackVo.setHeader(areaList);
sendBackVo.setDeviceIdList(idList);
sendBackVo.setUnDevice(unDevice);
sendBackVo.setAreaToIds(areaIdList);
sendBackVo.setModelToIds(modelIdList);
sendBackVo.setStatus(allStatus);
sendBackVo.setMap(newList);
return sendBackVo;
}else {
sendBack.setStatus(allStatus);
sendBack.setMap(newList);
return sendBack;
}
sendBackVo.setStatus(allStatus);
sendBackVo.setMap(newList);
return sendBackVo;
}
......@@ -1133,6 +1353,14 @@ public class SendBackServiceImpl implements SendBackService {
*/
HashMap<Integer,StringBuffer> unitDeviceIds = new HashMap<>();
//区县
HashMap<Integer,Integer> county=new HashMap<>();
//市
HashMap<Integer,Integer> city=new HashMap<>();
//区县不在库装备存储
HashMap<Integer,List<Integer>> countyNoLibrary=new HashMap<>();
/*
存放各单位的装备集合
*/
......@@ -1149,50 +1377,107 @@ public class SendBackServiceImpl implements SendBackService {
List<Integer> deviceIds = unitDevices.getOrDefault(unit.getUnitId(), new ArrayList<>());
deviceIds.add(device.getId());
unitDevices.put(0,deviceIds);
continue;
}
}else if (level == 2) {
List<Integer> deviceIds = unitDevices.getOrDefault(unit.getUnitId(), new ArrayList<>());
deviceIds.add(device.getId());
unitDevices.put(unit.getUnitId(), deviceIds);
List<Integer> deviceIds = unitDevices.getOrDefault(unit.getUnitId(), new ArrayList<>());
deviceIds.add(device.getId());
unitDevices.put(unit.getUnitId(),deviceIds);
if (!device.getOwnUnit().equals(device.getLocationUnit())) {
List<Integer> noLibrary = countyNoLibrary.getOrDefault(unit.getUnitId(), new ArrayList<>());
noLibrary.add(device.getId());
countyNoLibrary.put(unit.getUnitId(), noLibrary);
}
/*
将装备加入所属的单位
*/
StringBuffer localIds = unitDeviceIds.getOrDefault(unit.getUnitId(), new StringBuffer());
localIds.append("x").append(device.getId());
unitDeviceIds.put(unit.getUnitId(), localIds);
city.put(unit.getUnitId(),0);
}else if(level == 3){
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){
/*
将装备加入所属的单位
*/
StringBuffer localIds = unitDeviceIds.getOrDefault(unit.getUnitId(), new StringBuffer());
localIds.append("x").append(device.getId());
unitDeviceIds.put(unit.getUnitId(), localIds);
county.put(unit.getUnitId(),0);
/*
所属市
*/
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);
if (city.containsKey(parentUnit.getUnitId())){
city.put(parentUnit.getUnitId(),1);
}else {
city.put(parentUnit.getUnitId(),2);
}
}
}
Set<Integer> keySet = unitDeviceIds.keySet();
// Set<Integer> keySet = unitDeviceIds.keySet();
for (Integer key:keySet) {
HashMap<Integer,Integer> unitsAndTaskid=new HashMap<>();
for (Integer key:city.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 + "发起装备清退","");
if (city.get(key)==1) {
SendBackVo sendBack = newStatistical(stringToList(ids.toString()), 1,null,true);
sendBack.setName(name);
sendBack.setTime(time);
sendBack.setDeviceIdList(null);
TaskBto taskBto=addTask(parentId, JSON.toJSONString(sendBack), ids.toString(), key, userId, time);
unitsAndTaskid.put(key,taskBto.getId());
}else {
TaskBto taskBto= addTask1203(parentId, null, ids.toString(), key, userId, time);
unitsAndTaskid.put(key,taskBto.getId());
}
}
for (Integer key:county.keySet()){
StringBuffer ids = unitDeviceIds.get(key);
Units units = unitsDao.findById(key).get();
Area parentArea = unitToArea.get(units.getName());
Units parentUnit = unitsDao.findByAreaIdAndLevel(parentArea.getId(), 2);
TaskBto taskBto= addTask1203(unitsAndTaskid.get(parentUnit.getUnitId()), null, ids.toString(), key, userId, time);
if (countyNoLibrary.containsKey(key)){
addExceptionTask(taskBto.getId(),countyNoLibrary.get(key),key,userId,time);
}
}
// for (Integer key:keySet) {
// StringBuffer ids = unitDeviceIds.get(key);
// if (city.containsKey(key)){
// if (city.get(key)==1) {
// addTask(parentId, null, ids.toString(), key, userId, time);
// }else {
// addTask1203(parentId, null, ids.toString(), key, userId, time);
// }
// }else {
// Units units = unitsDao.findById(key).get();
// addTask1203(parentId, null, ids.toString(), key, userId, time);
// }
//// List<Integer> idToAddLog= unitDevices.get(key);
//// addLog(task.getId(),idToAddLog,name + "发起装备清退","");
// }
/*
添加省级装备的log
*/
......@@ -1202,16 +1487,6 @@ public class SendBackServiceImpl implements SendBackService {
}
/*
批量添加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]
*/
......
......@@ -51,4 +51,5 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
List<Task> findTaskEntitiesByParentTaskId(Integer parentTaskId);
Task findByBusinessTypeAndOwnUnitAndBillStatus(Integer type,Integer ownUnit,Integer billStatus);
}
......@@ -631,6 +631,9 @@ public class TaskServiceImpl implements TaskService {
if (list.size() > 0) {
//筛选出当前用户操作该业务的所有日志,根据业务日志的创建时间降序排列,得到最新的上一次操作时间
List<TaskLog> taskLogs = taskUtils.orderByCreateTimeDesc(list.stream().filter(taskLog -> taskLog.getCreateUserId().equals(userUtils.getCurrentUserId())).collect(Collectors.toList()));
if (taskLogs.size()==0){
return null;
}
return taskLogs.get(0).getCreateTime();
} else {
return null;
......
......@@ -26,7 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
* @createTime 2020年08月19日 09:36:00
*/
@RestController
@RequestMapping(value = "/user/handover/")
@RequestMapping(value = "/user/handover")
@AutoDocument
@Api(tags = "工作交接",description = "工作交接")
public class HandoverController {
......@@ -58,7 +58,7 @@ public class HandoverController {
}
@GetMapping(value = "/query/{workId}")
@ApiOperation(value = "完结工作交接")
@ApiOperation(value = "查询")
public ResponseEntity getHandoverUser( @PathVariable Integer workId) {
return ResponseEntity.ok(workHandoverService.findById(workId));
......
......@@ -169,9 +169,8 @@ public class TrainJobController {
// jobService.update(jobEntity);
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"不报名",null);
taskLogService.addLog(taskLogBto);
taskBto=taskService.moveToEnd(taskBto);
taskService.moveToEnd(taskBto);
}
taskService.update(taskBto);
myWebSocket.sendMessage1();
return ResponseEntity.ok(trainThemeService.save(trainTheme));
}
......@@ -187,10 +186,10 @@ public class TrainJobController {
TrainTheme trainTheme = trainThemeService.findById(trainId);
//查询所有必须报名而没有报名的task 状态直接转为待培训
trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1001.id).forEach(
taskBto -> taskService.update(taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1))
taskBto -> taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1)
);
trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1002.id).forEach(
taskBto -> taskService.update(taskService.moveToEnd(taskBto))
taskBto -> taskService.moveToEnd(taskBto)
);
//未报名统一处理为为报名
......@@ -202,7 +201,7 @@ public class TrainJobController {
// }
// );
trainTaskService.selectBillidAndBillType(trainId,BusinessEnum.TRAIN.id,StatusEnum.TRAIN1000.id).forEach(
taskBto ->taskService.update( taskService.moveToSpecial(taskBto,StatusEnum.TRAIN1010))
taskBto ->taskService.moveToSpecial(taskBto,StatusEnum.TRAIN1010)
);
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(7);
......@@ -228,7 +227,7 @@ public class TrainJobController {
public ResponseEntity inTraining(@PathVariable Integer trainId) {
TrainTheme trainTheme = trainThemeService.findById(trainId);
trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1010.id).forEach(
taskBto -> taskService.update(taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1004, taskBto.getInvolveUserIdList().get(0)))
taskBto -> taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1004, taskBto.getInvolveUserIdList().get(0))
);
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(8);
......@@ -279,7 +278,7 @@ public class TrainJobController {
// TaskEntity taskEntity= taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(),trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
taskBto.setOwnUnit(1);
taskService.update(taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1005));
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1005);
// taskEntity.setBillStatus(32);
// taskEntity.setOwnUnit(1);
// taskService.update(taskEntity);
......@@ -443,7 +442,7 @@ public class TrainJobController {
TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
taskBto = taskService.addInvolveUser(taskBto, securityUser.getCurrentUserInfo().getUserId());
taskService.update(taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1006, gradeEntryVo.getAuditId()));
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1006, gradeEntryVo.getAuditId());
// TaskEntity taskEntity= taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
......@@ -482,7 +481,7 @@ public class TrainJobController {
public ResponseEntity audit(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody GradeEntryVo gradeEntryVo) {
TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
taskService.update(taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1007, gradeEntryVo.getAuditId()));
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1007, gradeEntryVo.getAuditId());
//
// TaskEntity taskEntity= taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
......@@ -528,7 +527,7 @@ public class TrainJobController {
TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
//给培训报名的人员都发起一个通知,查看自己都证书
TaskBto taskBto=trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
taskService.update(taskService.moveToEnd(taskBto));
taskService.moveToEnd(taskBto);
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// //8 培训完成
// taskEntity.setBillStatus(15);
......@@ -692,7 +691,7 @@ public class TrainJobController {
//给培训报名的人员都发起一个通知,查看自己都证书
// TaskEntity taskEntity=taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(),trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
TaskBto taskBto = taskService.get(signUpReturn.getTaskId());
taskService.update(taskService.moveToEnd(taskBto));
taskService.moveToEnd(taskBto);
// taskEntity.setBillStatus(BusinessEnum.TRAIN.id);
// taskService.update(taskEntity);
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
......
......@@ -148,21 +148,33 @@ public class TrainTheme {
/**
* 发证状态
*/
@ApiModelProperty(value = "发证状态")
@ApiModelProperty(value = "发证状态",name = "isCertificate")
private Integer isCertificate;
/**
* 及格
*/
@ApiModelProperty(value = "发证状态")
@ApiModelProperty(value = "及格",name = "pass")
private Integer pass;
/**
* 优秀
*/
@ApiModelProperty(value = "发证状态")
@ApiModelProperty(value = "优秀",name = "good")
private Integer good;
/**
* 培训试卷url
*/
@ApiModelProperty(value = "培训试卷url",name = "trainPapersUrl")
private String trainPapersUrl;
/**
* 培训试卷名称
*/
@ApiModelProperty(value = "培训试卷名称",name = "trainPapersName")
private String trainPapersName;
public ByTrainingPeople toByTrainingPeople(){
......
spring.datasource.url=jdbc:mysql://192.168.100.249:3306/device?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.url=jdbc:mysql://localhost:3306/device?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
......
//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
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.device.train.entity.WorkHandover;
import com.tykj.dev.device.train.entity.vo.WorkHandoverAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.device.train.service.WorkHandoverService;
import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.union.BaseTest;
import lombok.extern.slf4j.Slf4j;
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")
@Slf4j
class WorkHandoverTest extends BaseTest {
@Autowired
protected MockMvc mockMvc;
@Autowired
WorkHandoverService workHandoverService;
@Autowired
UserService userService;
@Autowired
private TaskDao taskRepo;
private String url="/user/handover/";
@Test
void startManualCheck() throws Exception {
WorkHandoverAddVo workHandoverAddVo=new WorkHandoverAddVo();
//交接人
workHandoverAddVo.setHandoverUserId(9);
//移交人
workHandoverAddVo.setTurnOverUserId(10);
//监交人
workHandoverAddVo.setInUserName("省a专管员");
// 测试
RequestBuilder request;
request = post(url+"create")
.header("Origin", "*")
.contentType(MediaType.APPLICATION_JSON)
.content(toJSon(workHandoverAddVo));
mockMvc.perform(request)
.andExpect(status().isOk())
.andDo(mvcResult1 ->System.out.println("[测试结果] 工作交接任务测试通过"));
// A 接口
Task initTask = taskRepo.findAll(Specifications.<Task>and()
.eq("billStatus", StatusEnum.WORKHANDOVER1011.id)
.build())
.get(0);
Integer workBillId = initTask.getBillId();
WorkHandoverVo workHandover= workHandoverService.findById(workBillId);
if (workHandover!=null){
log.info("[workHandover] 新建工作交接业务完成");
}else {
log.info("[workHandover] 新建工作交接业务不通过");
}
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.tykj.dev.device.user.subject.service.RolePermissionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
/**
......@@ -35,6 +36,7 @@ public class RolePermissionsServiceImpl implements RolePermissionsService {
}
@Override
@Transactional
public void deleteFindRoleId(Integer roleId) {
rolePermissionsDao.deleteAllByRoleId(roleId);
}
......
......@@ -105,7 +105,7 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public Units findByAreaId(Integer unitsId) {
return unitsDao.findAllByAreaId(areaDao.findById(findById(unitsId).getAreaId()).get().getFatherId() ).get(0);
return unitsDao.findAllByAreaId(areaDao.findById(findById(unitsId).getAreaId()).get().getFatherId()).get(0);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论