Merge branch 'develop_master' into develop_3

This commit is contained in:
super_liu
2021-07-26 18:31:43 +08:00
7 changed files with 174 additions and 14 deletions
@@ -1,13 +1,11 @@
package com.adc.da.slrs.sarLawsAttrDetailedList.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -43,44 +41,49 @@ public class LawsDto {
@ExcelProperty(value = "能源类型", index = 4)
@ApiModelProperty(value = "能源类型")
private String NYLX;
@ExcelProperty(value = "标准年份", index = 5)
private String standYear;
@ExcelProperty(value = "标准类别", index = 6)
private String standSortShow;
@ColumnWidth(16)
@ExcelProperty(value = "标准实施日期", index = 5)
@ExcelProperty(value = "标准实施日期", index = 7)
@ApiModelProperty(value = "标准实施日期")
@DateTimeFormat("yyyy年MM月dd日")
private String putTime;
@ColumnWidth(16)
@ExcelProperty(value = "新车型实施日期", index = 6)
@ExcelProperty(value = "新车型实施日期", index = 8)
@ApiModelProperty(value = "新车型实施日期")
@DateTimeFormat("yyyy年MM月dd日")
private String XCXSSRQGJ;
@ColumnWidth(16)
@ExcelProperty(value = "在产车实施日期", index = 7)
@ExcelProperty(value = "在产车实施日期", index = 8)
@ApiModelProperty(value = "在产车实施日期")
@DateTimeFormat("yyyy年MM月dd日")
private String ZCCSSRQGJ;
@ExcelProperty(value = "责任部门", index = 8)
@ExcelProperty(value = "责任部门", index = 9)
@ApiModelProperty(value = "责任部门")
private String ZRBM;
@ColumnWidth(14)
@ExcelProperty(value = "适用产品线", index = 9)
@ExcelProperty(value = "适用产品线", index = 10)
@ApiModelProperty(value = "适用产品线")
private String SYCPX;
@ColumnWidth(20)
@ExcelProperty(value = "乘用车VPPS编码", index = 10)
@ExcelProperty(value = "乘用车VPPS编码", index = 11)
@ApiModelProperty(value = "乘用车VPPS编码")
private String CYCVPPSBM;
@ColumnWidth(20)
@ExcelProperty(value = "乘用车vpps中文名称", index = 11)
@ExcelProperty(value = "乘用车vpps中文名称", index = 12)
@ApiModelProperty(value = "乘用车vpps中文名称")
private String CYCVPPSCN;
@ColumnWidth(20)
@ExcelProperty(value = "卡车VPPS编码", index = 12)
@ExcelProperty(value = "卡车VPPS编码", index = 13)
@ApiModelProperty(value = "卡车VPPS编码")
private String KCCVPPSBM;
@ColumnWidth(20)
@ExcelProperty(value = "卡车vpps中文名称", index = 13)
@ExcelProperty(value = "卡车vpps中文名称", index = 14)
@ApiModelProperty(value = "卡车vpps中文名称")
private String KCCVPPSCN;
@ApiModelProperty(value = "责任工程师")
@ExcelProperty(value = "责任工程师", index = 15)
private String responsibleEngineer;
}
@@ -78,6 +78,14 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
String completedString = builder.delete(builder.length()-1,builder.length()).toString();
list1.setTypeApplicable(completedString);
}
else {
for (Map<String,String> map1:typeApplicable) {
if (map1.get("value").equals(list1.getTypeApplicable())){
list1.setTypeApplicable(map1.get("label"));
break;
}
}
}
}
//能源类型
List<Map<String, String>> nylx = (List<Map<String, String>>)map.get("NYLXCLASS");
@@ -97,6 +105,14 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
String completedString = builder.delete(builder.length()-1,builder.length()).toString();
list1.setNYLX(completedString);
}
else {
for (Map<String,String> map1:nylx) {
if (map1.get("value").equals(list1.getNYLX())){
list1.setNYLX(map1.get("label"));
break;
}
}
}
}
//责任部门
List<Map<String, String>> zrbn = (List<Map<String, String>>)map.get("ZRBMCLASS");
@@ -116,6 +132,14 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
String completedString = builder.delete(builder.length()-1,builder.length()).toString();
list1.setZRBM(completedString);
}
else {
for (Map<String,String> map1:zrbn) {
if (map1.get("value").equals(list1.getZRBM())){
list1.setZRBM(map1.get("label"));
break;
}
}
}
}
//产品线
List<Map<String, String>> sycpx = (List<Map<String, String>>)map.get("SYCPXCLASS");
@@ -135,6 +159,14 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
String completedString = builder.delete(builder.length()-1,builder.length()).toString();
list1.setSYCPX(completedString);
}
else {
for (Map<String,String> map1:sycpx) {
if (map1.get("value").equals(list1.getSYCPX())){
list1.setSYCPX(map1.get("label"));
break;
}
}
}
}
return list;
}
@@ -0,0 +1,60 @@
package com.adc.da.slrs.sarLawsDetailedList.Util;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* //TODO 添加类、接口描述
*
* @author ZhangZhiYuan
* @date 2021-07-26
*/
@Slf4j
public class BeanConverUtil {
/**
* 单个类转换
*
* @param sourceObj
* @param targetClass
* @param <T>
* @return
*/
public static <T> T conver(Object sourceObj, Class<T> targetClass) {
if (sourceObj == null || targetClass == null) {
return null;
}
T targetObj = null;
try {
targetObj = targetClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
log.error("sourceObj:{},targetClass:{}", sourceObj, targetClass, e);
return null;
}
BeanUtils.copyProperties(sourceObj, targetObj);
return targetObj;
}
/**
* List之间转换
*
* @param sourceList
* @param targetClass
* @param <T>
* @return
*/
public static <T> List<T> converList(List<?> sourceList, Class<T> targetClass) {
if (CollectionUtils.isEmpty(sourceList) || targetClass == null) {
return Collections.emptyList();
}
return sourceList.stream().map(sourceObj -> conver(sourceObj, targetClass)).collect(Collectors.toList());
}
}
@@ -2,24 +2,31 @@ package com.adc.da.slrs.sarLawsDetailedList.controller;
import com.adc.da.att.controller.AttFileEOController;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarLawsDetailedList.Util.BeanConverUtil;
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
import com.adc.da.slrs.sarLawsDetailedList.entity.FindFileNameDto;
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
import com.adc.da.slrs.sarLawsDetailedList.entity.DetailedUpDto;
import com.adc.da.slrs.sarLawsDetailedList.service.impl.SarLawsDetailedListServiceImpl;
import com.adc.da.util.utils.CollectionUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
@@ -37,6 +44,7 @@ public class SarLawsDetailedListController extends BaseController<SarLawsDetaile
@Autowired
private SarLawsDetailedListServiceImpl sarLawsDetailedListService;
@Autowired
private AttFileEOController attFileEOController;
/**
@@ -88,8 +96,35 @@ public class SarLawsDetailedListController extends BaseController<SarLawsDetaile
String detailedList,
String detailedListName) {
if (StringUtils.isNotEmpty(sortKey)) {
IPage<SarLawsDetailedList> publicList = sarLawsDetailedListService.AllSelectD(page, pageSize, sortKey,
IPage<SarLawsDetailedList> publicList1 = sarLawsDetailedListService.AllSelectD(page, pageSize, sortKey,
countryArea, projectName, detailedList, detailedListName);
List<SarLawsDetailedList> list= publicList1.getRecords();//从封装中取出数据
List<FindFileNameDto> list1;//继承类集合实现
list1 = BeanConverUtil.converList(list,FindFileNameDto.class);//将原来类的数据赋给继承类
List<AttFileEO> attFileEOS;//新建文件信息的集合
for (int a=0;a<list.size();a++){
if (null!=list.get(a).getFileIds() && list.get(a).getFileIds().contains(",")){//判断集合中是否有id,是否有逗号
attFileEOS = attFileEOController.getMultiFileInfos(list.get(a).getFileIds()).getData();//根据id取出数据
FindFileNameDto fileNameDto = list1.get(a);//按顺序取出新表数据
if (attFileEOS.size()<=1){//判断有几个数据
fileNameDto.setFileName(attFileEOS.get(a).getOldFileName());//向新表里填入文件名
}else {
List<String> idList = attFileEOS.stream().map(AttFileEO::getOldFileName).collect(Collectors.toList());//多个数据取出数据
String FileNames = StringUtils.join(idList.toArray(),",");//拼接
fileNameDto.setFileName(FileNames);//存入
}
list1.set(a,fileNameDto);
}else if (null!=list.get(a).getFileIds()){
AttFileEO attFileEO = attFileEOController.getAttFileInfo(list.get(a).getFileIds()).getData();
}
}
IPage<FindFileNameDto> publicList = new Page<>();
publicList.setCurrent(publicList1.getCurrent());
publicList.setRecords(list1);
publicList.setTotal(publicList1.getTotal());
publicList.setSize(publicList1.getSize());
publicList.setPages(publicList1.getPages());
return Result.success("200", publicList);
} else {
return Result.success("200", null);
@@ -0,0 +1,21 @@
package com.adc.da.slrs.sarLawsDetailedList.entity;
/**
* //TODO 添加类、接口描述
*
* @author ZhangZhiYuan
* @date 2021-07-26
*/
public class FindFileNameDto extends SarLawsDetailedList {
private String fileName;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}
@@ -210,6 +210,13 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
}
String completedString = builder.delete(builder.length() - 1, builder.length()).toString();
list1.setCountryArea(completedString);
}else {
for (Map<String,String> map1:arr) {
if (map1.get("value").equals(list1.getCountryArea())){
list1.setCountryArea(map1.get("label"));
break;
}
}
}
}
userIPage.setRecords(list);
@@ -3,9 +3,11 @@
<mapper namespace="com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao">
<select id="selectLawsById" parameterType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarFindDto" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.LawsDto">
SELECT a.ID,a.STAND_NUMBER,a.STAND_NAME,a.STAND_EN_NAME,b.NYLX,a.PUT_TIME,b.XCXSSRQGJ,b.ZCCSSRQGJ,b.ZRBM,b.SYCPX,b.CYCVPPSBM,b.CYCVPPSCN,b.KCCVPPSBM,b.KCCVPPSCN,b.CLLX as typeApplicable
SELECT a.ID,a.STAND_NUMBER,a.STAND_NAME,a.STAND_EN_NAME,b.NYLX,a.PUT_TIME,b.XCXSSRQGJ,b.ZCCSSRQGJ,b.ZRBM,b.SYCPX,b.CYCVPPSBM,b.CYCVPPSCN,b.KCCVPPSBM,b.KCCVPPSCN,
b.CLLX as typeApplicable,dicstandSort.DIC_TYPE_NAME as standSortShow ,a.STAND_YEAR as standYear
FROM sar_standards_info a LEFT JOIN sar_stand_attr_info b on
a.ID = b.STAND_ID
a.ID = b.STAND_ID left join TS_DICTYPE dicstandSort on (dicstandSort.dic_type_code = a.stand_sort and
dicstandSort.dic_id is not null and dicstandSort.valid_flag = 0 and dicstandSort.PARENT_ID is null)
<where>
<if test="sarFindDto.standName != null">
(a.STAND_NUMBER LIKE concat ('%',#{sarFindDto.standName,jdbcType=VARCHAR},'%')