Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom
This commit is contained in:
commit
7c5c9abc40
|
|
@ -167,6 +167,7 @@ public class OriginalBomApi extends BaseApi {
|
||||||
|
|
||||||
//更新-原始BOM跟节点
|
//更新-原始BOM跟节点
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
|
originalParentService.getBaseMapper().updateRootState_1(OriginalStatusEnum.OVER_CONVERT.getValue());
|
||||||
originalParentService.getBaseMapper().updateRootState_2(OriginalStatusEnum.OVER_CONVERT.getValue());
|
originalParentService.getBaseMapper().updateRootState_2(OriginalStatusEnum.OVER_CONVERT.getValue());
|
||||||
originalParentService.getBaseMapper().updateRootState_3(OriginalStatusEnum.OVER_CONVERT.getValue());
|
originalParentService.getBaseMapper().updateRootState_3(OriginalStatusEnum.OVER_CONVERT.getValue());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.nflg.product.bomnew.api.user;
|
package com.nflg.product.bomnew.api.user;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.mzt.logapi.context.LogRecordContext;
|
import com.mzt.logapi.context.LogRecordContext;
|
||||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||||
|
|
@ -16,7 +17,9 @@ import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomCopyCheckResultVO;
|
import com.nflg.product.bomnew.pojo.vo.BomCopyCheckResultVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO;
|
||||||
import com.nflg.product.bomnew.service.*;
|
import com.nflg.product.bomnew.service.*;
|
||||||
|
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
@ -27,6 +30,7 @@ import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
@ -75,35 +79,51 @@ public class PBomApi extends BaseApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("exportWorkDetailsListByPage")
|
@PostMapping("exportWorkDetailsListByPage")
|
||||||
@ApiOperation("导出工作列表--导出")
|
@ApiOperation("导出工作列表--按查询条件")
|
||||||
@LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表")
|
@LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表")
|
||||||
public void exportWorkDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException {
|
public void exportWorkDownLoad(@RequestBody BomNewPbomParentQuery query, HttpServletResponse response) throws IOException {
|
||||||
bomNewPbomParentService.workDetailsExcel(query,response);
|
//bomNewPbomParentService.workDetailsExcel(query,response);
|
||||||
|
IPage<BomNewPbomParentVO> data = bomNewPbomParentService.workDetailsListByPage(query);
|
||||||
|
List<BomNewPbomWorkExcelVO> out = new ArrayList<>();
|
||||||
|
if (!data.getRecords().isEmpty()) {
|
||||||
|
out = Convert.toList(BomNewPbomWorkExcelVO.class, data.getRecords());
|
||||||
|
}
|
||||||
|
EecExcelUtil.export(response, out, BomNewPbomWorkExcelVO.class, "pbom明细列表");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("releaseListDownLoad")
|
@PostMapping("releaseListDownLoad")
|
||||||
@ApiOperation("PBom已发布工作列表--导出")
|
@ApiOperation("导出正式列表--按查询条件")
|
||||||
@LogRecord(success = "PBom-导出已发布工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-已发布工作列表")
|
@LogRecord(success = "PBom-导出已发布工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-已发布工作列表")
|
||||||
public void releaseListDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException {
|
public void releaseListDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException {
|
||||||
bomNewPbomParentService.releaseListExcel(query,response);
|
//bomNewPbomParentService.releaseListExcel(query,response);
|
||||||
|
IPage<BomNewPbomParentVO> data = bomNewPbomParentService.releaseListByPage(query);
|
||||||
|
List<BomNewPbomWorkExcelVO> out = new ArrayList<>();
|
||||||
|
if (!data.getRecords().isEmpty()) {
|
||||||
|
out = Convert.toList(BomNewPbomWorkExcelVO.class, data.getRecords());
|
||||||
|
}
|
||||||
|
EecExcelUtil.export(response, out, BomNewPbomWorkExcelVO.class, "pbom已发布工作列表");
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PostMapping("exportWorkDetailsListByPage")
|
@PostMapping("exportWorkDetailsListByIds")
|
||||||
// @ApiOperation("导出工作列表--导出")
|
@ApiOperation("导出工作列表--按rowid")
|
||||||
// @LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表")
|
@LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表")
|
||||||
// public void exportWorkDownLoad(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
public void exportWorkDownLoad(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
||||||
// List<BomNewPbomWorkExcelVO> data = bomNewPbomParentService.exportExcel(bomRowIds);
|
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要导出的行");
|
||||||
// //new Workbook().addSheet(new ListSheet<>(data)).writeTo(response.getOutputStream());
|
|
||||||
// EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom明细列表");
|
List<BomNewPbomWorkExcelVO> data = bomNewPbomParentService.exportExcel(bomRowIds);
|
||||||
// }
|
//new Workbook().addSheet(new ListSheet<>(data)).writeTo(response.getOutputStream());
|
||||||
//
|
EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom明细列表");
|
||||||
// @PostMapping("releaseListDownLoad")
|
}
|
||||||
// @ApiOperation("PBom已发布工作列表--导出")
|
|
||||||
// @LogRecord(success = "PBom-导出已发布工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-已发布工作列表")
|
@PostMapping("releaseListDownLoadByIds")
|
||||||
// public void releaseListDownLoad(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
@ApiOperation("导出正式列表--按rowid")
|
||||||
// List<BomNewPbomWorkExcelVO> data = bomNewPbomParentService.exportExcel(bomRowIds);
|
@LogRecord(success = "PBom-导出已发布工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-已发布工作列表")
|
||||||
// EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom已发布明细列表");
|
public void releaseListDownLoad(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
||||||
// }
|
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要导出的行");
|
||||||
|
|
||||||
|
List<BomNewPbomWorkExcelVO> data = bomNewPbomParentService.exportExcel(bomRowIds);
|
||||||
|
EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom已发布明细列表");
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("getChild")
|
@GetMapping("getChild")
|
||||||
@ApiOperation("获取子级")
|
@ApiOperation("获取子级")
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,17 @@ public class TaskPoolConfig {
|
||||||
taskExecutor.setThreadFactory(new ThreadFactoryBuilder().setNamePrefix("plm-searcher-thread-").build());
|
taskExecutor.setThreadFactory(new ThreadFactoryBuilder().setNamePrefix("plm-searcher-thread-").build());
|
||||||
return taskExecutor;
|
return taskExecutor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean("syncOAThreadPool")
|
||||||
|
public ThreadPoolTaskExecutor syncOAThreadPool() {
|
||||||
|
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
|
||||||
|
taskExecutor.setCorePoolSize(10);
|
||||||
|
taskExecutor.setMaxPoolSize(30);
|
||||||
|
taskExecutor.setQueueCapacity(2000);
|
||||||
|
taskExecutor.setKeepAliveSeconds(100);
|
||||||
|
taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
|
//设置线程池的线程名称,方便日志追踪
|
||||||
|
taskExecutor.setThreadFactory(new ThreadFactoryBuilder().setNamePrefix("sync-oa-").build());
|
||||||
|
return taskExecutor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,13 @@ public enum EBomStatusEnum implements ValueEnum<Integer> {
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|
||||||
|
public static EBomStatusEnum findByValue(Integer value) {
|
||||||
|
for (EBomStatusEnum statusEnum : EBomStatusEnum.values()) {
|
||||||
|
if (statusEnum.getValue().equals(value)) {
|
||||||
|
return statusEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("无效的值");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
|
||||||
/**
|
/**
|
||||||
* 更新是否根节点状态
|
* 更新是否根节点状态
|
||||||
*/
|
*/
|
||||||
void updateRootState_1();
|
void updateRootState_1(@Param("status") Integer status);
|
||||||
|
|
||||||
void updateRootState_2(@Param("status") Integer status);
|
void updateRootState_2(@Param("status") Integer status);
|
||||||
void updateRootState_3(@Param("status") Integer status);
|
void updateRootState_3(@Param("status") Integer status);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.nflg.product.bomnew.pojo.query;
|
package com.nflg.product.bomnew.pojo.query;
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
@ -8,7 +7,6 @@ import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,8 +18,6 @@ import java.util.List;
|
||||||
@ApiModel(value = "com-nflg-product-bom-obom-pojo-query-BomOriginalParentEntityQuery")
|
@ApiModel(value = "com-nflg-product-bom-obom-pojo-query-BomOriginalParentEntityQuery")
|
||||||
public class OriginalBomQuery extends BasePageQuery {
|
public class OriginalBomQuery extends BasePageQuery {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "图号集合,英文逗号隔开")
|
@ApiModelProperty(value = "图号集合,英文逗号隔开")
|
||||||
private String drawingNoList;
|
private String drawingNoList;
|
||||||
|
|
||||||
|
|
@ -45,12 +41,10 @@ public class OriginalBomQuery extends BasePageQuery {
|
||||||
@ApiModelProperty(value = "状态:1=待转换、2=已转换")
|
@ApiModelProperty(value = "状态:1=待转换、2=已转换")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String startDate;
|
private String startDate;
|
||||||
|
|
||||||
private String endDate;
|
private String endDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否仅显示自己的数据:0=所有人的数据;1=仅自己的数据,默认为0")
|
||||||
|
private Integer showMySelfOnly = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.lang.TypeReference;
|
import cn.hutool.core.lang.TypeReference;
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import cn.hutool.core.util.EnumUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
|
@ -1489,7 +1488,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
//待复核和已退回才能删除
|
//待复核和已退回才能删除
|
||||||
VUtils.isTure(parentEntity.getStatus().equals(EBomStatusEnum.WAIT_CHECK.getValue())
|
VUtils.isTure(parentEntity.getStatus().equals(EBomStatusEnum.WAIT_CHECK.getValue())
|
||||||
|| parentEntity.getStatus().equals(EBomStatusEnum.RETURNED.getValue()))
|
|| parentEntity.getStatus().equals(EBomStatusEnum.RETURNED.getValue()))
|
||||||
.throwMessage(EnumUtil.fromString(EBomStatusEnum.class, parentEntity.getStatus().toString()).getDescription() + "状态不能删除");
|
.throwMessage(EBomStatusEnum.findByValue(parentEntity.getStatus()).getDescription() + "状态不能删除");
|
||||||
|
|
||||||
EBomDel eBomDel = new EBomDel(bomRowId);
|
EBomDel eBomDel = new EBomDel(bomRowId);
|
||||||
eBomDel.classifyBom();
|
eBomDel.classifyBom();
|
||||||
|
|
|
||||||
|
|
@ -145,11 +145,9 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
Page<BomOriginalListVO> result = new Page<>();
|
Page<BomOriginalListVO> result = new Page<>();
|
||||||
//物料编码搜索或图号搜索
|
//物料编码搜索或图号搜索
|
||||||
if (CollUtil.isNotEmpty(query.getMaterialNos()) || CollUtil.isNotEmpty(query.getDrawingNos())) {
|
if (CollUtil.isNotEmpty(query.getMaterialNos()) || CollUtil.isNotEmpty(query.getDrawingNos())) {
|
||||||
List<String> queryDrawingNos = new ArrayList<>();
|
List<String> queryDrawingNos = new ArrayList<>(query.getDrawingNos());
|
||||||
queryDrawingNos.addAll(query.getDrawingNos());
|
|
||||||
List<String> drawingParentNos=new ArrayList<>();
|
|
||||||
if (CollUtil.isNotEmpty(query.getMaterialNos())) {
|
if (CollUtil.isNotEmpty(query.getMaterialNos())) {
|
||||||
drawingParentNos = this.getBaseMapper().getDrawingNoByMaterialNos(query.getMaterialNos());
|
List<String> drawingParentNos = this.getBaseMapper().getDrawingNoByMaterialNos(query.getMaterialNos());
|
||||||
if (CollUtil.isNotEmpty(drawingParentNos)) {
|
if (CollUtil.isNotEmpty(drawingParentNos)) {
|
||||||
queryDrawingNos.addAll(drawingParentNos);
|
queryDrawingNos.addAll(drawingParentNos);
|
||||||
}
|
}
|
||||||
|
|
@ -160,7 +158,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
if(query.getStatus().equals(1) && CollUtil.isEmpty(materialBoms)){
|
if(query.getStatus().equals(1) && CollUtil.isEmpty(materialBoms)){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
List<String> parentDrawingNos = getParentDrawingNoByMaterialNo(queryDrawingNos).stream().collect(Collectors.toList());
|
List<String> parentDrawingNos = new ArrayList<>(getParentDrawingNoByMaterialNo(queryDrawingNos));
|
||||||
parentDrawingNos.addAll(queryDrawingNos);
|
parentDrawingNos.addAll(queryDrawingNos);
|
||||||
if (CollUtil.isNotEmpty(parentDrawingNos)) {
|
if (CollUtil.isNotEmpty(parentDrawingNos)) {
|
||||||
List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus());
|
List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus());
|
||||||
|
|
@ -173,8 +171,11 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
String userCode = null;
|
||||||
result = this.getBaseMapper().getOriginalBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, SessionUtil.getUserCode());
|
if (query.getShowMySelfOnly() == 1) {
|
||||||
|
userCode = SessionUtil.getUserCode();
|
||||||
|
}
|
||||||
|
result = this.getBaseMapper().getOriginalBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, userCode);
|
||||||
materialMainService.intiMaterialInfo(result.getRecords());
|
materialMainService.intiMaterialInfo(result.getRecords());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -201,7 +202,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(childEntities)) {
|
if (CollUtil.isNotEmpty(childEntities)) {
|
||||||
//删除行
|
//删除行
|
||||||
List<Long> delRowIds = bom.getBomList().stream().filter(u -> u.getRowId() > 0).map(u -> u.getRowId()).collect(Collectors.toList());
|
List<Long> delRowIds = bom.getBomList().stream().map(BomOriginalListVO::getRowId).filter(rowId -> rowId > 0).collect(Collectors.toList());
|
||||||
originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds, bom.getParentRowId());
|
originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds, bom.getParentRowId());
|
||||||
originalChildService.saveOrUpdateBatch(childEntities);
|
originalChildService.saveOrUpdateBatch(childEntities);
|
||||||
}
|
}
|
||||||
|
|
@ -427,7 +428,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
||||||
public void computeLevelNumAndRootState() {
|
public void computeLevelNumAndRootState() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.getBaseMapper().updateRootState_1();
|
this.getBaseMapper().updateRootState_1(OriginalStatusEnum.UN_CONVERT.getValue());
|
||||||
this.getBaseMapper().updateRootState_2(OriginalStatusEnum.UN_CONVERT.getValue());
|
this.getBaseMapper().updateRootState_2(OriginalStatusEnum.UN_CONVERT.getValue());
|
||||||
this.getBaseMapper().updateRootState_3(OriginalStatusEnum.UN_CONVERT.getValue());
|
this.getBaseMapper().updateRootState_3(OriginalStatusEnum.UN_CONVERT.getValue());
|
||||||
// this.compucteLevelNum();
|
// this.compucteLevelNum();
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(materialNo)) {
|
if (StrUtil.isNotBlank(materialNo)) {
|
||||||
List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo).stream().collect(Collectors.toList());
|
List<String> parentMaterialByMaterialNo = new ArrayList<>(getParentMaterialByMaterialNo(materialNo));
|
||||||
parentMaterialByMaterialNo.add(materialNo);
|
parentMaterialByMaterialNo.add(materialNo);
|
||||||
if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) {
|
if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) {
|
||||||
List<BomNewPbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(StrUtil.isBlank(userRoleService.getUserFactory()) ? userRoleService.getUserFactory() : query.getFacCode(), parentMaterialByMaterialNo);
|
List<BomNewPbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(StrUtil.isBlank(userRoleService.getUserFactory()) ? userRoleService.getUserFactory() : query.getFacCode(), parentMaterialByMaterialNo);
|
||||||
|
|
@ -131,7 +131,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
return handSeachToTree(parents, childs);
|
return handSeachToTree(parents, childs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Page<BomNewPbomParentVO>();
|
return new Page<>();
|
||||||
} else {
|
} else {
|
||||||
Page<BomNewPbomParentVO> result = this.getBaseMapper().workDetailsListByPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserFactory());
|
Page<BomNewPbomParentVO> result = this.getBaseMapper().workDetailsListByPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserFactory());
|
||||||
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||||
|
|
@ -141,8 +141,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
|
|
||||||
private Page<BomNewPbomParentVO> handSeachToTree(List<BomNewPbomParentVO> parents, List<BomNewPbomParentVO> childs) {
|
private Page<BomNewPbomParentVO> handSeachToTree(List<BomNewPbomParentVO> parents, List<BomNewPbomParentVO> childs) {
|
||||||
Page<BomNewPbomParentVO> resutlData = new Page<>();
|
Page<BomNewPbomParentVO> resutlData = new Page<>();
|
||||||
Set<String> parentSet = parents.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
Set<String> parentSet = parents.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toSet());
|
||||||
Set<String> childSet = childs.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
Set<String> childSet = childs.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toSet());
|
||||||
Set<String> difference = Sets.difference(parentSet, childSet);
|
Set<String> difference = Sets.difference(parentSet, childSet);
|
||||||
List<BomNewPbomParentVO> resultParents = parents.stream().filter(u -> difference.contains(u.getMaterialNo())).collect(Collectors.toList());
|
List<BomNewPbomParentVO> resultParents = parents.stream().filter(u -> difference.contains(u.getMaterialNo())).collect(Collectors.toList());
|
||||||
resutlData.setTotal(difference.size());
|
resutlData.setTotal(difference.size());
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
import nflg.product.common.vo.ResultVO;
|
import nflg.product.common.vo.ResultVO;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
@ -32,6 +34,7 @@ import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -44,6 +47,10 @@ public class MaterialService {
|
||||||
@Resource
|
@Resource
|
||||||
MaterialMainService materialMainService;
|
MaterialMainService materialMainService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Qualifier("syncOAThreadPool")
|
||||||
|
ThreadPoolTaskExecutor syncOAThreadPool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请物料
|
* 申请物料
|
||||||
*
|
*
|
||||||
|
|
@ -202,7 +209,7 @@ public class MaterialService {
|
||||||
materialMainService.saveOrUpdateBatch(resultList);
|
materialMainService.saveOrUpdateBatch(resultList);
|
||||||
initCategoryInfo(syncOaEnts);
|
initCategoryInfo(syncOaEnts);
|
||||||
//同步OA
|
//同步OA
|
||||||
sysnToOa(syncOaEnts);
|
CompletableFuture.runAsync(() -> sysnToOa(syncOaEnts),syncOAThreadPool);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,11 @@ public abstract class VirtualPackageBase {
|
||||||
protected BomNewEbomParentEntity buildParentVirtualPackage(Long rowId,VirtualPackageTypeEnum virtualPackageTypeEnum) throws IOException {
|
protected BomNewEbomParentEntity buildParentVirtualPackage(Long rowId,VirtualPackageTypeEnum virtualPackageTypeEnum) throws IOException {
|
||||||
|
|
||||||
AddVirtrualMaterialDTO addM = vMNos.get(StrUtil.join("",rowId,virtualPackageTypeEnum.getConMaterialName()));
|
AddVirtrualMaterialDTO addM = vMNos.get(StrUtil.join("",rowId,virtualPackageTypeEnum.getConMaterialName()));
|
||||||
BomNewEbomParentEntity oldParent= SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, addM.getMaterialNo()).eq(BomNewEbomParentEntity::getLastVersionIs,1).one();
|
BomNewEbomParentEntity oldParent= SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery()
|
||||||
|
.eq(BomNewEbomParentEntity::getMaterialNo, addM.getMaterialNo())
|
||||||
|
.eq(BomNewEbomParentEntity::getLastVersionIs,1)
|
||||||
|
.ne(BomNewEbomParentEntity::getStatus,4)
|
||||||
|
.one();
|
||||||
|
|
||||||
if(Objects.nonNull(oldParent)){
|
if(Objects.nonNull(oldParent)){
|
||||||
oldParent.setLastVersionIs(0);
|
oldParent.setLastVersionIs(0);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
package com.nflg.product.bomnew.util;
|
package com.nflg.product.bomnew.util;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
import okhttp3.*;
|
import okhttp3.*;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -23,6 +26,8 @@ public class HttpUtils {
|
||||||
//请求类
|
//请求类
|
||||||
private OkHttpClient okHttpClient;
|
private OkHttpClient okHttpClient;
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(HttpUtils.class);
|
||||||
|
|
||||||
//请求头类型
|
//请求头类型
|
||||||
private final MediaType jsonMediaType = MediaType.parse("application/json;charset=utf-8");
|
private final MediaType jsonMediaType = MediaType.parse("application/json;charset=utf-8");
|
||||||
|
|
||||||
|
|
@ -210,13 +215,22 @@ public class HttpUtils {
|
||||||
* @throws IOException e
|
* @throws IOException e
|
||||||
*/
|
*/
|
||||||
public String doPost(String url, String json) throws IOException {
|
public String doPost(String url, String json) throws IOException {
|
||||||
System.out.println(url);
|
String ret = null;
|
||||||
System.out.println(json);
|
String traceId = IdWorker.getIdStr();
|
||||||
Response response = doPostRtnRsp(url, json);
|
LOGGER.info(traceId + ",http请求,地址:" + url + ",参数:" + json);
|
||||||
if (response == null || response.body() == null) {
|
long start = System.currentTimeMillis();
|
||||||
return null;
|
try (Response response = doPostRtnRsp(url, json)) {
|
||||||
|
if (response == null || response.body() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ret = response.body().string();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOGGER.error(traceId + ",http请求,出错", ex);
|
||||||
|
} finally {
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
LOGGER.info(traceId + ",http请求,耗时:" + (end - start) + "毫秒,返回:" + ret);
|
||||||
}
|
}
|
||||||
return response.body().string();
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@
|
||||||
<update id="updateRootState">
|
<update id="updateRootState">
|
||||||
update t_bom_new_ebom_parent
|
update t_bom_new_ebom_parent
|
||||||
set root_is=0, user_root_is=0
|
set root_is=0, user_root_is=0
|
||||||
where last_version_is = 1;
|
where last_version_is = 1 AND `status` < 4;
|
||||||
|
|
||||||
|
|
||||||
update t_bom_new_ebom_parent a left join (
|
update t_bom_new_ebom_parent a left join (
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,9 @@
|
||||||
<if test="query.startDate!=null and query.startDate!=''">
|
<if test="query.startDate!=null and query.startDate!=''">
|
||||||
and created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY)
|
and created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY)
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userCode!=null">
|
||||||
|
and created_by=#{userCode}
|
||||||
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!--获取原始bom列表-->
|
<!--获取原始bom列表-->
|
||||||
|
|
@ -143,7 +146,7 @@
|
||||||
update t_bom_new_original_parent
|
update t_bom_new_original_parent
|
||||||
set root_is=0,
|
set root_is=0,
|
||||||
user_root_is=0
|
user_root_is=0
|
||||||
where last_version_is = 1
|
where last_version_is = 1 and `status`= #{status}
|
||||||
</update>
|
</update>
|
||||||
<!--处理根节点-->
|
<!--处理根节点-->
|
||||||
<update id="updateRootState_2">
|
<update id="updateRootState_2">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue