Browse Source

自动发布时间字典表数据flyway

feature/evaluate
yinzuomei 3 years ago
parent
commit
e290cfa4b2
  1. 7
      epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.23_party_publish_Time.sql
  2. 6
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  3. 146
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActAddOrUpdateFormDTO.java
  4. 53
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/JoinOrgDTO.java
  5. 8
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActController.java
  6. 6
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActEntity.java
  7. 32
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java

7
epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.23_party_publish_Time.sql

@ -0,0 +1,7 @@
INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458000894500866', 'icpartyact_auto_publish_time', '党组织活动自动发布时间', '党组织活动自动发布时间', 35, 0, 0, '1', '2022-08-19 10:45:54', '1', '2022-08-19 10:46:11');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458233091170305', 1560458000894500866, '活动开始前1天', '1', '0', '活动开始前1天', 1, 0, 0, '1', '2022-08-19 10:46:49', '1', '2022-08-19 10:46:49');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458276439302146', 1560458000894500866, '活动开始前3天', '3', '0', '活动开始前3天', 2, 0, 0, '1', '2022-08-19 10:47:00', '1', '2022-08-19 10:47:00');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458332076744705', 1560458000894500866, '活动开始前5天', '5', '0', '活动开始前5天', 3, 0, 0, '1', '2022-08-19 10:47:13', '1', '2022-08-19 10:47:13');
INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458388007788545', 1560458000894500866, '活动开始前7天', '7', '0', '活动开始前7天', 4, 0, 0, '1', '2022-08-19 10:47:26', '1', '2022-08-19 10:47:26');

6
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -1070,4 +1070,10 @@ public class DateUtils {
return cal.getTime(); return cal.getTime();
} }
public static Date calDateBaseDay(Date date, int day) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, day);
return calendar.getTime();
}
} }

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

