Browse Source

发布/编辑活动

dev_shibei_match
yinzuomei 4 years ago
parent
commit
3f5e652147
  1. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoResultDTO.java
  2. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  3. 17
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java
  4. 27
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActDetailFormDTO.java
  5. 104
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/PublishGroupActFormDTO.java
  6. 10
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java
  7. 41
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java
  8. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCategoryDictDao.java
  9. 3
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java
  10. 4
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java
  11. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCategoryDictService.java
  12. 19
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java
  13. 34
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCategoryDictServiceImpl.java
  14. 331
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java
  15. 25
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupActConstant.java
  16. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java
  17. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java
  18. 22
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCategoryDictDao.xml
  19. 4
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml
  20. 9
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoResultDTO.java

@ -87,5 +87,10 @@ public class GridInfoResultDTO implements Serializable {
* 网格所属机关名称
*/
private String parentAgencyName;
/**
* 网格的所有上级组织
*/
private String pids;
}

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -481,6 +481,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
gridInfoResultDTO.setGridName(customerGridDTO.getGridName());
gridInfoResultDTO.setParentAgencyId(customerGridDTO.getPid());
gridInfoResultDTO.setParentAgencyName(customerAgencyService.get(customerGridDTO.getPid()).getOrganizationName());
gridInfoResultDTO.setPids(customerGridDTO.getPids());
String pids=customerGridDTO.getPids();
String[] pidArray = pids.split(":");
for(String agencyId:pidArray){

17
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/GroupActIdDTO.java

@ -0,0 +1,17 @@
package com.epmet.resi.group.dto.act;
import lombok.Data;
import java.io.Serializable;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/4/19 15:11
*/
@Data
public class GroupActIdDTO implements Serializable {
private static final long serialVersionUID = -729672768113053794L;
private String groupActId;
}

27
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/ActDetailFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.resi.group.dto.act.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 004活动详情
*
* @author yinzuomei@elink-cn.com
* @date 2021/4/19 19:16
*/
@Data
public class ActDetailFormDTO implements Serializable {
private static final long serialVersionUID = 9163803497503557861L;
public interface AddUserInternalGroup {
}
@NotBlank(message = "groupActId不能为空", groups = AddUserInternalGroup.class)
private String groupActId;
/**
* 当前用户id
*/
@NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class)
private String userId;
}

104
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/form/PublishGroupActFormDTO.java

@ -0,0 +1,104 @@
package com.epmet.resi.group.dto.act.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 003发布编辑组织活动
*
* @author yinzuomei@elink-cn.com
* @date 2021/4/19 15:10
*/
@Data
public class PublishGroupActFormDTO implements Serializable {
private static final long serialVersionUID = 3507465802034946254L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "tokenDto获取customerId为空", groups = AddUserInternalGroup.class)
private String customerId;
/**
* 活动发布人用户id
*/
@NotBlank(message = "tokenDto获取userId为空", groups = AddUserInternalGroup.class)
private String publishUserId;
@NotBlank(message = "groupId不能为空", groups = AddUserInternalGroup.class)
private String groupId;
/**
* 小组活动id,此列有值代表编辑
*/
private String groupActId;
/**
* 类别编码
*/
@NotBlank(message = "categoryCode不能为空", groups = AddUserInternalGroup.class)
private String categoryCode;
/**
* 类别编码所属的上一级编码
*/
@NotBlank(message = "parentCode不能为空", groups = AddUserInternalGroup.class)
private String parentCode;
/**
* 活动标题
*/
@NotBlank(message = "title不能为空,最多输入50个字", groups = AddUserShowGroup.class)
@Length(min = 1, max = 50, message = "title不能为空,最多输入50个字", groups = {AddUserShowGroup.class})
private String title;
/**
* 活动时间格式yyyy-MM-dd HH:mm
*/
private String startTime;
/**
* 活动地点
*/
@NotBlank(message = "活动地点不能为空", groups = AddUserShowGroup.class)
private String address;
/**
* 活动地点-经度
*/
private BigDecimal longitude;
/**
* 活动地点-纬度
*/
private BigDecimal latitude;
/**
* 应参加人数组长填入此列也是应签到人数
*/
@Min(value = 1, message = "应参加人数需大于0", groups = AddUserShowGroup.class)
private Integer shouldAttend;
/**
* 活动文本内容目前只有一段限制1000字
*/
private List<String> textList;
/**
* 图片列表最多3张
*/
private List<String> imgList;
private String gridId;
}

10
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/act/result/ActDetailResultDTO.java

@ -0,0 +1,10 @@
package com.epmet.resi.group.dto.act.result;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/4/19 19:24
*/
public class ActDetailResultDTO {
}

41
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/controller/GroupActInfoController.java

@ -17,8 +17,18 @@
package com.epmet.modules.act.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.modules.act.service.GroupActInfoService;
import com.epmet.resi.group.dto.act.GroupActIdDTO;
import com.epmet.resi.group.dto.act.form.ActDetailFormDTO;
import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO;
import com.epmet.resi.group.dto.act.result.ActDetailResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -36,4 +46,35 @@ public class GroupActInfoController {
@Autowired
private GroupActInfoService groupActInfoService;
/**
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.act.GroupActIdDTO>
* @param tokenDto
* @param formDTO
* @author yinzuomei
* @description 003发布编辑组织活动
* @Date 2021/4/19 15:16
**/
@PostMapping("publish")
public Result<GroupActIdDTO> publishGroupAct(@LoginUser TokenDto tokenDto, @RequestBody PublishGroupActFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setPublishUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,PublishGroupActFormDTO.AddUserShowGroup.class,PublishGroupActFormDTO.AddUserInternalGroup.class);
return new Result<GroupActIdDTO>().ok(groupActInfoService.publishGroupAct(formDTO));
}
/**
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.group.dto.act.result.ActDetailResultDTO>
* @param tokenDto
* @param actDetailFormDTO
* @author yinzuomei
* @description 004活动详情
* @Date 2021/4/19 19:25
**/
@PostMapping("actdetail")
public Result<ActDetailResultDTO> queryActDetail(@LoginUser TokenDto tokenDto, @RequestBody ActDetailFormDTO actDetailFormDTO){
actDetailFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(actDetailFormDTO,ActDetailFormDTO.AddUserInternalGroup.class);
return new Result<ActDetailResultDTO>().ok(groupActInfoService.queryActDetail(actDetailFormDTO));
}
}

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActCategoryDictDao.java

@ -52,4 +52,8 @@ public interface ActCategoryDictDao extends BaseDao<ActCategoryDictEntity> {
*/
List<CategoryCodeResultDTO> selectCategoryList(@Param("parentCode") String parentCode,
@Param("customerId") String customerId);
int selectCountByCustomerId(String customerId);
ActCategoryDictEntity selectByCode(@Param("categoryCode")String categoryCode, @Param("customerId")String customerId);
}

3
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/ActReadRecordDao.java

@ -29,5 +29,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ActReadRecordDao extends BaseDao<ActReadRecordEntity> {
int deleteByActId(String groupActId);
}

4
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/dao/GroupActContentDao.java

@ -20,6 +20,7 @@ package com.epmet.modules.act.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.act.entity.GroupActContentEntity;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.repository.query.Param;
/**
* 组织活动内容
@ -29,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface GroupActContentDao extends BaseDao<GroupActContentEntity> {
int updateToDel(@Param("groupActId") String groupActId, @Param("userId") String userId);
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/ActCategoryDictService.java

@ -49,4 +49,13 @@ public interface ActCategoryDictService extends BaseService<ActCategoryDictEntit
* @return com.epmet.resi.group.dto.act.result.CategoryCodeResultDTO
*/
List<CategoryCodeResultDTO> queryCategoryList(ActCategoryFormDTO formDTO);
/**
* 查询类别编码的全路径名称
*
* @param categoryCode
* @param customerId
* @return 支部建设-三会一课
*/
String queryAllCategoryName(String categoryCode,String customerId);
}

19
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/GroupActInfoService.java

@ -19,6 +19,10 @@ package com.epmet.modules.act.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.modules.act.entity.GroupActInfoEntity;
import com.epmet.resi.group.dto.act.GroupActIdDTO;
import com.epmet.resi.group.dto.act.form.ActDetailFormDTO;
import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO;
import com.epmet.resi.group.dto.act.result.ActDetailResultDTO;
/**
* 组织活动信息
@ -28,4 +32,19 @@ import com.epmet.modules.act.entity.GroupActInfoEntity;
*/
public interface GroupActInfoService extends BaseService<GroupActInfoEntity> {
/**
* 003发布编辑组织活动
*
* @param formDTO
* @return com.epmet.resi.group.dto.act.GroupActIdDTO
*/
GroupActIdDTO publishGroupAct(PublishGroupActFormDTO formDTO);
/**
* 004活动详情
*
* @param actDetailFormDTO
* @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO
*/
ActDetailResultDTO queryActDetail(ActDetailFormDTO actDetailFormDTO);
}

34
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/ActCategoryDictServiceImpl.java

@ -18,6 +18,8 @@
package com.epmet.modules.act.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.modules.act.dao.ActCategoryDictDao;
import com.epmet.modules.act.entity.ActCategoryDictEntity;
import com.epmet.modules.act.service.ActCategoryDictService;
@ -30,9 +32,11 @@ import com.epmet.resi.group.dto.act.result.CategoryCodeResultDTO;
import com.epmet.resi.group.dto.act.result.CategoryDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -81,4 +85,34 @@ public class ActCategoryDictServiceImpl extends BaseServiceImpl<ActCategoryDictD
}
return list;
}
/**
* 查询类别编码的全路径名称
*
* @param categoryCode
* @param customerId
* @return 支部建设-三会一课
*/
@Override
public String queryAllCategoryName(String categoryCode, String customerId) {
if (baseDao.selectCountByCustomerId(customerId) == NumConstant.ZERO) {
customerId = GroupActConstant.DEFAULT_CUSTOMER_ID;
}
ActCategoryDictEntity entity = baseDao.selectByCode(categoryCode, customerId);
if (null == entity) {
log.warn(String.format("根据categoryCode:%s,查询act_category_dict表为null", categoryCode));
return StrConstant.EPMETY_STR;
}
List<String> nameList = new ArrayList<>();
for (int i = NumConstant.ONE; i <= entity.getLevel(); i++) {
int length = i * NumConstant.THREE;
String categoryCodeStr = categoryCode.substring(NumConstant.ZERO, length);
ActCategoryDictEntity actCategoryDictEntity = baseDao.selectByCode(categoryCodeStr, customerId);
nameList.add(actCategoryDictEntity.getCategoryName());
}
String allCategoryName = StringUtils.strip(nameList.toString(), "[]").replace(", ", StrConstant.HYPHEN);
String.format("categoryCode:%s,allCategoryName:%s", categoryCode, allCategoryName);
return allCategoryName;
}
}

331
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/act/service/impl/GroupActInfoServiceImpl.java

@ -17,11 +17,54 @@
package com.epmet.modules.act.service.impl;
import com.alibaba.fastjson.JSON;
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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.modules.act.dao.ActOperationRecordDao;
import com.epmet.modules.act.dao.ActReadRecordDao;
import com.epmet.modules.act.dao.GroupActContentDao;
import com.epmet.modules.act.dao.GroupActInfoDao;
import com.epmet.modules.act.entity.ActOperationRecordEntity;
import com.epmet.modules.act.entity.ActReadRecordEntity;
import com.epmet.modules.act.entity.GroupActContentEntity;
import com.epmet.modules.act.entity.GroupActInfoEntity;
import com.epmet.modules.act.service.ActCategoryDictService;
import com.epmet.modules.act.service.GroupActInfoService;
import com.epmet.modules.constant.GroupActConstant;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.resi.group.dto.act.GroupActIdDTO;
import com.epmet.resi.group.dto.act.form.ActDetailFormDTO;
import com.epmet.resi.group.dto.act.form.PublishGroupActFormDTO;
import com.epmet.resi.group.dto.act.result.ActDetailResultDTO;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* 组织活动信息
@ -29,8 +72,296 @@ import org.springframework.stereotype.Service;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-16
*/
@Slf4j
@Service
public class GroupActInfoServiceImpl extends BaseServiceImpl<GroupActInfoDao, GroupActInfoEntity> implements GroupActInfoService {
@Autowired
private ResiGroupMemberService resiGroupMemberService;
@Autowired
private ResiGroupService resiGroupService;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Autowired
private ActOperationRecordDao actOperationRecordDao;
@Autowired
private ActCategoryDictService actCategoryDictService;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private GroupActContentDao groupActContentDao;
@Autowired
private ActReadRecordDao actReadRecordDao;
/**
* 003发布编辑组织活动
*
* @param formDTO
* @return com.epmet.resi.group.dto.act.GroupActIdDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public GroupActIdDTO publishGroupAct(PublishGroupActFormDTO formDTO) {
ResiGroupDTO groupDTO = resiGroupService.get(formDTO.getGroupId());
formDTO.setGridId(groupDTO.getGridId());
//参数校验
this.checkPublishGroupActFormDTO(formDTO);
//内容审核
this.scanActContent(formDTO.getTitle(), formDTO.getTextList(), formDTO.getImgList());
//返参
GroupActIdDTO result=new GroupActIdDTO();
//组织活动信息
GroupActInfoEntity groupActInfoEntity = constructGroupActInfoEntity(formDTO);
//1、插入活修改活动信息表
if (StringUtils.isNotBlank(groupActInfoEntity.getId())) {
//删除group_act_content、删除act_read_record
groupActContentDao.updateToDel(groupActInfoEntity.getId(), formDTO.getPublishUserId());
actReadRecordDao.deleteByActId(groupActInfoEntity.getId());
baseDao.updateById(groupActInfoEntity);
} else {
baseDao.insert(groupActInfoEntity);
}
//要放在插入或者更新之后,才能拿到插入的主键
//构造操作日志
ActOperationRecordEntity operRecEntity = constructOperRec(groupActInfoEntity.getId(), formDTO);
//构造活动内容表
List<GroupActContentEntity> contentList = constructText(groupActInfoEntity.getId(), formDTO.getCustomerId(), formDTO.getTextList());
List<GroupActContentEntity> imgList = constructImg(groupActInfoEntity.getId(), formDTO.getCustomerId(), formDTO.getImgList());
List<ActReadRecordEntity> readRecordEntityList=constructReadRec(groupActInfoEntity.getId(),
formDTO.getCustomerId(),
formDTO.getGroupId(),
formDTO.getPublishUserId());
//2、插入活动内容
contentList.forEach(textContentEntity->{
groupActContentDao.insert(textContentEntity);
});
imgList.forEach(imgContent->{
groupActContentDao.insert(imgContent);
});
//3、插入操作日志
actOperationRecordDao.insert(operRecEntity);
//4、插入应读记录表
readRecordEntityList.forEach(readRecordEntity->{
actReadRecordDao.insert(readRecordEntity);
});
result.setGroupActId(groupActInfoEntity.getId());
return result;
}
private List<ActReadRecordEntity> constructReadRec(String groupActId, String customerId, String groupId,String publishUserId) {
List<ActReadRecordEntity> list=new ArrayList<>();
List<ResiGroupMemberDTO> memberDTOList=resiGroupMemberService.getMemberList(groupId);
memberDTOList.forEach(memberDTO->{
ActReadRecordEntity actReadRecordEntity=new ActReadRecordEntity();
actReadRecordEntity.setCustomerId(customerId);
actReadRecordEntity.setGroupActId(groupActId);
if(publishUserId.equals(memberDTO.getCustomerUserId())){
//发布人默认是已读
actReadRecordEntity.setRead(GroupActConstant.READ);
}else{
actReadRecordEntity.setRead(GroupActConstant.UN_READ);
}
actReadRecordEntity.setUserId(memberDTO.getCustomerUserId());
actReadRecordEntity.setShouldBeRead(Constant.YES);
list.add(actReadRecordEntity);
});
return list;
}
private GroupActInfoEntity constructGroupActInfoEntity(PublishGroupActFormDTO formDTO) {
GroupActInfoEntity entity = ConvertUtils.sourceToTarget(formDTO, GroupActInfoEntity.class);
entity.setId(formDTO.getGroupActId());
entity.setAllCategoryName(actCategoryDictService.queryAllCategoryName(formDTO.getCategoryCode(), formDTO.getCustomerId()));
String startTimeStr = formDTO.getStartTime().concat(":00");
entity.setStartTime(DateUtils.parse(startTimeStr, DateUtils.DATE_TIME_PATTERN));
if (StringUtils.isNotBlank(formDTO.getGroupActId())) {
entity.setStatus(GroupActConstant.CHANGED);
entity.setChangedTime(new Date());
GroupActInfoEntity orginalEntity=baseDao.selectById(formDTO.getGroupActId());
entity.setSignInStartTime(orginalEntity.getSignInStartTime());
entity.setSignInEndTime(orginalEntity.getSignInEndTime());
entity.setSummaryFlag(orginalEntity.getSummaryFlag());
entity.setSignedInNum(orginalEntity.getSignedInNum());
} else {
//发布新活动
entity.setStatus(GroupActConstant.PUBLISHED);
entity.setChangedTime(new Date());
entity.setSummaryFlag(NumConstant.ZERO);
entity.setSignedInNum(NumConstant.ZERO);
}
Result<GridInfoResultDTO> gridInfoRes = govOrgOpenFeignClient.queryGridInfo(formDTO.getGridId());
if (!gridInfoRes.success() || null == gridInfoRes.getData()) {
throw new RenException("网格信息查询失败,griId="+formDTO.getGridId());
}
entity.setAgencyId(gridInfoRes.getData().getParentAgencyId());
entity.setGridPids(gridInfoRes.getData().getPids());
return entity;
}
private void checkPublishGroupActFormDTO(PublishGroupActFormDTO formDTO) {
//只有组长才能发布、编辑活动
ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getLeaderMember(formDTO.getGroupId());
if (!formDTO.getPublishUserId().equals(groupMemberDTO.getCustomerUserId())) {
throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode(), EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg());
}
if (StringUtils.isNotBlank(formDTO.getGroupActId())) {
//已取消或者已关闭的活动不允许修改
GroupActInfoEntity originalAct = baseDao.selectById(formDTO.getGroupActId());
if (null == originalAct) {
throw new RenException(String.format("活动已删除,group_act_info.id=%s", formDTO.getGroupActId()));
}
if (GroupActConstant.CANCELED.equals(originalAct.getStatus())) {
throw new RenException(EpmetErrorCode.GROUP_ACT_CANCELED_CAN_NOT_EDIT.getCode(), EpmetErrorCode.GROUP_ACT_CANCELED_CAN_NOT_EDIT.getMsg());
}
if (GroupActConstant.CLOSED.equals(originalAct.getStatus())) {
throw new RenException(EpmetErrorCode.GROUP_ACT_CLOSED_CAN_NOT_EDIT.getCode(), EpmetErrorCode.GROUP_ACT_CLOSED_CAN_NOT_EDIT.getMsg());
}
}
//文本内容、图片列表至少选择一个
if (CollectionUtils.isEmpty(formDTO.getTextList()) && CollectionUtils.isEmpty(formDTO.getImgList())) {
throw new RenException(EpmetErrorCode.PLEASE_INPUT_ACT_CONTENT.getCode(), EpmetErrorCode.PLEASE_INPUT_ACT_CONTENT.getMsg());
}
if (!CollectionUtils.isEmpty(formDTO.getTextList())) {
//活动文本内容,目前只有一段,限制1000字
if (formDTO.getTextList().get(NumConstant.ZERO).length() > 1000) {
throw new RenException(EpmetErrorCode.GROUP_ACT_CONTENT_MAX.getCode(), EpmetErrorCode.GROUP_ACT_CONTENT_MAX.getMsg());
}
}
if (!CollectionUtils.isEmpty(formDTO.getImgList())) {
//最多选择3张图片
if (formDTO.getTextList().get(NumConstant.ZERO).length() > NumConstant.THREE) {
throw new RenException(EpmetErrorCode.GROUP_ACT_IMG_MAX.getCode(), EpmetErrorCode.GROUP_ACT_IMG_MAX.getMsg());
}
}
}
/**
* @param title 活动标题
* @param textList 活动内容列表
* @param imgList 活动图片列表
* @return void
* @author yinzuomei
* @description
* @Date 2021/4/19 16:39
**/
private void scanActContent(String title, List<String> textList, List<String> imgList) {
//活动标题
if (StringUtils.isNotBlank(title)) {
//创建话题内容审核
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(title);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
log.warn(String.format("活动标题审核失败【%s】", title));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg());
}
}
}
//活动内容
if (!CollectionUtils.isEmpty(textList)) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
textList.forEach(content -> {
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(content);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
});
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
log.warn(String.format("活动内容审核失败【%s】", JSON.toJSONString(textList)));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg());
}
}
}
//活动图片
if (!CollectionUtils.isEmpty(imgList)) {
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
log.warn("活动图片审核失败");
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode(), EpmetErrorCode.IMG_SCAN_FAILED.getMsg());
}
}
}
}
private ActOperationRecordEntity constructOperRec(String groupActId, PublishGroupActFormDTO formDTO) {
ActOperationRecordEntity actOperationRecordEntity = new ActOperationRecordEntity();
actOperationRecordEntity.setCustomerId(formDTO.getCustomerId());
actOperationRecordEntity.setOperateUserId(formDTO.getPublishUserId());
actOperationRecordEntity.setGroupActId(groupActId);
actOperationRecordEntity.setOperationType(StringUtils.isNotBlank(formDTO.getGroupActId()) ? GroupActConstant.CHANGE : GroupActConstant.PUBLISH);
return actOperationRecordEntity;
}
private List<GroupActContentEntity> constructImg(String groupActId, String customerId, List<String> imgList) {
List<GroupActContentEntity> list = new ArrayList<>();
int imgSort = NumConstant.ONE;
for (String img : imgList) {
GroupActContentEntity entity = new GroupActContentEntity();
entity.setGroupActId(groupActId);
entity.setContent(img);
entity.setContentType(GroupActConstant.IMG);
entity.setCustomerId(customerId);
entity.setSort(imgSort);
imgSort++;
}
return list;
}
private List<GroupActContentEntity> constructText(String groupActId, String customerId, List<String> textList) {
List<GroupActContentEntity> list = new ArrayList<>();
int textSort = NumConstant.ONE;
for (String text : textList) {
GroupActContentEntity entity = new GroupActContentEntity();
entity.setGroupActId(groupActId);
entity.setContent(text);
entity.setContentType(GroupActConstant.TEXT);
entity.setCustomerId(customerId);
entity.setSort(textSort);
textSort++;
}
return list;
}
/**
* 004活动详情
*
* @param actDetailFormDTO
* @return com.epmet.resi.group.dto.act.result.ActDetailResultDTO
*/
@Override
public ActDetailResultDTO queryActDetail(ActDetailFormDTO actDetailFormDTO) {
//todo
return null;
}
}

25
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupActConstant.java

@ -8,4 +8,29 @@ package com.epmet.modules.constant;
*/
public interface GroupActConstant {
String DEFAULT_CUSTOMER_ID = "default";
// 活动状态:已发布:published;已取消:canceled;已变更:changed;已关闭:closed
String PUBLISHED="published";
String CANCELED="canceled";
String CHANGED="changed";
String CLOSED="closed";
/**
* 操作类型发布publish;
取消cancel
变更change
关闭close
*/
String PUBLISH="publish";
String CANCEL="cancel";
String CHANGE="change";
String CLOSE="close";
// 内容类型: 文字:text;图片:img
String TEXT="text";
String IMG="img";
// 已读: read未读:un_read
String READ="read";
String UN_READ="un_read";
}

18
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java

@ -234,4 +234,22 @@ public interface ResiGroupMemberService extends BaseService<ResiGroupMemberEntit
* @Date 2021/4/19 13:53
**/
Integer selectCountMember(String groupId);
/**
* @return com.epmet.resi.group.dto.member.ResiGroupMemberDTO
* @param groupId
* @author yinzuomei
* @description 获取组长信息
* @Date 2021/4/19 19:14
**/
ResiGroupMemberDTO getLeaderMember(String groupId);
/**
* @return java.util.List<com.epmet.resi.group.dto.member.ResiGroupMemberDTO>
* @param groupId
* @author yinzuomei
* @description 查询组内有效人员列表
* @Date 2021/4/19 19:14
**/
List<ResiGroupMemberDTO> getMemberList(String groupId);
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java

