提交 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;
* @author huangxiahao
*/
@SpringBootApplication(scanBasePackages = {
"com.tykj.dev.config",
"com.tykj.dev.misc"
"com.tykj.dev.*"
}
)
public class ConfigApplication {
......
......@@ -29,7 +29,12 @@ public enum FileName {
/**
* 配发单
*/
ALLOT(6,"配发单");
ALLOT(6,"配发单"),
/**
* 丢失单
*/
LOSS(7,"丢失单");
public Integer id;
......
......@@ -30,6 +30,9 @@ public class ConfigCache {
private Map<Integer, String> positionMap;
private Map<Integer, String> storageLocationMap;
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));
......@@ -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.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.storageLocationMap = systemConfigs.stream().filter(systemConfig -> "storageLocation".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
}
public Map<Integer, String> getMatchingRangeMap() {
......@@ -83,6 +88,11 @@ public class ConfigCache {
return allotTypeMap;
}
public Map<Integer, String> getStorageLocationMap() {
return storageLocationMap;
}
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));
......@@ -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.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.storageLocationMap = systemConfigs.stream().filter(systemConfig -> "storageLocation".equals(systemConfig.getEnglishName())).collect(Collectors.toMap(SystemConfig::getValue, SystemConfig::getLabel));
return this;
}
}
......@@ -3,6 +3,7 @@ package com.tykj.dev.config.controller;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.repository.SystemConfigDao;
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.vo.ConfigUpdateVo;
import com.tykj.dev.config.vo.ConfigVo;
......@@ -36,6 +37,9 @@ public class ConfigController {
@Autowired
private SystemConfigDao systemConfigDao;
@Autowired
TerminalInformationService terminalInformationService;
@ApiOperation(value = "添加系统配置变量值", notes = "添加系统配置变量值")
@PostMapping(value = "/add")
@Transactional(rollbackFor = Exception.class)
......@@ -65,10 +69,12 @@ public class ConfigController {
@Transactional(rollbackFor = Exception.class)
public ResponseEntity select() {
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);
}
@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;
import com.tykj.dev.config.domin.SystemConfig;
import java.util.Map;
/**
* @author dengdiyi
*/
......@@ -16,4 +18,6 @@ public interface SystemConfigService {
Integer getMaxValue(String englishName);
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;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@Service
public class SystemConfigServiceImpl implements SystemConfigService {
......@@ -53,4 +54,10 @@ public class SystemConfigServiceImpl implements SystemConfigService {
public SystemConfig getOne(Integer id) {
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);
}
}
......@@ -18,7 +18,6 @@ import com.tykj.dev.device.confirmcheck.utils.ObjTransUtil;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.selfcheck.controller.SelfCheckController;
import com.tykj.dev.device.task.repository.TaskDao;
......@@ -45,7 +44,6 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
......@@ -59,6 +57,7 @@ import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.function.Predicate;
import static com.tykj.dev.misc.base.BusinessEnum.CONFIRM_CHECK_DETAIL;
import static com.tykj.dev.misc.base.BusinessEnum.CONFIRM_CHECK_STAT;
......@@ -72,7 +71,7 @@ import static java.util.stream.Collectors.*;
@RestController
@RequestMapping(value = "/check/confirm")
@AutoDocument
//@Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class)
@Slf4j
@Api(tags = "核查模块", description = "核查模块", position = 1)
public class DeviceCheckController {
......@@ -94,8 +93,6 @@ public class DeviceCheckController {
@Autowired
private DeviceCheckDetailDao detailRepo;
@Autowired
private DeviceLibraryCacheService dcService;
@Autowired
private ObjTransUtil transUtil;
@Autowired
private TaskDao taskRepo;
......@@ -111,8 +108,6 @@ public class DeviceCheckController {
private ConfirmCheckService ccService;
@Autowired
private MyWebSocket myWebSocket;
@Autowired
private SelfCheckController selfCheckController;
@GetMapping("/area/{fatherId}")
@ApiOperation(value = "查询指定区域下的所有区域信息")
......@@ -140,6 +135,7 @@ public class DeviceCheckController {
return statVoList;
}
@ApiOperation(value = "根据关键字分页查询核查统计数据")
@PostMapping("/stat")
public Page<CheckStatTableVo> findStatByKeyword(
......@@ -195,6 +191,7 @@ public class DeviceCheckController {
return ResponseEntity.ok(new ResultObj<>(cdVo));
}
/**
* 该接口负责处理以下跳转情况
* 1 - 统计跳转
......@@ -269,13 +266,11 @@ public class DeviceCheckController {
.collect(toList());
totalList.addAll(casList);
}
//
String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName();
// CheckAreaStatVo cas = combineCaList(totalList, areaName);
//
// LinkCheckDetail lcd = rev2lcd(child, endTime, updateTime, cas.reverse());
LinkCheckDetail lcd = cas2lcd(totalList, child, areaName);
CheckAreaStatVo cas = combineCaList(totalList, areaName);
LinkCheckDetail lcd = rev2lcd(child, endTime, updateTime,cas.reverse());
lcd.setCheckUnit(unitName);
if (child.getTitle().contains("统计确认待办任务")) {
lcd.setCheckSituation("统计确认待办任务");
......@@ -305,13 +300,16 @@ public class DeviceCheckController {
if (casList.isEmpty()) {
cas = new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0);
} else {
// cas = combineCaList(casList, unitName);
cas = casList.get(0);
cas = combineCaList(casList, unitName);
}
// LinkExamDetail led = rev2led(child, endTime, updateTime, cas.reverse());
LinkExamDetail led = cas2led(cas, child, endTime, updateTime);
// CheckAreaStatVo cas = parseStatString2Vo(child.parse2Bto(), childDetail).stream()
// .map(CheckDeviceStatVo::getAreaStatList)
// .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
// .reduce(CheckAreaStatVo::combine)
// .orElse(new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0));
LinkExamDetail led = rev2led(child, endTime, updateTime,cas.reverse());
led.setCheckUnit(unitName);
ledList.add(led);
......@@ -358,7 +356,34 @@ public class DeviceCheckController {
int i = 0;
for (Task child : childTask) {
LinkExamDetail led = getLed(endTime, updateTime, child);
Integer childBusType = child.getBusinessType();
Integer childBusId = child.getBillId();
DeviceCheckDetail childDetail = detailRepo.findById(childBusId).get();
String unitName = childDetail.getCheckUnit();
List<CheckAreaStatVo> casList = parseStatString2Vo(child.parse2Bto(), childDetail).stream()
.map(CheckDeviceStatVo::getAreaStatList)
.flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
.collect(toList());
//自查的areaName要从detail里找
String areaName = childDetail.getCheckUnit();
CheckAreaStatVo cas;
if (casList.isEmpty()) {
cas = new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0);
} else {
cas = combineCaList(casList, areaName);
}
//
// CheckAreaStatVo cas = parseStatString2Vo(child.parse2Bto(), childDetail).stream()
// .map(CheckDeviceStatVo::getAreaStatList)
// .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
// .reduce(CheckAreaStatVo::combine)
// .get();
LinkExamDetail led = rev2led(child, endTime, updateTime,cas.reverse());
led.setCheckUnit(unitName);
//设置名称
led.setExamName(groupNames.get(i));
......@@ -384,37 +409,8 @@ public class DeviceCheckController {
}
@NotNull
private LinkExamDetail getLed(LocalDateTime endTime, LocalDateTime updateTime, Task child) {
Integer childBusType = child.getBusinessType();
Integer childBusId = child.getBillId();
DeviceCheckDetail childDetail = detailRepo.findById(childBusId).get();
String unitName = childDetail.getCheckUnit();
List<CheckAreaStatVo> casList = parseStatString2Vo(child.parse2Bto(), childDetail).stream()
.map(CheckDeviceStatVo::getAreaStatList)
.flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
.collect(toList());
//自查的areaName要从detail里找
String areaName = childDetail.getCheckUnit();
CheckAreaStatVo cas;
if (casList.isEmpty()) {
cas = new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0);
} else {
cas = casList.get(0);
}
LinkExamDetail led = cas2led(cas, child, endTime, updateTime);
led.setCheckUnit(unitName);
return led;
}
//进行了更新 使用修改时间去做是否逾期判断
private LinkCheckDetail rev2lcd(Task task, LocalDateTime endTime, LocalDateTime updateTime, RevAreaStat revAreaStat) {
private LinkCheckDetail rev2lcd(Task task, LocalDateTime endTime, LocalDateTime updateTime,RevAreaStat revAreaStat) {
LinkCheckDetail lcd = new LinkCheckDetail();
lcd.setId(task.getBillId());
......@@ -481,100 +477,8 @@ public class DeviceCheckController {
return lcd;
}
/**
* lcd 里的列表都为检查,因此是集合对
*
* @return
*/
private LinkCheckDetail cas2lcd(List<CheckAreaStatVo> casList, Task task, String finalCityName) {
LinkCheckDetail lcd = new LinkCheckDetail();
lcd.setId(task.getBillId());
//全部为0->0,全部为2->2,否则1
boolean waitStart = casList.stream()
.allMatch(cas -> cas.getComProgress() == 0);
boolean isFinished = casList.stream()
.allMatch(cas -> cas.getComProgress() == 2) || task.getBillStatus().equals(END);
if (waitStart) {
lcd.setCheckSituation("等待核查");
} else if (isFinished) {
lcd.setCheckSituation("已完成");
} else {
lcd.setCheckSituation("核查中");
}
boolean waitAudit = casList.stream()
.allMatch(cas -> cas.getComSituation() == 10);
// 需要每一个城市都有无误(即12) 才算无误
long cityCount = casList.stream().count();
long okCount = casList.stream()
.filter(cas -> cas.getComSituation() == 12)
.count();
boolean allOk = okCount >= cityCount;
if (isFinished) {
if (waitAudit) {
lcd.setCheckResult("待审核");
} else if (allOk) {
lcd.setCheckResult("无误");
} else {
lcd.setCheckResult("审核中");
}
}
lcd.setCheckUnit(finalCityName + "局");
return lcd;
}
/**
* led 里的列表都为自查,因此都是单个对象
*
* @return
*/
private LinkExamDetail cas2led(CheckAreaStatVo cas, Task task, LocalDateTime endTime, LocalDateTime updateTime) {
LinkExamDetail led = new LinkExamDetail();
led.setId(task.getBillId());
int comProgress = cas.getComProgress();
int comSituation = cas.getComSituation();
if (comProgress == 0) {
led.setCheckSituation("准备核查");
} else if (comProgress == 1) {
led.setCheckSituation("核查中");
} else if (comProgress == 2) {
if (endTime.isBefore(updateTime)) {
led.setCheckSituation("逾期完成");
} else {
led.setCheckSituation("完成");
}
}
if (comProgress == 0 || comProgress == 1) {
led.setCheckResult("无");
} else {
if (comSituation == 10) {
led.setCheckResult("待审核");
} else if (comSituation == 12) {
led.setCheckResult("无误");
} else if (comSituation == 13) {
led.setCheckResult("未通过");
} else {
led.setCheckResult("缺省");
}
}
led.setCheckUnit(cas.getAreaName() + "局");
return led;
}
//修改
private LinkExamDetail rev2led(Task task, LocalDateTime endTime, LocalDateTime updateTime, RevAreaStat revAreaStat) {
private LinkExamDetail rev2led(Task task, LocalDateTime endTime, LocalDateTime updateTime,RevAreaStat revAreaStat) {
LinkExamDetail led = new LinkExamDetail();
led.setId(task.getBillId());
......@@ -683,7 +587,7 @@ public class DeviceCheckController {
Integer provId = taskService.get(examJobId).getParentTaskId();
// 检查的job id 找到 father 进而找到 father的billid 进而找到title Id
Integer statId = taskService.get(provId).getBillId();
DeviceCheckStat deviceCheckStat = statRepo.findById(statId).get();
DeviceCheckStat deviceCheckStat = statRepo.getOne(statId);
String title = deviceCheckStat.getTitle();
String remark = deviceCheckStat.getRemark();
return ResponseEntity.ok(new CheckTitleAndTimeVo(title, deviceCheckStat.getEndTime(), remark));
......@@ -713,8 +617,8 @@ public class DeviceCheckController {
@ApiOperation(value = "检查地区是否发起核查", notes = "检查地区是否发起核查")
@PostMapping("/checkPossible")
public ResponseEntity checkPossible(@RequestBody UnitIds unitIds) {
List<String> unitNames = unitIds.getIds().stream()
public ResponseEntity checkPossible(@RequestBody UnitIds uuid) {
List<String> unitNames = uuid.getIds().stream()
.map(id -> auService.findOne(AuExample.UnitId, id))
.map(AreaUnit::getUnitName)
.collect(toList());
......@@ -882,15 +786,12 @@ public class DeviceCheckController {
}
List<String> tmpString = new ArrayList<>();
// 拼接检查组和检查组成员
for (CheckExamDetailVo vo : examDetailVos) {
for (Integer u : vo.getUnitIds()) {
tmpString.add(vo.getGroupName() + "," + vo.getUserNames().stream().collect(joining(",")));
}
tmpString.add(vo.getGroupName() + "," + vo.getUserNames().stream().collect(joining(",")));
}
String groupUserString = tmpString.stream().collect(joining("|"));
List<Integer> unitIds = examDetailVos.stream().flatMap(cv -> cv.getUnitIds().stream()).collect(toList());
List<Integer> unitIds = examDetailVos.stream().map(CheckExamDetailVo::getUnitId).collect(toList());
List<Units> checkedUnits = unitsRepo.findAllById(unitIds);
List<String> checkedUnitNames = checkedUnits.stream().map(Units::getName).collect(toList());
......@@ -959,37 +860,30 @@ public class DeviceCheckController {
// 3. 构建被核查单位的详情账单与Task
// 对每个需要核查的单位构建其detail账单与task
for (CheckExamDetailVo ed : examDetailVos) {
List<Integer> uid = ed.getUnitIds();
for (Integer u : uid) {
Units unit = unitsRepo.findById(u).get();
String names = ed.getUserNames().stream().collect(joining(","));
// 3-1 构建被查单位的 自查账单
DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(names + "|" + ed.getRemark(), ceVo.getTitle() + "%^&" + ed.getRemark(), 0, 0, 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>()));
DeviceCheckDetail detail = detailRepo.save(unitDetailDoc);
detailIds.add(detail.getId());
// 将id放入统计中去 model -> areaName -> detailId
String areaName = auService.findOne(AuExample.UnitId, unit.getUnitId()).getName();
for (CheckDeviceStatVo statVo : deviceStatVos) {
for (CheckAreaStatVo asv : statVo.getAreaStatList()) {
if (asv.getAreaName().equals(areaName)) {
asv.setAreaStatId(statId);
asv.setAreaDetailId(detail.getId());
}
Units unit = unitsRepo.findById(ed.getUnitId()).get();
String names = ed.getUserNames().stream().collect(joining(","));
// 3-1 构建被查单位的 自查账单
DeviceCheckDetail unitDetailDoc = DeviceCheckDetail.EmptyWithChecker(names + "|" + ed.getRemark(), ceVo.getTitle() + "%^&" + ed.getRemark(), 0, 0, 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>()));
DeviceCheckDetail detail = detailRepo.save(unitDetailDoc);
detailIds.add(detail.getId());
// 将id放入统计中去 model -> areaName -> detailId
String areaName = auService.findOne(AuExample.UnitId, unit.getUnitId()).getName();
for (CheckDeviceStatVo statVo : deviceStatVos) {
for (CheckAreaStatVo asv : statVo.getAreaStatList()) {
if (asv.getAreaName().equals(areaName)) {
asv.setAreaStatId(statId);
asv.setAreaDetailId(detail.getId());
}
}
// 3-2 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态)
TaskBto checkedTask = new TaskBto(CHECK_EXAM_DETAIL_0.id, "自核查任务", cityStatTask.getId(), addNode(cityStatTask.getNodeIdDetail(), cityStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), unit.getUnitId(), 0);
checkedTask.setRemark(String.valueOf(CHECK_EXAM_DETAIL_0.id));
checkedTask.setCustomInfo("manual");
checkedTask = taskService.start(checkedTask);
desBillMap.put(detail.getId(), ed.getRemark());
desMap.put(checkedTask.getId(), ed.getRemark());
}
// 3-2 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态)
TaskBto checkedTask = new TaskBto(CHECK_EXAM_DETAIL_0.id, "自核查任务", cityStatTask.getId(), addNode(cityStatTask.getNodeIdDetail(), cityStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), unit.getUnitId(), 0);
checkedTask.setRemark(String.valueOf(CHECK_EXAM_DETAIL_0.id));
checkedTask.setCustomInfo("manual");
checkedTask = taskService.start(checkedTask);
desBillMap.put(detail.getId(), ed.getRemark());
desMap.put(checkedTask.getId(), ed.getRemark());
}
// 4. 重新设置并保存统计账单
......@@ -1023,6 +917,7 @@ public class DeviceCheckController {
}
/**
* 根据taskId查询Remark
*/
......@@ -1033,6 +928,7 @@ public class DeviceCheckController {
return ResponseEntity.ok(desBillMap.get(billId));
}
private TaskBto selectProvTask(Integer taskId) {
TaskBto taskBto = taskService.get(taskId);
if (taskBto.getParentTaskId() == 0) {
......@@ -1041,6 +937,7 @@ public class DeviceCheckController {
return selectProvTask(taskBto.getParentTaskId());
}
/**
* 对于专员A来说的逻辑
* 1. 修改detailString
......@@ -1203,126 +1100,84 @@ public class DeviceCheckController {
return ResponseEntity.ok(new ResultObj<>("专管B操作成功"));
}
@ApiOperation(value = "自查的回退接口")
@PutMapping("/audit/rollback/{id}")
public ResponseEntity rollBack(@PathVariable Integer id) {
//1. bill单的自查将百位数变为3
DeviceCheckDetail detail = detailRepo.findById(id).get();
String detailString = detail.getCheckDetail();
String initalDetail = Arrays.stream(detailString.split(","))
.map(s -> s.split("-")[0] + "-" + 119)
.collect(joining(","));
String updateDetail = changeHunds(detailString,3);
detailRepo.updateCheckDetail(id, updateDetail, "", 0, 0, 0);
/**
* 用于核查的回退接口
*
* @param id 办结的done接口id
* @return
*/
@ApiOperation(value = "核查回退")
@PutMapping("/check/rollback/{id}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity checkRollback(@PathVariable Integer id) {
log.info("[核查模块] 将id = {} 的检查任务进行回退", id);
Specification<Task> donePred = Specifications.<Task>and()
.eq("billStatus", CONFIRM_STAT_0.id)
.eq("billId", id)
.eq("businessType", CONFIRM_CHECK_STAT.id)
.build();
TaskBto doneTask = taskRepo.findOne(donePred).get().parse2Bto();
//2. 当前任务结束,开启一个新的 退回任务(连带一个新的detail)
TaskBto currentTask = taskService.get(id, CONFIRM_CHECK_DETAIL.id);
TaskBto newTask = currentTask.toDo().copy().parse2Bto();
currentTask.setCustomInfo(currentTask.getCustomInfo());
taskService.moveToEnd(currentTask);
// 创建新的detail 新的detail会在B的时候加入,所以老的stat要去除掉
DeviceCheckDetail cDetail = detail.copyWithoutId();
cDetail.setId(null);
cDetail.setCheckDetail(initalDetail);
cDetail = detailRepo.save(cDetail);
// 创建新的任务
newTask.setBillStatus(CHECK_EXAM_DETAIL_0.id);
newTask.setBillId(cDetail.getId());
newTask.setId(0);
newTask.setCustomInfo(newTask.getCustomInfo());
newTask.getInvolveUserIdList().add(0);
newTask.setCurrentPoint(newTask.getInvolveUserIdList().size()-1);
taskService.start(newTask);
//3. 在stat的remark中追加信息 - 找到currentTask在其中的顺位
TaskBto fatherTask = taskService.get(currentTask.getParentTaskId());
List<Task> childTask = taskRepo.findAllByParentTaskId(fatherTask.getId());
int pos = 0;
for (int i = 0; i < childTask.size(); i++) {
if (childTask.get(i).getId().equals(currentTask.getId())) {
log.info("[核查模块] 记录remark的pos位置 = {}", i);
}
}
Specification<Task> checkPred = Specifications.<Task>and()
.eq("customInfo", "exam")
.eq("billId", id)
.eq("businessType", CONFIRM_CHECK_STAT.id)
.build();
Task checkTask = taskRepo.findOne(checkPred).get();
DeviceCheckStat dcs = statRepo.findById(fatherTask.getBillId()).get();
String[] groups = dcs.getRemark().split("\\|");
String pading = groups[pos];
dcs.setRemark(dcs.getRemark() + "|" + pading);
log.info("[核查模块] 补充remark = {}", pading);
//1.将市检查的任务节点回退到等待办结的状态
taskService.moveToSpecial(checkTask.parse2Bto(), CHECK_EXAM_STAT_1);
// 老的stat要去除掉对应areaName的数据
String areaName = auService.findOne(AuExample.UnitName, detail.getCheckUnit()).getName();
CheckStatVo csv = transUtil.checkStatDo2Vo(dcs);
for (CheckDeviceStatVo vo : csv.getDeviceStatVoList()) {
List<CheckAreaStatVo> filterList = vo.getAreaStatList().stream()
.filter(casv -> !casv.getAreaName().equals(areaName)).collect(toList());
if (filterList.size() != vo.getAreaStatList().size()){
log.info("[核查模块] 回退操作-将退回的数据从统计中去除了.");
vo.setAreaStatList(filterList);
}
//2.删除掉省的办结任务
if (Objects.isNull(doneTask)) {
log.info("[核查模块] 没有找到对应的办结任务");
} else {
log.info("[核查模块] 删除id = {}的办结任务", doneTask.getId());
taskRepo.deleteById(doneTask.getId());
}
statRepo.save(csv.toDo());
//4.父级任务变为进行中
fatherTask.setBillStatus(CHECK_EXAM_STAT_1.id);
taskRepo.save(fatherTask.toDo());
return ResponseEntity.ok(new ResultObj<>("回退操作成功!"));
return ResponseEntity.ok(new ResultObj<>("核查回退操作成功!"));
}
@PutMapping("/audit/verify/{id}")
@ApiOperation(value = "自查的通过接口")
public ResponseEntity verify(@PathVariable Integer id){
//将自查的情况的百位数全部替换成2
DeviceCheckDetail detail = detailRepo.findById(id).get();
String updatedString = changeHunds(detail.getCheckDetail(), 2);
detail.setCheckDetail(updatedString);
log.info("[核查模块] 审核通过 - 更新后的detailString形如 {}",updatedString.split(",")[0]);
detailRepo.save(detail);
//将对应stat中地区的comProgress 改为 2 comsitution 改为12
String areaName = auService.findOne(AuExample.UnitName, detail.getCheckUnit()).getName();
TaskBto currentTask = taskService.get(id, CONFIRM_CHECK_DETAIL.id);
TaskBto fatherTask = taskService.get(currentTask.getParentTaskId());
DeviceCheckStat dcs = statRepo.findById(fatherTask.getBillId()).get();
CheckStatVo csv = transUtil.checkStatDo2Vo(dcs);
for (CheckDeviceStatVo vo : csv.getDeviceStatVoList()) {
for (CheckAreaStatVo av : vo.getAreaStatList()) {
if (av.getAreaName().equals(areaName)){
log.info("[核查模块] 审核通过 - 地区 = {} 的统计数据在统计信息中被成功修改了",areaName);
av.auditPassed();
}
}
}
return ResponseEntity.ok(new ResultObj<>("审核通过!"));
}
/**
* 将detailString里的百位数改为指定数字
* @param detailString 要更改的自查详情字符串
* @param value 想要改成的数字
* 用于检查页面的回退接口
*
* @param id 自查的detail id
* @return
*/
private String changeHunds(String detailString,Integer value) {
String updateDetail = Arrays.stream(detailString.split(","))
.map(s -> {
Integer number = Integer.valueOf(s.split("-")[1]);
int digit = number % 10;
int tens = number / 10 % 10;
number = value * 100 + tens * 10 + digit;
return s.split("-")[0] + "-" + number;
})
@ApiOperation(value = " ")
@PutMapping("/exam/rollback/{id}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity examRollback(@PathVariable Integer id) {
log.info("[核查模块] 进行检查回退操作,要回退的检查detail id为 {}", id);
//1. 回退device-detail数据 包括 detail String,checkResult,userAId,userBid,checkedCount
// 将原来的checkDetail 的检查状态统一更改为 8 - 已退回
String detail = detailRepo.getOne(id).getCheckDetail();
String updateDetail = Arrays.stream(detail.split(","))
.map(s -> s.split("-")[0] + "-" + "8")
.collect(joining(","));
return updateDetail;
}
detailRepo.updateCheckDetail(id, updateDetail, "", 0, 0, 0);
//2. 回退任务Task
TaskBto currentTask = taskService.get(id, CONFIRM_CHECK_DETAIL.id);
StatusEnum firstStatus = GlobalMap.getStatusEnumMap().get(Integer.valueOf(currentTask.getRemark()));
taskService.moveToSpecial(currentTask, firstStatus, currentTask.getFirstUserId());
//3.如果父级任务状态已经到确认阶段,则同样回退一个阶段
TaskBto fatherTask = taskService.get(currentTask.getParentTaskId());
// log.info("[核查模块] 父级统计节点的task id = {} , bill id = {}", fatherTask.getId(), fatherTask.getBillId());
// if (fatherTask.getBillStatus().equals(CHECK_EXAM_STAT_1.id)) {
// log.info("[核查模块] 检测到父级节点已经进入确认阶段,回滚父级节点");
// taskService.moveToSpecial(fatherTask, CHECK_EXAM_STAT_0, fatherTask.getFirstUserId());
// }
//3. 回退合并上去的数据
String unitName = detailRepo.findById(id).get().getCheckUnit();
AreaUnit areaUnit = auService.findOne(AuExample.UnitName, unitName);
String cityName = areaUnit.getName();
resetStatByCity(fatherTask.getBillId(), cityName);
return ResponseEntity.ok(new ResultObj<>("检查回退操作成功!"));
}
/**
* 将统计数据中指定城市的统计数据重置
......@@ -1449,7 +1304,8 @@ public class DeviceCheckController {
log.info("[核查模块] 办结统计待办操作成功");
return ResponseEntity.ok(new ResultObj<>("办结统计待办确认完毕"));
}
@Autowired
private SelfCheckController selfCheckController;
/**
* @param statId 统计账单主键id
*/
......@@ -1585,10 +1441,8 @@ public class DeviceCheckController {
.collect(toList());
long start = System.currentTimeMillis();
List<DeviceLibrary> allDevice = dcService.getAllDeviceLibraryList();
Map<Integer, DeviceLibrary> deviceMap = allDevice.stream()
.filter(d -> idList.contains(d.getId()))
Map<Integer, DeviceLibrary> deviceMap = deviceRepo.findAllByIdIn(idList)
.stream()
.collect(toMap(DeviceLibrary::getId, Function.identity()));
long end = System.currentTimeMillis();
log.info("[核查TEST] 批量查询id集合耗时 {} ms ", end - start);
......@@ -1604,34 +1458,23 @@ public class DeviceCheckController {
DeviceLibrary checkDevice = deviceMap.get(deviceId);
CheckAreaStatVo checkAreaStatVo;
// 百位数 0/1 待审核 2 无误 3未通过
// 十位数 1 人工 2 自动
// 0缺失1无误2新增3不在库 8已退回 9未检查
int digits = proofResult % 10;
int tens = proofResult / 10 % 10;
int huns = proofResult / 100 % 10;
// 个位数判断自查结果
if (digits == 9) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 0, 10, statId, detailId);
if (digits == 8) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 3, -1, statId, detailId);
} else if (digits == 9) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 0, 0, statId, detailId);
} else if (digits == 3) {
//跳过非在库的统计
continue;
} else if (digits == 1) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 10, statId, detailId);
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 0, statId, detailId);
} else if (digits == 0) {
checkAreaStatVo = new CheckAreaStatVo(areaName, 0, 1, 2, 10, statId, detailId);
checkAreaStatVo = new CheckAreaStatVo(areaName, 0, 1, 2, 1, statId, detailId);
} else {
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 10, statId, detailId);
}
// 百位数判断审核情况 0,1未检查 2是无误 3是未通过
if (huns == 0 || huns == 1) {
checkAreaStatVo.setComSituation(10);
} else if (huns == 2) {
checkAreaStatVo.setComSituation(12);
} else if (huns == 3) {
checkAreaStatVo.setComSituation(13);
checkAreaStatVo = new CheckAreaStatVo(areaName, 1, 1, 2, 1, statId, detailId);
}
List<CheckAreaStatVo> areaStatVoList = new ArrayList<>();
......@@ -1814,7 +1657,7 @@ public class DeviceCheckController {
return new CheckAreaStatVo(finalCityName, actualCount, supposeCount, finalProgress, finalSituation, 0, 0);
}
private void findBySystem() {
private void findBySystem(){
selfCheckController.findBySystem1();
}
......
......@@ -6,7 +6,6 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collections;
import java.util.List;
/**
......@@ -28,12 +27,12 @@ public class CheckExamDetailVo {
private List<String> userNames;
@ApiModelProperty(name = "需要被检查的区域id")
private List<Integer> unitIds;
private Integer unitId;
@ApiModelProperty(name = "备注")
private 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 {
private String lifeStatusName;
private String matchingRangeName;
private Integer isPart;
}
......@@ -48,4 +48,8 @@ public class DeviceNotInLibVo {
private String secretLevelName;
private String lifeStatusName;
private String matchingRangeName;
private Integer isPart;
}
......@@ -401,7 +401,9 @@ public class ObjTransUtil {
device.getInvisibleRangeName(),
device.getTypeName(),
device.getSecretLevelName(),
device.getLifeStatusName()
device.getLifeStatusName(),
device.getMatchingRangeName(),
device.getIsPart()
);
}
......@@ -423,7 +425,9 @@ public class ObjTransUtil {
device.getInvisibleRangeName(),
device.getTypeName(),
device.getSecretLevelName(),
device.getLifeStatusName()
device.getLifeStatusName(),
device.getMatchingRangeName(),
device.getIsPart()
);
}
}
......
......@@ -130,4 +130,10 @@ public class DecommissioningQueryController {
deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(list,3);
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 {
public ResponseEntity findApplyIdToDecommissioningTask(@RequestBody DestroySelectVo 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 @@
<artifactId>easypoi-annotation</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<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>
</dependencies>
</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 {
deviceLibraryEntity.setType(libraryUpdateVo.getType());
}
//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);
deviceLogService.addLog(deviceLogDto);
deviceLibraryEntity.setStorageLocation(libraryUpdateVo.getStorageLocation());
}
//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);
deviceLogService.addLog(deviceLogDto);
deviceLibraryEntity.setRecord(libraryUpdateVo.getRecord());
}
deviceLibraryService.update(deviceLibraryEntity);
}
//添加绑定配件
......@@ -815,15 +814,27 @@ public class DeviceLibraryController {
List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceSelectIdsVo.getIds());
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<>();
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));
return deviceNewVoList;
}
......@@ -833,7 +844,6 @@ public class DeviceLibraryController {
*/
@GetMapping("/setNumber")
public List<DeviceLibrary> setNumber(){
List<DeviceLibrary> allListAndParent = getAllListAndParent();
AtomicInteger sortNum = new AtomicInteger();
return setOrderNumber(sortNum, allListAndParent);
......
......@@ -42,4 +42,7 @@ public class DeviceNewVo {
@ApiModelProperty(value = "装备id")
private List<Integer> devicesId;
@ApiModelProperty("是否是配件")
private Integer isPart;
}
......@@ -11,10 +11,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
/**
......@@ -59,4 +56,10 @@ public class DeviceLossController {
lossBillService.superiorAuditRetrieve(retrieveAuditvo);
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 {
public ResponseEntity initiateLoss( @PathVariable Integer taskId){
return ResponseEntity.ok(lossBillSelectService.findDeviceLoss(taskId));
}
}
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.vo.LossAuditvo;
import com.tykj.dev.device.loss.entity.vo.RetrieveAuditvo;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import java.util.List;
import java.util.Map;
/**
* @author zjm
* @version 1.0.0
......@@ -34,4 +38,5 @@ public interface LossBillService {
*/
void superiorAuditRetrieve(RetrieveAuditvo retrieveAuditvo);
Map<String, List<FileRet>> findTaskIdToFileMap(Integer taskId);
}
package com.tykj.dev.device.loss.service.impl;
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.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
......@@ -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.RetrieveAuditvo;
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.util.StringUtils;
import com.tykj.dev.device.task.service.TaskService;
......@@ -32,7 +35,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
......@@ -76,6 +81,8 @@ public class LossBillServiceImpl implements LossBillService {
@Autowired
UserService userService;
@Autowired
LossBillSelectService lossBillSelectService;
@Override
public void initiateLoss(DeviceLoss deviceLoss, SecurityUser securityUser) {
deviceLibraryService.isInStockOrWaitRetired(deviceLoss.getDevIdsList());
......@@ -194,6 +201,14 @@ public class LossBillServiceImpl implements LossBillService {
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){
List<Integer> list=new ArrayList<>();
......
package com.tykj.dev.misc.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
......@@ -16,45 +20,80 @@ import java.util.stream.Collectors;
*/
@Component
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 需要排序的型号
* @return 排】序过后的型号列表
*/
public static List<String> modelToSort(List<String> modelList){
return modelList.stream().sorted(Comparator.comparing(DeviceModelSort::toModelSort)).collect(Collectors.toList());
public static List<String> modelToSort(List<String> modelList) {
//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 型号
* @return 排序号码
*/
public static Integer toModelSort(String model){
public static Integer toModelSort(String model) {
System.out.println(model);
return mapModelSort.get(model);
}
/**
* 单位排序排序方法
*
* @param unitList 需要排序的型号
* @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());
}
/**
* 获取单位对应的排序号
* @param unitName 单位名称
*
* @param unitName 单位名称
* @return 排序号码
*/
public static Integer toUnitSort(String unitName){
public static Integer toUnitSort(String unitName) {
return mapUnitSort.get(unitName);
}
......
......@@ -1640,15 +1640,38 @@ public class RepairController {
integerList.add(9);
integerList.add(4);
//过滤掉状态4,5,9
long l = System.currentTimeMillis();
List<RepairDetail> repairDetails1 = repairDetailDao.findAllByRepairStatusNotIn(integerList, repairTaskSelectVo.getPageable().getSort());
repairDetails1.forEach(repairDetail -> {
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))
.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<>();
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) {
TaskBto taskBto = taskService.getParentTaskIsNull(repairDetail.getDeviceRepairBillId(), 5);
TaskUserVo taskUserVo = taskBto.toVo();
......@@ -1657,6 +1680,8 @@ public class RepairController {
waitingRepairEquipment.setTaskUserVos(taskUserVo);
waitingRepairEquipments.add(waitingRepairEquipment);
}
System.out.println("taskBto--"+(System.currentTimeMillis()-l2));
//按照时间排序
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()));
......
......@@ -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.JpaSpecificationExecutor;
import java.util.List;
/**
* @author dengdiyi
*/
public interface RepairBillDao extends JpaRepository<RepairBill, Integer>, JpaSpecificationExecutor<RepairBill> {
/**
* 通过ids查询集合
*/
List<RepairBill> findAllByIdIn(List<Integer> ids);
}
......@@ -26,4 +26,9 @@ public interface RepairBillService {
RepairBill update(RepairBill deviceRepairBillEntity);
void delete(Integer id);
/**
* 通过id集合进行查询
*/
List<RepairBill> findByIds(List<Integer> ids);
}
......@@ -94,6 +94,12 @@ public class RepairBillServiceImpl implements RepairBillService {
deviceRepairBillDao.deleteById(id);
}
@Override
public List<RepairBill> findByIds(List<Integer> ids) {
return deviceRepairBillDao.findAllByIdIn(ids);
}
private Specification<RepairBill> getSelectSpecification(RepairBillSelectVo deviceRepairBillSelectVo) {
PredicateBuilder<RepairBill> predicateBuilder = Specifications.and();
PredicateBuilder<RepairBill> predicateBuilder1 = Specifications.or();
......
......@@ -46,4 +46,10 @@ public class ScrapQueryController {
public ResponseEntity findApplyIdToScrapTask(@PathVariable Integer 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 {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
// DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),taskBto.getId());
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,userId,taskBto.getId());
deviceLogDtos.add(deviceLogDto);
// deviceLogService.addLog(deviceLogDto);
}
}
long l = System.currentTimeMillis();
//进行日志的存储
executor.execute(
()->{
deviceLogService.addAllLog(deviceLogDtos);
}
);
log.info("日志存储时间:{}",System.currentTimeMillis()-l);
log.info("[自查模块]:发起自查");
myWebSocket.sendMessage1();
return ResultUtil.success(selfExaminationBillEntity1);
......@@ -438,6 +435,7 @@ public class SelfCheckController {
@Transactional(rollbackFor = Exception.class)
public ResponseEntity selfExaminationConfirm(@RequestBody @Validated SelfCheckConfirmVo selfCheckConfirmVo) {
TaskBto taskBto = taskService.get(selfCheckConfirmVo.getTaskId());
Integer userId = userUtils.getCurrentUserId();
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.SELF_CHECK_CONFIRM);
SelfCheckBill selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId());
if(selfCheckConfirmVo.getCheckFiles()!=null&&selfCheckConfirmVo.getCheckFiles().size()>0){
......@@ -466,7 +464,8 @@ public class SelfCheckController {
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"上传自查单",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);
}
}
......@@ -482,7 +481,7 @@ public class SelfCheckController {
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"自查审核失败",null,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"自查审核失败",null,userId,taskBto.getId());
deviceLogService.addLog(deviceLogDto);
}
}
......@@ -697,13 +696,12 @@ public class SelfCheckController {
public void findBySystem1() {
//通过billId和businessType 和 ownUnit
List<Task> allByBillAndBusinessTypeAndOwnUnit = taskService.findAllByBillAndBusinessTypeAndOwnUnit(4, userUtils.getCurrentUnitId());
if (allByBillAndBusinessTypeAndOwnUnit.size() == 0){
throw new ApiException("该时间段没有系统发起的自查");
}
for (Task task : allByBillAndBusinessTypeAndOwnUnit) {
taskService.moveToArchive(task.parse2Bto());
//删除
selfCheckBillService.delete(task.getBillId());
if (allByBillAndBusinessTypeAndOwnUnit.size()>0){
for (Task task : allByBillAndBusinessTypeAndOwnUnit) {
taskService.moveToArchive(task.parse2Bto());
//删除
selfCheckBillService.delete(task.getBillId());
}
}
}
......
......@@ -29,6 +29,7 @@ public class RepelDevController {
@Autowired
RepelBusinessService repelBusinessService;
@Autowired
AgainStorageBillService againStorageBillService;
......@@ -177,4 +178,11 @@ public class RepelDevController {
repelBusinessService.AllRepelNotDeviceSubmit(securityUser,taskId);
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;
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.StorageDeviceRepel;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
......@@ -144,4 +146,10 @@ public interface RepelBusinessService {
*/
void withdraw(Integer taskId);
/**
* 清退总任务 撤销
* 判断下面任务是否存在配发中的 有则不能撤回需要等配发结束后在撤回。
*/
List<TaskBto> repelWithdraw(Integer taskId);
}
......@@ -40,6 +40,7 @@ import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
......@@ -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私有方式
......
......@@ -299,7 +299,7 @@ public class StatisticalController {
List<ScrappedDestroyedRetiredVo> destroyedRetiredVoList = new ArrayList<>();
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){
for (String s : map.keySet()) {
String[] strings = s.split("Ǵ");
......@@ -308,6 +308,7 @@ public class StatisticalController {
scrappedDestroyedRetiredVo.setModel(strings[0]);
scrappedDestroyedRetiredVo.setName(strings[1]);
scrappedDestroyedRetiredVo.setMatchingRangeName(strings[2]);
scrappedDestroyedRetiredVo.setIsPart(Integer.valueOf(strings[3]));
scrappedDestroyedRetiredVo.setNum(map.get(s).size());
List<Integer> ids = new ArrayList<>();
List<DeviceLibrary> deviceLibraries = map.get(s);
......
......@@ -38,4 +38,8 @@ public class ScrappedDestroyedRetiredVo {
@ApiModelProperty(value = "装备id")
private List<Integer> devicesId;
@ApiModelProperty(value = "是否是配件")
private Integer isPart;
}
......@@ -791,5 +791,9 @@ public class StorageBillController {
/**
* 根据任务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;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......@@ -45,6 +46,12 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
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
......@@ -89,4 +96,5 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
//zsp
List<Task> findAllByBusinessTypeAndOwnUnitAndCustomInfo(Integer businessType, Integer ownUnit,String customInfo);
List<Task> findAllByIdIn(List<Integer> ids);
}
......@@ -232,9 +232,24 @@ public interface TaskService {
*/
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);
List<TaskBto> findAllByBillIdAndBusinessType2(Integer billId,Integer businessType);
List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer businessType,Integer ownUnit);
/**
* 查询多个任务
*/
TaskBto findByTaskIds(List<Integer> ids);
}
......@@ -1129,6 +1129,16 @@ public class TaskServiceImpl implements TaskService {
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
public TaskBto findByTaskId(Integer taskId) {
return taskDao.findById(taskId).get().parse2Bto();
......@@ -1152,6 +1162,18 @@ public class TaskServiceImpl implements TaskService {
.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
public void moveAllSonNodeToEnd(Integer taaskId) {
List<Task> tasks = taskDao.findAllByParentTaskId(taaskId);
......
......@@ -112,7 +112,6 @@ public class TrainTask {
if (trainTheme.getTrainType()==1) {
}else {
List<Integer> userIds= trainUserDao.findAllByIsSignUpAndTrainId(1,trainId).stream().map(TrainUser::getUserId).collect(Collectors.toList());
userIds.forEach(
userId-> onlineLearningTask(trainId,taskBto.getId(),trainTheme.getName(),userId,taskBto.getOwnUnit())
......
......@@ -59,6 +59,11 @@ public class UnitsController {
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}")
......
......@@ -237,4 +237,10 @@ public class UserController {
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> {
*/
LeftNavigation findLeftNavigation(SecurityUser securityUser);
/**
* 装备库左边侧面导航栏接口
*/
LeftNavigation findLeftNavigation1(SecurityUser securityUser);
/**
* 左边侧面导航栏接口 不包括直属单位
*/
......
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.ret.*;
import com.tykj.dev.device.user.cache.UnitsCache;
......@@ -39,6 +41,9 @@ public class UnitsServiceImpl implements UnitsService {
AreaDao areaDao;
@Autowired
UnitsCache unitsCache;
@Autowired
SystemConfigService systemConfigService;
@Override
public Units findById(Integer unitId) {
Optional<Units> unit = unitsDao.findById(unitId);
......@@ -284,6 +289,47 @@ public class UnitsServiceImpl implements UnitsService {
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
public LeftNavigation findLeftNavigationNotDirectlyUnit(SecurityUser securityUser) {
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论