Browse Source

错误码

dev_shibei_match
yinzuomei 4 years ago
parent
commit
fa76c7b175
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 31
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/AssignFormDTO.java
  3. 4
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandAddFromDTO.java
  4. 48
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java
  5. 17
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/StaffCancelFormDTO.java
  6. 13
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandPageFormDTO.java
  7. 16
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java
  8. 57
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  9. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java
  10. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandServiceDao.java
  11. 27
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  12. 172
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  13. 61
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml
  14. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandServiceDao.xml

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

@ -83,6 +83,10 @@ public enum EpmetErrorCode {
DOOR_NAME_EXITED(8216,"门牌号已存在"), DOOR_NAME_EXITED(8216,"门牌号已存在"),
NEIGHBOOR_NAME_EXITED(8217,"小区名称已存在"), NEIGHBOOR_NAME_EXITED(8217,"小区名称已存在"),
DEMAND_NAME_EXITED(8218, "分类名称已存在"), DEMAND_NAME_EXITED(8218, "分类名称已存在"),
DEMAND_CAN_NOT_CANCEL(8219, "需求已完成,不可取消"),
DEMAND_CAN_NOT_ASSIGN(8220, "当前状态,不可指派"),
DEMAND_CAN_NOT_FINISH(8221, "当前状态,不能评价"),
DEMAND_FINISHED(8222,"需求已完成"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"), REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),
THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"), THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"),

31
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/AssignFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form.demand;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
public class AssignFormDTO implements Serializable {
private static final long serialVersionUID = -8844710824469349121L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "需求id不能为空", groups = AddUserInternalGroup.class)
private String demandRecId;
@NotBlank(message = "服务方类型不能为空", groups = AddUserShowGroup.class)
private String serviceType;
@NotBlank(message = "服务方不能为空", groups = AddUserShowGroup.class)
private String serverId;
@NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class)
private String userId;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

4
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandAddFromDTO.java

@ -2,6 +2,7 @@ package com.epmet.dto.form.demand;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@ -58,7 +59,8 @@ public class DemandAddFromDTO implements Serializable {
/** /**
* 需求内容1000字 * 需求内容1000字
*/ */
@NotBlank(message = "需求类型不能为空",groups = AddUserShowGroup.class) @NotBlank(message = "需求内容不能为空",groups = AddUserShowGroup.class)
@Length(max = 1000,message = "需求内容至多输入1000字",groups = AddUserShowGroup.class)
private String content; private String content;
/** /**

48
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/FinishStaffFromDTO.java

@ -0,0 +1,48 @@
package com.epmet.dto.form.demand;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class FinishStaffFromDTO implements Serializable {
private static final long serialVersionUID = 591380873862126679L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "需求id不能为空", groups = AddUserInternalGroup.class)
private String demandRecId;
@NotBlank(message = "服务方不能为空", groups = AddUserShowGroup.class)
private String serverId;
@NotNull(message = "实际服务开始不能为空", groups = AddUserShowGroup.class)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date serviceStartTime;
@NotNull(message = "实际服务结束不能为空", groups = AddUserShowGroup.class)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date serviceEndTime;
@NotBlank(message = "完成结果不能为空", groups = AddUserShowGroup.class)
private String finishResult;
private String finishDesc;
@NotNull(message = "得分不能为空", groups = AddUserShowGroup.class)
private BigDecimal score;
@NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class)
private String userId;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

17
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/StaffCancelFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.form.demand;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class StaffCancelFormDTO {
public interface AddUserInternalGroup {}
@NotBlank(message = "需求id不能为空",groups = AddUserInternalGroup.class)
private String demandRecId;
@NotBlank(message = "userId不能为空", groups =AddUserInternalGroup.class)
private String userId;
@NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class)
private String customerId;
}

13
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandPageFormDTO.java

@ -2,6 +2,7 @@ package com.epmet.dto.form.demand;
import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@ -41,12 +42,14 @@ public class UserDemandPageFormDTO extends PageFormDTO implements Serializable {
/** /**
* 上报时间开始 * 上报时间开始
*/ */
private Date reportStartTime; @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date reportStartDate;
/** /**
* 上报时间截止 * 上报时间截止
*/ */
private Date reportEndTime; @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date reportEndDate;
/** /**
* 待处理pending已取消canceled已派单assigned已接单have_order已完成finished * 待处理pending已取消canceled已派单assigned已接单have_order已完成finished
@ -69,10 +72,12 @@ public class UserDemandPageFormDTO extends PageFormDTO implements Serializable {
/** /**
* 希望服务时间开始 * 希望服务时间开始
*/ */
private Date wantServiceStartTime; @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date wantServiceStartDate;
/** /**
* 希望截止 * 希望截止
*/ */
private Date wantServiceEndTime; @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date wantServiceEndDate;
} }