@ -351,6 +351,16 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
return baseDao.selectCountMember(groupId);
}
@Override
public ResiGroupMemberDTO getLeaderMember(String groupId) {
return baseDao.selectLeaderMember(groupId);
}
@Override
public List<ResiGroupMemberDTO> getMemberList(String groupId) {
return baseDao.getMemberList(groupId);
}
/**
* @param groupMemberListFormDTO
* @return com.epmet.commons.tools.utils.Result

22
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActCategoryDictDao.xml

@ -37,10 +37,30 @@
FROM
act_category_dict acd
WHERE
acd.PARENT_CODE = #{parentCode}
acd.DEL_FLAG = '0'
and acd.PARENT_CODE = #{parentCode}
AND acd.CUSTOMER_ID = #{customerId}
ORDER BY ACD.SORT ASC
</select>
<select id="selectCountByCustomerId" parameterType="java.lang.String" resultType="int">
SELECT
count(*)
FROM
act_category_dict acd
WHERE
acd.DEL_FLAG = '0'
AND acd.CUSTOMER_ID = #{customerId}
</select>
<select id="selectByCode" parameterType="map" resultType="com.epmet.modules.act.entity.ActCategoryDictEntity">
SELECT
acd.*
FROM
act_category_dict acd
WHERE
acd.DEL_FLAG = '0'
and acd.CATEGORY_CODE= #{categoryCode}
AND acd.CUSTOMER_ID = #{customerId}
</select>
</mapper>

4
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/ActReadRecordDao.xml

@ -2,7 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.modules.act.dao.ActReadRecordDao">
<delete id="deleteByActId" parameterType="java.lang.String">
delete from act_read_record where GROUP_ACT_ID=#{groupActId}
</delete>
</mapper>

9
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/act/GroupActContentDao.xml

@ -3,6 +3,13 @@
<mapper namespace="com.epmet.modules.act.dao.GroupActContentDao">
<update id="updateToDel" parameterType="map">
UPDATE group_act_content
SET DEL_FLAG = '1',
UPDATED_BY = #{userId},
UPDATED_TIME = now()
WHERE
GROUP_ACT_ID = #{groupActId}
</update>
</mapper>
Loading…
Cancel
Save