Merge branch 'develop_3' into 'develop_master'

feat: 国内外标准 反向标准显示逻辑

See merge request !75
This commit is contained in:
super_liu
2021-07-29 16:55:10 +00:00
7 changed files with 101 additions and 12 deletions
@@ -28,6 +28,8 @@ public interface SarStandAttrInfoDao extends BaseMapper<SarStandAttrInfo> {
Map<String, Object> selectStandFieldAndData(@Param("fieldInfo") String fieldInfo, @Param("standId") String standId);
List<Map<String, Object>> selectStandFieldAndDataListMap(@Param("fieldInfo") String fieldInfo, @Param("ids") List<String> ids);
int insertStandAttr(@Param("fieldInfo") String fieldInfo, @Param("fieldValue") String fieldValue);
int deleteStandAttrByStandId(@Param("standId") String standId);
@@ -1,10 +1,7 @@
package com.adc.da.slrs.sarStandardsInfo.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.hutool.core.util.ZipUtil;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.common.FileUnZip;
import com.adc.da.common.ReadExcel;
import com.adc.da.exception.AdcDaBaseException;
@@ -20,7 +17,6 @@ import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.*;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
@@ -42,7 +38,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -82,6 +77,12 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
@Autowired
ISarLawsInfoService sarLawsInfoEOService;
@ApiOperation(value="SarStandardsInfoEO|反向标准操作")
@GetMapping(value = "/reverseQueryStand")
public void reverseQueryStand(@RequestParam(name="ids",required=true) String ids, String standName, String type) {
this.sarStandardsInfoEOService.reverseQueryStand(Arrays.asList(ids.split(",")),standName,type);
}
@ApiOperation(value = "|SarStandardsInfoEO|自定义分页查询")
@GetMapping("/getSarStandardsInfoPage")
//@RequiresPermissions("lawss:sarStandardsInfo:getSarStandardsInfoPage")
@@ -94,6 +94,14 @@ public class SarStandardsInfo extends BaseEntity {
@TableField("REPLACED_STAND_NUM")
private String replacedStandNum;
@ApiModelProperty(value = "代替部分标准号")
@TableField("REPLACE_PART_STAND_NUM")
private String replacePartStandNum;
@ApiModelProperty(value = "被代替部分标准号")
@TableField("REPLACED_PART_STAND_NUM")
private String replacedPartStandNum;
@TableField("CREATION_USER")
private String creationUser;
@@ -17,6 +17,8 @@ import java.util.Map;
*/
public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
void reverseQueryStand(List<String> ids, String standName,String type);
List<SarStandardsInfo> getSarStandardsInfoPage(SarStandardsInfoEOPage page) throws Exception;
void createSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception;
@@ -9,7 +9,6 @@ import com.adc.da.http.Result;
import com.adc.da.mq.service.CreateStandMQService;
import com.adc.da.person.dao.PersonCollectEODao;
import com.adc.da.person.dao.PersonShareEODao;
import com.adc.da.person.entity.PersonMsgEO;
import com.adc.da.person.service.IPersonCollectEOService;
import com.adc.da.search.service.StandLawsSearchService;
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
@@ -40,7 +39,6 @@ import com.adc.da.slrs.sarStandPutTime.entity.SarStandPutTime;
import com.adc.da.slrs.sarStandVal.dao.SarStandValDao;
import com.adc.da.slrs.sarStandVal.entity.SarStandVal;
import com.adc.da.slrs.sarStandardsInfo.entity.*;
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
@@ -73,15 +71,24 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.File;
import java.io.FileInputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.sql.Clob;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -187,6 +194,60 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
@Autowired
private StandLawsSearchService standLawsSearchService;
/**
* 反向操作标准
*/
@Override
@Async
public void reverseQueryStand(List<String> ids, String standName,String type){
String fieldInfo = InitStandAttrUtil.queryField;
if (StringUtils.isNotBlank(fieldInfo) && StringUtils.isNotBlank(type)) {
List<Map<String, Object>> getAttrListMap = sarStandAttrInfoEODao.selectStandFieldAndDataListMap(fieldInfo, ids);
getAttrListMap.forEach(attrMap -> {
List<String> list = Collections.singletonList(attrMap.get(type).toString());
list.add(standName);
String reverseStandName = list.stream().map(String::toString).collect(Collectors.joining(","));
attrMap.put(type,reverseStandName);
SarStandAttrInfo sarStandAttrInfo = map2Object(attrMap,SarStandAttrInfo.class);
sarStandAttrInfoEODao.updateById(sarStandAttrInfo);
});
}
}
public static <T> T map2Object(Map<String, Object> map, Class<T> clazz) {
T obj = null;
try {
BeanInfo bean = Introspector.getBeanInfo(clazz);
PropertyDescriptor[] propertyDescriptorArr = bean.getPropertyDescriptors();
for (int i = 0; i < propertyDescriptorArr.length; i++) {
PropertyDescriptor propertyDescriptor = propertyDescriptorArr[i];
String name = propertyDescriptor.getName();
if(map.containsKey(name)) {
Object value = map.get(name);
if("null".equals(value)) {
value = null;
}
Object[] objArr = new Object[0];
objArr[0] = value;
try {
propertyDescriptor.getWriteMethod().invoke(obj, objArr);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
} catch (IntrospectionException e) {
e.printStackTrace();
}
return obj;
}
/***
* @Description: 分页查询
@@ -448,8 +509,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
}
//编写预警信息
// writeWarnings(sarStandardsInfoEO);
// updateCiteStand(sarStandardsInfoEO, null, "DTBJH", "BDTBZBH");
// updateCiteStand(sarStandardsInfoEO, null, "YYBJ", "BYYBJ");
updateCiteStand(sarStandardsInfoEO, null, "YYBJ", "BYYBJ");
updateCiteStand(sarStandardsInfoEO, null, "BFDTBZ", "BBFDTBZ");
// updateRelateStand(sarStandardsInfoEO, "CBBH");
// 根据代替标准号修改被代替的标准的状态 修改为已修订状态
replaseStandState(sarStandardsInfoEO);
@@ -502,6 +563,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
sarStandardsInfoEO.setRelateStand(attrValue);
} else if ("DTBJH".equals(attrKey)) {
sarStandardsInfoEO.setReplaceStandNum(attrValue);
}else if ("BFDTBZ".equals(attrKey)) {
sarStandardsInfoEO.setReplacePartStandNum(attrValue);
}
// 多选项,文件类型需要单独处理 向子表添加数据
if (InitStandAttrUtil.selectionFieldList.contains(attrKey)) {
@@ -718,6 +781,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
newCiteStand = sarStandardsInfoEO.getRelateStand();
} else if ("DTBJH".equals(upField)) {
newCiteStand = sarStandardsInfoEO.getReplaceStandNum();
}else if ("BFDTBZ".equals(upField)) {
newCiteStand = sarStandardsInfoEO.getReplacePartStandNum();
}
if (StringUtils.isNotEmpty(newCiteStand) && newCiteStand.split(",").length > 0) {
// 主要逻辑处理新增的
@@ -1016,8 +1081,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
//修改标准过程中,重新修改代替标准号对应的标准的被代替标准号
// updateReplacedNumber(sarStandardsInfoEO,beforeSarStandardsInfo);
// 根据引用标准修改其他被引用标准
// updateCiteStand(sarStandardsInfoEO, beforeSarStandardsInfo, "DTBJH", "BDTBZBH");
// updateCiteStand(sarStandardsInfoEO, beforeSarStandardsInfo, "YYBJ", "BYYBJ");
updateCiteStand(sarStandardsInfoEO, null, "YYBJ", "BYYBJ");
updateCiteStand(sarStandardsInfoEO, null, "BFDTBZ", "BBFDTBZ");
// 根据对应其他标准修改其他对应其他标准
// updateRelateStand(sarStandardsInfoEO, "CBBH");
// 根据代替标准号修改被代替的标准的状态 修改为已修订状态
@@ -197,6 +197,17 @@
WHERE valid_flag=0 and stand_id = #{standId, jdbcType=VARCHAR}
</select>
<!-- 查询字段及对应数据 List<Map>-->
<select id="selectStandFieldAndDataListMap" resultType="Map">
SELECT ${fieldInfo},ID
FROM SAR_STAND_ATTR_INFO
WHERE valid_flag=0
and stand_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item, jdbcType=VARCHAR}
</foreach>
</select>
<insert id="insertStandAttr" parameterType="java.lang.String" >
insert into SAR_STAND_ATTR_INFO(${fieldInfo})
values (${fieldValue})
@@ -395,7 +395,7 @@
<if test="country != null and country != ''">
and country = #{country}
</if>
<!-- 标准编号 -->
<!-- 标准编号111 -->
<if test="standNumber != null and standNumber != ''">
and (
(concat(SAR_STANDARDS_INFO.STAND_SORT,' ',SAR_STANDARDS_INFO.STAND_NUMBER,'-',