16
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java

@ -19,26 +19,30 @@ public class DemandRecResultDTO implements Serializable {
@JsonIgnore @JsonIgnore
private String categoryCode; private String categoryCode;
@JsonIgnore
private String parentCode;
private String categoryName; private String categoryName;
private String content; private String content;
private String reportType; private String reportType;
private String reportUserName; private String reportUserName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date reportTime; private Date reportTime;
private String demandUser;
private String demandUserName; private String demandUserName;
private String demandUserMobile;
@JsonIgnore @JsonIgnore
private String serviceType; private String serviceType;
@JsonIgnore @JsonIgnore
private String serverId; private String serverId;
private String serviceName; private String serviceName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private String wantServiceTime; private String wantServiceTime;
private String status; private String status;
private String statusName;
} }

57
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java

@ -23,10 +23,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.UserDemandConstant; import com.epmet.constant.UserDemandConstant;
import com.epmet.dto.form.demand.DemandAddFromDTO; import com.epmet.dto.form.demand.*;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.service.*; import com.epmet.service.*;
@ -108,9 +105,61 @@ public class IcUserDemandRecController {
* @param formDTO * @param formDTO
* @return * @return
*/ */
@PostMapping("pagelist")
public Result<PageData<DemandRecResultDTO>> pageList(@LoginUser TokenDto tokenDto, @RequestBody UserDemandPageFormDTO formDTO){ public Result<PageData<DemandRecResultDTO>> pageList(@LoginUser TokenDto tokenDto, @RequestBody UserDemandPageFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCurrentStaffId(tokenDto.getUserId()); formDTO.setCurrentStaffId(tokenDto.getUserId());
return new Result<PageData<DemandRecResultDTO>>().ok(icUserDemandRecService.pageList(formDTO)); return new Result<PageData<DemandRecResultDTO>>().ok(icUserDemandRecService.pageList(formDTO));
} }
/**
* 取消未完成之前都可以取消
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("cancel")
public Result cancel(@LoginUser TokenDto tokenDto,@RequestBody StaffCancelFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,StaffCancelFormDTO.AddUserInternalGroup.class);
icUserDemandRecService.cancel(formDTO);
return new Result();
}
/**
* 指派
* 待处理pending已取消canceled已派单assigned已接单have_order已完成finished
* 待处理+已派单才可以指派
*
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("assign")
public Result assign(@LoginUser TokenDto tokenDto,@RequestBody AssignFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO,AssignFormDTO.AddUserShowGroup.class,AssignFormDTO.AddUserInternalGroup.class);
icUserDemandRecService.assign(formDTO);
return new Result();
}
/**
* 完成并评价
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("finish")
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);
icUserDemandRecService.finish(formDTO);
return new Result();
}
} }

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

@ -18,9 +18,13 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.entity.IcUserDemandRecEntity; import com.epmet.entity.IcUserDemandRecEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 居民需求记录表 * 居民需求记录表
* *
@ -29,5 +33,7 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface IcUserDemandRecDao extends BaseDao<IcUserDemandRecEntity> { public interface IcUserDemandRecDao extends BaseDao<IcUserDemandRecEntity> {
List<DemandRecResultDTO> pageSelect(UserDemandPageFormDTO formDTO);
} }

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandServiceDao.java

@ -29,5 +29,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface IcUserDemandServiceDao extends BaseDao<IcUserDemandServiceEntity> { public interface IcUserDemandServiceDao extends BaseDao<IcUserDemandServiceEntity> {
IcUserDemandServiceEntity selectByRecId(String demandRecId);
} }

27
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java

@ -20,9 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.demand.DemandAddFromDTO; import com.epmet.dto.form.demand.*;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.entity.IcUserDemandRecEntity; import com.epmet.entity.IcUserDemandRecEntity;
@ -106,4 +104,27 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
DemandRecId add(DemandAddFromDTO fromDTO); DemandRecId add(DemandAddFromDTO fromDTO);
PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO); PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO);
/**
* 未完成之前都可以取消
*
* @param formDTO
*/
void cancel(StaffCancelFormDTO formDTO);
/**
* 指派
* 待处理pending已取消canceled已派单assigned已接单have_order已完成finished
* 待处理+已派单才可以指派
*
* @param formDTO
* @return
*/
void assign(AssignFormDTO formDTO);
/**
* 完成并评价
* @param formDTO
*/
void finish(FinishStaffFromDTO formDTO);
} }

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

