diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActOrgController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActOrgController.java index 19fb1ea357..a42a752523 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActOrgController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActOrgController.java @@ -28,43 +28,4 @@ public class IcPartyActOrgController { @Autowired private IcPartyActOrgService icPartyActOrgService; - - @RequestMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = icPartyActOrgService.page(params); - return new Result>().ok(page); - } - - @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ - IcPartyActOrgDTO data = icPartyActOrgService.get(id); - return new Result().ok(data); - } - - @NoRepeatSubmit - @PostMapping("save") - public Result save(@RequestBody IcPartyActOrgDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - icPartyActOrgService.save(dto); - return new Result(); - } - - @NoRepeatSubmit - @PostMapping("update") - public Result update(@RequestBody IcPartyActOrgDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - icPartyActOrgService.update(dto); - return new Result(); - } - - @PostMapping("delete") - public Result delete(@RequestBody String[] ids){ - //效验数据 - AssertUtils.isArrayEmpty(ids, "id"); - icPartyActOrgService.delete(ids); - return new Result(); - } - } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActOrgDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActOrgDao.java index 97cd8d2e9e..e38cde539a 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActOrgDao.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActOrgDao.java @@ -3,6 +3,9 @@ package com.epmet.modules.partyOrg.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 参加活动党组织表 @@ -12,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcPartyActOrgDao extends BaseDao { - + + int deleteByPartyActId(@Param("customerId") String customerId, @Param("icPartyActIds")List icPartyActIds); } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/ResiPartymemberAttachmentDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/ResiPartymemberAttachmentDao.java new file mode 100644 index 0000000000..5b42ff57e4 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/ResiPartymemberAttachmentDao.java @@ -0,0 +1,24 @@ +package com.epmet.modules.partyOrg.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 本库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +@Mapper +public interface ResiPartymemberAttachmentDao extends BaseDao { + /** + * + * @param businessIds + * @return + */ + int deleteByBusinessId(@Param("customerId")String customerId,@Param("businessIds") List businessIds); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/ResiPartymemberAttachmentEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/ResiPartymemberAttachmentEntity.java new file mode 100644 index 0000000000..aa190b4ea9 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/ResiPartymemberAttachmentEntity.java @@ -0,0 +1,82 @@ +package com.epmet.modules.partyOrg.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 本库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("resi_partymember_attachment") +public class ResiPartymemberAttachmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 业务id + */ + private String businessId; + + /** + * 党组织活动:ic_party_act + */ + private String attachTo; + + /** + * 附件名 + */ + private String name; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String format; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String type; + + /** + * 附件地址 + */ + private String url; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 附件状态(审核中:auditing; +auto_passed: 自动通过; +review:结果不确定,需要人工审核; +block: 结果违规; +rejected:人工审核驳回; +approved:人工审核通过) +现在图片是同步审核的,所以图片只有auto_passed一种状态 + */ + private String status; + + /** + * 失败原因 + */ + private String reason; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActOrgService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActOrgService.java index 24dfde82b4..9e5a6e2be2 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActOrgService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActOrgService.java @@ -1,12 +1,9 @@ package com.epmet.modules.partyOrg.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; -import com.epmet.resi.partymember.dto.IcPartyActOrgDTO; import java.util.List; -import java.util.Map; /** * 参加活动党组织表 @@ -15,64 +12,5 @@ import java.util.Map; * @since v1.0.0 2022-08-18 */ public interface IcPartyActOrgService extends BaseService { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2022-08-18 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2022-08-18 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return IcPartyActOrgDTO - * @author generator - * @date 2022-08-18 - */ - IcPartyActOrgDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2022-08-18 - */ - void save(IcPartyActOrgDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2022-08-18 - */ - void update(IcPartyActOrgDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2022-08-18 - */ - void delete(String[] ids); + int deleteByPartyActId(String customerId, List icPartyActIds); } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/ResiPartymemberAttachmentService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/ResiPartymemberAttachmentService.java new file mode 100644 index 0000000000..6c70b77d3f --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/ResiPartymemberAttachmentService.java @@ -0,0 +1,16 @@ +package com.epmet.modules.partyOrg.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; + +import java.util.List; + +/** + * 本库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +public interface ResiPartymemberAttachmentService extends BaseService { + int deleteByBusinessId(String customerId, List businessIds); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActOrgServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActOrgServiceImpl.java index 0339c1dc77..dc767f47e0 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActOrgServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActOrgServiceImpl.java @@ -1,22 +1,13 @@ package com.epmet.modules.partyOrg.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.modules.partyOrg.dao.IcPartyActOrgDao; import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; import com.epmet.modules.partyOrg.service.IcPartyActOrgService; -import com.epmet.resi.partymember.dto.IcPartyActOrgDTO; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; import java.util.List; -import java.util.Map; /** * 参加活动党组织表 @@ -28,55 +19,13 @@ import java.util.Map; public class IcPartyActOrgServiceImpl extends BaseServiceImpl implements IcPartyActOrgService { @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, IcPartyActOrgDTO.class); + public int deleteByPartyActId(String customerId, List icPartyActIds) { + if (CollectionUtils.isEmpty(icPartyActIds)) { + return 0; + } + return baseDao.deleteByPartyActId(customerId, icPartyActIds); } - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, IcPartyActOrgDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - - @Override - public IcPartyActOrgDTO get(String id) { - IcPartyActOrgEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, IcPartyActOrgDTO.class); - } - @Override - @Transactional(rollbackFor = Exception.class) - public void save(IcPartyActOrgDTO dto) { - IcPartyActOrgEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyActOrgEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(IcPartyActOrgDTO dto) { - IcPartyActOrgEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyActOrgEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } +} -} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java index 86e6fbe505..f8d8067598 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java @@ -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 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 orgList=ConvertUtils.sourceToTarget(formDTO.getJoinOrgList(),IcPartyActOrgEntity.class); + orgList.forEach(joinOrg->{ + joinOrg.setCustomerId(formDTO.getCustomerId()); + joinOrg.setIcPartyActId(icPartyActEntity.getId()); + icPartyActOrgDao.insert(joinOrg); + }); + //批量新增附件 + List 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 map=new HashMap<>(); + map.put("icPartyActId",icPartyActEntity.getId()); + return map; } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/ResiPartymemberAttachmentServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/ResiPartymemberAttachmentServiceImpl.java new file mode 100644 index 0000000000..df42c273c0 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/ResiPartymemberAttachmentServiceImpl.java @@ -0,0 +1,29 @@ +package com.epmet.modules.partyOrg.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.modules.partyOrg.dao.ResiPartymemberAttachmentDao; +import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; +import com.epmet.modules.partyOrg.service.ResiPartymemberAttachmentService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 本库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +@Service +public class ResiPartymemberAttachmentServiceImpl extends BaseServiceImpl implements ResiPartymemberAttachmentService { + + + @Override + public int deleteByBusinessId(String customerId, List businessIds) { + if(CollectionUtils.isEmpty(businessIds)){ + return 0; + } + return baseDao.deleteByBusinessId(customerId,businessIds); + } +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActOrgDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActOrgDao.xml index f84e9ae594..ce671cd13c 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActOrgDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActOrgDao.xml @@ -2,5 +2,11 @@ - + + delete from ic_party_act_org + where customer_id = #{customerId} + + IC_PARTY_ACT_ID = #{icPartyActId} + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/ResiPartymemberAttachmentDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/ResiPartymemberAttachmentDao.xml new file mode 100644 index 0000000000..955f5f4664 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/ResiPartymemberAttachmentDao.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from resi_partymember_attachment + where customer_id=#{customerId} + + BUSINESS_ID = #{businessId} + + + \ No newline at end of file