提交 228c9237 authored 作者: zjm's avatar zjm

合并分支 'dev' 到 'master'

Dev合并 mes v0.0.9.8.2 关闭 #2#3 查看合并请求 !1
...@@ -7,8 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -7,8 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author huangxiahao * @author huangxiahao
*/ */
@SpringBootApplication(scanBasePackages = { @SpringBootApplication(scanBasePackages = {
"com.tykj.dev.config", "com.tykj.dev.*"
"com.tykj.dev.misc"
} }
) )
public class ConfigApplication { public class ConfigApplication {
......
...@@ -29,7 +29,12 @@ public enum FileName { ...@@ -29,7 +29,12 @@ public enum FileName {
/** /**
* 配发单 * 配发单
*/ */
ALLOT(6,"配发单"); ALLOT(6,"配发单"),
/**
* 丢失单
*/
LOSS(7,"丢失单");
public Integer id; public Integer id;
......
...@@ -30,6 +30,9 @@ public class ConfigCache { ...@@ -30,6 +30,9 @@ public class ConfigCache {
private Map<Integer, String> positionMap; private Map<Integer, String> positionMap;
private Map<Integer, String> storageLocationMap;
public ConfigCache(List<SystemConfig> systemConfigs){ public ConfigCache(List<SystemConfig> systemConfigs){
this.lifeStatusMap = systemConfigs.stream().filter(systemConfig -> "lifeStatus".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); 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.matchingRangeMap = systemConfigs.stream().filter(systemConfig -> "matchingRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
...@@ -41,6 +44,8 @@ public class ConfigCache { ...@@ -41,6 +44,8 @@ public class ConfigCache {
this.natureMap = systemConfigs.stream().filter(systemConfig -> "nature".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)); this.positionMap = systemConfigs.stream().filter(systemConfig -> "position".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.allotTypeMap = systemConfigs.stream().filter(systemConfig -> "allotType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.allotTypeMap = systemConfigs.stream().filter(systemConfig -> "allotType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.storageLocationMap = systemConfigs.stream().filter(systemConfig -> "storageLocation".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
} }
public Map<Integer, String> getMatchingRangeMap() { public Map<Integer, String> getMatchingRangeMap() {
...@@ -83,6 +88,11 @@ public class ConfigCache { ...@@ -83,6 +88,11 @@ public class ConfigCache {
return allotTypeMap; return allotTypeMap;
} }
public Map<Integer, String> getStorageLocationMap() {
return storageLocationMap;
}
public ConfigCache refresh(List<SystemConfig> systemConfigs){ public ConfigCache refresh(List<SystemConfig> systemConfigs){
this.lifeStatusMap = systemConfigs.stream().filter(systemConfig -> "lifeStatus".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); 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.matchingRangeMap = systemConfigs.stream().filter(systemConfig -> "matchingRange".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
...@@ -94,6 +104,7 @@ public class ConfigCache { ...@@ -94,6 +104,7 @@ public class ConfigCache {
this.natureMap = systemConfigs.stream().filter(systemConfig -> "nature".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)); this.positionMap = systemConfigs.stream().filter(systemConfig -> "position".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.allotTypeMap = systemConfigs.stream().filter(systemConfig -> "allotType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel)); this.allotTypeMap = systemConfigs.stream().filter(systemConfig -> "allotType".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
this.storageLocationMap = systemConfigs.stream().filter(systemConfig -> "storageLocation".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
return this; return this;
} }
} }
...@@ -3,6 +3,7 @@ package com.tykj.dev.config.controller; ...@@ -3,6 +3,7 @@ package com.tykj.dev.config.controller;
import com.tykj.dev.config.domin.SystemConfig; import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.repository.SystemConfigDao; import com.tykj.dev.config.repository.SystemConfigDao;
import com.tykj.dev.config.service.SystemConfigService; import com.tykj.dev.config.service.SystemConfigService;
import com.tykj.dev.config.service.TerminalInformationService;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.config.vo.ConfigUpdateVo; import com.tykj.dev.config.vo.ConfigUpdateVo;
import com.tykj.dev.config.vo.ConfigVo; import com.tykj.dev.config.vo.ConfigVo;
...@@ -36,6 +37,9 @@ public class ConfigController { ...@@ -36,6 +37,9 @@ public class ConfigController {
@Autowired @Autowired
private SystemConfigDao systemConfigDao; private SystemConfigDao systemConfigDao;
@Autowired
TerminalInformationService terminalInformationService;
@ApiOperation(value = "添加系统配置变量值", notes = "添加系统配置变量值") @ApiOperation(value = "添加系统配置变量值", notes = "添加系统配置变量值")
@PostMapping(value = "/add") @PostMapping(value = "/add")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -65,10 +69,12 @@ public class ConfigController { ...@@ -65,10 +69,12 @@ public class ConfigController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity select() { public ResponseEntity select() {
Map<String, List<SystemConfig>> map = systemConfigDao.findAllByDeleteTag(0).stream().sorted(Comparator.comparing(SystemConfig::getValue)).collect(groupingBy(SystemConfig::getChineseName)); Map<String, List<SystemConfig>> map = systemConfigDao.findAllByDeleteTag(0).stream().sorted(Comparator.comparing(SystemConfig::getValue)).collect(groupingBy(SystemConfig::getChineseName));
// Map<String,List<String>> resultMap = new HashMap<>();
// for (String s:map.keySet()) {
// resultMap.put(s,map.get(s).stream().map(SystemConfig::getLabel).collect(Collectors.toList()));
// }
return ResponseEntity.ok(map); return ResponseEntity.ok(map);
} }
@ApiOperation(value = "终端信息根据序号查询接口", notes = "终端信息根据序号查询接口")
@GetMapping(value = "/terminalInformation/{code}")
public ResponseEntity select(@PathVariable String code) {
return ResponseEntity.ok(terminalInformationService.findCode(code));
}
} }
package com.tykj.dev.config.domin;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
/**
* @author zjm
* @version 1.0.0
* @ClassName TerminalInformation.java
* @Description TODO
* @createTime 2021年08月16日 17:03:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@EntityListeners(AuditingEntityListener.class)
@Entity
@ApiModel(value = "终端信息", description = "终端信息实体")
public class TerminalInformation extends BaseEntity {
private String code;
private String name;
}
package com.tykj.dev.config.repository;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.domin.TerminalInformation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author zjm
* @version 1.0.0
* @ClassName TerminalInformationDao.java
* @Description TODO
* @createTime 2021年08月16日 17:05:00
*/
public interface TerminalInformationDao extends JpaRepository<TerminalInformation,Integer>, JpaSpecificationExecutor<TerminalInformation> {
TerminalInformation findByCode(String code);
}
...@@ -2,6 +2,8 @@ package com.tykj.dev.config.service; ...@@ -2,6 +2,8 @@ package com.tykj.dev.config.service;
import com.tykj.dev.config.domin.SystemConfig; import com.tykj.dev.config.domin.SystemConfig;
import java.util.Map;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -16,4 +18,6 @@ public interface SystemConfigService { ...@@ -16,4 +18,6 @@ public interface SystemConfigService {
Integer getMaxValue(String englishName); Integer getMaxValue(String englishName);
SystemConfig getOne(Integer id); SystemConfig getOne(Integer id);
Map<Integer, String> getStorageLocationMap();
} }
package com.tykj.dev.config.service;
import com.tykj.dev.config.domin.TerminalInformation;
/**
* @author zjm
* @version 1.0.0
* @ClassName TerminalInformationService.java
* @Description TODO
* @createTime 2021年08月16日 17:07:00
*/
public interface TerminalInformationService {
TerminalInformation findCode(String code);
TerminalInformation saveTerminalInformation(TerminalInformation terminalInformation);
}
...@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; ...@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class SystemConfigServiceImpl implements SystemConfigService { public class SystemConfigServiceImpl implements SystemConfigService {
...@@ -53,4 +54,10 @@ public class SystemConfigServiceImpl implements SystemConfigService { ...@@ -53,4 +54,10 @@ public class SystemConfigServiceImpl implements SystemConfigService {
public SystemConfig getOne(Integer id) { public SystemConfig getOne(Integer id) {
return systemConfigDao.findById(id).get(); return systemConfigDao.findById(id).get();
} }
@Override
public Map<Integer, String> getStorageLocationMap() {
return configCache.getStorageLocationMap();
}
} }
package com.tykj.dev.config.service.impl;
import com.tykj.dev.config.domin.TerminalInformation;
import com.tykj.dev.config.repository.TerminalInformationDao;
import com.tykj.dev.config.service.TerminalInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zjm
* @version 1.0.0
* @ClassName TerminalInformationServiceImpl.java
* @Description TODO
* @createTime 2021年08月16日 17:09:00
*/
@Service
public class TerminalInformationServiceImpl implements TerminalInformationService {
@Autowired
TerminalInformationDao terminalInformationDao;
@Override
public TerminalInformation findCode(String code) {
return terminalInformationDao.findByCode(code);
}
@Override
public TerminalInformation saveTerminalInformation(TerminalInformation terminalInformation) {
return terminalInformationDao.save(terminalInformation);
}
}
...@@ -6,7 +6,6 @@ import lombok.AllArgsConstructor; ...@@ -6,7 +6,6 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
...@@ -28,12 +27,12 @@ public class CheckExamDetailVo { ...@@ -28,12 +27,12 @@ public class CheckExamDetailVo {
private List<String> userNames; private List<String> userNames;
@ApiModelProperty(name = "需要被检查的区域id") @ApiModelProperty(name = "需要被检查的区域id")
private List<Integer> unitIds; private Integer unitId;
@ApiModelProperty(name = "备注") @ApiModelProperty(name = "备注")
private String remark; private String remark;
public CheckExamDetailVo copy(Integer unitId,String remark) { public CheckExamDetailVo copy(Integer unitId,String remark) {
return new CheckExamDetailVo(this.groupName, this.userNames, Collections.singletonList(unitId), remark); return new CheckExamDetailVo(this.groupName, this.userNames, unitId, remark);
} }
} }
...@@ -49,4 +49,7 @@ public class DeviceInLibVo { ...@@ -49,4 +49,7 @@ public class DeviceInLibVo {
private String lifeStatusName; private String lifeStatusName;
private String matchingRangeName;
private Integer isPart;
} }
...@@ -48,4 +48,8 @@ public class DeviceNotInLibVo { ...@@ -48,4 +48,8 @@ public class DeviceNotInLibVo {
private String secretLevelName; private String secretLevelName;
private String lifeStatusName; private String lifeStatusName;
private String matchingRangeName;
private Integer isPart;
} }
...@@ -401,7 +401,9 @@ public class ObjTransUtil { ...@@ -401,7 +401,9 @@ public class ObjTransUtil {
device.getInvisibleRangeName(), device.getInvisibleRangeName(),
device.getTypeName(), device.getTypeName(),
device.getSecretLevelName(), device.getSecretLevelName(),
device.getLifeStatusName() device.getLifeStatusName(),
device.getMatchingRangeName(),
device.getIsPart()
); );
} }
...@@ -423,7 +425,9 @@ public class ObjTransUtil { ...@@ -423,7 +425,9 @@ public class ObjTransUtil {
device.getInvisibleRangeName(), device.getInvisibleRangeName(),
device.getTypeName(), device.getTypeName(),
device.getSecretLevelName(), device.getSecretLevelName(),
device.getLifeStatusName() device.getLifeStatusName(),
device.getMatchingRangeName(),
device.getIsPart()
); );
} }
} }
......
...@@ -130,4 +130,10 @@ public class DecommissioningQueryController { ...@@ -130,4 +130,10 @@ public class DecommissioningQueryController {
deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(list,3); deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(list,3);
return ResponseEntity.ok("ok"); return ResponseEntity.ok("ok");
} }
@GetMapping(value ="/repel/fileMap/{taskId}")
@ApiOperation(value = "根据任务ID查询业务相关单据", notes = "根据任务ID查询业务相关单据")
public ResponseEntity repelFileMap( @PathVariable Integer taskId){
return ResponseEntity.ok(deviceDecommissioningQueryService.findByTaskIdToFileMapList(taskId));
}
} }
...@@ -46,4 +46,10 @@ public class DeviceDestroyQueryController { ...@@ -46,4 +46,10 @@ public class DeviceDestroyQueryController {
public ResponseEntity findApplyIdToDecommissioningTask(@RequestBody DestroySelectVo destroySelectVo){ public ResponseEntity findApplyIdToDecommissioningTask(@RequestBody DestroySelectVo destroySelectVo){
return ResponseEntity.ok(deviceDestroyQueryService.findPageDeviceDestroyBill(destroySelectVo)); return ResponseEntity.ok(deviceDestroyQueryService.findPageDeviceDestroyBill(destroySelectVo));
} }
@GetMapping(value ="/repel/fileMap/{taskId}")
@ApiOperation(value = "根据任务ID查询业务相关单据", notes = "根据任务ID查询业务相关单据")
public ResponseEntity repelFileMap( @PathVariable Integer taskId){
return ResponseEntity.ok(deviceDestroyQueryService.findByTaskIdToFileMapList(taskId));
}
} }
...@@ -50,9 +50,17 @@ ...@@ -50,9 +50,17 @@
<artifactId>easypoi-annotation</artifactId> <artifactId>easypoi-annotation</artifactId>
<version>3.2.0</version> <version>3.2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.ben-manes.caffeine</groupId> <groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId> <artifactId>caffeine</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>5.3.2</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.tykj.dev.device.library.config;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.cache.CacheManager;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.TimeUnit;
/**
* CaffeineCacheConfig.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/8/16 at 5:21 下午
*/
@Configuration
public class CaffeineCacheConfig {
@Bean
public CacheManager cacheManager() {
CaffeineCacheManager cacheManager = new CaffeineCacheManager("devicesLibraryList");
cacheManager.setCaffeine(caffeineCacheBuilder());
return cacheManager;
}
Caffeine< Object, Object > caffeineCacheBuilder() {
return Caffeine.newBuilder()
.initialCapacity(100)
.maximumSize(500)
.expireAfterAccess(10, TimeUnit.MINUTES)
.weakKeys()
.recordStats();
}
}
...@@ -645,18 +645,17 @@ public class DeviceLibraryController { ...@@ -645,18 +645,17 @@ public class DeviceLibraryController {
deviceLibraryEntity.setType(libraryUpdateVo.getType()); deviceLibraryEntity.setType(libraryUpdateVo.getType());
} }
//add 库房 //add 库房
if (libraryUpdateVo.getStorageLocation()!=null){ if (libraryUpdateVo.getStorageLocation()!=null && !libraryUpdateVo.getStorageLocation().equals(deviceLibraryEntity.getStorageLocation())){
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());
} }
//add 备注 //add 备注
if (libraryUpdateVo.getRecord()!=null){ if (libraryUpdateVo.getRecord()!=null && !libraryUpdateVo.getRecord().equals(deviceLibraryEntity.getRecord())){
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(), "将备注改为"+libraryUpdateVo.getRecord(), null,null,null); DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(), "将备注改为"+libraryUpdateVo.getRecord(), null,null,null);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryEntity.setRecord(libraryUpdateVo.getRecord()); deviceLibraryEntity.setRecord(libraryUpdateVo.getRecord());
} }
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
} }
//添加绑定配件 //添加绑定配件
...@@ -815,15 +814,27 @@ public class DeviceLibraryController { ...@@ -815,15 +814,27 @@ public class DeviceLibraryController {
List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceSelectIdsVo.getIds()); List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceSelectIdsVo.getIds());
byIds.forEach(DeviceLibrary::setConfigName); byIds.forEach(DeviceLibrary::setConfigName);
Map<String, List<DeviceLibrary>> map = byIds.stream().collect(Collectors.groupingBy(DeviceLibrary::getOwnUnit)); //key为所属单位
Map<String, List<DeviceLibrary>> map = byIds.stream().collect(Collectors.groupingBy(deviceLibrary -> deviceLibrary.getOwnUnit()+"Ǵ"+deviceLibrary.getIsPart()));
List<DeviceNewVo> deviceNewVoList = new ArrayList<>(); List<DeviceNewVo> deviceNewVoList = new ArrayList<>();
map.forEach((k,v)->{
DeviceNewVo deviceNewVo = new DeviceNewVo(v.get(0).getModel(), v.get(0).getName(),
v.get(0).getMatchingRangeName(), v.get(0).getTypeName(),
v.size(),k,DeviceModelSort.toUnitSort(k),v.stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
deviceNewVoList.add(deviceNewVo); map.forEach((k,v)->{
}); DeviceNewVo deviceNewVo = new DeviceNewVo(v.get(0).getModel(), v.get(0).getName(),
v.get(0).getMatchingRangeName(), v.get(0).getTypeName(),
v.size(),k.split("Ǵ")[0],DeviceModelSort.toUnitSort(k.split("Ǵ")[0]),v.stream().map(DeviceLibrary::getId).collect(Collectors.toList()),Integer.valueOf(k.split("Ǵ")[1]));
deviceNewVoList.add(deviceNewVo);
});
// List<DeviceNewVo> deviceNewVoList = new ArrayList<>();
// map.forEach((k,v)->{
// DeviceNewVo deviceNewVo = new DeviceNewVo(v.get(0).getModel(), v.get(0).getName(),
// v.get(0).getMatchingRangeName(), v.get(0).getTypeName(),
// v.size(),k,DeviceModelSort.toUnitSort(k),v.stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
// deviceNewVoList.add(deviceNewVo);
// });
//实现按照组织架构排序
deviceNewVoList.sort(Comparator.comparing(DeviceNewVo::getLevel)); deviceNewVoList.sort(Comparator.comparing(DeviceNewVo::getLevel));
return deviceNewVoList; return deviceNewVoList;
} }
...@@ -833,7 +844,6 @@ public class DeviceLibraryController { ...@@ -833,7 +844,6 @@ public class DeviceLibraryController {
*/ */
@GetMapping("/setNumber") @GetMapping("/setNumber")
public List<DeviceLibrary> setNumber(){ public List<DeviceLibrary> setNumber(){
List<DeviceLibrary> allListAndParent = getAllListAndParent(); List<DeviceLibrary> allListAndParent = getAllListAndParent();
AtomicInteger sortNum = new AtomicInteger(); AtomicInteger sortNum = new AtomicInteger();
return setOrderNumber(sortNum, allListAndParent); return setOrderNumber(sortNum, allListAndParent);
......
...@@ -42,4 +42,7 @@ public class DeviceNewVo { ...@@ -42,4 +42,7 @@ public class DeviceNewVo {
@ApiModelProperty(value = "装备id") @ApiModelProperty(value = "装备id")
private List<Integer> devicesId; private List<Integer> devicesId;
@ApiModelProperty("是否是配件")
private Integer isPart;
} }
...@@ -11,10 +11,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -11,10 +11,7 @@ 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.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
/** /**
...@@ -59,4 +56,10 @@ public class DeviceLossController { ...@@ -59,4 +56,10 @@ public class DeviceLossController {
lossBillService.superiorAuditRetrieve(retrieveAuditvo); lossBillService.superiorAuditRetrieve(retrieveAuditvo);
return ResponseEntity.ok("确认成功"); return ResponseEntity.ok("确认成功");
} }
@GetMapping(value ="/repel/fileMap/{taskId}")
@ApiOperation(value = "根据任务ID查询业务相关单据", notes = "根据任务ID查询业务相关单据")
public ResponseEntity repelFileMap( @PathVariable Integer taskId){
return ResponseEntity.ok(lossBillService.findTaskIdToFileMap(taskId));
}
} }
...@@ -31,4 +31,7 @@ public class DeviceLossSelectController { ...@@ -31,4 +31,7 @@ public class DeviceLossSelectController {
public ResponseEntity initiateLoss( @PathVariable Integer taskId){ public ResponseEntity initiateLoss( @PathVariable Integer taskId){
return ResponseEntity.ok(lossBillSelectService.findDeviceLoss(taskId)); return ResponseEntity.ok(lossBillSelectService.findDeviceLoss(taskId));
} }
} }
package com.tykj.dev.device.loss.service; package com.tykj.dev.device.loss.service;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.loss.entity.domain.DeviceLoss; import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import com.tykj.dev.device.loss.entity.vo.LossAuditvo; import com.tykj.dev.device.loss.entity.vo.LossAuditvo;
import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo; import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo;
import com.tykj.dev.device.user.subject.entity.SecurityUser; import com.tykj.dev.device.user.subject.entity.SecurityUser;
import java.util.List;
import java.util.Map;
/** /**
* @author zjm * @author zjm
* @version 1.0.0 * @version 1.0.0
...@@ -34,4 +38,5 @@ public interface LossBillService { ...@@ -34,4 +38,5 @@ public interface LossBillService {
*/ */
void superiorAuditRetrieve(RetrieveAuditvo retrieveAuditvo); void superiorAuditRetrieve(RetrieveAuditvo retrieveAuditvo);
Map<String, List<FileRet>> findTaskIdToFileMap(Integer taskId);
} }
package com.tykj.dev.device.loss.service.impl; package com.tykj.dev.device.loss.service.impl;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil; import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.base.FileName;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
...@@ -11,6 +13,7 @@ import com.tykj.dev.device.loss.entity.domain.DeviceLoss; ...@@ -11,6 +13,7 @@ import com.tykj.dev.device.loss.entity.domain.DeviceLoss;
import com.tykj.dev.device.loss.entity.vo.LossAuditvo; import com.tykj.dev.device.loss.entity.vo.LossAuditvo;
import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo; import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo;
import com.tykj.dev.device.loss.service.DeviceLossService; import com.tykj.dev.device.loss.service.DeviceLossService;
import com.tykj.dev.device.loss.service.LossBillSelectService;
import com.tykj.dev.device.loss.service.LossBillService; import com.tykj.dev.device.loss.service.LossBillService;
import com.tykj.dev.device.loss.util.StringUtils; import com.tykj.dev.device.loss.util.StringUtils;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
...@@ -32,7 +35,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -32,7 +35,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -76,6 +81,8 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -76,6 +81,8 @@ public class LossBillServiceImpl implements LossBillService {
@Autowired @Autowired
UserService userService; UserService userService;
@Autowired
LossBillSelectService lossBillSelectService;
@Override @Override
public void initiateLoss(DeviceLoss deviceLoss, SecurityUser securityUser) { public void initiateLoss(DeviceLoss deviceLoss, SecurityUser securityUser) {
deviceLibraryService.isInStockOrWaitRetired(deviceLoss.getDevIdsList()); deviceLibraryService.isInStockOrWaitRetired(deviceLoss.getDevIdsList());
...@@ -194,6 +201,14 @@ public class LossBillServiceImpl implements LossBillService { ...@@ -194,6 +201,14 @@ public class LossBillServiceImpl implements LossBillService {
deviceLossService.save(deviceLoss); deviceLossService.save(deviceLoss);
} }
@Override
public Map<String,List<FileRet>> findTaskIdToFileMap(Integer taskId) {
Map<String,List<FileRet>> map=new HashMap<>();
DeviceLoss deviceLoss= lossBillSelectService.findDeviceLoss(taskId);
map.put(FileName.LOSS.name,deviceLoss.getFileRetList());
return map;
}
private TaskBto newRetrieveCountyTask(Integer unitId, Integer lossId, String title,Integer userID){ private TaskBto newRetrieveCountyTask(Integer unitId, Integer lossId, String title,Integer userID){
List<Integer> list=new ArrayList<>(); List<Integer> list=new ArrayList<>();
......
package com.tykj.dev.misc.utils; package com.tykj.dev.misc.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -16,45 +20,80 @@ import java.util.stream.Collectors; ...@@ -16,45 +20,80 @@ import java.util.stream.Collectors;
*/ */
@Component @Component
public class DeviceModelSort { public class DeviceModelSort {
public static Map<String,Integer> mapModelSort; public static Map<String, Integer> mapModelSort;
public static Map<String,Integer> mapUnitSort; public static Map<String, Integer> mapUnitSort;
/** /**
* 列装型号排序方法 * 列装型号排序方法
*
* @param modelList 需要排序的型号 * @param modelList 需要排序的型号
* @return 排】序过后的型号列表 * @return 排】序过后的型号列表
*/ */
public static List<String> modelToSort(List<String> modelList){ public static List<String> modelToSort(List<String> modelList) {
return modelList.stream().sorted(Comparator.comparing(DeviceModelSort::toModelSort)).collect(Collectors.toList()); //int -> map {id , value String} -> sort -> mappping get value -> to list
// List<String> resultModel = new ArrayList<>();
// List<SortedModel> sortedModels = new ArrayList<>();
//
// for (String m : modelList) {
// sortedModels.add(new SortedModel(toModelSort(m), m));
// }
//
// sortedModels.sort(Comparator.comparing(SortedModel::getId));
//
// for (SortedModel model : sortedModels) {
// resultModel.add(model.getValue());
// }
return modelList.stream()
.map(s -> new SortedModel(toModelSort(s), s))
.sorted(Comparator.comparing(SortedModel::getId))
.map(SortedModel::getValue)
.collect(Collectors.toList());
// modelList= modelList.stream().sorted(Comparator.comparing(DeviceModelSort::toModelSort)).collect(Collectors.toList());
// return modelList;
}
@Data
@NoArgsConstructor
@AllArgsConstructor
static
class SortedModel {
Integer id;
String value;
} }
/** /**
* 获取型号对应的排序号 * 获取型号对应的排序号
*
* @param model 型号 * @param model 型号
* @return 排序号码 * @return 排序号码
*/ */
public static Integer toModelSort(String model){ public static Integer toModelSort(String model) {
System.out.println(model);
return mapModelSort.get(model); return mapModelSort.get(model);
} }
/** /**
* 单位排序排序方法 * 单位排序排序方法
*
* @param unitList 需要排序的型号 * @param unitList 需要排序的型号
* @return 排序过后的型号列表 * @return 排序过后的型号列表
*/ */
public static List<String> unitToSort(List<String> unitList){ public static List<String> unitToSort(List<String> unitList) {
return unitList.stream().sorted(Comparator.comparing(DeviceModelSort::toUnitSort)).collect(Collectors.toList()); return unitList.stream().sorted(Comparator.comparing(DeviceModelSort::toUnitSort)).collect(Collectors.toList());
} }
/** /**
* 获取单位对应的排序号 * 获取单位对应的排序号
* @param unitName 单位名称 *
* @param unitName 单位名称
* @return 排序号码 * @return 排序号码
*/ */
public static Integer toUnitSort(String unitName){ public static Integer toUnitSort(String unitName) {
return mapUnitSort.get(unitName); return mapUnitSort.get(unitName);
} }
......
...@@ -1640,15 +1640,38 @@ public class RepairController { ...@@ -1640,15 +1640,38 @@ public class RepairController {
integerList.add(9); integerList.add(9);
integerList.add(4); integerList.add(4);
//过滤掉状态4,5,9 //过滤掉状态4,5,9
long l = System.currentTimeMillis();
List<RepairDetail> repairDetails1 = repairDetailDao.findAllByRepairStatusNotIn(integerList, repairTaskSelectVo.getPageable().getSort()); List<RepairDetail> repairDetails1 = repairDetailDao.findAllByRepairStatusNotIn(integerList, repairTaskSelectVo.getPageable().getSort());
repairDetails1.forEach(repairDetail -> { repairDetails1.forEach(repairDetail -> {
repairDetail.setConfigName(); repairDetail.setConfigName();
}); });
System.out.println("repairDetails1--"+(System.currentTimeMillis()-l));
//发起送修的单位为当前单位 并且所在单位不是自己的 //发起送修的单位为当前单位 并且所在单位不是自己的
List<RepairDetail> repairDetails2 = repairDetails1.stream().filter(repairDetail -> deviceRepairBillService.getOne(repairDetail.getDeviceRepairBillId()).getSendUnit().equals(unitName)) //进行时间上面的优化 todo
List<Integer> sendRepairIds = repairDetails1.stream().map(RepairDetail::getDeviceRepairBillId).collect(Collectors.toList());
//通过id去查询
List<String> sendUnits = deviceRepairBillService.findByIds(sendRepairIds).stream().map(RepairBill::getSendUnit).collect(Collectors.toList());
List<RepairDetail> repairDetails2 = repairDetails1.stream().filter(repairDetail -> sendUnits.contains(unitName))
.filter(repairDetail -> !repairDetail.getLocationUnit().equals(unitName)) .filter(repairDetail -> !repairDetail.getLocationUnit().equals(unitName))
.collect(Collectors.toList()); .collect(Collectors.toList());
// List<RepairDetail> repairDetails2 = repairDetails1.stream().filter(
// repairDetail -> deviceRepairBillService.getOne(repairDetail.getDeviceRepairBillId())
// .getSendUnit().equals(unitName))
// .filter(repairDetail -> !repairDetail.getLocationUnit().equals(unitName))
// .collect(Collectors.toList());
List<WaitingRepairEquipmentVo> waitingRepairEquipments = new ArrayList<>(); List<WaitingRepairEquipmentVo> waitingRepairEquipments = new ArrayList<>();
long l2 = System.currentTimeMillis();
//进行优化
//需要查出来多个task todo
// List<Integer> taskIds = repairDetails2.stream().map(RepairDetail::getDeviceRepairBillId).collect(Collectors.toList());
// repairDetails2.forEach(
// repairDetail -> {
// WaitingRepairEquipmentVo waitingRepairEquipment = new WaitingRepairEquipmentVo();
// BeanUtils.copyProperties(repairDetail, waitingRepairEquipment);
//
// waitingRepairEquipments.add(waitingRepairEquipment);
// }
// );
for (RepairDetail repairDetail : repairDetails2) { for (RepairDetail repairDetail : repairDetails2) {
TaskBto taskBto = taskService.getParentTaskIsNull(repairDetail.getDeviceRepairBillId(), 5); TaskBto taskBto = taskService.getParentTaskIsNull(repairDetail.getDeviceRepairBillId(), 5);
TaskUserVo taskUserVo = taskBto.toVo(); TaskUserVo taskUserVo = taskBto.toVo();
...@@ -1657,6 +1680,8 @@ public class RepairController { ...@@ -1657,6 +1680,8 @@ public class RepairController {
waitingRepairEquipment.setTaskUserVos(taskUserVo); waitingRepairEquipment.setTaskUserVos(taskUserVo);
waitingRepairEquipments.add(waitingRepairEquipment); waitingRepairEquipments.add(waitingRepairEquipment);
} }
System.out.println("taskBto--"+(System.currentTimeMillis()-l2));
//按照时间排序 //按照时间排序
List<WaitingRepairEquipmentVo> waitingRepairEquipmentVoList = waitingRepairEquipments.stream().sorted(Comparator.comparing(WaitingRepairEquipmentVo::getUpdateTime)).collect(Collectors.toList()); List<WaitingRepairEquipmentVo> waitingRepairEquipmentVoList = waitingRepairEquipments.stream().sorted(Comparator.comparing(WaitingRepairEquipmentVo::getUpdateTime)).collect(Collectors.toList());
return ResponseEntity.ok(PageUtil.getPerPage(repairTaskSelectVo.getPage(), repairTaskSelectVo.getSize(), waitingRepairEquipmentVoList, repairTaskSelectVo.getPageable())); return ResponseEntity.ok(PageUtil.getPerPage(repairTaskSelectVo.getPage(), repairTaskSelectVo.getSize(), waitingRepairEquipmentVoList, repairTaskSelectVo.getPageable()));
......
...@@ -4,9 +4,15 @@ import com.tykj.dev.device.repair.subject.domin.RepairBill; ...@@ -4,9 +4,15 @@ import com.tykj.dev.device.repair.subject.domin.RepairBill;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
public interface RepairBillDao extends JpaRepository<RepairBill, Integer>, JpaSpecificationExecutor<RepairBill> { public interface RepairBillDao extends JpaRepository<RepairBill, Integer>, JpaSpecificationExecutor<RepairBill> {
/**
* 通过ids查询集合
*/
List<RepairBill> findAllByIdIn(List<Integer> ids);
} }
...@@ -26,4 +26,9 @@ public interface RepairBillService { ...@@ -26,4 +26,9 @@ public interface RepairBillService {
RepairBill update(RepairBill deviceRepairBillEntity); RepairBill update(RepairBill deviceRepairBillEntity);
void delete(Integer id); void delete(Integer id);
/**
* 通过id集合进行查询
*/
List<RepairBill> findByIds(List<Integer> ids);
} }
...@@ -94,6 +94,12 @@ public class RepairBillServiceImpl implements RepairBillService { ...@@ -94,6 +94,12 @@ public class RepairBillServiceImpl implements RepairBillService {
deviceRepairBillDao.deleteById(id); deviceRepairBillDao.deleteById(id);
} }
@Override
public List<RepairBill> findByIds(List<Integer> ids) {
return deviceRepairBillDao.findAllByIdIn(ids);
}
private Specification<RepairBill> getSelectSpecification(RepairBillSelectVo deviceRepairBillSelectVo) { private Specification<RepairBill> getSelectSpecification(RepairBillSelectVo deviceRepairBillSelectVo) {
PredicateBuilder<RepairBill> predicateBuilder = Specifications.and(); PredicateBuilder<RepairBill> predicateBuilder = Specifications.and();
PredicateBuilder<RepairBill> predicateBuilder1 = Specifications.or(); PredicateBuilder<RepairBill> predicateBuilder1 = Specifications.or();
......
...@@ -46,4 +46,10 @@ public class ScrapQueryController { ...@@ -46,4 +46,10 @@ public class ScrapQueryController {
public ResponseEntity findApplyIdToScrapTask(@PathVariable Integer applyId){ public ResponseEntity findApplyIdToScrapTask(@PathVariable Integer applyId){
return ResponseEntity.ok(scrapQueryService.findApplyIdToScrapTask(applyId)); return ResponseEntity.ok(scrapQueryService.findApplyIdToScrapTask(applyId));
} }
@GetMapping(value ="/repel/fileMap/{taskId}")
@ApiOperation(value = "根据任务ID查询业务相关单据", notes = "根据任务ID查询业务相关单据")
public ResponseEntity repelFileMap( @PathVariable Integer taskId){
return ResponseEntity.ok(scrapQueryService.findByTaskIdToFileMapList(taskId));
}
} }
...@@ -415,19 +415,16 @@ public class SelfCheckController { ...@@ -415,19 +415,16 @@ public class SelfCheckController {
if (s.length()>=2) { if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); 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,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),taskBto.getId()); DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,userId,taskBto.getId());
deviceLogDtos.add(deviceLogDto); deviceLogDtos.add(deviceLogDto);
// deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
} }
} }
long l = System.currentTimeMillis();
//进行日志的存储
executor.execute( executor.execute(
()->{ ()->{
deviceLogService.addAllLog(deviceLogDtos); deviceLogService.addAllLog(deviceLogDtos);
} }
); );
log.info("日志存储时间:{}",System.currentTimeMillis()-l);
log.info("[自查模块]:发起自查"); log.info("[自查模块]:发起自查");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success(selfExaminationBillEntity1); return ResultUtil.success(selfExaminationBillEntity1);
...@@ -438,6 +435,7 @@ public class SelfCheckController { ...@@ -438,6 +435,7 @@ public class SelfCheckController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity selfExaminationConfirm(@RequestBody @Validated SelfCheckConfirmVo selfCheckConfirmVo) { public ResponseEntity selfExaminationConfirm(@RequestBody @Validated SelfCheckConfirmVo selfCheckConfirmVo) {
TaskBto taskBto = taskService.get(selfCheckConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(selfCheckConfirmVo.getTaskId());
Integer userId = userUtils.getCurrentUserId();
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SELF_CHECK_CONFIRM); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SELF_CHECK_CONFIRM);
SelfCheckBill selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId()); SelfCheckBill selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId());
if(selfCheckConfirmVo.getCheckFiles()!=null&&selfCheckConfirmVo.getCheckFiles().size()>0){ if(selfCheckConfirmVo.getCheckFiles()!=null&&selfCheckConfirmVo.getCheckFiles().size()>0){
...@@ -466,7 +464,8 @@ public class SelfCheckController { ...@@ -466,7 +464,8 @@ public class SelfCheckController {
for (String s:strings) { for (String s:strings) {
if (s.length()>=2) { if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"上传自查单",null,taskBto.getId(),null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id,"上传自查单",null,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"上传自查单",null,userId,taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
} }
...@@ -482,7 +481,7 @@ public class SelfCheckController { ...@@ -482,7 +481,7 @@ public class SelfCheckController {
for (String s:strings) { for (String s:strings) {
if (s.length()>=2) { if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"自查审核失败",null,taskBto.getId(),null); DeviceLogDto deviceLogDto = new DeviceLogDto(id,"自查审核失败",null,userId,taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
} }
...@@ -697,13 +696,12 @@ public class SelfCheckController { ...@@ -697,13 +696,12 @@ public class SelfCheckController {
public void findBySystem1() { public void findBySystem1() {
//通过billId和businessType 和 ownUnit //通过billId和businessType 和 ownUnit
List<Task> allByBillAndBusinessTypeAndOwnUnit = taskService.findAllByBillAndBusinessTypeAndOwnUnit(4, userUtils.getCurrentUnitId()); List<Task> allByBillAndBusinessTypeAndOwnUnit = taskService.findAllByBillAndBusinessTypeAndOwnUnit(4, userUtils.getCurrentUnitId());
if (allByBillAndBusinessTypeAndOwnUnit.size() == 0){ if (allByBillAndBusinessTypeAndOwnUnit.size()>0){
throw new ApiException("该时间段没有系统发起的自查"); for (Task task : allByBillAndBusinessTypeAndOwnUnit) {
} taskService.moveToArchive(task.parse2Bto());
for (Task task : allByBillAndBusinessTypeAndOwnUnit) { //删除
taskService.moveToArchive(task.parse2Bto()); selfCheckBillService.delete(task.getBillId());
//删除 }
selfCheckBillService.delete(task.getBillId());
} }
} }
......
...@@ -29,6 +29,7 @@ public class RepelDevController { ...@@ -29,6 +29,7 @@ public class RepelDevController {
@Autowired @Autowired
RepelBusinessService repelBusinessService; RepelBusinessService repelBusinessService;
@Autowired @Autowired
AgainStorageBillService againStorageBillService; AgainStorageBillService againStorageBillService;
...@@ -177,4 +178,11 @@ public class RepelDevController { ...@@ -177,4 +178,11 @@ public class RepelDevController {
repelBusinessService.AllRepelNotDeviceSubmit(securityUser,taskId); repelBusinessService.AllRepelNotDeviceSubmit(securityUser,taskId);
return ResponseEntity.ok("任务办结完成"); return ResponseEntity.ok("任务办结完成");
} }
@ApiOperation(value = "test", notes = "全部清退无装备办结接口")
@GetMapping(value ="/test/{taskId}")
public ResponseEntity test(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@PathVariable Integer taskId){
return ResponseEntity.ok(repelBusinessService.repelWithdraw(taskId));
}
} }
...@@ -6,7 +6,9 @@ import com.tykj.dev.device.sendback.entity.vo.OrderOutData; ...@@ -6,7 +6,9 @@ import com.tykj.dev.device.sendback.entity.vo.OrderOutData;
import com.tykj.dev.device.sendback.entity.vo.RepelAuditResult; import com.tykj.dev.device.sendback.entity.vo.RepelAuditResult;
import com.tykj.dev.device.sendback.entity.vo.ResolveConfirm; import com.tykj.dev.device.sendback.entity.vo.ResolveConfirm;
import com.tykj.dev.device.sendback.entity.vo.StorageDeviceRepel; import com.tykj.dev.device.sendback.entity.vo.StorageDeviceRepel;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.entity.SecurityUser; import com.tykj.dev.device.user.subject.entity.SecurityUser;
import org.apache.poi.ss.formula.functions.T;
import java.util.List; import java.util.List;
...@@ -144,4 +146,10 @@ public interface RepelBusinessService { ...@@ -144,4 +146,10 @@ public interface RepelBusinessService {
*/ */
void withdraw(Integer taskId); void withdraw(Integer taskId);
/**
* 清退总任务 撤销
* 判断下面任务是否存在配发中的 有则不能撤回需要等配发结束后在撤回。
*/
List<TaskBto> repelWithdraw(Integer taskId);
} }
...@@ -40,6 +40,7 @@ import com.tykj.dev.misc.base.StatusEnum; ...@@ -40,6 +40,7 @@ import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.*; import com.tykj.dev.misc.utils.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
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.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -991,6 +992,38 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -991,6 +992,38 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
} }
} }
@Override
public List<TaskBto> repelWithdraw(Integer taskId) {
//首先查询总任务,把清退任务都查询出来
//SEND_BACK_1209 SEND_BACK_1215 SEND_BACK_1218 SEND_BACK_1220
// TaskBto taskBto = taskService.get(taskId);
// DeviceRepel deviceRepel=deviceRepelService.findDeviceRepel(taskBto.getBillId());
//市级清退16查询
List<Integer> statusList=new ArrayList<>();
statusList.add(StatusEnum.SEND_BACK_1209.id);
statusList.add(StatusEnum.SEND_BACK_1215.id);
statusList.add(StatusEnum.SEND_BACK_1218.id);
statusList.add(StatusEnum.SEND_BACK_1220.id);
List<TaskBto> taskBtoList = taskService.findAllBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId);
List<Integer> ids=taskBtoList.stream().map(TaskBto::getId).collect(Collectors.toList());
//市级清退统计任务集合
List<TaskBto> statisticalList = taskService.findAllBillTypeAndFatherIdIn(BusinessEnum.SEND_BACK_STATISTICAL.id,ids);
ids= statisticalList.stream().map(TaskBto::getId).collect(Collectors.toList());
taskBtoList.addAll( taskService.findAllBillTypeAndFatherIdIn(BusinessEnum.SEND_BACK.id,ids));
boolean flag = taskBtoList.stream().allMatch(taskBto -> !statusList.contains(taskBto.getBillStatus()));
// log.info("test :{}",flag);
if (flag){
//可以使用
}else {
//不可以撤回
}
//判断是否存在为哪些状态为不能清退
//不能清退都则返回否 告诉前端本次存在不能撤回都情况
//可以撤回 需要把所有都相关任务封存
return taskBtoList;
}
/** /**
* service私有方式 * service私有方式
......
...@@ -299,7 +299,7 @@ public class StatisticalController { ...@@ -299,7 +299,7 @@ public class StatisticalController {
List<ScrappedDestroyedRetiredVo> destroyedRetiredVoList = new ArrayList<>(); List<ScrappedDestroyedRetiredVo> destroyedRetiredVoList = new ArrayList<>();
if (lifeStatus.containsAll(deviceLibrarySelectVo.getLifeStatus())){ if (lifeStatus.containsAll(deviceLibrarySelectVo.getLifeStatus())){
//进行组合 //进行组合
Map<String, List<DeviceLibrary>> map = libraryList.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel() + "Ǵ" + deviceLibrary.getName() + "Ǵ" + deviceLibrary.getMatchingRangeName())); Map<String, List<DeviceLibrary>> map = libraryList.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel() + "Ǵ" + deviceLibrary.getName() + "Ǵ" + deviceLibrary.getMatchingRangeName()+"Ǵ"+deviceLibrary.getIsPart()));
if (map.size()>0){ if (map.size()>0){
for (String s : map.keySet()) { for (String s : map.keySet()) {
String[] strings = s.split("Ǵ"); String[] strings = s.split("Ǵ");
...@@ -308,6 +308,7 @@ public class StatisticalController { ...@@ -308,6 +308,7 @@ public class StatisticalController {
scrappedDestroyedRetiredVo.setModel(strings[0]); scrappedDestroyedRetiredVo.setModel(strings[0]);
scrappedDestroyedRetiredVo.setName(strings[1]); scrappedDestroyedRetiredVo.setName(strings[1]);
scrappedDestroyedRetiredVo.setMatchingRangeName(strings[2]); scrappedDestroyedRetiredVo.setMatchingRangeName(strings[2]);
scrappedDestroyedRetiredVo.setIsPart(Integer.valueOf(strings[3]));
scrappedDestroyedRetiredVo.setNum(map.get(s).size()); scrappedDestroyedRetiredVo.setNum(map.get(s).size());
List<Integer> ids = new ArrayList<>(); List<Integer> ids = new ArrayList<>();
List<DeviceLibrary> deviceLibraries = map.get(s); List<DeviceLibrary> deviceLibraries = map.get(s);
......
...@@ -38,4 +38,8 @@ public class ScrappedDestroyedRetiredVo { ...@@ -38,4 +38,8 @@ public class ScrappedDestroyedRetiredVo {
@ApiModelProperty(value = "装备id") @ApiModelProperty(value = "装备id")
private List<Integer> devicesId; private List<Integer> devicesId;
@ApiModelProperty(value = "是否是配件")
private Integer isPart;
} }
...@@ -791,5 +791,9 @@ public class StorageBillController { ...@@ -791,5 +791,9 @@ public class StorageBillController {
/** /**
* 根据任务id 查询单据 * 根据任务id 查询单据
*/ */
// public Map<> @ApiOperation("根据任务id获取单据集合")
@GetMapping("/getFileList")
public ResponseEntity getFiles(Integer taskId){
return ResponseEntity.ok(storageBillService.getFileList(taskId));
}
} }
package com.tykj.dev.device.task.repository; package com.tykj.dev.device.task.repository;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task; import com.tykj.dev.device.task.subject.domin.Task;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
...@@ -45,6 +46,12 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE ...@@ -45,6 +46,12 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
List<Task> findAllByBillIdAndBusinessType(Integer billId, Integer businessType); List<Task> findAllByBillIdAndBusinessType(Integer billId, Integer businessType);
List<Task> findAllByBusinessTypeAndParentTaskId(Integer businessType, Integer taskId);
List<Task> findAllByBusinessTypeAndParentTaskIdIn(Integer businessType, List<Integer> taskId);
/** /**
* 根据账单id、业务类型、以及父id为null * 根据账单id、业务类型、以及父id为null
...@@ -89,4 +96,5 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE ...@@ -89,4 +96,5 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
//zsp //zsp
List<Task> findAllByBusinessTypeAndOwnUnitAndCustomInfo(Integer businessType, Integer ownUnit,String customInfo); List<Task> findAllByBusinessTypeAndOwnUnitAndCustomInfo(Integer businessType, Integer ownUnit,String customInfo);
List<Task> findAllByIdIn(List<Integer> ids);
} }
...@@ -232,9 +232,24 @@ public interface TaskService { ...@@ -232,9 +232,24 @@ public interface TaskService {
*/ */
TaskBto findBillTypeAndFatherId(Integer billType,Integer fatherId); TaskBto findBillTypeAndFatherId(Integer billType,Integer fatherId);
List<TaskBto> findAllBillTypeAndFatherId(Integer billType,Integer fatherId);
/**
* 根据业务类型和父类id集合查询任务
* @param billType 业务类型
* @param fatherIds 父类id集合
* @return 任务集合
*/
List<TaskBto> findAllBillTypeAndFatherIdIn(Integer billType,List<Integer> fatherIds);
TaskBto findByTaskId(Integer taskId); TaskBto findByTaskId(Integer taskId);
List<TaskBto> findAllByBillIdAndBusinessType2(Integer billId,Integer businessType); List<TaskBto> findAllByBillIdAndBusinessType2(Integer billId,Integer businessType);
List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer businessType,Integer ownUnit); List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer businessType,Integer ownUnit);
/**
* 查询多个任务
*/
TaskBto findByTaskIds(List<Integer> ids);
} }
...@@ -1129,6 +1129,16 @@ public class TaskServiceImpl implements TaskService { ...@@ -1129,6 +1129,16 @@ public class TaskServiceImpl implements TaskService {
return taskDao.findByParentTaskIdAndBusinessType(fatherId,billType).parse2Bto(); return taskDao.findByParentTaskIdAndBusinessType(fatherId,billType).parse2Bto();
} }
@Override
public List<TaskBto> findAllBillTypeAndFatherId(Integer billType, Integer fatherId) {
return taskDao.findAllByBusinessTypeAndParentTaskId(billType,fatherId).stream().map(Task::parse2Bto).collect(Collectors.toList());
}
@Override
public List<TaskBto> findAllBillTypeAndFatherIdIn(Integer billType, List<Integer> fatherIds) {
return taskDao.findAllByBusinessTypeAndParentTaskIdIn(billType,fatherIds).stream().map(Task::parse2Bto).collect(Collectors.toList());
}
@Override @Override
public TaskBto findByTaskId(Integer taskId) { public TaskBto findByTaskId(Integer taskId) {
return taskDao.findById(taskId).get().parse2Bto(); return taskDao.findById(taskId).get().parse2Bto();
...@@ -1152,6 +1162,18 @@ public class TaskServiceImpl implements TaskService { ...@@ -1152,6 +1162,18 @@ public class TaskServiceImpl implements TaskService {
.stream().filter(task -> task.getTitle().contains("系统发起") && !list.contains(task.getBillStatus())).collect(Collectors.toList()); .stream().filter(task -> task.getTitle().contains("系统发起") && !list.contains(task.getBillStatus())).collect(Collectors.toList());
} }
@Override
public TaskBto findByTaskIds(List<Integer> ids) {
List<Task> tasks = taskDao.findAllByIdIn(ids).stream().filter(task -> task.getBusinessType() == 5).collect(Collectors.toList());
tasks = tasks.stream().filter(task -> task.getParentTaskId() == null).collect(Collectors.toList());
if (tasks.size()==0){
return new TaskBto();
// throw new ApiException(String.format("要查询的数据不存在,查询的billId为 %d,businessType为 %d", billId, businessType));
}else {
return tasks.get(0).parse2Bto();
}
}
@Override @Override
public void moveAllSonNodeToEnd(Integer taaskId) { public void moveAllSonNodeToEnd(Integer taaskId) {
List<Task> tasks = taskDao.findAllByParentTaskId(taaskId); List<Task> tasks = taskDao.findAllByParentTaskId(taaskId);
......
...@@ -112,7 +112,6 @@ public class TrainTask { ...@@ -112,7 +112,6 @@ public class TrainTask {
if (trainTheme.getTrainType()==1) { if (trainTheme.getTrainType()==1) {
}else { }else {
List<Integer> userIds= trainUserDao.findAllByIsSignUpAndTrainId(1,trainId).stream().map(TrainUser::getUserId).collect(Collectors.toList()); List<Integer> userIds= trainUserDao.findAllByIsSignUpAndTrainId(1,trainId).stream().map(TrainUser::getUserId).collect(Collectors.toList());
userIds.forEach( userIds.forEach(
userId-> onlineLearningTask(trainId,taskBto.getId(),trainTheme.getName(),userId,taskBto.getOwnUnit()) userId-> onlineLearningTask(trainId,taskBto.getId(),trainTheme.getName(),userId,taskBto.getOwnUnit())
......
...@@ -59,6 +59,11 @@ public class UnitsController { ...@@ -59,6 +59,11 @@ public class UnitsController {
return ResponseEntity.ok(unitsService.findLeftNavigation(securityUser)); return ResponseEntity.ok(unitsService.findLeftNavigation(securityUser));
} }
@GetMapping(value = "/areaDevice")
@ApiOperation(value = "查询装备库区域单位列表", notes = "查询装备库区域单位列表")
public ResponseEntity selectOrganizationUnits1(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
return ResponseEntity.ok(unitsService.findLeftNavigation1(securityUser));
}
@GetMapping(value = "/findAll/GreaterThanEqual/{level}") @GetMapping(value = "/findAll/GreaterThanEqual/{level}")
......
...@@ -237,4 +237,10 @@ public class UserController { ...@@ -237,4 +237,10 @@ public class UserController {
return ResponseEntity.ok("ok"); return ResponseEntity.ok("ok");
} }
@GetMapping("/switch/{unitId}")
@ApiOperation(value = "切换用户")
public ResponseEntity switchUser( @PathVariable Integer unitId){
userService.deleteById(unitId);
return ResponseEntity.ok("ok");
}
} }
...@@ -135,6 +135,11 @@ public interface UnitsService extends PublicService<Units> { ...@@ -135,6 +135,11 @@ public interface UnitsService extends PublicService<Units> {
*/ */
LeftNavigation findLeftNavigation(SecurityUser securityUser); LeftNavigation findLeftNavigation(SecurityUser securityUser);
/**
* 装备库左边侧面导航栏接口
*/
LeftNavigation findLeftNavigation1(SecurityUser securityUser);
/** /**
* 左边侧面导航栏接口 不包括直属单位 * 左边侧面导航栏接口 不包括直属单位
*/ */
......
package com.tykj.dev.device.user.subject.service.impl; package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.service.SystemConfigService;
import com.tykj.dev.device.user.base.req.UnitNameVo; import com.tykj.dev.device.user.base.req.UnitNameVo;
import com.tykj.dev.device.user.base.ret.*; import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.cache.UnitsCache; import com.tykj.dev.device.user.cache.UnitsCache;
...@@ -39,6 +41,9 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -39,6 +41,9 @@ public class UnitsServiceImpl implements UnitsService {
AreaDao areaDao; AreaDao areaDao;
@Autowired @Autowired
UnitsCache unitsCache; UnitsCache unitsCache;
@Autowired
SystemConfigService systemConfigService;
@Override @Override
public Units findById(Integer unitId) { public Units findById(Integer unitId) {
Optional<Units> unit = unitsDao.findById(unitId); Optional<Units> unit = unitsDao.findById(unitId);
...@@ -284,6 +289,47 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -284,6 +289,47 @@ public class UnitsServiceImpl implements UnitsService {
return leftNavigation; return leftNavigation;
} }
@Override
public LeftNavigation findLeftNavigation1(SecurityUser securityUser) {
LeftNavigation leftNavigation=new LeftNavigation();
List<LeftNavigation> leftNavigationList=new ArrayList<>();
Integer areaId=securityUser.getCurrentUserInfo().getUnits().getAreaId();
Area belongsArea= areaDao.findById(areaId).get();
if (belongsArea.getType()==1){
leftNavigation = belongsArea.toLeftNavigation();
LeftNavigation units=securityUser.getCurrentUserInfo().getUnits().toLeftNavigation();
List<LeftNavigation> leftNavigationList1=new ArrayList<>();
systemConfigService.getStorageLocationMap().forEach(
(k,v)->{
leftNavigationList1.add(new LeftNavigation(0,v,null,v,3,k,units.getId()));
}
);
units.setLeftNavigations( leftNavigationList1.stream().sorted(Comparator.comparing(LeftNavigation::getOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()));
leftNavigationList.add(units);
//把省直属组合一下 直属单位(type=2) 处室单位(type=4)
// leftNavigationList.addAll(unitsDao.findAllByType(4).stream().map(Units::toLeftNavigation).collect(Collectors.toList()));
List<LeftNavigation> leftNavigationList2=unitsDao.findAllByType(2).stream().filter(units1 -> !units1.getName().equals("省应急小组")&& !units1.getName().equals("省机科技管理处")&& !units1.getName().equals("省机通信报务处")).map(Units::toLeftNavigation).collect(Collectors.toList());
LeftNavigation leftNavigation2=new LeftNavigation(0,"省直属",leftNavigationList2, UUID.randomUUID().toString(),1,22,null);
leftNavigationList.add(leftNavigation2);
}
if ( belongsArea.getType()==2){
leftNavigation = belongsArea.toLeftNavigation();
leftNavigationList = unitsDao.findAllByAreaId(belongsArea.getId()).stream().map(Units::toLeftNavigation).collect(Collectors.toList());
}
List<Area> areas= areaDao.findAllByFatherId(areaId).stream().filter(area -> area.getType() <= 3).collect(Collectors.toList());
if (areas.size()!=0) {
provinceAndCity(belongsArea,areas,leftNavigationList);
}else {
leftNavigation= belongsArea.toLeftNavigation();
leftNavigationList= unitsDao.findAllByAreaId(belongsArea.getId()).stream().map(Units::toLeftNavigation).collect(Collectors.toList());
}
leftNavigation.setLeftNavigations(leftNavigationList.stream().sorted(Comparator.comparing(LeftNavigation::getOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()));
return leftNavigation;
}
@Override @Override
public LeftNavigation findLeftNavigationNotDirectlyUnit(SecurityUser securityUser) { public LeftNavigation findLeftNavigationNotDirectlyUnit(SecurityUser securityUser) {
LeftNavigation leftNavigation=new LeftNavigation(); LeftNavigation leftNavigation=new LeftNavigation();
......
{
"devDependencies": {
"commitizen": "^4.0.3",
"cz-conventional-changelog": "^3.0.2"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"version": "1.0.2",
"scripts": {
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
}
}
\ No newline at end of file
## 要点
- 项目的结构分好,删掉没用的文件,以及版本管理做好,分支,dev,release,hotfix
- dev , 开发分支
- release , 4个模块,v0.1`[4个模块的可以使用的版本]`
GIT FLOW
- readme 写好 ,自己模块的伪代码业务逻辑,状态 变化
- 业务术语以及相关对象的名称统一
- com.tykj.dev.device ,名称很重要
- `domain(entity) - repository(dao) - service - controller` 业务
- utils , config , common(bean,exception,filter ... ) , misc(其它)
- do , vo
- 日志,注释,事务
## 结构重新整合
- 分为 config 配置模块 放置所有的配置相关的代码
- device 包括所有的业务模块 以及人员模块 task等
- misc 放置所有的工具类代码
- rfid 标签模块
- socket 放置socket模块代码
- union 启动类
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论