@ -23,6 +23,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
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.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
@ -31,17 +32,22 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserDemandConstant; import com.epmet.constant.UserDemandConstant;
import com.epmet.dao.IcUserDemandOperateLogDao; import com.epmet.dao.IcUserDemandOperateLogDao;
import com.epmet.dao.IcUserDemandRecDao; import com.epmet.dao.IcUserDemandRecDao;
import com.epmet.dao.IcUserDemandSatisfactionDao;
import com.epmet.dao.IcUserDemandServiceDao;
import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.demand.DemandAddFromDTO; import com.epmet.dto.form.demand.*;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.entity.IcUserDemandOperateLogEntity; import com.epmet.entity.IcUserDemandOperateLogEntity;
import com.epmet.entity.IcUserDemandRecEntity; import com.epmet.entity.IcUserDemandRecEntity;
import com.epmet.entity.IcUserDemandSatisfactionEntity;
import com.epmet.entity.IcUserDemandServiceEntity;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.IcUserDemandRecService; import com.epmet.service.IcUserDemandRecService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -63,6 +69,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
@Autowired @Autowired
private IcUserDemandOperateLogDao operateLogDao; private IcUserDemandOperateLogDao operateLogDao;
@Autowired @Autowired
private IcUserDemandServiceDao demandServiceDao;
@Autowired
private IcUserDemandSatisfactionDao demandSatisfactionDao;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@ -155,11 +165,157 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
@Override @Override
public PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO) { public PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId()); CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId());
String gridPids=staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()); if (null == staffInfo) {
formDTO.setGridPids(formDTO.getGridPids()); throw new RenException("工作人员所属组织信息查询异常");
// todo }
return null; if (StringUtils.isBlank(staffInfo.getAgencyPIds())) {
formDTO.setGridPids(staffInfo.getAgencyId());
} else {
if (staffInfo.getAgencyPIds().contains(StrConstant.COLON)) {
formDTO.setGridPids(staffInfo.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfo.getAgencyId()));
}
}
PageInfo<DemandRecResultDTO> pageInfo= PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageSelect(formDTO));
List<DemandRecResultDTO> list=pageInfo.getList();
if(CollectionUtils.isNotEmpty(list)){
/*for(){
}*/
}
return new PageData<>(list, pageInfo.getTotal());
}
/**
* 未完成之前都可以取消
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void cancel(StaffCancelFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) {
throw new RenException("需求不存在");
}
if (UserDemandConstant.FINISH.equals(entity.getStatus())) {
//需求已完成,不可取消
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_CANCEL.getCode(),EpmetErrorCode.DEMAND_CAN_NOT_CANCEL.getMsg());
}
//1、修改主表
//置为取消状态、设置取消时间
entity.setStatus(UserDemandConstant.CANCELED);
entity.setCancelTime(new Date());
baseDao.updateById(entity);
//2、插入操作日志
IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity();
logEntity.setCustomerId(formDTO.getCustomerId());
logEntity.setDemandRecId(formDTO.getDemandRecId());
logEntity.setUserType(UserDemandConstant.STAFF);
logEntity.setUserId(formDTO.getUserId());
logEntity.setActionCode(UserDemandConstant.CANCEL);
logEntity.setOperateTime(entity.getCancelTime());
operateLogDao.insert(logEntity);
}
/**
* 指派
* 待处理pending已取消canceled已派单assigned已接单have_order已完成finished
* 待处理+已派单才可以指派
*
* @param formDTO
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void assign(AssignFormDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) {
throw new RenException("需求不存在");
}
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());
}
//1、修改主表
//置为已派单
entity.setStatus(UserDemandConstant.ASSIGNED);
baseDao.updateById(entity);
//2、插入操作日志
IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity();
logEntity.setCustomerId(formDTO.getCustomerId());
logEntity.setDemandRecId(formDTO.getDemandRecId());
logEntity.setUserType(UserDemandConstant.STAFF);
logEntity.setUserId(formDTO.getUserId());
logEntity.setActionCode(UserDemandConstant.ASSIGN);
logEntity.setOperateTime(new Date());
operateLogDao.insert(logEntity);
//3、插入或更新服务记录
IcUserDemandServiceEntity serviceEntity=ConvertUtils.sourceToTarget(formDTO,IcUserDemandServiceEntity.class);
IcUserDemandServiceEntity origin=demandServiceDao.selectByRecId(formDTO.getDemandRecId());
if (null == origin) {
demandServiceDao.insert(serviceEntity);
}else{
serviceEntity.setId(origin.getId());
serviceEntity.setUpdatedBy(formDTO.getUserId());
demandServiceDao.updateById(serviceEntity);
}
}
/**
* 完成并评价
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void finish(FinishStaffFromDTO formDTO) {
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId());
if (null == entity) {
throw new RenException("需求不存在");
}
if (UserDemandConstant.PENDING.equals(entity.getStatus()) ||UserDemandConstant.CANCELED.equals(entity.getStatus())) {
//待处理或者已取消的不能评价
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getCode(), EpmetErrorCode.DEMAND_CAN_NOT_FINISH.getMsg());
}
if(UserDemandConstant.FINISHED.equals(entity.getStatus()) ){
//已经完成
throw new RenException(EpmetErrorCode.DEMAND_FINISHED.getCode(), EpmetErrorCode.DEMAND_FINISHED.getMsg());
}
//1、修改主表
entity.setStatus(UserDemandConstant.FINISHED);
entity.setFinishResult(formDTO.getFinishResult());
entity.setEvaluateFlag(true);
baseDao.updateById(entity);
//2、插入操作日志
IcUserDemandOperateLogEntity logEntity = new IcUserDemandOperateLogEntity();
logEntity.setCustomerId(formDTO.getCustomerId());
logEntity.setDemandRecId(formDTO.getDemandRecId());
logEntity.setUserType(UserDemandConstant.STAFF);
logEntity.setUserId(formDTO.getUserId());
logEntity.setActionCode(UserDemandConstant.FINISH);
logEntity.setOperateTime(new Date());
operateLogDao.insert(logEntity);
//3、更新服务记录
IcUserDemandServiceEntity serviceEntity=demandServiceDao.selectById(formDTO.getServerId());
serviceEntity.setServiceStartTime(formDTO.getServiceStartTime());
serviceEntity.setServiceEndTime(formDTO.getServiceEndTime());
serviceEntity.setFinishDesc(formDTO.getFinishDesc());
demandServiceDao.updateById(serviceEntity);
//4、插入评价
IcUserDemandSatisfactionEntity satisfactionEntity=new IcUserDemandSatisfactionEntity();
satisfactionEntity.setCustomerId(formDTO.getCustomerId());
satisfactionEntity.setDemandRecId(formDTO.getDemandRecId());
satisfactionEntity.setUserType(UserDemandConstant.STAFF);
satisfactionEntity.setUserId(formDTO.getUserId());
satisfactionEntity.setEvaluateTime(logEntity.getOperateTime());
satisfactionEntity.setScore(formDTO.getScore());
demandSatisfactionDao.insert(satisfactionEntity);
} }
} }

61
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml

@ -34,5 +34,64 @@
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<!-- 列表查询 -->
<select id="pageSelect" parameterType="com.epmet.dto.form.demand.UserDemandPageFormDTO" resultType="com.epmet.dto.result.demand.DemandRecResultDTO">
SELECT
r.id as demandRecId,
r.GRID_ID ,
r.CATEGORY_CODE,
r.CONTENT,
r.REPORT_TYPE,
r.REPORT_TIME,
r.REPORT_USER_NAME,
r.`STATUS`,
r.DEMAND_USER_ID,
r.DEMAND_USER_NAME,
r.DEMAND_USER_MOBILE,
IFNULL( s.SERVICE_TYPE, '' ) AS SERVICE_TYPE,
IFNULL( s.SERVER_ID, '' ) AS SERVER_ID,
r.WANT_SERVICE_TIME
FROM
ic_user_demand_rec r
INNER JOIN ic_user_demand_service s ON ( r.id = s.DEMAND_REC_ID AND s.DEL_FLAG = '0' )
WHERE
r.DEL_FLAG = '0'
AND r.CUSTOMER_ID = #{customerId}
<if test="null != gridId and gridId != '' ">
and r.GRID_ID=#{gridId}
</if>
<if test="null == gridId or gridId == '' ">
AND r.GRID_PIDS LIKE concat('%',#{gridPids},'%')
</if>
<if test="null != level and level ==1">
and r.PARENT_CODE=#{categoryCode}
</if>
<if test="null != level and level ==2">
and r.CATEGORY_CODE=#{categoryCode}
</if>
<if test="null != demandUserName and demandUserName !='' ">
and r.DEMAND_USER_NAME like concat('%',#{demandUserName},'%')
</if>
<if test=" null != reportStartDate and reportStartDate != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{reportStartDate}
</if>
<if test="null != reportEndDate and reportEndDate != '' ">
AND DATE_FORMAT(r.REPORT_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{reportEndDate}
</if>
<if test="null != status and status != '' ">
and r.STATUS=#{status}
</if>
<if test="null != serviceType and serviceType != '' ">
and s.SERVICE_TYPE=#{serviceType}
</if>
<if test="null != serverId and serverId != '' ">
and s.SERVER_ID=#{serverId}
</if>
<if test=" null != wantServiceStartDate and wantServiceStartDate != '' ">
AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{wantServiceStartDate}
</if>
<if test="null != wantServiceEndDate and wantServiceEndDate != '' ">
AND DATE_FORMAT(r.WANT_SERVICE_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{wantServiceEndDate}
</if>
</select>
</mapper> </mapper>

7
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandServiceDao.xml

@ -20,5 +20,10 @@
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<select id="selectByRecId" resultType="com.epmet.entity.IcUserDemandServiceEntity" parameterType="java.lang.String">
select m.*
from ic_user_demand_service m
where m.DEL_FLAG='0'
and m.DEMAND_REC_ID=#{demandRecId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save