提交 9d214ce3 authored 作者: 133's avatar 133

[清退 丢失 培训] 代码修改提交

上级 08ec3e59
......@@ -75,11 +75,15 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus where o.id in :idList")
int upDateLeftStatus(Integer lifeStatus,@Param("idList") List<Integer> idList);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.lockStatus=:lock where o.id in :idList")
int upDateLeftStatusAndLockStatus(Integer lifeStatus,Integer lock,@Param("idList") List<Integer> idList);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.locationUnit = :unitName,o.ownUnit = :unitName where o.id in :idList")
int upDateLeftStatusAndUnitName(Integer lifeStatus,String unitName,@Param("idList") List<Integer> idList);
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.locationUnit = :unitName,o.ownUnit = :unitName ,o.lockStatus=:lock where o.id in :idList")
int upDateLeftStatusAndUnitNameAndLockStatus(Integer lifeStatus,String unitName,Integer lock,@Param("idList") List<Integer> idList);
@Transactional
@Modifying
......
......@@ -5,11 +5,14 @@ import com.tykj.dev.device.loss.entity.vo.LossAuditvo;
import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo;
import com.tykj.dev.device.loss.service.LossBillService;
import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
/**
* @author zjm
......@@ -27,8 +30,8 @@ public class DeviceLossController {
LossBillService lossBillService;
@PostMapping(value ="/initiateLoss")
@ApiOperation(value = "丢失装备上报", notes = "丢失装备上报接口")
public ResponseEntity initiateLoss(@RequestBody DeviceLoss deviceLoss){
lossBillService.initiateLoss(deviceLoss);
public ResponseEntity initiateLoss(@RequestBody DeviceLoss deviceLoss,@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
lossBillService.initiateLoss(deviceLoss,securityUser);
return ResponseEntity.ok("上报成功");
}
......@@ -42,8 +45,8 @@ public class DeviceLossController {
@PostMapping(value ="/initiateRetrieve")
@ApiOperation(value = "找回装备上报", notes = "找回装备上报接口")
public ResponseEntity initiateRetrieve(@RequestBody DeviceLoss deviceLoss){
lossBillService.initiateRetrieve(deviceLoss);
public ResponseEntity initiateRetrieve(@RequestBody DeviceLoss deviceLoss,@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
lossBillService.initiateRetrieve(deviceLoss,securityUser);
return ResponseEntity.ok("上报成功");
}
......
......@@ -3,6 +3,7 @@ package com.tykj.dev.device.loss.service;
import com.tykj.dev.device.loss.entity.vo.LossAuditvo;
import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
/**
* @author zjm
......@@ -15,7 +16,7 @@ public interface LossBillService {
/**
* 发起丢失
*/
void initiateLoss(DeviceLoss deviceLoss);
void initiateLoss(DeviceLoss deviceLoss, SecurityUser securityUser);
/**
*上级审核
......@@ -26,7 +27,7 @@ public interface LossBillService {
/**
* 找回装备
*/
void initiateRetrieve(DeviceLoss deviceLoss);
void initiateRetrieve(DeviceLoss deviceLoss,SecurityUser securityUser);
/**
* 找回装备 审核
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.loss.service.impl;
import com.tykj.dev.device.file.service.FilesUtil;
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.DeviceLog;
......@@ -13,6 +14,7 @@ import com.tykj.dev.device.loss.util.StringUtils;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.entity.Area;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.device.user.subject.service.UnitsService;
......@@ -20,6 +22,7 @@ import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import com.tykj.dev.misc.utils.TaskDisposeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -49,6 +52,9 @@ public class LossBillServiceImpl implements LossBillService {
@Autowired
DeviceLibraryDao deviceLibraryDao;
@Autowired
DeviceLibraryService deviceLibraryService;
@Autowired
AreaService areaService;
......@@ -56,7 +62,8 @@ public class LossBillServiceImpl implements LossBillService {
DeviceLogService deviceLogService;
@Override
public void initiateLoss(DeviceLoss deviceLoss) {
public void initiateLoss(DeviceLoss deviceLoss, SecurityUser securityUser) {
deviceLibraryService.isInStockOrWaitRetired(deviceLoss.getDevIdsList());
deviceLoss.setDevIds(StringUtils.ListToString(deviceLoss.getDevIdsList()));
deviceLoss.setLossFile(FilesUtil.stringFileToList(deviceLoss.getFileRetList()));
DeviceLoss deviceLossThis= deviceLossService.save(deviceLoss);
......@@ -64,9 +71,12 @@ public class LossBillServiceImpl implements LossBillService {
Area area=areaService.findByid(units.getAreaId());
if (units.getLevel() == 1) {
end(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "丢失装备任务", units.getUnitId());
} else {
} else if (units.getLevel()==2){
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
newLossCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务",securityUser.getCurrentUserInfo().getUserId());
}else {
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
newLossTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务");
newLossCountyTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "丢失装备任务",securityUser.getCurrentUserInfo().getUserId());
}
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.LOSS.id,deviceLoss.getDevIdsList());
devLogAdd(deviceLoss.getDevIdsList(),"装备报备丢失", deviceLoss.getCreateUserId());
......@@ -81,22 +91,25 @@ public class LossBillServiceImpl implements LossBillService {
TaskBto taskBto=taskService.get(lossAuditvo.getTaskId());
DeviceLoss deviceLoss=deviceLossService.findByDeviceLoss(taskBto.getBillId());
if (units.getLevel()==1){
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.LOSS1301);
deviceLoss.setProvinceUnitName(units.getName());
deviceLoss.setProvinceDes(lossAuditvo.getDes());
taskService.moveToEnd(taskBto);
}else {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.LOSS1300);
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
deviceLoss.setCityUnitName(units.getName());
deviceLoss.setCityDes(lossAuditvo.getDes());
taskBto.setOwnUnit(parentUnits.getUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.LOSS1300,0);
taskService.moveToSpecial(taskBto,StatusEnum.LOSS1301,0);
}
deviceLossService.save(deviceLoss);
}
@Override
public void initiateRetrieve(DeviceLoss deviceLoss) {
public void initiateRetrieve(DeviceLoss deviceLoss,SecurityUser securityUser) {
deviceLibraryService.isInStockOrWaitRetired(deviceLoss.getDevIdsList());
deviceLoss.setDevIds(StringUtils.ListToString(deviceLoss.getDevIdsList()));
deviceLoss.setLossFile(FilesUtil.stringFileToList(deviceLoss.getFileRetList()));
DeviceLoss deviceLossThis= deviceLossService.save(deviceLoss);
......@@ -105,9 +118,12 @@ public class LossBillServiceImpl implements LossBillService {
if (units.getLevel() == 1) {
endRetrieve(deviceLossThis.getCreateUserId(), deviceLossThis.getId(), units.getName() + "找回装备任务", units.getUnitId());
deviceLibraryDao.upDateLeftStatus(DeviceLifeStatus.IN_LIBRARY.id,deviceLoss.getDevIdsList());
} else {
} else if (units.getLevel()==2){
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
newRetrieveTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务");
newRetrieveCityTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId());
}else {
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
newRetrieveCountyTask(parentUnits.getUnitId(), deviceLossThis.getId(), units.getName() + "找回装备任务",securityUser.getCurrentUserInfo().getUserId());
}
devLogAdd(deviceLoss.getDevIdsList(),"装备找回上报", deviceLoss.getCreateUserId());
}
......@@ -120,6 +136,7 @@ public class LossBillServiceImpl implements LossBillService {
TaskBto taskBto=taskService.get(retrieveAuditvo.getTaskId());
DeviceLoss deviceLoss=deviceLossService.findByDeviceLoss(taskBto.getBillId());
if (units.getLevel()==1){
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.RETRIEVE1401);
deviceLoss.setProvinceUnitName(units.getName());
deviceLoss.setProvinceDes(retrieveAuditvo.getDes());
taskService.moveToEnd(taskBto);
......@@ -130,12 +147,14 @@ public class LossBillServiceImpl implements LossBillService {
deviceLoss.setBackStatus(3);
}
}else {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.RETRIEVE1400);
Units parentUnits=unitsService.findUnitAreaId(area.getFatherId());
deviceLoss.setCityUnitName(units.getName());
deviceLoss.setCityDes(retrieveAuditvo.getDes());
if (retrieveAuditvo.getType()==1){
taskBto.setOwnUnit(parentUnits.getUnitId());
taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1400,0);
taskService.moveToSpecial(taskBto,StatusEnum.RETRIEVE1401,0);
}else {
taskService.moveToEnd(taskBto);
deviceLoss.setBackStatus(3);
......@@ -146,10 +165,18 @@ public class LossBillServiceImpl implements LossBillService {
}
private void newRetrieveTask(Integer unitId, Integer lossId, String title){
private void newRetrieveCountyTask(Integer unitId, Integer lossId, String title,Integer userID){
List<Integer> list=new ArrayList<>();
list.add(userID);
list.add(0);
taskService.start(new TaskBto(StatusEnum.RETRIEVE1400.id, title, 0, ".", lossId, BusinessEnum.RETRIEVE.id, unitId, 0, "", list));
taskService.start(new TaskBto(StatusEnum.RETRIEVE1400.id, title, 0, ".", lossId, BusinessEnum.RETRIEVE.id, unitId, 1, "", list));
}
private void newRetrieveCityTask(Integer unitId, Integer lossId, String title,Integer userID){
List<Integer> list=new ArrayList<>();
list.add(userID);
list.add(0);
taskService.start(new TaskBto(StatusEnum.RETRIEVE1401.id, title, 0, ".", lossId, BusinessEnum.RETRIEVE.id, unitId, 1, "", list));
}
private void endRetrieve(Integer userId, Integer lossId, String title, Integer unitId){
......@@ -159,10 +186,18 @@ public class LossBillServiceImpl implements LossBillService {
}
private void newLossTask(Integer unitId, Integer lossId, String title){
private void newLossCountyTask(Integer unitId, Integer lossId, String title,Integer userID){
List<Integer> list=new ArrayList<>();
list.add(userID);
list.add(0);
taskService.start(new TaskBto(StatusEnum.LOSS1300.id, title, 0, ".", lossId, BusinessEnum.LOSS.id, unitId, 1, "", list));
}
private void newLossCityTask(Integer unitId, Integer lossId, String title,Integer userID){
List<Integer> list=new ArrayList<>();
list.add(userID);
list.add(0);
taskService.start(new TaskBto(StatusEnum.LOSS1300.id, title, 0, ".", lossId, BusinessEnum.LOSS.id, unitId, 0, "", list));
taskService.start(new TaskBto(StatusEnum.LOSS1301.id, title, 0, ".", lossId, BusinessEnum.LOSS.id, unitId, 1, "", list));
}
private void end(Integer userId, Integer lossId, String title, Integer unitId){
......
......@@ -90,9 +90,13 @@ public enum StatusEnum {
LOSS1300(1300,"丢失装备等待审核"),
LOSS1300(1300,"丢失装备等待审核"),
RETRIEVE1400(1400,"装备找回等待审核"),
LOSS1301(1301,"丢失装备等待省审核"),
RETRIEVE1400(1400,"装备找回等待市审核"),
RETRIEVE1401(1401,"装备找回等待省审核"),
// SEND_BACK_1204(1204, "入库待审核"),
......
......@@ -22,9 +22,8 @@ public class TaskDisposeUtil {
}
public static void isNotSubmit(Integer billStatus, StatusEnum statusEnum){
if (!statusEnum.id.equals(billStatus)){
public static void isNotSubmit(Integer billStatus, StatusEnum statusEnums){
if (!statusEnums.id.equals(billStatus)){
throw new ApiException(ResponseEntity.status(303).body("本次任务已经被其他专管员完成,请处理其他任务"));
}
......
......@@ -4,11 +4,14 @@ import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepel;
import com.tykj.dev.device.sendback.entity.vo.*;
import com.tykj.dev.device.sendback.service.RepelBusinessService;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
......@@ -160,8 +163,8 @@ public class RepelDevController {
*/
@ApiOperation(value = "省直属任务待清退", notes = "省直属任务待清退")
@GetMapping(value ="/provinceDirectlyUnder/{taskId}")
public ResponseEntity provinceDirectlyUnder(@PathVariable Integer taskId){
repelBusinessService.provinceDirectlyUnder(taskId);
public ResponseEntity provinceDirectlyUnder(@PathVariable Integer taskId,@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
repelBusinessService.provinceDirectlyUnder(taskId,securityUser);
return ResponseEntity.ok("省直属单位任务提交成功");
}
......@@ -175,5 +178,13 @@ public class RepelDevController {
return ResponseEntity.ok("上传回执单成功");
}
/**
* 测试
*/
@ApiOperation(value = "测试", notes = "上传回执单 也可以不上传回执单")
@PostMapping(value ="/test")
public ResponseEntity receipts1(){
return ResponseEntity.status(303).body("test");
}
}
......@@ -31,4 +31,12 @@ public class StorageDeviceRepel {
private Integer userId;
private Integer taskId;
private Integer userA;
private Integer userB;
private String userAName;
private String userBName;
}
......@@ -7,6 +7,7 @@ import com.tykj.dev.device.sendback.entity.vo.OrderOutData;
import com.tykj.dev.device.sendback.entity.vo.RepelAuditResult;
import com.tykj.dev.device.sendback.entity.vo.ResolveConfirm;
import com.tykj.dev.device.sendback.entity.vo.StorageDeviceRepel;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import java.util.List;
......@@ -28,6 +29,7 @@ public interface RepelBusinessService {
*/
void cityInitiateRepel(DeviceRepel deviceRepel,Integer userId);
/**
* 省审核市清退任务
*/
......@@ -81,7 +83,7 @@ public interface RepelBusinessService {
/**
* 省直属任务等待上传
*/
void provinceDirectlyUnder(Integer taskId);
void provinceDirectlyUnder(Integer taskId, SecurityUser securityUser);
/**
* 省\市清退任待办结 签字上传
......@@ -94,7 +96,7 @@ public interface RepelBusinessService {
void cityRepelEnd(Integer taskId);
/**
* 生成省中办出库的任务
* 生成省中办退役的任务
* @param userId 用户id
* @param orderOutData 出库对象
*/
......
......@@ -27,6 +27,7 @@ import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.TaskDisposeUtil;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -175,6 +176,8 @@ public class TrainJobController {
public ResponseEntity signUp(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody signUpReturn signUpReturn) {
TrainTheme trainTheme = trainThemeService.findById(signUpReturn.getTrainThemeId());
TaskBto taskBto = taskService.get(signUpReturn.getTaskId());
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.TRAIN1002);
Integer taskId=taskBto.getId();
List<SignUpUsers> signUpUsers= signUpReturn.getSignUpUsers();
signUpUsers.forEach(signUpUser -> {
......@@ -274,6 +277,9 @@ public class TrainJobController {
TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
// TaskEntity taskEntity= taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(),trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
//判断
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.TRAIN1008);
taskBto.setOwnUnit(1);
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1005);
gradeEntryVo.getGradeEntryList().forEach(
......@@ -303,6 +309,10 @@ public class TrainJobController {
public ResponseEntity provinceAudit(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody GradeEntryVo gradeEntryVo) {
TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
//判断
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.TRAIN1005);
taskBto = taskService.addInvolveUser(taskBto, securityUser.getCurrentUserInfo().getUserId());
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1006, gradeEntryVo.getAuditId());
......@@ -335,6 +345,11 @@ 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);
//判断
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.TRAIN1008);
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1007, gradeEntryVo.getAuditId());
//7 省培训发证审核
......@@ -376,6 +391,12 @@ public class TrainJobController {
TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
//给培训报名的人员都发起一个通知,查看自己都证书
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
List<StatusEnum> statusEnums=new ArrayList<>();
statusEnums.add(StatusEnum.TRAIN1006);
statusEnums.add(StatusEnum.TRAIN1007);
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),statusEnums);
taskService.moveToEnd(taskBto);
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// //8 培训完成
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论