optimize: 添加物料时,去掉同步到OA,由主物料服务来同步

This commit is contained in:
曹鹏飞 2024-06-17 10:43:02 +08:00
parent 1ec4e16bd7
commit b9f37aea55
1 changed files with 13 additions and 15 deletions

View File

@ -1,7 +1,6 @@
package com.nflg.product.bomnew.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
@ -35,7 +34,6 @@ import javax.annotation.Resource;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@Service
@ -192,25 +190,25 @@ public class MaterialService {
ma.setApplyUserCode(userInfo.getRealName());
ma.setApplyDeptName(userInfo.getDepartName());
ma.setMaterialUnit("PC");
ma.setProcessState(10);
// ma.setProcessState(10);
if(StrUtil.isNotBlank(md.getProjectType())){
ma.setProjectType(md.getProjectType());
}
resultList.add(ma);
AddMaterialMainDTO ent=new AddMaterialMainDTO();
BeanUtil.copyProperties(ma,ent);
ent.setRelCategoryCode(relMaterialCategory);
ent.setReuseOfOnceState(0);
syncOaEnts.add(ent);
// AddMaterialMainDTO ent=new AddMaterialMainDTO();
// BeanUtil.copyProperties(ma,ent);
// ent.setRelCategoryCode(relMaterialCategory);
// ent.setReuseOfOnceState(0);
// syncOaEnts.add(ent);
md.setMaterialNo(ma.getMaterialNo());
result.put(md.getKey(),md);
}
materialMainService.saveOrUpdateBatch(resultList);
initCategoryInfo(syncOaEnts);
// initCategoryInfo(syncOaEnts);
//同步OA
sysnToOa(syncOaEnts);
// sysnToOa(syncOaEnts, userInfo);
// CompletableFuture.runAsync(() -> sysnToOa(syncOaEnts),syncOAThreadPool);
return result;
}
@ -307,8 +305,8 @@ public class MaterialService {
* @param data
*/
@Transactional(rollbackFor = Exception.class)
public void sysnToOa(List<AddMaterialMainDTO> data) {
Map<String, Object> result = getHttpMap();
public void sysnToOa(List<AddMaterialMainDTO> data, LoginUserInfoDTO userInfo) {
Map<String, Object> result = getHttpMap(userInfo.getUserCode());
List<Map<String, String>> list = new ArrayList<>();
data.forEach(u -> {
@ -329,7 +327,7 @@ public class MaterialService {
material.put("MREMA", u.getMaterialDesc());
material.put("MMANU", u.getMaterialBrand());
material.put("ATTYP", relCategoryCode);
material.put("ERNAM", SessionUtil.getUserCode());
material.put("ERNAM", userInfo.getUserCode());
material.put("MEINS", u.getMaterialUnit());
material.put("DUPLICATEITEMS", u.getReuseOfOnceState().equals(1) ? "2" : "1");// 是否一次性使用物料 0:否1
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<>();
result.put("userid", SessionUtil.getUserCode());
result.put("userid", userCode);
result.put("summary", NacosConfig.getNacosConfig().getSummary());
return result;
}