Merge branch 'develop_migration' into 'develop_master'
Develop migration See merge request LiuChao/foton-slrs-system-rest!497
This commit is contained in:
@@ -36,6 +36,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
* AWG 接口
|
* AWG 接口
|
||||||
*/
|
*/
|
||||||
addInterceptor.excludePathPatterns("/api/regulations/searchStandData");
|
addInterceptor.excludePathPatterns("/api/regulations/searchStandData");
|
||||||
|
addInterceptor.excludePathPatterns("/api/regulationsTDM/standData");
|
||||||
/**
|
/**
|
||||||
* TODO 测试流程 开放 login 接口 正式环境 关闭
|
* TODO 测试流程 开放 login 接口 正式环境 关闭
|
||||||
*/
|
*/
|
||||||
|
|||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.adc.da.base.web.BaseController;
|
||||||
|
import com.adc.da.http.Result;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.StandResult;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.SearchStandContext;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.StandData;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.StandMessageCodeEnum;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.service.IStandDataTDMService;
|
||||||
|
import com.adc.da.util.utils.StringUtils;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 标准信息表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author super_liu
|
||||||
|
* @since 2021-07-13
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "福田标准法规--TDM查询标准")
|
||||||
|
@RequestMapping("/api/regulationsTDM")
|
||||||
|
public class StandDataTDMController extends BaseController<StandData> {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(StandDataTDMController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStandDataTDMService iStandDataTDMService;
|
||||||
|
/**
|
||||||
|
* 标准查询列表接口
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "|regulationsTDM|标准查询列表接口")
|
||||||
|
@PostMapping("/standData")
|
||||||
|
public String searchStandData(@RequestBody SearchStandContext searchStandContext){
|
||||||
|
if(searchStandContext.getPage() == 0
|
||||||
|
|| StringUtils.isEmpty(searchStandContext.getType())){
|
||||||
|
return StandResult.toJson(Result.error(StandMessageCodeEnum.ERROR_PARAM.getCode(),
|
||||||
|
"page/type 为必填项 且page不可为0"));
|
||||||
|
}
|
||||||
|
List<StandData> rows = iStandDataTDMService.searchStandData(searchStandContext);
|
||||||
|
return StandResult.toJson(Result.success(getPageInfo(searchStandContext.getPager(), rows)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String verifyObj(String str){
|
||||||
|
return (str == null || str.equals("")) ? "" : str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.dao;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.SearchStandContext;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.StandData;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 标准信息表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author super_liu
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface StandDataTDMDao extends BaseMapper<StandData> {
|
||||||
|
|
||||||
|
List<StandData> searchStandData(SearchStandContext searchStandContext);
|
||||||
|
List<StandData> searchBussData(SearchStandContext searchStandContext);
|
||||||
|
|
||||||
|
List<StandData> searchStandDataThree(SearchStandContext searchStandContext);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.entity;
|
||||||
|
|
||||||
|
import com.adc.da.base.page.BasePage;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: TODO
|
||||||
|
* @author: super_liu
|
||||||
|
* @date: 2022年04月25日 12:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SearchStandContext extends BasePage {
|
||||||
|
|
||||||
|
// 标准查询条件
|
||||||
|
@ApiModelProperty(value = "页数")
|
||||||
|
private Integer page;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "区分类别(GB:国内外标准 QB:企业标准)")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: TODO
|
||||||
|
* @author: super_liu
|
||||||
|
* @date: 2022年04月25日 12:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SearchStandResult<T> {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "返回状态 200 正常,-1 系统错误, -10 参数错误")
|
||||||
|
@JSONField(ordinal=1)
|
||||||
|
private String respCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "true:成功 false:失败")
|
||||||
|
@JSONField(ordinal=2)
|
||||||
|
private Boolean ok;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "正常返回空字符串,系统错误时返回系统异常信息及对应描述")
|
||||||
|
@JSONField(ordinal=3)
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
|
||||||
|
public SearchStandResult(String respCode, String message, boolean ok, T data) {
|
||||||
|
this.respCode = respCode;
|
||||||
|
this.message = message;
|
||||||
|
this.ok = ok;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SearchStandResult(String respCode, String message, boolean ok) {
|
||||||
|
this.respCode = respCode;
|
||||||
|
this.message = message;
|
||||||
|
this.ok = ok;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: TODO
|
||||||
|
* @author: super_liu
|
||||||
|
* @date: 2022年04月25日 12:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StandData {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准ID")
|
||||||
|
@JSONField(ordinal=1)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准类型")
|
||||||
|
@JSONField(ordinal=2)
|
||||||
|
private String standType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准分类")
|
||||||
|
@JSONField(ordinal=3)
|
||||||
|
private String standSort;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准号")
|
||||||
|
@JSONField(ordinal=4)
|
||||||
|
private String standNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "年代号")
|
||||||
|
@JSONField(ordinal=5)
|
||||||
|
private String standYear;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准名称")
|
||||||
|
@JSONField(ordinal=6)
|
||||||
|
private String standName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准英文名称")
|
||||||
|
@JSONField(ordinal=7)
|
||||||
|
private String standEnName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准分类+空格+标准号+空格+标准名称")
|
||||||
|
@JSONField(ordinal=8)
|
||||||
|
private String documentName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前标准跳转到本系统内的链接地址")
|
||||||
|
@JSONField(ordinal=9)
|
||||||
|
private String documentUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "代替标准号")
|
||||||
|
@JSONField(ordinal=10)
|
||||||
|
private String dtbzh;
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: TODO
|
||||||
|
* @author: super_liu
|
||||||
|
* @date: 2022年04月25日 14:58
|
||||||
|
*/
|
||||||
|
public enum StandMessageCodeEnum {
|
||||||
|
SUCCESS("200"),
|
||||||
|
ERROR_SYS("-1"),
|
||||||
|
ERROR_PARAM("-10"),
|
||||||
|
SOURCE("SRMS");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private StandMessageCodeEnum(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.entity;
|
||||||
|
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: TODO
|
||||||
|
* @author: super_liu
|
||||||
|
* @date: 2022年04月25日 14:56
|
||||||
|
*/
|
||||||
|
public class StandResult {
|
||||||
|
|
||||||
|
public static <T>SearchStandResult<T> success(String code,String message,T t) {
|
||||||
|
return new SearchStandResult(code, message, true, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T>SearchStandResult<T> error(String code,String message) {
|
||||||
|
return new SearchStandResult(code, message, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toJson(ResponseMessage searchStandResult){
|
||||||
|
GsonBuilder gsonBuilder = getGsonBuilder();
|
||||||
|
Gson json = gsonBuilder.create();
|
||||||
|
return json.toJson(searchStandResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static GsonBuilder getGsonBuilder() {
|
||||||
|
return new GsonBuilder().disableHtmlEscaping().serializeNulls().enableComplexMapKeySerialization().serializeSpecialFloatingPointValues().setLenient();
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.service;
|
||||||
|
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.SearchStandContext;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.StandData;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 标准信息表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author super_liu
|
||||||
|
*/
|
||||||
|
public interface IStandDataTDMService extends IService<StandData> {
|
||||||
|
|
||||||
|
List<StandData> searchStandData(SearchStandContext searchStandContext);
|
||||||
|
}
|
||||||
|
|
||||||
+84
@@ -0,0 +1,84 @@
|
|||||||
|
package com.adc.da.slrs.regulationsTDM.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.regulationsTDM.entity.*;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.dao.StandDataTDMDao;
|
||||||
|
import com.adc.da.slrs.regulationsTDM.service.IStandDataTDMService;
|
||||||
|
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
||||||
|
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import sun.misc.BASE64Encoder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 标准信息表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author super_liu
|
||||||
|
* @date: 2022年04月25日 14:56
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StandDataTDMServiceImpl extends ServiceImpl<StandDataTDMDao, StandData> implements IStandDataTDMService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(StandDataTDMServiceImpl.class);
|
||||||
|
|
||||||
|
private String webUrl = "https://srms.foton.com.cn/#/loginStandDetails";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SarStandardsInfoDao sarStandardInfoDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SarBussionessStandDao sarBussionessStandDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StandData> searchStandData(SearchStandContext searchStandContext){
|
||||||
|
List<StandData> standDataQuery = new ArrayList<>();
|
||||||
|
searchStandContext.setPageSize(100);
|
||||||
|
QueryWrapper queryCount = new QueryWrapper();
|
||||||
|
queryCount.eq("VALID_FLAG","0");
|
||||||
|
if("GB".equals(searchStandContext.getType().toUpperCase())){
|
||||||
|
int count = sarStandardInfoDao.selectCount(queryCount);
|
||||||
|
searchStandContext.getPager().setRowCount(count);
|
||||||
|
standDataQuery = this.baseMapper.searchStandData(searchStandContext);
|
||||||
|
}else if("QB".equals(searchStandContext.getType().toUpperCase())){
|
||||||
|
int count = sarBussionessStandDao.selectCount(queryCount);
|
||||||
|
searchStandContext.getPager().setRowCount(count);
|
||||||
|
standDataQuery = this.baseMapper.searchBussData(searchStandContext);
|
||||||
|
}
|
||||||
|
if(!standDataQuery.isEmpty()){
|
||||||
|
// 重组数据集合 只需documentName 及 documentUrl
|
||||||
|
standDataQuery.stream().peek(standData -> {
|
||||||
|
standData.setDocumentName(verifyObj(standData.getStandSort(),standData.getStandNumber(),standData.getStandName()));
|
||||||
|
standData.setDocumentUrl(webUrl+"?dataId="+standData.getId()+"&datatype="+standData.getStandType());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return standDataQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String verifyObj(String str1,String str2,String str3){
|
||||||
|
String res1 = (str1 == null || str1.equals("")) ? "" : (str1+" ");
|
||||||
|
String res2 = (str2 == null || str2.equals("")) ? "" : (str2+" ");
|
||||||
|
String res3 = (str3 == null || str3.equals("")) ? "" : str3;
|
||||||
|
return res1 + res2 + res3;
|
||||||
|
}
|
||||||
|
private String encode(String str){
|
||||||
|
String encodeStr = new BASE64Encoder().encodeBuffer(str.getBytes()).replaceAll("[\r\n]", "");
|
||||||
|
return encodeStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String errFilter(String str){
|
||||||
|
if (str.contains("Cause")){
|
||||||
|
str = str.split("Cause")[0].replaceAll("\\r\\n###","");
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?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.adc.da.slrs.regulationsTDM.dao.StandDataTDMDao">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.adc.da.slrs.regulationsTDM.entity.StandData">
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="searchStandData" resultMap="BaseResultMap"
|
||||||
|
parameterType="com.adc.da.slrs.regulationsTDM.entity.SearchStandContext">
|
||||||
|
SELECT
|
||||||
|
t.id,
|
||||||
|
t.standType,
|
||||||
|
t.standSort,
|
||||||
|
t.standNumber,
|
||||||
|
t.standYear,
|
||||||
|
t.standName,
|
||||||
|
t.standEnName,
|
||||||
|
t.dtbzh
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
sar_standards_info.id AS id,
|
||||||
|
sar_standards_info.STAND_TYPE AS standType,
|
||||||
|
sar_standards_info.STAND_SORT AS standSort,
|
||||||
|
sar_standards_info.STAND_NUMBER AS standNumber,
|
||||||
|
sar_standards_info.STAND_YEAR AS standYear,
|
||||||
|
sar_standards_info.STAND_NAME AS standName,
|
||||||
|
sar_standards_info.STAND_EN_NAME AS standEnName,
|
||||||
|
SAR_STAND_ATTR_INFO.DTBJH AS dtbzh
|
||||||
|
FROM
|
||||||
|
sar_standards_info
|
||||||
|
LEFT JOIN SAR_STAND_ATTR_INFO ON (
|
||||||
|
SAR_STAND_ATTR_INFO.stand_id = SAR_STANDARDS_INFO.id
|
||||||
|
AND SAR_STAND_ATTR_INFO.valid_flag = 0
|
||||||
|
)
|
||||||
|
WHERE sar_standards_info.valid_flag = 0
|
||||||
|
) t
|
||||||
|
ORDER BY t.standSort ASC,CAST(t.standNumber AS decimal(9,2)) ASC,t.standYear DESC,t.id
|
||||||
|
limit ${pager.startIndex-1},${pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="searchBussData" resultMap="BaseResultMap"
|
||||||
|
parameterType="com.adc.da.slrs.regulationsTDM.entity.SearchStandContext">
|
||||||
|
SELECT
|
||||||
|
t.id,
|
||||||
|
t.standType,
|
||||||
|
t.standSort,
|
||||||
|
t.standNumber,
|
||||||
|
t.standYear,
|
||||||
|
t.standName,
|
||||||
|
t.standEnName,
|
||||||
|
t.dtbzh
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
DISTINCT
|
||||||
|
sar_bussioness_stand.id AS id,
|
||||||
|
'BUSINESS_STAND' AS standType,
|
||||||
|
sar_bussioness_stand.STAND_SORT AS standSort,
|
||||||
|
sar_bussioness_stand.STAND_NUMBER AS standNumber,
|
||||||
|
sar_bussioness_stand.STAND_YEAR AS standYear,
|
||||||
|
sar_bussioness_stand.STAND_NAME AS standName,
|
||||||
|
sar_bussioness_stand.STAND_EN_NAME AS standEnName,
|
||||||
|
sar_buss_stand_attr_info.DTQBBHBUSS AS dtbzh
|
||||||
|
FROM
|
||||||
|
sar_bussioness_stand
|
||||||
|
LEFT JOIN sar_buss_stand_attr_info ON (
|
||||||
|
sar_buss_stand_attr_info.stand_id = sar_bussioness_stand.id
|
||||||
|
AND sar_buss_stand_attr_info.valid_flag = 0
|
||||||
|
)
|
||||||
|
WHERE sar_bussioness_stand.valid_flag = 0
|
||||||
|
) t
|
||||||
|
ORDER BY t.standSort ASC,CAST(t.standNumber AS decimal(9,2)) ASC,t.standYear DESC,t.id
|
||||||
|
limit ${pager.startIndex-1},${pageSize}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user