提交 61cd8b8a authored 作者: 133's avatar 133

[清退 工作交接] 代码提交

上级 d14973c6
package com.tykj.dev.misc.utils;
import com.tykj.dev.misc.MiscApplication;
import com.tykj.dev.misc.exception.ApiException;
import org.springframework.boot.SpringApplication;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import sun.jvm.hotspot.utilities.Interval;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @author dengdiyi
......@@ -11,6 +20,113 @@ import java.util.List;
*/
public class DeviceSeqUtil {
public static void main(String[] args) {
List<String> list=new ArrayList<>();
list.add("a2");
list.add("a4");
list.add("a6");
list.add("a5");
list.add("a3");
list.add("a1");
compositionInterval(list);
}
/**
* 根据一组序列号 组成区间
* 先判断元素是字符+数字,还是存数字,还是其他
*
*/
public static String compositionInterval(List<String> seqList){
StringBuffer stringBuffer=new StringBuffer();
int i=0;
String rext="^(\\w.*)(\\d.*)$";
String rext1="^[0-9]*$";
String rextOne = null;
String rextTwo = null;
String startPrefix=null;
Integer startIndex=null;
String prefix=null;
Integer index=0;
String rext1One="";
Pattern pattern;
Matcher matcher;
seqList=seqList.stream().sorted(Comparator.comparing(String::toString)).collect(Collectors.toList());
for (String seq:seqList){
if (seq.matches(rext)){
if (rextOne==null){
rextOne=seq;
rextTwo=seq;
index=toIndex(rext,seq);
prefix=toPrefix(rext,seq);
startIndex=index;
startPrefix=prefix;
}else {
if (isSame(rext,seq,prefix,index)){
index++;
rextTwo=seq;
}else {
i=1;
if (index.equals(startIndex)) {
stringBuffer.append(",").append(rextOne);
}else {
stringBuffer.append(",").append(rextOne).append("-").append(rextTwo);
}
rextTwo=seq;
index=toIndex(rext,seq);
prefix=toPrefix(rext,seq);
}
}
}else if (seq.matches(rext1)){
}
}
if (i==0){
stringBuffer.append(",").append(rextOne).append("-").append(rextTwo);
}
System.out.println("-------:"+stringBuffer.toString());
return "";
}
private static boolean isSame(String rext,String str,String prefix,int index){
Pattern pattern = Pattern.compile(rext);
Matcher matcher = pattern.matcher(str);
if (matcher.find()){
if (prefix.equals(matcher.group(1)) && Integer.parseInt(matcher.group(2))==index+1){
return true;
}else {
return false;
}
}else {
throw new ApiException(ResponseEntity.status(500).body("正则匹配失败 请查看"));
}
}
private static Integer toIndex(String rext,String str){
Pattern pattern = Pattern.compile(rext);
Matcher matcher = pattern.matcher(str);
if (matcher.find()){
return Integer.parseInt(matcher.group(2));
}else {
throw new ApiException(ResponseEntity.status(500).body("正则匹配失败 请查看"));
}
}
private static String toPrefix(String rext,String str){
Pattern pattern = Pattern.compile(rext);
Matcher matcher = pattern.matcher(str);
if (matcher.find()){
return matcher.group(1);
}else {
throw new ApiException(ResponseEntity.status(500).body("正则匹配失败 请查看"));
}
}
/**
* @param num 入库数量
* @param s 序列号区间字符串
......
......@@ -169,7 +169,7 @@ public class RepelDevController {
* 清退装备任务等待上传回执单
*/
@ApiOperation(value = "清退装备任务等待上传回执单", notes = "上传回执单 也可以不上传回执单")
@GetMapping(value ="/receipts")
@PostMapping(value ="/receipts")
public ResponseEntity receipts( @RequestBody StorageDeviceRepel storageDeviceRepel){
repelBusinessService.receipts(storageDeviceRepel);
return ResponseEntity.ok("上传回执单成功");
......
......@@ -237,6 +237,12 @@ public class DeviceRepelDetail extends BaseEntity {
@ApiModelProperty(value = "清退单对象")
private List<FileRet> billFiles ;
@Transient
@ApiModelProperty(value = "清退单对象")
private List<FileRet> inFiles ;
@Transient
@ApiModelProperty(value = "清退单对象")
private List<FileRet> outboundFiles ;
}
package com.tykj.dev.device.sendback.service.impl;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
......@@ -43,6 +44,9 @@ public class DeviceRepelDetailServiceImpl implements DeviceRepelDetailService {
if (optional.isPresent()){
DeviceRepelDetail deviceRepelDetail=optional.get();
deviceRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
deviceRepelDetail.setBillFiles(FilesUtil.stringFileToList(deviceRepelDetail.getBillFile()));
deviceRepelDetail.setOutboundFiles(FilesUtil.stringFileToList(deviceRepelDetail.getOutboundFile()));
deviceRepelDetail.setInFiles(FilesUtil.stringFileToList(deviceRepelDetail.getInFile()));
return deviceRepelDetail;
}else {
log.info("[清退] 详情查看错误,id没有找到{}",repelDetailId);
......
......@@ -172,7 +172,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
}
repelTaskStatisticalService.saveAllRepelTaskStatistical(list);
isCommission(taskBto,deviceRepel1.getId());
}
@Override
......
......@@ -60,5 +60,24 @@ public class HandoverController {
return ResponseEntity.ok(workHandoverService.findById(workId));
}
/**
* 查询移交人
*/
@GetMapping(value = "/handedList")
@ApiOperation(value = "查询移交人")
public ResponseEntity handedList(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
return ResponseEntity.ok(workHandoverService.handedList(securityUser));
}
/**
* 查询交接人
*/
@PostMapping(value = "/handover")
@ApiOperation(value = "查询交接人")
public ResponseEntity handedList(@RequestBody WorkHandoverAddVo workHandoverAddVo) {
return ResponseEntity.ok(workHandoverService.handover(workHandoverAddVo.getTurnOverUserAId()));
}
}
......@@ -36,17 +36,22 @@ public class WorkHandover {
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer workHandoverId;
/**
* 发起人id
*/
private Integer initiateUserId;
/**
* 交接
* 交接相关人员
*/
@Column(name = "handover_user_ids",columnDefinition = "TEXT")
private String handoverUserIds;
/**
* 移交人a
*/
@Column(name = "turn_over_user_ids",columnDefinition = "TEXT")
private String turnOverUserIds;
/**
......@@ -67,6 +72,7 @@ public class WorkHandover {
/**
* 文件集合(装备列表签字文件集合)
*/
@Column(name = "file" ,columnDefinition = "TEXT")
private String file;
/**
......
......@@ -27,12 +27,6 @@ public class WorkHandoverAddVo {
private List<Integer> turnOverUserAId;
public WorkHandover toWorkHandover() {
ModelMapper mapper = BeanHelper.getUserMapper();
WorkHandover workHandover = mapper.map(this, WorkHandover.class);
workHandover.setStatus(1);
return workHandover;
}
}
......@@ -5,6 +5,9 @@ import com.tykj.dev.device.train.entity.vo.WorkHandoverAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverEndAddVo;
import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.User;
import java.util.List;
/**
* @author zjm
......@@ -30,4 +33,13 @@ public interface WorkHandoverService {
*/
WorkHandover findById(Integer workHandoverId);
/**
* 移交人
*/
List<User> handedList(SecurityUser securityUser);
/**
* 交接人
*/
List<User> handover(List<Integer> userIds);
}
......@@ -69,6 +69,7 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
workHandover.setStatus(1);
workHandover.setTurnOverUserIds(StringSplitUtil.ListToString(workHandoverAddVo.getTurnOverUserAId()));
workHandover.setHandoverUserIds(StringSplitUtil.ListToString(handoverIds));
workHandover.setInitiateUserId(securityUser.getCurrentUserInfo().getUserId());
//创建workHandoverDB 存储数据库
workHandover = workHandoverDao.save(workHandover);
List<Integer> integers = new ArrayList<>();
......@@ -99,7 +100,9 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id);
taskService.moveToEnd(taskBto);
//把交接人账号状态改为冻结
User user= userService.findByUser(workHandover.getInitiateUserId());
user.setIsDel(1);
userService.save(user);
return workHandover;
}
......@@ -116,4 +119,15 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
throw new ApiException(ResponseEntity.status(500).body("没有这个id:" + workHandoverId));
}
}
@Override
public List<User> handedList(SecurityUser securityUser) {
return userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId());
}
@Override
public List<User> handover(List<Integer> userIds) {
return userService.findAllUserIdInUser(userIds);
}
}
......@@ -99,4 +99,10 @@ public class UnitsController {
}
@GetMapping("/countries/directlyUnder")
@ApiOperation(value = "省直属单位接口", notes = "省直属单位接口")
public ResponseEntity directlyUnder(){
return ResponseEntity.ok(unitsService.findDirectlyUnder());
}
}
......@@ -131,4 +131,6 @@ public interface UnitsService extends PublicService<Units> {
* 省入库上级单位对象查询接口
*/
List<Units> findSuperiorUnitsList();
List<Units> findDirectlyUnder();
}
......@@ -17,10 +17,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -282,7 +279,11 @@ public class UnitsServiceImpl implements UnitsService {
leftNavigationList= unitsDao.findAllByAreaId(belongsArea.getId()).stream().map(Units::toLeftNavigation).collect(Collectors.toList());
}
if (belongsArea.getType()==1){
leftNavigationList.addAll(unitsDao.findAllByType(2).stream().map(Units::toLeftNavigation).collect(Collectors.toList()));
//把省直属组合一下 直属单位(type=2) 处室单位(type=4)
leftNavigationList.addAll(unitsDao.findAllByType(4).stream().map(Units::toLeftNavigation).collect(Collectors.toList()));
List<LeftNavigation> leftNavigationList2=unitsDao.findAllByType(2).stream().map(Units::toLeftNavigation).collect(Collectors.toList());
LeftNavigation leftNavigation2=new LeftNavigation(0,"省直属",leftNavigationList2, UUID.randomUUID().toString(),1,22);
leftNavigationList.add(leftNavigation2);
}
List<Area> areas= areaDao.findAllByFatherId(areaId);
if (areas.size()!=0) {
......@@ -303,6 +304,13 @@ public class UnitsServiceImpl implements UnitsService {
return unitsDao.findAllByType(3);
}
@Override
public List<Units> findDirectlyUnder() {
List<Units> unitsList= unitsDao.findAllByType(2);
unitsList.addAll(unitsDao.findAllByType(4));
return unitsList;
}
@Override
public Units save(Units units) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论