optimize: 添加物料时,去掉同步到OA,由主物料服务来同步
This commit is contained in:
parent
1ec4e16bd7
commit
b9f37aea55
|
|
@ -1,7 +1,6 @@
|
||||||
package com.nflg.product.bomnew.service;
|
package com.nflg.product.bomnew.service;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
|
@ -35,7 +34,6 @@ 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
|
||||||
|
|
@ -192,25 +190,25 @@ public class MaterialService {
|
||||||
ma.setApplyUserCode(userInfo.getRealName());
|
ma.setApplyUserCode(userInfo.getRealName());
|
||||||
ma.setApplyDeptName(userInfo.getDepartName());
|
ma.setApplyDeptName(userInfo.getDepartName());
|
||||||
ma.setMaterialUnit("PC");
|
ma.setMaterialUnit("PC");
|
||||||
ma.setProcessState(10);
|
// ma.setProcessState(10);
|
||||||
if(StrUtil.isNotBlank(md.getProjectType())){
|
if(StrUtil.isNotBlank(md.getProjectType())){
|
||||||
ma.setProjectType(md.getProjectType());
|
ma.setProjectType(md.getProjectType());
|
||||||
}
|
}
|
||||||
resultList.add(ma);
|
resultList.add(ma);
|
||||||
|
|
||||||
AddMaterialMainDTO ent=new AddMaterialMainDTO();
|
// AddMaterialMainDTO ent=new AddMaterialMainDTO();
|
||||||
BeanUtil.copyProperties(ma,ent);
|
// BeanUtil.copyProperties(ma,ent);
|
||||||
ent.setRelCategoryCode(relMaterialCategory);
|
// ent.setRelCategoryCode(relMaterialCategory);
|
||||||
ent.setReuseOfOnceState(0);
|
// ent.setReuseOfOnceState(0);
|
||||||
syncOaEnts.add(ent);
|
// syncOaEnts.add(ent);
|
||||||
|
|
||||||
md.setMaterialNo(ma.getMaterialNo());
|
md.setMaterialNo(ma.getMaterialNo());
|
||||||
result.put(md.getKey(),md);
|
result.put(md.getKey(),md);
|
||||||
}
|
}
|
||||||
materialMainService.saveOrUpdateBatch(resultList);
|
materialMainService.saveOrUpdateBatch(resultList);
|
||||||
initCategoryInfo(syncOaEnts);
|
// initCategoryInfo(syncOaEnts);
|
||||||
//同步OA
|
//同步OA
|
||||||
sysnToOa(syncOaEnts);
|
// sysnToOa(syncOaEnts, userInfo);
|
||||||
// CompletableFuture.runAsync(() -> sysnToOa(syncOaEnts),syncOAThreadPool);
|
// CompletableFuture.runAsync(() -> sysnToOa(syncOaEnts),syncOAThreadPool);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -307,8 +305,8 @@ public class MaterialService {
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void sysnToOa(List<AddMaterialMainDTO> data) {
|
public void sysnToOa(List<AddMaterialMainDTO> data, LoginUserInfoDTO userInfo) {
|
||||||
Map<String, Object> result = getHttpMap();
|
Map<String, Object> result = getHttpMap(userInfo.getUserCode());
|
||||||
|
|
||||||
List<Map<String, String>> list = new ArrayList<>();
|
List<Map<String, String>> list = new ArrayList<>();
|
||||||
data.forEach(u -> {
|
data.forEach(u -> {
|
||||||
|
|
@ -329,7 +327,7 @@ public class MaterialService {
|
||||||
material.put("MREMA", u.getMaterialDesc());
|
material.put("MREMA", u.getMaterialDesc());
|
||||||
material.put("MMANU", u.getMaterialBrand());
|
material.put("MMANU", u.getMaterialBrand());
|
||||||
material.put("ATTYP", relCategoryCode);
|
material.put("ATTYP", relCategoryCode);
|
||||||
material.put("ERNAM", SessionUtil.getUserCode());
|
material.put("ERNAM", userInfo.getUserCode());
|
||||||
material.put("MEINS", u.getMaterialUnit());
|
material.put("MEINS", u.getMaterialUnit());
|
||||||
material.put("DUPLICATEITEMS", u.getReuseOfOnceState().equals(1) ? "2" : "1");// 是否一次性使用物料 0:否1:是
|
material.put("DUPLICATEITEMS", u.getReuseOfOnceState().equals(1) ? "2" : "1");// 是否一次性使用物料 0:否1:是
|
||||||
material.put("categoryTreeName", u.getCategoryNameTree());
|
material.put("categoryTreeName", u.getCategoryNameTree());
|
||||||
|
|
@ -368,9 +366,9 @@ public class MaterialService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getHttpMap() {
|
public Map<String, Object> getHttpMap(String userCode) {
|
||||||
Map<String, Object> result = new LinkedHashMap<>();
|
Map<String, Object> result = new LinkedHashMap<>();
|
||||||
result.put("userid", SessionUtil.getUserCode());
|
result.put("userid", userCode);
|
||||||
result.put("summary", NacosConfig.getNacosConfig().getSummary());
|
result.put("summary", NacosConfig.getNacosConfig().getSummary());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue