From 2699f67ce1e5cecbdc42444f6c07efa6bc1d9baa Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Dec 2021 16:35:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/demand/DemandAddFromDTO.java | 3 + .../dto/form/demand/DemandDetailFormDTO.java | 4 + .../dto/form/demand/ReportDemandFormDTO.java | 112 +++++++ .../dto/result/demand/DemandDetailResDTO.java | 3 +- .../epmet/constant/UserDemandConstant.java | 9 + .../controller/ResiDemandController.java | 39 +++ .../epmet/service/IcUserDemandRecService.java | 14 + .../impl/IcUserDemandRecServiceImpl.java | 276 +++++++++++++++++- .../dto/result/UserResiInfoResultDTO.java | 1 + .../main/resources/mapper/UserResiInfoDao.xml | 5 +- 10 files changed, 459 insertions(+), 7 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ReportDemandFormDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandAddFromDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandAddFromDTO.java index f3a1c9ae0c..a9ae2fad05 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandAddFromDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandAddFromDTO.java @@ -10,6 +10,9 @@ import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; +/** + * pc录入需求入参 + */ @Data public class DemandAddFromDTO implements Serializable { diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandDetailFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandDetailFormDTO.java index 25ec764f3f..8e24df4191 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandDetailFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandDetailFormDTO.java @@ -5,6 +5,10 @@ import lombok.Data; import javax.validation.constraints.NotBlank; import java.io.Serializable; +/** + * 需求大厅-需求详情入参 + * 我的需求-需求详情入参 + */ @Data public class DemandDetailFormDTO implements Serializable { private static final long serialVersionUID = 514538389753713095L; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ReportDemandFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ReportDemandFormDTO.java new file mode 100644 index 0000000000..267254bc3b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ReportDemandFormDTO.java @@ -0,0 +1,112 @@ +package com.epmet.dto.form.demand; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + + +/** + * 居民端-上报需求,或者修改需求 + */ +@Data +public class ReportDemandFormDTO implements Serializable { + private static final long serialVersionUID = -2931148629441558468L; + + public interface Add extends CustomerClientShowGroup { + } + + public interface AddInternalGroup { + } + + public interface Update extends CustomerClientShowGroup { + } + + public interface UpdateInternalGroup { + } + + @NotBlank(message = "需求id不能为空",groups = UpdateInternalGroup.class) + private String demandRecId; + + @NotBlank(message = "customerId不能为空", groups = {AddInternalGroup.class, UpdateInternalGroup.class}) + private String customerId; + + /** + * 网格id + */ + @NotBlank(message = "所属网格不能为空",groups = {AddInternalGroup.class}) + private String gridId; + + /** + * 需求内容1000字 + */ + @NotBlank(message = "需求内容不能为空", groups = {Add.class, Update.class}) + @Length(max = 1000, message = "需求内容至多输入1000字", groups = {Add.class, Update.class}) + private String content; + + /** + * 二级需求分类编码 + */ + @NotBlank(message = "需求类别不能为空",groups = Add.class) + private String categoryCode; + + /** + * 父级需求分类编码 + */ + @NotBlank(message = "父级分类不能为空",groups = Add.class) + private String parentCode; + + + /** + * 希望服务时间 + */ + @NotNull(message = "服务时间不能为空",groups = {Add.class, Update.class}) + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date wantServiceTime; + + /** + * 需求人:user.id或者ic_resi_user.id + */ + @NotBlank(message = "需求人不能为空",groups ={AddInternalGroup.class, UpdateInternalGroup.class}) + private String demandUserId; + + /** + * 需求人联系姓名 + */ + @NotBlank(message = "联系人不能为空",groups = {Add.class, Update.class}) + private String demandUserName; + + /** + * 需求人联系电话 + */ + @NotBlank(message = "联系电话不能为空",groups = {Add.class, Update.class}) + private String demandUserMobile; + + /** + * 服务地点,工作端指派默认居民居住房屋地址,居民端地图选择 + */ + @NotBlank(message = "服务地点不能为空",groups = {Add.class, Update.class}) + private String serviceLocation; + + /** + * 门牌号详细地址 + */ + @Length(max = 200, message = "门牌号至多输入200字", groups = {Add.class, Update.class}) + 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/DemandDetailResDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDetailResDTO.java index 96aab58234..2a829c2bb4 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 @@ -98,7 +98,8 @@ public class DemandDetailResDTO implements Serializable { * 服务记录主键 */ private String serviceId; - + @JsonIgnore + private String serverId; // 以下几个返参在我的需求详情中返回: private String serviceType; private String serviceUserName; 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 0d747cb8cb..39692daa96 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 @@ -64,4 +64,13 @@ public interface UserDemandConstant { * pc完成情况:完成+评价 */ String FINISH_AND_EVALUATE="finish_and_evaluate"; + + String MESSAGE_TITILE="您有一条需求消息"; + String HAVE_SERVICE="您提出的需求将由%s为您解决,请查看"; + String FINISH_DEMAND_MESSAGE="您提出的需求已完成,请进行服务评价。"; + /** + * 您收到来自张三的评价,请查看。 + */ + String DEMAND_EVALUATED=" 您收到来自%s的评价,请查看。"; + String DEMAND_CANCELED=" %s的需求已取消,请查看。"; } 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 9a2e1a896c..39d205bdca 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 @@ -3,6 +3,7 @@ package com.epmet.controller; import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.security.dto.TokenDto; @@ -16,6 +17,7 @@ import com.epmet.dto.result.demand.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.service.IcUserDemandRecService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -75,6 +77,7 @@ public class ResiDemandController { * @param tokenDto * @return */ + @NoRepeatSubmit @PostMapping("takeorder") public Result takeOrder(@LoginUser TokenDto tokenDto, @RequestBody TakeOrderFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); @@ -89,6 +92,7 @@ public class ResiDemandController { * @param formDTO * @return */ + @NoRepeatSubmit @PostMapping("finish") public Result finish(@LoginUser TokenDto tokenDto, @RequestBody FinishStaffFromDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -108,6 +112,7 @@ public class ResiDemandController { * @param formDTO * @return */ + @NoRepeatSubmit @PostMapping("evaluate") public Result evaluate(@LoginUser TokenDto tokenDto, @RequestBody EvaluateDemandFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); @@ -138,6 +143,7 @@ public class ResiDemandController { * @param formDTO * @return */ + @NoRepeatSubmit @PostMapping("cancel") public Result cancel(@LoginUser TokenDto tokenDto,@RequestBody CancelDemandFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -161,5 +167,38 @@ public class ResiDemandController { ValidatorUtils.validateEntity(formDTO,PageFormDTO.AddUserInternalGroup.class,ResiClientMyDemandFormDTO.AddUserInternalGroup.class); return new Result>().ok(icUserDemandRecService.queryMyDemandForResiClient(formDTO)); } + /** + * 我的需求-需求详情(待处理,处理中,已完成,已取消) + * + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("my-detail") + public Result queryMyDetail(@LoginUser TokenDto tokenDto, @RequestBody DemandDetailFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, DemandDetailFormDTO.AddUserInternalGroup.class); + return new Result().ok(icUserDemandRecService.queryMyDetail(formDTO)); + } + + /** + * 居民端-我的需求:提交需求,修改需求 + * @param tokenDto + * @param formDTO + * @return + */ + @NoRepeatSubmit + @PostMapping("submit") + public Result saveOrUpdateDemand(@LoginUser TokenDto tokenDto,@RequestBody ReportDemandFormDTO formDTO){ + //需求人默认是当前用户id + formDTO.setDemandUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + if(StringUtils.isNotBlank(formDTO.getDemandRecId())){ + ValidatorUtils.validateEntity(formDTO,ReportDemandFormDTO.Update.class,ReportDemandFormDTO.UpdateInternalGroup.class); + }else{ + ValidatorUtils.validateEntity(formDTO,ReportDemandFormDTO.Add.class,ReportDemandFormDTO.AddInternalGroup.class); + } + return new Result().ok(icUserDemandRecService.saveOrUpdateDemand(formDTO)); + } } 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 61132ea3eb..b2801abd64 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 @@ -190,4 +190,18 @@ public interface IcUserDemandRecService extends BaseService queryMyDemandForResiClient(ResiClientMyDemandFormDTO formDTO); + + /** + * 我的需求-需求详情(待处理,处理中,已完成,已取消) + * @param formDTO + * @return + */ + DemandDetailResDTO queryMyDetail(DemandDetailFormDTO formDTO); + + /** + * 居民端-我的需求:提交需求,修改需求 + * @param formDTO + * @return + */ + DemandRecId saveOrUpdateDemand(ReportDemandFormDTO formDTO); } \ 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 975d579f29..957fe5b019 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 @@ -20,6 +20,7 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; @@ -30,20 +31,21 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.UserDemandConstant; +import com.epmet.constant.UserMessageTypeConstant; import com.epmet.dao.IcUserDemandOperateLogDao; import com.epmet.dao.IcUserDemandRecDao; import com.epmet.dao.IcUserDemandSatisfactionDao; import com.epmet.dao.IcUserDemandServiceDao; import com.epmet.dto.*; -import com.epmet.dto.form.CustomerGridFormDTO; -import com.epmet.dto.form.FindIcUserFormDTO; -import com.epmet.dto.form.ResiUserFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.form.demand.*; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.*; import com.epmet.entity.*; import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.*; @@ -92,6 +94,8 @@ 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; + } + return resDto; + } + return null; + } + + /** + * 居民端-我的需求:提交需求,修改需求 + * + * @param formDTO + * @return + */ + @Override + public DemandRecId saveOrUpdateDemand(ReportDemandFormDTO formDTO) { + Date now = new Date(); + DemandRecId resultDto = new DemandRecId(); + resultDto.setDemandRecId(formDTO.getDemandRecId()); + if (StringUtils.isNotBlank(formDTO.getDemandRecId())) { + //修改需求 + IcUserDemandRecEntity origin = baseDao.selectById(formDTO.getDemandRecId()); + if (null == origin) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); + } + if (!UserDemandConstant.PENDING.equals(origin.getStatus())) { + //待处理的才可以修改需求 + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不允许重新编辑", origin.getStatus()), "需求已处理,不允许重新编辑"); + } + origin.setContent(formDTO.getContent()); + origin.setWantServiceTime(formDTO.getWantServiceTime()); + origin.setDemandUserName(formDTO.getDemandUserName()); + origin.setDemandUserMobile(formDTO.getDemandUserMobile()); + origin.setServiceLocation(formDTO.getServiceLocation()); + origin.setLatitude(formDTO.getLatitude()); + origin.setLongitude(formDTO.getLongitude()); + origin.setLocationDetail(formDTO.getLocationDetail()); + baseDao.updateById(origin); + } else { + CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); + customerGridFormDTO.setGridId(formDTO.getGridId()); + Result gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); + if (!gridInfoRes.success() || null == gridInfoRes.getData()) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询网格信息失败"); + } + IcUserDemandRecEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, IcUserDemandRecEntity.class); + insertEntity.setAgencyId(gridInfoRes.getData().getPid()); + insertEntity.setGridPids(gridInfoRes.getData().getPids()); + insertEntity.setDemandUserType(UserDemandConstant.MINI_RESI); + insertEntity.setStatus(UserDemandConstant.PENDING); + insertEntity.setEvaluateFlag(false); + //设置上报人消息 + insertEntity.setReportType(UserDemandConstant.SELF_HELP_REPORT); + insertEntity.setReportTime(now); + insertEntity.setReportUserId(formDTO.getDemandUserId()); + insertEntity.setReportUserMobile(formDTO.getDemandUserMobile()); + insertEntity.setReportUserName(formDTO.getDemandUserName()); + //记录发放积分 + IcResiDemandDictEntity icResiDemandDictEntity = demandDictService.getByCode(formDTO.getCustomerId(), formDTO.getCategoryCode()); + if (null != icResiDemandDictEntity) { + insertEntity.setAwardPoint(icResiDemandDictEntity.getAwardPoint()); + } + baseDao.insert(insertEntity); + resultDto.setDemandRecId(insertEntity.getId()); + } + //插入操作日志 + IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity(); + logEntity.setCustomerId(formDTO.getCustomerId()); + logEntity.setDemandRecId(resultDto.getDemandRecId()); + logEntity.setUserType(UserDemandConstant.RESI); + logEntity.setUserId(formDTO.getDemandUserId()); + logEntity.setActionCode(StringUtils.isNotBlank(formDTO.getDemandRecId()) ? UserDemandConstant.UPDATE : UserDemandConstant.CREATE); + logEntity.setOperateTime(now); + operateLogDao.insert(logEntity); + + return resultDto; + } + + + /** + * 我的需求被抢单->您提出的需求将由青岛亿联科技有限公司为您解决,请查看。 + */ + private void sendDemandUserHaveVolunnteerService(IcUserDemandRecEntity entity, String volunteerUserId) { + // 如果需求人是小程序里的用户,需要通知需求人: + // 您提出的需求将由青岛亿联科技有限公司为您解决,请查看。 + // 您提出的需求将由张三为您解决,请查看。 + if (UserDemandConstant.MINI_RESI.equals(entity.getDemandUserType())) { + UserResiInfoListFormDTO formDTO = new UserResiInfoListFormDTO(); + formDTO.setUserIdList(Arrays.asList(volunteerUserId)); + Result> userRes = epmetUserOpenFeignClient.getUserResiInfoList(formDTO); + if (userRes.success() && CollectionUtils.isNotEmpty(userRes.getData())) { + String volunteerName=userRes.getData().get(NumConstant.ZERO).getRealName(); + UserMessageFormDTO userMessage = new UserMessageFormDTO(); + userMessage.setApp(AppClientConstant.APP_RESI); + userMessage.setCustomerId(entity.getCustomerId()); + userMessage.setGridId(entity.getGridId()); + String messageContent = String.format(UserDemandConstant.HAVE_SERVICE, volunteerName); + userMessage.setMessageContent(messageContent); + userMessage.setReadFlag(ReadFlagConstant.UN_READ); + userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); + userMessage.setMessageType(UserMessageTypeConstant.DEMAND); + userMessage.setTargetId(entity.getId()); + //通知需求提出人 + userMessage.setUserId(entity.getDemandUserId()); + messageOpenFeignClient.saveUserMessage(userMessage); + } + } + } + + /** + * 您提出的需求将由青岛亿联科技有限公司为您解决,请查看。 + */ + private void sendDemandUserHaveOrgService(IcUserDemandRecEntity entity, String serverId, String serviceType) { + // 如果需求人是小程序里的用户,需要通知需求人: + // 您提出的需求将由青岛亿联科技有限公司为您解决,请查看。 + String serviceName = ""; + if (UserDemandConstant.PARTY_UNIT.equals(serviceType)) { + IcPartyUnitDTO data = partyUnitService.get(serverId); + serviceName = null != data ? data.getUnitName() : StrConstant.EPMETY_STR; + } else if (UserDemandConstant.SOCIAL_ORG.equals(serviceType)) { + Map map = getSocialOrgMap(Arrays.asList(serverId)); + serviceName = MapUtils.isNotEmpty(map) ? map.get(serverId).getSocietyName() : StrConstant.EPMETY_STR; + } else if (UserDemandConstant.COMMUNITY_ORG.equals(serviceType)) { + Map communityOrgMap = getCommunityOrgMap(Arrays.asList(serverId)); + serviceName = MapUtils.isNotEmpty(communityOrgMap) ? communityOrgMap.get(serverId).getOrganizationName() : StrConstant.EPMETY_STR; + } + if (StringUtils.isNotBlank(serviceName)) { + UserMessageFormDTO userMessage = new UserMessageFormDTO(); + userMessage.setApp(AppClientConstant.APP_RESI); + userMessage.setCustomerId(entity.getCustomerId()); + userMessage.setGridId(entity.getGridId()); + String messageContent = String.format(UserDemandConstant.HAVE_SERVICE, serviceName); + userMessage.setMessageContent(messageContent); + userMessage.setReadFlag(ReadFlagConstant.UN_READ); + userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); + userMessage.setMessageType(UserMessageTypeConstant.DEMAND); + userMessage.setTargetId(entity.getId()); + //通知需求提出人 + userMessage.setUserId(entity.getDemandUserId()); + messageOpenFeignClient.saveUserMessage(userMessage); + } + } + + /** + * 我的需求服务完成->您提出的需求已完成,请进行服务评价。 + */ + private void sendDemandUserFinished(IcUserDemandRecEntity entity) { + if (UserDemandConstant.MINI_RESI.equals(entity.getDemandUserType())) { + UserMessageFormDTO userMessage = new UserMessageFormDTO(); + userMessage.setApp(AppClientConstant.APP_RESI); + userMessage.setCustomerId(entity.getCustomerId()); + userMessage.setGridId(entity.getGridId()); + String messageContent = UserDemandConstant.FINISH_DEMAND_MESSAGE; + userMessage.setMessageContent(messageContent); + userMessage.setReadFlag(ReadFlagConstant.UN_READ); + userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); + userMessage.setMessageType(UserMessageTypeConstant.DEMAND); + userMessage.setTargetId(entity.getId()); + //通知需求提出人 + userMessage.setUserId(entity.getDemandUserId()); + messageOpenFeignClient.saveUserMessage(userMessage); + } + } + + /** + * 我的需求-评价:如果服务方是志愿者,通知TA: 您收到来自张三的评价,请查看。 + */ + private void sendVolunnterEvaluated(IcUserDemandRecEntity entity) { + IcUserDemandServiceEntity serviceEntity = demandServiceDao.selectByRecId(entity.getId()); + if (null != serviceEntity && UserDemandConstant.VOLUNTEER.equals(serviceEntity.getServiceType())) { + UserMessageFormDTO userMessage = new UserMessageFormDTO(); + userMessage.setApp(AppClientConstant.APP_RESI); + userMessage.setCustomerId(entity.getCustomerId()); + userMessage.setGridId(entity.getGridId()); + String messageContent = String.format(UserDemandConstant.DEMAND_EVALUATED, entity.getDemandUserName()); + userMessage.setMessageContent(messageContent); + userMessage.setReadFlag(ReadFlagConstant.UN_READ); + userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); + userMessage.setMessageType(UserMessageTypeConstant.DEMAND); + userMessage.setTargetId(entity.getId()); + //通知志愿者 + userMessage.setUserId(serviceEntity.getServerId()); + messageOpenFeignClient.saveUserMessage(userMessage); + } + } + + /** + * 我的需求-取消需求(未完成的都可以取消),如果需求已经被小程序里的志愿者接单通知它->XXX的需求已取消,请查看。 + * pc指派给志愿者的,如果取消了也要通知 + * @param entity + */ + private void sendVolunnterCanceled(IcUserDemandRecEntity entity) { + IcUserDemandServiceEntity serviceEntity = demandServiceDao.selectByRecId(entity.getId()); + if (null != serviceEntity && UserDemandConstant.VOLUNTEER.equals(serviceEntity.getServiceType())) { + UserMessageFormDTO userMessage = new UserMessageFormDTO(); + userMessage.setApp(AppClientConstant.APP_RESI); + userMessage.setCustomerId(entity.getCustomerId()); + userMessage.setGridId(entity.getGridId()); + String messageContent = String.format(UserDemandConstant.DEMAND_CANCELED, entity.getDemandUserName()); + userMessage.setMessageContent(messageContent); + userMessage.setReadFlag(ReadFlagConstant.UN_READ); + userMessage.setTitle(UserDemandConstant.MESSAGE_TITILE); + userMessage.setMessageType(UserMessageTypeConstant.DEMAND); + userMessage.setTargetId(entity.getId()); + //通知志愿者 + userMessage.setUserId(serviceEntity.getServerId()); + messageOpenFeignClient.saveUserMessage(userMessage); + } + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserResiInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserResiInfoResultDTO.java index c5482e05ba..a4be7e8745 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserResiInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserResiInfoResultDTO.java @@ -58,4 +58,5 @@ public class UserResiInfoResultDTO implements Serializable { private String headPhoto; private String nickName; + private String realName; } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml index 93cb1fc7a4..8078b4a959 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml @@ -113,7 +113,7 @@