Browse Source

保存需求

master
yinzuomei 4 years ago
parent
commit
ab85110bb3
  1. 9
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandOperateLogDTO.java
  2. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandRecDTO.java
  3. 113
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandAddFromDTO.java
  4. 10
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandRecId.java
  5. 78
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/UserDemandPageFormDTO.java
  6. 44
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/DemandRecResultDTO.java
  7. 38
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java
  8. 36
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  9. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandOperateLogEntity.java
  10. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandRecEntity.java
  11. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  12. 66
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

9
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandOperateLogDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -59,7 +60,7 @@ public class IcUserDemandOperateLogDTO implements Serializable {
private String userId;
/**
* 创建需求create;撤销需求cancel;指派assign;接单take_order;完成finish;评价evaluate
* 创建需求create;撤销需求cancel;指派assign;接单take_order;完成finish;
*/
private String actionCode;
@ -98,9 +99,5 @@ public class IcUserDemandOperateLogDTO implements Serializable {
*/
private Date updatedTime;
/**
*
*/
private String userName;
}

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandRecDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -142,7 +143,7 @@ public class IcUserDemandRecDTO implements Serializable {
/**
* 1已评价0未评价;评价后ic_user_satisfaction表有记录
*/
private Integer evaluateFlag;
private Boolean evaluateFlag;
/**
* 删除标识0.未删除 1.已删除

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

@ -0,0 +1,113 @@
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.util.Date;
@Data
public class DemandAddFromDTO implements Serializable {
private static final long serialVersionUID = 1589287946950749226L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
private String customerId;
private String currentUserId;
/**
* 网格id
*/
@NotBlank(message = "所属网格不能为空",groups = AddUserShowGroup.class)
private String gridId;
/**
* 组织id
*/
private String agencyId;
/**
* 网格的所有上级id
*/
private String gridPids;
/**
* 二级需求分类编码
*/
@NotBlank(message = "需求类型不能为空",groups = AddUserShowGroup.class)
private String categoryCode;
/**
* 父级需求分类编码
*/
@NotBlank(message = "需求类型不能为空",groups = AddUserShowGroup.class)
private String parentCode;
/**
* 需求内容1000字
*/
@NotBlank(message = "需求类型不能为空",groups = AddUserShowGroup.class)
private String content;
/**
* 社区帮办community楼长帮办building_caption;党员帮办party;自身上报self_help
*/
@NotBlank(message = "上报类型不能为空",groups = AddUserShowGroup.class)
private String reportType;
/**
* 上报人姓名
*/
@NotBlank(message = "上报人不能为空",groups = AddUserShowGroup.class)
private String reportUserName;
/**
* 上报人联系方式自身上报时存储注册居民的手机号
*/
@NotBlank(message = "上报人联系方式不能为空",groups = AddUserShowGroup.class)
private String reportUserMobile;
/**
* 上报时间
*/
@NotNull(message = "上报时间不能为空",groups = AddUserShowGroup.class)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reportTime;
/**
* 需求人user.id或者ic_resi_user.id
*/
@NotNull(message = "需求人不能为空",groups = AddUserShowGroup.class)
private String demandUserId;
/**
* 需求人姓名
*/
@NotNull(message = "需求人不能为空",groups = AddUserShowGroup.class)
private String demandUserName;
/**
* 需求人联系电话
*/
@NotNull(message = "需求人不能为空",groups = AddUserShowGroup.class)
private String demandUserMobile;
/**
* 希望服务时间
*/
@NotNull(message = "服务时间不能为空",groups = AddUserShowGroup.class)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date wantServiceTime;
}

10
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/DemandRecId.java

@ -0,0 +1,10 @@
package com.epmet.dto.form.demand;
import lombok.Data;
import java.io.Serializable;
@Data
public class DemandRecId implements Serializable {
private String demandRecId;
}

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

@ -0,0 +1,78 @@
package com.epmet.dto.form.demand;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class UserDemandPageFormDTO extends PageFormDTO implements Serializable {
private String customerId;
private String currentStaffId;
private String gridPids;
/**
* 网格id
*/
private String gridId;
/**
* 分类的编码
*/
private String categoryCode;
/**
* 分类的级别
*/
private Integer level;
/**
* 需求人姓名
*/
private String demandUserName;
/**
* 上报时间开始
*/
private Date reportStartTime;
/**
* 上报时间截止
*/
private Date reportEndTime;
/**
* 待处理pending已取消canceled已派单assigned已接单have_order已完成finished
*/
private String status;
/**
* 服务方类型志愿者volunteer社会组织social_org社区自组织community_org区域党建单位party_unit
*/
private String serviceType;
/**
* 服务方id
*/
private String serverId;
/**
* 希望服务时间开始
*/
private Date wantServiceStartTime;
/**
* 希望截止
*/
private Date wantServiceEndTime;
}

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

@ -0,0 +1,44 @@
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.util.Date;
@Data
public class DemandRecResultDTO implements Serializable {
private static final long serialVersionUID = 1140730681599839420L;
private String demandRecId;
@JsonIgnore
private String gridId;
private String gridName;
@JsonIgnore
private String categoryCode;
@JsonIgnore
private String parentCode;
private String categoryName;
private String content;
private String reportType;
private String reportUserName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date reportTime;
private String demandUserName;
@JsonIgnore
private String serviceType;
@JsonIgnore
private String serverId;
private String serviceName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String wantServiceTime;
private String status;
}

38
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/UserDemandConstant.java

@ -0,0 +1,38 @@
package com.epmet.constant;
public interface UserDemandConstant {
/**
* 小程序用户自己上报mini_resi居民信息录入的居民ic_resi_user
*/
String MINI_RESI = "mini_resi";
String IC_RESI_USER = "ic_resi_user";
/**
* 待处理pending已取消canceled已派单assigned已接单have_order已完成finished
*/
String PENDING = "pending";
String CANCELED = "canceled";
String ASSIGNED = "assigned";
String HAVE_ORDER = "have_order";
String FINISHED = "finished";
/**
* 当前操作用户属于哪个端工作端staff居民端resi
*/
String STAFF="staff";
String RESI="resi";
/**
* 创建需求create;撤销需求cancel;指派assign;接单take_order;完成finish;
*/
String CREATE="create";
String CANCEL="cancel";
String ASSIGN="assign";
String TAKE_ORDER="take_order";
String FINISH="finish";
}

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

@ -17,8 +17,19 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.demand.DemandAddFromDTO;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.service.IcUserDemandRecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -37,5 +48,30 @@ public class IcUserDemandRecController {
private IcUserDemandRecService icUserDemandRecService;
/**
* 新增需求
*
* @param tokenDto
* @param fromDTO
* @return
*/
@PostMapping("add")
public Result<DemandRecId> add(@LoginUser TokenDto tokenDto, @RequestBody DemandAddFromDTO fromDTO){
fromDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(fromDTO,DemandAddFromDTO.AddUserShowGroup.class);
return new Result<DemandRecId>().ok(icUserDemandRecService.add(fromDTO));
}
/**
* 列表查询 分页
* @param tokenDto
* @param formDTO
* @return
*/
public Result<PageData<DemandRecResultDTO>> pageList(@LoginUser TokenDto tokenDto, @RequestBody UserDemandPageFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCurrentStaffId(tokenDto.getUserId());
return new Result<PageData<DemandRecResultDTO>>().ok(icUserDemandRecService.pageList(formDTO));
}
}

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandOperateLogEntity.java

@ -59,7 +59,7 @@ public class IcUserDemandOperateLogEntity extends BaseEpmetEntity {
private String userId;
/**
* 创建需求create;撤销需求cancel;指派assign;接单take_order;完成finish;评价evaluate
* 创建需求create;撤销需求cancel;指派assign;接单take_order;完成finish;
*/
private String actionCode;
@ -68,9 +68,4 @@ public class IcUserDemandOperateLogEntity extends BaseEpmetEntity {
*/
private Date operateTime;
/**
*
*/
private String userName;
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandRecEntity.java

@ -18,7 +18,6 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -142,6 +141,6 @@ public class IcUserDemandRecEntity extends BaseEpmetEntity {
/**
* 1已评价0未评价;评价后ic_user_satisfaction表有记录
*/
private Integer evaluateFlag;
private Boolean evaluateFlag;
}

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

@ -20,6 +20,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.demand.DemandAddFromDTO;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.entity.IcUserDemandRecEntity;
import java.util.List;
@ -92,4 +96,14 @@ public interface IcUserDemandRecService extends BaseService<IcUserDemandRecEntit
* @date 2021-11-19
*/
void delete(String[] ids);
/**
* 新增需求
*
* @param fromDTO
* @return
*/
DemandRecId add(DemandAddFromDTO fromDTO);
PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO);
}

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

@ -21,17 +21,34 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserDemandConstant;
import com.epmet.dao.IcUserDemandOperateLogDao;
import com.epmet.dao.IcUserDemandRecDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.demand.DemandAddFromDTO;
import com.epmet.dto.form.demand.DemandRecId;
import com.epmet.dto.form.demand.UserDemandPageFormDTO;
import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.entity.IcUserDemandOperateLogEntity;
import com.epmet.entity.IcUserDemandRecEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.IcUserDemandRecService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -43,6 +60,11 @@ import java.util.Map;
*/
@Service
public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecDao, IcUserDemandRecEntity> implements IcUserDemandRecService {
@Autowired
private IcUserDemandOperateLogDao operateLogDao;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override
public PageData<IcUserDemandRecDTO> page(Map<String, Object> params) {
@ -96,4 +118,48 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 新增需求
*
* @param fromDTO
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public DemandRecId add(DemandAddFromDTO fromDTO) {
CustomerGridFormDTO customerGridFormDTO=new CustomerGridFormDTO();
customerGridFormDTO.setGridId(fromDTO.getGridId());
Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO);
if(!gridInfoRes.success()||null==gridInfoRes.getData()){
throw new RenException("查询网格信息失败");
}
IcUserDemandRecEntity insertEntity=ConvertUtils.sourceToTarget(fromDTO,IcUserDemandRecEntity.class);
insertEntity.setAgencyId(gridInfoRes.getData().getPid());
insertEntity.setGridPids(gridInfoRes.getData().getPids());
insertEntity.setDemandUserType(UserDemandConstant.IC_RESI_USER);
insertEntity.setStatus(UserDemandConstant.PENDING);
insertEntity.setEvaluateFlag(false);
baseDao.insert(insertEntity);
IcUserDemandOperateLogEntity logEntity=new IcUserDemandOperateLogEntity();
logEntity.setCustomerId(fromDTO.getCustomerId());
logEntity.setDemandRecId(insertEntity.getId());
logEntity.setUserType(UserDemandConstant.STAFF);
logEntity.setUserId(fromDTO.getCurrentUserId());
logEntity.setActionCode(UserDemandConstant.CREATE);
logEntity.setOperateTime(new Date());
operateLogDao.insert(logEntity);
DemandRecId resultDto=new DemandRecId();
resultDto.setDemandRecId(insertEntity.getId());
return resultDto;
}
@Override
public PageData<DemandRecResultDTO> pageList(UserDemandPageFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId());
String gridPids=staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId());
formDTO.setGridPids(formDTO.getGridPids());
// todo
return null;
}
}
Loading…
Cancel
Save