Browse Source

publishOrgPath、joinOrgPath

master
yinzuomei 3 years ago
parent
commit
0b262f29fd
  1. 3
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActAddOrUpdateFormDTO.java
  2. 33
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgInfo.java
  3. 6
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActController.java
  4. 8
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyOrgService.java
  5. 46
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java
  6. 62
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java

3
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActAddOrUpdateFormDTO.java

@ -94,7 +94,8 @@ public class IcPartyActAddOrUpdateFormDTO implements Serializable {
private String longitude;
/**
* 活动开始前几天
* 活动开始前几天,字典接口返回的
* 0,1,3,5,7天
*/
@NotNull(message = "自动发布时间不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private Integer autoPublicType;

33
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgInfo.java

@ -0,0 +1,33 @@
package com.epmet.resi.partymember.dto.partyOrg.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author yzm
* @Date 2022/8/23 13:10
*/
@Data
public class IcPartyOrgInfo implements Serializable {
/**
* 党组织ID
*/
private String id;
/**
* 党组织的上级ID,没有上级时为0
*/
private String orgPid;
/**
* 党组织名称
*/
private String partyOrgName;
/**
* 党组织的id全路径包含自身
*/
private String partyOrgIdPath;
private String partyOrgNamePath;
}

6
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActController.java

@ -238,6 +238,12 @@ public class IcPartyActController {
return new Result<List<YearSearchResultDTO>>().ok(icPartyActService.yearSearch01(formDTO));
}
/**
* 党建日历生成年度活动计划查询
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("yearSearch")
public Result<List<YearSearchDetailResultDTO>> yearSearch(@LoginUser TokenDto tokenDto, @RequestBody YearSearchFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, YearSearchFormDTO.YearSearchForm.class);

8
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyOrgService.java

@ -10,6 +10,7 @@ import com.epmet.resi.partymember.dto.partyOrg.form.GetParentOrgFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.DefaultPartyOrgResDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgInfo;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO;
import java.util.List;
@ -136,4 +137,11 @@ public interface IcPartyOrgService extends BaseService<IcPartyOrgEntity> {
* @return
*/
DefaultPartyOrgResDTO defaultPartyOrg(String customerId, String userId);
/**
* 查询党组织partyOrgIdPath
* @param icPartyOrgId
* @return
*/
IcPartyOrgInfo queryIcPartyOrgInfo(String icPartyOrgId);
}

46
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java

@ -174,9 +174,15 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
public Map<String, String> addOrUpdate(IcPartyActAddOrUpdateFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo=queryStaffInfo(formDTO.getCustomerId(),formDTO.getPublishStaffId());
IcPartyActEntity icPartyActEntity= ConvertUtils.sourceToTarget(formDTO,IcPartyActEntity.class);
//计算好自动发布的时间
icPartyActEntity.setAutoPublicTime(DateUtils.calDateBaseDay(formDTO.getHoldTime(),formDTO.getAutoPublicType()));
icPartyActEntity.setPublishStaffName(staffInfo.getRealName());
icPartyActEntity.setOrgId(staffInfo.getAgencyId());
//!!!!!!!不用前端传的了。 我自己查询吧
IcPartyOrgInfo icPartyOrgInfo=SpringContextUtils.getBean(IcPartyOrgService.class).queryIcPartyOrgInfo(formDTO.getPublishPartyOrgId());
icPartyActEntity.setPublishOrgPath(icPartyOrgInfo.getPartyOrgIdPath());
AgencyInfoCache agencyInfoCache= CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId());
icPartyActEntity.setPid(agencyInfoCache.getPid());
if(StringUtils.isBlank(agencyInfoCache.getPid())||NumConstant.ZERO_STR.equals(agencyInfoCache.getPid())){
@ -194,7 +200,9 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
//保留原来的发布状态
IcPartyActEntity origin=baseDao.selectById(formDTO.getIcPartyActId());
icPartyActEntity.setIsPublish(origin.getIsPublish());
//修改活动
baseDao.updateById(icPartyActEntity);
//已发布,在编辑的时候,需要发送消息
if(NumConstant.ONE_STR.equals(icPartyActEntity.getIsPublish())&&NumConstant.ONE_STR.equals(icPartyActEntity.getIsAutoInform())){
sendMsg=true;
@ -207,6 +215,7 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
}else{
icPartyActEntity.setIsPublish(NumConstant.ZERO_STR);
}
//新增活动
baseDao.insert(icPartyActEntity);
}
//新增参加参加活动党组织
@ -214,8 +223,12 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
orgList.forEach(joinOrg->{
joinOrg.setCustomerId(formDTO.getCustomerId());
joinOrg.setIcPartyActId(icPartyActEntity.getId());
//!!!!!!!不用前端传的了。 我自己查询吧
IcPartyOrgInfo joinPartyOrgInfo=SpringContextUtils.getBean(IcPartyOrgService.class).queryIcPartyOrgInfo(joinOrg.getId());
joinOrg.setJoinOrgPath(joinPartyOrgInfo.getPartyOrgIdPath());
icPartyActOrgDao.insert(joinOrg);
});
//批量新增附件
List<ResiPartymemberAttachmentEntity> attachmentEntityList=ConvertUtils.sourceToTarget(formDTO.getAttachmentList(),ResiPartymemberAttachmentEntity.class);
int attSort = 1;
@ -227,10 +240,9 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
attSort++;
resiPartymemberAttachmentDao.insert(att);
}
Map<String, String> map=new HashMap<>();
map.put("icPartyActId",icPartyActEntity.getId());
//已经发布的,编辑需要发消息
if(sendMsg){
//已经发布的活动+且活动未开始的,编辑后需要发消息
if (sendMsg && icPartyActEntity.getHoldTime().compareTo(new Date()) < 1) {
PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg();
msg.setCustomerId(formDTO.getCustomerId());
msg.setIcPartyActId(icPartyActEntity.getId());
@ -239,6 +251,9 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
.openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class))
.sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg);
}
Map<String, String> map=new HashMap<>();
map.put("icPartyActId",icPartyActEntity.getId());
return map;
}
@ -446,7 +461,7 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
if (null == icPartyOrgDTO){
throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId());
}
formDTO.setPath(icPartyOrgDTO.getOrgPids().equals("") || icPartyOrgDTO.getOrgPids().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId()));
formDTO.setPath(StringUtils.isBlank(icPartyOrgDTO.getOrgPid()) || icPartyOrgDTO.getOrgPid().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId()));
}
}
@ -626,8 +641,8 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
icPartyActEntity.setIsPublish(NumConstant.ONE_STR);
icPartyActEntity.setUpdatedBy(userId);
baseDao.updateById(icPartyActEntity);
//发送消息
if(NumConstant.ONE_STR.equals(icPartyActEntity.getIsAutoInform())){
//发送消息:自动通知参加人员+活动未开始的
if (NumConstant.ONE_STR.equals(icPartyActEntity.getIsAutoInform()) && icPartyActEntity.getHoldTime().compareTo(new Date()) < 1) {
PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg();
msg.setCustomerId(icPartyActEntity.getCustomerId());
msg.setIcPartyActId(icPartyActEntity.getId());
@ -712,13 +727,16 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
//置为已发布
act.setIsPublish(NumConstant.ONE_STR);
baseDao.updateById(act);
PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg();
msg.setCustomerId(act.getCustomerId());
msg.setIcPartyActId(act.getId());
msg.setType("publish");
SendMqMsgUtil.build()
.openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class))
.sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg);
//选择了自动通知参加人员的,需要发送消息
if(NumConstant.ONE_STR.equals(act.getIsAutoInform())){
PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg();
msg.setCustomerId(act.getCustomerId());
msg.setIcPartyActId(act.getId());
msg.setType("publish");
SendMqMsgUtil.build()
.openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class))
.sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg);
}
}
}
}

