提交 b3978a05 authored 作者: 133's avatar 133

[清退] [用户] [装备]代码提交

上级 1fdf171f
......@@ -209,11 +209,6 @@ public class DeviceLibrary {
childs.add(deviceLibraryEntity);
}
public DeviceLibrary toVo(){
if (!this.locationUnit.equals(this.ownUnit)){
this.manageStatus=0;
}
return this;
}
}
......@@ -64,9 +64,9 @@ public class SendBackController {
}
@ApiOperation(value = "处理异常,修改装备的所属单位",notes = "处理异常,修改装备的所属单位")
@PostMapping("/endException/{userId}/{taskId}")
ResponseEntity endException(@PathVariable("userId") Integer userId,@PathVariable("taskId") Integer taskId){
return sendBackService.endException(taskId,userId);
@GetMapping("/endException/{userId}/{taskId}/{type}")
ResponseEntity endException(@PathVariable("userId") Integer userId,@PathVariable("taskId") Integer taskId,@PathVariable("type") Integer type){
return sendBackService.endException(taskId,userId,type);
}
......@@ -150,4 +150,12 @@ public class SendBackController {
return sendBackService.sendBackInCheck(taskId,sendBackOut,userId);
}
@ApiOperation(value = "异常处理详情接口")
@GetMapping("/select/exception/{taskId}")
public ResponseEntity exception(@PathVariable("taskId") Integer taskId){
return sendBackService.exceptionSelect(taskId);
}
}
package com.tykj.dev.device.sendback.entity.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zjm
* @version 1.0.0
* @ClassName AbnormalDescribe.java
* @Description TODO
* @createTime 2020年09月25日 14:26:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("异常装备描述")
public class AbnormalDescribe {
private String model;
private Integer id;
private String name;
private String des;
}
package com.tykj.dev.device.sendback.entity.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zjm
* @version 1.0.0
* @ClassName AbnormalVo.java
* @Description TODO
* @createTime 2020年09月25日 10:18:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("清退出库表单")
public class AbnormalVo {
@ApiModelProperty(value = "经办人")
private String name;
@ApiModelProperty(value = "经办人id")
private Integer id;
@ApiModelProperty(value = "截止时间")
private Date time;
private List<DeviceLibrary> deviceLibraryList;
@ApiModelProperty(value = "未在库装备备注")
private UnDeviceDesVo unDeviceDesVo;
}
......@@ -78,7 +78,15 @@ public class SendBackOutVo {
@ApiModelProperty(value = "清退单url")
private String returnNoteUrl;
@ApiModelProperty(value = "清退单name")
private String returnNoteName;
@ApiModelProperty(value = "是否可以出库")
private Integer isNotOutbound;
@ApiModelProperty(value = "异常taskid")
private Integer excTask;
}
......@@ -25,7 +25,7 @@ public class SendBackRequst {
private Integer parentTaskId;
@ApiModelProperty(value = "未在库装备备注")
private HashMap<Integer,UnDeviceDesVo> unDeviceDes;
private UnDeviceDesVo unDeviceDesVo;
@ApiModelProperty(value = "查询类型,0:省级 1:市级 2:区县级")
private Integer type;
......
......@@ -43,7 +43,7 @@ public class SendBackVo {
private List<DeviceLibrary> unDevice;
@ApiModelProperty(value = "异常装备描述")
private List<UnDeviceDesVo> unDeviceDes;
private UnDeviceDesVo unDeviceDes;
@ApiModelProperty(value = "区域和任务id")
private HashMap<String,Integer> areaToTaskId;
......
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* <h4>Description : </h4>
......@@ -27,7 +28,6 @@ public class UnDeviceDesVo {
private String unitName;
@ApiModelProperty(value = "备注")
private String des;
private List<AbnormalDescribe> des;
}
......@@ -5,6 +5,8 @@ import com.tykj.dev.device.sendback.entity.vo.SendBackOutFormVo;
import com.tykj.dev.device.sendback.entity.vo.SendBackOutVo;
import com.tykj.dev.device.sendback.entity.vo.SendBackRequst;
import com.tykj.dev.device.sendback.entity.vo.SendBackVo;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.http.ResponseEntity;
import java.util.List;
......@@ -53,7 +55,7 @@ public interface SendBackService {
* @param taskId 上报异常的taskid
* @return 成功
*/
ResponseEntity endException(Integer taskId, Integer userId);
ResponseEntity endException(Integer taskId, Integer userId,Integer type);
/**
* 清退装备校对发起——专管员A
......@@ -118,4 +120,11 @@ public interface SendBackService {
* @return 成功
*/
ResponseEntity endTask(Integer taskId);
/**
* 异常行为 查询接口
*/
ResponseEntity exceptionSelect(Integer task);
}
......@@ -180,10 +180,9 @@ public class SendBackServiceImpl implements SendBackService {
}
}else {
SendBackVo sendBackVo = JSONObject.parseObject(send,SendBackVo.class);
// SendBackVo newSend = newStatistical(idList, 1, sendBackVo, false);
sendBackVo.setAreaToTaskId(areaToTaskId);
sendBackVo.setTime(sendBackVo.getTime());
sendBackVo.setName(sendBackVo.getName());
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);
......@@ -243,14 +242,30 @@ public class SendBackServiceImpl implements SendBackService {
List<Integer> deviceIdList = sendBackRequst.getDeviceIdList();
HashMap<Integer, UnDeviceDesVo> unDeviceDes = sendBackRequst.getUnDeviceDes();
User user = userDao.findById(userId).get();
UnDeviceDesVo unDeviceDes = sendBackRequst.getUnDeviceDesVo();
unDeviceDes.setName(user.getName());
unDeviceDes.setTime(new Date());
unDeviceDes.setUnitName(unitsDao.findById(user.getUnitsId()).get().getName());
List<AbnormalDescribe> abnormalDescribes=new ArrayList<>();
if (unDeviceDes.getDes()!=null){
abnormalDescribes=unDeviceDes.getDes();
}
Map<Integer,AbnormalDescribe> map=new HashMap<>();
abnormalDescribes.forEach(
abnormalDescribe -> {
map.put(abnormalDescribe.getId(),abnormalDescribe);
}
);
/*
将异常的装备根据所在进行分类,然后给所在地task
*/
List<DeviceLibrary> deviceLibraryEntitiesByIdIn = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(deviceIdList);
HashMap<String,List<Integer>> locationUnitList = new HashMap<>();
HashMap<String,List<UnDeviceDesVo>> desList = new HashMap<>();
HashMap<String,List<AbnormalDescribe>> desList = new HashMap<>();
for (DeviceLibrary deviceLibraryEntity : deviceLibraryEntitiesByIdIn) {
String locationUnit = deviceLibraryEntity.getLocationUnit();
......@@ -262,14 +277,20 @@ public class SendBackServiceImpl implements SendBackService {
ids.add(deviceLibraryEntity.getId());
locationUnitList.put(locationUnit,ids);
List<UnDeviceDesVo> unDeviceDesVos = desList.get(locationUnit);
List<AbnormalDescribe> unDeviceDesVos = desList.get(locationUnit);
if(unDeviceDesVos == null){
unDeviceDesVos = new ArrayList<>();
}
unDeviceDesVos.add(unDeviceDes.get(deviceLibraryEntity.getId()));
unDeviceDesVos.add(map.get(deviceLibraryEntity.getId()));
desList.put(locationUnit,unDeviceDesVos);
}
TaskBto parentTask = taskService.get(parentTaskId);
SendBackBill parentBillEntity = sendBackBillEntityDao.getOne(parentTask.getBillId());
parentBillEntity.setExceptionDes(JSON.toJSONString(unDeviceDes));
sendBackBillEntityDao.save(parentBillEntity);
Set<String> locationKey = locationUnitList.keySet();
for (String location:locationKey) {
TaskBto taskSaveVo = new TaskBto();
......@@ -280,7 +301,8 @@ public class SendBackServiceImpl implements SendBackService {
StringBuffer idString = new StringBuffer();
locationUnitList.get(location).forEach(id -> idString.append("x").append(id));
sendBackBillEntity.setInvoleDevice(idString.toString());
sendBackBillEntity.setExceptionDes(JSON.toJSONString(desList.get(location)));
unDeviceDes.setDes(desList.get(location));
sendBackBillEntity.setExceptionDes(JSON.toJSONString(unDeviceDes));
sendBackBillEntity.setDeadLine(new Date());
sendBackBillEntity.setReviewUserId(0);
sendBackBillEntity.setTitle("装备异常报告");
......@@ -301,7 +323,7 @@ public class SendBackServiceImpl implements SendBackService {
*/
Units unit = unitsDao.findByName(location);
taskSaveVo.setOwnUnit(unit.getUnitId());
taskSaveVo.setParentTaskId(parentTaskId);
taskSaveVo.setParentTaskId(parentTask.getParentTaskId());
taskSaveVo.setNodeIdDetail("");
List<Integer> integerList=new ArrayList<>();
integerList.add(0);
......@@ -317,11 +339,7 @@ public class SendBackServiceImpl implements SendBackService {
*/
// addJob(task.getId(),task.getBillStatus(),userId,null,0,0);
}
TaskBto parentTask = taskService.get(parentTaskId);
SendBackBill billEntity = sendBackBillEntityDao.getOne(parentTask.getBillId());
billEntity.setExceptionDes(JSON.toJSONString(unDeviceDes.values()));
taskService.moveToEnd(parentTask);
return ResponseEntity.ok("提交成功");
}
......@@ -334,7 +352,7 @@ public class SendBackServiceImpl implements SendBackService {
*/
@Transactional
@Override
public ResponseEntity endException(Integer taskId,Integer userId) {
public ResponseEntity endException(Integer taskId,Integer userId,Integer type) {
User user = userDao.getOne(userId);
Units units = unitsDao.getOne(user.getUnitsId());
......@@ -347,12 +365,9 @@ public class SendBackServiceImpl implements SendBackService {
/*
获取关联的设备id
*/
String involeDevice = sendBackBill.getInvoleDevice();
String[] idString = involeDevice.split("x");
List<Integer> idList = new ArrayList<>();
for (String id:idString) {
idList.add(Integer.parseInt(id));
}
String involeDevice=sendBackBill.getInvoleDevice();
List<Integer> idList = stringToList(involeDevice);
/*
根据idList查询装备列表
*/
......@@ -367,20 +382,22 @@ public class SendBackServiceImpl implements SendBackService {
SendBackBill parentTaskBill = sendBackBillEntityDao.getOne(parentTaskBillId);
parentTaskBill.setInvoleDevice(parentTaskBill.getInvoleDevice().replaceAll(involeDevice,""));
if (parentTaskBill.getInvoleDevice().equals("")){
taskService.moveToEnd(parentTask);
s(parentTask,parentTaskBill,idList);
}
sendBackBillEntityDao.save(parentTaskBill);
taskService.moveToEnd(taskBto);
/*
结束这个task
*/
// taskBto.setBillStatus(13);
// /*
// 结束job
// */
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(),1);
// job.setBillStatus(13);
//
// taskDao.save(taskEntity);
// addLog(taskEntity.getId(),idList,"装备异常处理","");
if (units.getLevel()==2){
TaskBto cityTask = taskService.get(parentTask.getParentTaskId());
Integer cityTaskBillId = cityTask.getBillId();
SendBackBill cityTaskBill = sendBackBillEntityDao.getOne(cityTaskBillId);
parentTaskBill.setInvoleDevice(cityTaskBill.getInvoleDevice()+involeDevice);
sendBackBillEntityDao.save(parentTaskBill);
}
return ResponseEntity.ok("异常处理成功");
}
......@@ -396,11 +413,6 @@ public class SendBackServiceImpl implements SendBackService {
TaskBto taskEntity = taskService.get(taskId);
/*
这里不用生成新的task,修改task状态即可,出库待校验的状态
*/
// taskEntity.setBillStatus(27);
/*
获取账单信息,根据账单的id,出库装备
*/
......@@ -422,24 +434,20 @@ public class SendBackServiceImpl implements SendBackService {
*/
sendBackOutVo.setActualOut(idList.size());
sendBackOutVo.setShouldOut(idList.size());
List<DeviceLibrary> deviceLibraries= deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).stream().map(DeviceLibrary::toVo).collect(Collectors.toList());
List<DeviceLibrary> deviceLibraries= new ArrayList<>();
deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).forEach(
deviceLibrary -> {
if (!deviceLibrary.getOwnUnit().equals(deviceLibrary.getLocationUnit())){
deviceLibrary.setManageStatus(0);
sendBackOutVo.setIsNotOutbound(1);
}
deviceLibraries.add(deviceLibrary);
}
);
sendBackOutVo.setDeviceLibraryEntities(deviceLibraries);
Task exlTask= taskDao.findByParentTaskIdAndAndTitle(taskId,"异常装备描述");
sendBackOutVo.setExcTask(exlTask.getId());
// billEntity.setSendBackOut(JSON.toJSONString(sendBackOutVo));
// taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,userId);
/*
结束上一个job,生成新的job
*/
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,userId,0);
//
// /*
// 生成log
// */
// User user = userDao.getOne(userId);
// addLog(taskEntity.getId(),idList,user.getName()+"发起装备校验","");
return ResponseEntity.ok(sendBackOutVo);
}
......@@ -459,7 +467,7 @@ public class SendBackServiceImpl implements SendBackService {
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));
......@@ -492,18 +500,6 @@ public class SendBackServiceImpl implements SendBackService {
SendBackBillDetail backBillDetailEntity = sendBackBillDetailEntityDao.save(sendBackBillDetailEntity);
bill.setFormId(backBillDetailEntity.getId());
/*
新增job
*/
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,sendBackOut.getReviewerNameId(),0);
/*
生成日志
*/
// User user = userDao.getOne(userId);
// addLog(taskId,stringToList(bill.getInvoleDevice()),user.getName()+"发起申请,待"+sendBackOut.getReviewerName()+"审核","Ǒ"+sendBackOut.getUrl()+"Ǒ"+sendBackOut.getFileName());
return ResponseEntity.ok("装备出库发起成功等待审核");
}
......@@ -527,81 +523,6 @@ public class SendBackServiceImpl implements SendBackService {
List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId());
taskEntity.setOwnUnit(fatherUnit.get(0).getUnitId());
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1206,0);
// taskEntity.setBillStatus(13);
//
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1);
// System.out.println(job.getId());
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,userId,0);
/*
获取账单
*/
// SendBackBill sendBackBill = sendBackBillEntityDao.getOne(taskEntity.getBillId());
// SendBackOutVo sendBackOutVo = JSON.parseObject(sendBackBill.getSendBackOut(), new TypeReference<SendBackOutVo>() {
// });
/*
// 生成清退的表格
// */
// SendBackBillDetail sendBackBillDetailEntity = new SendBackBillDetail();
// sendBackBillDetailEntity.setSendUnit(unit.getName());
// sendBackBillDetailEntity.setSendUserAName(sendBackOutVo.getName());
// sendBackBillDetailEntity.setSendUserAId(sendBackOutVo.getId());
// sendBackBillDetailEntity.setSendUserBName(sendBackOutVo.getReviewerName());
// sendBackBillDetailEntity.setSendUserBId(sendBackOutVo.getReviewerNameId());
// sendBackBillDetailEntity.setSendTime(new Date());
// sendBackBillDetailEntity.setSendedCount(sendBackOutVo.getShouldOut());
// sendBackBillDetailEntity.setSendBackCount(sendBackOutVo.getActualOut());
// sendBackBillDetailEntity.setSendBackStatus(1);
// sendBackBillDetailEntity.setFileName(sendBackOutVo.getFileName());
// sendBackBillDetailEntity.setFileUrl(sendBackOutVo.getUrl());
// sendBackBillDetailEntity.setDeleteTag(0);
// sendBackBillDetailEntity.setApplyNumber("");
// sendBackBillDetailEntity.setReplayNumber("");
// sendBackBillDetailEntity.setReceiveUnit(fatherUnit.get(0).getName());
// sendBackBillDetailEntity.setReceiveUserAId(0);
// sendBackBillDetailEntity.setSendCheckDetail("");
// sendBackBillDetailEntity.setSendCheckResult("");
// sendBackBillDetailEntity.setNum("第"+new Date().getYear()+"QT"+taskEntity.getBillId()+"号");
//
// SendBackBillDetail backBillDetailEntity = sendBackBillDetailEntityDao.save(sendBackBillDetailEntity);
//
// sendBackBill.setFormId(backBillDetailEntity.getId());
// User user = userDao.getOne(userId);
// List<Integer> ids = stringToList(sendBackBill.getInvoleDevice());
//// addLog(taskId,ids,user.getName()+"通过审核,装备出库","");
//
// /*
// 生成新的Task
// */
// TaskBto taskSaveVo = new TaskBto();
//
// /*
// 账单与task关联18
// */
// taskSaveVo.setTitle("装备入库申请");
// taskSaveVo.setBillId(taskEntity.getBillId());
// taskSaveVo.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()+"发起入库申请","");
return ResponseEntity.ok("装配入库申请发送成功");
}
......@@ -624,27 +545,7 @@ public class SendBackServiceImpl implements SendBackService {
/*
已完结
*/
// taskEntity.setBillStatus(13);
taskService.moveToEnd(taskEntity);
/*
结束job
*/
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,userId,1);
/*
结束上级task和job
*/
// TaskBto parentTask = taskService.get(taskEntity.getParentTaskId());
// parentTask.setBillStatus(13);
// JobEntity parentJob = jobDao.findByTaskIdAndIsDone(taskEntity.getParentTaskId(), 0);
// parentJob.setIsDone(1);
// addJob(parentTask.getId(),parentTask.getBillStatus(),userId,job,parentJob.getBelongUserId(),1);
//
//
// taskDao.save(taskEntity);
// taskService.moveToEnd(parentTask);
/*
修改装备是所属单位
*/
......@@ -661,6 +562,16 @@ public class SendBackServiceImpl implements SendBackService {
}
deviceLibraryDao.saveAll(deviceList);
s(taskEntity,bill,idList);
return ResponseEntity.ok("装备已入库");
}
/**
* 判断是否全部提交
* 全部提交把跟踪业务改为代办
*/
private void s(TaskBto taskEntity,SendBackBill bill,List<Integer> idList){
//父类task
TaskBto fatherTaskBto = taskService.get(taskEntity.getParentTaskId());;
SendBackBill fatherBill = sendBackBillEntityDao.getOne(fatherTaskBto.getBillId());
......@@ -671,37 +582,35 @@ public class SendBackServiceImpl implements SendBackService {
将入库结果反馈给下级,由于两个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);
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());
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("装备已入库");
}
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());
}
}
}
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());
......@@ -711,14 +620,6 @@ public class SendBackServiceImpl implements SendBackService {
return deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(devIds);
}
private TaskBto task(Integer taskId){
TaskBto taskBto = taskService.get(taskId);
if ( taskBto.getParentTaskId()==null){
return taskBto;
}
return task(taskBto.getParentTaskId());
}
/**
* 业务详情
......@@ -748,8 +649,7 @@ public class SendBackServiceImpl implements SendBackService {
if(unit.getLevel() == 2){
SendBackVo sendBackVo = newStatistical(idList, 1, null, true);
billEntity.setSendBackStatistical(JSON.toJSONString(sendBackVo));
sendBackVo.setUnDeviceDes(JSONObject.parseObject(billEntity.getExceptionDes(), new TypeReference<List<UnDeviceDesVo>>() {
}));
sendBackVo.setUnDeviceDes(JSONObject.parseObject(billEntity.getExceptionDes(), UnDeviceDesVo.class));
sendBackVo.setAreaToTaskId(areaToTaskId);
List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>(sendBackVo.getMap().values());
sendBackVo.setDataList(dataList);
......@@ -765,8 +665,7 @@ public class SendBackServiceImpl implements SendBackService {
SendBackVo sendBackVo = JSONObject.parseObject(send, new TypeReference<SendBackVo>() {
});
SendBackVo backVo = newStatistical(idList, type, sendBackVo, false);
backVo.setUnDeviceDes(JSONObject.parseObject(billEntity.getExceptionDes(), new TypeReference<List<UnDeviceDesVo>>() {
}));
backVo.setUnDeviceDes(JSONObject.parseObject(billEntity.getExceptionDes(),UnDeviceDesVo.class));
List<HashMap<String, StatisticalVo>> dataList = new ArrayList<>(backVo.getMap().values());
backVo.setDataList(dataList);
backVo.setAreaToTaskId(areaToTaskId);
......@@ -896,6 +795,18 @@ public class SendBackServiceImpl implements SendBackService {
return ResponseEntity.ok("清退已办结");
}
@Override
public ResponseEntity exceptionSelect(Integer task) {
UnDeviceDesVo unDeviceDesVo =null;
TaskBto taskBto = taskService.get(task);
SendBackBill sendBackBill= sendBackBillEntityDao.getOne(taskBto.getBillId());
if (sendBackBill.getExceptionDes()!=null) {
unDeviceDesVo = JSONObject.parseObject(sendBackBill.getExceptionDes(), UnDeviceDesVo.class);
}
List<Integer> idList=stringToList(sendBackBill.getInvoleDevice());
return ResponseEntity.ok(new AbnormalVo("",null,sendBackBill.getDeadLine(),deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList),unDeviceDesVo));
}
/**
* 新建task
* @param sendBackVo 初始清退表单
......@@ -980,6 +891,7 @@ public class SendBackServiceImpl implements SendBackService {
);
SendBackBill sendBackBillEntity = new SendBackBill();
sendBackBillEntity.setSendBackStatistical(null);
sendBackBillEntity.setInvoleDevice(localIds.toString());
sendBackBillEntity.setDeadLine(deadLine);
......@@ -991,7 +903,7 @@ public class SendBackServiceImpl implements SendBackService {
生成省级及以下的Task
*/
List<Integer> integers=new ArrayList<>();
integers.add(startUserId);
integers.add(0);
/*
保存省级的task
......@@ -1359,6 +1271,9 @@ public class SendBackServiceImpl implements SendBackService {
//市
HashMap<Integer,Integer> city=new HashMap<>();
//区县不在库装备存储
HashMap<Integer,List<Integer>> cityNoLibrary=new HashMap<>();
//区县不在库装备存储
HashMap<Integer,List<Integer>> countyNoLibrary=new HashMap<>();
/*
......@@ -1383,9 +1298,9 @@ public class SendBackServiceImpl implements SendBackService {
unitDevices.put(unit.getUnitId(), deviceIds);
if (!device.getOwnUnit().equals(device.getLocationUnit())) {
List<Integer> noLibrary = countyNoLibrary.getOrDefault(unit.getUnitId(), new ArrayList<>());
List<Integer> noLibrary = cityNoLibrary.getOrDefault(unit.getUnitId(), new ArrayList<>());
noLibrary.add(device.getId());
countyNoLibrary.put(unit.getUnitId(), noLibrary);
cityNoLibrary.put(unit.getUnitId(), noLibrary);
}
/*
将装备加入所属的单位
......@@ -1400,7 +1315,11 @@ public class SendBackServiceImpl implements SendBackService {
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);
}
/*
将装备加入所属的单位
......@@ -1444,6 +1363,9 @@ public class SendBackServiceImpl implements SendBackService {
}else {
TaskBto taskBto= addTask1203(parentId, null, ids.toString(), key, userId, time);
unitsAndTaskid.put(key,taskBto.getId());
if (cityNoLibrary.containsKey(key)){
addExceptionTask(taskBto.getId(),cityNoLibrary.get(key),key,userId,time);
}
}
}
......@@ -1460,35 +1382,12 @@ public class SendBackServiceImpl implements SendBackService {
}
// 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
*/
// addLog(parentId,unitDevices.get(0),name + "发起装备清退","");
return unitDeviceIds;
}
/*
x1x2x1 -> [1,2,3]
x1x2x1 -> [1,2,3] 装备id组合字段 转换成id集合
*/
private List<Integer> stringToList(String idString){
String[] ids = idString.split("x");
......
......@@ -52,4 +52,6 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
List<Task> findTaskEntitiesByParentTaskId(Integer parentTaskId);
Task findByBusinessTypeAndOwnUnitAndBillStatus(Integer type,Integer ownUnit,Integer billStatus);
Task findByParentTaskIdAndAndTitle(Integer parentId,String title);
}
......@@ -9,18 +9,25 @@ package com.tykj.dev.device.user.subject.controller;
*/
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.user.subject.dao.AreaDao;
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.service.AreaService;
import com.tykj.dev.misc.exception.ApiException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Optional;
/**
* 区域视图层
*/
......@@ -31,6 +38,8 @@ import springfox.documentation.annotations.ApiIgnore;
public class AreaController {
@Autowired
AreaService areaService;
@Autowired
AreaDao areaDao;
@GetMapping(value = "/area/units")
@ApiOperation(value = "查询权限接口,按照类型划分,具体字段查看model", notes = "成功返回分类的权限对象")
......@@ -38,4 +47,16 @@ public class AreaController {
return ResponseEntity.ok(areaService.findAll(securityUser.getCurrentUserInfo().getUnits().getAreaId()));
}
@GetMapping(value = "/select/area/{areaId}")
@ApiOperation(value = "查询区域对象,传入areaId", notes = "成功返回区域对象")
public ResponseEntity areaId(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @PathVariable Integer areaId) {
Optional<Area> areaOptional = areaDao.findById(areaId);
if (areaOptional.isPresent()){
return ResponseEntity.ok(areaOptional.get());
}else {
throw new ApiException(ResponseEntity.status(500).body("areaId查询不到"));
}
}
}
......@@ -37,9 +37,10 @@ public class RoleController {
@ApiOperation(value = "角色添加和修改接口,新增不需要传id,修改必须传id", notes = "成功返回角色对象")
public ResponseEntity addRole(@RequestBody RoleVo roleVo) {
Role role = roleService.save(roleVo.toDo());
if (rolePermissionsService.findAllByRoleId(role.getRoleId()).size() != 0) {
rolePermissionsService.deleteFindRoleId(role.getRoleId());
if (roleVo.getRoleId()!=null) {
if (rolePermissionsService.findAllByRoleId(role.getRoleId()).size() != 0) {
rolePermissionsService.deleteFindRoleId(role.getRoleId());
}
}
List<Integer> list = roleVo.getPermissionsIds();
if (list != null && list.size() != 0) {
......
......@@ -69,7 +69,7 @@ public class RoleServiceImpl implements RoleService {
return RolePage.builder().data(rolePage.getContent())
.page(page)
.size(size)
.total(rolePage.getSize())
.total(Math.toIntExact(rolePage.getTotalElements()))
.build();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论