标准政策 新增去除重复

This commit is contained in:
yuezhihang
2021-11-12 10:27:43 +08:00
parent 7258ce26cf
commit 5363b35153
3 changed files with 18 additions and 4 deletions
@@ -17,7 +17,8 @@ import java.util.List;
*/
public interface WgStandorpolicyInfoDao extends BaseMapper<WgStandorpolicyInfo> {
List<WgStandorpolicyInfo> researchDatas(@Param(value = "data") String data);
//仅用来政策或者标准新增验重不是查全部的接口
List<WgStandorpolicyInfo> researchDatas();
List<WgStandorpolicyInfo> researchAllDatas(@Param(value = "type")String type);
@@ -15,6 +15,7 @@ import com.adc.da.slrs.wgNetInfo.entity.WgNetInfoDTO;
import com.adc.da.slrs.wgNetInfo.service.IWgNetInfoService;
import com.adc.da.slrs.wgPayInfo.entity.WgPayInfo;
import com.adc.da.slrs.wgPayInfo.service.IWgPayInfoService;
import com.adc.da.slrs.wgStandorpolicyInfo.dao.WgStandorpolicyInfoDao;
import com.adc.da.slrs.wgStandorpolicyInfo.entity.WgStandorpolicyInfo;
import com.adc.da.slrs.wgStandorpolicyInfo.service.IWgStandorpolicyInfoService;
import com.adc.da.slrs.wgWorkGroup.entity.WgWorkGroup;
@@ -56,6 +57,8 @@ public class WgWorkGroupServiceImpl extends ServiceImpl<WgWorkGroupDao, WgWorkGr
@Autowired
private WgWorkGroupDao wgWorkGroupDao;
@Autowired
private WgStandorpolicyInfoDao wgStandorpolicyInfoDao;
@Autowired
private IWgMeetingUserRelationService wgMeetingUserRelationService;
@@ -121,6 +124,11 @@ public class WgWorkGroupServiceImpl extends ServiceImpl<WgWorkGroupDao, WgWorkGr
@Override
public String saveStandDatas(WgWorkGroupDTO wgWorkGroupDTO) {
List<WgStandorpolicyInfo> wgStandorpolicyInfos= wgStandorpolicyInfoDao.researchDatas();
Map<String,WgStandorpolicyInfo> map=new HashMap<>();
wgStandorpolicyInfos.forEach(wgStandorpolicyInfo -> {
map.put(wgStandorpolicyInfo.getStandId()+"-"+wgStandorpolicyInfo.getWgId(),wgStandorpolicyInfo);
});
if (null!=wgWorkGroupDTO.getWgStandorpolicyInfos() && wgWorkGroupDTO.getWgStandorpolicyInfos().size()>0){
List<WgWorkGroup> wgWorkGroups=new ArrayList<>();
wgWorkGroupDTO.getWgStandorpolicyInfos().forEach(wgStandorpolicyInfo -> {
@@ -128,9 +136,13 @@ public class WgWorkGroupServiceImpl extends ServiceImpl<WgWorkGroupDao, WgWorkGr
BeanUtils.copyProperties(wgWorkGroupDTO,wgWorkGroup);
wgWorkGroup.setId(String.valueOf(UUID.randomUUID()));
wgStandorpolicyInfo.setWgId(wgWorkGroup.getId());
wgWorkGroups.add(wgWorkGroup);
if (null==map.get(wgStandorpolicyInfo.getStandId()+"-"+wgWorkGroup.getPid())) {
wgWorkGroups.add(wgWorkGroup);
}
});
if (wgWorkGroups.size()==0){
return "政策已存在,请勿重复添加";
}
boolean flag=wgWorkGroupService.saveOrUpdateBatch(wgWorkGroups);
boolean flag1=wgStandorpolicyInfoService.saveOrUpdateBatch(wgWorkGroupDTO.getWgStandorpolicyInfos());
if (flag && flag1){
@@ -4,7 +4,8 @@
<select id="researchDatas" resultType="com.adc.da.slrs.wgStandorpolicyInfo.entity.WgStandorpolicyInfo">
select * from wg_standorpolicy_info where wg_standorpolicy_info.wg_id = #{data}
select wg_standorpolicy_info.id , wg_standorpolicy_info.stand_id , wg_work_group.pid as wgId from wg_standorpolicy_info
left join wg_work_group on wg_work_group.id = wg_standorpolicy_info.wg_id
</select>
<select id="researchAllDatas" resultType="com.adc.da.slrs.wgStandorpolicyInfo.entity.WgStandorpolicyInfo">