feat: 绑定零部件PDM相关部分

This commit is contained in:
2024-04-29 17:42:41 +08:00
parent d2de22b6eb
commit 55a820a5de
16 changed files with 335 additions and 48 deletions
@@ -168,6 +168,8 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/srms/getByLawsStandardPage", "anon");
// 分页查询标准数据
filterChainDefinitionMap.put("/srms/syncPartData", "anon");
// PDM获取零部件号绑定的法规数据
filterChainDefinitionMap.put("/srms/bindPartStandardInfo", "anon");
// 添加自己的过滤器并且取名为jwt
Map<String, Filter> filterMap = new HashMap<>(1);
@@ -1,4 +1,4 @@
package com.jero.modules.laws.bindPart.controller;
package com.jero.modules.docking.bindPart.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
@@ -6,9 +6,9 @@ import com.jero.common.api.vo.ResultCommon;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.MessageUtils;
import com.jero.modules.laws.bindPart.entity.BindPartStandardVO;
import com.jero.modules.laws.bindPart.entity.LawsBindPart;
import com.jero.modules.laws.bindPart.service.ILawsBindPartService;
import com.jero.modules.docking.bindPart.entity.BindPartStandardVO;
import com.jero.modules.docking.bindPart.entity.LawsBindPart;
import com.jero.modules.docking.bindPart.service.ILawsBindPartService;
import com.jero.modules.laws.documenttool.service.IDocumentSplitService;
import com.jero.modules.split.entity.SarFileSplitMenuEO;
import com.jero.modules.split.page.SarFileSplitMenuEOPage;
@@ -25,7 +25,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -52,12 +51,24 @@ public class LawsBindPartController {
@RequiresPermissions("sys:bindingPart:search")
public Result<IPage<LawsBindPart>> queryPageList(LawsBindPart lawsBindPart,
@RequestParam(name="pageNo", defaultValue="1") @ApiParam("页码") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") @ApiParam("页面显示数量") Integer pageSize,
HttpServletRequest req) {
IPage<LawsBindPart> pageList= lawsBindPartService.queryPage(lawsBindPart, pageNo, pageSize, req);
@RequestParam(name="pageSize", defaultValue="10") @ApiParam("页面显示数量") Integer pageSize) {
IPage<LawsBindPart> pageList= lawsBindPartService.queryPage(lawsBindPart, pageNo, pageSize);
return Result.OK(pageList);
}
@AutoLog(value = "绑定零部件-是否显示使用绑定关系")
@ApiOperation(value="绑定零部件-是否显示使用绑定关系", notes="绑定零部件-是否显示使用绑定关系")
@GetMapping(value = "/isShowUseBindRelation")
public Result<LawsBindPart> isShowUseBindRelation(LawsBindPart lawsBindPart) {
return Result.OK(lawsBindPartService.isShowUseBindRelation(lawsBindPart));
}
@AutoLog(value = "绑定零部件-使用绑定关系")
@ApiOperation(value="绑定零部件-使用绑定关系", notes="绑定零部件-使用绑定关系")
@GetMapping(value = "/useBindRelation")
public Result<LawsBindPart> useBindRelation(@RequestParam("id") String id) {
return Result.OK(lawsBindPartService.useBindRelation(id));
}
/**
* 添加
@@ -1,4 +1,4 @@
package com.jero.modules.laws.bindPart.entity;
package com.jero.modules.docking.bindPart.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -1,4 +1,4 @@
package com.jero.modules.laws.bindPart.entity;
package com.jero.modules.docking.bindPart.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -75,6 +75,12 @@ public class LawsBindPart implements Serializable {
@ApiModelProperty(value = "零部件号")
private String partNo;
/**
* 零部件分类码
*/
@ApiModelProperty(value = "零部件分类码")
private String partCategoryNum;
/**
* 零部件名称
*/
@@ -1,4 +1,4 @@
package com.jero.modules.laws.bindPart.entity;
package com.jero.modules.docking.bindPart.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -1,6 +1,6 @@
package com.jero.modules.laws.bindPart.mapper;
package com.jero.modules.docking.bindPart.mapper;
import com.jero.modules.laws.bindPart.entity.LawsBindPartDoc;
import com.jero.modules.docking.bindPart.entity.LawsBindPartDoc;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
@@ -1,8 +1,7 @@
package com.jero.modules.laws.bindPart.mapper;
package com.jero.modules.docking.bindPart.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.modules.laws.bindPart.entity.BindPartStandardVO;
import com.jero.modules.laws.bindPart.entity.LawsBindPart;
import com.jero.modules.docking.bindPart.entity.LawsBindPart;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
@@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.laws.bindPart.mapper.LawsBindPartDocMapper">
<mapper namespace="com.jero.modules.docking.bindPart.mapper.LawsBindPartDocMapper">
<resultMap id="BaseResultMap" type="com.jero.modules.laws.bindPart.entity.LawsBindPartDoc">
<resultMap id="BaseResultMap" type="com.jero.modules.docking.bindPart.entity.LawsBindPartDoc">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.laws.bindPart.mapper.LawsBindPartMapper">
<mapper namespace="com.jero.modules.docking.bindPart.mapper.LawsBindPartMapper">
<resultMap id="BaseResultMap" type="com.jero.modules.laws.bindPart.entity.LawsBindPart">
<resultMap id="BaseResultMap" type="com.jero.modules.docking.bindPart.entity.LawsBindPart">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
@@ -25,7 +25,7 @@
bind_user,bind_time
</sql>
<select id="page" resultType="com.jero.modules.laws.bindPart.entity.LawsBindPart">
<select id="page" resultType="com.jero.modules.docking.bindPart.entity.LawsBindPart">
SELECT
bp.id,
bp.part_no,
@@ -75,6 +75,8 @@
</if>
</where>
GROUP BY
bp.id
bp.id, bp.create_time
ORDER BY
bp.create_time DESC
</select>
</mapper>
@@ -1,6 +1,6 @@
package com.jero.modules.laws.bindPart.service;
package com.jero.modules.docking.bindPart.service;
import com.jero.modules.laws.bindPart.entity.LawsBindPartDoc;
import com.jero.modules.docking.bindPart.entity.LawsBindPartDoc;
import com.baomidou.mybatisplus.extension.service.IService;
/**
@@ -1,12 +1,10 @@
package com.jero.modules.laws.bindPart.service;
package com.jero.modules.docking.bindPart.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.modules.laws.bindPart.entity.BindPartStandardVO;
import com.jero.modules.laws.bindPart.entity.LawsBindPart;
import com.jero.modules.docking.bindPart.entity.BindPartStandardVO;
import com.jero.modules.docking.bindPart.entity.LawsBindPart;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.laws.system.entity.LawsContactManage;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@@ -22,10 +20,9 @@ public interface ILawsBindPartService extends IService<LawsBindPart> {
* @param lawsBindPart
* @param pageNo
* @param pageSize
* @param req
* @return
*/
IPage<LawsBindPart> queryPage(LawsBindPart lawsBindPart, Integer pageNo, Integer pageSize, HttpServletRequest req);
IPage<LawsBindPart> queryPage(LawsBindPart lawsBindPart, Integer pageNo, Integer pageSize);
/**
* 保存
@@ -75,4 +72,18 @@ public interface ILawsBindPartService extends IService<LawsBindPart> {
* @return
*/
IPage<BindPartStandardVO> selectStandard(BindPartStandardVO bindPartStandardVO, Integer pageNo, Integer pageSize);
/**
* 是否显示使用绑定关系按钮
* @param id
* @return
*/
LawsBindPart useBindRelation(String id);
/**
* 使用绑定关系
* @param lawsBindPart
* @return
*/
LawsBindPart isShowUseBindRelation(LawsBindPart lawsBindPart);
}
@@ -1,9 +1,9 @@
package com.jero.modules.laws.bindPart.service.impl;
package com.jero.modules.docking.bindPart.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.laws.bindPart.entity.LawsBindPartDoc;
import com.jero.modules.laws.bindPart.service.ILawsBindPartDocService;
import com.jero.modules.laws.bindPart.mapper.LawsBindPartDocMapper;
import com.jero.modules.docking.bindPart.entity.LawsBindPartDoc;
import com.jero.modules.docking.bindPart.mapper.LawsBindPartDocMapper;
import com.jero.modules.docking.bindPart.service.ILawsBindPartDocService;
import org.springframework.stereotype.Service;
/**
@@ -1,22 +1,22 @@
package com.jero.modules.laws.bindPart.service.impl;
package com.jero.modules.docking.bindPart.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.TableEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.activiti.process.common.enums.StandardStateEnum;
import com.jero.modules.laws.bindPart.entity.BindPartStandardVO;
import com.jero.modules.laws.bindPart.entity.LawsBindPart;
import com.jero.modules.laws.bindPart.entity.LawsBindPartDoc;
import com.jero.modules.laws.bindPart.service.ILawsBindPartDocService;
import com.jero.modules.laws.bindPart.service.ILawsBindPartService;
import com.jero.modules.laws.bindPart.mapper.LawsBindPartMapper;
import com.jero.modules.docking.bindPart.entity.BindPartStandardVO;
import com.jero.modules.docking.bindPart.entity.LawsBindPart;
import com.jero.modules.docking.bindPart.entity.LawsBindPartDoc;
import com.jero.modules.docking.bindPart.mapper.LawsBindPartMapper;
import com.jero.modules.docking.bindPart.service.ILawsBindPartDocService;
import com.jero.modules.docking.bindPart.service.ILawsBindPartService;
import com.jero.modules.docking.srms.service.SrmsApiService;
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
import com.jero.modules.laws.standard.controller.LawsDomesticController;
import com.jero.modules.laws.standard.controller.LawsOverseasController;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
@@ -26,11 +26,11 @@ import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
import com.jero.modules.onlyoffice.entity.StandardFileType;
import com.jero.modules.split.entity.SarFileSplitInfoEO;
import com.jero.modules.split.service.ISarFileSplitInfoService;
import com.jero.modules.sys.utils.UserUtils;
import com.jero.modules.tag.enums.TableNameEnum;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
@@ -63,8 +63,11 @@ public class LawsBindPartServiceImpl extends ServiceImpl<LawsBindPartMapper, Law
@Resource
private ILawsEnterpriseStandardService esService;
@Resource
private SrmsApiService srmsApiService;
@Override
public IPage<LawsBindPart> queryPage(LawsBindPart lawsBindPart, Integer pageNo, Integer pageSize, HttpServletRequest req) {
public IPage<LawsBindPart> queryPage(LawsBindPart lawsBindPart, Integer pageNo, Integer pageSize) {
IPage<LawsBindPart> page = new Page<>(pageNo, pageSize);
lawsBindPartMapper.page(page, lawsBindPart);
return page;
@@ -224,8 +227,60 @@ public class LawsBindPartServiceImpl extends ServiceImpl<LawsBindPartMapper, Law
return resultPage;
}
@Override
public LawsBindPart useBindRelation(String id) {
LawsBindPart bindPart = getById(id);
LawsBindPart newBindPart = BeanCopyUtils.copyBean(bindPart, LawsBindPart.class);
LoginUser currentUser = UserUtils.getCurrentUser();
newBindPart.setCreateBy(null);
newBindPart.setCreateTime(null);
newBindPart.setUpdateBy(null);
newBindPart.setUpdateTime(null);
newBindPart.setBindUser(currentUser.getId());
newBindPart.setBindTime(new Date());
newBindPart.setId(null);
save(newBindPart);
String newId = newBindPart.getId();
LambdaQueryWrapper<LawsBindPartDoc> lawsBindPartDocLambdaQueryWrapper = new LambdaQueryWrapper<>();
lawsBindPartDocLambdaQueryWrapper.eq(LawsBindPartDoc::getBindId, id);
List<LawsBindPartDoc> list = lawsBindPartDocService.list(lawsBindPartDocLambdaQueryWrapper);
list.forEach(b -> {
b.setId(null);
b.setBindId(newId);
});
lawsBindPartDocService.saveBatch(list);
return null;
}
/**
1如当前零部件绑定关系数据为空则查询法规绑定关系中 当前零部件分类树下是否有绑定关系无则进入序号3有则获取零部件分类零部件编号调用PDM的接口判断零部件编号是否在当前的零部件分类下
2在零部件分类下则 弹框文字提醒当前零部件分类结构下已有XXXX绑定标准关联关系是否引入对应关系XXXX指第一次绑定的零部件名称+编号
3如某分类的第一个零部件第一次绑定进入法规系统点击新增/编辑弹窗中自动带出零部件号零部件名称和绑定人员需要选择标准以及该标准下的条款其中标准为单选条款可以多选绑定成功后在列表最上方生成一条数据pdm可以获取到零部件绑定的全部标准信息
* @param lawsBindPart
* @return
*/
@Override
public LawsBindPart isShowUseBindRelation(LawsBindPart lawsBindPart) {
LambdaQueryWrapper<LawsBindPart> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(LawsBindPart::getPartCategoryNum, lawsBindPart.getPartCategoryNum());
List<LawsBindPart> list = this.list(lambdaQueryWrapper);
// 第一次绑定不显示使用绑定关系
if (list == null || list.isEmpty()) {
return null;
}
for (LawsBindPart existBind : list) {
// 调用PDM判断零部件编号是否在当前的零部件分类下
// boolean validPartBelong = srmsApiService.validPartBelong(lawsBindPart.getPartNo(), lawsBindPart.getPartName(), existBind.getPartCategoryNum());
boolean validPartBelong = true;
if (validPartBelong) {
return existBind;
}
// 零部件编号和零部件分类码绑定关系发生变更所以需要将系统中存储的所有该零部件号的零部件分类码清空
existBind.setPartCategoryNum(null);
updateById(existBind);
}
return null;
}
}
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.CommonConstant;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.docking.srms.entity.LawsPartStandard;
import com.jero.modules.docking.srms.service.SrmsApiService;
import com.jero.modules.docking.srms.vo.ByFileRows;
@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Objects;
/**
* @author lqt
@@ -187,4 +189,27 @@ public class SrmsApiController {
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper("操作失败",CommonConstant.SC_INTERNAL_SERVER_ERROR_500));
}
}
@AutoLog(value = "PDM获取零部件号绑定的法规数据信息")
@PostMapping("/bindPartStandardInfo")
public JSONObject getBindPartStandardInfo(@RequestBody JSONObject json) {
JSONObject messageHandler = JSON.parseObject(JSON.toJSONString(json.get(MESSAGE_HEADER)));
String uuid = messageHandler.get("UUID").toString();
try {
List<JSONObject> rows = srmsApiService.getBindPartStandardInfo(json);
JSONObject resultJson = new JSONObject();
resultJson.put("MessageHeader", srmsApiService.getMessageHandler("interface_id", uuid));
JSONObject jsonResponses = ResponsesUtil.getJsonOkUpper();
if (!Objects.isNull(rows)) {
jsonResponses.put("Rows", rows);
}
resultJson.put("Responses", jsonResponses);
return resultJson;
} catch (Exception e) {
log.error("PDM获取零部件号绑定的法规数据信息异常:", e);
return ResponsesUtil.getJsonResult(
srmsApiService.getMessageHandler("interface_id", uuid),
ResponsesUtil.getJsonErrUpper("操作失败", CommonConstant.SC_INTERNAL_SERVER_ERROR_500));
}
}
}
@@ -6,6 +6,7 @@ import com.jero.common.api.vo.Result;
import com.jero.modules.docking.srms.vo.ByFileRows;
import com.jero.modules.docking.srms.vo.StandardPageVO;
import com.jero.modules.docking.srms.vo.StandardTree;
import com.jero.modules.docking.bindPart.entity.LawsBindPart;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@@ -103,4 +104,37 @@ public interface SrmsApiService {
*/
Result<List<JSONObject>> getEStandardInfo(JSONObject json, HttpServletRequest req);
/**
* 获取固定的MessageHandler
* @param interfaceId
* @return com.jero.common.api.vo.Result<java.util.List<com.alibaba.fastjson.JSONObject>>
*/
JSONObject getMessageHandler(String interfaceId, String uuid);
/**
* PDM验证零部件号是否可修改
*
* @return com.jero.common.api.vo.Result<java.util.List < com.alibaba.fastjson.JSONObject>>
* @author CHH
* @date 2024/4/28 15:08
*/
boolean validPartNoEdit(String partNo, String partName, String bindUserInfo);
/**
* PDM校验某个零部件是否所属于某个零部件分类
* @author CHH
* @date 2024/4/28 15:08
* @return com.jero.common.api.vo.Result<java.util.List<com.alibaba.fastjson.JSONObject>>
*/
boolean validPartBelong(String partNo, String partName, String partCategoryNum);
/**
* 获取零部件号绑定的法规数据
* @author CHH
* @date 2024/4/28 15:08
* @param json
* @return com.jero.common.api.vo.Result<java.util.List<com.alibaba.fastjson.JSONObject>>
*/
List<JSONObject> getBindPartStandardInfo(JSONObject json);
}
@@ -1,5 +1,6 @@
package com.jero.modules.docking.srms.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -10,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.CaseFormat;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.MD5Util;
@@ -24,10 +26,14 @@ import com.jero.modules.docking.srms.service.ILawsPartStandardService;
import com.jero.modules.docking.srms.service.ILawsSysApiInfoService;
import com.jero.modules.docking.srms.service.SrmsApiService;
import com.jero.modules.docking.srms.vo.*;
import com.jero.modules.docking.bindPart.entity.LawsBindPart;
import com.jero.modules.docking.bindPart.service.ILawsBindPartService;
import com.jero.modules.laws.documenttool.entity.LawsDocumentSplit;
import com.jero.modules.laws.documenttool.mapper.LawsDocumentSplitMapper;
import com.jero.modules.laws.enterprise.entity.vo.LawsTreeNodeModel;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.entity.PartName;
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
import com.jero.modules.laws.standard.service.ILawsTreeNodeService;
import com.jero.modules.laws.standard.service.PartNameService;
import com.jero.modules.oss.entity.OSSFile;
@@ -93,6 +99,12 @@ public class SrmsApiServiceImpl implements SrmsApiService {
@Resource
private RestTemplate restTemplate;
@Resource
private ILawsBindPartService lawsBindPartService;
@Resource
private ILawsEnterpriseStandardService esService;
@Value("${srms.font_url_pdf}")
private String fontUrlPdf;
@Value("${srms.back_url_pdf}")
@@ -110,7 +122,18 @@ public class SrmsApiServiceImpl implements SrmsApiService {
@Value("${srms.part_standard_url}")
private String partStandardUrl;
@Value("${bindPart.pdm_Ip}")
private String pdmIp;
@Value("${bindPart.edit_valid_url}")
private String editValidUrl;
@Value("${bindPart.part_belong_url}")
private String partBelongUrl;
private static final String REQUESTS = "Requests";
private static final String MESSAGE_HANDLER = "MessageHeader";
private static final String SYS_ERR = "访问受限,token授权过期";
private static final String STANDARD_NAME = "standardName";
private static final String STANDARD_NUMBER = "standardNumber";
@@ -741,4 +764,123 @@ public class SrmsApiServiceImpl implements SrmsApiService {
return Result.error("操作失败" + e.getMessage());
}
}
@Override
public JSONObject getMessageHandler(String interfaceId, String uuid) {
if (StrUtil.isBlank(uuid)) {
uuid = UUID.randomUUID().toString();
}
JSONObject messageHeader = new JSONObject();
String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
messageHeader.put("Interface_ID", interfaceId);
messageHeader.put("UUID", uuid);
messageHeader.put("MessageId", "");
messageHeader.put("Sender", "SRMS");
messageHeader.put("Receiver", "PDM");
messageHeader.put("SendDate", date.substring(0, 8));
messageHeader.put("SendTime", date.substring(8));
return messageHeader;
}
@Override
public boolean validPartNoEdit(String partNo, String partName, String bindUserInfo) {
try {
JSONObject all = new JSONObject();
// todo Interface_IDUUID
all.put(MESSAGE_HANDLER, getMessageHandler("interfaceId", null));
JSONObject requests = new JSONObject();
requests.put("PartNum", partNo);
requests.put("PartName", partName);
requests.put("BindUserInfo", bindUserInfo);
requests.put("Remark1", "");
requests.put("Remark2", "");
requests.put("Remark3", "");
all.put(REQUESTS, requests);
// todo url
JSONObject reData = restTemplate.postForObject(pdmIp + editValidUrl, all, JSONObject.class);
log.info(JSON.toJSONString(reData));
if (!Objects.isNull(reData) && reData.containsKey("Success")) {
String success = reData.getString("Success");
if ("true".equals(success)) {
log.info("验证零部件号是否可修改接口成功");
return true;
}
if ("false".equals(success)) {
log.error("验证零部件号是否可修改接口失败");
return false;
}
}
} catch (Exception e) {
log.error("验证零部件号是否可修改异常", e);
}
return false;
}
@Override
public boolean validPartBelong(String partNo, String partName, String partCategoryNum) {
try {
JSONObject all = new JSONObject();
// todo Interface_IDUUID
all.put(MESSAGE_HANDLER, getMessageHandler("interfaceId", null));
JSONObject requests = new JSONObject();
requests.put("PartNum", partNo);
requests.put("PartName", partName);
requests.put("PartCategoryNum", partCategoryNum);
requests.put("PartCategoryName", "");
requests.put("Remark1", "");
requests.put("Remark2", "");
requests.put("Remark3", "");
all.put(REQUESTS, requests);
// todo url
JSONObject reData = restTemplate.postForObject(pdmIp + partBelongUrl, all, JSONObject.class);
log.info(JSON.toJSONString(reData));
if (!Objects.isNull(reData) && reData.containsKey("Success")) {
String success = reData.getString("Success");
if ("true".equals(success)) {
log.info("校验某个零部件是否所属于某个零部件分类接口成功");
return true;
}
if ("false".equals(success)) {
log.error("校验某个零部件是否所属于某个零部件分类接口失败");
return false;
}
}
} catch (Exception e) {
log.error("校验某个零部件是否所属于某个零部件分类异常", e);
}
return false;
}
@Override
public List<JSONObject> getBindPartStandardInfo(JSONObject json) {
JSONObject requests = JSON.parseObject(JSON.toJSONString(json.get(REQUESTS)));
String partNum = requests.get("PartNum").toString();
if (StrUtil.isBlank(partNum)) {
throw new JeroBootException("零部件编号PartNum不能为空");
}
LawsBindPart lawsBindPart = new LawsBindPart();
lawsBindPart.setPartNo(partNum);
LambdaQueryWrapper<LawsBindPart> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(LawsBindPart::getPartNo, partNum);
List<LawsBindPart> lawsBindPartList = lawsBindPartService.list(lambdaQueryWrapper);
List<JSONObject> listObj = new ArrayList<>();
if (!CollectionUtils.isEmpty(lawsBindPartList)) {
// 设置标准名称
Set<String> standardIdSet = lawsBindPartList.stream().map(LawsBindPart::getStandardId).collect(Collectors.toSet());
List<LawsEnterpriseStandard> lawsStandardList = esService.listByIds(standardIdSet);
for (LawsEnterpriseStandard es : lawsStandardList) {
JSONObject rows = new JSONObject();
rows.put("PartNum", lawsBindPartList.get(0).getPartName());
rows.put("PartName", lawsBindPartList.get(0).getPartName());
rows.put("StandardNumber", es.getStandardNumber());
rows.put("StandardName", es.getStandardName());
rows.put("Remark1", "");
rows.put("Remark2", "");
rows.put("Remark3", "");
listObj.add(rows);
}
}
return listObj;
}
}