提交 f7ccbf2b authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块,配套设备库模块):…

feat(装备模块,配套设备库模块): 入库新增存放位置的id,修改装备存放位置的id,根据装备的存放位置查询装备,入库配套设备新增存放位置的id,修改配套装备存放位置的id,根据配套装备的存放位置查询装备, 入库新增存放位置的id,修改装备存放位置的id,根据装备的存放位置查询装备,入库配套设备新增存放位置的id,修改配套装备存放位置的id,根据配套装备的存放位置查询装备,
上级 a52d1735
...@@ -782,6 +782,7 @@ public class DeviceLibraryController { ...@@ -782,6 +782,7 @@ public class DeviceLibraryController {
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(), "将存放位置改为"+libraryUpdateVo.getStorageLocation(), null,null,null); DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(), "将存放位置改为"+libraryUpdateVo.getStorageLocation(), null,null,null);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryEntity.setStorageLocation(libraryUpdateVo.getStorageLocation()); deviceLibraryEntity.setStorageLocation(libraryUpdateVo.getStorageLocation());
deviceLibraryEntity.setStorageLocationId(libraryUpdateVo.getStorageLocationId());
} }
//add 备注 //add 备注
if (libraryUpdateVo.getRecord()!=null && !libraryUpdateVo.getRecord().equals(deviceLibraryEntity.getRecord())){ if (libraryUpdateVo.getRecord()!=null && !libraryUpdateVo.getRecord().equals(deviceLibraryEntity.getRecord())){
...@@ -931,6 +932,7 @@ public class DeviceLibraryController { ...@@ -931,6 +932,7 @@ public class DeviceLibraryController {
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(deviceStorageLocation.getDevId()); DeviceLibrary deviceLibrary = deviceLibraryService.getOne(deviceStorageLocation.getDevId());
//添加修改存放装备位置 //添加修改存放装备位置
deviceLibrary.setStorageLocation(deviceStorageLocation.getStorageLocation()); deviceLibrary.setStorageLocation(deviceStorageLocation.getStorageLocation());
deviceLibrary.setStorageLocationId(deviceStorageLocation.getStorageLocationId());
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceStorageLocation.getDevId(), "将存放位置改为"+deviceStorageLocation.getStorageLocation(), null,null,null); DeviceLogDto deviceLogDto = new DeviceLogDto(deviceStorageLocation.getDevId(), "将存放位置改为"+deviceStorageLocation.getStorageLocation(), null,null,null);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibrary); deviceLibraryService.update(deviceLibrary);
...@@ -974,8 +976,15 @@ public class DeviceLibraryController { ...@@ -974,8 +976,15 @@ public class DeviceLibraryController {
@ApiOperation("入库修改试用装备的序列号") @ApiOperation("入库修改试用装备的序列号")
@PostMapping("updateSeq") @PostMapping("updateSeq")
@CacheEvict(value = "devicesLibraryList",key = "'device'",allEntries = true)
public ResponseEntity updateSeq(@RequestBody List<DeviceForApplyVo> deviceForApplyVos){ public ResponseEntity updateSeq(@RequestBody List<DeviceForApplyVo> deviceForApplyVos){
deviceLibraryService.updateSeqNumber(deviceForApplyVos); deviceLibraryService.updateSeqNumber(deviceForApplyVos);
//异步去查询数据库
executor.execute(
()->{
cacheLibraryService.getAllDeviceLibraryList();
}
);
return ResponseEntity.ok("更新成功"); return ResponseEntity.ok("更新成功");
} }
......
...@@ -225,8 +225,8 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>, ...@@ -225,8 +225,8 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Transactional @Transactional
@Modifying @Modifying
@Query("update DeviceLibrary o set o.storageLocation = :storageLocation where o.id in :deviceIds") @Query("update DeviceLibrary o set o.storageLocation = :storageLocation,o.storageLocationId = :storageLocationId where o.id in :deviceIds")
int updateStorageLocation( @Param("storageLocation") String storageLocation, int updateStorageLocation( @Param("storageLocation") String storageLocation,@Param("storageLocationId") Integer storageLocationId,
@Param("deviceIds") List<Integer> deviceIds); @Param("deviceIds") List<Integer> deviceIds);
......
...@@ -236,6 +236,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -236,6 +236,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
d.setName(deviceLibrarySelectVo.getName()); d.setName(deviceLibrarySelectVo.getName());
d.setContent(deviceLibrarySelectVo.getContent()); d.setContent(deviceLibrarySelectVo.getContent());
d.setType(deviceLibrarySelectVo.getType()); d.setType(deviceLibrarySelectVo.getType());
d.setStorageLocationId(deviceLibrarySelectVo.getStorageLocationId());
//获取所有的核心装备 //获取所有的核心装备
List<DeviceLibrary> libraryEntities = getCoreDevicePage(d); List<DeviceLibrary> libraryEntities = getCoreDevicePage(d);
if (libraryEntities.size() > 0) { if (libraryEntities.size() > 0) {
...@@ -1156,7 +1157,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1156,7 +1157,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
updateStorageLocationVo.getStorageLocation(),null,userId); updateStorageLocationVo.getStorageLocation(),null,userId);
deviceLogDtos.add(deviceLogDto); deviceLogDtos.add(deviceLogDto);
}}); }});
deviceLibraryDao.updateStorageLocation(updateStorageLocationVo.getStorageLocation(),deviceIds); deviceLibraryDao.updateStorageLocation(updateStorageLocationVo.getStorageLocation(),
updateStorageLocationVo.getStorageLocationId(),deviceIds);
}else { }else {
throw new ApiException("请选择要修改的装备"); throw new ApiException("请选择要修改的装备");
} }
...@@ -1372,7 +1374,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1372,7 +1374,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
predicateBuilder.in("seqNumber", DeviceSeqUtil.selectDeviceSeqs(deviceLibrarySelectVo.getSeqInterval())); predicateBuilder.in("seqNumber", DeviceSeqUtil.selectDeviceSeqs(deviceLibrarySelectVo.getSeqInterval()));
} }
//新增库房位置 //新增库房位置
predicateBuilder.eq(deviceLibrarySelectVo.getStorageLocation() != null,"storageLocation",deviceLibrarySelectVo.getStorageLocation()); predicateBuilder.eq(deviceLibrarySelectVo.getStorageLocationId() != null,"storageLocationId",deviceLibrarySelectVo.getStorageLocationId());
//新增装备的形态 //新增装备的形态
predicateBuilder.eq(deviceLibrarySelectVo.getType() != null,"type",deviceLibrarySelectVo.getType()); predicateBuilder.eq(deviceLibrarySelectVo.getType() != null,"type",deviceLibrarySelectVo.getType());
} }
......
...@@ -239,6 +239,9 @@ public class DeviceLibrary implements Serializable { ...@@ -239,6 +239,9 @@ public class DeviceLibrary implements Serializable {
@ApiModelProperty(value = "装备存放位置",notes = "默认是库房") @ApiModelProperty(value = "装备存放位置",notes = "默认是库房")
private String storageLocation; private String storageLocation;
@ApiModelProperty(value = "装备存放位置Id",notes = "默认是库房")
private Integer storageLocationId;
@Transient @Transient
private List<DeviceLibrary> childs = new ArrayList<>(); private List<DeviceLibrary> childs = new ArrayList<>();
......
...@@ -60,6 +60,9 @@ public class DeviceLibrarySaveVo { ...@@ -60,6 +60,9 @@ public class DeviceLibrarySaveVo {
@ApiModelProperty(value = "装备存放位置",notes = "默认是库房") @ApiModelProperty(value = "装备存放位置",notes = "默认是库房")
private String storageLocation; private String storageLocation;
@ApiModelProperty(value = "装备存放位置的id",notes = "默认是库房id")
private Integer storageLocationId;
@ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试") @ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试")
private Integer tryOutDevice = 0; private Integer tryOutDevice = 0;
......
...@@ -123,6 +123,9 @@ public class DeviceLibrarySelectVo extends CustomPage { ...@@ -123,6 +123,9 @@ public class DeviceLibrarySelectVo extends CustomPage {
@ApiModelProperty(value = "存储位置") @ApiModelProperty(value = "存储位置")
private String storageLocation; private String storageLocation;
@ApiModelProperty(value = "存储位置")
private Integer storageLocationId;
@ApiModelProperty(value = "存储位置的模糊查询字段") @ApiModelProperty(value = "存储位置的模糊查询字段")
private String storageLocationDim; private String storageLocationDim;
......
...@@ -48,6 +48,9 @@ public class DeviceLibraryUpdateVo { ...@@ -48,6 +48,9 @@ public class DeviceLibraryUpdateVo {
@ApiModelProperty("库存位置") @ApiModelProperty("库存位置")
private String storageLocation; private String storageLocation;
@ApiModelProperty("库存位置id")
private Integer storageLocationId;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String record; private String record;
......
...@@ -22,4 +22,7 @@ public class DeviceStorageLocation { ...@@ -22,4 +22,7 @@ public class DeviceStorageLocation {
@ApiModelProperty(value = "库存位置") @ApiModelProperty(value = "库存位置")
private String storageLocation; private String storageLocation;
@ApiModelProperty(value = "库存位置id")
private Integer storageLocationId;
} }
...@@ -21,4 +21,7 @@ public class UpdateStorageLocationVo { ...@@ -21,4 +21,7 @@ public class UpdateStorageLocationVo {
@ApiModelProperty(value = "要修改的库房位置") @ApiModelProperty(value = "要修改的库房位置")
private String storageLocation; private String storageLocation;
@ApiModelProperty(value = "要修改的库房位置id")
private Integer storageLocationId;
} }
...@@ -529,6 +529,16 @@ public class MatchingDeviceController { ...@@ -529,6 +529,16 @@ public class MatchingDeviceController {
m.setDeviceId(0); m.setDeviceId(0);
} }
if (matchingDeviceEditVo.getMatchingDeviceStorageLocation() != null &&
!m.getMatchingDeviceStorageLocation().equals(matchingDeviceEditVo.getMatchingDeviceStorageLocation())) {
//添加设备日志 存放位置
String remark = "将设备的存放位置改为" + matchingDeviceEditVo.getMatchingDeviceStorageLocation();
DeviceLogDto deviceLogDto = new DeviceLogDto(1, matchingDeviceEditVo.getMatchingDeviceId(), remark, null,null);
deviceLogService.addLog(deviceLogDto);
m.setMatchingDeviceStorageLocation(m.getMatchingDeviceStorageLocation());
m.setMatchingDeviceStorageLocationId(m.getMatchingDeviceStorageLocationId());
}
matchingDeviceLibraryService.update(m); matchingDeviceLibraryService.update(m);
return ResponseEntity.ok("修改成功"); return ResponseEntity.ok("修改成功");
} }
......
...@@ -377,6 +377,8 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -377,6 +377,8 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
predicateBuilder.in("rfidCardId", ""); predicateBuilder.in("rfidCardId", "");
} }
} }
predicateBuilder.eq(matchingDeviceSelectVo.getMatchingDeviceStorageLocationId() != null,
"matchingDeviceStorageLocationId",matchingDeviceSelectVo.getMatchingDeviceStorageLocationId());
return predicateBuilder; return predicateBuilder;
} }
} }
...@@ -136,6 +136,12 @@ public class MatchingDeviceLibrary { ...@@ -136,6 +136,12 @@ public class MatchingDeviceLibrary {
@Transient @Transient
private String deviceSeqNumber; private String deviceSeqNumber;
@ApiModelProperty(value = "存放位置")
private String matchingDeviceStorageLocation;
@ApiModelProperty(value = "存放位置id")
private Integer matchingDeviceStorageLocationId;
public MatchingDeviceLibrary setConfigName(){ public MatchingDeviceLibrary setConfigName(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache"); ConfigCache configCache = SpringUtils.getBean("initConfigCache");
......
...@@ -62,4 +62,10 @@ public class MatchingDeviceEditVo { ...@@ -62,4 +62,10 @@ public class MatchingDeviceEditVo {
@ApiModelProperty(value = "删除相关装备id") @ApiModelProperty(value = "删除相关装备id")
private Integer deleteDeviceId; private Integer deleteDeviceId;
@ApiModelProperty(value = "存放位置")
private String matchingDeviceStorageLocation;
@ApiModelProperty(value = "存放位置id")
private Integer matchingDeviceStorageLocationId;
} }
...@@ -58,6 +58,12 @@ public class MatchingDeviceSaveVo { ...@@ -58,6 +58,12 @@ public class MatchingDeviceSaveVo {
@ApiModelProperty(value = "序列号集合") @ApiModelProperty(value = "序列号集合")
private List<String> seqList; private List<String> seqList;
@ApiModelProperty(value = "存放位置")
private String matchingDeviceStorageLocation;
@ApiModelProperty(value = "存放位置id")
private Integer matchingDeviceStorageLocationId;
public MatchingDeviceLibrary toDo() { public MatchingDeviceLibrary toDo() {
MatchingDeviceLibrary matchingDeviceLibraryEntity = new MatchingDeviceLibrary(); MatchingDeviceLibrary matchingDeviceLibraryEntity = new MatchingDeviceLibrary();
BeanUtils.copyProperties(this, matchingDeviceLibraryEntity); BeanUtils.copyProperties(this, matchingDeviceLibraryEntity);
......
...@@ -33,6 +33,9 @@ public class MatchingDeviceSelectVo extends CustomPage { ...@@ -33,6 +33,9 @@ public class MatchingDeviceSelectVo extends CustomPage {
@ApiModelProperty(value = "查询是否打印标签(有没有表面号)装备") @ApiModelProperty(value = "查询是否打印标签(有没有表面号)装备")
private Integer isPrint; private Integer isPrint;
@ApiModelProperty(value = "存放位置id")
private Integer matchingDeviceStorageLocationId;
private String typeDim; private String typeDim;
private String modelDim; private String modelDim;
......
...@@ -31,4 +31,6 @@ public class StorageBillDetail { ...@@ -31,4 +31,6 @@ public class StorageBillDetail {
private String typeName; private String typeName;
@ApiModelProperty(value = "装备存放位置",notes = "默认是库房") @ApiModelProperty(value = "装备存放位置",notes = "默认是库房")
private String storageLocation; private String storageLocation;
@ApiModelProperty(value = "装备存放位置的id",notes = "默认是库房id")
private Integer storageLocationId;
} }
...@@ -16,17 +16,25 @@ public class StorageBillDetailVo { ...@@ -16,17 +16,25 @@ public class StorageBillDetailVo {
@ApiModelProperty(value = "配件列表") @ApiModelProperty(value = "配件列表")
List<StorageBillDetailVo> list; List<StorageBillDetailVo> list;
@ApiModelProperty(value = "列装id") @ApiModelProperty(value = "列装id")
private Integer packingId; private Integer packingId;
@ApiModelProperty(value = "入库数量") @ApiModelProperty(value = "入库数量")
private Integer storageCount; private Integer storageCount;
@ApiModelProperty(value = "序列号区间") @ApiModelProperty(value = "序列号区间")
private String seqInterval; private String seqInterval;
@ApiModelProperty(value = "生产号区间") @ApiModelProperty(value = "生产号区间")
private String prodInterval; private String prodInterval;
@ApiModelProperty(value = "列装装备") @ApiModelProperty(value = "列装装备")
private PackingLibrary packingLibrary; private PackingLibrary packingLibrary;
@ApiModelProperty(value = "装备存放位置",notes = "默认是库房") @ApiModelProperty(value = "装备存放位置",notes = "默认是库房")
private String storageLocation; private String storageLocation;
@ApiModelProperty(value = "装备存放位置的id",notes = "默认是库房id")
private Integer storageLocationId;
} }
...@@ -118,6 +118,9 @@ public class StorageBillSaveVo { ...@@ -118,6 +118,9 @@ public class StorageBillSaveVo {
@ApiModelProperty(value = "装备存放位置",notes = "默认是库房") @ApiModelProperty(value = "装备存放位置",notes = "默认是库房")
private String storageLocation ; private String storageLocation ;
@ApiModelProperty(value = "装备存放位置的id",notes = "默认是库房id")
private Integer storageLocationId;
@ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试") @ApiModelProperty(value = "是否是试用装备",notes = "0 是正式 1 是测试")
private Integer tryOutDevice = 0; private Integer tryOutDevice = 0;
......
package com.tykj.dev.union; //package com.tykj.dev.union;
//
import com.tykj.dev.device.allot.repository.AllotBackBillDao; //import com.tykj.dev.device.allot.repository.AllotBackBillDao;
import com.tykj.dev.device.allot.repository.AllotBillDao; //import com.tykj.dev.device.allot.repository.AllotBillDao;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill; //import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill; //import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail; //import com.tykj.dev.device.apply.repository.DeviceApplyBillDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao; //import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao; //import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; //import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.repair.repository.RepairBackBillDao; //import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.repair.repository.RepairBillDao; //import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.repair.repository.RepairDetailDao; //import com.tykj.dev.device.repair.repository.RepairBackBillDao;
import com.tykj.dev.device.repair.repository.RepairSendBillDao; //import com.tykj.dev.device.repair.repository.RepairBillDao;
import com.tykj.dev.device.repair.subject.domin.RepairBackBill; //import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.subject.domin.RepairBill; //import com.tykj.dev.device.repair.repository.RepairSendBillDao;
import com.tykj.dev.device.repair.subject.domin.RepairDetail; //import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
import com.tykj.dev.device.repair.subject.domin.RepairSendBill; //import com.tykj.dev.device.repair.subject.domin.RepairBill;
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao; //import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill; //import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
import com.tykj.dev.device.user.subject.dao.UnitsDao; //import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
import com.tykj.dev.device.user.subject.entity.Units; //import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.user.util.AuthenticationUtils; //import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.util.UserUtils; //import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.usereport.repository.DeviceUseReportDao; //import com.tykj.dev.device.user.util.AuthenticationUtils;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport; //import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.utils.SpringUtils; //import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
import lombok.extern.slf4j.Slf4j; //import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import org.springframework.beans.factory.annotation.Autowired; //import com.tykj.dev.misc.utils.SpringUtils;
import org.springframework.boot.CommandLineRunner; //import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn; //import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order; //import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component; //import org.springframework.context.annotation.DependsOn;
import org.springframework.transaction.annotation.Transactional; //import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; //import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; //
import java.util.Collections; //import javax.annotation.PostConstruct;
import java.util.List; //import javax.annotation.Resource;
//import java.util.Collections;
@Slf4j //import java.util.List;
@Component //
public class DataInit { //@Slf4j
//@Component
@Resource //public class DataInit {
private UnitsDao unitsDao; //
// @Resource
@Autowired // private UnitsDao unitsDao;
private AllotBillDao allotBillDao; //
@Autowired // @Autowired
private AllotBackBillDao allotBackBillDao; // private AllotBillDao allotBillDao;
@Autowired // @Autowired
private RepairBackBillDao repairBackBillDao; // private AllotBackBillDao allotBackBillDao;
@Autowired // @Autowired
private RepairDetailDao repairDetailDao; // private RepairBackBillDao repairBackBillDao;
@Autowired // @Autowired
private RepairSendBillDao repairSendBillDao; // private RepairDetailDao repairDetailDao;
@Autowired // @Autowired
private RepairBillDao repairBillDao; // private RepairSendBillDao repairSendBillDao;
@Autowired // @Autowired
private SelfCheckBillDao selfCheckBillDao; // private RepairBillDao repairBillDao;
@Autowired // @Autowired
private DeviceUseReportDao deviceUseReportDao; // private SelfCheckBillDao selfCheckBillDao;
// @Autowired
@Autowired // private DeviceUseReportDao deviceUseReportDao;
private MatchingDeviceLibraryDao matchingDeviceLibraryDao; //
// @Autowired
@Autowired // private DeviceApplyBillDao deviceApplyBillDao;
private UserUtils userUtils; //
// @Autowired
@Autowired // private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
private SpringUtils springUtils; //
// @Autowired
@Autowired // private UserUtils userUtils;
private com.tykj.dev.device.user.util.AuthenticationUtils AuthenticationUtils; //
// @Autowired
private void initCheckDetailUnitName() { // private SpringUtils springUtils;
// 对现有的数据补充unitId信息 //
allotBillDao.findAll().forEach(this::saveModifyDetail1); // @Autowired
allotBackBillDao.findAll().forEach(this::saveModifyDetail2); // private com.tykj.dev.device.user.util.AuthenticationUtils AuthenticationUtils;
selfCheckBillDao.findAll().forEach(this::saveModifyDetail3); //
repairBillDao.findAll().forEach(this::saveModifyDetail4); // private void initCheckDetailUnitName() {
repairSendBillDao.findAll().forEach(this::saveModifyDetail5); // // 对现有的数据补充unitId信息
repairDetailDao.findAll().forEach(this::saveModifyDetail6); // allotBillDao.findAll().forEach(this::saveModifyDetail1);
repairBackBillDao.findAll().forEach(this::saveModifyDetail7); // allotBackBillDao.findAll().forEach(this::saveModifyDetail2);
deviceUseReportDao.findAll().forEach(this::saveModifyDetail8); // selfCheckBillDao.findAll().forEach(this::saveModifyDetail3);
matchingDeviceLibraryDao.findAll().forEach(this::saveModifyDetail9); // repairBillDao.findAll().forEach(this::saveModifyDetail4);
} // repairSendBillDao.findAll().forEach(this::saveModifyDetail5);
// repairDetailDao.findAll().forEach(this::saveModifyDetail6);
// repairBackBillDao.findAll().forEach(this::saveModifyDetail7);
private void saveModifyDetail1(AllotBill allotBill) { // deviceUseReportDao.findAll().forEach(this::saveModifyDetail8);
String receiveUnit = allotBill.getReceiveUnit(); // matchingDeviceLibraryDao.findAll().forEach(this::saveModifyDetail9);
String sendUnit = allotBill.getSendUnit(); // }
//
Integer receiveUnitId = getUnitId(receiveUnit); //
Integer sendUnitId = getUnitId(sendUnit); // private void saveModifyDetail1(AllotBill allotBill) {
// String receiveUnit = allotBill.getReceiveUnit();
if (receiveUnitId != -1 && sendUnitId != -1) { // String sendUnit = allotBill.getSendUnit();
allotBill.setReceiveUnitId(receiveUnitId); //
allotBill.setSendUnitId(sendUnitId); // Integer receiveUnitId = getUnitId(receiveUnit);
log.info("[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // Integer sendUnitId = getUnitId(sendUnit);
sendUnit, receiveUnit,sendUnitId,receiveUnitId); //
allotBillDao.save(allotBill); // if (receiveUnitId != -1 && sendUnitId != -1) {
} // allotBill.setReceiveUnitId(receiveUnitId);
// allotBill.setSendUnitId(sendUnitId);
} // log.info("[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
private void saveModifyDetail2(AllotBackBill allotBackBill) { // allotBillDao.save(allotBill);
String receiveUnit = allotBackBill.getReceiveUnit(); // }
String sendUnit = allotBackBill.getSendUnit(); //
// }
Integer receiveUnitId = getUnitId(receiveUnit); //
Integer sendUnitId = getUnitId(sendUnit); // private void saveModifyDetail2(AllotBackBill allotBackBill) {
// String receiveUnit = allotBackBill.getReceiveUnit();
if (receiveUnitId != -1 && sendUnitId != -1) { // String sendUnit = allotBackBill.getSendUnit();
allotBackBill.setReceiveUnitId(receiveUnitId); //
allotBackBill.setSendUnitId(sendUnitId); // Integer receiveUnitId = getUnitId(receiveUnit);
log.info("[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // Integer sendUnitId = getUnitId(sendUnit);
sendUnit, receiveUnit,sendUnitId,receiveUnitId); //
allotBackBillDao.save(allotBackBill); // if (receiveUnitId != -1 && sendUnitId != -1) {
} // allotBackBill.setReceiveUnitId(receiveUnitId);
// allotBackBill.setSendUnitId(sendUnitId);
} // log.info("[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
private void saveModifyDetail3(SelfCheckBill selfCheckBill) { // allotBackBillDao.save(allotBackBill);
String receiveUnit = selfCheckBill.getCheckUnit(); // }
Integer receiveUnitId = getUnitId(receiveUnit); //
if (receiveUnitId != -1) { // }
selfCheckBill.setCheckUnitId(receiveUnitId); //
log.info("[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}", // private void saveModifyDetail3(SelfCheckBill selfCheckBill) {
receiveUnit,receiveUnitId); // String receiveUnit = selfCheckBill.getCheckUnit();
selfCheckBillDao.save(selfCheckBill); // Integer receiveUnitId = getUnitId(receiveUnit);
} // if (receiveUnitId != -1) {
// selfCheckBill.setCheckUnitId(receiveUnitId);
} // log.info("[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}",
// receiveUnit,receiveUnitId);
private void saveModifyDetail4(RepairBill allotBill) { // selfCheckBillDao.save(selfCheckBill);
String receiveUnit = allotBill.getReceiveUnit(); // }
String sendUnit = allotBill.getSendUnit(); //
// }
Integer receiveUnitId = getUnitId(receiveUnit); //
Integer sendUnitId = getUnitId(sendUnit); // private void saveModifyDetail4(RepairBill allotBill) {
// String receiveUnit = allotBill.getReceiveUnit();
if (receiveUnitId != -1 && sendUnitId != -1) { // String sendUnit = allotBill.getSendUnit();
allotBill.setReceiveUnitId(receiveUnitId); //
allotBill.setSendUnitId(sendUnitId); // Integer receiveUnitId = getUnitId(receiveUnit);
log.info("[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // Integer sendUnitId = getUnitId(sendUnit);
sendUnit, receiveUnit,sendUnitId,receiveUnitId); //
repairBillDao.save(allotBill); // if (receiveUnitId != -1 && sendUnitId != -1) {
} // allotBill.setReceiveUnitId(receiveUnitId);
// allotBill.setSendUnitId(sendUnitId);
} // log.info("[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
private void saveModifyDetail5(RepairSendBill allotBill) { // repairBillDao.save(allotBill);
String receiveUnit = allotBill.getReceiveUnit(); // }
String sendUnit = allotBill.getSendUnit(); //
// }
Integer receiveUnitId = getUnitId(receiveUnit); //
Integer sendUnitId = getUnitId(sendUnit); // private void saveModifyDetail5(RepairSendBill allotBill) {
// String receiveUnit = allotBill.getReceiveUnit();
if (receiveUnitId != -1 && sendUnitId != -1) { // String sendUnit = allotBill.getSendUnit();
allotBill.setReceiveUnitId(receiveUnitId); //
allotBill.setSendUnitId(sendUnitId); // Integer receiveUnitId = getUnitId(receiveUnit);
log.info("[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // Integer sendUnitId = getUnitId(sendUnit);
sendUnit, receiveUnit,sendUnitId,receiveUnitId); //
repairSendBillDao.save(allotBill); // if (receiveUnitId != -1 && sendUnitId != -1) {
} // allotBill.setReceiveUnitId(receiveUnitId);
// allotBill.setSendUnitId(sendUnitId);
} // log.info("[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
private void saveModifyDetail6(RepairDetail allotBill) { // repairSendBillDao.save(allotBill);
String receiveUnit = allotBill.getLocationUnit(); // }
String sendUnit = allotBill.getOwnUnit(); //
// }
Integer receiveUnitId = getUnitId(receiveUnit); //
Integer sendUnitId = getUnitId(sendUnit); // private void saveModifyDetail6(RepairDetail allotBill) {
// String receiveUnit = allotBill.getLocationUnit();
if (receiveUnitId != -1 && sendUnitId != -1) { // String sendUnit = allotBill.getOwnUnit();
allotBill.setLocationUnitId(receiveUnitId); //
allotBill.setOwnUnitId(sendUnitId); // Integer receiveUnitId = getUnitId(receiveUnit);
log.info("[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // Integer sendUnitId = getUnitId(sendUnit);
sendUnit, receiveUnit,sendUnitId,receiveUnitId); //
repairDetailDao.save(allotBill); // if (receiveUnitId != -1 && sendUnitId != -1) {
} // allotBill.setLocationUnitId(receiveUnitId);
// allotBill.setOwnUnitId(sendUnitId);
} // log.info("[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
private void saveModifyDetail7(RepairBackBill allotBill) { // sendUnit, receiveUnit,sendUnitId,receiveUnitId);
String receiveUnit = allotBill.getReceiveUnit(); // repairDetailDao.save(allotBill);
String sendUnit = allotBill.getSendUnit(); // }
//
Integer receiveUnitId = getUnitId(receiveUnit); // }
Integer sendUnitId = getUnitId(sendUnit); // private void saveModifyDetail7(RepairBackBill allotBill) {
// String receiveUnit = allotBill.getReceiveUnit();
if (receiveUnitId != -1 && sendUnitId != -1) { // String sendUnit = allotBill.getSendUnit();
allotBill.setReceiveUnitId(receiveUnitId); //
allotBill.setSendUnitId(sendUnitId); // Integer receiveUnitId = getUnitId(receiveUnit);
log.info("[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}", // Integer sendUnitId = getUnitId(sendUnit);
sendUnit, receiveUnit,sendUnitId,receiveUnitId); //
repairBackBillDao.save(allotBill); // if (receiveUnitId != -1 && sendUnitId != -1) {
} // allotBill.setReceiveUnitId(receiveUnitId);
// allotBill.setSendUnitId(sendUnitId);
} // log.info("[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
private void saveModifyDetail8(DeviceUseReport allotBill) { // repairBackBillDao.save(allotBill);
String receiveUnit = allotBill.getUnit(); // }
Integer receiveUnitId = getUnitId(receiveUnit); //
if (receiveUnitId != -1 ) { // }
allotBill.setUnitId(receiveUnitId); //
log.info("[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}", // private void saveModifyDetail8(DeviceUseReport allotBill) {
receiveUnit,receiveUnitId); // String receiveUnit = allotBill.getUnit();
deviceUseReportDao.save(allotBill); // Integer receiveUnitId = getUnitId(receiveUnit);
} // if (receiveUnitId != -1 ) {
// allotBill.setUnitId(receiveUnitId);
} // log.info("[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}",
// receiveUnit,receiveUnitId);
private void saveModifyDetail9(MatchingDeviceLibrary matchingDeviceLibrary) { // deviceUseReportDao.save(allotBill);
String createUnit = matchingDeviceLibrary.getCreateUnit(); // }
Integer createUnitId = getUnitId(createUnit); //
if (createUnitId != -1 ) { // }
matchingDeviceLibrary.setCreateUnitId(createUnitId); //
log.info("[配套设备库] 修正MatchingDeviceLibrary历史数据,修正的单位:{},接收单位id:{}", // private void saveModifyDetail9(MatchingDeviceLibrary matchingDeviceLibrary) {
createUnit,createUnitId); // String createUnit = matchingDeviceLibrary.getCreateUnit();
matchingDeviceLibraryDao.save(matchingDeviceLibrary); // Integer createUnitId = getUnitId(createUnit);
} // if (createUnitId != -1 ) {
// matchingDeviceLibrary.setCreateUnitId(createUnitId);
} // log.info("[配套设备库] 修正MatchingDeviceLibrary历史数据,修正的单位:{},接收单位id:{}",
// createUnit,createUnitId);
private Integer getUnitId(String unitName) { // matchingDeviceLibraryDao.save(matchingDeviceLibrary);
List<Units> units = unitsDao.findAllByName(unitName).orElse(Collections.emptyList()); // }
return units.size() == 1 ? units.get(0).getUnitId() : -1; //
} // }
//
// @Bean // private void saveModifyDetail10(DeviceApplyBill deviceApplyBill) {
// @DependsOn("userUtils") // String replyUnit = deviceApplyBill.getReplyUnit();
@PostConstruct // String applyUnit = deviceApplyBill.getApplyUnit();
public void init2(){ // Integer replyUnitId = getUnitId(replyUnit);
log.info("单位名称初始化-----"); // Integer applyUnitId = getUnitId(applyUnit);
initCheckDetailUnitName(); // if (replyUnitId != -1 && applyUnitId != -1) {
initCheckDetailUnitName2(); // deviceApplyBill.setReplyUnitId(replyUnitId);
} // deviceApplyBill.setApplyUnitId(applyUnitId);
// log.info("[装备申请] 修正DeviceApplyBill历史数据,修正的申请单位:{},申请单位id:{},修正的批复单位:{},批复单位id:{}",
@Autowired // replyUnit,replyUnitId,applyUnit,applyUnitId);
private DeviceCheckDetailDao // deviceApplyBillDao.save(deviceApplyBill);
deviceCheckDetailDao; // }
//
private void initCheckDetailUnitName2() { // }
// 对现有的数据补充unitId信息 //
deviceCheckDetailDao.findAll().forEach(this::saveModifyDetail); // private Integer getUnitId(String unitName) {
} // List<Units> units = unitsDao.findAllByName(unitName).orElse(Collections.emptyList());
// return units.size() == 1 ? units.get(0).getUnitId() : -1;
private void saveModifyDetail(DeviceCheckDetail deviceCheckDetail) { // }
String checkUnit = deviceCheckDetail.getCheckUnit(); //
Integer unitId = getUnitId(checkUnit); //// @Bean
if (unitId != -1) { //// @DependsOn("userUtils")
deviceCheckDetail.setCheckUnitId(unitId); // @PostConstruct
log.info("[核查] 修正detail历史数据,修正的单位:{},单位id:{}", checkUnit, unitId); // public void init2(){
deviceCheckDetailDao.save(deviceCheckDetail);
}
}
// @Override
// @Order(value = 1)
// public void run(String... args) throws Exception {
// log.info("单位名称初始化-----"); // log.info("单位名称初始化-----");
// initCheckDetailUnitName(); // initCheckDetailUnitName();
// initCheckDetailUnitName2();
// }
//
// @Autowired
// private DeviceCheckDetailDao
// deviceCheckDetailDao;
//
// private void initCheckDetailUnitName2() {
// // 对现有的数据补充unitId信息
// deviceCheckDetailDao.findAll().forEach(this::saveModifyDetail);
// }
//
// private void saveModifyDetail(DeviceCheckDetail deviceCheckDetail) {
// String checkUnit = deviceCheckDetail.getCheckUnit();
// Integer unitId = getUnitId(checkUnit);
// if (unitId != -1) {
// deviceCheckDetail.setCheckUnitId(unitId);
// log.info("[核查] 修正detail历史数据,修正的单位:{},单位id:{}", checkUnit, unitId);
// deviceCheckDetailDao.save(deviceCheckDetail);
// }
// } // }
} //// @Override
//// @Order(value = 1)
//// public void run(String... args) throws Exception {
//// log.info("单位名称初始化-----");
//// initCheckDetailUnitName();
//// }
//}
package com.tykj.dev.union; //package com.tykj.dev.union;
//
/** ///**
* @author zjm // * @author zjm
* @version 1.0.0 // * @version 1.0.0
* @ClassName AreaController.java // * @ClassName AreaController.java
* @Description TODO // * @Description TODO
* @createTime 2020年09月04日 13:34:00 // * @createTime 2020年09月04日 13:34:00
*/ // */
//
import com.tykj.dev.config.swagger.AutoDocument; //import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.user.subject.dao.AreaDao; //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.Area;
import com.tykj.dev.device.user.subject.entity.SecurityUser; //import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.service.AreaService; //import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.misc.exception.ApiException; //import com.tykj.dev.misc.exception.ApiException;
import io.swagger.annotations.Api; //import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; //import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; //import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal; //import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*; //import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; //import springfox.documentation.annotations.ApiIgnore;
//
import java.util.Optional; //import java.util.Optional;
//
/** ///**
* 区域视图层 // * 区域视图层
*/ // */
@RestController //@RestController
@RequestMapping("/run") //@RequestMapping("/run")
public class RunController { //public class RunController {
@Autowired // @Autowired
DataInit dataInit; // DataInit dataInit;
@GetMapping(value = "/init2") // @GetMapping(value = "/init2")
public ResponseEntity addPermissions(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) { // public ResponseEntity addPermissions(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
dataInit.init2(); // dataInit.init2();
return ResponseEntity.ok("ok"); // return ResponseEntity.ok("ok");
} // }
//
//
} //}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论