Merge branch 'develop_master' into 'FOTON'

Develop master

See merge request LiuChao/foton-slrs-system-rest!348
This commit is contained in:
王夏晖
2022-01-04 16:45:56 +08:00
7 changed files with 229 additions and 146 deletions
@@ -52,6 +52,14 @@ public class WgNetInfo extends BaseEntity {
@TableField("email") @TableField("email")
private String email; private String email;
@ApiModelProperty(value = "联络人")
@TableField("name")
private String name;
@ApiModelProperty(value = "单位")
@TableField("unit")
private String unit;
} }
@@ -63,6 +63,12 @@ public class WgWorkGroupController extends BaseController<WgWorkGroup> {
return wgWorkGroupService.updateData(wgWorkGroupShowDTO); return wgWorkGroupService.updateData(wgWorkGroupShowDTO);
} }
@ApiOperation("修改工作组节点数据")
@PostMapping("/updateDataByWk")
public ResponseMessage<Object> updateDataByWk(@RequestBody WgWorkGroupShowDTO wgWorkGroupShowDTO){
return wgWorkGroupService.updateDataByWk(wgWorkGroupShowDTO);
}
@@ -26,4 +26,6 @@ public interface WgWorkGroupDao extends BaseMapper<WgWorkGroup> {
List<WgWorkGroup> researchDownCheck(@Param(value = "data") String data,@Param(value = "status")String status); List<WgWorkGroup> researchDownCheck(@Param(value = "data") String data,@Param(value = "status")String status);
List<WgWorkGroup> researchDatasCheck(@Param(value = "data") String data,@Param(value = "status")String status);
} }
@@ -31,6 +31,8 @@ public interface IWgWorkGroupService extends IService<WgWorkGroup> {
ResponseMessage<Object> updateData(WgWorkGroupShowDTO wgWorkGroupShowDTO); ResponseMessage<Object> updateData(WgWorkGroupShowDTO wgWorkGroupShowDTO);
ResponseMessage<Object> updateDataByWk(WgWorkGroupShowDTO wgWorkGroupShowDTO);
} }
@@ -322,30 +322,84 @@ public class WgWorkGroupServiceImpl extends ServiceImpl<WgWorkGroupDao, WgWorkGr
@Override @Override
public ResponseMessage<Object> updateData(WgWorkGroupShowDTO wgWorkGroupShowDTO) { public ResponseMessage<Object> updateData(WgWorkGroupShowDTO wgWorkGroupShowDTO) {
List<WgWorkGroup> wgWorkGroupShowDTOS = wgWorkGroupDao.researchDownCheck(wgWorkGroupShowDTO.getId(), "1"); List<WgWorkGroup> wgWorkGroupShowDTOS = wgWorkGroupDao.researchDatasCheck(wgWorkGroupShowDTO.getId(), "0");
if (null != wgWorkGroupShowDTOS && wgWorkGroupShowDTOS.size() > 0) { if (null != wgWorkGroupShowDTOS && wgWorkGroupShowDTOS.size() > 0) {
return Result.error("工作组处在流程中,无法修改"); return Result.error("工作组处在流程中,无法修改");
} else { } else {
return dealAllDatas(wgWorkGroupShowDTO,"sys");
}
}
@Override
public ResponseMessage<Object> updateDataByWk(WgWorkGroupShowDTO wgWorkGroupShowDTO) {
return dealAllDatas(wgWorkGroupShowDTO,"wk");
}
private ResponseMessage<Object> dealAllDatas(WgWorkGroupShowDTO wgWorkGroupShowDTO,String part) {
WgWorkGroup wgWorkGroup = new WgWorkGroup(); WgWorkGroup wgWorkGroup = new WgWorkGroup();
BeanUtils.copyProperties(wgWorkGroupShowDTO, wgWorkGroup); BeanUtils.copyProperties(wgWorkGroupShowDTO, wgWorkGroup);
boolean flag = false; boolean flag = false;
flag = wgWorkGroupService.saveOrUpdate(wgWorkGroup); flag = wgWorkGroupService.saveOrUpdate(wgWorkGroup);
if (null != wgWorkGroupShowDTO.getWgDepts() && wgWorkGroupShowDTO.getWgDepts().size() > 0) { saveBathDept(wgWorkGroupShowDTO, flag,part);
if (StringUtils.isNotEmpty(wgWorkGroupShowDTO.getWgDeptsDel())){ saveBathMeetingUserRelations(wgWorkGroupShowDTO, flag,part);
List<String> strings=new ArrayList<>(Arrays.asList(wgWorkGroupShowDTO.getWgDeptsDel().split(","))); saveBathNetInfo(wgWorkGroupShowDTO, flag,part);
wgDeptService.removeByIds(strings); saveBathPayInfo(wgWorkGroupShowDTO, flag,part);
saveBathStandardPolicyInfo(wgWorkGroupShowDTO, flag,part);
if (flag) {
return Result.success("更新成功");
} else {
return Result.error("无法更新");
} }
List<WgDept> wgDepts=new ArrayList<>();
wgWorkGroupShowDTO.getWgDepts().forEach(wgDeptShow -> {
WgDept wgDept=new WgDept();
BeanUtils.copyProperties(wgDeptShow,wgDept);
if (null==wgDept.getWgId()){
wgDept.setWgId(wgWorkGroupShowDTO.getId());
} }
wgDepts.add(wgDept);
private boolean saveBathPayInfo(WgWorkGroupShowDTO wgWorkGroupShowDTO, boolean flag,String part) {
if (null != wgWorkGroupShowDTO.getWgPayInfos() && wgWorkGroupShowDTO.getWgPayInfos().size() > 0) {
if (StringUtils.isNotEmpty(wgWorkGroupShowDTO.getWgPayInfosDel())) {
List<String> strings = new ArrayList<>(Arrays.asList(wgWorkGroupShowDTO.getWgPayInfosDel().split(",")));
wgPayInfoService.removeByIds(strings);
}
if (!wgWorkGroupShowDTO.getWgPayInfos().isEmpty()) {
wgWorkGroupShowDTO.getWgPayInfos().forEach(wgPayInfo -> {
if (null == wgPayInfo.getWgId()) {
wgPayInfo.setWgId(wgWorkGroupShowDTO.getId());
}
}); });
flag = wgDeptService.saveOrUpdateBatch(wgDepts);
} }
flag = wgPayInfoService.saveOrUpdateBatch(wgWorkGroupShowDTO.getWgPayInfos());
}else if ("sys".equals(part)){
QueryWrapper<WgPayInfo> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("wg_id",wgWorkGroupShowDTO.getId());
wgPayInfoService.remove(queryWrapper);
}
return flag;
}
private boolean saveBathNetInfo(WgWorkGroupShowDTO wgWorkGroupShowDTO, boolean flag,String part) {
if (null != wgWorkGroupShowDTO.getWgNetInfos() && wgWorkGroupShowDTO.getWgNetInfos().size() > 0) {
if (StringUtils.isNotEmpty(wgWorkGroupShowDTO.getWgNetInfosDel())) {
List<String> strings = new ArrayList<>(Arrays.asList(wgWorkGroupShowDTO.getWgNetInfosDel().split(",")));
wgNetInfoService.removeByIds(strings);
}
List<WgNetInfo> wgNetInfos = new ArrayList<>();
wgWorkGroupShowDTO.getWgNetInfos().forEach(wgNetInfoDTO -> {
WgNetInfo wgNetInfo = new WgNetInfo();
BeanUtils.copyProperties(wgNetInfoDTO, wgNetInfo);
if (null == wgNetInfo.getWgId()) {
wgNetInfo.setWgId(wgWorkGroupShowDTO.getId());
}
wgNetInfos.add(wgNetInfo);
});
flag = wgNetInfoService.saveOrUpdateBatch(wgNetInfos);
}else if ("sys".equals(part)) {
QueryWrapper<WgNetInfo> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("wg_id",wgWorkGroupShowDTO.getId());
wgNetInfoService.remove(queryWrapper);
}
return flag;
}
private boolean saveBathMeetingUserRelations(WgWorkGroupShowDTO wgWorkGroupShowDTO, boolean flag,String part) {
if (null != wgWorkGroupShowDTO.getWgMeetingInfos() && wgWorkGroupShowDTO.getWgMeetingInfos().size() > 0) { if (null != wgWorkGroupShowDTO.getWgMeetingInfos() && wgWorkGroupShowDTO.getWgMeetingInfos().size() > 0) {
if (StringUtils.isNotEmpty(wgWorkGroupShowDTO.getWgMeetingInfosDel())) { if (StringUtils.isNotEmpty(wgWorkGroupShowDTO.getWgMeetingInfosDel())) {
List<String> strings = new ArrayList<>(Arrays.asList(wgWorkGroupShowDTO.getWgMeetingInfosDel().split(","))); List<String> strings = new ArrayList<>(Arrays.asList(wgWorkGroupShowDTO.getWgMeetingInfosDel().split(",")));
@@ -372,37 +426,48 @@ public class WgWorkGroupServiceImpl extends ServiceImpl<WgWorkGroupDao, WgWorkGr
wgMeetingUserRelationService.removeByIds(removeMeet); wgMeetingUserRelationService.removeByIds(removeMeet);
wgMeetingUserRelationService.saveBatch(wgMeetingUserRelations); wgMeetingUserRelationService.saveBatch(wgMeetingUserRelations);
} }
} }else if ("sys".equals(part)) {
if (null != wgWorkGroupShowDTO.getWgNetInfos() && wgWorkGroupShowDTO.getWgNetInfos().size() > 0) { QueryWrapper<WgMeetingInfo> queryWrapper=new QueryWrapper<>();
if (StringUtils.isNotEmpty(wgWorkGroupShowDTO.getWgNetInfosDel())){ queryWrapper.eq("wg_id",wgWorkGroupShowDTO.getId());
List<String> strings=new ArrayList<>(Arrays.asList(wgWorkGroupShowDTO.getWgNetInfosDel().split(","))); wgMeetingInfoService.remove(queryWrapper);
wgNetInfoService.removeByIds(strings); List<WgMeetingInfo> wgMeetingInfos=wgMeetingInfoService.list(queryWrapper);
} List<String> removeIds=new ArrayList<>();
List<WgNetInfo> wgNetInfos = new ArrayList<>(); wgMeetingInfos.forEach(wgMeetingInfo -> {
wgWorkGroupShowDTO.getWgNetInfos().forEach(wgNetInfoDTO -> { removeIds.add(wgMeetingInfo.getId());
WgNetInfo wgNetInfo = new WgNetInfo();
BeanUtils.copyProperties(wgNetInfoDTO, wgNetInfo);
if (null==wgNetInfo.getWgId()){
wgNetInfo.setWgId(wgWorkGroupShowDTO.getId());
}
wgNetInfos.add(wgNetInfo);
}); });
flag = wgNetInfoService.saveOrUpdateBatch(wgNetInfos); if (removeIds.size()>0) {
wgMeetingUserRelationService.removeByIds(removeIds);
} }
if (null != wgWorkGroupShowDTO.getWgPayInfos() && wgWorkGroupShowDTO.getWgPayInfos().size() > 0) {
if (StringUtils.isNotEmpty(wgWorkGroupShowDTO.getWgPayInfosDel())){
List<String> strings=new ArrayList<>(Arrays.asList(wgWorkGroupShowDTO.getWgPayInfosDel().split(",")));
wgPayInfoService.removeByIds(strings);
} }
if (!wgWorkGroupShowDTO.getWgPayInfos().isEmpty()){ return flag;
wgWorkGroupShowDTO.getWgPayInfos().forEach(wgPayInfo -> {
if (null==wgPayInfo.getWgId()){
wgPayInfo.setWgId(wgWorkGroupShowDTO.getId());
} }
private boolean saveBathDept(WgWorkGroupShowDTO wgWorkGroupShowDTO, boolean flag,String part) {
if (null != wgWorkGroupShowDTO.getWgDepts() && wgWorkGroupShowDTO.getWgDepts().size() > 0) {
if (StringUtils.isNotEmpty(wgWorkGroupShowDTO.getWgDeptsDel())) {
List<String> strings = new ArrayList<>(Arrays.asList(wgWorkGroupShowDTO.getWgDeptsDel().split(",")));
wgDeptService.removeByIds(strings);
}
List<WgDept> wgDepts = new ArrayList<>();
wgWorkGroupShowDTO.getWgDepts().forEach(wgDeptShow -> {
WgDept wgDept = new WgDept();
BeanUtils.copyProperties(wgDeptShow, wgDept);
if (null == wgDept.getWgId()) {
wgDept.setWgId(wgWorkGroupShowDTO.getId());
}
wgDepts.add(wgDept);
}); });
flag = wgDeptService.saveOrUpdateBatch(wgDepts);
}else if ("sys".equals(part)) {
QueryWrapper<WgDept> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("wg_id",wgWorkGroupShowDTO.getId());
wgDeptService.remove(queryWrapper);
} }
flag = wgPayInfoService.saveOrUpdateBatch(wgWorkGroupShowDTO.getWgPayInfos()); return flag;
} }
private boolean saveBathStandardPolicyInfo(WgWorkGroupShowDTO wgWorkGroupShowDTO, boolean flag,String part) {
if (null != wgWorkGroupShowDTO.getWgStandorpolicyInfos() && wgWorkGroupShowDTO.getWgStandorpolicyInfos().size() > 0) { if (null != wgWorkGroupShowDTO.getWgStandorpolicyInfos() && wgWorkGroupShowDTO.getWgStandorpolicyInfos().size() > 0) {
if (!wgWorkGroupShowDTO.getWgStandorpolicyInfos().isEmpty()) { if (!wgWorkGroupShowDTO.getWgStandorpolicyInfos().isEmpty()) {
wgWorkGroupShowDTO.getWgStandorpolicyInfos().forEach(wgStandorpolicyInfo -> { wgWorkGroupShowDTO.getWgStandorpolicyInfos().forEach(wgStandorpolicyInfo -> {
@@ -412,14 +477,12 @@ public class WgWorkGroupServiceImpl extends ServiceImpl<WgWorkGroupDao, WgWorkGr
}); });
} }
flag = wgStandorpolicyInfoService.saveOrUpdateBatch(wgWorkGroupShowDTO.getWgStandorpolicyInfos()); flag = wgStandorpolicyInfoService.saveOrUpdateBatch(wgWorkGroupShowDTO.getWgStandorpolicyInfos());
}else if ("sys".equals(part)) {
QueryWrapper<WgStandorpolicyInfo> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("wg_id",wgWorkGroupShowDTO.getId());
wgStandorpolicyInfoService.remove(queryWrapper);
} }
return flag;
if (flag) {
return Result.success("更新成功");
} else {
return Result.error("无法更新");
}
}
} }
@@ -11,12 +11,10 @@
</select> </select>
<select id="researchAllDatas" resultType="com.adc.da.slrs.wgNetInfo.entity.WgNetInfoDTO"> <select id="researchAllDatas" resultType="com.adc.da.slrs.wgNetInfo.entity.WgNetInfoDTO">
select wg_net_info.net_id,concat(ts_user.UNAME,concat('(',concat(ts_user.USID,')'))) as name ,wg_net_info.PHONE as phone, wg_net_info.EMAIL as email select wg_net_info.net_id,wg_net_info.name as name ,wg_net_info.PHONE as phone, wg_net_info.EMAIL as email
,wg_net_info.id,wg_net_info.wg_id , wg_net_info.join_id ,ts_institution.name as unit , ts_institution.id as unitId ,wg_net_info.id,wg_net_info.wg_id , wg_net_info.join_id ,wg_net_info.unit as unit
from wg_net_info from wg_net_info
left join ts_user on ts_user.ACCOUNT = wg_net_info.net_id
left join wg_work_group on wg_work_group.id = wg_net_info.wg_id left join wg_work_group on wg_work_group.id = wg_net_info.wg_id
left join ts_institution ON ts_institution.id = (SELECT parent_id from ts_institution WHERE id = ts_user.INSTITUTION_ID)
where wg_work_group.type = #{type} where wg_work_group.type = #{type}
</select> </select>
@@ -45,6 +45,10 @@
select * from wg_work_group where wg_work_group.pid = #{data} and wg_work_group.status = #{status} select * from wg_work_group where wg_work_group.pid = #{data} and wg_work_group.status = #{status}
</select> </select>
<select id="researchDatasCheck" resultType="com.adc.da.slrs.wgWorkGroup.entity.WgWorkGroup">
select * from wg_work_group where wg_work_group.id = #{data} and wg_work_group.status = #{status}
</select>
<select id="researchAllData" resultMap="WgWorkGroups"> <select id="researchAllData" resultMap="WgWorkGroups">
select * from wg_work_group where wg_work_group.type =#{type} select * from wg_work_group where wg_work_group.type =#{type}
</select> </select>