Browse Source

最近预约、需求分类

master
yinzuomei 4 years ago
parent
commit
0f30cca68b
  1. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java
  3. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java
  4. 38
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  5. 58
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  6. 27
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -85,17 +85,6 @@ public enum EpmetErrorCode {
BUILDING_NAME_EXITED(8215,"楼栋名称已存在"), BUILDING_NAME_EXITED(8215,"楼栋名称已存在"),
DOOR_NAME_EXITED(8216,"门牌号已存在"), DOOR_NAME_EXITED(8216,"门牌号已存在"),
NEIGHBOOR_NAME_EXITED(8217,"小区名称已存在"), NEIGHBOOR_NAME_EXITED(8217,"小区名称已存在"),
//需求相关的改用EpmetException
DEMAND_NAME_EXITED(8218, "分类名称已存在"),
DEMAND_CAN_NOT_CANCEL(8219, "当前状态,不可取消"),
DEMAND_CAN_NOT_ASSIGN(8220, "当前状态,不可指派"),
DEMAND_CAN_NOT_FINISH(8221, "当前状态,不能确认服务完成"),
DEMAND_FINISHED(8222,"需求已完成"),
DEMAND_CAN_NOT_UPDATE(8223,"当前状态,不可更新需求"),
DEMAND_NOT_EXITS(8224,"需求不存在"),
DEMAND_SERVICE_NOT_EXITS(8225,"服务记录不存在"),
DEMAND_CAN_NOT_TAKE_ORDER(8226, "当前状态,不可接单"),
DEMAND_CAN_NOT_EVALUATE(8227, "当前状态,不可评价"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"), REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),
THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"), THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"),

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcResiDemandDictController.java

@ -21,8 +21,6 @@ import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
@ -33,7 +31,6 @@ import com.epmet.dto.result.demand.DemandCategoryResDTO;
import com.epmet.dto.result.demand.DemandPageResDTO; import com.epmet.dto.result.demand.DemandPageResDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.service.IcResiDemandDictService; import com.epmet.service.IcResiDemandDictService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -185,10 +182,6 @@ public class IcResiDemandDictController {
*/ */
@PostMapping("category-list") @PostMapping("category-list")
public Result<List<DemandCategoryResDTO>> queryCategoryList(@LoginUser TokenDto tokenDto){ public Result<List<DemandCategoryResDTO>> queryCategoryList(@LoginUser TokenDto tokenDto){
//测试EpmetEx
if(StringUtils.isNotBlank(tokenDto.getCustomerId())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "internalMsg","用户看到的msg???");
}
return new Result<List<DemandCategoryResDTO>>().ok(icResiDemandDictService.queryCategoryList(tokenDto.getCustomerId())); return new Result<List<DemandCategoryResDTO>>().ok(icResiDemandDictService.queryCategoryList(tokenDto.getCustomerId()));
} }

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcResiDemandDictDao.java

@ -70,14 +70,6 @@ public interface IcResiDemandDictDao extends BaseDao<IcResiDemandDictEntity> {
IcResiDemandDictEntity selectByCode(@Param("customerId") String customerId, @Param("categoryCode") String categoryCode); IcResiDemandDictEntity selectByCode(@Param("customerId") String customerId, @Param("categoryCode") String categoryCode);
/**
* 居民端-我有需求分类列表
* @param customerId
* @param parentCode
* @return
*/
List<DemandCategoryResDTO> queryCategoryList(@Param("customerId") String customerId, @Param("parentCode")String parentCode);
/** /**
* 查询分类信息限制未被禁用的 * 查询分类信息限制未被禁用的
* @param customerId * @param customerId

38
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
@ -24,8 +25,10 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode; 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.exception.RenException;
import com.epmet.commons.tools.page.PageData; 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.Result;
import com.epmet.dao.IcResiDemandDictDao; import com.epmet.dao.IcResiDemandDictDao;
import com.epmet.dto.form.demand.*; import com.epmet.dto.form.demand.*;
@ -80,7 +83,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
public void addFirstCategory(AddFirstCategoryFormDTO formDTO) { public void addFirstCategory(AddFirstCategoryFormDTO formDTO) {
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.ONE, NumConstant.ZERO_STR,null) > NumConstant.ZERO) { if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.ONE, NumConstant.ZERO_STR,null) > NumConstant.ZERO) {
// 名称唯一 // 名称唯一
throw new RenException(EpmetErrorCode.DEMAND_NAME_EXITED.getCode(), EpmetErrorCode.DEMAND_NAME_EXITED.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在");
} }
IcResiDemandDictEntity entity = new IcResiDemandDictEntity(); IcResiDemandDictEntity entity = new IcResiDemandDictEntity();
@ -107,7 +110,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
} }
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.TWO, formDTO.getParentCategoryCode(),null) > NumConstant.ZERO) { if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.TWO, formDTO.getParentCategoryCode(),null) > NumConstant.ZERO) {
// 名称唯一 // 名称唯一
throw new RenException(EpmetErrorCode.DEMAND_NAME_EXITED.getCode(), EpmetErrorCode.DEMAND_NAME_EXITED.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在");
} }
IcResiDemandDictEntity entity = new IcResiDemandDictEntity(); IcResiDemandDictEntity entity = new IcResiDemandDictEntity();
@ -160,7 +163,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
IcResiDemandDictEntity origin = baseDao.selectById(formDTO.getCategoryId()); IcResiDemandDictEntity origin = baseDao.selectById(formDTO.getCategoryId());
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.TWO, origin.getParentCode(), formDTO.getCategoryId()) > NumConstant.ZERO) { if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.TWO, origin.getParentCode(), formDTO.getCategoryId()) > NumConstant.ZERO) {
// 名称唯一 // 名称唯一
throw new RenException(EpmetErrorCode.DEMAND_NAME_EXITED.getCode(), EpmetErrorCode.DEMAND_NAME_EXITED.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在");
} }
origin.setCategoryName(formDTO.getCategoryName()); origin.setCategoryName(formDTO.getCategoryName());
if (NumConstant.TWO == origin.getLevel()) { if (NumConstant.TWO == origin.getLevel()) {
@ -274,7 +277,34 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
*/ */
@Override @Override
public List<DemandCategoryResDTO> queryCategoryList(String customerId) { public List<DemandCategoryResDTO> queryCategoryList(String customerId) {
return baseDao.queryCategoryList(customerId,NumConstant.ZERO_STR); List<DemandCategoryResDTO> list=new ArrayList<>();
LambdaQueryWrapper<IcResiDemandDictEntity> wrapper=new LambdaQueryWrapper();
wrapper.eq(IcResiDemandDictEntity::getCustomerId,customerId);
wrapper.eq(IcResiDemandDictEntity::getUsableFlag,true);
wrapper.eq(IcResiDemandDictEntity::getParentCode,NumConstant.ZERO_STR);
wrapper.orderByAsc(IcResiDemandDictEntity::getSort);
List<IcResiDemandDictEntity> first=baseDao.selectList(wrapper);
first.forEach(dto->{
DemandCategoryResDTO resultDto= ConvertUtils.sourceToTarget(dto,DemandCategoryResDTO.class);
resultDto.setCategoryId(dto.getId());
LambdaQueryWrapper<IcResiDemandDictEntity> query=new LambdaQueryWrapper();
query.eq(IcResiDemandDictEntity::getCustomerId,customerId);
query.eq(IcResiDemandDictEntity::getUsableFlag,true);
query.eq(IcResiDemandDictEntity::getParentCode,dto.getCategoryCode());
query.orderByAsc(IcResiDemandDictEntity::getSort);
List<IcResiDemandDictEntity> sub=baseDao.selectList(query);
List<DemandCategoryResDTO> children=new ArrayList<>();
sub.forEach(subDto->{
DemandCategoryResDTO subDTO= ConvertUtils.sourceToTarget(subDto,DemandCategoryResDTO.class);
subDTO.setCategoryId(subDto.getId());
children.add(subDTO);
});
resultDto.setChildren(children);
list.add(resultDto);
});
return list;
} }
/** /**

58
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

@ -26,7 +26,6 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; 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.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
@ -105,17 +104,17 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
public DemandRecId update(DemandAddFromDTO dto) { public DemandRecId update(DemandAddFromDTO dto) {
IcUserDemandRecEntity origin = baseDao.selectById(dto.getDemandRecId()); IcUserDemandRecEntity origin = baseDao.selectById(dto.getDemandRecId());
if (null == origin) { if (null == origin) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
} }
if(!UserDemandConstant.PENDING.equals(origin.getStatus())){ if(!UserDemandConstant.PENDING.equals(origin.getStatus())){
//待处理的才可以修改需求 //待处理的才可以修改需求
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_UPDATE.getCode(),EpmetErrorCode.DEMAND_CAN_NOT_UPDATE.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不允许重新编辑", origin.getStatus()), "需求已处理,不允许重新编辑");
} }
CustomerGridFormDTO customerGridFormDTO=new CustomerGridFormDTO(); CustomerGridFormDTO customerGridFormDTO=new CustomerGridFormDTO();
customerGridFormDTO.setGridId(dto.getGridId()); customerGridFormDTO.setGridId(dto.getGridId());
Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if(!gridInfoRes.success()||null==gridInfoRes.getData()){ if(!gridInfoRes.success()||null==gridInfoRes.getData()){
throw new RenException("查询网格信息失败"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询网格信息失败");
} }
IcUserDemandRecEntity updateEntity=ConvertUtils.sourceToTarget(dto,IcUserDemandRecEntity.class); IcUserDemandRecEntity updateEntity=ConvertUtils.sourceToTarget(dto,IcUserDemandRecEntity.class);
updateEntity.setAgencyId(gridInfoRes.getData().getPid()); updateEntity.setAgencyId(gridInfoRes.getData().getPid());
@ -185,7 +184,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
customerGridFormDTO.setGridId(fromDTO.getGridId()); customerGridFormDTO.setGridId(fromDTO.getGridId());
Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if(!gridInfoRes.success()||null==gridInfoRes.getData()){ if(!gridInfoRes.success()||null==gridInfoRes.getData()){
throw new RenException("查询网格信息失败"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询网格信息失败");
} }
IcUserDemandRecEntity insertEntity=ConvertUtils.sourceToTarget(fromDTO,IcUserDemandRecEntity.class); IcUserDemandRecEntity insertEntity=ConvertUtils.sourceToTarget(fromDTO,IcUserDemandRecEntity.class);
insertEntity.setAgencyId(gridInfoRes.getData().getPid()); insertEntity.setAgencyId(gridInfoRes.getData().getPid());
@ -237,7 +236,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
public PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO) { public PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId()); CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId());
if (null == staffInfo) { if (null == staffInfo) {
throw new RenException("工作人员所属组织信息查询异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"工作人员所属组织信息查询异常");
} }
if (StringUtils.isBlank(staffInfo.getAgencyPIds())|| NumConstant.ZERO_STR.equals(staffInfo.getAgencyPIds())) { if (StringUtils.isBlank(staffInfo.getAgencyPIds())|| NumConstant.ZERO_STR.equals(staffInfo.getAgencyPIds())) {
//当前用户属于根组织下的人 //当前用户属于根组织下的人
@ -267,7 +266,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
if(CollectionUtils.isNotEmpty(userIdList)){ if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList));
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){
throw new RenException("查询志愿者信息异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询志愿者信息异常");
} }
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName));
} }
@ -316,11 +315,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
public void cancel(CancelDemandFormDTO formDTO) { public void cancel(CancelDemandFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) { if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
} }
if (UserDemandConstant.FINISH.equals(entity.getStatus()) || UserDemandConstant.CANCELED.equals(entity.getStatus())) { if (UserDemandConstant.FINISH.equals(entity.getStatus()) || UserDemandConstant.CANCELED.equals(entity.getStatus())) {
//需求已完成,不可取消 //需求已完成,不可取消
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_CANCEL.getCode(),EpmetErrorCode.DEMAND_CAN_NOT_CANCEL.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不可取消需求", entity.getStatus()), "当前状态,不可取消");
} }
//1、修改主表 //1、修改主表
//置为取消状态、设置取消时间 //置为取消状态、设置取消时间
@ -347,11 +346,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
public void assign(AssignFormDTO formDTO) { public void assign(AssignFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) { if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "需求不存在", EpmetErrorCode.SERVER_ERROR.getMsg());
} }
if (!UserDemandConstant.PENDING.equals(entity.getStatus()) && !UserDemandConstant.ASSIGNED.equals(entity.getStatus())) { if (!UserDemandConstant.PENDING.equals(entity.getStatus()) && !UserDemandConstant.ASSIGNED.equals(entity.getStatus())) {
//待处理+已派单才可以指派 //待处理+已派单才可以指派
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_ASSIGN.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_ASSIGN.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不可指派",entity.getStatus()),"当前状态,不可指派");
} }
//1、修改主表 //1、修改主表
//置为已派单 //置为已派单
@ -399,7 +398,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//2、更新服务记录,记录实际开始,实际结束时间 //2、更新服务记录,记录实际开始,实际结束时间
IcUserDemandServiceEntity serviceEntity=demandServiceDao.selectById(formDTO.getServiceId()); IcUserDemandServiceEntity serviceEntity=demandServiceDao.selectById(formDTO.getServiceId());
if(null==serviceEntity){ if(null==serviceEntity){
throw new RenException(EpmetErrorCode.DEMAND_SERVICE_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_SERVICE_NOT_EXITS.getMsg()); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "服务记录不存在", EpmetErrorCode.SERVER_ERROR.getMsg());
} }
serviceEntity.setServiceStartTime(formDTO.getServiceStartTime()); serviceEntity.setServiceStartTime(formDTO.getServiceStartTime());
serviceEntity.setServiceEndTime(formDTO.getServiceEndTime()); serviceEntity.setServiceEndTime(formDTO.getServiceEndTime());
@ -443,15 +442,15 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
private IcUserDemandRecEntity checkFinishPreCondition(String demandRecId) { private IcUserDemandRecEntity checkFinishPreCondition(String demandRecId) {
IcUserDemandRecEntity entity=baseDao.selectById(demandRecId); IcUserDemandRecEntity entity=baseDao.selectById(demandRecId);
if (null == entity) { if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
} }
if(UserDemandConstant.FINISHED.equals(entity.getStatus()) ){ if(UserDemandConstant.FINISHED.equals(entity.getStatus()) ){
//已经完成 //已经完成
throw new RenException(EpmetErrorCode.DEMAND_FINISHED.getCode(), EpmetErrorCode.DEMAND_FINISHED.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务已完成,不可重复提交", "服务已完成,不可重复提交");
} }
if (!UserDemandConstant.ASSIGNED.equals(entity.getStatus()) && !UserDemandConstant.HAVE_ORDER.equals(entity.getStatus())) { if (!UserDemandConstant.ASSIGNED.equals(entity.getStatus()) && !UserDemandConstant.HAVE_ORDER.equals(entity.getStatus())) {
//已指派、已抢单的才可以完成 //已指派、已抢单的才可以完成
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不可点击服务完成",entity.getStatus()), "当前状态,不能确认服务完成");
} }
return entity; return entity;
} }
@ -584,7 +583,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
resiUserFormDTO.setIcResiUserId(formDTO.getIcResiUserId()); resiUserFormDTO.setIcResiUserId(formDTO.getIcResiUserId());
Result<ResiUserResDTO> resiRes = epmetUserOpenFeignClient.findEpmetUser(resiUserFormDTO); Result<ResiUserResDTO> resiRes = epmetUserOpenFeignClient.findEpmetUser(resiUserFormDTO);
if (!resiRes.success()) { if (!resiRes.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询小程序用户异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询小程序用户异常");
} }
if (null != resiRes.getData() && CollectionUtils.isNotEmpty(resiRes.getData().getEpmetUserIdList())) { if (null != resiRes.getData() && CollectionUtils.isNotEmpty(resiRes.getData().getEpmetUserIdList())) {
formDTO.setEpmetUserIdList(resiRes.getData().getEpmetUserIdList()); formDTO.setEpmetUserIdList(resiRes.getData().getEpmetUserIdList());
@ -600,7 +599,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
} }
if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){ if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){
//需求人不能为空 //需求人不能为空
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空");
} }
@ -649,13 +648,13 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
HouseMemResDTO houseMemResDTO=new HouseMemResDTO(); HouseMemResDTO houseMemResDTO=new HouseMemResDTO();
if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){ if(StringUtils.isBlank(formDTO.getIcResiUserId())&&CollectionUtils.isEmpty(formDTO.getEpmetUserIdList())){
//需求人不能为空 //需求人不能为空
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "需求人不能为空,icResiUserId与epmetUserIdList不能同时为空");
} }
//服务措施分析点击了PC录入的需求,或者个人档案进来的(这两种情况肯定会有icResiUserId) //服务措施分析点击了PC录入的需求,或者个人档案进来的(这两种情况肯定会有icResiUserId)
if(StringUtils.isNotBlank(formDTO.getIcResiUserId())){ if(StringUtils.isNotBlank(formDTO.getIcResiUserId())){
Result<IcResiUserBriefDTO> userRes = epmetUserOpenFeignClient.findFamilyMem(formDTO.getIcResiUserId()); Result<IcResiUserBriefDTO> userRes = epmetUserOpenFeignClient.findFamilyMem(formDTO.getIcResiUserId());
if (!userRes.success() || null == userRes.getData()) { if (!userRes.success() || null == userRes.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民信息接口异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取居民信息接口异常");
} }
houseMemResDTO=ConvertUtils.sourceToTarget(userRes.getData(),HouseMemResDTO.class); houseMemResDTO=ConvertUtils.sourceToTarget(userRes.getData(),HouseMemResDTO.class);
} }
@ -668,7 +667,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
findIcUserFormDTO.setEpmetUserId(formDTO.getEpmetUserIdList().get(NumConstant.ZERO)); findIcUserFormDTO.setEpmetUserId(formDTO.getEpmetUserIdList().get(NumConstant.ZERO));
Result<EpmetUserFamilyDTO> epmetUserFamilyDTOResult=epmetUserOpenFeignClient.findIcUser(findIcUserFormDTO); Result<EpmetUserFamilyDTO> epmetUserFamilyDTOResult=epmetUserOpenFeignClient.findIcUser(findIcUserFormDTO);
if (!epmetUserFamilyDTOResult.success() || null == epmetUserFamilyDTOResult.getData()) { if (!epmetUserFamilyDTOResult.success() || null == epmetUserFamilyDTOResult.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据小程序用户id,获取ic居民信息接口异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "根据小程序用户id,获取ic居民信息接口异常");
} }
houseMemResDTO=ConvertUtils.sourceToTarget(epmetUserFamilyDTOResult.getData(),HouseMemResDTO.class); houseMemResDTO=ConvertUtils.sourceToTarget(epmetUserFamilyDTOResult.getData(),HouseMemResDTO.class);
formDTO.setEpmetUserIdList(epmetUserFamilyDTOResult.getData().getEpmetUserIdList()); formDTO.setEpmetUserIdList(epmetUserFamilyDTOResult.getData().getEpmetUserIdList());
@ -688,7 +687,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//找到当前组织的所有上级,再拼接上自己 //找到当前组织的所有上级,再拼接上自己
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()); Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId());
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){ if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById");
} }
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){ if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){
//当前传入的组织id=客户的根组织 //当前传入的组织id=客户的根组织
@ -726,7 +725,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
if(CollectionUtils.isNotEmpty(userIdList)){ if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList));
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){
throw new RenException("查询志愿者信息异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询志愿者信息异常");
} }
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName));
} }
@ -784,7 +783,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//2、没有服务类型直接退出 //2、没有服务类型直接退出
Result<Map<String, String>> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode()); Result<Map<String, String>> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode());
if(!serviceTypeRes.success()||MapUtils.isEmpty(serviceTypeRes.getData())){ if(!serviceTypeRes.success()||MapUtils.isEmpty(serviceTypeRes.getData())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"查询服务方类型异常,请检查是否已经配置字典信息"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询服务方类型异常,请检查是否已经配置字典信息");
} }
List<LegendDTO> legend=new ArrayList<>(); List<LegendDTO> legend=new ArrayList<>();
serviceTypeRes.getData().forEach((code,name)->{ serviceTypeRes.getData().forEach((code,name)->{
@ -800,7 +799,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//找到当前组织的所有上级,再拼接上自己 //找到当前组织的所有上级,再拼接上自己
Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()); Result<CustomerAgencyDTO> customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId());
if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){ if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById");
} }
if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){ if(NumConstant.ZERO_STR.equals(customerAgencyDTOResult.getData().getPid())){
//当前传入的组织id=客户的根组织 //当前传入的组织id=客户的根组织
@ -950,11 +949,11 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
public TakeOrderResultDTO takeOrder(TakeOrderFormDTO formDTO) { public TakeOrderResultDTO takeOrder(TakeOrderFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) { if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
} }
if (!UserDemandConstant.PENDING.equals(entity.getStatus())) { if (!UserDemandConstant.PENDING.equals(entity.getStatus())) {
//待处理的才可以抢单 //待处理的才可以抢单
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_TAKE_ORDER.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_TAKE_ORDER.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("需求当前状态为【%s】,不可接单",entity.getStatus()), "当前状态不可接单");
} }
TakeOrderResultDTO takeOrderResultDTO=new TakeOrderResultDTO(); TakeOrderResultDTO takeOrderResultDTO=new TakeOrderResultDTO();
//只有志愿者才可以接单 //只有志愿者才可以接单
@ -1010,11 +1009,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
public FinishResultDTO evaluate(EvaluateDemandFormDTO formDTO) { public FinishResultDTO evaluate(EvaluateDemandFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) { if (null == entity) {
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "需求不存在", EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
} }
if (!UserDemandConstant.FINISHED.equals(entity.getStatus())) { if (!UserDemandConstant.FINISHED.equals(entity.getStatus())) {
// 已完成的可以评价 throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务未完成,不可评价", "服务未完成,不可评价");
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_EVALUATE.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_EVALUATE.getMsg());
} }
// todo 只有需求人才可以评价 // todo 只有需求人才可以评价
@ -1169,7 +1167,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
if(CollectionUtils.isNotEmpty(userIdList)){ if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList));
if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"查询志愿者信息异常","服务方查询异常"); throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"查询志愿者信息异常");
} }
userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, o -> o, (o1, o2) -> o1)); userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, o -> o, (o1, o2) -> o1));
} }

27
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml

@ -256,33 +256,6 @@
</select> </select>
<resultMap id="DemandCategoryResMap" type="com.epmet.dto.result.demand.DemandCategoryResDTO">
<result column="ID" property="categoryId"/>
<result column="CATEGORY_CODE" property="categoryCode"/>
<result column="PARENT_CODE" property="parentCode"/>
<result column="CATEGORY_NAME" property="categoryName"/>
<result column="CUSTOMER_ID" property="customerId"/>
<collection property="children" ofType="com.epmet.dto.result.demand.DemandCategoryResDTO"
select="queryCategoryList" column="customerId=customerId,parentCode=PARENT_CODE">
</collection>
</resultMap>
<!-- 居民端-我有需求 分类列表 -->
<select id="queryCategoryList" parameterType="map" resultMap="DemandCategoryResMap">
select
ID,
CATEGORY_CODE,
PARENT_CODE,
CATEGORY_NAME,
CUSTOMER_ID
from ic_resi_demand_dict
where del_flag='0'
AND USABLE_FLAG='1'
and customer_id = #{customerId}
and PARENT_CODE = #{parentCode}
ORDER BY SORT ASC
</select>
<!-- 查询分类信息,限制未被禁用的 --> <!-- 查询分类信息,限制未被禁用的 -->
<select id="selectListByCodes" parameterType="map" resultType="com.epmet.dto.result.demand.DemandCategoryResDTO"> <select id="selectListByCodes" parameterType="map" resultType="com.epmet.dto.result.demand.DemandCategoryResDTO">
select select

Loading…
Cancel
Save