diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/SysDictDataDTO.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/SysDictDataDTO.java index 344ef25601..3664870194 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/SysDictDataDTO.java +++ b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/SysDictDataDTO.java @@ -32,7 +32,7 @@ public class SysDictDataDTO implements Serializable { @Null(message="{id.null}", groups = AddGroup.class) @NotNull(message="{id.require}", groups = UpdateGroup.class) - private Long id; + private String id; @NotNull(message="{sysdict.type.require}", groups = DefaultGroup.class) private Long dictTypeId; @@ -42,14 +42,16 @@ public class SysDictDataDTO implements Serializable { private String dictValue; + private String dictPValue; + private String remark; @Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class) private Integer sort; @JsonProperty(access = JsonProperty.Access.READ_ONLY) - private Date createDate; + private Date createdTime; @JsonProperty(access = JsonProperty.Access.READ_ONLY) - private Date updateDate; + private Date updatedTime; } diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/SysDictTypeDTO.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/SysDictTypeDTO.java index 503078e1b5..4fd3c654f4 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/SysDictTypeDTO.java +++ b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/SysDictTypeDTO.java @@ -33,7 +33,7 @@ public class SysDictTypeDTO implements Serializable { @Null(message="{id.null}", groups = AddGroup.class) @NotNull(message="{id.require}", groups = UpdateGroup.class) - private Long id; + private String id; @NotBlank(message="{sysdict.type.require}", groups = DefaultGroup.class) private String dictType; @@ -47,8 +47,8 @@ public class SysDictTypeDTO implements Serializable { private Integer sort; @JsonProperty(access = JsonProperty.Access.READ_ONLY) - private Date createDate; + private Date createdTime; @JsonProperty(access = JsonProperty.Access.READ_ONLY) - private Date updateDate; + private Date updatedTime; } diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java index 6d7e1124dd..9068180318 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java +++ b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java @@ -3,6 +3,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.form.DictListFormDTO; import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.dto.result.DictTreeResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.CorsConfigResultDTO; @@ -88,6 +89,16 @@ public interface EpmetAdminOpenFeignClient { @PostMapping("/sys/dict/data/dictmap/{dictType}") Result> dictMap(@PathVariable("dictType") String dictType); + /** + * 字典数据查询通用接口 + * @Param dictType + * @Return {@link Result< Map < String, String>>} + * @Author zhaoqifeng + * @Date 2021/11/19 17:36 + */ + @PostMapping("/sys/dict/data/dictTree/{dictType}") + Result> dictTree(@PathVariable("dictType") String dictType); + @PostMapping("/sys/dict/data/dictlist") Result> dictList(@RequestBody DictListFormDTO formDTO); } diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java index 6c16e8f3ae..110ba490e3 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java +++ b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java @@ -3,6 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.form.DictListFormDTO; import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.dto.result.DictTreeResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; @@ -49,6 +50,11 @@ public class EpmetAdminOpenFeignClientFallback implements EpmetAdminOpenFeignCli return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "dictMap", dictType); } + @Override + public Result> dictTree(String dictType) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "dictTree", dictType); + } + @Override public Result> dictList(DictListFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_ADMIN_SERVER, "dictList", formDTO); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java index aff54e6e09..3c3ac4d344 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java @@ -10,6 +10,7 @@ package com.epmet.controller; import com.epmet.commons.tools.dto.form.DictListFormDTO; import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.dto.result.DictTreeResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; @@ -150,6 +151,15 @@ public class SysDictDataController { return new Result>().ok(sysDictDataService.dictList(formDTO.getDictType())); } + /** + * @Description 字典数据查询通用接口 + * @Author sun + */ + @PostMapping("dictTree/{dictType}") + public Result> dictListTree(@PathVariable("dictType") String dictType) { + return new Result>().ok(sysDictDataService.dictListTree(dictType)); + } + /** * 字典数据查询通用接口 * @Param dictType diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/SysDictDataDao.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/SysDictDataDao.java index 59ee893a89..7ba543b6af 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/SysDictDataDao.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/dao/SysDictDataDao.java @@ -10,6 +10,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.dto.result.DictTreeResultDTO; import com.epmet.entity.DictData; import com.epmet.entity.SysDictDataEntity; import org.apache.ibatis.annotations.Mapper; @@ -30,4 +31,6 @@ public interface SysDictDataDao extends BaseDao { List getDictDataList(); List selectDictList(String dictType); + + List selectDictData(String dictType); } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/SysDictDataEntity.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/SysDictDataEntity.java index 16a7b5cad8..b02d4fb4f3 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/SysDictDataEntity.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/SysDictDataEntity.java @@ -8,15 +8,13 @@ package com.epmet.entity; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEntity; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 数据字典 * @@ -25,8 +23,10 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @TableName("sys_dict_data") -public class SysDictDataEntity extends BaseEntity { +public class SysDictDataEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + @TableId(type = IdType.ID_WORKER_STR) + private String id; /** * 字典类型ID */ @@ -39,6 +39,10 @@ public class SysDictDataEntity extends BaseEntity { * 字典值 */ private String dictValue; + /** + * 父级字典值 顶级:0 + */ + private String dictPValue; /** * 备注 */ @@ -47,14 +51,4 @@ public class SysDictDataEntity extends BaseEntity { * 排序 */ private Integer sort; - /** - * 更新者 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updater; - /** - * 更新时间 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateDate; } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/SysDictTypeEntity.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/SysDictTypeEntity.java index d3e2f68a87..8640c2a7bf 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/SysDictTypeEntity.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/SysDictTypeEntity.java @@ -8,15 +8,13 @@ package com.epmet.entity; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEntity; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 字典类型 * @@ -25,8 +23,11 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @TableName("sys_dict_type") -public class SysDictTypeEntity extends BaseEntity { +public class SysDictTypeEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; + + @TableId(type = IdType.ID_WORKER_STR) + private String id; /** * 字典类型 */ @@ -43,14 +44,4 @@ public class SysDictTypeEntity extends BaseEntity { * 排序 */ private Integer sort; - /** - * 更新者 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updater; - /** - * 更新时间 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateDate; } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java index 9109cfdc86..b49e51fbdc 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/SysDictDataService.java @@ -10,6 +10,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.dto.result.DictTreeResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.SysDictDataDTO; @@ -87,4 +88,6 @@ public interface SysDictDataService extends BaseService { Map dictMap(String dictType); + + List dictListTree(String dictType); } diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java index d3c61d6c16..bd042379dd 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java @@ -13,9 +13,11 @@ 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.dto.result.DictListResultDTO; +import com.epmet.commons.tools.dto.result.DictTreeResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.TreeUtils; import com.epmet.dao.SysDictDataDao; import com.epmet.dto.SysDictDataDTO; import com.epmet.entity.SysDictDataEntity; @@ -217,4 +219,10 @@ public class SysDictDataServiceImpl extends BaseServiceImpl dictListTree(String dictType) { + List resultDTOList = baseDao.selectDictData(dictType); + return TreeUtils.buildTree(resultDTOList); + } + } diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.8__add_dict_data_pid.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.8__add_dict_data_pid.sql new file mode 100644 index 0000000000..864cc905d1 --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.8__add_dict_data_pid.sql @@ -0,0 +1,27 @@ +-- 添加pid (dict_p_value) 让字典支持 树形结构 +ALTER TABLE `epmet_admin`.`sys_dict_data` + ADD COLUMN `dict_p_value` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '父级value项;默认为0' AFTER `dict_value`; +ALTER TABLE `epmet_admin`.`sys_dict_data` + MODIFY COLUMN `dict_value` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字典值' AFTER `dict_label`; + + +INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473150812296318978, 'patrol_work_type', '例行工作分类', '网格员巡查-例行工作事项分类', 13, 1067246875800000001, '2021-12-21 12:40:45', 12, '2021-12-21 17:37:12'); + +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473151790785499137, 1473150812296318978, '重点巡查', '01', '0', '', 1, NULL, NULL, 1, '2021-12-21 14:17:14'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473175635001085953, 1473150812296318978, '出租房屋巡查', '0101', '01', '', 1, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473175848537296897, 1473150812296318978, '重点场所巡查', '0102', '01', '', 2, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473175904669667329, 1473150812296318978, '宗教活动', '0103', '01', '', 3, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473175977868660738, 1473150812296318978, '其他', '0199', '01', '', 99, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473151862784921602, 1473150812296318978, '特殊人群', '02', '0', '', 2, NULL, NULL, 1, '2021-12-21 14:17:24'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176029219524610, 1473150812296318978, '刑满释放人员', '0201', '02', '', 1, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176085809074178, 1473150812296318978, '社区矫正', '0202', '02', '', 2, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176129127845889, 1473150812296318978, '吸毒人员', '0203', '02', '', 3, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176201798356994, 1473150812296318978, '信访人员', '0204', '02', '', 4, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176249558896642, 1473150812296318978, '重点青少年', '0205', '02', '', 5, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176305758375937, 1473150812296318978, '精神障碍者', '0206', '02', '', 6, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473151924881592321, 1473150812296318978, '为民服务', '09', '0', '', 3, NULL, NULL, 1, '2021-12-21 14:20:06'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176393352220673, 1473150812296318978, '公共服务', '0901', '09', '', 1, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176479897489410, 1473150812296318978, '权益保障', '0902', '09', '', 2, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176534641545218, 1473150812296318978, '政策宣传', '0903', '09', '', 3, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176583006064641, 1473150812296318978, '便利服务', '0904', '09', '', 4, NULL, NULL, NULL, NULL); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES (1473176670985785345, 1473150812296318978, '其他', '0999', '09', '', 99, NULL, NULL, NULL, NULL); diff --git a/epmet-admin/epmet-admin-server/src/main/resources/mapper/SysDictDataDao.xml b/epmet-admin/epmet-admin-server/src/main/resources/mapper/SysDictDataDao.xml index 3760e0895a..ff1273d4ae 100644 --- a/epmet-admin/epmet-admin-server/src/main/resources/mapper/SysDictDataDao.xml +++ b/epmet-admin/epmet-admin-server/src/main/resources/mapper/SysDictDataDao.xml @@ -19,5 +19,18 @@ ORDER BY a.sort ASC + diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index 400eca1d51..9bbd564ea2 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -41,10 +41,24 @@ public interface ConsomerGroupConstants { */ String PROJECT_OPERATION_LOG_GROUP = "project_operation_log_group"; /** - * 积分操作消费组 + * 积分操作日志消费组 */ String POINT_OPERATION_LOG_GROUP = "point_operation_log_group"; + /** + * 爱心互助积分操作消费组 + */ + String EPMET_HEART_POINT_OPERATION_GROUP = "epmet_heart_point_operation_group"; + /** + * 楼院小组积分操作消费组 + */ + String RESI_GROUP_POINT_OPERATION_GROUP = "resi_group_point_operation_group"; + + /** + * 社区服务(原居民需求)积分操作消费组 + */ + String COMMUNITY_SERVICE_POINT_OPERATION_GROUP = "community_service_point_operation_group"; + /** * 开放的对接数据(中间库) 组织变更事件监听器分组 */ @@ -73,5 +87,5 @@ public interface ConsomerGroupConstants { /** * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度 */ - String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction"; + String USER_DEMAND_FINISH_GROUP = "user_demand_finish_group"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java index e11400fef3..f4c2d45e89 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java @@ -55,7 +55,23 @@ public interface TopicConstants { String IC_RESI_USER = "ic_resi_user"; /** - * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度 + * 需求完成 + * 1、如果服务方是区域化党建单位,重新计算这个单位的满意度 */ - String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction"; + String USER_DEMAND = "user_demand"; + + /** + * 爱心互助 + */ + String EPMET_HEART = "epmet_heart"; + + /** + * 楼院小组 + */ + String RESI_GROUP = "resi_group"; + + /** + * 社区服务,原居民需求 + */ + String COMMUNITY_SERVICE="community_service"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java deleted file mode 100644 index bfaf63703a..0000000000 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.epmet.commons.rocketmq.messages; - - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度,或者直接计算整个客户 - */ -@Data -public class CalPartyUnitSatisfactionFormDTO implements Serializable { - public interface AddUserInternalGroup { - } - @NotBlank(message = "客户id不能为空",groups = AddUserInternalGroup.class) - private String customerId; - private String partyUnitId; -} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/ServerSatisfactionCalFormDTO.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/ServerSatisfactionCalFormDTO.java new file mode 100644 index 0000000000..998d1523cb --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/ServerSatisfactionCalFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.commons.rocketmq.messages; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度,或者直接计算整个客户 + */ +@Data +public class ServerSatisfactionCalFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + @NotBlank(message = "客户id不能为空",groups = AddUserInternalGroup.class) + private String customerId; + /** + * 服务方id:可以值区域化党建单位id + * 后面也可以是社会组织、社区自组织id... + */ + private String serverId; + /** + * 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; + */ + @NotBlank(message = "serviceType不能为空",groups = AddUserInternalGroup.class) + private String serviceType; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java index 8ccaba98b4..8d458c4a60 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java @@ -17,4 +17,6 @@ public interface MqConstant { * 减分标识 minus */ String MINUS="minus"; + + String SOURCE_TYPE_DEMAND="demand"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java index 9235fe77a7..ff2849d331 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java @@ -92,4 +92,6 @@ public class BasePointEventMsg implements Serializable { private String eventTag; private String eventClass; + private String objectId; + private String eventName; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictListResultDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictListResultDTO.java index fe89cf0d24..cc85c39027 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictListResultDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictListResultDTO.java @@ -14,4 +14,5 @@ public class DictListResultDTO implements Serializable { private static final long serialVersionUID = 8618231166600518980L; private String label; private String value; + private List children; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictTreeResultDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictTreeResultDTO.java new file mode 100644 index 0000000000..c8aef8f93f --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/DictTreeResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.commons.tools.dto.result; + +import com.epmet.commons.tools.utils.TreeStringNode; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 字典数据查询-接口返参 + * @Author sun + */ +@Data +public class DictTreeResultDTO extends TreeStringNode implements Serializable { + private static final long serialVersionUID = 3772355047088964759L; + /** + * 上级ID + */ + private String pid; + private String name; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java index e1fa6b1456..7afc85aab1 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java @@ -20,6 +20,8 @@ public enum DictTypeEnum { USER_DEMAND_REPORT_TYPE("user_demand_report_type","居民需求上报类型",9), USER_DEMAND_SERVICE_TYPE("user_demand_service_type","居民需求服务方类型",10), AGE_GROUP("age_group", "年龄范围", 11), + PATROL_WORK_TYPE("patrol_work_type", "例行工作分类", 13), + GRID_TYPE("grid_type", "网格类型", 12), ; private final String code; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java index 44d229ec3b..3cccd74d7a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java @@ -18,6 +18,7 @@ public enum EventEnum { SHIFT_TOPIC_TO_ISSUE("shift_topic_to_issue","resi_group","转话题为议题(将自建小组中话题转为议题)"), TOPIC_SHIFTED_TO_PROJECT("topic_to_project","resi_group","话题被转为项目"), LEADER_RESOLVE_TOPIC("leader_resolve_topic","resi_group","组长解决组内话题"), + FINISH_USER_DEMAND("finish_user_demand","community_service","服务完成"), ; private String eventClass; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java index 53713e032c..6d87e3bd2c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java @@ -8,6 +8,7 @@ package com.epmet.commons.tools.utils; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml index ee8caafc3e..d2c47a0922 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml @@ -27,25 +27,12 @@ ca.level, ca.area_code, ca.parent_area_code, - ( CASE WHEN ca.longitude is null THEN - ( SELECT longitude FROM customer_agency - WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id) - ORDER BY pid ASC LIMIT 1 - ) - ELSE ca.longitude - END - ) longitude, - ( CASE WHEN ca.latitude is null THEN - ( SELECT latitude FROM customer_agency - WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id) - ORDER BY pid ASC LIMIT 1 - ) - ELSE ca.latitude - END - ) latitude + IFNULL(ca.longitude, cc.longitude) longitude, + IFNULL(ca.latitude, cc.latitude) latitude FROM customer_staff_agency csa INNER JOIN customer_agency ca ON csa.agency_id = ca.id + INNER JOIN customer_agency cc ON cc.pid = '0' AND ca.customer_id = cc.customer_id WHERE csa.del_flag = '0' AND ca.del_flag = '0' diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml index 0f4b2974ec..b883c42d9f 100644 --- a/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-report-server: container_name: data-report-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-report-server:0.3.195 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/data-report-server:0.3.196 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 84e5f4d96f..6651fb7c7a 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 0.3.195 + 0.3.196 data-report-server diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java index b747b77985..10180e0222 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java @@ -44,6 +44,27 @@ public class ActInfoDTO implements Serializable { */ private String customerId; + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; + /** * 活动标题 */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java index a8c770f8e9..81edd97c20 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java @@ -58,6 +58,11 @@ public class IcPartyActivityDTO implements Serializable { */ private String pids; + /** + * act_info表ID + */ + private String actId; + /** * 单位ID */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandRecDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandRecDTO.java index b070d80073..30b24a8498 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandRecDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandRecDTO.java @@ -145,6 +145,11 @@ public class IcUserDemandRecDTO implements Serializable { */ private Boolean evaluateFlag; + /** + * 奖励积分 + */ + private Integer awardPoint; + /** * 删除标识:0.未删除 1.已删除 */ @@ -175,4 +180,6 @@ public class IcUserDemandRecDTO implements Serializable { */ private Date updatedTime; + private String serverId; + private String serviceType; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java index 0d0824fdfd..e73c466837 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java @@ -179,6 +179,26 @@ public class LatestActInfoDTO implements Serializable { */ private Boolean auditSwitch; + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + /** * 乐观锁 */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AutoEvaluateDemandFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AutoEvaluateDemandFormDTO.java new file mode 100644 index 0000000000..2df4640227 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AutoEvaluateDemandFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 自动评价参数 + */ +@Data +public class AutoEvaluateDemandFormDTO implements Serializable { + private String customerId; + private Integer exceedValue; + /** + * day + * minute + */ + private String type; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/EvaluateDemandFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/EvaluateDemandFormDTO.java index 1a0a5d28f2..119061edee 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/EvaluateDemandFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/EvaluateDemandFormDTO.java @@ -41,4 +41,7 @@ public class EvaluateDemandFormDTO implements Serializable { private String userId; @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) private String customerId; + // 政府端:gov、居民端:resi、运营端:oper + @NotBlank(message = "app不能为空", groups = AddUserInternalGroup.class) + private String app; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandRelFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandRelFormDTO.java new file mode 100644 index 0000000000..82182b2440 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandRelFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form.demand; + + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 当前用户与需求消息的关系 + */ +@Data +public class UserDemandRelFormDTO implements Serializable { + private static final long serialVersionUID = 948510931204329428L; + + public interface AddInternalGroup { + } + @NotBlank(message = "需求id不能为空",groups = AddInternalGroup.class) + private String demandRecId; + + @NotBlank(message = "userId不能为空",groups = AddInternalGroup.class) + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java index 632b567c11..4ba08831e9 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java @@ -21,4 +21,5 @@ public class ActIdFormDTO implements Serializable { */ @NotBlank(message = "活动id不能为空", groups = { ActIdFormDTO.AddUserInternalGroup.class }) private String actId; + private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java index 57166c22f1..78bd1a6cd5 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActPreviewFormDTO.java @@ -23,4 +23,5 @@ public class ActPreviewFormDTO implements Serializable { */ @NotBlank(message = "活动草稿id不能为空", groups = {UserInternalGroup.class}) private String actDraftId; + private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java index 1d128594ff..f00ebe792f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java @@ -161,4 +161,24 @@ public class DraftActInfoFormDTO implements Serializable { */ private String sponsorTel; + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType = "heart"; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java index fae068b230..ef1f3c3e19 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/PublishActInfoFormDTO.java @@ -25,6 +25,8 @@ public class PublishActInfoFormDTO implements Serializable { public interface AddUserInternalGroup { } + public interface AddPartyActivityGroup { + } public interface AddUserShowGroup extends CustomerClientShowGroup { } @@ -189,4 +191,27 @@ public class PublishActInfoFormDTO implements Serializable { */ @NotBlank(message = "联系电话不能为空", groups = {AddUserShowGroup.class}) private String sponsorTel; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType = "heart"; + + /** + * 联建单位 + */ + @NotBlank(message = "联建单位不能为空", groups = {AddPartyActivityGroup.class}) + private String unitId; + + /** + * 活动目标 + */ + @NotBlank(message = "活动目标不能为空", groups = {AddPartyActivityGroup.class}) + private String target; + + /** + * 服务事项 + */ + @NotBlank(message = "服务事项不能为空", groups = {AddPartyActivityGroup.class}) + private String serviceMatter; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java index dfd1aeed99..b093e9dcba 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java @@ -24,6 +24,8 @@ public class RePublishFormDTO implements Serializable { private static final long serialVersionUID = -959956652123514886L; public interface AddUserInternalGroup { } + public interface AddPartyActivityGroup { + } public interface AddUserShowGroup extends CustomerClientShowGroup { } @@ -195,4 +197,27 @@ public class RePublishFormDTO implements Serializable { */ @NotBlank(message = "联系电话不能为空", groups = {AddUserShowGroup.class}) private String sponsorTel; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType = "heart"; + + /** + * 联建单位 + */ + @NotBlank(message = "联建单位不能为空", groups = {AddPartyActivityGroup.class}) + private String unitId; + + /** + * 活动目标 + */ + @NotBlank(message = "活动目标不能为空", groups = {AddPartyActivityGroup.class}) + private String target; + + /** + * 服务事项 + */ + @NotBlank(message = "服务事项不能为空", groups = {AddPartyActivityGroup.class}) + private String serviceMatter; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDetailResDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDetailResDTO.java index 2a829c2bb4..cad6a2c4dd 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDetailResDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDetailResDTO.java @@ -56,6 +56,17 @@ public class DemandDetailResDTO implements Serializable { */ private String serviceAddress; + // 服务地点,工作端指派默认居民居住房屋地址,居民端地图选择 + private String serviceLocation; + // 门牌号详细地址 + private String locationDetail; + // 经度,需求人是ic的居民时,取所住楼栋的中心点位 + private String longitude; + // 纬度,需求人是ic的居民时,取所住楼栋的中心点位 + private String latitude; + + + /** * 实际服务开始时间 */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java index 6a6c5145f1..c235915430 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java @@ -131,4 +131,12 @@ public class DemandRecResultDTO implements Serializable { * 服务地点 */ private String serviceAddress; + // 服务地点,工作端指派默认居民居住房屋地址,居民端地图选择 + private String serviceLocation; + // 门牌号详细地址 + private String locationDetail; + // 经度,需求人是ic的居民时,取所住楼栋的中心点位 + private String longitude; + // 纬度,需求人是ic的居民时,取所住楼栋的中心点位 + private String latitude; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/FinishResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/FinishResultDTO.java index db0bff7f8d..8ea54cc72f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/FinishResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/FinishResultDTO.java @@ -6,12 +6,30 @@ import java.io.Serializable; /** * 完成需求时,是否需要计算 区域化党建单位的满意度 - * */ @Data public class FinishResultDTO implements Serializable { + /** + * 服务方id:可以值区域化党建单位id、也可以是社会组织、社区自组织id、爱心互助的志愿者用户id + */ private String serverId; + /** + * 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit; + */ private String serviceType; - private Boolean grantPoint; + /** + * 奖励积分:只有服务方是志愿者且积分大于0时,才发放积分 + */ private Integer awardPoint; + + /** + * 1:已评价;0:未评价;评价后ic_user_satisfaction表有记录 + */ + private Boolean evaluateFlag; + /** + * 完成了XXX的需求 + */ + private String remark; + private String firstCategoryName; + private String categoryCode; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/UserDemandRelResDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/UserDemandRelResDTO.java new file mode 100644 index 0000000000..9c7808dd81 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/UserDemandRelResDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result.demand; + + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; + +/** + * 当前用户与需求消息的关系 + */ +@AllArgsConstructor +@Data +public class UserDemandRelResDTO implements Serializable { + private static final long serialVersionUID = -9007483306143283653L; + // 需求发布人:publisher ;服务人:server + private String identity; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java index eb6f07693c..5e3df9d139 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java @@ -89,4 +89,25 @@ public class ActPreviewResultDTO implements Serializable { * 活动详情 */ private List actContent; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java index 3a19c7d4d4..3da7fade52 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java @@ -147,4 +147,25 @@ public class CanceledActDetailResultDTO implements Serializable { * 活动签到打卡半径(单位:米) */ private Integer signInRadius; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java index e96026f842..3e4bfbdc9a 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java @@ -136,4 +136,25 @@ public class FinishedActDetailResultDTO implements Serializable { * 活动签到打卡半径(单位:米) */ private Integer signInRadius; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java index cd2518f840..8dc4ad2fb2 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java @@ -131,4 +131,25 @@ public class InProgressActDetailResultDTO implements Serializable { * 活动签到打卡半径(单位:米) */ private Integer signInRadius; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java index 7906c364d5..c4a250df92 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/LatestDraftActInfoResultDTO.java @@ -166,4 +166,24 @@ public class LatestDraftActInfoResultDTO implements Serializable { * 活动内容- */ private List actContent; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType = "heart"; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java index 80f668afae..a360fd53c3 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java @@ -148,4 +148,25 @@ public class ReEditActInfoResultDTO implements Serializable { * 活动详情 */ private List actContent; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + private String unitName; + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + private String serviceMatterName; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index a21cccb8f3..d4f3c8c92d 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; @@ -67,4 +68,11 @@ public interface EpmetHeartOpenFeignClient { */ @PostMapping("/heart/resi/volunteer/page") Result> queryVolunteerPage(@RequestBody VolunteerCommonFormDTO input); + + /** + * 服务方填写实际服务时间,并点击确认后。 7天内需求人未作出评价,默认完成情况为已完成,五星好评,为服务方发放积分 + * @return + */ + @PostMapping("/heart/residemand/autoevaluate") + Result AutoEvaluateDemand(@RequestBody AutoEvaluateDemandFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index 27c2c9bdc8..eed34f0116 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.form.resi.VolunteerCommonFormDTO; @@ -60,4 +61,14 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli public Result> queryVolunteerPage(VolunteerCommonFormDTO input) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "queryVolunteerPage", input); } + + /** + * 服务方填写实际服务时间,并点击确认后。 7天内需求人未作出评价,默认完成情况为已完成,五星好评,为服务方发放积分 + * + * @return + */ + @Override + public Result AutoEvaluateDemand(AutoEvaluateDemandFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "autoEvaluate",formDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java index c5387c8ce4..9855cee625 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java @@ -161,4 +161,12 @@ public interface ActConstant { String HANDLED="handled"; String RESET="reset"; + /** + * 活动类型-爱心互助 + */ + String HEART = "heart"; + /** + * 活动类型-联建活动 + */ + String PARTY = "party"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java index 39692daa96..a18b304aeb 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java @@ -32,7 +32,7 @@ public interface UserDemandConstant { */ String STAFF="staff"; String RESI="resi"; - + String SYS="sys"; /** * 创建需求:create;撤销需求:cancel;指派:assign;接单:take_order;完成:finish;;评价:evaluate @@ -73,4 +73,13 @@ public interface UserDemandConstant { */ String DEMAND_EVALUATED=" 您收到来自%s的评价,请查看。"; String DEMAND_CANCELED=" %s的需求已取消,请查看。"; + + String DEMAND_PUBLISHER="publisher"; + String DEMAND_SERVER="server"; + + String GRANT_POINT_REMARK="完成了%s的需求:%s"; + + String DEFAULT_EVALUATE_REMARK="此用户没有填写内容,由系统默认评分"; + // 完成结果:已解决 resolved,未解决 unresolved + String RESOLVED="resolved"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java index 27f193b978..5aaf4863fb 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java @@ -17,7 +17,7 @@ package com.epmet.controller; -import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO; +import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; @@ -189,8 +189,8 @@ public class IcPartyUnitController { * @return */ @PostMapping("cal-partyunit-satisfation") - public Result calPartyUnitSatisfation(@RequestBody CalPartyUnitSatisfactionFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO,CalPartyUnitSatisfactionFormDTO.AddUserInternalGroup.class); + public Result calPartyUnitSatisfation(@RequestBody ServerSatisfactionCalFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ServerSatisfactionCalFormDTO.AddUserInternalGroup.class); icPartyUnitService.calPartyUnitSatisfation(formDTO); return new Result(); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java index 31c250bc83..4a71e4d5e3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java @@ -17,9 +17,12 @@ package com.epmet.controller; -import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO; +import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; @@ -41,6 +44,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; @@ -189,18 +193,42 @@ public class IcUserDemandRecController { formDTO.setUserType(UserDemandConstant.STAFF); ValidatorUtils.validateEntity(formDTO,FinishStaffFromDTO.IcShowGroup.class,FinishStaffFromDTO.AddUserInternalGroup.class); FinishResultDTO finishResultDTO=icUserDemandRecService.finish(formDTO); - //如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。 - if(UserDemandConstant.PARTY_UNIT.equals(finishResultDTO.getServiceType())){ - CalPartyUnitSatisfactionFormDTO mqMsg = new CalPartyUnitSatisfactionFormDTO(); - mqMsg.setCustomerId(formDTO.getCustomerId()); - mqMsg.setPartyUnitId(finishResultDTO.getServerId()); - SystemMsgFormDTO form = new SystemMsgFormDTO(); - form.setMessageType(SystemMessageType.CAL_PARTY_UNIT_SATISFACTION); - form.setContent(mqMsg); - epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); - } else if (UserDemandConstant.VOLUNTEER.equals(finishResultDTO.getServiceType()) && finishResultDTO.getAwardPoint() > NumConstant.ZERO) { - // todo - // 志愿者发放积分 + if(finishResultDTO.getEvaluateFlag()){ + //如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。 + if(UserDemandConstant.PARTY_UNIT.equals(finishResultDTO.getServiceType())){ + ServerSatisfactionCalFormDTO mqMsg = new ServerSatisfactionCalFormDTO(); + mqMsg.setCustomerId(formDTO.getCustomerId()); + mqMsg.setServerId(finishResultDTO.getServerId()); + mqMsg.setServiceType(finishResultDTO.getServiceType()); + SystemMsgFormDTO form = new SystemMsgFormDTO(); + form.setMessageType(SystemMessageType.CAL_PARTY_UNIT_SATISFACTION); + form.setContent(mqMsg); + epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); + } else if (UserDemandConstant.VOLUNTEER.equals(finishResultDTO.getServiceType()) && null != finishResultDTO.getAwardPoint() && finishResultDTO.getAwardPoint() > NumConstant.ZERO) { + // 志愿者发放积分 + List actPointEventMsgList = new ArrayList<>(); + BasePointEventMsg actPointEventMsg = new BasePointEventMsg(); + actPointEventMsg.setCustomerId(formDTO.getCustomerId()); + actPointEventMsg.setSourceType(MqConstant.SOURCE_TYPE_DEMAND); + actPointEventMsg.setSourceId(formDTO.getDemandRecId()); + actPointEventMsg.setUserId(finishResultDTO.getServerId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setIsCommon(false); + actPointEventMsg.setRemark(finishResultDTO.getRemark()); + actPointEventMsg.setEventTag(EventEnum.FINISH_USER_DEMAND.getEventTag()); + actPointEventMsg.setEventClass(EventEnum.FINISH_USER_DEMAND.getEventClass()); + actPointEventMsg.setEventName(finishResultDTO.getFirstCategoryName()); + actPointEventMsg.setObjectId(finishResultDTO.getCategoryCode()); + actPointEventMsg.setPoint(finishResultDTO.getAwardPoint()); + actPointEventMsgList.add(actPointEventMsg); + SystemMsgFormDTO sendMsgForm = new SystemMsgFormDTO(); + sendMsgForm.setContent(actPointEventMsgList); + sendMsgForm.setMessageType(SystemMessageType.FINISH_USER_DEMAND); + Result mqResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(sendMsgForm); + if (!mqResult.success()) { + log.error(String.format("demandRecId:%s,给志愿者发放积分失败", formDTO.getDemandRecId())); + } + } } return new Result(); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java index 39d205bdca..d0a3c1ab0c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiDemandController.java @@ -1,21 +1,27 @@ package com.epmet.controller; -import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO; +import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; 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.constant.SystemMessageType; import com.epmet.constant.UserDemandConstant; +import com.epmet.dto.form.AutoEvaluateDemandFormDTO; import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.demand.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.service.IcUserDemandRecService; +import com.epmet.service.IcUserDemandSatisfactionService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -24,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; import java.util.List; @@ -41,6 +48,8 @@ public class ResiDemandController { private IcUserDemandRecService icUserDemandRecService; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private IcUserDemandSatisfactionService demandSatisfactionService; /** * 居民端-需求大厅(未处理、处理中、已完成) @@ -98,7 +107,11 @@ public class ResiDemandController { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); formDTO.setType(UserDemandConstant.FINISHED); - formDTO.setUserType(UserDemandConstant.RESI); + if (AppClientConstant.APP_GOV.equals(tokenDto.getApp())) { + formDTO.setUserType(UserDemandConstant.STAFF); + } else if (AppClientConstant.APP_RESI.equals(tokenDto.getApp())) { + formDTO.setUserType(UserDemandConstant.RESI); + } ValidatorUtils.validateEntity(formDTO, FinishStaffFromDTO.ResiShowGroup.class, FinishStaffFromDTO.AddUserInternalGroup.class); icUserDemandRecService.finish(formDTO); return new Result(); @@ -117,20 +130,45 @@ public class ResiDemandController { public Result evaluate(@LoginUser TokenDto tokenDto, @RequestBody EvaluateDemandFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setApp(tokenDto.getApp()); ValidatorUtils.validateEntity(formDTO, EvaluateDemandFormDTO.ShowGroup.class, EvaluateDemandFormDTO.AddUserInternalGroup.class); FinishResultDTO finishResultDTO = icUserDemandRecService.evaluate(formDTO); - //如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。 - if (UserDemandConstant.PARTY_UNIT.equals(finishResultDTO.getServiceType())) { - CalPartyUnitSatisfactionFormDTO mqMsg = new CalPartyUnitSatisfactionFormDTO(); - mqMsg.setCustomerId(formDTO.getCustomerId()); - mqMsg.setPartyUnitId(finishResultDTO.getServerId()); - SystemMsgFormDTO form = new SystemMsgFormDTO(); - form.setMessageType(SystemMessageType.CAL_PARTY_UNIT_SATISFACTION); - form.setContent(mqMsg); - epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); - } else if (UserDemandConstant.VOLUNTEER.equals(finishResultDTO.getServiceType()) && finishResultDTO.getAwardPoint() > NumConstant.ZERO) { - // todo - // 志愿者发放积分 + if(finishResultDTO.getEvaluateFlag()){ + //如果服务方是区域化党建单位,需要实时去计算他的群众满意度=服务过的需求的评价分数相加➗ 需求的总个数。 + if (UserDemandConstant.PARTY_UNIT.equals(finishResultDTO.getServiceType())) { + ServerSatisfactionCalFormDTO mqMsg = new ServerSatisfactionCalFormDTO(); + mqMsg.setCustomerId(formDTO.getCustomerId()); + mqMsg.setServerId(finishResultDTO.getServerId()); + mqMsg.setServiceType(finishResultDTO.getServiceType()); + SystemMsgFormDTO form = new SystemMsgFormDTO(); + form.setMessageType(SystemMessageType.CAL_PARTY_UNIT_SATISFACTION); + form.setContent(mqMsg); + epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); + } else if (UserDemandConstant.VOLUNTEER.equals(finishResultDTO.getServiceType()) && null != finishResultDTO.getAwardPoint() && finishResultDTO.getAwardPoint() > NumConstant.ZERO) { + // 志愿者发放积分 + List actPointEventMsgList = new ArrayList<>(); + BasePointEventMsg actPointEventMsg = new BasePointEventMsg(); + actPointEventMsg.setCustomerId(formDTO.getCustomerId()); + actPointEventMsg.setSourceType(MqConstant.SOURCE_TYPE_DEMAND); + actPointEventMsg.setSourceId(formDTO.getDemandRecId()); + actPointEventMsg.setUserId(finishResultDTO.getServerId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setIsCommon(false); + actPointEventMsg.setRemark(finishResultDTO.getRemark()); + actPointEventMsg.setEventTag(EventEnum.FINISH_USER_DEMAND.getEventTag()); + actPointEventMsg.setEventClass(EventEnum.FINISH_USER_DEMAND.getEventClass()); + actPointEventMsg.setEventName(finishResultDTO.getFirstCategoryName()); + actPointEventMsg.setObjectId(finishResultDTO.getCategoryCode()); + actPointEventMsg.setPoint(finishResultDTO.getAwardPoint()); + actPointEventMsgList.add(actPointEventMsg); + SystemMsgFormDTO sendMsgForm = new SystemMsgFormDTO(); + sendMsgForm.setContent(actPointEventMsgList); + sendMsgForm.setMessageType(SystemMessageType.FINISH_USER_DEMAND); + Result mqResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(sendMsgForm); + if (!mqResult.success()) { + log.error(String.format("需求评价完成:demandRecId:%s,给志愿者发放积分失败", formDTO.getDemandRecId())); + } + } } return new Result(); } @@ -161,7 +199,7 @@ public class ResiDemandController { * @return */ @PostMapping("mydemand") - public Result> queryMyDemand(@LoginUser TokenDto tokenDto, @RequestBody ResiClientMyDemandFormDTO formDTO){ + public Result> queryMyDemand(@LoginUser TokenDto tokenDto,@RequestBody ResiClientMyDemandFormDTO formDTO){ formDTO.setUserId(tokenDto.getUserId()); formDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(formDTO,PageFormDTO.AddUserInternalGroup.class,ResiClientMyDemandFormDTO.AddUserInternalGroup.class); @@ -201,4 +239,29 @@ public class ResiDemandController { return new Result().ok(icUserDemandRecService.saveOrUpdateDemand(formDTO)); } + /** + * 当前用户与需求消息的关系 + * 需求发布人:publisher ;服务人:server + * + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("user-demand-rel") + public Result queryUserDemandRel(@LoginUser TokenDto tokenDto, @RequestBody UserDemandRelFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, UserDemandRelFormDTO.AddInternalGroup.class); + return new Result().ok(icUserDemandRecService.queryUserDemandRel(formDTO)); + } + + /** + * 服务方填写实际服务时间,并点击确认后。 7天内需求人未作出评价,默认完成情况为已完成,五星好评,为服务方发放积分 + * + * @return + */ + @PostMapping("autoevaluate") + public Result autoEvaluate(@RequestBody AutoEvaluateDemandFormDTO formDTO){ + demandSatisfactionService.evaluateDemandAuto(formDTO); + return new Result(); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index fb0a64e4dc..1383924f57 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -1,7 +1,10 @@ package com.epmet.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.constant.ActConstant; import com.epmet.dto.form.work.*; import com.epmet.dto.result.work.*; import com.epmet.service.WorkActService; @@ -69,6 +72,23 @@ public class WorkActController { return new Result().ok(workActService.publishAct(formDTO)); } + @PostMapping("publishV2") + public Result publishActV2(@RequestBody PublishActInfoFormDTO formDTO) { + if (ActConstant.HEART.equals(formDTO.getActType())) { + ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); + } else { + ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, + PublishActInfoFormDTO.AddUserInternalGroup.class, PublishActInfoFormDTO.AddPartyActivityGroup.class); + } + for (PublishActContentFormDTO actContentFormDTO : formDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + return new Result().ok(workActService.publishActV2(formDTO)); + } + /** * @return com.epmet.commons.tools.utils.Result * @param formDTO @@ -130,9 +150,9 @@ public class WorkActController { * @Date 2020/7/26 18:00 **/ @PostMapping("canceleddetail") - public Result canceledDetail(@RequestBody ActIdFormDTO actIdFormDTO) { + public Result canceledDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO actIdFormDTO) { ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); - return new Result().ok(workActService.canceledDetail(actIdFormDTO.getActId())); + return new Result().ok(workActService.canceledDetail(tokenDto.getCustomerId(), actIdFormDTO.getActId())); } /** @@ -158,8 +178,9 @@ public class WorkActController { * @Date 2020/7/26 21:01 **/ @PostMapping("finisheddetail") - public Result finishedDeatil(@RequestBody ActIdFormDTO formDTO) { + public Result finishedDeatil(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(workActService.finishedDeatil(formDTO)); } @@ -171,9 +192,10 @@ public class WorkActController { * @Date 2020/7/26 21:33 **/ @PostMapping("inprogressdetail") - public Result inProgressDetail(@RequestBody ActIdFormDTO formDTO) { + public Result inProgressDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); - return new Result().ok(workActService.inProgressDetail(formDTO.getActId())); + + return new Result().ok(workActService.inProgressDetail(tokenDto.getCustomerId(), formDTO.getActId())); } /** @@ -229,9 +251,9 @@ public class WorkActController { * @Date 2020/7/27 13:36 **/ @PostMapping("getactinfo") - public Result getActInfo(@RequestBody ActIdFormDTO formDTO){ + public Result getActInfo(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); - return new Result().ok(workActService.getActInfo(formDTO.getActId())); + return new Result().ok(workActService.getActInfo(tokenDto.getCustomerId(), formDTO.getActId())); } /** @@ -253,5 +275,21 @@ public class WorkActController { return new Result().ok(workActService.rePublish(rePublishFormDTO)); } + @PostMapping("republishV2") + public Result rePublishV2(@RequestBody RePublishFormDTO rePublishFormDTO) { + if (ActConstant.HEART.equals(rePublishFormDTO.getActType())) { + ValidatorUtils.validateEntity(rePublishFormDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); + } else { + ValidatorUtils.validateEntity(rePublishFormDTO, RePublishFormDTO.AddUserShowGroup.class, RePublishFormDTO.AddUserInternalGroup.class); + } + for (PublishActContentFormDTO actContentFormDTO : rePublishFormDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + return new Result().ok(workActService.rePublishV2(rePublishFormDTO)); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java index e960a2f926..9d018d7d81 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java @@ -1,5 +1,7 @@ package com.epmet.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.dto.form.work.*; @@ -82,8 +84,9 @@ public class WorkActDraftController { * @Date 2020/7/21 17:24 **/ @PostMapping("preview") - public Result previewActDetail(@RequestBody ActPreviewFormDTO formDTO){ + public Result previewActDetail(@LoginUser TokenDto tokenDto, @RequestBody ActPreviewFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO,ActPreviewFormDTO.UserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); ActPreviewResultDTO resultDTO=workActDraftService.previewActDetail(formDTO); return new Result().ok(resultDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java index 2ba049bd30..27eaa8c689 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.form.demand.IcResiUserDemandFromDTO; import com.epmet.dto.form.demand.PageListAnalysisFormDTO; import com.epmet.dto.form.demand.UserDemandPageFormDTO; @@ -85,7 +86,9 @@ public interface IcUserDemandRecDao extends BaseDao { @Param("startDateId") String startDateId, @Param("endDateId") String endDateId); - List selectGroupByPartyUnit(@Param("customerId") String customerId, @Param("partyUnitId") String partyUnitId); + List selectGroupByServer(@Param("customerId") String customerId, + @Param("serverId") String serverId, + @Param("serviceType") String serviceType); /** * 居民端-需求大厅(未处理、处理中、已完成) @@ -109,4 +112,10 @@ public interface IcUserDemandRecDao extends BaseDao { List queryMyDemandForResiClient(@Param("gridId") String gridId, @Param("type")String type, @Param("demandUserId")String demandUserId); + + List selectNoEvaluate(@Param("customerId")String customerId, + @Param("exceedValue")Integer exceedValue, + @Param("type")String type); + + int evaluate(@Param("demandRecId")String demandRecId, @Param("finishResult")String finishResult); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java index e227b29ed5..191e639b24 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActInfoEntity.java @@ -18,7 +18,6 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -217,4 +216,24 @@ public class ActInfoEntity extends BaseEpmetEntity { */ private Boolean summaryFlag; + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java index 529bb4f34a..4919fdd133 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyActivityEntity.java @@ -53,6 +53,11 @@ public class IcPartyActivityEntity extends BaseEpmetEntity { */ private String pids; + /** + * act_info表ID + */ + private String actId; + /** * 单位ID */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandSatisfactionEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandSatisfactionEntity.java index ab17c5d738..819fb8239d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandSatisfactionEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandSatisfactionEntity.java @@ -50,7 +50,7 @@ public class IcUserDemandSatisfactionEntity extends BaseEpmetEntity { private String demandRecId; /** - * 当前操作用户属于哪个端?工作端:staff;居民端:resi + * 当前操作用户属于哪个端?工作端:staff;居民端:resi;系统操作:sys */ private String userType; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java index 706cf0668b..491ed210f8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java @@ -182,4 +182,24 @@ public class LatestActInfoEntity extends BaseEpmetEntity { * 数据库新增ACT_INFO_ID字段,act_info.id */ private String actInfoId; + + /** + * 活动类型爱心活动heart 联建活动party + */ + private String actType; + + /** + * 联建单位 + */ + private String unitId; + + /** + * 活动目标 + */ + private String target; + + /** + * 服务事项 + */ + private String serviceMatter; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index 3f599eefc0..2278c905e7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -4,7 +4,7 @@ import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; import com.epmet.commons.rocketmq.register.MQAbstractRegister; import com.epmet.commons.rocketmq.register.MQConsumerProperties; -import com.epmet.mq.listener.PartyUnitSatisfactionCalEventListener; +import com.epmet.mq.listener.ServerSatisfactionCalEventListener; import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; import org.springframework.stereotype.Component; @@ -20,11 +20,11 @@ public class RocketMQConsumerRegister extends MQAbstractRegister { public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { // 客户初始化监听器注册 register(consumerProperties, - ConsomerGroupConstants.CAL_PARTY_UNIT_SATISFACTION, + ConsomerGroupConstants.USER_DEMAND_FINISH_GROUP, MessageModel.CLUSTERING, - TopicConstants.CAL_PARTY_UNIT_SATISFACTION, + TopicConstants.USER_DEMAND, "*", - new PartyUnitSatisfactionCalEventListener()); + new ServerSatisfactionCalEventListener()); // ...其他监听器类似 } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/ServerSatisfactionCalEventListener.java similarity index 77% rename from epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java rename to epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/ServerSatisfactionCalEventListener.java index b7c3abc938..606a3801c3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/ServerSatisfactionCalEventListener.java @@ -2,13 +2,14 @@ package com.epmet.mq.listener; import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.constants.MQUserPropertys; -import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO; +import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.constant.SystemMessageType; import com.epmet.service.IcPartyUnitService; import org.apache.commons.lang.StringUtils; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; @@ -22,13 +23,7 @@ import org.slf4j.LoggerFactory; import java.util.List; import java.util.concurrent.TimeUnit; -/** - * @Description 计算区域化党建单位,群众满意度=分数相加➗ 需求的总个数。 - * @author wxz - * @date 2021.10.13 15:21:48 -*/ -public class PartyUnitSatisfactionCalEventListener implements MessageListenerConcurrently { - +public class ServerSatisfactionCalEventListener implements MessageListenerConcurrently { private Logger logger = LoggerFactory.getLogger(getClass()); private RedisUtils redisUtils; @@ -57,23 +52,28 @@ public class PartyUnitSatisfactionCalEventListener implements MessageListenerCon String tags = messageExt.getTags(); String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL); - logger.info("【计算区域化党建单位群众满意度事件监听器】-需求完成-收到消息内容:{},操作:{}", msg, tags); - CalPartyUnitSatisfactionFormDTO obj = JSON.parseObject(msg, CalPartyUnitSatisfactionFormDTO.class); + logger.info("【需求完成计算服务方群众满意度事件监听器】-需求完成-收到消息内容:{},操作:{}", msg, tags); + ServerSatisfactionCalFormDTO obj = JSON.parseObject(msg, ServerSatisfactionCalFormDTO.class); DistributedLock distributedLock = null; RLock lock = null; try { distributedLock = SpringContextUtils.getBean(DistributedLock.class); - lock = distributedLock.getLock(String.format("lock:ic_warn_stats:%s", obj.getCustomerId()), + lock = distributedLock.getLock(String.format("lock:user_demand:%s", obj.getCustomerId()), 30L, 30L, TimeUnit.SECONDS); - //待执行方法 - SpringContextUtils.getBean(IcPartyUnitService.class).calPartyUnitSatisfation(obj); + switch (tags) { + case SystemMessageType.CAL_PARTY_UNIT_SATISFACTION: + //区域化党建单位-计算群众满意度 + SpringContextUtils.getBean(IcPartyUnitService.class).calPartyUnitSatisfation(obj); + break; + //后面社会组织、社区自组织可能都会计算....先预备着 + } } catch (RenException e) { // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 - logger.error("【计算区域化党建单位群众满意度事件监听器】-MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + logger.error("【需求完成计算服务方群众满意度事件监听器】-MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e))); } catch (Exception e) { // 不是我们自己抛出的异常,可以让MQ重试 - logger.error("【计算区域化党建单位群众满意度监听器】-MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + logger.error("【需求完成计算服务方群众满意度监听器】-MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e))); throw e; } finally { distributedLock.unLock(lock); @@ -83,7 +83,7 @@ public class PartyUnitSatisfactionCalEventListener implements MessageListenerCon try { removePendingMqMsgCache(pendingMsgLabel); } catch (Exception e) { - logger.error("【计算区域化党建单位群众满意度监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); + logger.error("【需求完成计算服务方群众满意度监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); } } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java index c3931bbd0b..c36db9b2d6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyActivityService.java @@ -117,4 +117,22 @@ public interface IcPartyActivityService extends BaseService getActivityList(TokenDto tokenDto, PartyActivityFormDTO formDTO); + + /** + * 根据爱心活动ID获取联建活动 + * @Param actId + * @Return {@link IcPartyActivityDTO} + * @Author zhaoqifeng + * @Date 2021/12/23 16:13 + */ + IcPartyActivityDTO getActivityByActId(String actId); + + /** + * 根据爱心活动ID删除联建活动 + * @Param actId + * @Return {@link IcPartyActivityDTO} + * @Author zhaoqifeng + * @Date 2021/12/23 16:13 + */ + void deleteByActId(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java index 16a96f8194..5108fb6dbc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java @@ -18,8 +18,8 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; -import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -147,7 +147,7 @@ public interface IcPartyUnitService extends BaseService { * 计算区域化党建单位的群众满意度 * @param formDTO */ - void calPartyUnitSatisfation(CalPartyUnitSatisfactionFormDTO formDTO); + void calPartyUnitSatisfation(ServerSatisfactionCalFormDTO formDTO); List queryListById(List partyUnitIds); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java index b2801abd64..da3fd68cdf 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java @@ -141,10 +141,11 @@ public interface IcUserDemandRecService extends BaseService groupByPartyUnit(String customerId, String partyUnitId); + List groupByServer(String customerId, String serverId,String serviceType); /** * 居民端-需求大厅(未处理、处理中、已完成) @@ -204,4 +205,13 @@ public interface IcUserDemandRecService extends BaseService { + /** + * + * @param formDTO + * @return + */ + void evaluateDemandAuto(AutoEvaluateDemandFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index bc72cc7d67..d470f3571f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -38,7 +38,7 @@ public interface WorkActService { * @Date 2020/7/21 18:33 **/ PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO); - + PublishActResultDTO publishActV2(PublishActInfoFormDTO formDTO); /** * @return com.epmet.dto.result.work.InProgressActResultDTO * @param formDTO @@ -82,7 +82,7 @@ public interface WorkActService { * @description 已取消-活动详情 * @Date 2020/7/26 18:00 **/ - CanceledActDetailResultDTO canceledDetail(String actId); + CanceledActDetailResultDTO canceledDetail(String customerId, String actId); /** * @return void @@ -109,7 +109,7 @@ public interface WorkActService { * @description 进行中-活动详情 * @Date 2020/7/26 21:34 **/ - InProgressActDetailResultDTO inProgressDetail(String actId); + InProgressActDetailResultDTO inProgressDetail(String customerId, String actId); /** * @return void @@ -136,7 +136,7 @@ public interface WorkActService { * @description 重新编辑-获取活动详情 * @Date 2020/7/27 13:36 **/ - ReEditActInfoResultDTO getActInfo(String actId); + ReEditActInfoResultDTO getActInfo(String customerId, String actId); /** * @return com.epmet.dto.result.work.PublishActResultDTO @@ -146,6 +146,6 @@ public interface WorkActService { * @Date 2020/7/27 13:55 **/ PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO); - + PublishActResultDTO rePublishV2(RePublishFormDTO rePublishFormDTO); void testGrantPoint(TestGrantFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index c745c98192..3c7d9a6647 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -36,16 +36,19 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.commons.tools.utils.SendMqMsgUtils; +import com.epmet.constant.SystemMessageType; import com.epmet.dao.ActLivePicDao; import com.epmet.dao.ActLiveRecDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.ActLivePicDTO; import com.epmet.dto.ActLiveRecDTO; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLivePicEntity; import com.epmet.entity.ActLiveRecEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.ActLiveRecRedis; import com.epmet.service.ActInfoService; @@ -80,6 +83,9 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl actPointEventMsgList=new ArrayList<>(); BasePointEventMsg actPointEventMsg=new BasePointEventMsg(); actPointEventMsg.setCustomerId(formDTO.getCustomerId()); @@ -242,8 +248,14 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl queryListById(List communityOrgIds) { - return baseDao.selectBatchIds(communityOrgIds); + if(CollectionUtils.isNotEmpty(communityOrgIds)){ + return baseDao.selectBatchIds(communityOrgIds); + } + return Collections.EMPTY_LIST; } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java index 4057d1ba41..045b9564cc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java @@ -382,6 +382,40 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl(dtoList, pageInfo.getTotal()); } + /** + * 根据爱心活动ID获取联建活动 + * + * @param actId + * @Param actId + * @Return {@link IcPartyActivityDTO} + * @Author zhaoqifeng + * @Date 2021/12/23 16:13 + */ + @Override + public IcPartyActivityDTO getActivityByActId(String actId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcPartyActivityEntity::getActId, actId); + IcPartyActivityEntity entity = baseDao.selectOne(wrapper); + return ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class); + } + + /** + * 根据爱心活动ID删除联建活动 + * + * @param actId + * @Param actId + * @Return {@link IcPartyActivityDTO} + * @Author zhaoqifeng + * @Date 2021/12/23 16:13 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByActId(String actId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcPartyActivityEntity::getActId, actId); + baseDao.delete(wrapper); + } + /** * 近30天开始时间和结束时间 (精确到秒) * @Param formDTO diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java index 7f18773e78..43c0cd8bb0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java @@ -22,7 +22,7 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO; +import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; @@ -440,10 +440,11 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl list = icUserDemandRecService.groupByPartyUnit(formDTO.getCustomerId(), formDTO.getPartyUnitId()); + List list = icUserDemandRecService.groupByServer(formDTO.getCustomerId(), formDTO.getServerId(),formDTO.getServiceType()); for (ServiceStatDTO serviceStatDTO : list) { if (0 != serviceStatDTO.getDemandCount()) { BigDecimal result = serviceStatDTO.getTotalScore().divide(new BigDecimal(serviceStatDTO.getDemandCount()), 4, BigDecimal.ROUND_HALF_UP); @@ -454,7 +455,10 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl queryListById(List partyUnitIds) { - return baseDao.selectBatchIds(partyUnitIds); + if(CollectionUtils.isNotEmpty(partyUnitIds)){ + return baseDao.selectBatchIds(partyUnitIds); + } + return Collections.EMPTY_LIST; } private String getServiceMatter(Map map, String matter) { diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java index 5827a15107..52193bb4df 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java @@ -270,7 +270,10 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl queryListById(List socialOrgIds) { - return baseDao.selectBatchIds(socialOrgIds); + if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(socialOrgIds)){ + return baseDao.selectBatchIds(socialOrgIds); + } + return Collections.EMPTY_LIST; } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java index 3b46ccb3a8..45a1e6f1f8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java @@ -27,10 +27,15 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +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.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.UserDemandConstant; import com.epmet.constant.UserMessageTypeConstant; @@ -56,6 +61,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; 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; @@ -96,6 +102,15 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl userInfoMap=new HashMap<>(); - Set userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); + Set userIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); if(CollectionUtils.isNotEmpty(userIdList)){ Result> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ @@ -358,6 +373,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl 100 ? entity.getContent().substring(0, 99) : entity.getContent(); + finishResultDTO.setRemark(String.format(UserDemandConstant.GRANT_POINT_REMARK,entity.getDemandUserName(),content)); + } baseDao.updateById(entity); - FinishResultDTO finishResultDTO=new FinishResultDTO(); - finishResultDTO.setServerId(serviceEntity.getServerId()); - finishResultDTO.setServiceType(serviceEntity.getServiceType()); - finishResultDTO.setAwardPoint(entity.getAwardPoint()); // 5、如果是居民端用户提出的需求,发消息:您提出的需求已完成,请进行服务评价。 sendDemandUserFinished(entity); return finishResultDTO; @@ -457,14 +487,14 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl userInfoMap=new HashMap<>(); - Set userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); + Set userIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); if(CollectionUtils.isNotEmpty(userIdList)){ Result> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ @@ -896,15 +926,16 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl groupByPartyUnit(String customerId, String partyUnitId) { - if(StringUtils.isBlank(customerId)&&StringUtils.isBlank(partyUnitId)){ + public List groupByServer(String customerId, String serverId,String serviceType) { + if(StringUtils.isBlank(customerId)&&StringUtils.isBlank(serverId)){ return new ArrayList<>(); } - return baseDao.selectGroupByPartyUnit(customerId,partyUnitId); + return baseDao.selectGroupByServer(customerId,serverId,serviceType); } @@ -1028,19 +1059,27 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl 100 ? entity.getContent().substring(0, 99) : entity.getContent(); + finishResultDTO.setRemark(String.format(UserDemandConstant.GRANT_POINT_REMARK,entity.getDemandUserName(),content)); + finishResultDTO.setCategoryCode(entity.getCategoryCode()); + //5、我的需求-评价:如果服务方是志愿者,通知它: 您收到来自XXX(需求人姓名)的评价,请查看。 sendVolunnterEvaluated(entity); return finishResultDTO; } @@ -1073,7 +1121,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImplo.toString()).collect(Collectors.toList()); + return baseDao.selectObjs(queryWrapper).stream().map(o->o.toString()).collect(Collectors.toList()); } /** @@ -1091,48 +1139,50 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl list=result.getList(); if (CollectionUtils.isNotEmpty(list)) { //1、服务方(社会组织、社区自组织、区域化党建单位)单位名称,负责人姓名,负责人手机号 - List partyUnitIds = result.getList().stream().filter(l -> l.getServiceType().equals(UserDemandConstant.PARTY_UNIT)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); + List partyUnitIds = result.getList().stream().filter(l -> null != l.getServiceType() && l.getServiceType().equals(UserDemandConstant.PARTY_UNIT)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); Map partyUnitMap =getPartyUnitMap(partyUnitIds); - List socialOrgIds = result.getList().stream().filter(l -> l.getServiceType().equals(UserDemandConstant.SOCIAL_ORG)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); + List socialOrgIds = result.getList().stream().filter(l -> null != l.getServiceType() && l.getServiceType().equals(UserDemandConstant.SOCIAL_ORG)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); Map socialOrgMap=getSocialOrgMap(socialOrgIds); - List communityOrgIds = result.getList().stream().filter(l -> l.getServiceType().equals(UserDemandConstant.COMMUNITY_ORG)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); + List communityOrgIds = result.getList().stream().filter(l -> null != l.getServiceType() && l.getServiceType().equals(UserDemandConstant.COMMUNITY_ORG)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toList()); Map communityOrgMap=getCommunityOrgMap(communityOrgIds); //2、志愿者姓名、手机号 - Set userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toSet()); + Set userIdList=list.stream().filter(item->null!=item.getServiceType()&&item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(ResiClientMyDemandResDTO::getServerId).collect(Collectors.toSet()); Map userInfoMap=getVolunteerMap(userIdList); for (ResiClientMyDemandResDTO resDto : list) { //3、查询分类名称 IcResiDemandDictEntity demandDict = demandDictService.getByCode(formDTO.getCustomerId(), resDto.getCategoryCode()); resDto.setCategoryName(null != demandDict ? demandDict.getCategoryName() : StrConstant.EPMETY_STR); - switch (resDto.getServiceType()) - { - case UserDemandConstant.PARTY_UNIT: - resDto.setServiceUnitName(partyUnitMap.get(resDto.getServerId()).getUnitName()); - resDto.setServiceUserName(partyUnitMap.get(resDto.getServerId()).getContact()); - resDto.setServiceUserMobile(partyUnitMap.get(resDto.getServerId()).getContactMobile()); - break; - case UserDemandConstant.SOCIAL_ORG: - resDto.setServiceUnitName(socialOrgMap.get(resDto.getServerId()).getSocietyName()); - resDto.setServiceUserName(socialOrgMap.get(resDto.getServerId()).getPersonInCharge()); - resDto.setServiceUserMobile(socialOrgMap.get(resDto.getServerId()).getMobile()); - break; - case UserDemandConstant.COMMUNITY_ORG: - resDto.setServiceUnitName(communityOrgMap.get(resDto.getServerId()).getOrganizationName()); - resDto.setServiceUserName(communityOrgMap.get(resDto.getServerId()).getPrincipalName()); - resDto.setServiceUserMobile(communityOrgMap.get(resDto.getServerId()).getPrincipalPhone()); - break; - case UserDemandConstant.VOLUNTEER: - resDto.setServiceUnitName(StrConstant.EPMETY_STR); - resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName()); - resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile()); - break; - default: - log.warn("serviceType 错误"); - break; + if(StringUtils.isNotBlank(resDto.getServiceType())){ + switch (resDto.getServiceType()) + { + case UserDemandConstant.PARTY_UNIT: + resDto.setServiceUnitName(partyUnitMap.get(resDto.getServerId()).getUnitName()); + resDto.setServiceUserName(partyUnitMap.get(resDto.getServerId()).getContact()); + resDto.setServiceUserMobile(partyUnitMap.get(resDto.getServerId()).getContactMobile()); + break; + case UserDemandConstant.SOCIAL_ORG: + resDto.setServiceUnitName(socialOrgMap.get(resDto.getServerId()).getSocietyName()); + resDto.setServiceUserName(socialOrgMap.get(resDto.getServerId()).getPersonInCharge()); + resDto.setServiceUserMobile(socialOrgMap.get(resDto.getServerId()).getMobile()); + break; + case UserDemandConstant.COMMUNITY_ORG: + resDto.setServiceUnitName(communityOrgMap.get(resDto.getServerId()).getOrganizationName()); + resDto.setServiceUserName(communityOrgMap.get(resDto.getServerId()).getPrincipalName()); + resDto.setServiceUserMobile(communityOrgMap.get(resDto.getServerId()).getPrincipalPhone()); + break; + case UserDemandConstant.VOLUNTEER: + resDto.setServiceUnitName(StrConstant.EPMETY_STR); + resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName()); + resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile()); + break; + default: + log.warn("serviceType 错误"); + break; + } } } } @@ -1208,34 +1258,36 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl partyUnitMap = getPartyUnitMap(Arrays.asList(resDto.getServerId())); - resDto.setServiceUnitName(partyUnitMap.get(resDto.getServerId()).getUnitName()); - resDto.setServiceUserName(partyUnitMap.get(resDto.getServerId()).getContact()); - resDto.setServiceUserMobile(partyUnitMap.get(resDto.getServerId()).getContactMobile()); - break; - case UserDemandConstant.SOCIAL_ORG: - Map socialOrgMap = getSocialOrgMap(Arrays.asList(resDto.getServerId())); - resDto.setServiceUnitName(socialOrgMap.get(resDto.getServerId()).getSocietyName()); - resDto.setServiceUserName(socialOrgMap.get(resDto.getServerId()).getPersonInCharge()); - resDto.setServiceUserMobile(socialOrgMap.get(resDto.getServerId()).getMobile()); - break; - case UserDemandConstant.COMMUNITY_ORG: - Map communityOrgMap = getCommunityOrgMap(Arrays.asList(resDto.getServerId())); - resDto.setServiceUnitName(communityOrgMap.get(resDto.getServerId()).getOrganizationName()); - resDto.setServiceUserName(communityOrgMap.get(resDto.getServerId()).getPrincipalName()); - resDto.setServiceUserMobile(communityOrgMap.get(resDto.getServerId()).getPrincipalPhone()); - break; - case UserDemandConstant.VOLUNTEER: - Map userInfoMap = getVolunteerMap(new HashSet<>(Arrays.asList(resDto.getServerId()))); - resDto.setServiceUnitName(StrConstant.EPMETY_STR); - resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName()); - resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile()); - break; - default: - log.warn("serviceType 错误"); - break; + if(StringUtils.isNotBlank(resDto.getServiceType())){ + switch (resDto.getServiceType()) { + case UserDemandConstant.PARTY_UNIT: + Map partyUnitMap = getPartyUnitMap(Arrays.asList(resDto.getServerId())); + resDto.setServiceUnitName(partyUnitMap.get(resDto.getServerId()).getUnitName()); + resDto.setServiceUserName(partyUnitMap.get(resDto.getServerId()).getContact()); + resDto.setServiceUserMobile(partyUnitMap.get(resDto.getServerId()).getContactMobile()); + break; + case UserDemandConstant.SOCIAL_ORG: + Map socialOrgMap = getSocialOrgMap(Arrays.asList(resDto.getServerId())); + resDto.setServiceUnitName(socialOrgMap.get(resDto.getServerId()).getSocietyName()); + resDto.setServiceUserName(socialOrgMap.get(resDto.getServerId()).getPersonInCharge()); + resDto.setServiceUserMobile(socialOrgMap.get(resDto.getServerId()).getMobile()); + break; + case UserDemandConstant.COMMUNITY_ORG: + Map communityOrgMap = getCommunityOrgMap(Arrays.asList(resDto.getServerId())); + resDto.setServiceUnitName(communityOrgMap.get(resDto.getServerId()).getOrganizationName()); + resDto.setServiceUserName(communityOrgMap.get(resDto.getServerId()).getPrincipalName()); + resDto.setServiceUserMobile(communityOrgMap.get(resDto.getServerId()).getPrincipalPhone()); + break; + case UserDemandConstant.VOLUNTEER: + Map userInfoMap = getVolunteerMap(new HashSet<>(Arrays.asList(resDto.getServerId()))); + resDto.setServiceUnitName(StrConstant.EPMETY_STR); + resDto.setServiceUserName(userInfoMap.get(resDto.getServerId()).getRealName()); + resDto.setServiceUserMobile(userInfoMap.get(resDto.getServerId()).getMobile()); + break; + default: + log.warn("serviceType 错误"); + break; + } } return resDto; } @@ -1250,6 +1302,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode(), EpmetErrorCode.TEXT_SCAN_FAILED.getMsg()); + } + } + } /** * 我的需求被抢单->您提出的需求将由青岛亿联科技有限公司为您解决,请查看。 @@ -1359,6 +1432,14 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl communityOrgMap = getCommunityOrgMap(Arrays.asList(serverId)); serviceName = MapUtils.isNotEmpty(communityOrgMap) ? communityOrgMap.get(serverId).getOrganizationName() : StrConstant.EPMETY_STR; + }else if(UserDemandConstant.VOLUNTEER.equals(serviceType)){ + //如果指派给了志愿者-》您提出的需求将由XX为您解决,请查看 + UserResiInfoListFormDTO userResiInfoListFormDTO=new UserResiInfoListFormDTO(); + userResiInfoListFormDTO.setUserIdList(Arrays.asList(serverId)); + Result> userRes = epmetUserOpenFeignClient.getUserResiInfoList(userResiInfoListFormDTO); + if(userRes.success()){ + serviceName=userRes.getData().get(NumConstant.ZERO).getRealName(); + } } if (StringUtils.isNotBlank(serviceName)) { UserMessageFormDTO userMessage = new UserMessageFormDTO(); @@ -1443,5 +1524,29 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl implements IcUserDemandSatisfactionService { + + @Autowired + private IcUserDemandRecDao icUserDemandRecDao; + @Autowired + private IcUserDemandOperateLogDao operateLogDao; + @Autowired + private IcUserDemandServiceDao demandServiceDao; + @Autowired + private IcResiDemandDictService demandDictService; + @Autowired + private IcPartyUnitService icPartyUnitService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + + + /** + * + * @param formDTO + * @return + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void evaluateDemandAuto(AutoEvaluateDemandFormDTO formDTO) { + if (null == formDTO.getExceedValue()) { + formDTO.setExceedValue(NumConstant.SEVEN); + formDTO.setType("day"); + } + // 查询完成后,超过7天未评价的记录 + List list=icUserDemandRecDao.selectNoEvaluate(formDTO.getCustomerId(),formDTO.getExceedValue(),formDTO.getType()); + if(CollectionUtils.isEmpty(list)){ + return; + } + Date nowDate=new Date(); + for(IcUserDemandRecDTO demand:list){ + + //4、返回服务方,志愿者发放积分,区域化党建单位,计算群众满意度 + IcUserDemandServiceEntity serviceEntity = demandServiceDao.selectByRecId(demand.getId()); + if(null==serviceEntity){ + continue; + } + if(UserDemandConstant.PARTY_UNIT.equals(serviceEntity.getServiceType())){ + ServerSatisfactionCalFormDTO satisfactionCalFormDTO=new ServerSatisfactionCalFormDTO(); + satisfactionCalFormDTO.setCustomerId(demand.getCustomerId()); + satisfactionCalFormDTO.setServiceType(serviceEntity.getServiceType()); + satisfactionCalFormDTO.setServerId(serviceEntity.getServerId()); + icPartyUnitService.calPartyUnitSatisfation(satisfactionCalFormDTO); + } else if (UserDemandConstant.VOLUNTEER.equals(serviceEntity.getServiceType()) && null != demand.getAwardPoint() && demand.getAwardPoint() > NumConstant.ZERO) { + List actPointEventMsgList = new ArrayList<>(); + BasePointEventMsg actPointEventMsg = new BasePointEventMsg(); + actPointEventMsg.setCustomerId(demand.getCustomerId()); + actPointEventMsg.setSourceType(MqConstant.SOURCE_TYPE_DEMAND); + actPointEventMsg.setSourceId(demand.getId()); + actPointEventMsg.setUserId(serviceEntity.getServerId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setIsCommon(false); + String content = demand.getContent().length() > 100 ? demand.getContent().substring(0, 99) : demand.getContent(); + actPointEventMsg.setRemark(String.format(UserDemandConstant.GRANT_POINT_REMARK,demand.getDemandUserName(),content)); + actPointEventMsg.setEventTag(EventEnum.FINISH_USER_DEMAND.getEventTag()); + actPointEventMsg.setEventClass(EventEnum.FINISH_USER_DEMAND.getEventClass()); + if(StringUtils.isBlank(demand.getParentCode())||NumConstant.ZERO_STR.equals(demand.getParentCode())){ + actPointEventMsg.setEventName(demandDictService.getCategoryName(demand.getCustomerId(),demand.getCategoryCode())); + }else{ + actPointEventMsg.setEventName(demandDictService.getCategoryName(demand.getCustomerId(),demand.getParentCode())); + } + actPointEventMsg.setObjectId(demand.getCategoryCode()); + actPointEventMsg.setPoint(demand.getAwardPoint()); + actPointEventMsgList.add(actPointEventMsg); + SystemMsgFormDTO sendMsgForm = new SystemMsgFormDTO(); + sendMsgForm.setContent(actPointEventMsgList); + sendMsgForm.setMessageType(SystemMessageType.FINISH_USER_DEMAND); + Result mqResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(sendMsgForm); + if (!mqResult.success()) { + log.warn(String.format("需求自动评价志愿者发放积分失败:demandRecId:%s,消息体:%s", demand.getId(), JSON.toJSONString(sendMsgForm))); + continue; + } + } + + // 1、插入评价得分记录 + IcUserDemandSatisfactionEntity satisfactionEntity = new IcUserDemandSatisfactionEntity(); + satisfactionEntity.setCustomerId(demand.getCustomerId()); + satisfactionEntity.setDemandRecId(demand.getId()); + satisfactionEntity.setEvaluateTime(nowDate); + satisfactionEntity.setUserType(UserDemandConstant.SYS); + satisfactionEntity.setUserId(Constant.APP_USER_FLAG); + satisfactionEntity.setScore(new BigDecimal(NumConstant.FIVE_STR)); + satisfactionEntity.setRemark(UserDemandConstant.DEFAULT_EVALUATE_REMARK); + baseDao.insert(satisfactionEntity); + + // 2、插入评价操作日志 + IcUserDemandOperateLogEntity evaluateEntity = new IcUserDemandOperateLogEntity(); + evaluateEntity.setCustomerId(demand.getCustomerId()); + evaluateEntity.setDemandRecId(demand.getId()); + evaluateEntity.setUserType(UserDemandConstant.SYS); + evaluateEntity.setUserId(Constant.APP_USER_FLAG); + evaluateEntity.setActionCode(UserDemandConstant.EVALUATE); + evaluateEntity.setOperateTime(nowDate); + operateLogDao.insert(evaluateEntity); + + // 3、更新主表已评价标识,是否解决标识。 + icUserDemandRecDao.evaluate(demand.getId(),UserDemandConstant.RESOLVED); + } + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index e5f4edf8c1..44d33bedb0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -40,6 +40,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SendMqMsgUtils; import com.epmet.constant.SmsTemplateConstant; +import com.epmet.constant.SystemMessageType; import com.epmet.dao.VolunteerInfoDao; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerGridDTO; @@ -49,6 +50,7 @@ import com.epmet.dto.form.CommonCustomerFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; import com.epmet.dto.form.VolunteerRegResiFormDTO; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.result.ResiUserBaseInfoResultDTO; @@ -196,11 +198,11 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl actPointEventMsgList=new ArrayList<>(); BasePointEventMsg actPointEventMsg=new BasePointEventMsg(); actPointEventMsg.setCustomerId(formDTO.getCustomerId()); @@ -211,8 +213,14 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl 0) { actPreviewResultDTO.setActContent(actContent); } + + if (StringUtils.isNotBlank(actPreviewResultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(formDTO.getCustomerId()); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + actPreviewResultDTO.setServiceMatterName(categoryMap.get(actPreviewResultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(actPreviewResultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(actPreviewResultDTO.getUnitId()); + actPreviewResultDTO.setUnitName(unitDTO.getUnitName()); + } } return actPreviewResultDTO; } @@ -258,6 +285,12 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { latestActInfoDTO.setVolunteerLimit(formDTO.getVolunteerLimit()); //审核开关:1报名人员需要人工审核0不需要 latestActInfoDTO.setAuditSwitch(formDTO.getAuditSwitch()); + + latestActInfoDTO.setActType(formDTO.getActType()); + latestActInfoDTO.setUnitId(formDTO.getUnitId()); + latestActInfoDTO.setTarget(formDTO.getTarget()); + latestActInfoDTO.setServiceMatter(formDTO.getServiceMatter()); + return latestActInfoDTO; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index b552ee29bc..a54b43cce2 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -6,9 +6,7 @@ import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; -import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; -import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.ImgScanParamDTO; @@ -17,17 +15,20 @@ 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.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.*; -import com.epmet.constant.ActConstant; -import com.epmet.constant.ActMessageConstant; -import com.epmet.constant.ReadFlagConstant; -import com.epmet.constant.UserMessageTypeConstant; +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.constant.*; import com.epmet.dao.*; import com.epmet.dto.*; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.form.demand.SubCodeFormDTO; import com.epmet.dto.form.work.*; import com.epmet.dto.result.ActSponsorResultDTO; +import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.work.*; import com.epmet.entity.*; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -41,12 +42,10 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; /** * 描述一下 @@ -56,7 +55,7 @@ import java.util.UUID; */ @Service public class WorkActServiceImpl implements WorkActService { - private Logger logger = LogManager.getLogger(WorkActServiceImpl.class); + private final Logger logger = LogManager.getLogger(WorkActServiceImpl.class); @Value("${openapi.scan.server.url}") private String scanApiUrl; @Value("${openapi.scan.method.textSyncScan}") @@ -97,9 +96,19 @@ public class WorkActServiceImpl implements WorkActService { private UserKindnessTimeLogDao userKindnessTimeLogDao; @Autowired private LatestActInfoDao latestActInfoDao; + @Resource + private IcPartyActivityService icPartyActivityService; + @Resource + private IcResiDemandDictService icResiDemandDictService; + @Resource + private IcPartyUnitService icPartyUnitService; + + /** + * 服务事项code + */ + private static final String SERVICE_MATTER_CODE = "1010"; /** - * @return void * @author yinzuomei * @description 发布活动-删除历史活动草稿 * @Date 2020/7/20 18:15 @@ -184,9 +193,55 @@ public class WorkActServiceImpl implements WorkActService { return publishActResultDTO; } + @Override + @Transactional(rollbackFor = Exception.class) + public PublishActResultDTO publishActV2(PublishActInfoFormDTO formDTO) { + //构造属性保存活动属性,活动内容 + ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); + //校验参数 + + //校验 活动报名截止时间应该大于当前时间 + if (actInfoEntity.getSignUpEndTime().before(DateUtils.minStrToSecondDate(DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)))){ + throw new RenException(EpmetErrorCode.ACT_SIGN_UP_END_TIME_EARLIER_NOW_EERROR.getCode(),EpmetErrorCode.ACT_SIGN_UP_END_TIME_EARLIER_NOW_EERROR.getMsg()); + } + this.checkPublishFormDTO(actInfoEntity); + PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); + //内容审核(活动标题、招募要求、活动内容图文) + this.auditAct(formDTO); + logger.info("发布活动,审核成功"); + + actInfoDao.insert(actInfoEntity); + //如果用户之前点击了预览,需要去更新草稿表里的act_info_id,记录草稿和活动的关系 + if(StringUtils.isNotBlank(formDTO.getActDraftId())){ + logger.info("更新latest_act_info表的act_info_id字段"); + latestActInfoDao.updateActInfoId(formDTO.getActDraftId(),actInfoEntity.getId()); + } + List actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); + for(ActContentEntity actContentEntity:actContentEntityList){ + actContentDao.insert(actContentEntity); + } + //插入一条操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(actInfoEntity.getId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_PUBLISH); + actOperationRecEntity.setNoticeUser(false); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + + //删除所有的草稿 + this.deleteDraft(); + publishActResultDTO.setActId(actInfoEntity.getId()); + + //添加信息到ic_party_activity + if (ActConstant.PARTY.equals(formDTO.getActType())) { + IcPartyActivityEntity activity = getPartyActivityEntity(formDTO, actInfoEntity); + icPartyActivityService.insert(activity); + } + + return publishActResultDTO; + } /** - * @return void * @param actInfoEntity * @author yinzuomei * @description 第一次发布 @@ -209,23 +264,6 @@ public class WorkActServiceImpl implements WorkActService { } } - public static void main(String[] args) { - SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - try { - Date yesterDate=format.parse("2020-07-26 13:00:00"); - Date today=format.parse("2020-07-27 13:00:00"); - Date tommorrow=format.parse("2020-07-28 13:00:00"); - Date today1=format.parse("2020-07-27 13:00:00"); - System.out.println(yesterDate.compareTo(today)); - System.out.println(tommorrow.compareTo(today)); - System.out.println(today.compareTo(today1)); - } catch (ParseException e) { - e.printStackTrace(); - } - - } - /** * @return void * @param formDTO @@ -720,7 +758,10 @@ public class WorkActServiceImpl implements WorkActService { if (wxmpMsg.success()) { logger.info("给审核通过的用户推送微信订阅消息成功"); } + } + //取消活动,删除ic_party_activity对应的活动 + icPartyActivityService.deleteByActId(formDTO.getActId()); } @@ -732,7 +773,7 @@ public class WorkActServiceImpl implements WorkActService { * @Date 2020/7/26 18:00 **/ @Override - public CanceledActDetailResultDTO canceledDetail(String actId) { + public CanceledActDetailResultDTO canceledDetail(String customerId, String actId) { CanceledActDetailResultDTO canceledActDetailResultDTO=actInfoDao.selectCanceledActInfo(actId); if(null!=canceledActDetailResultDTO){ canceledActDetailResultDTO.setActContent(actContentDao.selectByActId(actId)); @@ -741,6 +782,20 @@ public class WorkActServiceImpl implements WorkActService { }else{ canceledActDetailResultDTO.setIsMyPublish(false); } + + if (StringUtils.isNotBlank(canceledActDetailResultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(customerId); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + canceledActDetailResultDTO.setServiceMatterName(categoryMap.get(canceledActDetailResultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(canceledActDetailResultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(canceledActDetailResultDTO.getUnitId()); + canceledActDetailResultDTO.setUnitName(unitDTO.getUnitName()); + } } return canceledActDetailResultDTO; } @@ -785,6 +840,20 @@ public class WorkActServiceImpl implements WorkActService { }else{ resultDTO.setIsMyPublish(false); } + + if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(formDTO.getCustomerId()); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(resultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); + resultDTO.setUnitName(unitDTO.getUnitName()); + } } return resultDTO; } @@ -797,7 +866,7 @@ public class WorkActServiceImpl implements WorkActService { * @Date 2020/7/26 21:34 **/ @Override - public InProgressActDetailResultDTO inProgressDetail(String actId) { + public InProgressActDetailResultDTO inProgressDetail(String customerId, String actId) { InProgressActDetailResultDTO resultDTO = actInfoDao.selectInProgressDetail(actId); if (null != resultDTO) { Date nowDate=new Date(); @@ -853,6 +922,19 @@ public class WorkActServiceImpl implements WorkActService { }else{ resultDTO.setIsMyPublish(false); } + if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(customerId); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(resultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); + resultDTO.setUnitName(unitDTO.getUnitName()); + } } return resultDTO; } @@ -917,11 +999,11 @@ public class WorkActServiceImpl implements WorkActService { String opAgencyId=userResult.getData().getId(); //备注 String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_REMARK,actInfoDTO.getTitle()); - MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); + //MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); //mq的事件类型 - mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass()); + //mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass()); //事件code - mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag()); + //mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag()); List basePointEventMsgArrayList=new ArrayList<>(); for(ActUserRelationEntity actUserRelationEntity:actUserRelationEntityList){ BasePointEventMsg basePointEventMsg=new BasePointEventMsg(); @@ -937,15 +1019,22 @@ public class WorkActServiceImpl implements WorkActService { basePointEventMsg.setOperatorId(loginUserUtil.getLoginUserId()); basePointEventMsgArrayList.add(basePointEventMsg); } - mqBaseMsgDTO.setMsg(JSON.toJSONString(basePointEventMsgArrayList)); - Result result=SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + //mqBaseMsgDTO.setMsg(JSON.toJSONString(basePointEventMsgArrayList)); + //Result result=SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + + SystemMsgFormDTO systemMsgFormDTO = new SystemMsgFormDTO(); + systemMsgFormDTO.setMessageType(SystemMessageType.ACTIVE_SEND_POINT); + systemMsgFormDTO.setContent(basePointEventMsgArrayList); + + Result result = epmetMessageOpenFeignClient.sendSystemMsgByMQ(systemMsgFormDTO); + ActGrantPointLogEntity actGrantPointLogEntity=new ActGrantPointLogEntity(); actGrantPointLogEntity.setActId(actInfoDTO.getId()); actGrantPointLogEntity.setCustomerId(actInfoDTO.getCustomerId()); actGrantPointLogEntity.setOperatorId(loginUserUtil.getLoginUserId()); actGrantPointLogEntity.setRemark(remark); actGrantPointLogEntity.setReward(actInfoDTO.getReward()); - actGrantPointLogEntity.setSendMsg(JSON.toJSONString(mqBaseMsgDTO)); + actGrantPointLogEntity.setSendMsg(JSON.toJSONString(systemMsgFormDTO)); actGrantPointLogEntity.setResponseMsg(JSON.toJSONString(result)); actGrantPointLogDao.insert(actGrantPointLogEntity); if(!result.success()){ @@ -958,11 +1047,11 @@ public class WorkActServiceImpl implements WorkActService { //查询当前用户所属组织信息 Result userResult = govOrgOpenFeignClient.getAgencyByStaff(loginUserUtil.getLoginUserId()); String opAgencyId = userResult.getData().getId(); - MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); + //MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); //mq的事件类型 - mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass()); + //mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass()); //事件code - mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag()); + //mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag()); List basePointEventMsgArrayList = new ArrayList<>(); BasePointEventMsg basePointEventMsg = new BasePointEventMsg(); basePointEventMsg.setOpAgencyId(opAgencyId); @@ -976,9 +1065,16 @@ public class WorkActServiceImpl implements WorkActService { basePointEventMsg.setSourceId(formDTO.getSourceId()); basePointEventMsg.setOperatorId(loginUserUtil.getLoginUserId()); basePointEventMsgArrayList.add(basePointEventMsg); - mqBaseMsgDTO.setMsg(JSON.toJSONString(basePointEventMsgArrayList)); - logger.info("发送消息入参:"+JSON.toJSON(mqBaseMsgDTO)); - Result result = SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + //mqBaseMsgDTO.setMsg(JSON.toJSONString(basePointEventMsgArrayList)); + //logger.info("发送消息入参:"+JSON.toJSON(mqBaseMsgDTO)); + //Result result = SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + + SystemMsgFormDTO msgForm = new SystemMsgFormDTO(); + msgForm.setMessageType(SystemMessageType.ACTIVE_SEND_POINT); + msgForm.setContent(basePointEventMsgArrayList); + + Result result = epmetMessageOpenFeignClient.sendSystemMsgByMQ(msgForm); + logger.info("发送消息返参:"+JSON.toJSON(result)); ActGrantPointLogEntity actGrantPointLogEntity=new ActGrantPointLogEntity(); actGrantPointLogEntity.setActId(formDTO.getSourceId()); @@ -986,7 +1082,7 @@ public class WorkActServiceImpl implements WorkActService { actGrantPointLogEntity.setOperatorId(loginUserUtil.getLoginUserId()); actGrantPointLogEntity.setRemark(formDTO.getRemark()); actGrantPointLogEntity.setReward(formDTO.getReward()); - actGrantPointLogEntity.setSendMsg(JSON.toJSONString(mqBaseMsgDTO)); + actGrantPointLogEntity.setSendMsg(JSON.toJSONString(msgForm)); actGrantPointLogEntity.setResponseMsg(JSON.toJSONString(result)); actGrantPointLogDao.insert(actGrantPointLogEntity); if (!result.success()) { @@ -1084,6 +1180,15 @@ public class WorkActServiceImpl implements WorkActService { //拒绝发放积分总人数 actStatisticalDTO.setDenyRewardUserNum(actUserRelationDao.selectCountByReward(actId,ActConstant.ACT_USER_STATUS_DENY)); actStatisticalService.save(actStatisticalDTO); + + //保存服务人数 + IcPartyActivityDTO dto = icPartyActivityService.getActivityByActId(actId); + if (null != dto) { + IcPartyActivityEntity actInfoEntity = new IcPartyActivityEntity(); + actInfoEntity.setId(dto.getId()); + actInfoEntity.setPeopleCount(actStatisticalDTO.getSignedInUserNum()); + icPartyActivityService.updateById(actInfoEntity); + } } /** @@ -1177,6 +1282,15 @@ public class WorkActServiceImpl implements WorkActService { //更新act_info表的SUMMARY_FLAG=true actInfoDTO.setSummaryFlag(true); actInfoService.update(actInfoDTO); + + //保存活动结果 + IcPartyActivityDTO dto = icPartyActivityService.getActivityByActId(formDTO.getActId()); + if (null != dto) { + IcPartyActivityEntity actInfoEntity = new IcPartyActivityEntity(); + actInfoEntity.setId(dto.getId()); + actInfoEntity.setResult(getContent(formDTO.getActSummary())); + icPartyActivityService.updateById(actInfoEntity); + } } /** @@ -1187,7 +1301,7 @@ public class WorkActServiceImpl implements WorkActService { * @Date 2020/7/27 13:36 **/ @Override - public ReEditActInfoResultDTO getActInfo(String actId) { + public ReEditActInfoResultDTO getActInfo(String customerId, String actId) { ActInfoDTO actInfoDTO=actInfoService.get(actId); if(null==actInfoDTO){ logger.error("act_info is null"); @@ -1203,6 +1317,21 @@ public class WorkActServiceImpl implements WorkActService { resultDTO.setActId(actId); List actContent=actContentDao.selectByActId(actId); resultDTO.setActContent(actContent); + + if (StringUtils.isNotBlank(resultDTO.getServiceMatter())) { + //获取服务事项 + SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); + codeFormDTO.setCustomerId(customerId); + codeFormDTO.setParentCategoryCode(SERVICE_MATTER_CODE); + Map categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + resultDTO.setServiceMatterName(categoryMap.get(resultDTO.getServiceMatter())); + } + if (StringUtils.isNotBlank(resultDTO.getUnitId())) { + //获取单位名称 + IcPartyUnitDTO unitDTO = icPartyUnitService.get(resultDTO.getUnitId()); + resultDTO.setUnitName(unitDTO.getUnitName()); + } + return resultDTO; } @@ -1264,5 +1393,108 @@ public class WorkActServiceImpl implements WorkActService { return publishActResultDTO; } + @Override + @Transactional(rollbackFor = Exception.class) + public PublishActResultDTO rePublishV2(RePublishFormDTO rePublishFormDTO) { + ActInfoDTO originalActInfo=actInfoService.get(rePublishFormDTO.getActId()); + if(null==originalActInfo){ + logger.error("act_info is null"); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + if(!originalActInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + if(!ActConstant.ACT_STATUS_PUBLISHED.equals(originalActInfo.getActStatus())){ + throw new RenException("只有进行中的活动才可以编辑"); + } + //构造属性保存活动属性,活动内容 + ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO); + //校验参数 + this.checkPublishFormDTO(newActInfoEntity); + PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); + //内容审核(活动标题、招募要求、活动内容图文) + this.auditRePublishAct(rePublishFormDTO); + logger.info("重新发布活动,审核成功"); + newActInfoEntity.setId(rePublishFormDTO.getActId()); + actInfoDao.updateById(newActInfoEntity); + //删除原来的 + actContentDao.updateDelFlagByActId(rePublishFormDTO.getActId()); + //插入编辑后的活动详情 + List actContentEntityList=this.constructActContent(rePublishFormDTO.getActContent(),rePublishFormDTO.getActId()); + for(ActContentEntity actContentEntity:actContentEntityList){ + actContentDao.insert(actContentEntity); + } + //插入一条操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(rePublishFormDTO.getActId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_UPDATE); + actOperationRecEntity.setNoticeUser(rePublishFormDTO.getNoticePassedPeople()); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + + //删除所有的草稿 + this.deleteDraft(); + publishActResultDTO.setActId(rePublishFormDTO.getActId()); + //发送消息通知-暂时不做了,前端默认串的是不通知 + //如果用户在重新发布之前点击了预览,需要去更新草稿表里的act_info_id,记录草稿和活动的关系 + if(StringUtils.isNotBlank(rePublishFormDTO.getActDraftId())){ + latestActInfoDao.updateActInfoId(rePublishFormDTO.getActDraftId(),newActInfoEntity.getId()); + } + + //添加信息到ic_party_activity + if (ActConstant.PARTY.equals(rePublishFormDTO.getActType())) { + IcPartyActivityDTO activityDTO = icPartyActivityService.getActivityByActId(newActInfoEntity.getId()); + if (null != activityDTO) { + IcPartyActivityEntity activity = getPartyActivityEntity(ConvertUtils.sourceToTarget(rePublishFormDTO, PublishActInfoFormDTO.class), newActInfoEntity); + activity.setId(activityDTO.getId()); + icPartyActivityService.updateById(activity); + } + } + + return publishActResultDTO; + } + + /** + * 构建联建活动对象 + * @Param formDTO + * @Return {@link IcPartyActivityEntity} + * @Author zhaoqifeng + * @Date 2021/12/23 14:32 + */ + private IcPartyActivityEntity getPartyActivityEntity(PublishActInfoFormDTO formDTO, ActInfoEntity actInfoEntity) { + IcPartyActivityEntity entity = new IcPartyActivityEntity(); + entity.setCustomerId(actInfoEntity.getCustomerId()); + entity.setAgencyId(actInfoEntity.getSponsorId()); + Result result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); + if(result.success()&&null!=result.getData()){ + entity.setPids(result.getData().getPids()); + }else{ + logger.warn("根据agencyId查询组织信息失败,agencyId={}",formDTO.getSponsorId()); + } + entity.setActId(actInfoEntity.getId()); + entity.setUnitId(actInfoEntity.getUnitId()); + entity.setServiceMatter(actInfoEntity.getServiceMatter()); + entity.setTitle(actInfoEntity.getTitle()); + entity.setTarget(actInfoEntity.getTarget()); + entity.setContent(getContent(formDTO.getActContent())); + entity.setPeopleCount(NumConstant.ZERO); + entity.setActivityTime(actInfoEntity.getActStartTime()); + entity.setAddress(actInfoEntity.getActAddress()); + entity.setLongitude(actInfoEntity.getActLongitude().toPlainString()); + entity.setLatitude(actInfoEntity.getActLatitude().toPlainString()); + return entity; + } + + private String getContent(List actContent) { + AtomicReference content = new AtomicReference<>(""); + actContent.forEach(i -> { + if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(i.getContentType())) { + content.set(content.get().concat("

").concat(i.getContent()).concat("

")); + } else { + content.set(content.get().concat("

").concat("").concat("

")); + } + }); + return content.get(); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.5__activity.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.5__activity.sql new file mode 100644 index 0000000000..fd9732bc6e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.5__activity.sql @@ -0,0 +1,9 @@ +ALTER TABLE `epmet_heart`.`act_info` + ADD COLUMN `ACT_TYPE` varchar(10) NULL COMMENT '活动类型 爱心活动heart 联建活动party' AFTER `CUSTOMER_ID`, + ADD COLUMN `UNIT_ID` varchar(64) NULL COMMENT '联建单位ID' AFTER `ACT_TYPE`, + ADD COLUMN `SERVICE_MATTER` varchar(64) NULL COMMENT '服务事项' AFTER `UNIT_ID`, + ADD COLUMN `TARGET` varchar(100) NULL COMMENT '活动目标' AFTER `TITLE`; + + +ALTER TABLE `epmet_heart`.`ic_party_activity` + ADD COLUMN `ACT_ID` varchar(64) NULL COMMENT 'act_info表ID' AFTER `PIDS`; \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 4ce15b04c7..796fe5cd93 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -645,7 +645,11 @@ ai.SIGN_IN_START_TIME as signInStartTime, ai.SIGN_IN_END_TIME as signInEndTime, ai.SIGN_IN_ADDRESS as signInAddress, - ai.SIGN_IN_RADIUS as signInRadius + ai.SIGN_IN_RADIUS as signInRadius, + ai.ACT_TYPE, + ai.UNIT_ID, + ai.SERVICE_MATTER, + ai.TARGET FROM act_info ai WHERE @@ -678,7 +682,11 @@ ai.SIGN_IN_START_TIME as signInStartTime, ai.SIGN_IN_END_TIME as signInEndTime, ai.SIGN_IN_ADDRESS as signInAddress, - ai.SIGN_IN_RADIUS as signInRadius + ai.SIGN_IN_RADIUS as signInRadius, + ai.ACT_TYPE, + ai.UNIT_ID, + ai.SERVICE_MATTER, + ai.TARGET FROM act_info ai WHERE @@ -717,7 +725,11 @@ ai.SIGN_IN_START_TIME as signInStartTime, ai.SIGN_IN_END_TIME as signInEndTime, ai.SIGN_IN_ADDRESS as signInAddress, - ai.SIGN_IN_RADIUS as signInRadius + ai.SIGN_IN_RADIUS as signInRadius, + ai.ACT_TYPE, + ai.UNIT_ID, + ai.SERVICE_MATTER, + ai.TARGET FROM act_info ai WHERE diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml index 37f21845e4..0358defecc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml @@ -259,7 +259,7 @@ - SELECT S.SERVER_ID AS serverId, SUM( M.SCORE ) AS totalScore, @@ -407,9 +412,9 @@ AND r.DEL_FLAG = '0' AND m.CUSTOMER_ID = #{customerId} AND r.`STATUS` = 'finished' - and s.SERVICE_TYPE ='party_unit' - - and s.server_id=#{partyUnitId} + and s.SERVICE_TYPE=#{serviceType} + + and s.server_id=#{serverId} group by s.SERVER_ID @@ -476,7 +481,7 @@ WHERE r.DEL_FLAG = '0' AND r.GRID_ID = #{gridId} - AND R.DEMAND_USER_ID !=#{demandUserId} + AND R.DEMAND_USER_ID =#{demandUserId} AND r.`STATUS` = 'pending' @@ -491,4 +496,38 @@ order by r.WANT_SERVICE_TIME asc + + + + + + update ic_user_demand_rec + set EVALUATE_FLAG='1', + FINISH_RESULT=#{finishResult}, + UPDATED_TIME=NOW() + where id=#{demandRecId} + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml index f0904b26a4..67f4cb64a7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml @@ -113,7 +113,11 @@ lai.REQUIREMENT AS requirement, lai.SPONSOR_NAME AS sponsorName, lai.SPONSOR_CONTACTS AS sponsorContacts, - lai.SPONSOR_TEL AS sponsorTel + lai.SPONSOR_TEL AS sponsorTel, + lai.ACT_TYPE, + lai.UNIT_ID, + lai.SERVICE_MATTER, + lai.TARGET FROM latest_act_info lai WHERE diff --git a/epmet-module/epmet-job/epmet-job-server/pom.xml b/epmet-module/epmet-job/epmet-job-server/pom.xml index 4ebf4f1fd3..5c1655d562 100644 --- a/epmet-module/epmet-job/epmet-job-server/pom.xml +++ b/epmet-module/epmet-job/epmet-job-server/pom.xml @@ -90,6 +90,12 @@ 2.0.0 compile + + com.epmet + epmet-heart-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java new file mode 100644 index 0000000000..c1ce071d0e --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoEvaluateDemandTask.java @@ -0,0 +1,31 @@ +package com.epmet.task; + + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.AutoEvaluateDemandFormDTO; +import com.epmet.feign.EpmetHeartOpenFeignClient; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author yinzuomei + * @dscription 每天晚上23:50执行,需求已完成,未评分的自动评分=》发放积分,计算满意度 + */ +@Slf4j +@Component("autoEvaluateDemandTask") +public class AutoEvaluateDemandTask implements ITask { + @Autowired + private EpmetHeartOpenFeignClient heartOpenFeignClient; + + @Override + public void run(String params) { + AutoEvaluateDemandFormDTO formDTO = new AutoEvaluateDemandFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, AutoEvaluateDemandFormDTO.class); + } + Result result = heartOpenFeignClient.AutoEvaluateDemand(formDTO); + } +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java index 284be1cb95..660693f986 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java @@ -104,4 +104,54 @@ public interface SystemMessageType { * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度 */ String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction"; + + /** + * 活动发放积分 + */ + String ACTIVE_SEND_POINT = "active_send_point"; + /** + * 认证志愿者 + */ + String REGISTER_VOLUNTEER = "register_volunteer"; + /** + * 添加活动实况 + */ + String ACTIVE_INSERT_LIVE = "active_insert_live"; + /** + * 拉新用户入组 + */ + String INVITE_NEW_INTO_GROUP = "invite_new_into_group"; + /** + * 邀请已注册的用户入组 + */ + String INVITE_RESI_INTO_GROUP = "invite_resi_into_group"; + /** + * 发布话题 + */ + String PUBLISH_ONE_TOPIC = "publish_one_topic"; + /** + * 话题被转为议题(小组中发布的话题被组长转为议题) + */ + String TOPIC_TO_ISSUE = "topic_to_issue"; + /** + * 对小组内话题进行15字以上评论 + */ + String PARTICIPATE_ONE_TOPIC = "participate_one_topic"; + /** + * 转话题为议题(将自建小组中话题转为议题) + */ + String SHIFT_TOPIC_TO_ISSUE = "shift_topic_to_issue"; + /** + * 话题被转为项目 + */ + String TOPIC_TO_PROJECT = "topic_to_project"; + /** + * 组长解决组内话题 + */ + String LEADER_RESOLVE_TOPIC = "leader_resolve_topic"; + + /** + * 完成用户需求,需求人提交评价 + */ + String FINISH_USER_DEMAND="finish_user_demand"; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java index c0fb1400e9..24dbd8694f 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java @@ -19,6 +19,6 @@ public class SystemMsgFormDTO { @NotNull(message = "消息内容不能为空", groups = { SendMsgByMQ.class }) private Object content; - @NotNull(message = "pendingMsgLabel不能为空", groups = { AckMsgByMQ.class }) - private String pendingMsgLabel; + //@NotNull(message = "pendingMsgLabel不能为空", groups = { AckMsgByMQ.class }) + //private String pendingMsgLabel; } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java index 92703db76e..4f668a3c5a 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java @@ -193,7 +193,26 @@ public class SystemMessageServiceImpl implements SystemMessageService { topic = TopicConstants.IC_RESI_USER; break; case SystemMessageType.CAL_PARTY_UNIT_SATISFACTION: - topic=TopicConstants.CAL_PARTY_UNIT_SATISFACTION; + topic=TopicConstants.USER_DEMAND; + break; + case SystemMessageType.INVITE_NEW_INTO_GROUP: + case SystemMessageType.INVITE_RESI_INTO_GROUP: + case SystemMessageType.PUBLISH_ONE_TOPIC: + case SystemMessageType.PARTICIPATE_ONE_TOPIC: + case SystemMessageType.TOPIC_TO_ISSUE: + case SystemMessageType.SHIFT_TOPIC_TO_ISSUE: + case SystemMessageType.TOPIC_TO_PROJECT: + case SystemMessageType.LEADER_RESOLVE_TOPIC: + topic = TopicConstants.RESI_GROUP; + break; + case SystemMessageType.ACTIVE_SEND_POINT: + case SystemMessageType.REGISTER_VOLUNTEER: + case SystemMessageType.ACTIVE_INSERT_LIVE: + topic = TopicConstants.EPMET_HEART; + break; + //社区服务相关积分 + case SystemMessageType.FINISH_USER_DEMAND: + topic=TopicConstants.COMMUNITY_SERVICE; break; } return topic; diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 89c84eb878..c0224fd49d 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -167,6 +167,10 @@ https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + true + 192.168.1.140:9876;192.168.1.141:9876 @@ -210,6 +214,10 @@ https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + true + 192.168.1.140:9876;192.168.1.141:9876 @@ -253,6 +261,10 @@ https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + true + 192.168.10.161:9876 @@ -296,6 +308,10 @@ https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + true + 192.168.11.187:9876;192.168.11.184:9876 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java new file mode 100644 index 0000000000..500f4bb632 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -0,0 +1,28 @@ +package com.epmet.mq; + +import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; +import com.epmet.mq.listener.PointListener; +import com.epmet.service.UserPointActionLogService; +import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class RocketMQConsumerRegister extends MQAbstractRegister { + + @Autowired + private UserPointActionLogService userPointActionLogService; + + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.RESI_GROUP_POINT_OPERATION_GROUP, MessageModel.CLUSTERING, TopicConstants.RESI_GROUP, "*", new PointListener(userPointActionLogService)); + register(consumerProperties, ConsomerGroupConstants.EPMET_HEART_POINT_OPERATION_GROUP, MessageModel.CLUSTERING, TopicConstants.EPMET_HEART, "*", new PointListener(userPointActionLogService)); + register(consumerProperties, ConsomerGroupConstants.COMMUNITY_SERVICE_POINT_OPERATION_GROUP, MessageModel.CLUSTERING, TopicConstants.COMMUNITY_SERVICE, "*", new PointListener(userPointActionLogService)); + + // ...其他监听器类似 + } +} \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/listener/PointListener.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/listener/PointListener.java new file mode 100644 index 0000000000..63b4c44e2b --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/listener/PointListener.java @@ -0,0 +1,243 @@ +package com.epmet.mq.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.MQUserPropertys; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.constant.SystemMessageType; +import com.epmet.service.UserPointActionLogService; +import dto.form.SendPointFormDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; +import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; +import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; +import org.apache.rocketmq.common.message.MessageExt; +import org.redisson.api.RLock; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * @author wxz + * @Description 登录操作日志监听器 + + * @return + * @date 2021.06.07 16:12 + */ +@Slf4j +public class PointListener implements MessageListenerConcurrently { + + private RedisUtils redisUtils; + + private UserPointActionLogService userPointActionLogService; + + public PointListener(UserPointActionLogService userPointActionLogService) { + this.userPointActionLogService = userPointActionLogService; + } + + @Override + public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { + + if (redisUtils == null) { + redisUtils = SpringContextUtils.getBean(RedisUtils.class); + } + + try { + msgs.forEach(msg -> consumeMessage(msg)); + } catch (Exception e) { + log.error(ExceptionUtils.getErrorStackTrace(e)); + return ConsumeConcurrentlyStatus.RECONSUME_LATER; + } + return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; + } + + private void consumeMessage(MessageExt messageExt) { + String tags = messageExt.getTags(); + String msg = new String(messageExt.getBody()); + String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL); + log.info("【积分操作监听器】-收到消息内容:{}", msg); + + DistributedLock distributedLock = null; + RLock lock = null; + try { + distributedLock = SpringContextUtils.getBean(DistributedLock.class); + lock = distributedLock.getLock("lock:point_operation", 30L, 30L, TimeUnit.SECONDS); + + switch (tags) { + case SystemMessageType.PARTICIPATE_ONE_TOPIC: + resiGroupPointOpe(msg); + break; + case SystemMessageType.ACTIVE_SEND_POINT: + // 爱心活动积分发放 + activeSendPoint(msg); + break; + case SystemMessageType.ACTIVE_INSERT_LIVE: + // 添加活动实况 + activeInsertLive(msg); + break; + case SystemMessageType.REGISTER_VOLUNTEER: + // 注册志愿者 + registerVolunteer(msg); + break; + case SystemMessageType.TOPIC_TO_ISSUE: + // 话题被组长转为议题 + topicToIssue(msg); + break; + case SystemMessageType.TOPIC_TO_PROJECT: + // 话题转为项目 + topicToProject(msg); + break; + case SystemMessageType.INVITE_RESI_INTO_GROUP: + inviteResiIntoGroup(msg); + break; + case SystemMessageType.INVITE_NEW_INTO_GROUP: + inviteNewIntoGroup(msg); + break; + case SystemMessageType.SHIFT_TOPIC_TO_ISSUE: + shiftTopicToIssue(msg); + break; + case SystemMessageType.PUBLISH_ONE_TOPIC: + publicOneTopic(msg); + break; + case SystemMessageType.LEADER_RESOLVE_TOPIC: + leaderResolveTopic(msg); + break; + case SystemMessageType.FINISH_USER_DEMAND: + //给需求服务方(志愿者)发放积分 + grantServerPoint(msg); + break; + } + + } catch (RenException e) { + // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 + log.error("【积分操作监听器】消费消息失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + } catch (Exception e) { + // 不是我们自己抛出的异常,可以让MQ重试 + log.error("【积分操作监听器】消费消息失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + throw e; + } finally { + distributedLock.unLock(lock); + } + + if (StringUtils.isNotBlank(pendingMsgLabel)) { + try { + removePendingMqMsgCache(pendingMsgLabel); + } catch (Exception e) { + log.error("【登录操作事件监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); + } + } + } + + private void leaderResolveTopic(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + } + + private void publicOneTopic(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + } + + private void shiftTopicToIssue(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + } + + private void inviteNewIntoGroup(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + } + + private void inviteResiIntoGroup(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + } + + private void topicToProject(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + } + + private void topicToIssue(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(), obj); + }); + } + + private void registerVolunteer(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(EventEnum.REGISTER_VOLUNTEER.getEventTag(),obj); + }); + } + + private void activeInsertLive(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(EventEnum.ACTIVE_INSERT_LIVE.getEventTag(), obj); + }); + } + + private void activeSendPoint(String msg) { + List formDTO = JSON.parseArray(msg, SendPointFormDTO.class); + userPointActionLogService.grantPoint(formDTO); + } + + private void resiGroupPointOpe(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + } + + /** + * 需求完成,给志愿者发放积分 + * @param msg + */ + private void grantServerPoint(String msg) { + List formDTO = JSON.parseArray(msg, BasePointEventMsg.class); + userPointActionLogService.grantServerPoint(formDTO); + } + + /** + * @description + * + * @param pendingMsgLabel + * @return + * @author wxz + * @date 2021.10.14 16:32:32 + */ + private void removePendingMqMsgCache(String pendingMsgLabel) { + String key = RedisKeys.blockedMqMsgKey(pendingMsgLabel); + redisUtils.delete(key); + //logger.info("【登录操作事件监听器】删除pendingMsgLabel成功:{}", pendingMsgLabel); + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java index b156816c80..360edcb9cb 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java @@ -119,6 +119,12 @@ public interface UserPointActionLogService extends BaseService grantPointParam); + /** + * 需求完成-志愿者发放积分 + * @param grantPointParam + */ + void grantServerPoint(List grantPointParam); + /** * @Description 通过事件推送进行积分加减 * @param event diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java index 45bbb65790..0fbb19a3d8 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java @@ -578,4 +578,59 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl baseDao.selectPageResiPoin(formDTO)); return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); } + + /** + * 需求完成,给志愿者发放积分 + * @param list + */ + @Override + public void grantServerPoint(List list){ + if (CollectionUtils.isEmpty(list)){ + return; + } + list.forEach(grantPoint->{ + if (null != grantPoint.getPoint()) { + //1.新增用户积分行为记录 + UserPointActionLogEntity action = new UserPointActionLogEntity(); + action.setCustomerId(grantPoint.getCustomerId()); + action.setBizType("community_service"); + action.setPoint(grantPoint.getPoint()); + //完成了XXX的需求 + action.setEventStatement(grantPoint.getRemark()); + //需求分类表中一级分类的名称 + action.setEventId(EventEnum.FINISH_USER_DEMAND.getEventTag()); + action.setActionFlag(grantPoint.getActionFlag()); + action.setUserId(grantPoint.getUserId()); + action.setCreatedBy(grantPoint.getOperatorId()); + action.setUpdatedBy(grantPoint.getOperatorId()); + action.setSourceType(grantPoint.getSourceType()); + action.setSourceId(grantPoint.getSourceId()); + // 需求所属分类编码,对应objectId + action.setObjectId(grantPoint.getObjectId()); + //需求所属分类-一级分类名称 + action.setEventName(grantPoint.getEventName()); + baseDao.insert(action); + //2.新增/修改用户积分日统计 + DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date()); + UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dimVal, UserPointStatisticalDailyEntity.class); + statistical.setPointChange(grantPoint.getPoint()); + statistical.setActionFlag(grantPoint.getActionFlag()); + statistical.setCustomerId(grantPoint.getCustomerId()); + statistical.setUserId(grantPoint.getUserId()); + statistical.setCreatedBy(grantPoint.getOperatorId()); + statistical.setUpdatedBy(grantPoint.getOperatorId()); + userPointStatisticalDailyService.insertOrUpdate(statistical); + //3.新增/修改用户积分日统计 + UserPointTotalEntity point = new UserPointTotalEntity(); + point.setCustomerId(grantPoint.getCustomerId()); + point.setUserId(grantPoint.getUserId()); + point.setTotalPoint(grantPoint.getPoint()); + point.setUsablePoint(grantPoint.getPoint()); + point.setUsedPoint(NumConstant.ZERO); + point.setCreatedBy(grantPoint.getOperatorId()); + point.setUpdatedBy(grantPoint.getOperatorId()); + userPointTotalService.insertOrUpdate(point); + } + }); + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml index af068df15d..4d5434a25f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml @@ -141,3 +141,7 @@ shutdown: graceful: enable: true #是否开启优雅停机 waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 + +rocketmq: + enable: @rocketmq.enable@ + name-server: @rocketmq.nameserver@ \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentRecordMiniFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentRecordMiniFormDTO.java new file mode 100644 index 0000000000..b3a14cf11b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AppointmentRecordMiniFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/12/24 10:38 上午 + * @DESC + */ +@Data +public class AppointmentRecordMiniFormDTO implements Serializable { + + private static final long serialVersionUID = -2963684994195809536L; + + public interface AppointmentRecordMiniForm{} + + @NotBlank(message = "gridId不能为空",groups = AppointmentRecordMiniForm.class) + private String gridId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/PartyServiceCenterDetailFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/PartyServiceCenterDetailFormDTO.java new file mode 100644 index 0000000000..b7ec31560e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/PartyServiceCenterDetailFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/12/28 5:05 下午 + * @DESC + */ +@Data +public class PartyServiceCenterDetailFormDTO implements Serializable { + + private static final long serialVersionUID = 8849427528238500433L; + + public interface PartyServiceCenterDetailForm{} + + @NotBlank(message = "partyServiceCenterId不能为空",groups = PartyServiceCenterDetailForm.class) + private String partyServiceCenterId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java index 84813a4f47..4858babc52 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentRecordResultDTO.java @@ -47,6 +47,8 @@ public class AppointmentRecordResultDTO implements Serializable { */ private List appointmentTime; + private String appointmentDate; + @JsonIgnore private String timeId; @@ -58,5 +60,6 @@ public class AppointmentRecordResultDTO implements Serializable { this.remark = ""; this.appointmentTime = new ArrayList<>(); this.recordId = ""; + this.appointmentDate = ""; } } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java index c8d547fe17..4bc56543a1 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java @@ -34,9 +34,13 @@ public class GridBaseInfoResultDTO implements Serializable { */ private String code = ""; /** - * 编码 + * 网格类型 字典表value值 */ private String gridType = ""; + /** + * 网格类型 字典表label值 + */ + private String gridTypeName = ""; /** * 负责人 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java index bfb95d5c23..f9a2726a1a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java @@ -70,9 +70,13 @@ public class GridDetailResultDTO implements Serializable { */ private String code = ""; /** - * 网格类型 + * 网格类型 字典表value值 */ private String gridType = ""; + /** + * 网格类型 字典表label值 + */ + private String gridTypeName = ""; /** * 负责人 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java index 1fb82337a5..3b2872a7f3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPartyServiceCenterController.java @@ -217,5 +217,28 @@ public class IcPartyServiceCenterController { return new Result>().ok(icPartyServiceCenterService.getAllMatters(formDTO)); } + /** + * @Description 小程序端预约记录 + * @param formDTO + * @author zxc + * @date 2021/12/24 10:18 上午 + */ + @PostMapping("appointmentrecordmini") + public Result> appointmentRecordMini(@RequestBody AppointmentRecordMiniFormDTO formDTO,@LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO,AppointmentRecordMiniFormDTO.AppointmentRecordMiniForm.class); + return new Result>().ok(icPartyServiceCenterService.appointmentRecordMini(formDTO,tokenDto)); + } + + /** + * @Description 党群服务中心详情 + * @param formDTO + * @author zxc + * @date 2021/12/28 5:13 下午 + */ + @PostMapping("partyservicecenterdetail") + public Result partyServiceCenterDetail(@RequestBody PartyServiceCenterDetailFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, PartyServiceCenterDetailFormDTO.PartyServiceCenterDetailForm.class); + return new Result().ok(icPartyServiceCenterService.partyServiceCenterDetail(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index eca348b6f2..48dacdf82d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -345,4 +345,10 @@ public interface CustomerGridDao extends BaseDao { List selectByPid(@Param("pid") String pid); List getGridOptionForQuery(String gridPids); + + /** + * @Author sun + * @Description 网格组织信息 + **/ + CustomerGridDTO gridAgencyByGrid(@Param("gridId") String gridId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcMatterAppointmentRecordDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcMatterAppointmentRecordDao.java index 0b118216bb..d501c97389 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcMatterAppointmentRecordDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcMatterAppointmentRecordDao.java @@ -44,6 +44,15 @@ public interface IcMatterAppointmentRecordDao extends BaseDao appointmentRecord(@Param("matterId")String matterId,@Param("date")String date); + /** + * @Description 小程序端预约列表 + * @param orgId + * @param userId + * @author zxc + * @date 2021/12/24 10:25 上午 + */ + List appointmentRecordMini(@Param("orgId")String orgId,@Param("userId")String userId); + /** * @Description 查询事项是不是存在预约记录 * @param matterIds diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java index 52a90184cf..ad1ff57769 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPartyServiceCenterDao.java @@ -43,6 +43,14 @@ public interface IcPartyServiceCenterDao extends BaseDao partyServiceCenterList(@Param("orgId")String orgId); + /** + * @Description 查询党群服务中心详情 + * @param centerId + * @author zxc + * @date 2021/12/28 5:15 下午 + */ + PartyServiceCenterListResultDTO partyServiceCenterDetail(@Param("centerId")String centerId); + /** * @Description 获取网格所属组织下所有的可预约事项 * @param orgId diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java index 1c0e805806..37d93ce41a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPartyServiceCenterService.java @@ -175,4 +175,20 @@ public interface IcPartyServiceCenterService extends BaseService getAllMatters(AllMattersFormDTO formDTO); + /** + * @Description 小程序端预约记录 + * @param tokenDto + * @author zxc + * @date 2021/12/24 10:18 上午 + */ + List appointmentRecordMini(AppointmentRecordMiniFormDTO formDTO,TokenDto tokenDto); + + /** + * @Description 党群服务中心详情 + * @param formDTO + * @author zxc + * @date 2021/12/28 5:13 下午 + */ + PartyServiceCenterListResultDTO partyServiceCenterDetail(PartyServiceCenterDetailFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index bd83c240df..f95eb8343a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; +import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -43,6 +44,7 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerGridEntity; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; @@ -51,6 +53,7 @@ import com.epmet.service.CustomerGridService; import com.epmet.util.ModuleConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -87,6 +90,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl page(Map params) { @@ -216,6 +221,12 @@ public class CustomerGridServiceImpl extends BaseServiceImpl> staffGridList = epmetUserFeignClient.getStaffGridList(customerStaffGridDTOS); griddetail.setStaffGridList(staffGridList.getData()); + //查询网格类型字典表数据 + Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.GRID_TYPE.getCode()); + Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); + if (StringUtils.isNotBlank(griddetail.getGridType())) { + griddetail.setGridTypeName(statusMap.get(griddetail.getGridType())); + } return new Result().ok(griddetail); } @@ -356,7 +367,23 @@ public class CustomerGridServiceImpl extends BaseServiceImpl> getAllGridsByAgency(CommonAgencyIdFormDTO agencyFormDTO) { - return new Result>().ok(baseDao.selectGridListByAgencyId(agencyFormDTO.getAgencyId(),null)); + //1.查询组织下网格列表数据 + List list = baseDao.selectGridListByAgencyId(agencyFormDTO.getAgencyId(),null); + if (org.springframework.util.CollectionUtils.isEmpty(list)) { + return new Result>(); + } + + //2.查询网格类型字典表数据 + Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.GRID_TYPE.getCode()); + Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); + + //3.封装数据并返回 + list.forEach(l->{ + if (StringUtils.isNotBlank(l.getGridType())) { + l.setGridTypeName(statusMap.get(l.getGridType())); + } + }); + return new Result>().ok(list); } /** @@ -743,15 +770,16 @@ public class CustomerGridServiceImpl extends BaseServiceImpl(); } + /** + * @Description 小程序端预约记录 + * @param tokenDto + * @author zxc + * @date 2021/12/24 10:18 上午 + */ + @Override + public List appointmentRecordMini(AppointmentRecordMiniFormDTO formDTO,TokenDto tokenDto) { + List result = matterAppointmentRecordDao.appointmentRecordMini(formDTO.getGridId(), tokenDto.getUserId()); + if (CollectionUtils.isNotEmpty(result)){ + return result; + } + return new ArrayList<>(); + } + + /** + * @Description 党群服务中心详情 + * @param formDTO + * @author zxc + * @date 2021/12/28 5:13 下午 + */ + @Override + public PartyServiceCenterListResultDTO partyServiceCenterDetail(PartyServiceCenterDetailFormDTO formDTO) { + return baseDao.partyServiceCenterDetail(formDTO.getPartyServiceCenterId()); + } + public List getTimeList(String start,String end,Integer interval){ List result = new ArrayList<>(); List intervalTimeList = getIntervalTimeList(start, end, interval); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolReviewRecordServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolReviewRecordServiceImpl.java index 8019f867c7..a67d4980b8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolReviewRecordServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolReviewRecordServiceImpl.java @@ -17,32 +17,25 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; -import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcPlacePatrolReviewRecordDao; import com.epmet.dao.IcPlacePatrolTeamStaffDao; import com.epmet.dto.IcPlacePatrolTeamStaffDTO; -import com.epmet.dto.form.*; -import com.epmet.dto.result.GetListPlacePatrolRecordResultDTO; +import com.epmet.dto.form.AddPlacePatrolReviewRecordFormDTO; +import com.epmet.dto.form.EditPlacePatrolReviewRecordFormDTO; +import com.epmet.dto.form.GetListPlacePatrolReviewRecordFormDTO; import com.epmet.dto.result.GetListPlacePatrolReviewRecordResultDTO; -import com.epmet.dto.result.PlacePatrolRecordDetailResultDTO; import com.epmet.dto.result.PlacePatrolReviewRecordDetailResultDTO; import com.epmet.entity.IcPlacePatrolRecordEntity; import com.epmet.entity.IcPlacePatrolReviewRecordEntity; -import com.epmet.entity.IcPlacePatrolTeamEntity; -import com.epmet.entity.IcPlacePatrolTeamStaffEntity; -import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.service.IcPlacePatrolRecordService; import com.epmet.service.IcPlacePatrolReviewRecordService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -50,7 +43,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index be7125e80c..13629cef31 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -190,23 +190,10 @@ ca.organization_name AS "agencyName", ca.pids AS "pids", ca.level level, - ( CASE WHEN ca.longitude is null THEN - ( SELECT longitude FROM customer_agency - WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id) - ORDER BY pid ASC LIMIT 1 - ) - ELSE ca.longitude - END - ) longitude, - ( CASE WHEN ca.latitude is null THEN - ( SELECT latitude FROM customer_agency - WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id) - ORDER BY pid ASC LIMIT 1 - ) - ELSE ca.latitude - END - ) latitude + IFNULL(ca.longitude, cc.longitude) longitude, + IFNULL(ca.latitude, cc.latitude) latitude FROM customer_agency ca + INNER JOIN customer_agency cc ON cc.pid = '0' AND ca.customer_id = cc.customer_id WHERE ca.del_flag = '0' AND ca.pids = #{subAgencyPids} ORDER BY ca.created_time DESC diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 02e6a67cb2..4c34ea5bed 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -409,25 +409,11 @@ ) agencyGridName, cg.grid_name gridName, - ( CASE WHEN cg.longitude is null THEN - ( SELECT longitude FROM customer_agency - WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id) - ORDER BY pid ASC LIMIT 1 - ) - ELSE cg.longitude - END - ) longitude, - ( CASE WHEN cg.latitude is null THEN - ( SELECT latitude FROM customer_agency - WHERE del_flag = '0' AND customer_id = (SELECT customer_id FROM customer_agency WHERE id = ca.id) - ORDER BY pid ASC LIMIT 1 - ) - ELSE cg.latitude - END - ) latitude + IFNULL(cg.longitude, ca.longitude) longitude, + IFNULL(cg.latitude, ca.latitude) latitude FROM customer_grid cg - INNER JOIN customer_agency ca ON cg.pid = ca.id + INNER JOIN customer_agency ca ON ca.pid = '0' AND ca.customer_id = cg.customer_id WHERE cg.del_flag = '0' AND ca.del_flag = '0' @@ -734,4 +720,39 @@ and cg.PIDS like concat(#{gridPids},'%') order by ca.CREATED_TIME asc,cg.CREATED_TIME asc + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcMatterAppointmentRecordDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcMatterAppointmentRecordDao.xml index 3b5f960894..3709847fd8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcMatterAppointmentRecordDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcMatterAppointmentRecordDao.xml @@ -45,4 +45,22 @@ GROUP BY matterId + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml index 275a3be71b..dc979d5df6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml @@ -67,4 +67,36 @@ AND c.DEL_FLAG = 0 AND c.ORG_ID = #{orgId} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventDetailResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventDetailResultDTO.java index 4f0e1f1ff0..0ba4733a75 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventDetailResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventDetailResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.result; +import com.epmet.commons.tools.dto.form.FileCommonDTO; import com.epmet.dto.EventProjectInfoDTO; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; @@ -79,7 +80,7 @@ public class EventDetailResultDTO implements Serializable { /** * 语音附件url集合 */ - private List voiceList; + private List voiceList; /** * 事件附件 */ @@ -127,5 +128,10 @@ public class EventDetailResultDTO implements Serializable { * 附件类型 */ private String type; + + /** + * 附件类型 + */ + private Integer duration; } } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventAttachmentEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventAttachmentEntity.java index b28acf8317..658922b493 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventAttachmentEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ResiEventAttachmentEntity.java @@ -89,4 +89,9 @@ public class ResiEventAttachmentEntity extends BaseEpmetEntity { */ private String reason; + /** + * 语音或视频时长,秒 + * */ + private Integer duration; + } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java index 1521c76bc6..7a0b19a9fc 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ResiEventReplyServiceImpl.java @@ -293,7 +293,7 @@ public class ResiEventReplyServiceImpl extends BaseServiceImpl eventImgs = new ArrayList<>(); - List voiceList = new ArrayList<>(); + List voiceList = new ArrayList<>(); dto.getAttachmentList().forEach(file->{ if("image".equals(file.getType())){ eventImgs.add(file.getUrl()); }else if("voice".equals(file.getType())){ - voiceList.add(file.getUrl()); + FileCommonDTO fl = new FileCommonDTO(); + fl.setUrl(file.getUrl()); + fl.setDuration(file.getDuration()); + voiceList.add(fl); } }); dto.setEventImgs(eventImgs); @@ -347,10 +350,11 @@ public class ResiEventServiceImpl extends BaseServiceImpl + @@ -155,6 +156,7 @@ ea.id AS resiEventAttachmentId, ea.ATTACHMENT_URL AS url, ea.ATTACHMENT_TYPE AS type, + ea.duration AS duration, IF(ISNULL(em.USER_SHOW_NAME),NULL,concat('人大代表-',em.USER_SHOW_NAME)) AS person, re.GRID_ID AS gridId, re.CREATED_BY AS eventUserId, diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java index de5c0b5207..648c64fca0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java @@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSON; 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.rocketmq.constants.TopicConstants; import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.MqConstant; @@ -34,12 +35,15 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SendMqMsgUtils; +import com.epmet.constant.SystemMessageType; import com.epmet.dto.IssueShareLinkRecordDTO; import com.epmet.dto.IssueShareLinkVisitRecordDTO; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.GetRoleKeyListFormDTO; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.result.CommonDataFilterResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.modules.feign.GovOrgFeignClient; @@ -120,6 +124,8 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl page(Map params) { @@ -352,10 +358,13 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); BasePointEventMsg pointEventMsg = new BasePointEventMsg(); pointEventMsg.setCustomerId(resiGroupDTO.getCustomerId()); @@ -368,8 +377,8 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); BasePointEventMsg pointEventMsg = new BasePointEventMsg(); pointEventMsg.setCustomerId(groupCache.getCustomerId()); @@ -689,7 +693,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl userParam = new LinkedList<>(); @@ -707,8 +711,15 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl NumConstant.FIFTEEN){ + String eventClass = EventEnum.PARTICIPATE_ONE_TOPIC.getEventClass(); + String eventTag = EventEnum.PARTICIPATE_ONE_TOPIC.getEventTag(); + //mq的事件类型 - MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); - mqBaseMsgDTO.setEventClass(EventEnum.PARTICIPATE_ONE_TOPIC.getEventClass()); + //MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); + //mqBaseMsgDTO.setEventClass(EventEnum.PARTICIPATE_ONE_TOPIC.getEventClass()); //事件code - mqBaseMsgDTO.setEventTag(EventEnum.PARTICIPATE_ONE_TOPIC.getEventTag()); + //mqBaseMsgDTO.setEventTag(EventEnum.PARTICIPATE_ONE_TOPIC.getEventTag()); List pointEventMsgList = new ArrayList<>(); BasePointEventMsg pointEventMsg = new BasePointEventMsg(); String customerId = resiTopicdDao.selectCustomerIdByTopicId(resiCommentFormDTO.getTopicId()); @@ -297,8 +304,8 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); BasePointEventMsg pointEventMsg = new BasePointEventMsg(); ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(resiTopicPublishFormDTO.getGroupId()); @@ -449,13 +455,19 @@ public class ResiTopicServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); BasePointEventMsg pointEventMsg = new BasePointEventMsg(); @@ -840,8 +852,15 @@ public class ResiTopicServiceImpl extends BaseServiceImpl result = SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + + SystemMsgFormDTO msgFormDTO = new SystemMsgFormDTO(); + msgFormDTO.setContent(pointEventMsgList); + msgFormDTO.setMessageType(SystemMessageType.LEADER_RESOLVE_TOPIC); + Result result = epmetMessageOpenFeignClient.sendSystemMsgByMQ(msgFormDTO); + + if (!result.success()) { log.error("组长解决话题事件发送失败,参数:{}", JSON.toJSONString(closeFormDTO)); } } @@ -1931,15 +1950,22 @@ public class ResiTopicServiceImpl extends BaseServiceImpl { - MqBaseMsgDTO msgDTO = new MqBaseMsgDTO(); - msgDTO.setEventClass("resi_group"); + //MqBaseMsgDTO msgDTO = new MqBaseMsgDTO(); + //msgDTO.setEventClass("resi_group"); //事件code 因为楼院小组的事件回调统一入口,外层的EventTag不能够判断具体的事件 //因为可能会一次发送多个事件集合,需要对集合里的对象逐个判断 - msgDTO.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag()); + //msgDTO.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag()); List msgList = new ArrayList<>(); msgList.add(item); - msgDTO.setMsg(JSON.toJSONString(msgList)); - if(!SendMqMsgUtils.sendMsg(msgDTO).success()){ + //msgDTO.setMsg(JSON.toJSONString(msgList)); + + SystemMsgFormDTO msgForm = new SystemMsgFormDTO(); + msgForm.setMessageType(SystemMessageType.SHIFT_TOPIC_TO_ISSUE); + msgForm.setContent(msgList); + Result sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(msgForm); + + //Result sendMsgResult = SendMqMsgUtils.sendMsg(msgDTO); + if(!sendMsgResult.success()){ log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(topicTurnIssueFromDTO)); } }); @@ -2104,15 +2130,22 @@ public class ResiTopicServiceImpl extends BaseServiceImpl { - MqBaseMsgDTO msgDTO = new MqBaseMsgDTO(); - msgDTO.setEventClass("resi_group"); + //MqBaseMsgDTO msgDTO = new MqBaseMsgDTO(); + //msgDTO.setEventClass("resi_group"); //事件code 因为楼院小组的事件回调统一入口,外层的EventTag不能够判断具体的事件 //因为可能会一次发送多个事件集合,需要对集合里的对象逐个判断 - msgDTO.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag()); + //msgDTO.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag()); List msgList = new ArrayList<>(); msgList.add(item); - msgDTO.setMsg(JSON.toJSONString(msgList)); - if(!SendMqMsgUtils.sendMsg(msgDTO).success()){ + //msgDTO.setMsg(JSON.toJSONString(msgList)); + + SystemMsgFormDTO sendMsgForm = new SystemMsgFormDTO(); + sendMsgForm.setContent(msgList); + sendMsgForm.setMessageType(SystemMessageType.SHIFT_TOPIC_TO_ISSUE); + Result sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(sendMsgForm); + + //Result sendMsgResult = SendMqMsgUtils.sendMsg(msgDTO); + if(!sendMsgResult.success()){ log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(param)); } }); @@ -2462,10 +2495,10 @@ public class ResiTopicServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); //话题被转为项目 话题作者 @@ -2493,8 +2526,16 @@ public class ResiTopicServiceImpl extends BaseServiceImpl content.length() ? "\"" : "…\"") ).append("被转为项目").toString()); pointEventMsgList.add(pointEventMsg); - mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); - if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){ + //mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); + + //Result sendMsgResult = SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + + SystemMsgFormDTO sendMsgForm = new SystemMsgFormDTO(); + sendMsgForm.setContent(pointEventMsgList); + sendMsgForm.setMessageType(SystemMessageType.TOPIC_TO_PROJECT); + Result sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(sendMsgForm); + + if(!sendMsgResult.success()){ log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(param)); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java index 9a60f060b2..0d681d7368 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java @@ -38,7 +38,9 @@ import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.scan.result.VoiceResultDTO; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.*; +import com.epmet.constant.SystemMessageType; import com.epmet.dto.form.CommonGridIdFormDTO; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.dto.result.UserInfoResultDTO; import com.epmet.dto.result.CommonDataFilterResultDTO; @@ -1004,11 +1006,11 @@ public class TopicDraftServiceImpl extends BaseServiceImpl actPointEventMsgList=new ArrayList<>(); BasePointEventMsg actPointEventMsg=new BasePointEventMsg(); actPointEventMsg.setCustomerId(customerId); @@ -1026,8 +1028,14 @@ public class TopicDraftServiceImpl extends BaseServiceImpl workTypeList; + + @Range(min = 0, max = 1, message = "有无变动(异常)格式错误", groups = AddOrUpdateForm.class) + @NotNull(message = "有无变动(异常)不能为空", groups = AddOrUpdateForm.class) + private Integer isNormal; + + @JsonFormat(pattern = "yyyy-MM-dd") + @NotNull(message = "发生时间不能为空", groups = AddOrUpdateForm.class) + private String happenTime; + + @NotBlank(message = "工作简介不能为空", groups = AddOrUpdateForm.class) + private String workContent; + + @NotBlank(message = "工作地点不能为空", groups = AddOrUpdateForm.class) + private String address; + + /** + * 基础信息ID【相关信息】暂时没有 + */ + private String baseInfoId; + /** + * 经度 + */ + private String longitude; + /** + * 纬度 + */ + private String latitude; + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java index 3561cb4060..e8bff9cd33 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java @@ -30,6 +30,16 @@ public class UserInfoOnEnterGridResultDTO implements Serializable{ * */ private String currentGridId; + /** + * 网格经度【没值则去客户跟组织的值】 + */ + private String longitude; + + /** + * 网格纬度【没值则去客户跟组织的值】 + */ + private String latitude; + /** * 当前网格名称 * */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java new file mode 100644 index 0000000000..aa970dee00 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/PatrolRoutineWorkController.java @@ -0,0 +1,38 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.PatrolRoutineWorkFormDTO; +import com.epmet.service.PatrolRoutineWorkService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@RestController +@RequestMapping("patrolroutinework") +public class PatrolRoutineWorkController { + + @Autowired + private PatrolRoutineWorkService gridUserWorkService; + + /** + * @Description 添加例行工作 + * @param formDTO + * @author zxc + * @date 2021/10/19 1:35 下午 + */ + @NoRepeatSubmit + @PostMapping("add") + public Result gridUserWork( @RequestBody PatrolRoutineWorkFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, PatrolRoutineWorkFormDTO.AddOrUpdateForm.class); + gridUserWorkService.add(formDTO); + return new Result().ok(true); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkDao.java new file mode 100644 index 0000000000..02ba968895 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PatrolRoutineWorkEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Mapper +public interface PatrolRoutineWorkDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkTypeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkTypeDao.java new file mode 100644 index 0000000000..924c91eaeb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/PatrolRoutineWorkTypeDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.PatrolRoutineWorkTypeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Mapper +public interface PatrolRoutineWorkTypeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java new file mode 100644 index 0000000000..0167079052 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridUserWorkEntity.java @@ -0,0 +1,90 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 网格员例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("patrol_routine_work") +public class GridUserWorkEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * gridId的PID + */ + private String pids; + + /** + * 用户Id user.id 谁创建的 + */ + private String userId; + + /** + * 事项名称 + */ + private String title; + + /** + * 发生日期 格式为“YYYY-MM-DD” + */ + private Date happenTime; + + /** + * 有无变动(异常)1:是、0:否 + */ + private Integer isNormal; + + /** + * 备注说明 + */ + private String workContent; + + /** + * 经度 + */ + private String longitude; + /** + * 纬度 + */ + private String latitude; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkEntity.java new file mode 100644 index 0000000000..94bde0e1ba --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkEntity.java @@ -0,0 +1,88 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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 2021-12-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("patrol_routine_work") +public class PatrolRoutineWorkEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 网格表Id(CUSTOMER_GRID.id)【居民党员角色值为all,热心居民角色对应的网格Id】 + */ + private String gridId; + + /** + * 网格所有上级id + */ + private String pids; + + /** + * 用户Id user.id + */ + private String userId; + + /** + * 事项名称 + */ + private String title; + + /** + * 工作日期 格式为“YYYY-MM-DD” + */ + private String happenTime; + + /** + * 有无变动(异常)1:是、0:否 + */ + private Integer isNormal; + + /** + * 工作内容 + */ + private String workContent; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkTypeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkTypeEntity.java new file mode 100644 index 0000000000..bf18e08bee --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/PatrolRoutineWorkTypeEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("patrol_routine_work_type") +public class PatrolRoutineWorkTypeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 例行工作Id + */ + private String routineWorkId; + + /** + * 例行工作字典项值;type:patrol_work_type + */ + private String workTypeCode; + + /** + * 所有上级类别code组合 + */ + private String allPCode; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkService.java new file mode 100644 index 0000000000..f30a19f244 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkService.java @@ -0,0 +1,37 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.form.PatrolRoutineWorkFormDTO; +import com.epmet.entity.PatrolRoutineWorkEntity; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +public interface PatrolRoutineWorkService extends BaseService { + + /** + * desc:添加例行工作 + * @param formDTO + */ + void add(PatrolRoutineWorkFormDTO formDTO); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkTypeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkTypeService.java new file mode 100644 index 0000000000..f15123239f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/PatrolRoutineWorkTypeService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.PatrolRoutineWorkTypeEntity; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +public interface PatrolRoutineWorkTypeService extends BaseService { + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java new file mode 100644 index 0000000000..91e2c520df --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java @@ -0,0 +1,162 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +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.commons.tools.dto.result.DictTreeResultDTO; +import com.epmet.commons.tools.enums.DictTypeEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.PatrolRoutineWorkDao; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.PatrolRoutineWorkFormDTO; +import com.epmet.entity.PatrolRoutineWorkEntity; +import com.epmet.entity.PatrolRoutineWorkTypeEntity; +import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.service.PatrolRoutineWorkService; +import com.epmet.service.PatrolRoutineWorkTypeService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Slf4j +@Service +public class PatrolRoutineWorkServiceImpl extends BaseServiceImpl implements PatrolRoutineWorkService { + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private EpmetAdminOpenFeignClient adminOpenFeignClient; + @Autowired + private LoginUserUtil loginUserUtil; + @Autowired + PatrolRoutineWorkTypeService patrolRoutineWorkTypeService; + + /** + * @param formDTO + * @Description 网格员例行工作 + * @author zxc + * @date 2021/10/19 1:35 下午 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void add(PatrolRoutineWorkFormDTO formDTO) { + PatrolRoutineWorkEntity entity = ConvertUtils.sourceToTarget(formDTO, PatrolRoutineWorkEntity.class); + + CustomerGridFormDTO gridFormDTO = new CustomerGridFormDTO(); + gridFormDTO.setGridId(formDTO.getGridId()); + Result gridBaseInfoData = govOrgOpenFeignClient.getGridBaseInfoByGridId(gridFormDTO); + if (!gridBaseInfoData.success()) { + throw new EpmetException("查询网格基本信息失败......"); + } + CustomerGridDTO gridBaseInfo = gridBaseInfoData.getData(); + entity.setPids(gridBaseInfo.getPids()); + entity.setUserId(loginUserUtil.getLoginUserId()); + entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + + //entity.setUserId("loginUserUtil.getLoginUserId()"); + //entity.setCustomerId("loginUserUtil.getLoginUserCustomerId()"); + baseDao.insert(entity); + + Result> mapResult = adminOpenFeignClient.dictTree(DictTypeEnum.PATROL_WORK_TYPE.getCode()); + if (mapResult == null || !mapResult.success() || CollectionUtils.isEmpty(mapResult.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "例行工作类型字典获取失败!"); + } + List dictTree = mapResult.getData(); + + Map pidsMap = new HashMap<>(); + + dictTree.forEach(dto -> buildAllParentIdPath(pidsMap, dto)); + + List workTypeList = new ArrayList<>(); + formDTO.getWorkTypeList().forEach(code -> { + PatrolRoutineWorkTypeEntity typeEntity = new PatrolRoutineWorkTypeEntity(); + typeEntity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + typeEntity.setRoutineWorkId(entity.getId()); + typeEntity.setWorkTypeCode(code); + StringBuilder pids = pidsMap.get(code); + typeEntity.setAllPCode(pids.length() == 0 ? NumConstant.ZERO_STR : pids.toString()); + workTypeList.add(typeEntity); + }); + patrolRoutineWorkTypeService.insertBatch(workTypeList); + + } + + /** + * desc:递归遍历树形结构 构建pids 根节点pids 为空字符串 + * + * @param result 构建的结果 + * @param crurent + */ + private static void buildAllParentIdPath(Map result, DictTreeResultDTO crurent) { + String id = crurent.getId(); + String pid = crurent.getPid(); + + StringBuilder pidsPath = new StringBuilder(); + StringBuilder pidSb = result.get(pid); + if (pidSb == null) { + pidSb = new StringBuilder(); + } else if (pidSb.indexOf(pid) == -1) { + if (pidSb.length() > 0) { + pidSb.append(StrConstant.COLON); + } + pidSb.append(pid); + } + pidsPath.append(pidSb); + result.put(id, pidsPath); + + log.debug("id:" + id + " pids:" + pidsPath.toString()); + + List children = crurent.getChildren(); + if (children != null) { + crurent.getChildren().forEach(item -> buildAllParentIdPath(result, item)); + } + } + + public static void main(String[] args) { + String str = "[{\"id\":\"01\",\"pid\":\"0\",\"children\":[{\"id\":\"0101\",\"pid\":\"01\",\"children\":[{\"id\":\"010101\",\"pid\":\"0101\",\"children\":[],\"name\":\"出租房屋巡查\"}],\"name\":\"出租房屋巡查\"},{\"id\":\"0102\",\"pid\":\"01\",\"children\":[],\"name\":\"重点场所巡查\"},{\"id\":\"0103\",\"pid\":\"01\",\"children\":[],\"name\":\"宗教活动\"},{\"id\":\"0199\",\"pid\":\"01\",\"children\":[],\"name\":\"其他\"}],\"name\":\"重点巡查\"},{\"id\":\"02\",\"pid\":\"0\",\"children\":[{\"id\":\"0201\",\"pid\":\"02\",\"children\":[],\"name\":\"刑满释放人员\"},{\"id\":\"0202\",\"pid\":\"02\",\"children\":[],\"name\":\"社区矫正\"},{\"id\":\"0203\",\"pid\":\"02\",\"children\":[],\"name\":\"吸毒人员\"},{\"id\":\"0204\",\"pid\":\"02\",\"children\":[],\"name\":\"信访人员\"},{\"id\":\"0205\",\"pid\":\"02\",\"children\":[],\"name\":\"重点青少年\"},{\"id\":\"0206\",\"pid\":\"02\",\"children\":[],\"name\":\"精神障碍者\"}],\"name\":\"特殊人群\"},{\"id\":\"09\",\"pid\":\"0\",\"children\":[{\"id\":\"0901\",\"pid\":\"09\",\"children\":[],\"name\":\"公共服务\"},{\"id\":\"0902\",\"pid\":\"09\",\"children\":[],\"name\":\"权益保障\"},{\"id\":\"0903\",\"pid\":\"09\",\"children\":[],\"name\":\"政策宣传\"},{\"id\":\"0904\",\"pid\":\"09\",\"children\":[],\"name\":\"便利服务\"},{\"id\":\"0999\",\"pid\":\"09\",\"children\":[],\"name\":\"其他\"}],\"name\":\"为民服务\"}]"; + List dtos = JSON.parseArray(str, DictTreeResultDTO.class); + Map result = new HashMap<>(); + dtos.forEach(dto -> { + buildAllParentIdPath(result, dto); + }); + System.out.println(result.get("010101")); + System.out.println(JSON.toJSONString(result)); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkTypeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkTypeServiceImpl.java new file mode 100644 index 0000000000..185d69ac4d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkTypeServiceImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.PatrolRoutineWorkTypeDao; +import com.epmet.entity.PatrolRoutineWorkTypeEntity; +import com.epmet.service.PatrolRoutineWorkTypeService; +import org.springframework.stereotype.Service; + +/** + * 巡查例行工作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-12-21 + */ +@Service +public class PatrolRoutineWorkTypeServiceImpl extends BaseServiceImpl implements PatrolRoutineWorkTypeService { + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java index 0e0a8ef246..0ab2d16b99 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java @@ -309,6 +309,8 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkTypeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkTypeDao.xml new file mode 100644 index 0000000000..cec9ea0941 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkTypeDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file