添加srms接口
This commit is contained in:
@@ -113,4 +113,11 @@ public interface ILoginService{
|
|||||||
* @return com.jero.common.api.vo.Result<java.lang.String>
|
* @return com.jero.common.api.vo.Result<java.lang.String>
|
||||||
*/
|
*/
|
||||||
public Result<String> getRSAPublicKey();
|
public Result<String> getRSAPublicKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* srms获取token
|
||||||
|
* @param username 用户名
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Result<JSONObject> srmsByToken(String username);
|
||||||
}
|
}
|
||||||
|
|||||||
+23
@@ -625,6 +625,8 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*
|
*
|
||||||
@@ -706,4 +708,25 @@ public class LoginServiceImpl implements ILoginService {
|
|||||||
result.setMessage("登录成功");
|
result.setMessage("登录成功");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<JSONObject> srmsByToken(String userName) {
|
||||||
|
// 获取用户信息
|
||||||
|
SysUser sysUser = sysUserService.getUserByName(userName);
|
||||||
|
// 校验用户是否有效
|
||||||
|
Result<JSONObject> result = sysUserService.checkUserIsEffective(sysUser);
|
||||||
|
if(!result.isSuccess()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (checkSysPermission(sysUser.getUsername())) {
|
||||||
|
return Result.error("该用户无权限,请联系管理员");
|
||||||
|
}
|
||||||
|
//用户登录信息
|
||||||
|
userInfo(sysUser, result);
|
||||||
|
//update-begin--Author:wangshuai Date:20200714 for:登录日志没有记录人员
|
||||||
|
LoginUser loginUser = new LoginUser();
|
||||||
|
BeanUtils.copyProperties(sysUser, loginUser);
|
||||||
|
baseCommonService.addLog(USER_NAME + userName + LOGIN_SUCCEED, CommonConstant.LOG_TYPE_1, null,loginUser);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
package com.jero.modules.docking.srms.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jero.common.api.vo.Result;
|
||||||
|
import com.jero.modules.docking.srms.service.SrmsApiService;
|
||||||
|
import com.jero.modules.docking.srms.vo.ByFileRows;
|
||||||
|
import com.jero.modules.docking.utils.ResponsesUtil;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/18 9:52
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/srms")
|
||||||
|
public class SrmsApiController {
|
||||||
|
@Resource
|
||||||
|
private SrmsApiService srmsApiService;
|
||||||
|
|
||||||
|
private static final String MESSAGE_HEADER = MESSAGE_HEADER;
|
||||||
|
|
||||||
|
@ApiOperation("获取token")
|
||||||
|
@PostMapping("/getByToken")
|
||||||
|
public JSONObject getByToken(@RequestBody JSONObject json){
|
||||||
|
try {
|
||||||
|
Result<JSONObject> re = srmsApiService.getByToken(json);
|
||||||
|
if(!re.isSuccess()){
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage()));
|
||||||
|
}
|
||||||
|
String token = re.getResult().get("token").toString();
|
||||||
|
JSONObject jsonResponses = ResponsesUtil.getJsonOk();
|
||||||
|
jsonResponses.put("token",token);
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("获取token异常:",e);
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr("操作失败"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("标准法规文档查询")
|
||||||
|
@PostMapping("/getByLawsFileList")
|
||||||
|
public JSONObject getByLawsFileList(@RequestBody JSONObject json, HttpServletRequest req){
|
||||||
|
try {
|
||||||
|
Result<List<ByFileRows>> re = srmsApiService.getByLawsFileList(json,req);
|
||||||
|
if(!re.isSuccess()){
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage()));
|
||||||
|
}
|
||||||
|
List<ByFileRows> list = re.getResult();
|
||||||
|
JSONObject jsonResponses = ResponsesUtil.getJsonOk();
|
||||||
|
jsonResponses.put("Rows",list);
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("获取token异常:",e);
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr("操作失败"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ApiOperation("设计导航-产品设计条款查询")
|
||||||
|
// @PostMapping("/getByLawsDesignNavigation")
|
||||||
|
// public JSONObject getByLawsDesignNavigation(@RequestBody JSONObject json, HttpServletRequest req){
|
||||||
|
// try {
|
||||||
|
// Result<JSONArray> re = srmsApiService.getByLawsFileList(json,req);
|
||||||
|
// if(!re.isSuccess()){
|
||||||
|
// return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr(re.getMessage()));
|
||||||
|
// }
|
||||||
|
// JSONArray jsonArray = re.getResult();
|
||||||
|
// JSONObject jsonResponses = ResponsesUtil.getJsonOk();
|
||||||
|
// jsonResponses.put("Rows",jsonArray);
|
||||||
|
// return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
|
// }catch (Exception e){
|
||||||
|
// log.error("获取token异常:",e);
|
||||||
|
// return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr("操作失败"));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package com.jero.modules.docking.srms.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/18 10:10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ByFileListRequests implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工号(唯一值)
|
||||||
|
*/
|
||||||
|
private String partCategoryNum;
|
||||||
|
/**
|
||||||
|
* 系统的key值(对接时SRMS提供)
|
||||||
|
*/
|
||||||
|
private String partCategoryName;
|
||||||
|
/**
|
||||||
|
* 系统对应秘钥(对接时SRMS提供)
|
||||||
|
*/
|
||||||
|
private String secret;
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package com.jero.modules.docking.srms.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/18 10:10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ByTokenRequests implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工号(唯一值)
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
/**
|
||||||
|
* 系统的key值(对接时SRMS提供)
|
||||||
|
*/
|
||||||
|
private String appkey;
|
||||||
|
/**
|
||||||
|
* 系统对应秘钥(对接时SRMS提供)
|
||||||
|
*/
|
||||||
|
private String secret;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.jero.modules.docking.srms.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/19 14:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StandardVO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 零部件-分类内部码(精准查询)
|
||||||
|
*/
|
||||||
|
private String partCategoryNum;
|
||||||
|
/**
|
||||||
|
* 零部件-分类名称
|
||||||
|
*/
|
||||||
|
private String partCategoryName;
|
||||||
|
/**
|
||||||
|
* 标准编号
|
||||||
|
*/
|
||||||
|
private String standardNumber;
|
||||||
|
/**
|
||||||
|
* 标准名称
|
||||||
|
*/
|
||||||
|
private String standardName;
|
||||||
|
/**
|
||||||
|
* 标准状态
|
||||||
|
*/
|
||||||
|
private String standardState;
|
||||||
|
/**
|
||||||
|
* 是否存在拆分信息,1 成功 2 null
|
||||||
|
*/
|
||||||
|
private String hasSplit;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package com.jero.modules.docking.srms.mapper;
|
||||||
|
|
||||||
|
import com.jero.modules.docking.srms.dto.StandardVO;
|
||||||
|
import com.jero.modules.docking.srms.vo.ByFileRows;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: ASMS国内法规
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-10-20
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface LawsStandardMapper{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/19 15:43
|
||||||
|
* @param standard
|
||||||
|
* @return java.util.List<com.jero.modules.docking.srms.vo.ByFileRows>
|
||||||
|
*/
|
||||||
|
List<ByFileRows> getStandard(@Param("standard") StandardVO standard);
|
||||||
|
|
||||||
|
}
|
||||||
+69
@@ -0,0 +1,69 @@
|
|||||||
|
<?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.LawsStandardMapper">
|
||||||
|
|
||||||
|
<select id="getStandard" resultType="com.jero.modules.docking.srms.vo.ByFileRows">
|
||||||
|
select law.*,
|
||||||
|
#{standard.partCategoryNum} as partCategoryNum,
|
||||||
|
l1.name as partCategoryName
|
||||||
|
from (
|
||||||
|
select id,standard_number,standard_name,standard_english_name,standard_state,
|
||||||
|
DATE_FORMAT(release_date,'%Y-%m-%d') as release_date,
|
||||||
|
DATE_FORMAT(implementation_date,'%Y-%m-%d') as implementation_date
|
||||||
|
from laws_domestic_standard
|
||||||
|
where del_flag = 0 and instr(part_name,#{standard.partCategoryNum}) > 0
|
||||||
|
<if test="standard.standardNumber != '' and standard.standardNumber != null">
|
||||||
|
and standard_number = #{standard.standardNumber}
|
||||||
|
</if>
|
||||||
|
<if test="standard.standardName != '' and standard.standardName != null">
|
||||||
|
and standard_name = #{standard.standardName}
|
||||||
|
</if>
|
||||||
|
<if test="standard.standardState != '' and standard.standardState != null">
|
||||||
|
and standard_state = #{standard.standardState}
|
||||||
|
</if>
|
||||||
|
union all
|
||||||
|
select id,standard_number,standard_name,standard_english_name,standard_state,
|
||||||
|
DATE_FORMAT(release_date,'%Y-%m-%d') as release_date,
|
||||||
|
DATE_FORMAT(implementation_date,'%Y-%m-%d') as implementation_date
|
||||||
|
from laws_overseas_standard
|
||||||
|
where del_flag = 0 and instr(part_name,#{standard.partCategoryNum}) > 0
|
||||||
|
<if test="standard.standardNumber != '' and standard.standardNumber != null">
|
||||||
|
and standard_number = #{standard.standardNumber}
|
||||||
|
</if>
|
||||||
|
<if test="standard.standardName != '' and standard.standardName != null">
|
||||||
|
and standard_name = #{standard.standardName}
|
||||||
|
</if>
|
||||||
|
<if test="standard.standardState != '' and standard.standardState != null">
|
||||||
|
and standard_state = #{standard.standardState}
|
||||||
|
</if>
|
||||||
|
union all
|
||||||
|
select id,standard_number,standard_name,standard_english_name,standard_state,
|
||||||
|
DATE_FORMAT(release_date,'%Y-%m-%d') as release_date,
|
||||||
|
DATE_FORMAT(implementation_date,'%Y-%m-%d') as implementation_date
|
||||||
|
from laws_enterprise_standard
|
||||||
|
where del_flag = 0 and instr(part_name,#{standard.partCategoryNum}) > 0
|
||||||
|
<if test="standard.standardNumber != '' and standard.standardNumber != null">
|
||||||
|
and standard_number = #{standard.standardNumber}
|
||||||
|
</if>
|
||||||
|
<if test="standard.standardName != '' and standard.standardName != null">
|
||||||
|
and standard_name = #{standardVO.standardName}
|
||||||
|
</if>
|
||||||
|
<if test="standard.standardState != '' and standard.standardState != null">
|
||||||
|
and standard_state = #{standard.standardState}
|
||||||
|
</if>
|
||||||
|
) law
|
||||||
|
left join laws_part_name l1 on l1.code = #{standard.partCategoryNum} and l1.del_flag = 0
|
||||||
|
left join sar_file_split_info s1 on s1.standard_id = law.id and s1.file_type = 'publish_of_original' and s1.publish_before_id is null and s1.del_flag = 0
|
||||||
|
<where>
|
||||||
|
<if test="standard.partCategoryName != '' and standard.partCategoryName != null">
|
||||||
|
and l1.name = #{standard.partCategoryName}
|
||||||
|
</if>
|
||||||
|
<if test="standard.hasSplit == '1'">
|
||||||
|
and s1.split_result = '成功'
|
||||||
|
</if>
|
||||||
|
<if test="standard.hasSplit == '2'">
|
||||||
|
and s1.split_result is null
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
package com.jero.modules.docking.srms.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jero.common.api.vo.Result;
|
||||||
|
import com.jero.modules.docking.srms.vo.ByFileRows;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/18 9:49
|
||||||
|
*/
|
||||||
|
public interface SrmsApiService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取token
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/18 15:41
|
||||||
|
* @param json
|
||||||
|
* @return com.jero.common.api.vo.Result<com.alibaba.fastjson.JSONObject>
|
||||||
|
*/
|
||||||
|
Result<JSONObject> getByToken(JSONObject json);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准法规文档查询
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/18 16:59
|
||||||
|
* @param json
|
||||||
|
* @param req
|
||||||
|
* @return com.alibaba.fastjson.JSONObject
|
||||||
|
*/
|
||||||
|
Result<List<ByFileRows>> getByLawsFileList(JSONObject json, HttpServletRequest req);
|
||||||
|
}
|
||||||
+245
@@ -0,0 +1,245 @@
|
|||||||
|
package com.jero.modules.docking.srms.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.jero.common.api.vo.Result;
|
||||||
|
import com.jero.common.system.api.ISysBaseAPI;
|
||||||
|
import com.jero.common.system.util.JwtUtil;
|
||||||
|
import com.jero.common.util.RedisUtil;
|
||||||
|
import com.jero.common.util.TokenUtils;
|
||||||
|
import com.jero.modules.docking.srms.dto.ByTokenRequests;
|
||||||
|
import com.jero.modules.docking.srms.dto.StandardVO;
|
||||||
|
import com.jero.modules.docking.srms.mapper.LawsStandardMapper;
|
||||||
|
import com.jero.modules.docking.srms.service.SrmsApiService;
|
||||||
|
import com.jero.modules.docking.srms.vo.ByFileRows;
|
||||||
|
import com.jero.modules.docking.srms.vo.DocumentSplitDetail;
|
||||||
|
import com.jero.modules.docking.srms.vo.SarFileSplitMenu;
|
||||||
|
import com.jero.modules.docking.srms.vo.SplitResult;
|
||||||
|
import com.jero.modules.laws.documenttool.entity.LawsDocumentSplit;
|
||||||
|
import com.jero.modules.laws.documenttool.mapper.LawsDocumentSplitMapper;
|
||||||
|
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
|
||||||
|
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
||||||
|
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
|
||||||
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
|
import com.jero.modules.oss.service.IOSSFileService;
|
||||||
|
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||||
|
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||||
|
import com.jero.modules.split.page.SarFileSplitMenuEOPage;
|
||||||
|
import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||||
|
import com.jero.modules.split.service.ISarFileSplitMenuEOService;
|
||||||
|
import com.jero.modules.system.service.ILoginService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/18 9:53
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class SrmsApiServiceImpl implements SrmsApiService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILoginService loginService;
|
||||||
|
@Resource
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
@Resource
|
||||||
|
private ILawsDomesticStandardService lawsDomesticStandardService;
|
||||||
|
@Resource
|
||||||
|
private ILawsOverseasStandardService lawsOverseasStandardService;
|
||||||
|
@Resource
|
||||||
|
private ILawsEnterpriseStandardService lawsEnterpriseStandardService;
|
||||||
|
@Resource
|
||||||
|
private ISarFileSplitMenuEOService sarFileSplitMenuEOService;
|
||||||
|
@Resource
|
||||||
|
private ISarFileSplitInfoService sarFileSplitInfoService;
|
||||||
|
@Resource
|
||||||
|
private LawsDocumentSplitMapper lawsDocumentSplitMapper;
|
||||||
|
@Resource
|
||||||
|
private LawsStandardMapper lawsStandardMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysBaseAPI sysBaseAPI;
|
||||||
|
@Resource
|
||||||
|
private IOSSFileService ossFileService;
|
||||||
|
|
||||||
|
@Value("${srms.app_key}")
|
||||||
|
private String appKey;
|
||||||
|
@Value("${srms.secret}")
|
||||||
|
private String secret;
|
||||||
|
|
||||||
|
private static final String SRMS_TOKEN = "srms_token_";
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<JSONObject> getByToken(JSONObject json) {
|
||||||
|
try {
|
||||||
|
ByTokenRequests byTokenRequests = JSON.parseObject(JSON.toJSONString(json.get("Requests")),ByTokenRequests.class);
|
||||||
|
// 验证数据必填项
|
||||||
|
if(StringUtils.isAllBlank(byTokenRequests.getUsername())
|
||||||
|
|| StringUtils.isBlank(byTokenRequests.getAppkey())
|
||||||
|
|| StringUtils.isBlank(byTokenRequests.getSecret())){
|
||||||
|
return Result.error("必填项不能为空");
|
||||||
|
}
|
||||||
|
if(!Objects.equals(appKey,byTokenRequests.getAppkey()) || !Objects.equals(secret,byTokenRequests.getSecret())){
|
||||||
|
return Result.error("系统验证失败");
|
||||||
|
}
|
||||||
|
Result<JSONObject> re = Result.OK();
|
||||||
|
String tokenKey = SRMS_TOKEN + byTokenRequests.getUsername();
|
||||||
|
// 验证用户是否存在token,存在不再重复获取
|
||||||
|
if(redisUtil.hasKey(tokenKey)){
|
||||||
|
JSONObject js = new JSONObject();
|
||||||
|
js.put("token",redisUtil.get(tokenKey));
|
||||||
|
re.setResult(js);
|
||||||
|
}else{
|
||||||
|
re = loginService.srmsByToken(byTokenRequests.getUsername());
|
||||||
|
String token = re.getResult().get("token").toString();
|
||||||
|
redisUtil.set(tokenKey,token,JwtUtil.EXPIRE_TIME / 1000);
|
||||||
|
}
|
||||||
|
return re;
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("获取token异常:",e);
|
||||||
|
return Result.error("操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<ByFileRows>> getByLawsFileList(JSONObject json, HttpServletRequest req) {
|
||||||
|
try {
|
||||||
|
// 验证token
|
||||||
|
String token = req.getHeader("X-Access-Token");
|
||||||
|
if(StringUtils.isBlank(token) || !Objects.equals(TokenUtils.getTokenByRequest(req),token)){
|
||||||
|
Result.error("系统验证失败");
|
||||||
|
}
|
||||||
|
JSONObject requests = JSON.parseObject(JSON.toJSONString(json.get("Requests")));
|
||||||
|
StandardVO standardVO = new StandardVO();
|
||||||
|
// 零部件-分类内部码(精准查询)
|
||||||
|
String partCategoryNum = getStr(requests, "partCategoryNum");
|
||||||
|
if(StringUtils.isBlank(partCategoryNum)){
|
||||||
|
Result.error("零部件-分类内部码不能为空");
|
||||||
|
}
|
||||||
|
standardVO.setPartCategoryNum(partCategoryNum);
|
||||||
|
// 零部件-分类名称
|
||||||
|
String partCategoryName = getStr(requests, "partCategoryName");
|
||||||
|
standardVO.setPartCategoryName(partCategoryName);
|
||||||
|
// 标准编号
|
||||||
|
String standardNumber = getStr(requests, "standardNumber");
|
||||||
|
standardVO.setStandardNumber(standardNumber);
|
||||||
|
// 标准名称
|
||||||
|
String standardName = getStr(requests, "standardName");
|
||||||
|
standardVO.setStandardName(standardName);
|
||||||
|
// 标准状态
|
||||||
|
String standardState = getStr(requests, "standardState");
|
||||||
|
standardVO.setStandardState(standardState);
|
||||||
|
// 是否存在拆分信息,默认false; true-是,false-否
|
||||||
|
if(!Objects.isNull(requests.get("hasSplit"))){
|
||||||
|
Boolean hasSplit = Boolean.parseBoolean(requests.get("hasSplit").toString());
|
||||||
|
if(hasSplit){
|
||||||
|
standardVO.setHasSplit("1");
|
||||||
|
}else{
|
||||||
|
standardVO.setHasSplit("2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 备用字段1
|
||||||
|
String remark1 = getStr(requests, "Remark1");
|
||||||
|
// 备用字段2
|
||||||
|
String remark2 = getStr(requests, "Remark2");
|
||||||
|
// 备用字段3
|
||||||
|
String remark3 = getStr(requests, "Remark3");
|
||||||
|
// 备用字段4
|
||||||
|
String remark4 = getStr(requests, "Remark4");
|
||||||
|
|
||||||
|
List<ByFileRows> listByFileRows = lawsStandardMapper.getStandard(standardVO);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
if(!CollectionUtils.isEmpty(listByFileRows)){
|
||||||
|
List<String> listFileId = listByFileRows.stream().map(ByFileRows::getId).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<OSSFile> queryOssFile = new LambdaQueryWrapper<>();
|
||||||
|
queryOssFile.in(OSSFile::getStandardId,listFileId);
|
||||||
|
queryOssFile.eq(OSSFile::getStandardFileType,"publish_of_original");
|
||||||
|
queryOssFile.orderByDesc(OSSFile::getCreateTime);
|
||||||
|
List<OSSFile> listOssFile = ossFileService.list(queryOssFile);
|
||||||
|
for (ByFileRows byFileRows : listByFileRows) {
|
||||||
|
byFileRows.setPartCategoryNum(partCategoryNum);
|
||||||
|
byFileRows.setStandardState_dictText(sysBaseAPI.translateDict("standard_state", byFileRows.getStandardState()));
|
||||||
|
if(!CollectionUtils.isEmpty(listOssFile)){
|
||||||
|
List<OSSFile> listFile = listOssFile.stream().filter(o->Objects.equals(o.getStandardId(),byFileRows.getId())).collect(Collectors.toList());
|
||||||
|
if(!CollectionUtils.isEmpty(listFile)){
|
||||||
|
listFile = listFile.stream().sorted(Comparator.comparing(OSSFile::getCreateTime).reversed()).collect(Collectors.toList());
|
||||||
|
byFileRows.setStandardUrl(listFile.get(0).getUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<SarFileSplitInfoEO> querySarFileSplitInfoEo = new LambdaQueryWrapper<>();
|
||||||
|
querySarFileSplitInfoEo.eq(SarFileSplitInfoEO::getStandardId,byFileRows.getId());
|
||||||
|
querySarFileSplitInfoEo.isNull(SarFileSplitInfoEO::getPublishBeforeId);
|
||||||
|
querySarFileSplitInfoEo.eq(SarFileSplitInfoEO::getFileType,"publish_of_original");
|
||||||
|
SarFileSplitInfoEO sarFileSplitInfoEo = sarFileSplitInfoService.getOne(querySarFileSplitInfoEo,false);
|
||||||
|
if(!Objects.isNull(sarFileSplitInfoEo)){
|
||||||
|
SarFileSplitMenuEOPage page = new SarFileSplitMenuEOPage();
|
||||||
|
page.setValidFlag("0");
|
||||||
|
page.setOrderBy("display_seq asc");
|
||||||
|
page.setInfoId(sarFileSplitInfoEo.getId());
|
||||||
|
List<SarFileSplitMenuEO> getList = sarFileSplitMenuEOService.queryByApiList(page);
|
||||||
|
if(!CollectionUtils.isEmpty(getList)){
|
||||||
|
List<SarFileSplitMenu> listSarFileSplitMenu = new ArrayList<>();
|
||||||
|
for (SarFileSplitMenuEO sarFileSplitMenuEo : getList) {
|
||||||
|
SarFileSplitMenu sarFileSplitMenu = new SarFileSplitMenu();
|
||||||
|
sarFileSplitMenu.setId(sarFileSplitMenuEo.getId());
|
||||||
|
sarFileSplitMenu.setPid(sarFileSplitMenuEo.getPId());
|
||||||
|
sarFileSplitMenu.setItemName(sarFileSplitMenuEo.getItemName());
|
||||||
|
sarFileSplitMenu.setName(sarFileSplitMenuEo.getName());
|
||||||
|
listSarFileSplitMenu.add(sarFileSplitMenu);
|
||||||
|
}
|
||||||
|
SplitResult splitResult = new SplitResult();
|
||||||
|
if(!CollectionUtils.isEmpty(listSarFileSplitMenu)){
|
||||||
|
List<String> listIds = listSarFileSplitMenu.stream().map(SarFileSplitMenu::getId).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<LawsDocumentSplit> queryLawsDocumentSplit = new LambdaQueryWrapper<>();
|
||||||
|
queryLawsDocumentSplit.in(LawsDocumentSplit::getMenuId,listIds);
|
||||||
|
queryLawsDocumentSplit.eq(LawsDocumentSplit::getDelFlag,"0");
|
||||||
|
List<LawsDocumentSplit> listLawsDocumentSplit = lawsDocumentSplitMapper.selectList(queryLawsDocumentSplit);
|
||||||
|
if(!CollectionUtils.isEmpty(listLawsDocumentSplit)){
|
||||||
|
List<DocumentSplitDetail> listDocumentSplitDetail = JSON.parseArray(JSON.toJSONString(listLawsDocumentSplit),DocumentSplitDetail.class);
|
||||||
|
splitResult.setDocumentSplitDetail(listDocumentSplitDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SarFileSplitMenu> finalResult = listSarFileSplitMenu;
|
||||||
|
listSarFileSplitMenu = listSarFileSplitMenu.stream().filter(v -> StringUtils.isBlank(v.getPid()))
|
||||||
|
.peek(v -> v.setChildren(createChildList(v, finalResult))).collect(Collectors.toList());
|
||||||
|
splitResult.setSarFileSplitMenuEO(JSON.toJSONString(listSarFileSplitMenu));
|
||||||
|
}
|
||||||
|
|
||||||
|
byFileRows.setSplitResult(splitResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.OK(listByFileRows);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("标准法规文档查询异常:",e);
|
||||||
|
return Result.error("操作失败" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getStr(JSONObject requests, String partCategoryNum) {
|
||||||
|
return requests.containsKey(partCategoryNum) ? requests.get(partCategoryNum).toString() : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SarFileSplitMenu> createChildList(SarFileSplitMenu testTree, List<SarFileSplitMenu> treeList) {
|
||||||
|
return treeList.stream().filter(v -> testTree.getId().equals(v.getPid()))
|
||||||
|
.peek(v -> v.setChildren(createChildList(v, treeList)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.jero.modules.docking.srms.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/19 8:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ByFileRows implements Serializable {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 零部件-分类内部码(精准查询)
|
||||||
|
*/
|
||||||
|
private String partCategoryNum;
|
||||||
|
/**
|
||||||
|
* 零部件-分类名称
|
||||||
|
*/
|
||||||
|
private String partCategoryName;
|
||||||
|
/**
|
||||||
|
* 标准编号
|
||||||
|
*/
|
||||||
|
private String standardNumber;
|
||||||
|
/**
|
||||||
|
* 标准名称
|
||||||
|
*/
|
||||||
|
private String standardName;
|
||||||
|
/**
|
||||||
|
* 标准英文名称
|
||||||
|
*/
|
||||||
|
private String standardEnglishName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准状态
|
||||||
|
*/
|
||||||
|
private String standardState;
|
||||||
|
/**
|
||||||
|
* 标准状态
|
||||||
|
*/
|
||||||
|
private String standardState_dictText;
|
||||||
|
/**
|
||||||
|
* 发布日期(转成字符串传)
|
||||||
|
* 示例:2024-01-05
|
||||||
|
*/
|
||||||
|
private String releaseDate;
|
||||||
|
/**
|
||||||
|
* 实施日期
|
||||||
|
* 示例:2024-01-05
|
||||||
|
*/
|
||||||
|
private String implementationDate;
|
||||||
|
/**
|
||||||
|
* 标准跳转链接,即发布稿查看链接(url+at信息),试验存在
|
||||||
|
*/
|
||||||
|
private String standardUrl;
|
||||||
|
|
||||||
|
private SplitResult splitResult;
|
||||||
|
}
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
package com.jero.modules.docking.srms.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/19 8:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DocumentSplitDetail implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条款主键
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 目录id 和sarFileSplitMenuEO中对应
|
||||||
|
*/
|
||||||
|
private String menuId;
|
||||||
|
/**
|
||||||
|
* 条款内容
|
||||||
|
*/
|
||||||
|
private String itemContent;
|
||||||
|
/**
|
||||||
|
* 条款号
|
||||||
|
*/
|
||||||
|
private String itemNum;
|
||||||
|
/**
|
||||||
|
* 条款标题
|
||||||
|
*/
|
||||||
|
private String itemTitle;
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package com.jero.modules.docking.srms.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/19 13:55
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SarFileSplitMenu implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String itemName;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private List<SarFileSplitMenu> children;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.jero.modules.docking.srms.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/19 8:57
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SplitResult implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文档拆分详情
|
||||||
|
*/
|
||||||
|
private List<DocumentSplitDetail> documentSplitDetail;
|
||||||
|
/**
|
||||||
|
* 条款信息的全部内容
|
||||||
|
*/
|
||||||
|
private String sarFileSplitMenuEO;
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.jero.modules.docking.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jero.common.constant.CommonConstant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lqt
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/18 14:45
|
||||||
|
*/
|
||||||
|
public class ResponsesUtil {
|
||||||
|
|
||||||
|
|
||||||
|
public static JSONObject getJsonResult(Object jsonMessageHeader,JSONObject jsonResponses) {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("MessageHeader",jsonMessageHeader);
|
||||||
|
json.put("Responses",jsonResponses);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject getJsonOk() {
|
||||||
|
return getJsonOk("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject getJsonOk(String message) {
|
||||||
|
JSONObject jsonResponses = new JSONObject();
|
||||||
|
jsonResponses.put("srmsCode",CommonConstant.SC_OK_200);
|
||||||
|
jsonResponses.put("message",message);
|
||||||
|
jsonResponses.put("success",true);
|
||||||
|
jsonResponses.put("timestamp",System.currentTimeMillis());
|
||||||
|
return jsonResponses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject getJsonErr() {
|
||||||
|
return getJsonErr("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject getJsonErr(String message) {
|
||||||
|
JSONObject jsonResponses = new JSONObject();
|
||||||
|
jsonResponses.put("srmsCode",CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
|
||||||
|
jsonResponses.put("message",message);
|
||||||
|
jsonResponses.put("success",false);
|
||||||
|
jsonResponses.put("timestamp",System.currentTimeMillis());
|
||||||
|
return jsonResponses;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+2
@@ -47,6 +47,8 @@ public interface ISarFileSplitMenuEOService extends IService<SarFileSplitMenuEO>
|
|||||||
|
|
||||||
List<SarFileSplitMenuEO> queryByList(SarFileSplitMenuEOPage page);
|
List<SarFileSplitMenuEO> queryByList(SarFileSplitMenuEOPage page);
|
||||||
|
|
||||||
|
List<SarFileSplitMenuEO> queryByApiList(SarFileSplitMenuEOPage page);
|
||||||
|
|
||||||
int queryByCount(SarFileSplitMenuEOPage page);
|
int queryByCount(SarFileSplitMenuEOPage page);
|
||||||
|
|
||||||
List<SarFileSplitMenuEO> queryByPage(SarFileSplitMenuEOPage page);
|
List<SarFileSplitMenuEO> queryByPage(SarFileSplitMenuEOPage page);
|
||||||
|
|||||||
+45
@@ -223,6 +223,51 @@ public class SarFileSplitMenuEOServiceImpl extends ServiceImpl<SarFileSplitMenuE
|
|||||||
.peek(v -> v.setChildren(createChildList(v, finalResult))).collect(Collectors.toList());
|
.peek(v -> v.setChildren(createChildList(v, finalResult))).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SarFileSplitMenuEO> queryByApiList(SarFileSplitMenuEOPage page) {
|
||||||
|
String itemName;
|
||||||
|
if (StringUtils.isNotBlank(page.getName())){
|
||||||
|
itemName = page.getName();
|
||||||
|
page.setName(null);
|
||||||
|
} else {
|
||||||
|
itemName = "";
|
||||||
|
}
|
||||||
|
List<SarFileSplitMenuEO> result = dao.queryByList(page);
|
||||||
|
|
||||||
|
// 处理数据是否可以上下移动标识
|
||||||
|
for (SarFileSplitMenuEO sarFileSplitMenuEO : result) {
|
||||||
|
// 如果数据的同级别 该数据是第一条数据,不能向上移动, 该数据是最后一条数据 不能向下移动, 如果该级别只有这一条数据,不可向上或向下移动
|
||||||
|
boolean moveUpFlag = false;
|
||||||
|
boolean moveDownFlag = false;
|
||||||
|
Long displaySeq = sarFileSplitMenuEO.getDisplaySeq();
|
||||||
|
for (SarFileSplitMenuEO fileSplitMenuEO : result) {
|
||||||
|
if(StringUtils.equals(sarFileSplitMenuEO.getPId(),fileSplitMenuEO.getPId())){
|
||||||
|
if(displaySeq > fileSplitMenuEO.getDisplaySeq()){
|
||||||
|
moveUpFlag = true;
|
||||||
|
}else if(displaySeq < fileSplitMenuEO.getDisplaySeq()){
|
||||||
|
moveDownFlag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sarFileSplitMenuEO.setMoveUpFlag(moveUpFlag);
|
||||||
|
sarFileSplitMenuEO.setMoveDownFlag(moveDownFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关键字查询
|
||||||
|
if (StringUtils.isNotBlank(itemName) && !result.isEmpty()){
|
||||||
|
List<SarFileSplitMenuEO> trees = result.stream()
|
||||||
|
.filter(v -> (StringUtils.isNotBlank(v.getItemName())
|
||||||
|
&& v.getItemName().contains(itemName)) || v.getName().contains(itemName))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
// 递归查找所有符合项的父节点
|
||||||
|
List<SarFileSplitMenuEO> newTrees = new ArrayList<>(trees);
|
||||||
|
queryTreeFather(result, trees, newTrees);
|
||||||
|
// 过滤重复项
|
||||||
|
result = newTrees.stream().distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private void queryTreeFather(List<SarFileSplitMenuEO> treeList, List<SarFileSplitMenuEO> trees, List<SarFileSplitMenuEO> newTrees) {
|
private void queryTreeFather(List<SarFileSplitMenuEO> treeList, List<SarFileSplitMenuEO> trees, List<SarFileSplitMenuEO> newTrees) {
|
||||||
for (SarFileSplitMenuEO tree : trees) {
|
for (SarFileSplitMenuEO tree : trees) {
|
||||||
// 父节点
|
// 父节点
|
||||||
|
|||||||
@@ -476,3 +476,10 @@ watermark:
|
|||||||
margin:
|
margin:
|
||||||
top: 100
|
top: 100
|
||||||
left: 60
|
left: 60
|
||||||
|
|
||||||
|
# srms 接口对接
|
||||||
|
srms:
|
||||||
|
# 系统的key值
|
||||||
|
app_key: eeabe117f06a4d99a15582a143d3be54
|
||||||
|
# 系统对应秘钥
|
||||||
|
secret: 7ddbafa5b7ba4104bff5ffae9d775998
|
||||||
|
|||||||
Reference in New Issue
Block a user