Merge remote-tracking branch 'origin/develop_1' into develop_master

This commit is contained in:
yuezhihang
2021-08-19 10:41:20 +08:00
8 changed files with 229 additions and 82 deletions
@@ -22,7 +22,7 @@ import java.util.List;
public interface SarLawsAttrDetailedListDao extends BaseMapper<SarLawsAttrDetailedList> {
//根据清单id,查出标准的id并排序
List<String> selectLawsId(@Param("standId") String standId,@Param("param3") Integer page,@Param("param2") Integer size);
List<String> selectLawsId(@Param("standId") String standId,@Param("param3") Integer page,@Param("param2") Integer size,@Param("sar") SarFindDto sarFindDto);
//根据标准id查出数据
List<LawsDto> selectLawsById(@Param("param1") List<String> LawsIds, @Param("sarFindDto") SarFindDto sarFindDto);
//根据标准id查出数据用于清单查询
@@ -45,7 +45,7 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
wrapper.eq("detailed_list_id", sarFindDto.getId());
IPage<SarLawsAttrDetailedList> selectPage = sarLawsAttrDetailedListDao.selectPage(pageRes,wrapper);
//查询标准id
List<String> lawsIds = sarLawsAttrDetailedListDao.selectLawsId(sarFindDto.getId(),(sarFindDto.getPage())-1,sarFindDto.getSize());
List<String> lawsIds = sarLawsAttrDetailedListDao.selectLawsId(sarFindDto.getId(),(sarFindDto.getPage())-1,sarFindDto.getSize(),sarFindDto);
if (CollectionUtils.isEmpty(lawsIds)){
return null;
}
@@ -16,6 +16,8 @@ public class AddDetailedDto {
private String countryArea;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "车型类别")
private String carType;
@ApiModelProperty(value = "清单类别")
private String detailedList;
@ApiModelProperty(value = "区分,国家地区为1,项目名称为2,清单类别为3")
@@ -40,6 +42,4 @@ public class AddDetailedDto {
private String inforlist2;
@ApiModelProperty(value = "新车型实施时间")
private String inforlist3;
@ApiModelProperty(value = "车辆类别")
private String carType;
}
@@ -23,6 +23,9 @@ public class DetailedUpDto {
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "车型类别")
private String carType;
@ApiModelProperty(value = "清单类别")
private String detailedList;
@@ -12,7 +12,7 @@ import lombok.experimental.Accessors;
/**
* <p>
*
*
* </p>
*
* @author szc
@@ -41,6 +41,10 @@ public class SarLawsDetailedList extends BaseEntity {
@TableField("project_name")
private String projectName;
@ApiModelProperty(value = "车型类别")
@TableField("car_type")
private String carType;
@ApiModelProperty(value = "清单类别")
@TableField("detailed_list")
private String detailedList;
@@ -81,8 +85,5 @@ public class SarLawsDetailedList extends BaseEntity {
@TableField("file_id")
private String fileIds;
@ApiModelProperty(value = "附件id")
@TableField("car_type")
private String carType;
}
@@ -60,19 +60,158 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
@Override
public String add(AddDetailedDto addDetailedDto) {
//判断页面的国家地区是否和数据库里的字段长度相等
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
wrapper.select("DISTINCT country_area,car_type");
List<SarLawsDetailedList> sarLawsDetailedLists = sarLawsDetailedListDao.selectList(wrapper);
//国家/地区清单 多选是否可以添加的标识,true表示可以添加,false表示不许添加
boolean multiAddFlag = true;
//国家/地区清单 单选是否可以添加的标识,true表示可以添加,false表示不许添加
boolean singleAddFlag = true;
//车型类别是否可以添加的标识,true表示可以添加,false表示不许添加
boolean carAddFlag = true;
// System.out.println("数据库的值"+sarLawsDetailedLists);
// System.out.println("数据库里有多少条数据"+sarLawsDetailedLists.size());
// System.out.println("数据库里第一条"+sarLawsDetailedLists.get(1));
//先判断数据库里有没有值,如果没有,就直接新增
if (sarLawsDetailedLists.size() == 0) {
//下面放添加的具体方法
newListMethod(addDetailedDto);
return "数据库为空,添加成功";
}
//如果数据库有值,根据页面的字段进行判断是哪个清单的新增
else {
//如果是其他新增
if (addDetailedDto.getCountryArea() == null && addDetailedDto.getCarType() == null) {
//下面放添加的具体方法
newListMethod(addDetailedDto);
return "其他清单添加成功";
}
//如果是车辆新增
else if (addDetailedDto.getCarType() != null) {
//就判断页面的值和数据库里的值是否相等
for (int i = 0; i < sarLawsDetailedLists.size(); i++) {
//相等就不许添加
if (Objects.equals(addDetailedDto.getCarType(), sarLawsDetailedLists.get(i).getCarType())) {
System.out.println("数据库里第" + (i + 1) + "条的车型类别字段和页面一样,重复,不许添加");
carAddFlag = false;
}
}
}
//如果是国家新增
else if (addDetailedDto.getCountryArea() != null) {
for (int i = 0; i < sarLawsDetailedLists.size(); i++) {
//就先判断数据库里的数据的国家/地区字段是否为空
if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCountryArea()) {
System.out.println("数据库里第" + (i + 1) + "条的国家地区字段长度为空,不重复,目前可以添加");
}
//再判断页面字段长度是否与数据库里的长度一样,如果长度不一样,允许新增
else if (addDetailedDto.getCountryArea().length() != sarLawsDetailedLists.get(i).getCountryArea().length()) {
System.out.println("数据库里第" + (i + 1) + "条的国家地区字段长度和页面的国家地区字段长度不一样,不重复,目前可以添加");
}
//如果不为空且长度一样
else {
//判断页面的国家地区是单选还是多选(判断能不能拆)
if (addDetailedDto.getCountryArea().contains(",")) {
System.out.println("页面是多选");
//如果数据库里的国家地区字段存在",",说明是多选,如果不存在说明是单选
if (sarLawsDetailedLists.get(i).getCountryArea().contains(",")) {
System.out.println("数据库是多选,如果页面字段拆分之后都包含于数据库字段拆分之后,则说明重复,目前不许添加");
System.out.println("页面字段为" + addDetailedDto.getCountryArea());
//页面字段以“,”为分隔符拆分后的结果
String[] frontCountryArea = addDetailedDto.getCountryArea().split(",");
//数据库字段以“,”为分隔符拆分后的结果
String[] databaseCountryArea = sarLawsDetailedLists.get(i).getCountryArea().split(",");
//如果页面字段拆分之后都包含于数据库字段拆分之后,则说明重复,不许添加
for (int j = 0; j < frontCountryArea.length; j++) {
//如果数据库包含了页面字段的所有值,说明这俩完全相同,重复,不许添加
List<String> databaseCountryAreaList = Arrays.asList(databaseCountryArea);
if (databaseCountryAreaList.contains(frontCountryArea[j])) {
System.out.println("数据库" + databaseCountryAreaList);
System.out.println("页面" + frontCountryArea[j]);
System.out.println("数据库里的字段包含页面里的字段,可能重复,目前不许添加");
multiAddFlag = false;
} else {
System.out.println("数据库" + databaseCountryAreaList);
System.out.println("页面" + frontCountryArea[j]);
System.out.println("数据库里的字段和页面字段虽然长度相同,但是里面有不一样的元素,可以添加");
multiAddFlag = true;
}
}
if (multiAddFlag == true) {
System.out.println("长度相同,只要有一个不重复,就可以添加");
} else {
System.out.println("长度相同,整个循环下来都重复,说明两个字段重复,不许添加");
break;
}
}
} else {
System.out.println("页面是单选");
//如果数据库里的国家地区字段存在",",说明是多选,如果不存在说明是单选
if (sarLawsDetailedLists.get(i).getCountryArea().contains(",")) {
System.out.println("数据库是多选,肯定不重复,目前可以添加");
} else {
System.out.println("数据库是单选,如果数据库里的字段和页面的字段相等,重复,不许添加");
//如果数据库里的字段和页面的字段相等,重复,不许添加
if (Objects.equals(sarLawsDetailedLists.get(i).getCountryArea(), addDetailedDto.getCountryArea())) {
System.out.println("数据库里的字段和页面的字段相等,重复,不许添加");
singleAddFlag = false;
break;
} else {
System.out.println("数据库里的字段和页面的字段不相等,不重复,允许添加");
}
}
}
}
}
}
}
//如果是国家和车型清单
//如果整个循环下来都没有重复,则可以添加,不然就说明有重复,不能添加
if (carAddFlag == true && multiAddFlag == true && singleAddFlag == true) {
//下面放添加的具体方法
newListMethod(addDetailedDto);
return "车型类别清单添加成功";
//添加方法结束
} else if (carAddFlag == false){
//0表示添加成功,1表示添加失败
return "车型类别清单添加失败";
}
//如果循环完整个数据库,都没有重复使当前数据无法添加,则添加
if (multiAddFlag == true && singleAddFlag == true && carAddFlag == true) {
//下面放添加的具体方法
newListMethod(addDetailedDto);
//0表示添加成功,1表示添加失败
return "国家/地区清单添加成功";
//添加方法结束
} else {
//0表示添加成功,1表示添加失败
return "国家/地区清单添加失败";
}
}
/**
* 具体用来新增清单的方法
*
* @param addDetailedDto
*/
private void newListMethod(AddDetailedDto addDetailedDto) {
try {
SarLawsDetailedList sarLawsDetailedList = SarLawsDetailedList.builder()
.id(UUIDUtils.randomUUID20())
.sortKey(addDetailedDto.getSortKey())
.detailedListName(addDetailedDto.getDetailedListName())
.detailedListState("0")
.detailedListVision("v0")
.applicationScope(addDetailedDto.getApplicationScope())
.updateTime(new Date())
.updatePeople(addDetailedDto.getUpdatePeople())
.remark(addDetailedDto.getRemark())
.updatePeople(getUserName())
.fileIds(addDetailedDto.getFileIds())
.carType(addDetailedDto.getCarType())
.build();
List<TimeDto> timeDto = new ArrayList<>();
switch (addDetailedDto.getSortKey()) {
@@ -81,7 +220,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
break;
case "2":
sarLawsDetailedList.setProjectName(addDetailedDto.getProjectName());
sarLawsDetailedList.setCarType(addDetailedDto.getCarType());
break;
@@ -92,36 +231,38 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
default:
break;
}
if ("admin".equals(getUserName()))sarLawsDetailedList.setUpdatePeople("管理员");
else {sarLawsDetailedList.setUpdatePeople(getUserName());}
if ("admin".equals(getUserName())) sarLawsDetailedList.setUpdatePeople("管理员");
else {
sarLawsDetailedList.setUpdatePeople(getUserName());
}
sarLawsDetailedListDao.insert(sarLawsDetailedList);
if (addDetailedDto.getInforlist()!=null){
if (addDetailedDto.getInforlist().contains(",")){
if (addDetailedDto.getInforlist() != null) {
if (addDetailedDto.getInforlist().contains(",")) {
String[] id = addDetailedDto.getInforlist().split(",");
String[] ssrq = addDetailedDto.getInforlist1().split(",");
String[] putTime = addDetailedDto.getInforlist1().split(",");
String[] zcc = addDetailedDto.getInforlist2().split(",");
String[] xcx = addDetailedDto.getInforlist3().split(",");
for (int a =0;a< id.length;a++){
for (int a = 0; a < id.length; a++) {
TimeDto dto = new TimeDto();
dto.setStandId(id[a]);
if ("-".equals(ssrq[a]) || null==ssrq[a] ){
if ("-".equals(putTime[a]) || null == putTime[a]) {
dto.setSsrq(null);
}else {
dto.setSsrq(ssrq[a]);
} else {
dto.setSsrq(putTime[a]);
}
if ("-".equals(ssrq[a]) || null == xcx[a]){
if ("-".equals(putTime[a]) || null == xcx[a]) {
dto.setXcxssrqgj(null);
}else {
} else {
dto.setXcxssrqgj(xcx[a]);
}
if ("-".equals(ssrq[a]) || null == zcc[a]){
if ("-".equals(putTime[a]) || null == zcc[a]) {
dto.setZccssrqgj(null);
}else {
} else {
dto.setZccssrqgj(zcc[a]);
}
timeDto.add(dto);
}
}else {
} else {
TimeDto dto = new TimeDto();
dto.setStandId(addDetailedDto.getInforlist());
dto.setSsrq(addDetailedDto.getInforlist1());
@@ -129,30 +270,28 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
dto.setZccssrqgj(addDetailedDto.getInforlist3());
timeDto.add(dto);
}
}else {
timeDto=null;
} else {
timeDto = null;
}
service.insertDetailedList(sarLawsDetailedList.getId(),timeDto);
service.insertDetailedList(sarLawsDetailedList.getId(), timeDto);
} catch (Exception e) {
e.printStackTrace();
}
return "添加成功";
}
@Override
public IPage<SarLawsDetailedList> AllSelectD(Integer page, Integer pageSize, String sortKey,
String countryArea, String projectName,
String detailedList, String detailedListName,String carType) {
String countryArea, String projectName, String carType,
String detailedList, String detailedListName) {
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
if ("1".equals(sortKey)) {
wrapper.like(StringUtils.isNotEmpty(countryArea), "country_area", countryArea).
like(StringUtils.isNotEmpty(detailedListName), "detailed_list_name", detailedListName);
} else if ("2".equals(sortKey)) {
wrapper.like(StringUtils.isNotEmpty(projectName), "project_name", projectName).
like(StringUtils.isNotEmpty(detailedListName), "detailed_list_name", detailedListName).
like(StringUtils.isNotEmpty(carType), "car_type", carType);
wrapper.like(StringUtils.isNotEmpty(carType), "car_type", carType).
like(StringUtils.isNotEmpty(detailedListName), "detailed_list_name", detailedListName);
} else if ("3".equals(sortKey)) {
wrapper.like(StringUtils.isNotEmpty(detailedList), "detailed_list", detailedList).
@@ -180,9 +319,9 @@ 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())){
} else {
for (Map<String, String> map1 : arr) {
if (map1.get("value").equals(list1.getCountryArea())) {
list1.setCountryArea(map1.get("label"));
break;
}
@@ -201,46 +340,46 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
SarLawsDetailedList list = sarLawsDetailedListDao.selectById(detailedUpDto.getId());
//国家或地区
if (StringUtils.isBlank(detailedUpDto.getCountryArea())) list.setCountryArea(null);
else if ("null".equals(detailedUpDto.getCountryArea()));
else if ("null".equals(detailedUpDto.getCountryArea())) ;
else list.setCountryArea(detailedUpDto.getCountryArea());
//项目名称
if (StringUtils.isBlank(detailedUpDto.getProjectName())) list.setProjectName(null);
else if ("null".equals(detailedUpDto.getProjectName()));
else list.setProjectName(detailedUpDto.getProjectName());
//车型类别
if (StringUtils.isBlank(detailedUpDto.getCarType())) list.setCarType(null);
else if ("null".equals(detailedUpDto.getCarType())) ;
else list.setCarType(detailedUpDto.getCarType());
//清单类别
if (StringUtils.isBlank(detailedUpDto.getDetailedList())) list.setDetailedList(null);
else if ("null".equals(detailedUpDto.getDetailedList()));
else if ("null".equals(detailedUpDto.getDetailedList())) ;
else list.setDetailedList(detailedUpDto.getDetailedList());
//清单名称
if (StringUtils.isBlank(detailedUpDto.getDetailedListName())) list.setDetailedListName(null);
else if ("null".equals(detailedUpDto.getDetailedListName()));
else if ("null".equals(detailedUpDto.getDetailedListName())) ;
else list.setDetailedListName(detailedUpDto.getDetailedListName());
//适用领域
if (StringUtils.isBlank(detailedUpDto.getApplicationScope())) list.setApplicationScope(null);
else if ("null".equals(detailedUpDto.getApplicationScope()));
else if ("null".equals(detailedUpDto.getApplicationScope())) ;
else list.setApplicationScope(detailedUpDto.getApplicationScope());
//清单详情
if (StringUtils.isBlank(detailedUpDto.getRemark())) list.setRemark(null);
else if ("null".equals(detailedUpDto.getRemark()));
else if ("null".equals(detailedUpDto.getRemark())) ;
list.setRemark(detailedUpDto.getRemark());
//版本号
if (StringUtils.isBlank(detailedUpDto.getDetailedListVision())) list.setDetailedListVision(null);
else if ("null".equals(detailedUpDto.getDetailedListVision()));
else if ("null".equals(detailedUpDto.getDetailedListVision())) ;
list.setDetailedListVision(detailedUpDto.getDetailedListVision());
//更新时间
list.setUpdateTime(new Date());
//更新人
if (StringUtils.isBlank(detailedUpDto.getReNewPeople())) list.setUpdatePeople(null);
else if ("null".equals(detailedUpDto.getReNewPeople()));
else if ("null".equals(detailedUpDto.getReNewPeople())) ;
else list.setUpdatePeople(detailedUpDto.getReNewPeople());
//更新人
if (StringUtils.isBlank(detailedUpDto.getDetailedListState())) list.setDetailedListState(null);
else if ("null".equals(detailedUpDto.getDetailedListState()));
else if ("null".equals(detailedUpDto.getDetailedListState())) ;
else list.setDetailedListState(detailedUpDto.getDetailedListState());
//文件
if (StringUtils.isBlank(detailedUpDto.getFileIds())) list.setFileIds(null);
else if ("null".equals(detailedUpDto.getFileIds()));
else if ("null".equals(detailedUpDto.getFileIds())) ;
else list.setFileIds(detailedUpDto.getFileIds());
sarLawsDetailedListDao.updateById(list);
@@ -248,31 +387,31 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
if (src.equals(detailedUpDto.getInforlist()) || null != detailedUpDto.getInforlist()) {
List<TimeDto> timeDto = new ArrayList<>();
if ( detailedUpDto.getInforlist().contains(",")) {
if (detailedUpDto.getInforlist().contains(",")) {
String[] id = detailedUpDto.getInforlist().split(",");
String[] ssrq = detailedUpDto.getInforlist1().split(",");
String[] putTime = detailedUpDto.getInforlist1().split(",");
String[] zcc = detailedUpDto.getInforlist2().split(",");
String[] xcx = detailedUpDto.getInforlist3().split(",");
for (int a = 0; a < id.length; a++) {
TimeDto dto = new TimeDto();
dto.setStandId(id[a]);
if (ssrq.length<=a) {
dto.setSsrq(null);
} else {
dto.setSsrq(ssrq[a]);
}
if (ssrq.length<=a) {
dto.setXcxssrqgj(null);
} else {
dto.setXcxssrqgj(xcx[a]);
}
if (ssrq.length<=a) {
dto.setZccssrqgj(null);
} else {
dto.setZccssrqgj(zcc[a]);
}
timeDto.add(dto);
for (int a = 0; a < id.length; a++) {
TimeDto dto = new TimeDto();
dto.setStandId(id[a]);
if (putTime.length <= a) {
dto.setSsrq(null);
} else {
dto.setSsrq(putTime[a]);
}
if (putTime.length <= a) {
dto.setXcxssrqgj(null);
} else {
dto.setXcxssrqgj(xcx[a]);
}
if (putTime.length <= a) {
dto.setZccssrqgj(null);
} else {
dto.setZccssrqgj(zcc[a]);
}
timeDto.add(dto);
}
} else {
TimeDto dto = new TimeDto();
dto.setStandId(detailedUpDto.getInforlist());
@@ -85,9 +85,7 @@ public class SarStandardComplianceAssessResultController {
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER", eo.getStandNumber().trim());
}
// if (eo.getType() != null && !eo.getType().trim().equals("")) {
// queryWrapper.like("type",eo.getType().trim());
// }
IPage<SarInterpretationNationalStandard> page = iSarInterpretationNationalStandardService.page(iPage, queryWrapper);
while (page.getRecords().remove(null)) ;
@@ -103,17 +101,15 @@ public class SarStandardComplianceAssessResultController {
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER", eo.getStandNumber().trim());
}
// if (eo.getType() != null && !eo.getType().trim().equals("")) {
// queryWrapper.like("type",eo.getType().trim());
// }
IPage<SarInterpretationForeignStandard> page = iSarInterpretationForeignStandardService.page(iPage, queryWrapper);
while (page.getRecords().remove(null)) ;
while(page.getRecords().remove(null));
return Result.success(page);
}
}
}
private static class InsertEntity<T> {
private static class InsertEntity<T>{
List<Map> entityList;
T eo;
}
@@ -145,7 +141,7 @@ public class SarStandardComplianceAssessResultController {
}
iSarInterpretationNationalStandardService.saveOrUpdateBatch(entityList);
} else {
}else{
List<SarInterpretationForeignStandard> entityList = new ArrayList<>();
for (int i = 0; i < insertEntity.entityList.size(); i++) {
SarInterpretationForeignStandard obj = new SarInterpretationForeignStandard();
@@ -166,10 +162,10 @@ public class SarStandardComplianceAssessResultController {
public ResponseMessage<IPage<SarStandardComplianceProductAssess>> selectProduct(SarStandardComplianceProductAssessEO eo) throws Exception {
IPage<SarStandardComplianceProductAssess> iPage = new Page<>(eo.getCurrent(), eo.getSize());
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper = new QueryWrapper<>();
if (eo.getType() != null) queryWrapper.eq("type", eo.getType());
if (eo.getProductName() != null) queryWrapper.like("product_name", eo.getProductName());
if (eo.getStandId() != null) queryWrapper.like("STAND_ID", eo.getStandId());
if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
// if (eo.getStandId() != null) queryWrapper.like("STAND_ID", eo.getStandId());
// if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
IPage<SarStandardComplianceProductAssess> page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
return Result.success(page);
}
@@ -91,6 +91,10 @@ public class SarStandardComplianceProductAssess extends BaseEntity {
@ApiModelProperty(value = "在产产品合规信息")
private String productionCompliance;
@ApiModelProperty(value = "在产产品不合规信息")
@TableField("production_non_compliance")
private String productionNonCompliance;
@ApiModelProperty(value = "在产产品不合规应对措施")
private String productionCountermeasures;
@@ -113,6 +117,10 @@ public class SarStandardComplianceProductAssess extends BaseEntity {
@TableField("clause_name")
private String clauseName;
@ApiModelProperty(value = "流程UUID")
@TableField("type")
private String type;
private String id;