From 58ef2d14dab9e44c3c4f876725962777b614f68f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 22 Dec 2021 17:23:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=A4=A7=E5=8E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../dto/form/demand/FinishStaffFromDTO.java | 27 +++- .../dto/form/demand/ListHallFormDTO.java | 2 +- .../dto/form/demand/TakeOrderFormDTO.java | 21 +++ .../dto/result/demand/DemandDetailResDTO.java | 100 ++++++++++++ .../dto/result/demand/DemandRecResultDTO.java | 10 ++ .../dto/result/demand/TakeOrderResultDTO.java | 15 ++ .../epmet/constant/UserDemandConstant.java | 5 + .../controller/IcUserDemandRecController.java | 4 +- .../controller/ResiDemandController.java | 49 ++++++ .../epmet/service/IcUserDemandRecService.java | 14 ++ .../impl/IcUserDemandRecServiceImpl.java | 151 ++++++++++++++---- .../resources/mapper/IcUserDemandRecDao.xml | 4 +- 13 files changed, 363 insertions(+), 40 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/TakeOrderFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDetailResDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/TakeOrderResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 0f70c9ecbd..e2b10856d9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -93,6 +93,7 @@ public enum EpmetErrorCode { DEMAND_CAN_NOT_UPDATE(8223,"当前状态,不可更新需求"), DEMAND_NOT_EXITS(8224,"需求不存在"), DEMAND_SERVICE_NOT_EXITS(8225,"服务记录不存在"), + DEMAND_CAN_NOT_TAKE_ORDER(8226, "当前状态,不可指派"), REQUIRE_PERMISSION(8301, "您没有足够的操作权限"), THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"), diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java index 06ca8a93fc..68424240b1 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java @@ -2,6 +2,7 @@ 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; @@ -16,27 +17,31 @@ public class FinishStaffFromDTO implements Serializable { public interface AddUserInternalGroup { } - public interface AddUserShowGroup extends CustomerClientShowGroup { + public interface IcShowGroup extends CustomerClientShowGroup { + } + public interface ResiShowGroup extends CustomerClientShowGroup { } @NotBlank(message = "需求id不能为空", groups = AddUserInternalGroup.class) private String demandRecId; - @NotBlank(message = "服务id不能为空", groups = AddUserShowGroup.class) + @NotBlank(message = "服务id不能为空", groups = AddUserInternalGroup.class) private String serviceId; - @NotNull(message = "实际服务开始不能为空", groups = AddUserShowGroup.class) + @NotNull(message = "实际服务开始不能为空", groups = {IcShowGroup.class,ResiShowGroup.class}) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date serviceStartTime; - @NotNull(message = "实际服务结束不能为空", groups = AddUserShowGroup.class) + @NotNull(message = "实际服务结束不能为空", groups = {IcShowGroup.class,ResiShowGroup.class}) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date serviceEndTime; - @NotBlank(message = "完成结果不能为空", groups = AddUserShowGroup.class) + @NotBlank(message = "完成结果不能为空", groups = IcShowGroup.class) private String finishResult; + + @Length(max = 1000,message = "最多输入1000字",groups = {IcShowGroup.class}) private String finishDesc; - @NotNull(message = "得分不能为空", groups = AddUserShowGroup.class) + @NotNull(message = "得分不能为空", groups = IcShowGroup.class) private BigDecimal score; @@ -45,4 +50,14 @@ public class FinishStaffFromDTO implements Serializable { private String userId; @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) private String customerId; + /** + * pc完成情况:完成+评价 UserDemandConstant.FINISH_AND_EVALUATE + * 居民端完成:UserDemandConstant.FINISHED + */ + private String type; + /** + * pc完成情况:UserDemandConstant.STAFF + * 居民端完成:UserDemandConstant.RESI + */ + private String userType; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ListHallFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ListHallFormDTO.java index 00c28d50cd..8ffcd0589d 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ListHallFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/ListHallFormDTO.java @@ -23,7 +23,7 @@ public class ListHallFormDTO extends PageFormDTO implements Serializable { /** * 未处理:unprocessed;处理中:processing;已完成:finished */ - @NotBlank(message = "type不能为空", groups = AddUserInternalGroup.class) + @NotBlank(message = "type不能为空,未处理:unprocessed;处理中:processing;已完成:finished", groups = AddUserInternalGroup.class) private String type; // 以下入参从token中获取 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/TakeOrderFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/TakeOrderFormDTO.java new file mode 100644 index 0000000000..9672d8b457 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/TakeOrderFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form.demand; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 需求大厅-我要接单 + */ +@Data +public class TakeOrderFormDTO implements Serializable { + private static final long serialVersionUID = -2030750128789890382L; + public interface AddUserInternalGroup { + } + @NotBlank(message = "demandRecId不能为空", groups = AddUserInternalGroup.class) + private String demandRecId; + + @NotBlank(message = "tokenDto获取userId不能为空", groups = AddUserInternalGroup.class) + private String userId; +} 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 new file mode 100644 index 0000000000..5a71625cac --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandDetailResDTO.java @@ -0,0 +1,100 @@ +package com.epmet.dto.result.demand; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 需求大厅-需求详情 + */ +@Data +public class DemandDetailResDTO implements Serializable { + + private String demandRecId; + @JsonIgnore + private String categoryCode; + @JsonIgnore + private String parentCode; + /** + * 二级分类名称 + */ + private String categoryName; + + /** + * 奖励积分 + */ + private Integer awardPoint; + + /** + * 需求内容 + */ + private String content; + + /** + * 服务要求-服务时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date wantServiceTime; + + /** + * 服务要求-联系人(需求人)名称 + */ + private String demandUserName; + + /** + * 服务要求-联系人(需求人)电话 + */ + private String demandUserMobile; + + /** + * 服务地点 + */ + private String serviceAddress; + + /** + * 实际服务开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date serviceStartTime; + + /** + * 实际服务结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date serviceEndTime; + + /** + * 得分可为半星 + */ + private BigDecimal score; + + /** + * 完成结果:已解决 resolved,未解决 unresolved + + */ + private String finishResult; + + /** + * 完成情况 + */ + private String finishDesc; + + /** + * 待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished + */ + private String status; + + /** + * 1:已评价;0:未评价;评价后ic_user_satisfaction表有记录 + */ + private Boolean evaluateFlag; + + /** + * 服务记录主键 + */ + private String serviceId; +} 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 e7b673d22f..6a6c5145f1 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 @@ -121,4 +121,14 @@ public class DemandRecResultDTO implements Serializable { private String icResiUserId; private String epmetUserId; + + /** + * 奖励积分 + */ + private Integer awardPoint; + + /** + * 服务地点 + */ + private String serviceAddress; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/TakeOrderResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/TakeOrderResultDTO.java new file mode 100644 index 0000000000..a16bc5c648 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/TakeOrderResultDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.result.demand; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 需求大厅-我要接单 + */ +@Data +public class TakeOrderResultDTO implements Serializable { + private static final long serialVersionUID = -4390598017224563310L; + private Boolean isVolunteer; + private String serviceId; +} 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 4d9c087ab8..0d747cb8cb 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 @@ -59,4 +59,9 @@ public interface UserDemandConstant { */ String PERSONAL_DATA="personal-data"; String DEMAND_ANALYSIS="demand-analysis"; + + /** + * pc完成情况:完成+评价 + */ + String FINISH_AND_EVALUATE="finish_and_evaluate"; } 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 3e736641e0..269cc17225 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 @@ -187,7 +187,9 @@ public class IcUserDemandRecController { public Result finish(@LoginUser TokenDto tokenDto,@RequestBody FinishStaffFromDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); - ValidatorUtils.validateEntity(formDTO,FinishStaffFromDTO.AddUserShowGroup.class,FinishStaffFromDTO.AddUserInternalGroup.class); + formDTO.setType(UserDemandConstant.FINISH_AND_EVALUATE); + formDTO.setUserType(UserDemandConstant.STAFF); + ValidatorUtils.validateEntity(formDTO,FinishStaffFromDTO.IcShowGroup.class,FinishStaffFromDTO.AddUserInternalGroup.class); FinishResultDTO finishResultDTO=icUserDemandRecService.finish(formDTO); if(finishResultDTO.getSendCalStatisfaction()){ CalPartyUnitSatisfactionFormDTO mqMsg = new CalPartyUnitSatisfactionFormDTO(); 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 2094df9809..679f8beee0 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 @@ -6,8 +6,14 @@ import com.epmet.commons.tools.dto.form.PageFormDTO; 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.UserDemandConstant; +import com.epmet.dto.form.demand.DemandDetailFormDTO; +import com.epmet.dto.form.demand.FinishStaffFromDTO; import com.epmet.dto.form.demand.ListHallFormDTO; +import com.epmet.dto.form.demand.TakeOrderFormDTO; +import com.epmet.dto.result.demand.DemandDetailResDTO; import com.epmet.dto.result.demand.DemandHallResultDTO; +import com.epmet.dto.result.demand.TakeOrderResultDTO; import com.epmet.service.IcUserDemandRecService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -45,4 +51,47 @@ public class ResiDemandController { ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class,ListHallFormDTO.AddUserInternalGroup.class); return new Result>().ok(icUserDemandRecService.listHall(formDTO)); } + + /** + * 需求大厅-需求详情 + * + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("detail-hall") + public Result queryDetailHall(@LoginUser TokenDto tokenDto, @RequestBody DemandDetailFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,DemandDetailFormDTO.AddUserInternalGroup.class); + return new Result().ok(icUserDemandRecService.queryDetailHall(formDTO)); + } + + /** + * 需求大厅-我要接单 + * @param tokenDto + * @return + */ + @PostMapping("takeorder") + public Result takeOrder(@LoginUser TokenDto tokenDto, @RequestBody TakeOrderFormDTO formDTO){ + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,TakeOrderFormDTO.AddUserInternalGroup.class); + return new Result().ok(icUserDemandRecService.takeOrder(formDTO)); + } + + /** + * 需求大厅-完成需求 + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("finish") + public Result finish(@LoginUser TokenDto tokenDto, @RequestBody FinishStaffFromDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setType(UserDemandConstant.FINISHED); + formDTO.setUserType(UserDemandConstant.RESI); + ValidatorUtils.validateEntity(formDTO,FinishStaffFromDTO.ResiShowGroup.class,FinishStaffFromDTO.AddUserInternalGroup.class); + icUserDemandRecService.finish(formDTO); + return new Result(); + } } 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 9446699dc5..fe6d71e963 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 @@ -182,4 +182,18 @@ public interface IcUserDemandRecService extends BaseService listHall(ListHallFormDTO formDTO); + + /** + * 需求大厅-需求详情 + * @param formDTO + * @return + */ + DemandDetailResDTO queryDetailHall(DemandDetailFormDTO formDTO); + + /** + * 需求大厅-我要接单 + * @param formDTO + * @return + */ + TakeOrderResultDTO takeOrder(TakeOrderFormDTO 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 86446e5f53..bc9346fdd0 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 @@ -38,10 +38,7 @@ import com.epmet.dao.IcUserDemandOperateLogDao; import com.epmet.dao.IcUserDemandRecDao; import com.epmet.dao.IcUserDemandSatisfactionDao; import com.epmet.dao.IcUserDemandServiceDao; -import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.CustomerGridDTO; -import com.epmet.dto.IcResiUserDTO; -import com.epmet.dto.IcUserDemandRecDTO; +import com.epmet.dto.*; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.FindIcUserFormDTO; import com.epmet.dto.form.ResiUserFormDTO; @@ -54,6 +51,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.IcResiDemandDictService; import com.epmet.service.IcUserDemandRecService; +import com.epmet.service.VolunteerInfoService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; @@ -91,7 +89,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl page(Map params) { @@ -477,53 +476,63 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl