srms接口修改
This commit is contained in:
+39
-1
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.modules.docking.srms.dto.ProductDesign;
|
|
||||||
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;
|
||||||
@@ -130,4 +129,43 @@ public class SrmsApiController {
|
|||||||
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr("操作失败"));
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErr("操作失败"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @ApiOperation("零部件分类树同步接口")
|
||||||
|
@PostMapping("/syncPartData")
|
||||||
|
public JSONObject syncPartData(@RequestBody JSONObject json, HttpServletRequest req){
|
||||||
|
try {
|
||||||
|
Result<String> re = srmsApiService.syncPartData(json,req);
|
||||||
|
if(!re.isSuccess()){
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper(re.getMessage()));
|
||||||
|
}
|
||||||
|
JSONObject jsonResponses = ResponsesUtil.getJsonOkUpper();
|
||||||
|
jsonResponses.put("Result",re.getResult());
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("零部件分类树同步接口异常:",e);
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper("操作失败"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @ApiOperation("E采通获取标准信息")
|
||||||
|
@PostMapping("/getEStandardInfo")
|
||||||
|
public JSONObject getEStandardInfo(@RequestBody JSONObject json, HttpServletRequest req){
|
||||||
|
try {
|
||||||
|
// todo
|
||||||
|
Result<List<JSONObject>> re = srmsApiService.getEStandardInfo(json,req);
|
||||||
|
if(!re.isSuccess()){
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper(re.getMessage()));
|
||||||
|
}
|
||||||
|
List<JSONObject> page = re.getResult();
|
||||||
|
JSONObject jsonPage = new JSONObject();
|
||||||
|
JSONObject jsonResponses = ResponsesUtil.getJsonOkUpper();
|
||||||
|
jsonResponses.put("Result",jsonPage);
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),jsonResponses);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("E采通获取标准信息异常:",e);
|
||||||
|
return ResponsesUtil.getJsonResult(json.get(MESSAGE_HEADER),ResponsesUtil.getJsonErrUpper("操作失败"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -73,29 +73,29 @@
|
|||||||
<if test="standardNumber != null and standardNumber != ''">
|
<if test="standardNumber != null and standardNumber != ''">
|
||||||
and standard_number = #{standardNumber}
|
and standard_number = #{standardNumber}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryLabels != null and queryLabels != ''">
|
|
||||||
and standard_number = #{queryLabels}
|
|
||||||
</if>
|
|
||||||
union all
|
union all
|
||||||
select id from laws_overseas_standard where del_flag = 0 and standard_state = 6
|
select id from laws_overseas_standard where del_flag = 0 and standard_state = 6
|
||||||
<if test="standardNumber != null and standardNumber != ''">
|
<if test="standardNumber != null and standardNumber != ''">
|
||||||
and standard_number = #{standardNumber}
|
and standard_number = #{standardNumber}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryLabels != null and queryLabels != ''">
|
|
||||||
and standard_number = #{queryLabels}
|
|
||||||
</if>
|
|
||||||
union all
|
union all
|
||||||
select id from laws_enterprise_standard where del_flag = 0 and standard_state = 6
|
select id from laws_enterprise_standard where del_flag = 0 and standard_state = 6
|
||||||
<if test="standardNumber != null and standardNumber != ''">
|
<if test="standardNumber != null and standardNumber != ''">
|
||||||
and standard_number = #{standardNumber}
|
and standard_number = #{standardNumber}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryLabels != null and queryLabels != ''">
|
|
||||||
and standard_number = #{queryLabels}
|
|
||||||
</if>
|
|
||||||
) law
|
) law
|
||||||
left join sar_file_split_info s on s.standard_id = law.id and s.del_flag = 0
|
left join sar_file_split_info s on s.standard_id = law.id and s.del_flag = 0
|
||||||
left join laws_document_split l on s.id = l.info_id and l.del_flag = 0
|
left join laws_document_split l on s.id = l.info_id and l.del_flag = 0
|
||||||
where l.item_content is not null and l.item_content != '' limit 1
|
where
|
||||||
|
l.item_content is not null
|
||||||
|
and l.item_content != ''
|
||||||
|
<if test="queryLabels != null and queryLabels != ''">
|
||||||
|
and
|
||||||
|
<foreach collection="queryLabels.split(',')" item="item" separator="and" open="(" close=")">
|
||||||
|
FIND_IN_SET(#{item},l.property_tag)
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getByLawsStandardPage" resultType="com.jero.modules.docking.srms.vo.StandardPageVO">
|
<select id="getByLawsStandardPage" resultType="com.jero.modules.docking.srms.vo.StandardPageVO">
|
||||||
|
|||||||
+20
@@ -66,4 +66,24 @@ public interface SrmsApiService {
|
|||||||
*/
|
*/
|
||||||
Result<IPage<StandardPageVO>> getByLawsStandardPage(JSONObject json, HttpServletRequest req);
|
Result<IPage<StandardPageVO>> getByLawsStandardPage(JSONObject json, HttpServletRequest req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 零部件分类树同步接口
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/26 16:05
|
||||||
|
* @param json
|
||||||
|
* @param req
|
||||||
|
* @return com.jero.common.api.vo.Result<java.lang.String>
|
||||||
|
*/
|
||||||
|
Result<String> syncPartData(JSONObject json, HttpServletRequest req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* E采通获取标准信息
|
||||||
|
* @author LQT
|
||||||
|
* @date 2024/1/26 15:08
|
||||||
|
* @param json
|
||||||
|
* @param req
|
||||||
|
* @return com.jero.common.api.vo.Result<java.util.List<com.alibaba.fastjson.JSONObject>>
|
||||||
|
*/
|
||||||
|
Result<List<JSONObject>> getEStandardInfo(JSONObject json, HttpServletRequest req);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+60
-23
@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.system.api.ISysBaseAPI;
|
import com.jero.common.system.api.ISysBaseAPI;
|
||||||
import com.jero.common.system.util.JwtUtil;
|
|
||||||
import com.jero.common.system.vo.LoginUser;
|
import com.jero.common.system.vo.LoginUser;
|
||||||
import com.jero.common.util.MD5Util;
|
import com.jero.common.util.MD5Util;
|
||||||
import com.jero.common.util.RedisUtil;
|
import com.jero.common.util.RedisUtil;
|
||||||
@@ -95,8 +94,11 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
private String backUrlOther;
|
private String backUrlOther;
|
||||||
@Value("${srms.other_md5_mark}")
|
@Value("${srms.other_md5_mark}")
|
||||||
private String otherMd5Mark;
|
private String otherMd5Mark;
|
||||||
|
@Value("${srms.etton_sys_code}")
|
||||||
|
private String ettonSysCode;
|
||||||
|
@Value("${srms.etton_sys_user}")
|
||||||
|
private String ettonSysUser;
|
||||||
|
|
||||||
private static final String SRMS_TOKEN = "srms_token_";
|
|
||||||
private static final String REQUESTS = "Requests";
|
private static final String REQUESTS = "Requests";
|
||||||
private static final String SYS_ERR = "系统验证失败";
|
private static final String SYS_ERR = "系统验证失败";
|
||||||
private static final String STANDARD_NAME = "standardName";
|
private static final String STANDARD_NAME = "standardName";
|
||||||
@@ -118,21 +120,19 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
LambdaQueryWrapper<LawsSysApiInfo> queryLawsSysApiInfo = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<LawsSysApiInfo> queryLawsSysApiInfo = new LambdaQueryWrapper<>();
|
||||||
queryLawsSysApiInfo.eq(LawsSysApiInfo::getAppKey,byTokenRequests.getAppkey());
|
queryLawsSysApiInfo.eq(LawsSysApiInfo::getAppKey,byTokenRequests.getAppkey());
|
||||||
queryLawsSysApiInfo.eq(LawsSysApiInfo::getSecret,byTokenRequests.getSecret());
|
queryLawsSysApiInfo.eq(LawsSysApiInfo::getSecret,byTokenRequests.getSecret());
|
||||||
long l = lawsSysApiInfoService.count(queryLawsSysApiInfo);
|
LawsSysApiInfo lawsSysApiInfo = lawsSysApiInfoService.getOne(queryLawsSysApiInfo,false);
|
||||||
if(l == 0){
|
if(Objects.isNull(lawsSysApiInfo)){
|
||||||
return Result.error(SYS_ERR);
|
return Result.error(SYS_ERR);
|
||||||
}
|
}
|
||||||
Result<JSONObject> re = Result.OK();
|
Result<JSONObject> re;
|
||||||
String tokenKey = SRMS_TOKEN + byTokenRequests.getUsername() + byTokenRequests.getAppkey();
|
// E彩通访问,使用默认账户
|
||||||
// 验证用户是否存在token,存在不再重复获取
|
if(Objects.equals(ettonSysCode,lawsSysApiInfo.getSysCode())){
|
||||||
if(redisUtil.hasKey(tokenKey)){
|
re = loginService.srmsByToken(ettonSysUser);
|
||||||
JSONObject js = new JSONObject();
|
String token = re.getResult().get("token").toString();
|
||||||
js.put("token",redisUtil.get(tokenKey));
|
String tokenKey = byTokenRequests.getUsername() + token;
|
||||||
re.setResult(js);
|
redisUtil.set(tokenKey,token,3600);
|
||||||
}else{
|
}else{
|
||||||
re = loginService.srmsByToken(byTokenRequests.getUsername());
|
re = loginService.srmsByToken(byTokenRequests.getUsername());
|
||||||
String token = re.getResult().get("token").toString();
|
|
||||||
redisUtil.set(tokenKey,token,JwtUtil.EXPIRE_TIME / 1000);
|
|
||||||
}
|
}
|
||||||
return re;
|
return re;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
@@ -294,20 +294,20 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
return Result.error(ADD_NOT_NULL);
|
return Result.error(ADD_NOT_NULL);
|
||||||
}
|
}
|
||||||
List<ProductDesign> listProductDesign = new ArrayList<>();
|
List<ProductDesign> listProductDesign = new ArrayList<>();
|
||||||
|
String queryLabels = "queryLabels";
|
||||||
for (Object request : rows) {
|
for (Object request : rows) {
|
||||||
JSONObject js = JSON.parseObject(JSON.toJSONString(request));
|
JSONObject js = JSON.parseObject(JSON.toJSONString(request));
|
||||||
// todo || !js.containsKey("queryLabels")
|
if(!js.containsKey("ID") || !js.containsKey(STANDARD_NUMBER) || !js.containsKey(queryLabels)){
|
||||||
if(!js.containsKey("ID") || !js.containsKey(STANDARD_NUMBER) ){
|
return Result.error(ADD_NOT_NULL);
|
||||||
Result.error(ADD_NOT_NULL);
|
|
||||||
}
|
}
|
||||||
// todo || Objects.isNull(js.get("queryLabels"))
|
if(StringUtils.isBlank(js.getString("ID")) || StringUtils.isBlank(js.getString(STANDARD_NUMBER))
|
||||||
if(Objects.isNull(js.get("ID")) || Objects.isNull(js.get(STANDARD_NUMBER))){
|
|| StringUtils.isBlank(js.getString(queryLabels))){
|
||||||
Result.error(ADD_NOT_NULL);
|
return Result.error(ADD_NOT_NULL);
|
||||||
}
|
}
|
||||||
ProductDesign productDesign = new ProductDesign();
|
ProductDesign productDesign = new ProductDesign();
|
||||||
productDesign.setId(js.get("ID").toString());
|
productDesign.setId(js.getString("ID"));
|
||||||
productDesign.setStandardNumber(js.get(STANDARD_NUMBER).toString());
|
productDesign.setStandardNumber(js.getString(STANDARD_NUMBER));
|
||||||
productDesign.setQueryLabels(js.get("queryLabels").toString());
|
productDesign.setQueryLabels(js.getString(queryLabels));
|
||||||
listProductDesign.add(productDesign);
|
listProductDesign.add(productDesign);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -316,7 +316,7 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
String str = lawsStandardMapper.getStandardByProductDesign(productDesign.getStandardNumber(),productDesign.getQueryLabels());
|
String str = lawsStandardMapper.getStandardByProductDesign(productDesign.getStandardNumber(),productDesign.getQueryLabels());
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("ID",productDesign.getId());
|
obj.put("ID",productDesign.getId());
|
||||||
obj.put("queryLabels",productDesign.getQueryLabels());
|
obj.put(queryLabels,productDesign.getQueryLabels());
|
||||||
obj.put("itemContent",str);
|
obj.put("itemContent",str);
|
||||||
obj.put(STANDARD_NUMBER,productDesign.getStandardNumber());
|
obj.put(STANDARD_NUMBER,productDesign.getStandardNumber());
|
||||||
listObj.add(obj);
|
listObj.add(obj);
|
||||||
@@ -554,4 +554,41 @@ public class SrmsApiServiceImpl implements SrmsApiService {
|
|||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<JSONObject>> getEStandardInfo(JSONObject json, HttpServletRequest req) {
|
||||||
|
// 验证token
|
||||||
|
String token = req.getHeader(X_ACCESS_TOKEN);
|
||||||
|
if(StringUtils.isBlank(token) || !Objects.equals(TokenUtils.getTokenByRequest(req),token)){
|
||||||
|
return Result.error(SYS_ERR);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
for (Object request : rows) {
|
||||||
|
JSONObject js = JSON.parseObject(JSON.toJSONString(request));
|
||||||
|
if(js.containsKey("PartNum") && StringUtils.isBlank(js.getString("PartNum"))){
|
||||||
|
return Result.error(ADD_NOT_NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<JSONObject> listObj = new ArrayList<>();
|
||||||
|
for (Object request : rows) {
|
||||||
|
// todo
|
||||||
|
}
|
||||||
|
return Result.OK(listObj);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("设计导航-产品设计条款查询异常:",e);
|
||||||
|
return Result.error("操作失败" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<String> syncPartData(JSONObject json, HttpServletRequest req) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-1
@@ -9,7 +9,7 @@ import com.jero.common.constant.CommonConstant;
|
|||||||
* @date 2024/1/18 14:45
|
* @date 2024/1/18 14:45
|
||||||
*/
|
*/
|
||||||
public class ResponsesUtil {
|
public class ResponsesUtil {
|
||||||
|
private ResponsesUtil(){}
|
||||||
|
|
||||||
public static JSONObject getJsonResult(Object jsonMessageHeader,JSONObject jsonResponses) {
|
public static JSONObject getJsonResult(Object jsonMessageHeader,JSONObject jsonResponses) {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
@@ -22,6 +22,19 @@ public class ResponsesUtil {
|
|||||||
return getJsonOk("");
|
return getJsonOk("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static JSONObject getJsonOkUpper() {
|
||||||
|
return getJsonOkUpper("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject getJsonOkUpper(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 getJsonOk(String message) {
|
public static JSONObject getJsonOk(String message) {
|
||||||
JSONObject jsonResponses = new JSONObject();
|
JSONObject jsonResponses = new JSONObject();
|
||||||
jsonResponses.put("srmsCode",CommonConstant.SC_OK_200);
|
jsonResponses.put("srmsCode",CommonConstant.SC_OK_200);
|
||||||
@@ -31,6 +44,19 @@ public class ResponsesUtil {
|
|||||||
return jsonResponses;
|
return jsonResponses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static JSONObject getJsonErrUpper() {
|
||||||
|
return getJsonErrUpper("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject getJsonErrUpper(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;
|
||||||
|
}
|
||||||
|
|
||||||
public static JSONObject getJsonErr() {
|
public static JSONObject getJsonErr() {
|
||||||
return getJsonErr("");
|
return getJsonErr("");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -489,3 +489,7 @@ srms:
|
|||||||
back_url_other: http://localhost:8184/${srms.back_url_pdf}&fullfilename={file_name}
|
back_url_other: http://localhost:8184/${srms.back_url_pdf}&fullfilename={file_name}
|
||||||
# 其他文件水印标识
|
# 其他文件水印标识
|
||||||
other_md5_mark: cnhtc
|
other_md5_mark: cnhtc
|
||||||
|
# E彩通标识
|
||||||
|
etton_sys_code: ETTON
|
||||||
|
# E彩通默认账户
|
||||||
|
etton_sys_user: etton
|
||||||
|
|||||||
Reference in New Issue
Block a user