|
|
@ -24,7 +24,6 @@ import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
@ -41,7 +40,6 @@ import javax.annotation.Resource; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
/** |
|
|
|
* 党员报道 |
|
|
@ -70,16 +68,23 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo |
|
|
|
page.getRecords().forEach(entity -> { |
|
|
|
result.getList().forEach(dto -> { |
|
|
|
if (entity.getId().equals(dto.getId())) { |
|
|
|
String[] ids; |
|
|
|
if (StringUtils.isNotEmpty(entity.getAllDeptIds())) { |
|
|
|
dto.setAllDeptIds(entity.getAllDeptIds().split(",")); |
|
|
|
} |
|
|
|
if (StringUtils.isNotEmpty(entity.getCouplingCommunity())) { |
|
|
|
ids = entity.getCouplingCommunity().split(","); |
|
|
|
ParentAndAllDeptDTO deptDTO; |
|
|
|
if (entity.getShiBei() == 1) { |
|
|
|
String[] ids = entity.getAllDeptIds().split(","); |
|
|
|
String deptId = ids[ids.length - 1]; |
|
|
|
ParentAndAllDeptDTO deptDTO = adminFeignClient.getParentAndAllDept(deptId).getData(); |
|
|
|
dto.setCouplingCommunityName(deptDTO.getAllDeptNames()); |
|
|
|
deptDTO = adminFeignClient.getParentAndAllDept(deptId).getData(); |
|
|
|
dto.setParentDeptNames(deptDTO.getParentDeptNames()); |
|
|
|
}else { |
|
|
|
String[] villageNames = entity.getVillageName().split("-"); |
|
|
|
dto.setParentDeptNames(villageNames[0]); |
|
|
|
dto.setHomeName(villageNames[1]); |
|
|
|
} |
|
|
|
//包联社区
|
|
|
|
deptDTO = adminFeignClient.getParentAndAllDept(entity.getDeptId()).getData(); |
|
|
|
dto.setCouplingCommunityName(deptDTO.getAllDeptNames()); |
|
|
|
if (StringUtils.isNotEmpty(entity.getIdCard())) { |
|
|
|
String idCard = entity.getIdCard(); |
|
|
|
String temp = idCard.substring(0, 4) + tempKey + idCard.substring(idCard.length() - 3); |
|
|
@ -104,11 +109,9 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo |
|
|
|
String idCard = (String) params.get(FieldConstant.ID_CARD_HUMP); |
|
|
|
String mobile = (String) params.get(FieldConstant.MOBILE_HUMP); |
|
|
|
String workUnit = (String) params.get("workUnit"); |
|
|
|
String deptId = (String) params.get("deptId"); |
|
|
|
if (StringUtils.isEmpty(deptId)) { |
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
|
deptId = String.valueOf(user.getDeptId()); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(deptId), "DEPT_ID", deptId); |
|
|
|
Long deptId = SecurityUser.getUser().getDeptId(); |
|
|
|
if (null != deptId) { |
|
|
|
wrapper.eq("DEPT_ID", deptId); |
|
|
|
} |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
wrapper.like(StringUtils.isNotBlank(name), FieldConstant.NAME_HUMP, name); |
|
|
@ -140,14 +143,15 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(ReportPartyDTO dto) { |
|
|
|
if (dto.getAllDeptIds().length == 0) { |
|
|
|
setDeptId(dto); |
|
|
|
} |
|
|
|
ReportPartyEntity entity = ConvertUtils.sourceToTarget(dto, ReportPartyEntity.class); |
|
|
|
Result<ParentAndAllDeptDTO> parentResult = null; |
|
|
|
if (dto.getAllDeptIds() != null && dto.getAllDeptIds().length > 1) { |
|
|
|
entity.setDeptId(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]); |
|
|
|
if (null != dto.getCouplingCommunity() && dto.getCouplingCommunity().length > 3) { |
|
|
|
entity.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 2]); |
|
|
|
entity.setCouplingCommunity(String.join(",", dto.getCouplingCommunity())); |
|
|
|
} |
|
|
|
if (dto.getAllDeptIds() != null && dto.getAllDeptIds().length > 3) { |
|
|
|
entity.setDeptId(dto.getAllDeptIds()[dto.getAllDeptIds().length - 2]); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(dto.getAllDeptIds()[dto.getAllDeptIds().length - 2]); |
|
|
|
} else { |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(dto.getDeptId())); |
|
|
|
} |
|
|
@ -160,7 +164,6 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo |
|
|
|
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
|
|
|
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
|
|
|
} |
|
|
|
entity.setCouplingCommunity(String.join(",", dto.getCouplingCommunity())); |
|
|
|
entity.setStatus(0); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
@ -168,32 +171,32 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(ReportPartyDTO dto) { |
|
|
|
if (dto.getAllDeptIds().length == 0) { |
|
|
|
setDeptId(dto); |
|
|
|
} |
|
|
|
ReportPartyEntity entity = ConvertUtils.sourceToTarget(dto, ReportPartyEntity.class); |
|
|
|
Result<ParentAndAllDeptDTO> parentResult = null; |
|
|
|
if (dto.getAllDeptIds() != null && dto.getAllDeptIds().length > 1) { |
|
|
|
entity.setDeptId(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]); |
|
|
|
} else { |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(dto.getDeptId())); |
|
|
|
} |
|
|
|
if (!parentResult.success() || parentResult.getData() == null) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
|
Result<ParentAndAllDeptDTO> parentResult; |
|
|
|
if (dto.getShiBei() == 1) {//设置居住社区
|
|
|
|
if (null != dto.getAllDeptIds() && dto.getAllDeptIds().length > 3) { |
|
|
|
entity.setAllDeptIds(dto.getAllDeptIds().toString()); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]); |
|
|
|
if (!parentResult.success() || parentResult.getData() == null) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
|
} |
|
|
|
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
|
|
|
entity.setAllDeptIds(deptDTO.getAllDeptIds()); |
|
|
|
entity.setAllDeptNames(deptDTO.getAllDeptNames()); |
|
|
|
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
|
|
|
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
ParentAndAllDeptDTO deptDTO = parentResult.getData(); |
|
|
|
entity.setAllDeptIds(deptDTO.getAllDeptIds()); |
|
|
|
entity.setAllDeptNames(deptDTO.getAllDeptNames()); |
|
|
|
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
|
|
|
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
|
|
|
} |
|
|
|
if (Objects.equals(0, entity.getStatus())) { |
|
|
|
entity.setExamineMsg(null); |
|
|
|
if (StringUtils.isNotEmpty(dto.getVillageName())) { |
|
|
|
dto.setParentDeptNames(dto.getVillageName()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != dto.getCouplingCommunity()) { |
|
|
|
if (null != dto.getCouplingCommunity() && dto.getCouplingCommunity().length > 3) { |
|
|
|
entity.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 2]); |
|
|
|
entity.setCouplingCommunity(String.join(",", dto.getCouplingCommunity())); |
|
|
|
} |
|
|
|
entity.setStatus(0); |
|
|
|
entity.setExamineMsg(null); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
@ -230,15 +233,22 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo |
|
|
|
ReportPartyEntity result = baseDao.getByIdCardAndName(dto.getIdCard(), dto.getName()); |
|
|
|
if (null != result && !dto.getCouplingCommunity().equals(result.getCouplingCommunity())) { |
|
|
|
result.setCouplingCommunity(String.join(",", dto.getCouplingCommunity())); |
|
|
|
if (result.getCouplingCommunity().length() > 3) { |
|
|
|
result.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 2]); |
|
|
|
} else { |
|
|
|
result.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 1]); |
|
|
|
} |
|
|
|
result.setStatus(0); |
|
|
|
baseDao.updateById(result); |
|
|
|
} else { |
|
|
|
if (dto.getAllDeptIds().length == 0) { |
|
|
|
setDeptId(dto); |
|
|
|
} |
|
|
|
Result<ParentAndAllDeptDTO> parentResult; |
|
|
|
if (dto.getAllDeptIds() != null && dto.getAllDeptIds().length > 1) { |
|
|
|
if (null != dto.getCouplingCommunity() && dto.getCouplingCommunity().length > 3) { |
|
|
|
entity.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 2]); |
|
|
|
entity.setCouplingCommunity(String.join(",", dto.getCouplingCommunity())); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(entity.getDeptId())); |
|
|
|
} else if (null != dto.getAllDeptIds() && dto.getAllDeptIds().length > 2) { |
|
|
|
entity.setDeptId(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]); |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(entity.getDeptId()); |
|
|
|
} else { |
|
|
|
parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(dto.getDeptId())); |
|
|
|
} |
|
|
@ -251,16 +261,8 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo |
|
|
|
entity.setParentDeptIds(deptDTO.getParentDeptIds()); |
|
|
|
entity.setParentDeptNames(deptDTO.getParentDeptNames()); |
|
|
|
} |
|
|
|
entity.setCouplingCommunity(String.join(",", dto.getCouplingCommunity())); |
|
|
|
entity.setStatus(0); |
|
|
|
baseDao.insert(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void setDeptId(ReportPartyDTO dto) { |
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
|
String deptId = String.valueOf(user.getDeptId()); |
|
|
|
dto.setDeptId(user.getDeptId()); |
|
|
|
dto.setAllDeptIds(new String[]{deptId}); |
|
|
|
} |
|
|
|
} |
|
|
|