|
|
@ -4,21 +4,24 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.Constant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyActDao; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcScheduleDao; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcPartyActOrgDao; |
|
|
|
import com.epmet.modules.partyOrg.dao.IcScheduleDao; |
|
|
|
import com.epmet.modules.partyOrg.dao.ResiPartymemberAttachmentDao; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyActEntity; |
|
|
|
import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; |
|
|
|
import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyActOrgService; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyActService; |
|
|
|
import com.epmet.modules.partyOrg.service.IcPartyOrgService; |
|
|
|
import com.epmet.modules.partyOrg.service.ResiPartymemberAttachmentService; |
|
|
|
import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO; |
|
|
|
import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActPageFormDTO; |
|
|
|
import com.epmet.resi.partymember.dto.icpartyact.result.IcPartActTypeDTO; |
|
|
@ -34,10 +37,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 党建组织活动 |
|
|
@ -54,7 +54,8 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
private IcPartyOrgService partyOrgService; |
|
|
|
@Autowired |
|
|
|
private IcPartyActOrgDao icPartyActOrgDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ResiPartymemberAttachmentDao resiPartymemberAttachmentDao; |
|
|
|
/** |
|
|
|
* 活动类型列表 |
|
|
|
* |
|
|
@ -135,24 +136,47 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Map<String, String> addOrUpdate(IcPartyActAddOrUpdateFormDTO formDTO) { |
|
|
|
IcPartyActEntity icPartyActEntity= ConvertUtils.sourceToTarget(formDTO,IcPartyActEntity.class); |
|
|
|
icPartyActEntity.setAutoPublicTime(DateUtils.calDateBaseDay(formDTO.getHoldTime(),formDTO.getAutoPublicType())); |
|
|
|
CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getPublishStaffId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
String msg = "查询工作人员信息异常"; |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); |
|
|
|
} |
|
|
|
IcPartyActEntity icPartyActEntity= ConvertUtils.sourceToTarget(formDTO,IcPartyActEntity.class); |
|
|
|
icPartyActEntity.setAutoPublicTime(DateUtils.calDateBaseDay(formDTO.getHoldTime(),formDTO.getAutoPublicType())); |
|
|
|
icPartyActEntity.setPublishStaffName(staffInfo.getRealName()); |
|
|
|
icPartyActEntity.setOrgId(staffInfo.getAgencyId()); |
|
|
|
icPartyActEntity.setPid(staffInfo.getParentAgency().getId()); |
|
|
|
icPartyActEntity.setOrgIdPath(staffInfo.getAgencyPIds()); |
|
|
|
if(StringUtils.isNotBlank(formDTO.getIcPartyActId())){ |
|
|
|
icPartyActEntity.setId(formDTO.getIcPartyActId()); |
|
|
|
//删除附件、删除参加组织
|
|
|
|
|
|
|
|
SpringContextUtils.getBean(ResiPartymemberAttachmentService.class).deleteByBusinessId(formDTO.getCustomerId(), Arrays.asList(formDTO.getIcPartyActId())); |
|
|
|
SpringContextUtils.getBean(IcPartyActOrgService.class).deleteByPartyActId(formDTO.getCustomerId(), Arrays.asList(formDTO.getIcPartyActId())); |
|
|
|
baseDao.updateById(icPartyActEntity); |
|
|
|
}else{ |
|
|
|
baseDao.insert(icPartyActEntity); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
//新增参加参加活动党组织
|
|
|
|
List<IcPartyActOrgEntity> orgList=ConvertUtils.sourceToTarget(formDTO.getJoinOrgList(),IcPartyActOrgEntity.class); |
|
|
|
orgList.forEach(joinOrg->{ |
|
|
|
joinOrg.setCustomerId(formDTO.getCustomerId()); |
|
|
|
joinOrg.setIcPartyActId(icPartyActEntity.getId()); |
|
|
|
icPartyActOrgDao.insert(joinOrg); |
|
|
|
}); |
|
|
|
//批量新增附件
|
|
|
|
List<ResiPartymemberAttachmentEntity> attachmentEntityList=ConvertUtils.sourceToTarget(formDTO.getAttachmentList(),ResiPartymemberAttachmentEntity.class); |
|
|
|
int attSort = 1; |
|
|
|
for (ResiPartymemberAttachmentEntity att : attachmentEntityList) { |
|
|
|
att.setCustomerId(formDTO.getCustomerId()); |
|
|
|
att.setBusinessId(icPartyActEntity.getId()); |
|
|
|
att.setAttachTo("ic_party_act"); |
|
|
|
att.setSort(attSort); |
|
|
|
attSort++; |
|
|
|
resiPartymemberAttachmentDao.insert(att); |
|
|
|
} |
|
|
|
Map<String, String> map=new HashMap<>(); |
|
|
|
map.put("icPartyActId",icPartyActEntity.getId()); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|