提交 97e3b5af authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块,3D模块): 新增修改存放位置的接口

新增修改存放位置的接口
上级 06d4ee51
......@@ -9,6 +9,7 @@ import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.allot.subject.vo.*;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
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;
......@@ -51,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
......@@ -115,7 +117,7 @@ public class AllotBillController {
@Autowired
private UserPublicService userService;
@Autowired
@Resource
private ConfigCache configCache;
@Autowired
......@@ -130,9 +132,12 @@ public class AllotBillController {
@Autowired
private PackingController packingController;
@Autowired
@Resource
private UnitsCache unitsCache;
@Resource
private DeviceLibraryPositionService deviceLibraryPositionService;
@ApiOperation(value = "导入二维码获取配发装备", notes = "可以通过这个接口导入二维码获取配发装备")
@PostMapping(value = "/load")
public ResponseEntity loadDevice(@RequestBody RfidVo rfidVo) {
......@@ -488,6 +493,7 @@ public class AllotBillController {
//分隔装备id信息
String deviceIdDetail = allotReceiveVo.getReceiveCheckDetail();
String[] strings = deviceIdDetail.split("x");
List<Integer> deviceIds = new ArrayList<>();
for (String s : strings) {
if (s.length() >= 2) {
//接收无误
......@@ -500,6 +506,9 @@ public class AllotBillController {
deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
deviceIds.add(id);
//如果接收时填写了生产号
if (allotReceiveVo.getMap().get(id) != null) {
deviceLibraryEntity.setProdNumber(allotReceiveVo.getMap().get(id));
......@@ -526,9 +535,15 @@ public class AllotBillController {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList, taskBto.getId(), taskBto.getId());
deviceLogService.addLog(deviceLogDto);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
deviceLibraryService.update(deviceLibraryEntity);
deviceIds.add(id);
}
}
//修改3D的存放位置
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,deviceIds);
}
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userId);
......@@ -880,8 +895,12 @@ public class AllotBillController {
deviceLibrary.setLifeStatus(2);
deviceLibrary.setOwnUnit(allotBill.getReceiveUnit());
deviceLibrary.setManageStatus(1);
deviceLibrary.setStorageLocationId(null);
deviceLibrary.setStorageLocation(null);
deviceLibraryService.update(deviceLibrary);
});
//修改3D的库房
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,ids);
//经办人阅知
// if (idList.size()>0) {
// MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1);
......
......@@ -10,6 +10,7 @@ import com.tykj.dev.device.allot.subject.vo.AllotBackReceiveVo;
import com.tykj.dev.device.allot.subject.vo.AllotBillSaveVo;
import com.tykj.dev.device.allot.subject.vo.FileUploadVo;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
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;
......@@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
......@@ -94,9 +96,12 @@ public class BackController {
@Autowired
private UnitsService unitsService;
@Autowired
@Resource
private UnitsCache unitsCache;
@Resource
private DeviceLibraryPositionService deviceLibraryPositionService;
@ApiOperation(value = "发起退回业务", notes = "可以通过这个接口发起退回任务")
@PostMapping(value = "/addBackBill")
@Transactional(rollbackFor = Exception.class)
......@@ -308,6 +313,7 @@ public class BackController {
//分隔装备id信息
String deviceIdDetail = allotBackReceiveVo.getReceiveCheckDetail();
String[] strings = deviceIdDetail.split("x");
List<Integer> deviceIds = new ArrayList<>();
for (String s : strings) {
if (s.length() >= 2) {
//接收无误
......@@ -320,6 +326,8 @@ public class BackController {
deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
//判断是签字入库还是签章入库
DeviceLogDto deviceLogDto = new DeviceLogDto();
if (allotBackReceiveVo.getRightSignatureId()!=null&&!"".equals(allotBackReceiveVo.getRightSignatureId())) {
......@@ -332,6 +340,7 @@ public class BackController {
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
deviceIds.add(id);
}
//接收缺失
if ("0".equals(s.substring(s.length() - 1))) {
......@@ -339,14 +348,19 @@ public class BackController {
//改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(11);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
//存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),taskBto.getId());
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
deviceIds.add(id);
}
}
}
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,deviceIds);
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userId);
// ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(allotBackBill.getSendUnit())).stream()
......@@ -512,8 +526,13 @@ public class BackController {
deviceLibrary.setLifeStatus(2);
deviceLibrary.setOwnUnit(allotBackBill.getReceiveUnit());
deviceLibrary.setManageStatus(1);
deviceLibrary.setStorageLocationId(null);
deviceLibrary.setStorageLocation(null);
deviceLibraryService.update(deviceLibrary);
});
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,ids);
//经办人阅知
// if (idList.size()>0) {
// MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", idList, 1);
......
......@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
......@@ -26,6 +27,7 @@ public class DeviceLibraryPositionController {
@Resource
private DeviceLibraryPositionService deviceLibraryPositionService;
@Transactional(rollbackFor = Exception.class)
@GetMapping("/findByStorageLocationId")
@ApiOperation(value = "根据当前库房位置查询装备")
public ResponseEntity<Map<String, Object>> findByStorageLocationId(@RequestBody QueryTheWarehouseVo queryTheWarehouseVo){
......@@ -33,6 +35,7 @@ public class DeviceLibraryPositionController {
return ResponseEntity.ok(map);
}
@Transactional(rollbackFor = Exception.class)
@PostMapping("/updateDeviceLibraryPosition")
@ApiOperation(value = "修改3D")
public ResponseEntity<String> updateDeviceLibraryPosition(@RequestBody DeviceLibraryPosition deviceLibraryPosition){
......@@ -51,6 +54,7 @@ public class DeviceLibraryPositionController {
return ResponseEntity.ok(deviceLibraryPosition);
}
@Transactional(rollbackFor = Exception.class)
@GetMapping("/delete")
@ApiOperation(value = "根据id删除")
public ResponseEntity<String> deleteByPosition(Integer id){
......
......@@ -24,7 +24,7 @@ public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPos
DeviceLibraryPosition findByDeviceId(Integer deviceId);
DeviceLibraryPosition findAllByDeviceIdIn(List<Integer> deviceIds);
List<DeviceLibraryPosition> findAllByDeviceIdIn(List<Integer> deviceIds);
List<DeviceLibraryPosition> findAllByModel(String model);
......
......@@ -28,7 +28,7 @@ public interface DeviceLibraryPositionService {
DeviceLibraryPosition findByDeviceId(Integer deviceId);
DeviceLibraryPosition findByDeviceIds(List<Integer> deviceIds);
List<DeviceLibraryPosition> findByDeviceIds(List<Integer> deviceIds);
/**
* 根据装备id修改库房位置
......
......@@ -12,6 +12,7 @@ import com.tykj.dev.device.library.subject.model.vo.QueryTheWarehouseVo;
import com.tykj.dev.device.library.subject.vo.DeviceLibraryPositionMessageVo;
import com.tykj.dev.device.library.subject.vo.RotationVo;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -52,7 +53,6 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
@Override
public List<DeviceLibraryPosition> findByStorageLocationId(Integer StorageLocationId) {
return deviceLibraryPositionDao.findAllByStorageLocationId(StorageLocationId);
}
@Override
......@@ -81,15 +81,13 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
}
@Override
public DeviceLibraryPosition findByDeviceIds(List<Integer> deviceIds) {
public List<DeviceLibraryPosition> findByDeviceIds(List<Integer> deviceIds) {
return deviceLibraryPositionDao.findAllByDeviceIdIn(deviceIds);
}
@Override
public void onlyUpdateStorageLocation(Integer StorageLocationId, String StorageLocation,Integer deviceId) {
if (findByDeviceId(deviceId)!=null){
deviceLibraryPositionDao.onlyUpdateStorageLocation(StorageLocationId,StorageLocation,deviceId);
}
public void onlyUpdateStorageLocation(Integer StorageLocationId, String StorageLocation, Integer deviceId) {
deviceLibraryPositionDao.onlyUpdateStorageLocation(StorageLocationId, StorageLocation, deviceId);
}
@Override
......@@ -99,7 +97,7 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
@Override
public void batchUpdateStorageLocation(Integer StorageLocationId, String StorageLocation, List<Integer> deviceIds) {
deviceLibraryPositionDao.batchUpdateStorageLocation(StorageLocationId,StorageLocation,deviceIds);
deviceLibraryPositionDao.batchUpdateStorageLocation(StorageLocationId, StorageLocation, deviceIds);
}
@Override
......@@ -133,25 +131,18 @@ public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionSe
}
@Override
public void updateModelByOldModel(String oldModel,String newModel) {
List<DeviceLibraryPosition> libraryPositions = findByModel(oldModel);
if (!libraryPositions.isEmpty()){
deviceLibraryPositionDao.updateModelByOldModel(oldModel,newModel);
}
public void updateModelByOldModel(String oldModel, String newModel) {
deviceLibraryPositionDao.updateModelByOldModel(oldModel, newModel);
}
@Override
public void updateName(String name, Integer deviceId) {
if (findByDeviceId(deviceId)!=null){
deviceLibraryPositionDao.updateName(name,deviceId);
}
deviceLibraryPositionDao.updateName(name, deviceId);
}
@Override
public void updateSeqNumber(String seqNumber, Integer deviceId) {
if (findByDeviceId(deviceId)!=null){
deviceLibraryPositionDao.updateSeqNumber(seqNumber,deviceId);
}
deviceLibraryPositionDao.updateSeqNumber(seqNumber, deviceId);
}
@Override
......
......@@ -7,6 +7,7 @@ import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceChangeService;
import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
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;
......@@ -149,6 +150,9 @@ public class RepairController {
@Resource
private UnitsCache unitsCache;
@Resource
private DeviceLibraryPositionService deviceLibraryPositionService;
@ApiOperation(value = "判断维修装备是否同一个送修单位", notes = "可以通过这个接口判断维修装备是否同一个送修单位")
@PostMapping(value = "/judge")
@Transactional(rollbackFor = Exception.class)
......@@ -593,6 +597,8 @@ public class RepairController {
if (level == 1) {
deviceLibraryEntity.setLifeStatus(4);
deviceLibraryEntity.setLocationUnit(repairBillSaveVo.getReceiveUnit());
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
} else {
deviceLibraryEntity.setLifeStatus(4);
}
......@@ -661,8 +667,6 @@ public class RepairController {
//
//添加taskId
repairBill2.setTaskId(saveEntity.getId());
//修改备注
return ResultUtil.success(repairBill2);
}
......@@ -776,6 +780,8 @@ public class RepairController {
deviceLibraryEntity.setLifeStatus(4);
deviceLibraryEntity.setLocationUnit(repairBill.getReceiveUnit());
deviceLibraryEntity.setManageStatus(1);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
//存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList, taskBto.getId());
DeviceLogDto deviceLogDto;
......@@ -792,14 +798,19 @@ public class RepairController {
//改变装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(11);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
//存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList, taskBto.getId());
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList, taskBto.getId(),taskBto.getId());
deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity);
idList.add(id);
}
}
}
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,idList);
//改变维修详情装备所在单位为当前单位
repairDetailEntities.forEach(repairDetail -> {
repairDetail.setLocationUnit(repairBill.getReceiveUnit());
......@@ -1337,6 +1348,7 @@ public class RepairController {
}
String[] strings = deviceIdDetail.split("x");
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
List<Integer> deviceIds = new ArrayList<>();
for (String s : strings) {
if (s.length() > 1) {
//接收无误的装备
......@@ -1345,6 +1357,8 @@ public class RepairController {
//更改装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLocationUnit(repairBackBill.getReceiveUnit());
deviceLibraryEntity.setStorageLocation(null);
deviceLibraryEntity.setStorageLocationId(null);
//如果所属和所在一致,状态改为在库
if (deviceLibraryEntity.getOwnUnit().equals(deviceLibraryEntity.getLocationUnit())) {
deviceLibraryEntity.setLifeStatus(2);
......@@ -1353,6 +1367,7 @@ public class RepairController {
}
deviceLibraryEntity.setManageStatus(1);
deviceLibraries.add(deviceLibraryEntity);
deviceIds.add(id);
//添加装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "维修退回装备接收并发起入库", fileVoList, taskBto2.getId());
DeviceLogDto deviceLogDto;
......@@ -1379,6 +1394,8 @@ public class RepairController {
}
}
}
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,deviceIds);
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
if (repairReceiveVo.getTaskId() != null) {
......@@ -2350,6 +2367,9 @@ public class RepairController {
deviceLogService.addLog(deviceLogDto);
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(integer);
deviceLibraryEntity.setLocationUnit(repairBackBill.getReceiveUnit());
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryEntity.setStorageLocation(null);
if (deviceLibraryEntity.getOwnUnit().equals(repairBackBill.getReceiveUnit())){
//在库
deviceLibraryEntity.setLifeStatus(2);
......@@ -2360,6 +2380,8 @@ public class RepairController {
deviceLibraryEntity.setManageStatus(1);
deviceLibraryService.update(deviceLibraryEntity);
});
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,ids);
//获取维修详情
List<RepairDetail> repairDetailList = repairDetailDao.findByRepairBackBillId(repairBackBill.getId());
//单位阅知map
......@@ -2484,11 +2506,16 @@ public class RepairController {
deviceLibraryEntity.setLifeStatus(4);
deviceLibraryEntity.setLocationUnit(repairBill.getReceiveUnit());
deviceLibraryEntity.setManageStatus(1);
//设置为空
deviceLibraryEntity.setStorageLocation(null);
deviceLibraryEntity.setStorageLocationId(null);
deviceLibraryService.update(deviceLibraryEntity);
// DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传维修单", fileVoList, taskBto.getId());
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传维修单", fileVoList, taskBto.getId(),taskBto.getId());
deviceLogService.addLog(deviceLogDto);
});
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,ids);
//改变维修详情装备所在单位为当前单位
repairDetailEntities.forEach(repairDetail -> {
repairDetail.setLocationUnit(repairBill.getReceiveUnit());
......@@ -2855,24 +2882,9 @@ public class RepairController {
BeanUtils.copyProperties(repairBillSaveVo,deviceRepairSendBillEntity);
deviceRepairSendBillEntity.setRepairUserbId(repairBillSaveVo.getRepairUseraId());
deviceRepairSendBillEntity.setRepairUseraId(userId);
// deviceRepairSendBillEntity.setRepairUseraId(repairBillSaveVo.getRepairUseraId());
// deviceRepairSendBillEntity.setRepairUserbId(userId);
deviceRepairSendBillEntity.setReceiveFiles(FilesUtil.stringFileToList(repairBillSaveVo.getReceiveFiles()));
}
// else {
// RepairBill repairBill1 = new RepairBill();
// RepairSendBill deviceRepairSendBillEntity1 = new RepairSendBill();
// BeanUtils.copyProperties(repairBillSaveVo, repairBill1);
// BeanUtils.copyProperties(repairBillSaveVo, deviceRepairSendBillEntity1);
// //进行赋值
//// repairBill1.setRepairUserB(repairBillSaveVo.getRepairUserA());
// repairBill = deviceRepairBillService.addEntity(repairBill1);
// deviceRepairSendBillEntity1.setDeviceRepairBillId(repairBill.getId());
// //进行赋值
// deviceRepairSendBillEntity1.setReceiveFiles(FilesUtil.stringFileToList(repairBillSaveVo.getReceiveFiles()));
// deviceRepairSendBillEntity1.setAgent(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName());
// deviceRepairSendBillEntity = deviceRepairSendBillService.addEntity(deviceRepairSendBillEntity1);
// }
if (repairBillSaveVo.getScriptSaveVos() != null) {
deviceRepairSendBillEntity.setScriptJson(JacksonUtil.toJSon(repairBillSaveVo.getScriptSaveVos()));
}
......@@ -2995,7 +3007,9 @@ public class RepairController {
taskService.moveToEnd(taskBto1);
}
}
List<Integer> deviceIds = new ArrayList<>();
for (DeviceDetailVo d : repairBillSaveVo.getDeviceList()) {
deviceIds.add(d.getDeviceId());
//存放旧详情
RepairDetail oldRepairDetail = null;
//从待维修列表发起维修的
......@@ -3044,6 +3058,8 @@ public class RepairController {
if (level == 1 && units.getType() == 2) {
deviceLibraryEntity.setLifeStatus(4);
deviceLibraryEntity.setLocationUnit(repairBillSaveVo.getReceiveUnit());
deviceLibraryEntity.setStorageLocation(null);
deviceLibraryEntity.setStorageLocationId(null);
}
deviceLibraryEntity.setManageStatus(0);
deviceLibraryService.update(deviceLibraryEntity);
......@@ -3055,6 +3071,8 @@ public class RepairController {
//获取装备id集合
String deviceIdDetail = deviceRepairSendBillEntity.getRepairDeviceCheckDetail();
List<Integer> idList = StringSplitUtil.split(deviceIdDetail);
//修改3D
deviceLibraryPositionService.batchUpdateStorageLocation(null,null,deviceIds);
//如果当前为省,改变装备的所在为中办
if (level == 1 && units.getType() == 1) {
//获取当前业务维修详情 记录
......@@ -3141,14 +3159,6 @@ public class RepairController {
TaskBto task = new TaskBto();
//草稿发起
if (repairBackBillSaveVo.getTaskId() == null) {
// task = new TaskBto(StatusEnum.WAIT_BACK_RECEIVE.id, "["+repairBackBillSaveVo.getReceiveUnit().substring(0,3) + "]型号" + StringSplitUtil.stringListToString(repairBackBillSaveVo.getScriptSaveVos().stream().map(ScriptSaveVo::getModel).distinct().collect(Collectors.toList())) + "共有" + repairBackBillSaveVo.getSendingCount() + "件", null, ".", deviceRepairBackBillEntity1.getId(), BusinessEnum.REPAIR_BACK.id, userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit()), 1, "country", userIds);
// task = new TaskBto(StatusEnum.WAIT_BACK_RECEIVE.id,
// "["+DeviceModelSort.unitNameToDisName(repairBackBillSaveVo.getReceiveUnit())+ "]型号" +
// StringSplitUtil.stringListToString(repairBackBillSaveVo.getScriptSaveVos().stream()
// .map(ScriptSaveVo::getModel).distinct().collect(Collectors.toList())) + "共有" +
// repairBackBillSaveVo.getSendingCount() + "件", null, ".",
// deviceRepairBackBillEntity1.getId(), BusinessEnum.REPAIR_BACK.id,
// userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit()), 1, "country", userIds);
task = new TaskBto(StatusEnum.WAIT_BACK_RECEIVE.id,
"["+DeviceModelSort.unitNameToDisName(repairBackBillSaveVo.getReceiveUnit())+ "]型号" +
StringSplitUtil.stringListToString(repairBackBillSaveVo.getScriptSaveVos().stream()
......@@ -3185,19 +3195,10 @@ public class RepairController {
inputOutputDeviceService.addWhiteDevices(idList, userUtils.getCurrentUnitId(), 1);
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
// ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream()
// .map(User::getUserId)
// .collect(Collectors.toList()));
ids.addAll(userDao.findAllByUnitsId(repairBackBill.getReceiveUnitId()).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
// if (repairBackBillSaveVo.getStartUserbId() != null) {
// List<Integer> idList1 = new ArrayList<>();
// idList1.add(repairBackBillSaveVo.getStartUserbId());
// MessageBto messageBto = new MessageBto(task.getId(), task.getBusinessType(), "被选为签发人", idList1, 1);
// messageService.add(messageBto);
// }
// MessageBto messageBto = new MessageBto(task.getId(), task.getBusinessType(), "向" + userPublicService.getAreaNameByUnitName(repairBackBill.getReceiveUnit()) + "退回维修装备", ids, 1);
List<String> models = repairBackBillSaveVo.getScriptSaveVos().stream().map(ScriptSaveVo::getModel).distinct().collect(Collectors.toList());
MessageBto messageBto = new MessageBto(task.getId(), task.getBusinessType(),
"退回 维修完成设备"+MessageFormatUtil.spellTwoWicket(repairBackBill1.getSendUnit(),repairBackBill1.getReceiveUnit())
......
......@@ -47,6 +47,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledFuture;
import java.util.stream.Collectors;
......@@ -303,6 +304,12 @@ public class SelfCheckController {
@PostMapping(value = "/addBill")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity addSelfExaminationBill(@RequestBody @Validated SelfCheckSaveVo selfCheckSaveVo) {
//当前登录的用户ID
Integer currentUserId = userUtils.getCurrentUserId();
//当前登录的单位ID
Integer unitId = userUtils.getCurrentUnitId();
//当前登录的单位名称
String currentUserUnitName = userUtils.getCurrentUserUnitName();
//添加账单
SelfCheckBill selfExaminationBillEntity;
List<FileVo> fileVoList = new ArrayList<>();
......@@ -312,25 +319,26 @@ public class SelfCheckController {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_SELF_CHECK);
selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId());
selfExaminationBillEntity.setCheckTime(new Date());
selfExaminationBillEntity.setCheckDetail(selfCheckSaveVo.getCheckDetail());
selfExaminationBillEntity.setCheckResult(selfCheckSaveVo.getCheckResult());
selfExaminationBillEntity.setCheckStatus(0);
selfExaminationBillEntity.setCheckedCount(selfCheckSaveVo.getCheckedCount());
selfExaminationBillEntity.setCheckingCount(selfCheckSaveVo.getCheckingCount());
selfExaminationBillEntity.setUserbId(selfCheckSaveVo.getUserbId());
selfExaminationBillEntity.setHandheldTerminalInformation(selfCheckSaveVo.getHandheldTerminalInformation());
BeanUtils.copyProperties(selfCheckSaveVo,selfExaminationBillEntity);
// selfExaminationBillEntity.setCheckDetail(selfCheckSaveVo.getCheckDetail());
// selfExaminationBillEntity.setCheckResult(selfCheckSaveVo.getCheckResult());
// selfExaminationBillEntity.setCheckedCount(selfCheckSaveVo.getCheckedCount());
// selfExaminationBillEntity.setCheckingCount(selfCheckSaveVo.getCheckingCount());
// selfExaminationBillEntity.setUserbId(selfCheckSaveVo.getUserbId());
// selfExaminationBillEntity.setHandheldTerminalInformation(selfCheckSaveVo.getHandheldTerminalInformation());
if (selfCheckSaveVo.getUnStockDevices()!=null&&selfCheckSaveVo.getUnStockDevices().size()>0){
selfExaminationBillEntity.setUnStockDetail(JacksonUtil.toJSon(selfCheckSaveVo.getUnStockDevices()));
}
}
else {
selfExaminationBillEntity = selfCheckSaveVo.toDo();
selfExaminationBillEntity.setTitle(userUtils.getCurrentUserUnitName() + "发起的自查任务");
selfExaminationBillEntity.setCheckUnit(userUtils.getCurrentUserUnitName());
selfExaminationBillEntity.setCheckUnitId(userUtils.getCurrentUnitId());
selfExaminationBillEntity.setTitle(currentUserUnitName + "发起的自查任务");
selfExaminationBillEntity.setCheckUnit(currentUserUnitName);
selfExaminationBillEntity.setCheckUnitId(unitId);
}
selfExaminationBillEntity.setUseraId(userUtils.getCurrentUserId());
selfExaminationBillEntity.setCreateUnitId(userUtils.getCurrentUnitId());
selfExaminationBillEntity.setUseraId(currentUserId);
selfExaminationBillEntity.setCreateUnitId(unitId);
if (selfCheckSaveVo.getNewDeviceList() != null) {
//按新增不在系统的装备按rfid卡号拼接保存
StringBuilder stringBuffer = new StringBuilder();
......@@ -348,7 +356,7 @@ public class SelfCheckController {
});
}
SelfCheckBill selfExaminationBillEntity1 = selfExaminationBillService.addEntity(selfExaminationBillEntity);
Integer userId = userUtils.getCurrentUserId();
// Integer userId = userUtils.getCurrentUserId();
String deviceIdDetail = selfCheckSaveVo.getCheckDetail();
String[] strings = deviceIdDetail.split("x");
if (selfCheckSaveVo.getTaskId()!=null){
......@@ -357,14 +365,14 @@ public class SelfCheckController {
if (selfCheckSaveVo.getType()==0){
taskBto.setCustomInfo("手动");
//添加涉及人员
taskService.addInvolveUser(taskBto,userId);
taskService.addInvolveUser(taskBto,currentUserId);
//推至下一阶段
taskService.moveToNext(taskBto,selfExaminationBillEntity1.getUseraId());
}
else if (selfCheckSaveVo.getType()==1){
taskBto.setCustomInfo("扫码");
//添加涉及人员
taskService.addInvolveUser(taskBto,userId);
taskService.addInvolveUser(taskBto,currentUserId);
if (selfCheckSaveVo.getUserbId()!=null) {
taskService.moveToEnd(taskBto);
selfExaminationBillEntity1.setUserbId(selfCheckSaveVo.getUserbId());
......@@ -387,11 +395,13 @@ public class SelfCheckController {
else {
//发起任务
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
userIds.add(currentUserId);
// if (selfExaminationBillEntity1.getUserbId()!=null){
// userIds.add(selfExaminationBillEntity1.getUserbId());
// }
taskBto = new TaskBto(StatusEnum.SELF_CHECK_CONFIRM.id, userUtils.getCurrentUserUnitName() + "发起的自查任务", null, ".", selfExaminationBillEntity1.getId(), 4, userUtils.getCurrentUnitId(), 0, null, userIds);
taskBto = new TaskBto(StatusEnum.SELF_CHECK_CONFIRM.id, currentUserUnitName + "发起的自查任务",
null, ".", selfExaminationBillEntity1.getId(), 4,
currentUserId, 0, null, userIds);
if (selfCheckSaveVo.getType()==0){
taskBto.setCustomInfo("手动");
taskService.start(taskBto);
......@@ -421,22 +431,154 @@ public class SelfCheckController {
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,userId,taskBto.getId());
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,currentUserId,taskBto.getId());
deviceLogDtos.add(deviceLogDto);
// deviceLogService.addLog(deviceLogDto);
}
}
executor.execute(
()->{
deviceLogService.addAllLog(deviceLogDtos);
}
);
executor.execute(()->deviceLogService.addAllLog(deviceLogDtos));
log.info("[自查模块]:发起自查");
myWebSocket.sendMessage1();
return ResultUtil.success(selfExaminationBillEntity1);
}
// @ApiOperation(value = "发起自查业务", notes = "可以通过这个接口发起自查业务")
// @PostMapping(value = "/addBill")
// @Transactional(rollbackFor = Exception.class)
// public ResponseEntity addSelfExaminationBill(@RequestBody @Validated SelfCheckSaveVo selfCheckSaveVo) {
// //添加账单
// SelfCheckBill selfExaminationBillEntity;
// List<FileVo> fileVoList = new ArrayList<>();
// TaskBto taskBto;
// if (selfCheckSaveVo.getTaskId()!=null){
// taskBto = taskService.get(selfCheckSaveVo.getTaskId());
// TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_SELF_CHECK);
// selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId());
// selfExaminationBillEntity.setCheckTime(new Date());
// selfExaminationBillEntity.setCheckDetail(selfCheckSaveVo.getCheckDetail());
// selfExaminationBillEntity.setCheckResult(selfCheckSaveVo.getCheckResult());
// selfExaminationBillEntity.setCheckStatus(0);
// selfExaminationBillEntity.setCheckedCount(selfCheckSaveVo.getCheckedCount());
// selfExaminationBillEntity.setCheckingCount(selfCheckSaveVo.getCheckingCount());
// selfExaminationBillEntity.setUserbId(selfCheckSaveVo.getUserbId());
// selfExaminationBillEntity.setHandheldTerminalInformation(selfCheckSaveVo.getHandheldTerminalInformation());
// if (selfCheckSaveVo.getUnStockDevices()!=null&&selfCheckSaveVo.getUnStockDevices().size()>0){
// selfExaminationBillEntity.setUnStockDetail(JacksonUtil.toJSon(selfCheckSaveVo.getUnStockDevices()));
// }
// }
// else {
// selfExaminationBillEntity = selfCheckSaveVo.toDo();
// selfExaminationBillEntity.setTitle(userUtils.getCurrentUserUnitName() + "发起的自查任务");
// selfExaminationBillEntity.setCheckUnit(userUtils.getCurrentUserUnitName());
// selfExaminationBillEntity.setCheckUnitId(userUtils.getCurrentUnitId());
// }
// selfExaminationBillEntity.setUseraId(userUtils.getCurrentUserId());
// selfExaminationBillEntity.setCreateUnitId(userUtils.getCurrentUnitId());
// if (selfCheckSaveVo.getNewDeviceList() != null) {
// //按新增不在系统的装备按rfid卡号拼接保存
// StringBuilder stringBuffer = new StringBuilder();
// stringBuffer.append(".");
// for (String s : selfCheckSaveVo.getNewDeviceList()) {
// stringBuffer.append(s);
// stringBuffer.append(".");
// }
// selfExaminationBillEntity.setNewDeviceDetail(stringBuffer.toString());
// }
// if(selfCheckSaveVo.getCheckFiles()!=null&&selfCheckSaveVo.getCheckFiles().size()>0) {
// selfExaminationBillEntity.setCheckFiles(FilesUtil.stringFileToList(selfCheckSaveVo.getCheckFiles()));
// selfCheckSaveVo.getCheckFiles().forEach(fileRet -> {
// fileVoList.add(new FileVo("自查单", fileRet.getName(), fileRet.getPreviewPath()));
// });
// }
// SelfCheckBill selfExaminationBillEntity1 = selfExaminationBillService.addEntity(selfExaminationBillEntity);
// Integer userId = userUtils.getCurrentUserId();
// String deviceIdDetail = selfCheckSaveVo.getCheckDetail();
// String[] strings = deviceIdDetail.split("x");
// if (selfCheckSaveVo.getTaskId()!=null){
// //获取任务
// taskBto = taskService.get(selfCheckSaveVo.getTaskId());
// if (selfCheckSaveVo.getType()==0){
// taskBto.setCustomInfo("手动");
// //添加涉及人员
// taskService.addInvolveUser(taskBto,userId);
// //推至下一阶段
// taskService.moveToNext(taskBto,selfExaminationBillEntity1.getUseraId());
// }
// else if (selfCheckSaveVo.getType()==1){
// taskBto.setCustomInfo("扫码");
// //添加涉及人员
// taskService.addInvolveUser(taskBto,userId);
// if (selfCheckSaveVo.getUserbId()!=null) {
// taskService.moveToEnd(taskBto);
// selfExaminationBillEntity1.setUserbId(selfCheckSaveVo.getUserbId());
// List<Integer> idList = new ArrayList<>();
// idList.add(selfCheckSaveVo.getUserbId());
// //阅知
// MessageBto messageBto = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "完成终端自查", idList, 0,0);
// messageService.add(messageBto);
// }
// else {
// taskService.moveToNext(taskBto,selfExaminationBillEntity1.getUseraId());
// }
// selfExaminationBillEntity1.setCheckStatus(2);
// selfExaminationBillService.update(selfExaminationBillEntity1);
// }
// else {
// throw new ApiException("type只能为0或1");
// }
// }
// else {
// //发起任务
// List<Integer> userIds = new ArrayList<>();
// userIds.add(userId);
//// if (selfExaminationBillEntity1.getUserbId()!=null){
//// userIds.add(selfExaminationBillEntity1.getUserbId());
//// }
// taskBto = new TaskBto(StatusEnum.SELF_CHECK_CONFIRM.id, userUtils.getCurrentUserUnitName() + "发起的自查任务", null, ".", selfExaminationBillEntity1.getId(), 4, userUtils.getCurrentUnitId(), 0, null, userIds);
// if (selfCheckSaveVo.getType()==0){
// taskBto.setCustomInfo("手动");
// taskService.start(taskBto);
// }
// else if (selfCheckSaveVo.getType()==1){
// taskBto.setCustomInfo("扫码");
// if (selfCheckSaveVo.getUserbId()!=null) {
// taskBto.setBillStatus(StatusEnum.END.id);
// }
//// taskBto.setCurrentPoint(0);
// TaskBto taskBto1 = taskService.start(taskBto);
// if (selfCheckSaveVo.getUserbId()!=null) {
// selfExaminationBillEntity1.setUserbId(selfCheckSaveVo.getUserbId());
// List<Integer> idList = new ArrayList<>();
// idList.add(selfCheckSaveVo.getUserbId());
// //阅知
// MessageBto messageBto = new MessageBto(taskBto1.getId(), taskBto1.getBusinessType(), "完成终端自查", idList, 0);
// messageService.add(messageBto);
// }
// selfExaminationBillEntity1.setCheckStatus(2);
// selfExaminationBillService.update(selfExaminationBillEntity1);
// }
// }
// //添加装备日志
// //进行修改日志存储慢的问题
// List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
// for (String s:strings) {
// if (s.length()>=2) {
// Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
//// DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),null);
// DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,userId,taskBto.getId());
// deviceLogDtos.add(deviceLogDto);
//// deviceLogService.addLog(deviceLogDto);
// }
// }
// executor.execute(
// ()->{
// deviceLogService.addAllLog(deviceLogDtos);
// }
// );
// log.info("[自查模块]:发起自查");
// myWebSocket.sendMessage1();
// return ResultUtil.success(selfExaminationBillEntity1);
// }
@ApiOperation(value = "自查审核", notes = "可以通过这个接口自查审核")
@PostMapping(value = "/selfExaminationConfirm")
@Transactional(rollbackFor = Exception.class)
......@@ -492,13 +634,16 @@ public class SelfCheckController {
taskService.update(taskService.moveToArchive(taskBto));
selfExaminationBillEntity.setCheckStatus(1);
selfExaminationBillService.update(selfExaminationBillEntity);
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"自查审核失败",null,userId,taskBto.getId());
deviceLogService.addLog(deviceLogDto);
deviceLogDtos.add(deviceLogDto);
// deviceLogService.addLog(deviceLogDto);
}
}
CompletableFuture.runAsync(() -> deviceLogService.addAllLog(deviceLogDtos));
log.info("[自查模块]:自查审核失败");
myWebSocket.sendMessage1();
return ResultUtil.success("自查审核失败");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论