合并DM到D1~~~~

This commit is contained in:
Mr.Z
2021-08-23 15:03:04 +08:00
3 changed files with 92 additions and 18 deletions
@@ -6,18 +6,18 @@ 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.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
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.entity.*;
import com.adc.da.slrs.sarLawsDetailedList.service.impl.SarLawsDetailedListServiceImpl;
import com.adc.da.util.utils.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -163,4 +163,11 @@ public class SarLawsDetailedListController extends BaseController<SarLawsDetaile
}
@ApiOperation(value = "标准插入已存在的清单")
@PostMapping("/standardToLaws")
public ResponseMessage standardToLaws(String countryArea,TimeDto timeDto){
sarLawsDetailedListService.standardToLaws(countryArea,timeDto);
return Result.success("200",null);
}
}
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarLawsDetailedList.service;
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
import com.adc.da.slrs.sarLawsDetailedList.entity.SarLawsDetailedList;
import com.adc.da.slrs.sarLawsDetailedList.entity.DetailedUpDto;
import com.adc.da.slrs.sarLawsDetailedList.entity.TimeDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
@@ -29,4 +30,7 @@ public interface ISarLawsDetailedListService extends IService<SarLawsDetailedLis
String updateList(DetailedUpDto detailedUpDto);
SarLawsDetailedList selSarLawDetailById(@Param("id")String id);
public void standardToLaws(String countryArea,TimeDto timeDto);
}
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarLawsDetailedList.service.impl;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
import com.adc.da.slrs.sarLawsAttrDetailedList.service.ISarLawsAttrDetailedListService;
import com.adc.da.slrs.sarLawsAttrDetailedList.service.impl.SarLawsAttrDetailedListServiceImpl;
import com.adc.da.slrs.sarLawsDetailedList.dao.SarLawsDetailedListDao;
import com.adc.da.slrs.sarLawsDetailedList.entity.AddDetailedDto;
@@ -17,10 +18,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Array;
import java.util.*;
import static com.adc.da.login.util.UserUtils.getUserName;
@@ -248,20 +251,23 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
for (int a = 0; a < id.length; a++) {
TimeDto dto = new TimeDto();
dto.setStandId(id[a]);
if ("-".equals(putTime[a]) || null == putTime[a]) {
dto.setSsrq(null);
} else {
dto.setSsrq(putTime[a]);
}
if ("-".equals(putTime[a]) || null == xcx[a]) {
dto.setXcxssrqgj(null);
} else {
dto.setXcxssrqgj(xcx[a]);
}
if ("-".equals(putTime[a]) || null == zcc[a]) {
dto.setZccssrqgj(null);
} else {
dto.setZccssrqgj(zcc[a]);
//putTiem即ssrq可能为空 ''
if (putTime.length>0){
if ("-".equals(putTime[a]) || null == putTime[a]) {
dto.setSsrq(null);
} else {
dto.setSsrq(putTime[a]);
}
if ("-".equals(putTime[a]) || null == xcx[a]) {
dto.setXcxssrqgj(null);
} else {
dto.setXcxssrqgj(xcx[a]);
}
if ("-".equals(putTime[a]) || null == zcc[a]) {
dto.setZccssrqgj(null);
} else {
dto.setZccssrqgj(zcc[a]);
}
}
timeDto.add(dto);
}
@@ -584,4 +590,61 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
public SarLawsDetailedList selSarLawDetailById(String id) {
return baseMapper.selectById(id);
}
@Autowired
private ISarLawsAttrDetailedListService sarLawsAttrDetailedListService;
@Override
public void standardToLaws(String countryArea,TimeDto timeDto) {
/**
* 加入对应"国家/地区"的清单列表
*/
//清单id
//标准id
//1.获取标准清单的"国家/地区"
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
wrapper.select("country_area","id");
//查询清单中的国家地区和清单id
List<SarLawsDetailedList> sarLawsDetailedLists = sarLawsDetailedListDao.selectList(wrapper);
//2.判断修改的标准的"国家/地区"与清单中的是否一致,一致则添加到清单中,不一致不作处理
String[] split = countryArea.split(","); //拆分标准中的国家地区
//遍历清单 对比国家地区
for (SarLawsDetailedList lawsDetailed : sarLawsDetailedLists) {
if (lawsDetailed.getCountryArea()==null){
continue;
}
String[] sarLawsCounties = lawsDetailed.getCountryArea().split(",");//拆分清单中的国家地区
// 对比清单列表中的国家地区,是否一致
Arrays.sort(split);
Arrays.sort(sarLawsCounties);
if ( Arrays.equals(split,sarLawsCounties)){
//一致时插入表并关联detailedListId和standId
ArrayList<TimeDto> timeDtos = new ArrayList<>();
timeDtos.add(timeDto);
QueryWrapper<SarLawsAttrDetailedList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("stand_id",timeDto.getStandId());
//如果目标清单中已存标准在则更新 懒得写更新(⓿_⓿) 直接删掉,再重新插入
if (sarLawsAttrDetailedListDao.selectCount(queryWrapper)>0) {
sarLawsAttrDetailedListDao.delete(queryWrapper);
}
sarLawsAttrDetailedListService.insertDetailedList(lawsDetailed.getId(),timeDtos);
break;
}
}
}
}