@ -1,8 +1,18 @@
package com.epmet.resi.partymember.dto.icpartyact.form; package com.epmet.resi.partymember.dto.icpartyact.form;
import com.epmet.commons.tools.dto.form.FileCommonDTO;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List;
/** /**
* @Description * @Description
@ -12,7 +22,143 @@ import java.io.Serializable;
@Data @Data
public class IcPartyActAddOrUpdateFormDTO implements Serializable { public class IcPartyActAddOrUpdateFormDTO implements Serializable {
private static final long serialVersionUID = -2554822505755122067L; private static final long serialVersionUID = -2554822505755122067L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
public interface UpdateUserInternalGroup {
}
public interface UpdateUserShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "customerId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class})
private String customerId; private String customerId;
@NotBlank(message = "publishStaffId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class})
private String publishStaffId; private String publishStaffId;
@NotBlank(message = "icPartyActId不能为空", groups = {UpdateUserInternalGroup.class})
private String icPartyActId;
/**
* 活动类型来源于ic_party_act_type_dict
*/
@NotBlank(message = "活动类型不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String actType;
/**
* 活动举办时间yyyy
*/
@NotBlank(message = "holdYearId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class})
private String holdYearId;
/**
* 活动举办时间:yyyyMM
*/
@NotBlank(message = "holdMonthId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class})
private String holdMonthId;
/**
* 举办活动时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@NotNull(message = "活动举办时间不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private Date holdTime;
/**
* 活动主题
*/
@NotBlank(message = "活动主题不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
@Length(max = 35, message = "最多输入35个字", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String topic;
/**
* 活动地点
*/
@NotBlank(message = "活动地点不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
@Length(max = 100, message = "活动地点最多输入100字", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String address;
/**
* 活动地点纬度
*/
private String latitude;
/**
* 活动地点经度
*/
private String longitude;
/**
* 活动开始前几天
*/
@NotBlank(message = "自动发布时间不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private Integer autoPublicType;
/**
* 发布活动党组织
*/
@NotBlank(message = "发布活动党组织不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String publishPartyOrgId;
/**
* 发布活动党组织名称
*/
@NotBlank(message = "发布活动党组织名称不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String publishPartyOrgName;
/**
* 发布活动党组织ID的上级节点
*/
@NotBlank(message = "参加活动党组织ID的上级节点不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class})
private String publishOrgPid;
/**
* 发布活动党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部6党小组
*/
@NotBlank(message = "发布活动党组织类型不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String publishOrgType;
/**
* 发布活动党组织PUBLISH_PARTY_ORG_ID的全路径包含自身方便前端回显
*/
@NotBlank(message = "", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class})
private String publishOrgPath;
/**
* 参加人员类型0全体党员1支部委员
*/
@NotBlank(message = "参加人员类型不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String joinUserType;
/**
* 是否自动通知参加人员0否1是
*/
@NotBlank(message = "自动通知参加人员不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String isAutoInform;
/**
* 活动介绍
*/
@NotBlank(message = "活动介绍不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
@Length(max = 1000, message = "活动介绍最多输入1000字", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private String introduce;
/**
* 参加活动党组织
*/
@Valid
@NotEmpty(message = "参加活动党组织不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class})
private List<JoinOrgDTO> joinOrgList;
/**
* 附件表
*/
private List<FileCommonDTO> attachmentList;
} }

53
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/JoinOrgDTO.java

@ -0,0 +1,53 @@
package com.epmet.resi.partymember.dto.icpartyact.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description
* @Author yzm
* @Date 2022/8/19 10:31
*/
@Data
public class JoinOrgDTO implements Serializable {
private static final long serialVersionUID = 6994576136698569857L;
//前端传入
/**
* 参加活动党组织ID,groupId
*/
@NotBlank(message = "参加活动党组织不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserShowGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserShowGroup.class})
private String joinOrgId;
/**
* 党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部6党小组
*/
@NotBlank(message = "参加活动党组织类型不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserShowGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserShowGroup.class})
private String orgType;
/**
* 参加活动党组织ID的上级节点
*/
@NotBlank(message = "参加活动党组织不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserInternalGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserInternalGroup.class})
private String pid;
/**
* PARTY_ORG_ID的全路径包含自身方便前端回显
*/
@NotBlank(message = "参加活动党组织不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserInternalGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserInternalGroup.class})
private String joinOrgPath;
//接口内部赋值
/**
* 活动id
*/
private String icPartyActId;
/**
* 客户ID
*/
private String customerId;
}

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

@ -13,6 +13,7 @@ import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActDetailResDTO;
import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActPageResultDTO; import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActPageResultDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.HomeMonthTotalFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.HomeMonthTotalFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.HomeMonthTotalResultDTO; import com.epmet.resi.partymember.dto.partyOrg.result.HomeMonthTotalResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -43,6 +44,13 @@ public class IcPartyActController {
public Result<Map<String,String>> addOrUpdate(@LoginUser TokenDto tokenDto,@RequestBody IcPartyActAddOrUpdateFormDTO formDTO){ public Result<Map<String,String>> addOrUpdate(@LoginUser TokenDto tokenDto,@RequestBody IcPartyActAddOrUpdateFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setPublishStaffId(tokenDto.getUserId()); formDTO.setPublishStaffId(tokenDto.getUserId());
if(StringUtils.isNotBlank(formDTO.getIcPartyActId())){
//修改活动
ValidatorUtils.validateEntity(formDTO,IcPartyActAddOrUpdateFormDTO.UpdateUserShowGroup.class,IcPartyActAddOrUpdateFormDTO.UpdateUserInternalGroup.class);
}else{
//添加活动
ValidatorUtils.validateEntity(formDTO,IcPartyActAddOrUpdateFormDTO.AddUserShowGroup.class,IcPartyActAddOrUpdateFormDTO.AddUserInternalGroup.class);
}
Map<String,String> map=icPartyActService.addOrUpdate(formDTO); Map<String,String> map=icPartyActService.addOrUpdate(formDTO);
return new Result<Map<String, String>>().ok(map); return new Result<Map<String, String>>().ok(map);
} }

6
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActEntity.java

@ -52,17 +52,17 @@ public class IcPartyActEntity extends BaseEpmetEntity {
private String publishPartyOrgName; private String publishPartyOrgName;
/** /**
* 参加活动党组织ID的上级节点 * 发布活动党组织ID的上级节点
*/ */
private String publishOrgPid; private String publishOrgPid;
/** /**
* 党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部6党小组 * 发布活动党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部6党小组
*/ */
private String publishOrgType; private String publishOrgType;
/** /**
* PUBLISH_PARTY_ORG_ID的全路径包含自身方便前端回显 * 发布活动党组织PUBLISH_PARTY_ORG_ID的全路径包含自身方便前端回显
*/ */
private String publishOrgPath; private String publishOrgPath;

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

@ -3,8 +3,15 @@ package com.epmet.modules.partyOrg.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
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.page.PageData;
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.modules.partyOrg.dao.IcPartyActDao; import com.epmet.modules.partyOrg.dao.IcPartyActDao;
import com.epmet.modules.partyOrg.dao.IcPartyActOrgDao;
import com.epmet.modules.partyOrg.entity.IcPartyActEntity; import com.epmet.modules.partyOrg.entity.IcPartyActEntity;
import com.epmet.modules.partyOrg.service.IcPartyActService; import com.epmet.modules.partyOrg.service.IcPartyActService;
import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO; import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO;
@ -16,7 +23,9 @@ import com.epmet.resi.partymember.dto.partyOrg.form.HomeMonthTotalFormDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.HomeMonthTotalResultDTO; import com.epmet.resi.partymember.dto.partyOrg.result.HomeMonthTotalResultDTO;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -32,7 +41,8 @@ import java.util.Map;
*/ */
@Service @Service
public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPartyActEntity> implements IcPartyActService { public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPartyActEntity> implements IcPartyActService {
@Autowired
private IcPartyActOrgDao icPartyActOrgDao;
/** /**
* 活动类型列表 * 活动类型列表
@ -99,11 +109,29 @@ public class IcPartyActServiceImpl extends BaseServiceImpl<IcPartyActDao, IcPart
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Map<String, String> addOrUpdate(IcPartyActAddOrUpdateFormDTO formDTO) { public Map<String, String> addOrUpdate(IcPartyActAddOrUpdateFormDTO formDTO) {
//todo 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.setPublishStaffName(staffInfo.getRealName());
icPartyActEntity.setOrgId(staffInfo.getAgencyId());
icPartyActEntity.setPid(staffInfo.getParentAgency().getId());
icPartyActEntity.setOrgIdPath(staffInfo.getAgencyPIds());
if(StringUtils.isNotBlank(formDTO.getIcPartyActId())){
//删除附件、删除参加组织
}
return null; return null;
} }
/** /**
* 活动列表-分页查询 * 活动列表-分页查询
* *

Loading…
Cancel
Save