提交 ab8b3239 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 df356fe8
......@@ -150,9 +150,11 @@ public class AllotBillController {
String num = "NO:第" + year + "PF" + allotBillEntity.getId() + "号";
allotBillEntity.setNum(num);
//生成电子签章id
Long signId = snowflake.creatNextId();
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId();
allotBillEntity.setLeftSignatureId(signId.toString());
if (allotBillSaveVo.getLeftSignatureId()!=null) {
allotBillEntity.setLeftSignatureId(allotBillSaveVo.getLeftSignatureId());
}
allotBillEntity.setRightSignatureId(signId2.toString());
AllotBill allotBill = allotBillService.update(allotBillEntity);
Integer billId = allotBillEntity.getId();
......@@ -540,20 +542,26 @@ public class AllotBillController {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_UPLOAD_ALLOT_RECEIVE_FILE);
Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto,userId);
taskService.moveToEnd(taskBto);
AllotBill allotBill = allotBillService.getOne(taskBto.getBillId());
allotBill.setBillFileName(fileUploadVo.getBillFileName());
allotBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
allotBillService.update(allotBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("配发单", allotBill.getBillFileName(), allotBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(allotBill.getAllotCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
//不上传单据
if (fileUploadVo.getStatus()==0){
taskService.moveToArchive(taskBto);
}
else {
taskService.moveToEnd(taskBto);
AllotBill allotBill = allotBillService.getOne(taskBto.getBillId());
allotBill.setBillFileName(fileUploadVo.getBillFileName());
allotBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
allotBillService.update(allotBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("配发单", allotBill.getBillFileName(), allotBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(allotBill.getAllotCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
}
return ResponseEntity.ok("上传成功");
}
......
......@@ -102,9 +102,11 @@ public class BackController {
String num = "NO:第" + year + "TH" + allotBackBill.getId() + "号";
allotBackBill.setNum(num);
//生成电子签章id
Long signId = snowflake.creatNextId();
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId();
allotBackBill.setLeftSignatureId(signId.toString());
if (allotBillSaveVo.getLeftSignatureId()!=null) {
allotBackBill.setLeftSignatureId(allotBillSaveVo.getLeftSignatureId());
}
allotBackBill.setRightSignatureId(signId2.toString());
AllotBackBill allotBackBill1 = allotBackBillService.update(allotBackBill);
Integer billId = allotBackBill.getId();
......@@ -231,20 +233,26 @@ public class BackController {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_UPLOAD_ALLOT_BACK_FILE);
Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto,userId);
taskService.moveToEnd(taskBto);
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
allotBackBill.setBillFileName(fileUploadVo.getBillFileName());
allotBackBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
allotBackBillService.update(allotBackBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("退回单", allotBackBill.getBillFileName(), allotBackBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(allotBackBill.getBackCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传退回单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
//不上传单据
if (fileUploadVo.getStatus()==0){
taskService.moveToArchive(taskBto);
}
else {
taskService.moveToEnd(taskBto);
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
allotBackBill.setBillFileName(fileUploadVo.getBillFileName());
allotBackBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
allotBackBillService.update(allotBackBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("退回单", allotBackBill.getBillFileName(), allotBackBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(allotBackBill.getBackCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传退回单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
}
return ResponseEntity.ok("上传成功");
}
......
......@@ -91,6 +91,9 @@ public class AllotBillSaveVo {
@ApiModelProperty(value = "批复文号附件名")
private List<FileRet> replyFiles;
@ApiModelProperty(value = "左签章Id")
private String leftSignatureId;
public AllotBill toDo() {
AllotBill allotBillEntity = new AllotBill();
BeanUtils.copyProperties(this, allotBillEntity);
......
......@@ -19,12 +19,16 @@ public class FileUploadVo {
@ApiModelProperty(value = "任务Id")
private Integer taskId;
@NotNull(message = "billFileName不能为空")
// @NotNull(message = "billFileName不能为空")
@ApiModelProperty(value = "配发单附件名字")
private String billFileName;
@NotNull(message = "billFileUrl不能为空")
// @NotNull(message = "billFileUrl不能为空")
@ApiModelProperty(value = "配发单附件URL")
private String billFileUrl;
@NotNull(message = "status不能为空")
@ApiModelProperty(value = "是否上传单据(0:否,1:是)")
private Integer status;
}
......@@ -241,9 +241,11 @@ public class DeviceApplyController {
deviceApplyBillEntity.setAllotId(allotBill.getId());
deviceApplyBillService.update(deviceApplyBillEntity);
//生成电子签章id
Long signId = snowflake.creatNextId();
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId();
allotBill.setLeftSignatureId(signId.toString());
if (deviceApplyAllotSaveVo.getLeftSignatureId()!=null) {
allotBill.setLeftSignatureId(deviceApplyAllotSaveVo.getLeftSignatureId());
}
allotBill.setRightSignatureId(signId2.toString());
allotBillService.update(allotBill);
taskBto.setBillId(allotBill.getId());
......
......@@ -48,4 +48,6 @@ public class DeviceApplyAllotSaveVo {
@ApiModelProperty(value = "对应任务ID", example = "1")
private Integer taskId;
@ApiModelProperty(value = "左签章Id")
private String leftSignatureId;
}
......@@ -236,6 +236,10 @@ public enum LogType {
ALLOT_BACK_6(98, ALLOT_BACK.id, WAIT_UPLOAD_BACK_FILE_2.id, ARCHIVE.id, "取消上传退回单"),
ALLOT_12(99, ALLOT.id, ALLOTING.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, "接收配发装备(缺失单据)"),
ALLOT_13(101, ALLOT.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, END.id, "上传配发单"),
ALLOT_14(102,ALLOT.id, WAIT_UPLOAD_ALLOT_RECEIVE_FILE.id, ARCHIVE.id, "取消上传配发单"),
ALLOT_BACK_7(103, ALLOT_BACK.id, WAIT_UPLOAD_ALLOT_BACK_FILE.id, ARCHIVE.id, "取消上传退回单"),
REPAIR_SEND_13(104, REPAIR.id, WAIT_UPLOAD_FILE.id, ARCHIVE.id, "取消上传送修单"),
REPAIR_BACK_9(105,REPAIR_BACK.id, WAIT_UPLOAD_BACK_FILE.id, ARCHIVE.id, "取消上传领取单"),
;
public Integer id;
......
package com.tykj.dev.config.cache;
import com.tykj.dev.config.domin.SystemConfig;
import lombok.Data;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Data
public class ConfigCache {
private Map<Integer, String> lifeStatusMap;
private Map<Integer, String> matchingRangeMap;
private Map<Integer, String> storageTypeMap;
private Map<Integer, String> applyTypeMap;
private Map<Integer, String> invisibleRangeMap;
private Map<Integer, String> secretLevelMap;
private Map<Integer, String> styleMap;
private Map<Integer, String> natureMap;
private Map<Integer, String> positionMap;
public ConfigCache(List<SystemConfig> systemConfigs){
this.lifeStatusMap = systemConfigs.stream().filter(systemConfig -> "lifeStatus".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.matchingRangeMap = systemConfigs.stream().filter(systemConfig -> "matchingRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.storageTypeMap = systemConfigs.stream().filter(systemConfig -> "storageType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.applyTypeMap = systemConfigs.stream().filter(systemConfig -> "applyType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.invisibleRangeMap = systemConfigs.stream().filter(systemConfig -> "invisibleRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.secretLevelMap = systemConfigs.stream().filter(systemConfig -> "secretLevel".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.styleMap = systemConfigs.stream().filter(systemConfig -> "style".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.natureMap = systemConfigs.stream().filter(systemConfig -> "nature".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.positionMap = systemConfigs.stream().filter(systemConfig -> "position".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
}
public Map<Integer, String> getMatchingRangeMap() {
return matchingRangeMap;
}
public Map<Integer, String> getStorageTypeMap() {
return storageTypeMap;
}
public Map<Integer, String> getApplyTypeMap() {
return applyTypeMap;
}
public Map<Integer, String> getInvisibleRangeMap() {
return invisibleRangeMap;
}
public Map<Integer, String> getSecretLevelMap() {
return secretLevelMap;
}
public Map<Integer, String> getLifeStatusMap() {
return lifeStatusMap;
}
public Map<Integer, String> getStyleMap() {
return styleMap;
}
public Map<Integer, String> getNatureMap() {
return natureMap;
}
public Map<Integer, String> getPositionMap() {
return positionMap;
}
public ConfigCache refresh(List<SystemConfig> systemConfigs){
this.lifeStatusMap = systemConfigs.stream().filter(systemConfig -> "lifeStatus".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.matchingRangeMap = systemConfigs.stream().filter(systemConfig -> "matchingRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.storageTypeMap = systemConfigs.stream().filter(systemConfig -> "storageType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.applyTypeMap = systemConfigs.stream().filter(systemConfig -> "applyType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.invisibleRangeMap = systemConfigs.stream().filter(systemConfig -> "invisibleRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.secretLevelMap = systemConfigs.stream().filter(systemConfig -> "secretLevel".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.styleMap = systemConfigs.stream().filter(systemConfig -> "style".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.natureMap = systemConfigs.stream().filter(systemConfig -> "nature".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.positionMap = systemConfigs.stream().filter(systemConfig -> "position".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
return this;
}
}
......@@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
public interface SystemConfigDao extends JpaRepository<SystemConfig,Integer>, JpaSpecificationExecutor<SystemConfig> {
SystemConfig findByEnglishNameAndValue(String name,Integer value);
List<SystemConfig> findAllByEnglishName(String name);
List<SystemConfig> findAllByDeleteTag(Integer deleteTag);
}
package com.tykj.dev.config.service.impl;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.repository.SystemConfigDao;
import com.tykj.dev.config.service.SystemConfigService;
......@@ -15,14 +16,21 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Autowired
SystemConfigDao systemConfigDao;
@Autowired
ConfigCache configCache;
@Override
public SystemConfig add(SystemConfig systemConfig) {
return systemConfigDao.save(systemConfig);
SystemConfig systemConfig1 = systemConfigDao.save(systemConfig);
configCache.refresh(systemConfigDao.findAll());
return systemConfig1;
}
@Override
public SystemConfig update(SystemConfig systemConfig) {
return systemConfigDao.save(systemConfig);
SystemConfig systemConfig1 = systemConfigDao.save(systemConfig);
configCache = new ConfigCache(systemConfigDao.findAll());
return systemConfig1;
}
@Override
......
......@@ -6,7 +6,7 @@ import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.confirmcheck.common.CheckType;
import com.tykj.dev.device.confirmcheck.common.TaskPeriod;
import com.tykj.dev.device.confirmcheck.entity.cache.AreaCache;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat;
import com.tykj.dev.device.confirmcheck.entity.vo.*;
......
package com.tykj.dev.device.confirmcheck.entity.cache;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.repository.SystemConfigDao;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.device.user.subject.dao.AreaDao;
......@@ -27,6 +30,9 @@ public class CacheBeanConfig {
@Autowired
private UnitsDao unitsDao;
@Autowired
private SystemConfigDao systemConfigDao;
@Bean
public AreaCache initAreaCache() {
return new AreaCache(areaRepo.findAll());
......@@ -41,4 +47,9 @@ public class CacheBeanConfig {
public UnitsCache initUnitCache() {
return new UnitsCache(unitsDao.findAll());
}
@Bean
public ConfigCache initConfigCache(){
return new ConfigCache(systemConfigDao.findAll());
}
}
......@@ -5,7 +5,7 @@ import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.device.confirmcheck.common.CheckType;
import com.tykj.dev.device.confirmcheck.common.TaskPeriod;
import com.tykj.dev.device.confirmcheck.entity.cache.AreaCache;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBill;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckPeriod;
......
......@@ -485,6 +485,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override
public List<DeviceLibrary> getAllotList(DeviceLibrarySelectVo deviceLibrarySelectVo) {
List<DeviceLibrary> deviceLibraryEntities = deviceLibraryDao.findAll(getAllotSelectSpecification(deviceLibrarySelectVo));
deviceLibraryEntities.forEach(DeviceLibrary::setConfigName);
Map<Integer, DeviceLibrary> nodeCollect =
deviceLibraryEntities.stream().collect(Collectors.toMap(DeviceLibrary::getId, deviceLibraryEntity -> deviceLibraryEntity));
return GetTreeUtils.parseTreeFromDown(
......@@ -633,7 +634,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
if (deviceLibrarySelectVo.getEndTime() != null) {
predicateBuilder.lt("updateTime", deviceLibrarySelectVo.getEndTime());
}
if (deviceLibrarySelectVo.getSeqInterval()!=null){
if (deviceLibrarySelectVo.getSeqInterval()!=null&&DeviceSeqUtil.selectDeviceSeqs(deviceLibrarySelectVo.getSeqInterval()).size()>0){
predicateBuilder.in("seqNumber", DeviceSeqUtil.selectDeviceSeqs(deviceLibrarySelectVo.getSeqInterval()));
}
}
......
package com.tykj.dev.device.library.subject.domin;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.library.subject.vo.DeviceVo;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -224,16 +226,53 @@ public class DeviceLibrary {
@Transient
private List<DeviceLibrary> childs = new ArrayList<>();
@ApiModelProperty(value = "密级")
@Transient
private String secretLevelName;
@ApiModelProperty(value = "配用范围")
@Transient
private String matchingRangeName;
@ApiModelProperty(value = "可见范围")
@Transient
private String invisibleRangeName;
@ApiModelProperty(value = "形态")
@Transient
private String typeName;
@ApiModelProperty(value = "生命状态")
@Transient
private String lifeStatusName;
@ApiModelProperty(value = "入库类型")
@Transient
private String storageTypeName;
public void addChildNode(DeviceLibrary deviceLibraryEntity) {
childs.add(deviceLibraryEntity);
}
public DeviceVo parseVo(){
setConfigName();
//modelMap复制
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(this, DeviceVo.class);
}
public DeviceLibrary setConfigName(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache != null) {
setSecretLevelName(configCache.getSecretLevelMap().get(this.secretLevel)==null?"-":configCache.getSecretLevelMap().get(this.secretLevel));
setLifeStatusName(configCache.getLifeStatusMap().get(this.lifeStatus)==null?"-":configCache.getLifeStatusMap().get(this.lifeStatus));
setMatchingRangeName(configCache.getMatchingRangeMap().get(this.matchingRange)==null?"-":configCache.getMatchingRangeMap().get(this.matchingRange));
setInvisibleRangeName(configCache.getInvisibleRangeMap().get(this.invisibleRange)==null?"-":configCache.getInvisibleRangeMap().get(this.invisibleRange));
setTypeName(configCache.getStyleMap().get(this.type)==null?"-":configCache.getStyleMap().get(this.type));
setStorageTypeName(configCache.getStorageTypeMap().get(this.storageType)==null?"-":configCache.getStorageTypeMap().get(this.storageType));
}
return this;
}
// public String getKeyWords(){
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append(this.model);
......
......@@ -60,4 +60,21 @@ public class DeviceVo {
@ApiModelProperty(value = "备注")
private String record;
@ApiModelProperty(value = "密级")
private String secretLevelName;
@ApiModelProperty(value = "配用范围")
private String matchingRangeName;
@ApiModelProperty(value = "可见范围")
private String invisibleRangeName;
@ApiModelProperty(value = "形态")
private String typeName;
@ApiModelProperty(value = "生命状态")
private String lifeStatusName;
@ApiModelProperty(value = "入库类型")
private String storageTypeName;
}
package com.tykj.dev.device.matching.controller;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.repository.DeviceLogDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
......@@ -82,6 +82,9 @@ public class MatchingDeviceController {
@Autowired
private MatchingRepairBillDao matchingRepairBillDao;
@Autowired
private ConfigCache configCache;
@ApiOperation(value = "添加配套设备", notes = "可以通过这个接口添加配套设备")
@PostMapping(value = "/add")
@Transactional(rollbackFor = Exception.class)
......@@ -221,7 +224,7 @@ public class MatchingDeviceController {
}
if (matchingDeviceEditVo.getLifeStatus() != null && !m.getLifeStatus().equals(matchingDeviceEditVo.getLifeStatus())) {
//添加设备日志
String remark = "将设备的生命状态由" + GlobalMap.getDeviceLifeStatusMap().get(m.getLifeStatus()).name + "改为" + GlobalMap.getDeviceLifeStatusMap().get(matchingDeviceEditVo.getLifeStatus()).name;
String remark = "将设备的生命状态由" + configCache.getLifeStatusMap().get(m.getLifeStatus()) + "改为" + configCache.getLifeStatusMap().get(matchingDeviceEditVo.getLifeStatus());
DeviceLogDto deviceLogDto = new DeviceLogDto(1, matchingDeviceEditVo.getMatchingDeviceId(), remark, null);
deviceLogService.addLog(deviceLogDto);
m.setLifeStatus(matchingDeviceEditVo.getLifeStatus());
......
......@@ -17,8 +17,6 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import javax.validation.ConstraintViolationException;
/**
* 错误处理类
......@@ -69,7 +67,7 @@ public class GlobalExceptionHandler {
@ResponseBody
@ExceptionHandler(ApiException.class)
public ResponseEntity errorMessage(ApiException e) {
log.warn("[自定义异常] {}", e);
log.warn("[自定义异常]"+e.getResponseEntity().getBody());
if (e.getResponseEntity() != null) {
return e.getResponseEntity();
}
......
......@@ -247,6 +247,9 @@ public class DeviceSeqUtil {
if (num1.length() != num2.length()){
throw new ApiException("序列号区间后面数字位数不相同");
}
else if(Long.parseLong(num1)>Long.parseLong(num2)){
throw new ApiException("序列号区间前数字大于后数字");
}
else {
Long minSeq = Long.parseLong(num1);
Long maxSeq = Long.parseLong(num2);
......@@ -295,7 +298,7 @@ public class DeviceSeqUtil {
String num1 = s1.replaceAll(".*[^\\d](?=(\\d+))", "");
//获得右区间最后几位的数字
String num2 = s2.replaceAll(".*[^\\d](?=(\\d+))", "");
if (num1.length() != num2.length()){
if (num1.length() != num2.length() || Long.parseLong(num1)>Long.parseLong(num2)){
return stringList;
}
else {
......
......@@ -137,7 +137,7 @@ public class PackingController {
PackingLibrary packingLibraryEntity = packingLibraryService.getOne(billId);
packingLibraryEntity.setUserA(userPublicService.getOne(packingLibraryEntity.getUseraId()).getName());
packingLibraryEntity.setUserB(userPublicService.getOne(packingLibraryEntity.getUserbId()).getName());
packingDetailVo.setPackingLibrary(packingLibraryEntity);
packingDetailVo.setPackingLibrary(packingLibraryEntity.setConfigName());
//获取所有配件
List<PackingLibrary> packingLibraryEntities = packingLibraryService.selectAllPart(billId);
packingDetailVo.setParts(packingLibraryEntities);
......
......@@ -51,6 +51,7 @@ public class PackingLibraryController {
@PostMapping("/serve/summary")
public ResponseEntity getPage(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) {
Page<PackingLibrary> packingLibraryEntityPage = packingLibraryService.getPage(packingLibrarySelectVo, packingLibrarySelectVo.getPageable());
packingLibraryEntityPage.getContent().forEach(PackingLibrary::setConfigName);
return ResultUtil.success(packingLibraryEntityPage);
}
......@@ -58,6 +59,7 @@ public class PackingLibraryController {
@PostMapping("/retired/summary")
public ResponseEntity getInvalidPage(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) {
Page<PackingLibrary> packingLibraryEntityPage = packingLibraryService.getInvalidPage(packingLibrarySelectVo, packingLibrarySelectVo.getPageable());
packingLibraryEntityPage.getContent().forEach(PackingLibrary::setConfigName);
return ResultUtil.success(packingLibraryEntityPage);
}
......@@ -245,7 +247,7 @@ public class PackingLibraryController {
@PostMapping("/selectMoreDetail")
public ResponseEntity selectMorePackingDetail(@RequestBody List<Integer> ids) {
List<PackingLibrary> packingLibraries = new ArrayList<>();
ids.forEach(integer -> packingLibraries.add(packingLibraryService.getOne(integer)));
ids.forEach(integer -> packingLibraries.add(packingLibraryService.getOne(integer).setConfigName()));
return ResultUtil.success(packingLibraries);
}
......
......@@ -4,8 +4,8 @@ import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.GlobalMap;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
......@@ -55,6 +55,9 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Autowired
private DeviceLibraryDao deviceLibraryDao;
@Autowired
private ConfigCache configCache;
@Override
public PackingLibrary addEntity(PackingLibrary packingLibraryEntity) {
PackingLibrary packingLibrary = packingLibraryDao.save(packingLibraryEntity);
......@@ -100,6 +103,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Override
public List<PackingLibrary> getList(PackingLibrarySelectVo packingLibrarySelectVo) {
List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll(getSelectSpecification(packingLibrarySelectVo));
packingLibraryEntities.forEach(PackingLibrary::setConfigName);
//返回父子结构
Map<Integer, PackingLibrary> nodeCollect =
packingLibraryEntities.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibraryEntity -> packingLibraryEntity));
......@@ -164,9 +168,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
} else {
//添加主件
List<PackingLibrary> libraryEntities = new ArrayList<>();
libraryEntities.add(byId.get());
libraryEntities.add(byId.get().setConfigName());
//添加配件信息
List<PackingLibrary> p = packingLibraryDao.findAll(getSelectSpecification3(id));
p.forEach(PackingLibrary::setConfigName);
libraryEntities.addAll(p);
return libraryEntities;
}
......@@ -180,9 +185,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
} else {
//添加主件
List<PackingLibrary> libraryEntities = new ArrayList<>();
libraryEntities.add(byId.get());
libraryEntities.add(byId.get().setConfigName());
//添加配件信息
List<PackingLibrary> p = packingLibraryDao.findAll(getSelectSpecification4(id));
p.forEach(PackingLibrary::setConfigName);
libraryEntities.addAll(p);
return libraryEntities;
}
......@@ -205,6 +211,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
final Integer status = selectPack.getStatus();
final Integer secretLevel = selectPack.getSecretLevel();
List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll(getSelectSpecification6());
packingLibraryEntities.forEach(PackingLibrary::setConfigName);
//返回父子结构
Map<Integer, PackingLibrary> nodeCollect =
packingLibraryEntities.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibrary -> packingLibrary));
......@@ -220,8 +227,8 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
boolean isSameSecretLevel = secretLevel == null || packingLibrary.getSecretLevel().equals(secretLevel);
boolean isContainContent = content == null
|| packingLibrary.getModel().contains(content)
|| GlobalMap.getDeviceInvisibleRangeMap().get(packingLibrary.getInvisibleRange()).name.contains(content)
|| GlobalMap.getDeviceSecretLevelMap().get(packingLibrary.getSecretLevel()).name.contains(content);
|| configCache.getInvisibleRangeMap().get(packingLibrary.getInvisibleRange()).contains(content)
|| configCache.getSecretLevelMap().get(packingLibrary.getSecretLevel()).contains(content);
return isSameModel && isSameName && isSameStatus && isSameSecretLevel && isContainContent;
}).sorted(Comparator.comparing(PackingLibrary::getShowOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList());
}
......
package com.tykj.dev.device.packing.subject.domin;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -213,7 +215,44 @@ public class PackingLibrary {
@Transient
private String prodNumber;
@ApiModelProperty(value = "密级")
@Transient
private String secretLevelName;
@ApiModelProperty(value = "应用类型")
@Transient
private String applyTypeName;
@ApiModelProperty(value = "配用范围")
@Transient
private String matchingRangeName;
@ApiModelProperty(value = "可见范围")
@Transient
private String invisibleRangeName;
@ApiModelProperty(value = "形态")
@Transient
private String typeName;
@ApiModelProperty(value = "列装性质")
@Transient
private String natureName;
public void addChildNode(PackingLibrary packingLibraryEntity) {
childs.add(packingLibraryEntity);
}
public PackingLibrary setConfigName(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache != null) {
setSecretLevelName(configCache.getSecretLevelMap().get(this.secretLevel)==null?"-":configCache.getSecretLevelMap().get(this.secretLevel));
setApplyTypeName(configCache.getApplyTypeMap().get(this.applyType)==null?"-":configCache.getApplyTypeMap().get(this.applyType));
setMatchingRangeName(configCache.getMatchingRangeMap().get(this.matchingRange)==null?"-":configCache.getMatchingRangeMap().get(this.matchingRange));
setInvisibleRangeName(configCache.getInvisibleRangeMap().get(this.invisibleRange)==null?"-":configCache.getInvisibleRangeMap().get(this.invisibleRange));
setTypeName(configCache.getStyleMap().get(this.type)==null?"-":configCache.getStyleMap().get(this.type));
setNatureName(configCache.getNatureMap().get(this.nature)==null?"-":configCache.getNatureMap().get(this.nature));
}
return this;
}
}
......@@ -154,6 +154,7 @@ public class RepairBillSelectController {
for (RepairDetail r : repairDetails) {
if (r.getDeviceId().equals(deviceLibrary.getId())) {
deviceLibrary.setRemark(r.getRemark());
deviceLibrary.setRepairStatus(r.getRepairStatus());
}
}
});
......@@ -201,6 +202,12 @@ public class RepairBillSelectController {
for (RepairDetail r : repairDetails) {
if (r.getDeviceId().equals(deviceLibrary.getId())) {
deviceLibrary.setRemark(r.getRemark());
if (r.getPid()!=null) {
deviceLibrary.setRepairStatus(repairDetailService.getOne(r.getPid()).getRepairStatus());
}
else {
deviceLibrary.setRepairStatus(r.getRepairStatus());
}
}
}
});
......
......@@ -169,12 +169,15 @@ public class RepairController {
if (repairBillSaveVo.getRepairUseraId() != null) {
repairBill.setRepairUserA(userPublicService.getOne(repairBillSaveVo.getRepairUseraId()).getName());
}
repairBill.setStartUserB(repairBillSaveVo.getAgent());
repairBill.setStartUserA(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName());
// repairBill.setStartUserB(userPublicService.getOne(repairBillSaveVo.getStartUserbId()).getName());
//生成单位电子签章id
Long signId = snowflake.creatNextId();
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId();
repairBill.setLeftSignatureId(signId.toString());
if (repairBillSaveVo.getLeftSignatureId()!=null) {
repairBill.setLeftSignatureId(repairBillSaveVo.getLeftSignatureId());
}
repairBill.setRightSignatureId(signId2.toString());
RepairBill repairBill1 = deviceRepairBillService.addEntity(repairBill);
Calendar calendar = Calendar.getInstance();
......@@ -538,20 +541,26 @@ public class RepairController {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_UPLOAD_FILE);
Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto,userId);
taskService.moveToEnd(taskBto);
RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(taskBto.getBillId());
repairSendBill.setBillFileName(fileUploadVo.getBillFileName());
repairSendBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
deviceRepairSendBillService.update(repairSendBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairSendBill.getRepairDeviceCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传送修单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
//不上传单据
if (fileUploadVo.getStatus()==0){
taskService.moveToArchive(taskBto);
}
else {
taskService.moveToEnd(taskBto);
RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(taskBto.getBillId());
repairSendBill.setBillFileName(fileUploadVo.getBillFileName());
repairSendBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
deviceRepairSendBillService.update(repairSendBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("维修单", repairSendBill.getBillFileName(), repairSendBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairSendBill.getRepairDeviceCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传送修单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
}
return ResponseEntity.ok("上传成功");
}
......@@ -699,9 +708,11 @@ public class RepairController {
repairBackBill.setTitle("维修退回业务");
repairBackBill.setAgent(repairBackBillSaveVo.getAgent());
//生成单位签章id
Long signId = snowflake.creatNextId();
// Long signId = snowflake.creatNextId();
Long signId2 = snowflake.creatNextId();
repairBackBill.setLeftSignatureId(signId.toString());
if (repairBackBillSaveVo.getLeftSignatureId()!=null) {
repairBackBill.setLeftSignatureId(repairBackBillSaveVo.getLeftSignatureId());
}
repairBackBill.setRightSignatureId(signId2.toString());
RepairBackBill deviceRepairBackBillEntity1 = deviceRepairBackBillService.save(repairBackBill);
Calendar calendar = Calendar.getInstance();
......@@ -1072,20 +1083,26 @@ public class RepairController {
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.WAIT_UPLOAD_BACK_FILE);
Integer userId = userUtils.getCurrentUserId();
taskService.addInvolveUser(taskBto,userId);
taskService.moveToEnd(taskBto);
RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
repairBackBill.setBillFileName(fileUploadVo.getBillFileName());
repairBackBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
deviceRepairBackBillService.update(repairBackBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("回执单", repairBackBill.getBillFileName(), repairBackBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairBackBill.getBackReciveCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传回执单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
//不上传单据
if (fileUploadVo.getStatus()==0){
taskService.moveToArchive(taskBto);
}
else {
taskService.moveToEnd(taskBto);
RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
repairBackBill.setBillFileName(fileUploadVo.getBillFileName());
repairBackBill.setBillFileUrl(fileUploadVo.getBillFileUrl());
deviceRepairBackBillService.update(repairBackBill);
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("回执单", repairBackBill.getBillFileName(), repairBackBill.getBillFileUrl()));
//添加装备日志
List<Integer> deviceIds = StringSplitUtil.split(repairBackBill.getBackReciveCheckDetail());
deviceIds.forEach(integer -> {
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传回执单据", fileVoList);
deviceLogService.addLog(deviceLogDto);
});
}
return ResponseEntity.ok("上传成功");
}
......
......@@ -19,12 +19,16 @@ public class FileUploadVo {
@ApiModelProperty(value = "任务Id")
private Integer taskId;
@NotNull(message = "billFileName不能为空")
// @NotNull(message = "billFileName不能为空")
@ApiModelProperty(value = "配发单附件名字")
private String billFileName;
@NotNull(message = "billFileUrl不能为空")
// @NotNull(message = "billFileUrl不能为空")
@ApiModelProperty(value = "配发单附件URL")
private String billFileUrl;
@NotNull(message = "status不能为空")
@ApiModelProperty(value = "是否上传单据(0:否,1:是)")
private Integer status;
}
......@@ -86,4 +86,7 @@ public class RepairBackBillSaveVo {
@NotEmpty(message = "deviceList不能为空")
@ApiModelProperty(value = "维修装备详情列表")
private List<DeviceDetailVo> deviceList;
@ApiModelProperty(value = "左签章Id")
private String leftSignatureId;
}
......@@ -86,4 +86,7 @@ public class RepairBillSaveVo {
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id")
private Integer taskId;
@ApiModelProperty(value = "左签章Id")
private String leftSignatureId;
}
......@@ -429,6 +429,7 @@ public class SelfCheckController {
String user3 = userPublicService.getOne(s.getCreateUserId()).getName();
s.setCreateUser(user3);
}
s.setTaskId(taskService.get(s.getId(),4).getId());
}
return ResultUtil.success(page);
}
......
......@@ -159,4 +159,7 @@ public class SelfCheckBill {
@Transient
private List<FileRet> checkFileList = new ArrayList<>();
@Transient
private Integer taskId;
}
package com.tykj.dev.statistical.cache;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.confirmcheck.entity.cache.AreaCache;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.device.user.subject.dao.AreaDao;
......
package com.tykj.dev.statistical.service.impl;
import com.tykj.dev.device.confirmcheck.entity.cache.AreaCache;
import com.tykj.dev.device.user.cache.AreaCache;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckStatDao;
......
......@@ -175,6 +175,7 @@ public class TaskSelectController {
deviceApplyBillEntity.setReplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getReplyFiles()));
deviceApplyBillEntity.setApplyFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyFiles()));
deviceApplyBillEntity.setApplyNumFileList(FilesUtil.stringFileToList(deviceApplyBillEntity.getApplyNumFiles()));
deviceApplyBillEntity.setApplyUser(userPublicService.getOne(deviceApplyBillEntity.getApplyUseraId()).getName());
list.add(deviceApplyBillEntity);
return ResponseEntity.ok(new ResultObj(list, "查询成功"));
}
......
......@@ -11,7 +11,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
import javax.persistence.Transient;
import java.util.Date;
/**
......@@ -148,6 +147,8 @@ public class MemberThat {
@JsonIgnore
private Long remaining;
private String positionName;
public User toUserVo() {
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(this, User.class);
......
package com.tykj.dev.device.confirmcheck.entity.cache;
package com.tykj.dev.device.user.cache;
import com.tykj.dev.device.user.subject.entity.Area;
import lombok.Data;
......@@ -38,4 +38,10 @@ public class AreaCache {
public Area findById(Integer id) {
return idMap.get(id);
}
public AreaCache refresh(List<Area> areaList){
nameMap = areaList.stream().collect(Collectors.toMap(Area::getName, Function.identity()));
idMap = areaList.stream().collect(Collectors.toMap(Area::getId, Function.identity()));
return this;
}
}
package com.tykj.dev.device.user.cache;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User;
import lombok.Data;
import java.util.ArrayList;
......@@ -30,4 +29,9 @@ public class UnitsCache {
public List<Units> findAll(){
return new ArrayList<>(idMap.values());
}
public UnitsCache refresh(List<Units> unitsList){
this.idMap = unitsList.stream().collect(Collectors.toMap(Units::getUnitId, Function.identity()));
return this;
}
}
......@@ -29,4 +29,9 @@ public class UserCache {
public List<User> findAll(){
return new ArrayList<>(idMap.values());
}
public UserCache refresh(List<User> userList){
this.idMap = userList.stream().collect(Collectors.toMap(User::getUserId, Function.identity()));
return this;
}
}
......@@ -9,6 +9,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.modelmapper.ModelMapper;
import javax.persistence.*;
......@@ -26,6 +28,8 @@ import java.util.UUID;
@Data
@Entity
@ApiModel(value = "单位对象", description = "单位详细信息")
@Where(clause = "id_del = 0")
@SQLDelete(sql = "update user set id_del = 1 where id = ?")
public class Units {
/**
* 单位id
......
package com.tykj.dev.device.user.subject.entity;
import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.user.base.ret.HandoverUser;
import com.tykj.dev.device.user.base.ret.MemberThat;
import com.tykj.dev.device.user.base.ret.UserShenRe;
import com.tykj.dev.device.user.base.ret.UserSuperiorVo;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.modelmapper.ModelMapper;
import javax.persistence.*;
......@@ -25,6 +32,8 @@ import javax.persistence.*;
@Data
@Entity
@ApiModel(value = "用户对象", description = "用户详细信息")
@Where(clause = "is_del = 0")
@SQLDelete(sql = "update user set is_del = 1 where id = ?")
public class User {
/**
* 用户
......@@ -151,7 +160,12 @@ public class User {
public MemberThat toVo() {
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(this, MemberThat.class);
MemberThat memberThat = mapper.map(this, MemberThat.class);
ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache!=null){
memberThat.setPositionName(configCache.getPositionMap().get(memberThat.getPosition()));
}
return memberThat;
}
public HandoverUser toHandoverUserVo() {
......
package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.cache.AreaCache;
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.service.AreaService;
......@@ -36,6 +37,9 @@ public class AreaServiceImpl implements AreaService {
@Autowired
UnitsService unitsService;
@Autowired
AreaCache areaCache;
@Override
public List<AreaInstitutions> findAllUserUnitsIdAreaList(Integer areaId) {
Optional<Area> areaOptional = areaDao.findById(areaId);
......@@ -164,7 +168,7 @@ public class AreaServiceImpl implements AreaService {
throw new ApiException(ResponseEntity.ok("[区域] 没有找到对应的所属区域id"));
}
Area area1 = areaDao.save(area);
areaCache.refresh(areaDao.findAll());
return area1;
}
......@@ -181,6 +185,8 @@ public class AreaServiceImpl implements AreaService {
@Override
public Area update(Area area) {
return areaDao.save(area);
Area area1 = areaDao.save(area);
areaCache.refresh(areaDao.findAll());
return area1;
}
}
package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.Area;
......@@ -34,6 +35,8 @@ public class UnitsServiceImpl implements UnitsService {
UnitsDao unitsDao;
@Autowired
AreaDao areaDao;
@Autowired
UnitsCache unitsCache;
@Override
public Units findById(Integer unitId) {
Optional<Units> unit = unitsDao.findById(unitId);
......@@ -332,12 +335,15 @@ public class UnitsServiceImpl implements UnitsService {
else {
units.setLevel(4);
}
return unitsDao.save(units);
Units units1 = unitsDao.save(units);
unitsCache.refresh(unitsDao.findAll());
return units1;
}
@Override
public boolean delete(Integer id) {
unitsDao.deleteById(id);
unitsCache.refresh(unitsDao.findAll());
return true;
}
......@@ -348,6 +354,8 @@ public class UnitsServiceImpl implements UnitsService {
@Override
public Units update(Units units) {
return unitsDao.save(units);
Units units1 = unitsDao.save(units);
unitsCache.refresh(unitsDao.findAll());
return units1;
}
}
package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.user.base.req.DropDownUserLocation;
import com.tykj.dev.device.user.base.req.NotIsUser;
import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.dao.MgrcertDao;
......@@ -15,6 +17,7 @@ import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserLogService;
import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
......@@ -55,6 +58,12 @@ public class UserServiceImpl implements UserService {
@Autowired
MessageService messageService;
@Autowired
UserCache userCache;
@Autowired
ConfigCache configCache;
@Override
public User save(User user, SecurityUser securityUser) {
String encode = bCryptPasswordEncoder.encode("qwer1234");
......@@ -78,6 +87,7 @@ public class UserServiceImpl implements UserService {
}
messageService.add(new MessageBto(0,-1,securityUser.getUsername()+"添加专管员"+user1.getUsername(),this.findAllLastUserids(securityUser.getCurrentUserInfo().getUserId())));
userLogService.save(new UserLog(user1.getUserId(),new Date(),"专管员任命成功"));
userCache.refresh(userDao.findAll());
return user1;
}
......@@ -109,12 +119,14 @@ public class UserServiceImpl implements UserService {
}
userLogService.save(new UserLog(user1.getUserId(),new Date(),"专管员任命成功"));
userCache.refresh(userDao.findAll());
return user1;
}
@Override
public boolean delete(Integer id) {
userDao.deleteById(id);
userCache.refresh(userDao.findAll());
return true;
}
......@@ -132,7 +144,9 @@ public class UserServiceImpl implements UserService {
}else {
throw new ApiException(ResponseEntity.status(500).body("没找到对应的用户id"));
}
return userDao.save(user);
User user1 = userDao.save(user);
userCache.refresh(userDao.findAll());
return user1;
}
@Override
......@@ -181,7 +195,7 @@ public class UserServiceImpl implements UserService {
boolean isSex = user.getSex() != 1 ? "男".contains(userConditionsVo.getDim()) : "女".contains(userConditionsVo.getDim());
boolean isUnit = unitsService.findById(user.getUnitsId()).getName().contains(userConditionsVo.getDim());
boolean isMobile=user.getMobile()!=null&&user.getMobile().contains(userConditionsVo.getDim());
boolean isPosition = user.getPosition() == 1 ? "领导".contains(userConditionsVo.getDim()) : "专管员".contains(userConditionsVo.getDim());
boolean isPosition = configCache.getPositionMap().get(user.getPosition()).contains(userConditionsVo.getDim());
return isName || isSex || isUnit || isPosition||isMobile;
}else {
return true;
......@@ -267,6 +281,7 @@ public class UserServiceImpl implements UserService {
if (bCryptPasswordEncoder.matches(userUpdatePw.getPassword(),user.getPassword())) {
user.setPassword(bCryptPasswordEncoder.encode(userUpdatePw.getNewPassWord()));
User user1 = userDao.save(user);
userCache.refresh(userDao.findAll());
return user1.getUserId();
} else {
return -1;
......@@ -291,8 +306,10 @@ public class UserServiceImpl implements UserService {
} else {
memberThat.setRemaining(0L);
}
ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache!=null){
memberThat.setPositionName(configCache.getPositionMap().get(memberThat.getPosition()));
}
return memberThat;
}
......@@ -421,6 +438,7 @@ public class UserServiceImpl implements UserService {
}
);
userDao.saveAll(users);
userCache.refresh(userDao.findAll());
}
@Override
......
......@@ -24,9 +24,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import java.util.Objects;
import java.util.*;
/**
* @author dengdiyi
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论