Merge branch 'thirdApiStage' into fourthStage
This commit is contained in:
@@ -162,6 +162,8 @@ public class ShiroConfig {
|
|||||||
filterChainDefinitionMap.put("/srms/getByLawsSystem", "anon");
|
filterChainDefinitionMap.put("/srms/getByLawsSystem", "anon");
|
||||||
// 分页查询标准数据
|
// 分页查询标准数据
|
||||||
filterChainDefinitionMap.put("/srms/getByLawsStandardPage", "anon");
|
filterChainDefinitionMap.put("/srms/getByLawsStandardPage", "anon");
|
||||||
|
// 分页查询标准数据
|
||||||
|
filterChainDefinitionMap.put("/srms/syncPartData", "anon");
|
||||||
|
|
||||||
// 添加自己的过滤器并且取名为jwt
|
// 添加自己的过滤器并且取名为jwt
|
||||||
Map<String, Filter> filterMap = new HashMap<>(1);
|
Map<String, Filter> filterMap = new HashMap<>(1);
|
||||||
|
|||||||
+17
-13
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.aspect.annotation.AutoLog;
|
import com.jero.common.aspect.annotation.AutoLog;
|
||||||
import com.jero.common.constant.CommonConstant;
|
import com.jero.common.constant.CommonConstant;
|
||||||
|
import com.jero.modules.docking.srms.entity.LawsPartStandard;
|
||||||
import com.jero.modules.docking.srms.service.SrmsApiService;
|
import com.jero.modules.docking.srms.service.SrmsApiService;
|
||||||
import com.jero.modules.docking.srms.vo.ByFileRows;
|
import com.jero.modules.docking.srms.vo.ByFileRows;
|
||||||
import com.jero.modules.docking.srms.vo.StandardPageVO;
|
import com.jero.modules.docking.srms.vo.StandardPageVO;
|
||||||
@@ -37,6 +38,7 @@ public class SrmsApiController {
|
|||||||
private SrmsApiService srmsApiService;
|
private SrmsApiService srmsApiService;
|
||||||
|
|
||||||
private static final String MESSAGE_HEADER = "MessageHeader";
|
private static final String MESSAGE_HEADER = "MessageHeader";
|
||||||
|
private static final String RESULT = "Result";
|
||||||
|
|
||||||
@ApiOperation("获取token")
|
@ApiOperation("获取token")
|
||||||
@AutoLog(value = "获取token")
|
@AutoLog(value = "获取token")
|
||||||
@@ -48,7 +50,7 @@ public class SrmsApiController {
|
|||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage(),re.getCode()));
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage(),re.getCode()));
|
||||||
}
|
}
|
||||||
String token = re.getResult().get("token").toString();
|
String token = re.getResult().get("token").toString();
|
||||||
JSONObject jsonResponses = ResponsesUtil.getJsonOk();
|
JSONObject jsonResponses = ResponsesUtil.getJsonOk(re.getMessage());
|
||||||
jsonResponses.put("token",token);
|
jsonResponses.put("token",token);
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
@@ -67,7 +69,7 @@ public class SrmsApiController {
|
|||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage(),re.getCode()));
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage(),re.getCode()));
|
||||||
}
|
}
|
||||||
List<ByFileRows> list = re.getResult();
|
List<ByFileRows> list = re.getResult();
|
||||||
JSONObject jsonResponses = ResponsesUtil.getJsonOk();
|
JSONObject jsonResponses = ResponsesUtil.getJsonOk(re.getMessage());
|
||||||
jsonResponses.put("Rows",list);
|
jsonResponses.put("Rows",list);
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
@@ -86,7 +88,7 @@ public class SrmsApiController {
|
|||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage(),re.getCode()));
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage(),re.getCode()));
|
||||||
}
|
}
|
||||||
List<JSONObject> list = re.getResult();
|
List<JSONObject> list = re.getResult();
|
||||||
JSONObject jsonResponses = ResponsesUtil.getJsonOk();
|
JSONObject jsonResponses = ResponsesUtil.getJsonOk(re.getMessage());
|
||||||
jsonResponses.put("Rows",list);
|
jsonResponses.put("Rows",list);
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
@@ -105,8 +107,8 @@ public class SrmsApiController {
|
|||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage(),re.getCode()));
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage(),re.getCode()));
|
||||||
}
|
}
|
||||||
List<StandardTree> list = re.getResult();
|
List<StandardTree> list = re.getResult();
|
||||||
JSONObject jsonResponses = ResponsesUtil.getJsonOk();
|
JSONObject jsonResponses = ResponsesUtil.getJsonOk(re.getMessage());
|
||||||
jsonResponses.put("result",JSON.toJSONString(list));
|
jsonResponses.put(RESULT,JSON.toJSONString(list));
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("获取所有体系数据异常:",e);
|
log.error("获取所有体系数据异常:",e);
|
||||||
@@ -130,8 +132,8 @@ public class SrmsApiController {
|
|||||||
jsonPage.put("size",page.getSize());
|
jsonPage.put("size",page.getSize());
|
||||||
jsonPage.put("total",page.getTotal());
|
jsonPage.put("total",page.getTotal());
|
||||||
jsonPage.put("Rows_Result",page.getRecords());
|
jsonPage.put("Rows_Result",page.getRecords());
|
||||||
JSONObject jsonResponses = ResponsesUtil.getJsonOk();
|
JSONObject jsonResponses = ResponsesUtil.getJsonOk(re.getMessage());
|
||||||
jsonResponses.put("Result",jsonPage);
|
jsonResponses.put(RESULT,jsonPage);
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("分页查询标准数据异常:",e);
|
log.error("分页查询标准数据异常:",e);
|
||||||
@@ -139,7 +141,7 @@ public class SrmsApiController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ApiOperation("零部件分类树同步接口")
|
@ApiOperation("零部件分类树同步接口")
|
||||||
@AutoLog(value = "零部件分类树同步接口")
|
@AutoLog(value = "零部件分类树同步接口")
|
||||||
@PostMapping("/syncPartData")
|
@PostMapping("/syncPartData")
|
||||||
public JSONObject syncPartData(@RequestBody JSONObject json, HttpServletRequest req){
|
public JSONObject syncPartData(@RequestBody JSONObject json, HttpServletRequest req){
|
||||||
@@ -148,8 +150,8 @@ public class SrmsApiController {
|
|||||||
if(!re.isSuccess()){
|
if(!re.isSuccess()){
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper(re.getMessage(),re.getCode()));
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper(re.getMessage(),re.getCode()));
|
||||||
}
|
}
|
||||||
JSONObject jsonResponses = ResponsesUtil.getJsonOkUpper();
|
JSONObject jsonResponses = ResponsesUtil.getJsonOkUpper(re.getMessage());
|
||||||
jsonResponses.put("Result",re.getResult());
|
jsonResponses.put(RESULT,re.getResult());
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("零部件分类树同步接口异常:",e);
|
log.error("零部件分类树同步接口异常:",e);
|
||||||
@@ -157,7 +159,10 @@ public class SrmsApiController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/syncPartStandard")
|
||||||
|
public Result<String> syncPartStandard(){
|
||||||
|
return srmsApiService.syncPartStandard();
|
||||||
|
}
|
||||||
|
|
||||||
// @ApiOperation("E采通获取标准信息")
|
// @ApiOperation("E采通获取标准信息")
|
||||||
@AutoLog(value = "E采通获取标准信息")
|
@AutoLog(value = "E采通获取标准信息")
|
||||||
@@ -169,10 +174,9 @@ public class SrmsApiController {
|
|||||||
if(!re.isSuccess()){
|
if(!re.isSuccess()){
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper(re.getMessage(),re.getCode()));
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper(re.getMessage(),re.getCode()));
|
||||||
}
|
}
|
||||||
List<JSONObject> page = re.getResult();
|
|
||||||
JSONObject jsonPage = new JSONObject();
|
JSONObject jsonPage = new JSONObject();
|
||||||
JSONObject jsonResponses = ResponsesUtil.getJsonOkUpper();
|
JSONObject jsonResponses = ResponsesUtil.getJsonOkUpper();
|
||||||
jsonResponses.put("Result",jsonPage);
|
jsonResponses.put(RESULT,jsonPage);
|
||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("E采通获取标准信息异常:",e);
|
log.error("E采通获取标准信息异常:",e);
|
||||||
|
|||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
package com.jero.modules.docking.srms.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/30 14:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LawsPartStandard implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**主键ID*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键ID")
|
||||||
|
private String id;
|
||||||
|
/**标准id*/
|
||||||
|
@ApiModelProperty(value = "标准id")
|
||||||
|
private String standardId;
|
||||||
|
/**分类内部码*/
|
||||||
|
@ApiModelProperty(value = "分类内部码")
|
||||||
|
private String partCategoryNum;
|
||||||
|
/**标准分类:设计规范:1释放规范:2*/
|
||||||
|
@ApiModelProperty(value = "标准分类:设计规范:1释放规范:2")
|
||||||
|
private String standardPdmType;
|
||||||
|
/**标准编号*/
|
||||||
|
@ApiModelProperty(value = "标准编号")
|
||||||
|
private String standardNumber;
|
||||||
|
/**备用字段1*/
|
||||||
|
@ApiModelProperty(value = "备用字段1")
|
||||||
|
private String remark1;
|
||||||
|
/**备用字段2*/
|
||||||
|
@ApiModelProperty(value = "备用字段2")
|
||||||
|
private String remark2;
|
||||||
|
/**备用字段3*/
|
||||||
|
@ApiModelProperty(value = "备用字段3")
|
||||||
|
private String remark3;
|
||||||
|
/**创建人*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
/**创建日期*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy年MM月dd日 EEEE")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建日期")
|
||||||
|
private Date createTime;
|
||||||
|
/**更新人*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
/**更新日期*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新日期")
|
||||||
|
private Date updateTime;
|
||||||
|
/**删除状态(0-正常,1-删除)*/
|
||||||
|
@ApiModelProperty(value = "删除状态(0-正常,1-删除)")
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package com.jero.modules.docking.srms.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jero.modules.docking.srms.entity.LawsPartStandard;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-10-18
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface LawsPartStandardMapper extends BaseMapper<LawsPartStandard> {
|
||||||
|
|
||||||
|
}
|
||||||
+21
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.jero.modules.docking.srms.entity.LawsPartStandard;
|
||||||
import com.jero.modules.docking.srms.vo.ByFileRows;
|
import com.jero.modules.docking.srms.vo.ByFileRows;
|
||||||
import com.jero.modules.docking.srms.vo.StandardPageVO;
|
import com.jero.modules.docking.srms.vo.StandardPageVO;
|
||||||
import com.jero.modules.docking.srms.vo.StandardVO;
|
import com.jero.modules.docking.srms.vo.StandardVO;
|
||||||
@@ -45,4 +46,24 @@ public interface LawsStandardMapper{
|
|||||||
IPage<StandardPageVO> getByLawsStandardPage(Page<StandardPageVO> page,
|
IPage<StandardPageVO> getByLawsStandardPage(Page<StandardPageVO> page,
|
||||||
@Param(Constants.WRAPPER) QueryWrapper<StandardPageVO> queryWrapper);
|
@Param(Constants.WRAPPER) QueryWrapper<StandardPageVO> queryWrapper);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新父级id
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/30 15:07
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void updatePartParentId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有 标准分类:
|
||||||
|
* 设计规范:1
|
||||||
|
* 释放规范:2 (系统中编码为4)
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/30 16:51
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
List<LawsPartStandard> getSyncPartStandard();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
<?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.docking.srms.mapper.LawsPartStandardMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
+27
@@ -141,5 +141,32 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getSyncPartStandard" resultType="com.jero.modules.docking.srms.entity.LawsPartStandard">
|
||||||
|
SELECT
|
||||||
|
a.id as standard_id,
|
||||||
|
a.standard_number as standard_number,
|
||||||
|
a.standard_class as standard_pdm_type,
|
||||||
|
substring_index(substring_index(a.part_name, ',', b.help_topic_id + 1), ',', - 1) as part_category_num
|
||||||
|
FROM (
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
standard_number,
|
||||||
|
case when standard_class = 4 then 2 else standard_class end as standard_class,
|
||||||
|
part_name
|
||||||
|
from laws_enterprise_standard where standard_class in (1,4) and del_flag = 0 and part_name is not null
|
||||||
|
) a
|
||||||
|
INNER JOIN mysql.help_topic b
|
||||||
|
ON b.help_topic_id < (length(a.part_name) - length(REPLACE(a.part_name, ',', '')) + 1)
|
||||||
|
union all
|
||||||
|
(select
|
||||||
|
id as standard_id,
|
||||||
|
standard_number,
|
||||||
|
case when standard_class = 4 then 2 else standard_class end as standard_class,
|
||||||
|
part_name
|
||||||
|
from laws_enterprise_standard where standard_class in (1,4) and del_flag = 0 and ISNULL(part_name))
|
||||||
|
</select>
|
||||||
|
<update id="updatePartParentId">
|
||||||
|
update laws_part_name l1 set parent_id = (select id from (select id from laws_part_name l2 where l2.code = l1.parent_code) aa)
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
package com.jero.modules.docking.srms.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jero.modules.docking.srms.entity.LawsPartStandard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 系统对接信息
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-10-18
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface ILawsPartStandardService extends IService<LawsPartStandard> {
|
||||||
|
|
||||||
|
}
|
||||||
+17
@@ -76,6 +76,23 @@ public interface SrmsApiService {
|
|||||||
*/
|
*/
|
||||||
Result<String> syncPartData(JSONObject json, HttpServletRequest req);
|
Result<String> syncPartData(JSONObject json, HttpServletRequest req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类树标准法规回写
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/26 16:05
|
||||||
|
* @return com.jero.common.api.vo.Result<java.lang.String>
|
||||||
|
*/
|
||||||
|
Result<String> syncPartStandard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送分类树标准法规
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/30 17:15
|
||||||
|
* @param
|
||||||
|
* @return com.jero.common.api.vo.Result<java.lang.String>
|
||||||
|
*/
|
||||||
|
void sendPartStandard();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* E采通获取标准信息
|
* E采通获取标准信息
|
||||||
* @author LQT
|
* @author LQT
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package com.jero.modules.docking.srms.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jero.modules.docking.srms.entity.LawsPartStandard;
|
||||||
|
import com.jero.modules.docking.srms.mapper.LawsPartStandardMapper;
|
||||||
|
import com.jero.modules.docking.srms.service.ILawsPartStandardService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-10-18
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ILawsPartStandardServiceImpl extends ServiceImpl<LawsPartStandardMapper, LawsPartStandard> implements ILawsPartStandardService {
|
||||||
|
|
||||||
|
}
|
||||||
+142
-7
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
@@ -16,8 +17,10 @@ import com.jero.common.util.RedisUtil;
|
|||||||
import com.jero.common.util.TokenUtils;
|
import com.jero.common.util.TokenUtils;
|
||||||
import com.jero.modules.docking.srms.dto.ByTokenRequests;
|
import com.jero.modules.docking.srms.dto.ByTokenRequests;
|
||||||
import com.jero.modules.docking.srms.dto.ProductDesign;
|
import com.jero.modules.docking.srms.dto.ProductDesign;
|
||||||
|
import com.jero.modules.docking.srms.entity.LawsPartStandard;
|
||||||
import com.jero.modules.docking.srms.entity.LawsSysApiInfo;
|
import com.jero.modules.docking.srms.entity.LawsSysApiInfo;
|
||||||
import com.jero.modules.docking.srms.mapper.LawsStandardMapper;
|
import com.jero.modules.docking.srms.mapper.LawsStandardMapper;
|
||||||
|
import com.jero.modules.docking.srms.service.ILawsPartStandardService;
|
||||||
import com.jero.modules.docking.srms.service.ILawsSysApiInfoService;
|
import com.jero.modules.docking.srms.service.ILawsSysApiInfoService;
|
||||||
import com.jero.modules.docking.srms.service.SrmsApiService;
|
import com.jero.modules.docking.srms.service.SrmsApiService;
|
||||||
import com.jero.modules.docking.srms.vo.*;
|
import com.jero.modules.docking.srms.vo.*;
|
||||||
@@ -43,11 +46,13 @@ import org.apache.shiro.SecurityUtils;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -83,6 +88,10 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
private PartNameService partNameService;
|
private PartNameService partNameService;
|
||||||
@Resource
|
@Resource
|
||||||
private ILawsSysApiInfoService lawsSysApiInfoService;
|
private ILawsSysApiInfoService lawsSysApiInfoService;
|
||||||
|
@Resource
|
||||||
|
private ILawsPartStandardService lawsPartStandardService;
|
||||||
|
@Resource
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
@Value("${srms.font_url_pdf}")
|
@Value("${srms.font_url_pdf}")
|
||||||
private String fontUrlPdf;
|
private String fontUrlPdf;
|
||||||
@@ -98,6 +107,8 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
private String ettonSysCode;
|
private String ettonSysCode;
|
||||||
@Value("${srms.etton_sys_user}")
|
@Value("${srms.etton_sys_user}")
|
||||||
private String ettonSysUser;
|
private String ettonSysUser;
|
||||||
|
@Value("${srms.part_standard_url}")
|
||||||
|
private String partStandardUrl;
|
||||||
|
|
||||||
private static final String REQUESTS = "Requests";
|
private static final String REQUESTS = "Requests";
|
||||||
private static final String SYS_ERR = "访问受限,token授权过期";
|
private static final String SYS_ERR = "访问受限,token授权过期";
|
||||||
@@ -106,6 +117,12 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
private static final String PUBLISH_OF_ORIGINAL = "publish_of_original";
|
private static final String PUBLISH_OF_ORIGINAL = "publish_of_original";
|
||||||
private static final String X_ACCESS_TOKEN = "X-Access-Token";
|
private static final String X_ACCESS_TOKEN = "X-Access-Token";
|
||||||
private static final String ADD_NOT_NULL = "必填项不能为空";
|
private static final String ADD_NOT_NULL = "必填项不能为空";
|
||||||
|
private static final String PART_CATEGROY_NUM = "PartCategroyNum";
|
||||||
|
private static final String PART_CATEGROY_NAME = "PartCategroyName";
|
||||||
|
private static final String PARENT_NUM = "ParentNum";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<JSONObject> getByToken(JSONObject json) {
|
public Result<JSONObject> getByToken(JSONObject json) {
|
||||||
@@ -146,6 +163,7 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
// 验证token
|
// 验证token
|
||||||
String token = req.getHeader(X_ACCESS_TOKEN);
|
String token = req.getHeader(X_ACCESS_TOKEN);
|
||||||
try {
|
try {
|
||||||
|
log.info("token============================" + token);
|
||||||
// 验证Token有效性
|
// 验证Token有效性
|
||||||
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
||||||
if(!tokenOK){
|
if(!tokenOK){
|
||||||
@@ -291,6 +309,8 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
public Result<List<JSONObject>> getByLawsProductDesign(JSONObject json, HttpServletRequest req) {
|
public Result<List<JSONObject>> getByLawsProductDesign(JSONObject json, HttpServletRequest req) {
|
||||||
// 验证token
|
// 验证token
|
||||||
try {
|
try {
|
||||||
|
String token = req.getHeader(X_ACCESS_TOKEN);
|
||||||
|
log.info("token============================" + token);
|
||||||
// 验证Token有效性
|
// 验证Token有效性
|
||||||
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
||||||
if(!tokenOK){
|
if(!tokenOK){
|
||||||
@@ -346,6 +366,8 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
public Result<List<StandardTree>> getByLawsSystem(JSONObject json, HttpServletRequest req) {
|
public Result<List<StandardTree>> getByLawsSystem(JSONObject json, HttpServletRequest req) {
|
||||||
// 验证token
|
// 验证token
|
||||||
try {
|
try {
|
||||||
|
String token = req.getHeader(X_ACCESS_TOKEN);
|
||||||
|
log.info("token============================" + token);
|
||||||
// 验证Token有效性
|
// 验证Token有效性
|
||||||
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
||||||
if(!tokenOK){
|
if(!tokenOK){
|
||||||
@@ -429,6 +451,7 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
// 验证token
|
// 验证token
|
||||||
String token = req.getHeader(X_ACCESS_TOKEN);
|
String token = req.getHeader(X_ACCESS_TOKEN);
|
||||||
try {
|
try {
|
||||||
|
log.info("token============================" + token);
|
||||||
// 验证Token有效性
|
// 验证Token有效性
|
||||||
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
||||||
if(!tokenOK){
|
if(!tokenOK){
|
||||||
@@ -580,12 +603,129 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<String> syncPartData(JSONObject json, HttpServletRequest req) {
|
||||||
|
try {
|
||||||
|
String token = req.getHeader(X_ACCESS_TOKEN);
|
||||||
|
log.info("token============================" + token);
|
||||||
|
// 验证Token有效性
|
||||||
|
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
||||||
|
if(!tokenOK){
|
||||||
|
return Result.error(403,SYS_ERR);
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
return Result.error(403,SYS_ERR);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
JSONObject requests = JSON.parseObject(JSON.toJSONString(json.get(REQUESTS)));
|
||||||
|
JSONArray rows = JSON.parseArray(JSON.toJSONString(requests.get("Rows")));
|
||||||
|
if(CollectionUtils.isEmpty(rows)){
|
||||||
|
return Result.error(ADD_NOT_NULL);
|
||||||
|
}
|
||||||
|
List<PartName> listPartName = new ArrayList<>();
|
||||||
|
for (Object request : rows) {
|
||||||
|
JSONObject js = JSON.parseObject(JSON.toJSONString(request));
|
||||||
|
if(!js.containsKey(PART_CATEGROY_NUM) || !js.containsKey(PART_CATEGROY_NAME) || !js.containsKey(PARENT_NUM)){
|
||||||
|
return Result.error(ADD_NOT_NULL);
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(js.getString(PART_CATEGROY_NUM))
|
||||||
|
|| StringUtils.isBlank(js.getString(PART_CATEGROY_NAME))
|
||||||
|
|| StringUtils.isBlank(js.getString(PARENT_NUM))){
|
||||||
|
return Result.error(ADD_NOT_NULL);
|
||||||
|
}
|
||||||
|
PartName partName = new PartName();
|
||||||
|
partName.setCode(js.getString(PART_CATEGROY_NUM));
|
||||||
|
partName.setName(js.getString(PART_CATEGROY_NAME));
|
||||||
|
partName.setParentCode(js.getString(PARENT_NUM));
|
||||||
|
partName.setRemark1(js.getString("Remark1"));
|
||||||
|
partName.setRemark2(js.getString("Remark2"));
|
||||||
|
partName.setRemark3(js.getString("Remark3"));
|
||||||
|
listPartName.add(partName);
|
||||||
|
}
|
||||||
|
if(!CollectionUtils.isEmpty(listPartName)){
|
||||||
|
// 清空数据
|
||||||
|
LambdaUpdateWrapper<PartName> updatePartName = new LambdaUpdateWrapper<>();
|
||||||
|
updatePartName.eq(PartName::getDelFlag,"0");
|
||||||
|
partNameService.remove(updatePartName);
|
||||||
|
// 保存数据
|
||||||
|
partNameService.saveBatch(listPartName);
|
||||||
|
// 更新父级id
|
||||||
|
lawsStandardMapper.updatePartParentId();
|
||||||
|
}
|
||||||
|
return Result.OK("操作成功");
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("零部件分类树同步接口异常:",e);
|
||||||
|
return Result.error("操作失败" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<String> syncPartStandard() {
|
||||||
|
// 清理数据
|
||||||
|
LambdaUpdateWrapper<LawsPartStandard> updateLawsPartStandard = new LambdaUpdateWrapper<>();
|
||||||
|
updateLawsPartStandard.eq(LawsPartStandard::getDelFlag,"0");
|
||||||
|
lawsPartStandardService.remove(updateLawsPartStandard);
|
||||||
|
// 同步数据到分类树标准法规回写表
|
||||||
|
List<LawsPartStandard> listLawsPartStandard = lawsStandardMapper.getSyncPartStandard();
|
||||||
|
lawsPartStandardService.saveBatch(listLawsPartStandard);
|
||||||
|
return Result.OK("操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPartStandard() {
|
||||||
|
try {
|
||||||
|
List<LawsPartStandard> listLawsPartStandard = lawsPartStandardService.list();
|
||||||
|
JSONObject all = new JSONObject();
|
||||||
|
JSONObject messageHeader = new JSONObject();
|
||||||
|
String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||||
|
// todo Interface_ID,UUID
|
||||||
|
messageHeader.put("Interface_ID","");
|
||||||
|
messageHeader.put("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));
|
||||||
|
all.put("MessageHeader",messageHeader);
|
||||||
|
List<JSONObject> listObj = new ArrayList<>();
|
||||||
|
if(!CollectionUtils.isEmpty(listLawsPartStandard)){
|
||||||
|
for (LawsPartStandard lawsPartStandard : listLawsPartStandard) {
|
||||||
|
JSONObject rows = new JSONObject();
|
||||||
|
rows.put(PART_CATEGROY_NUM,lawsPartStandard.getPartCategoryNum());
|
||||||
|
rows.put("StandardPdmType",lawsPartStandard.getStandardPdmType());
|
||||||
|
rows.put("StandardNumber",lawsPartStandard.getStandardNumber());
|
||||||
|
rows.put("Remark1",lawsPartStandard.getRemark1());
|
||||||
|
rows.put("Remark2",lawsPartStandard.getRemark2());
|
||||||
|
rows.put("Remark3",lawsPartStandard.getRemark3());
|
||||||
|
listObj.add(rows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSONObject requests = new JSONObject();
|
||||||
|
requests.put("Rows",listObj);
|
||||||
|
all.put(REQUESTS,requests);
|
||||||
|
// todo url
|
||||||
|
JSONObject reData = restTemplate.postForObject(partStandardUrl,all,JSONObject.class);
|
||||||
|
log.info(JSON.toJSONString(reData));
|
||||||
|
if(!Objects.isNull(reData) && reData.containsKey("Success") && Objects.equals("true",reData.getString("Success"))){
|
||||||
|
log.info("分类树标准法规回写接口成功");
|
||||||
|
}else{
|
||||||
|
log.error("分类树标准法规回写接口失败");
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("分类树标准法规回写接口失败",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<List<JSONObject>> getEStandardInfo(JSONObject json, HttpServletRequest req) {
|
public Result<List<JSONObject>> getEStandardInfo(JSONObject json, HttpServletRequest req) {
|
||||||
// 验证token
|
// 验证token
|
||||||
String token = req.getHeader(X_ACCESS_TOKEN);
|
try {
|
||||||
if(StringUtils.isBlank(token) || !Objects.equals(TokenUtils.getTokenByRequest(req),token)){
|
// 验证Token有效性
|
||||||
|
boolean tokenOK = TokenUtils.verifyToken(req, sysBaseAPI, redisUtil);
|
||||||
|
if(!tokenOK){
|
||||||
|
return Result.error(403,SYS_ERR);
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
return Result.error(403,SYS_ERR);
|
return Result.error(403,SYS_ERR);
|
||||||
}
|
}
|
||||||
JSONObject requests = JSON.parseObject(JSON.toJSONString(json.get(REQUESTS)));
|
JSONObject requests = JSON.parseObject(JSON.toJSONString(json.get(REQUESTS)));
|
||||||
@@ -611,9 +751,4 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
return Result.error("操作失败" + e.getMessage());
|
return Result.error("操作失败" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<String> syncPartData(JSONObject json, HttpServletRequest req) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,21 @@ public class PartName implements Serializable {
|
|||||||
@ApiModelProperty(value = "一级节点")
|
@ApiModelProperty(value = "一级节点")
|
||||||
private String firstNode;
|
private String firstNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级分类内部码(根节点0)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "父级分类内部码(根节点0)")
|
||||||
|
private String parentCode;
|
||||||
|
/**备用字段1*/
|
||||||
|
@ApiModelProperty(value = "备用字段1")
|
||||||
|
private String remark1;
|
||||||
|
/**备用字段2*/
|
||||||
|
@ApiModelProperty(value = "备用字段2")
|
||||||
|
private String remark2;
|
||||||
|
/**备用字段3*/
|
||||||
|
@ApiModelProperty(value = "备用字段3")
|
||||||
|
private String remark3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子零部件
|
* 子零部件
|
||||||
*/
|
*/
|
||||||
@@ -101,4 +116,4 @@ public class PartName implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -496,3 +496,5 @@ srms:
|
|||||||
etton_sys_code: ETTON
|
etton_sys_code: ETTON
|
||||||
# E彩通默认账户
|
# E彩通默认账户
|
||||||
etton_sys_user: etton
|
etton_sys_user: etton
|
||||||
|
# 分类树标准法规回写接口 url
|
||||||
|
part_standard_url:
|
||||||
|
|||||||
Reference in New Issue
Block a user