62
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java

@ -30,10 +30,8 @@ import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.GetParentOrgFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeSubDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.DefaultPartyOrgResDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -51,6 +49,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-05-17
*/
@Slf4j
@Service
public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPartyOrgEntity> implements IcPartyOrgService {
@ -402,4 +401,59 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart
resDto.setOrgType(entity.getPartyOrgType());
return resDto;
}
/**
* 查询党组织partyOrgIdPath
*
* @param icPartyOrgId
* @return
*/
@Override
public IcPartyOrgInfo queryIcPartyOrgInfo(String icPartyOrgId) {
IcPartyOrgInfo orgInfo=new IcPartyOrgInfo();
orgInfo.setId(icPartyOrgId);
IcPartyOrgEntity orgEntity=baseDao.selectById(icPartyOrgId);
if (null != orgEntity) {
orgInfo.setOrgPid(orgEntity.getOrgPid());
orgInfo.setPartyOrgName(orgEntity.getPartyOrgName());
if(StringUtils.isBlank(orgEntity.getOrgPid())||NumConstant.ZERO_STR.equals(orgEntity.getOrgPid())){
//一级党组织直接返回
orgInfo.setPartyOrgIdPath(orgEntity.getId());
orgInfo.setPartyOrgNamePath(orgEntity.getPartyOrgName());
return orgInfo;
}
List<String> pids=new ArrayList<>();
pids.add(icPartyOrgId);
List<String> names=new ArrayList<>();
names.add(orgEntity.getPartyOrgName());
Map<String,String> map=getPartyOrgIdPath(pids,names,orgEntity.getOrgPid());
String partyOrgIdPath = map.containsKey("idPath") ? map.get("idPath") : StrConstant.EPMETY_STR;
String partyOrgNamePath = map.containsKey("namePath") ? map.get("namePath") : StrConstant.EPMETY_STR;
orgInfo.setPartyOrgIdPath(partyOrgIdPath);
orgInfo.setPartyOrgNamePath(partyOrgNamePath);
}
return orgInfo;
}
private Map<String,String> getPartyOrgIdPath(List<String> pids,List<String> names,String pid) {
Map<String,String> map=new HashMap<>();
IcPartyOrgEntity orgEntity=baseDao.selectById(pid);
if(null==orgEntity){
return map;
}
pids.add(pid);
names.add(orgEntity.getPartyOrgName());
if(StringUtils.isNotBlank(orgEntity.getOrgPid())&&!NumConstant.ZERO_STR.equals(orgEntity.getOrgPid())){
return getPartyOrgIdPath(pids,names,orgEntity.getOrgPid());
}
//倒序排列
Collections.reverse(pids);
Collections.reverse(names);
map.put("idPath", StringUtils.join(pids.toArray(),StrConstant.COLON));
map.put("namePath", StringUtils.join(names.toArray(),StrConstant.HYPHEN));
return map;
}
}

Loading…
Cancel
Save