Browse Source

Merge remote-tracking branch 'origin/dev_epidemic_situation' into develop

dev
yinzuomei 4 years ago
parent
commit
38981500c9
  1. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java
  2. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  3. 115
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java
  4. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyReportedTripFormDTO.java
  5. 35
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  6. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java
  7. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java
  8. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java
  9. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java
  10. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java
  11. 55
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java
  12. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml
  13. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

5
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/IcResiUserConstant.java

@ -8,4 +8,9 @@ package com.epmet.constant;
public interface IcResiUserConstant {
String IC_RESI_USER = "ic_resi_user";
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
*/
String USER_TYPE_RESI="resi";
String USER_TYPE_IC_RESI="icresi";
}

20
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
@ -22,6 +23,21 @@ public class IcTripReportRecordDTO implements Serializable {
*/
private String id;
/**
* 居民端用户所在网格id,数字社区居民所属网格id
*/
private String gridId;
/**
* 居民端上报的存储用户所在网格的组织id;
*/
private String agencyId;
/**
* agency_id的所有上级
*/
private String pids;
/**
* 客户Id
*/
@ -80,11 +96,13 @@ public class IcTripReportRecordDTO implements Serializable {
/**
* 到达日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date arriveDate;
/**
* 离开日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date leaveDate;
/**
@ -122,4 +140,6 @@ public class IcTripReportRecordDTO implements Serializable {
*/
private Date updatedTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date reportTime;
}

115
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java

@ -0,0 +1,115 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* 行程上报居民端入参
*/
@Data
public class IcTripReportFormDTO implements Serializable {
public interface ResiUserInternalGroup {
}
public interface ResiUserRequired extends CustomerClientShowGroup {
}
/**
* 客户Id
*/
private String customerId;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空", groups = {ResiUserRequired.class})
private String name;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {ResiUserRequired.class})
private String mobile;
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class})
private String idCard;
/**
* 现居地编码
*/
@NotBlank(message = "现居地编码不能为空", groups = {ResiUserRequired.class})
private String presentAddressCode;
/**
* 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区
*/
@NotBlank(message = "现居地名称不能为空", groups = {ResiUserRequired.class})
private String presentAddress;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空", groups = {ResiUserRequired.class})
private String detailAddress;
/**
* 来源地区编码
*/
@NotBlank(message = "来自地区编码不能为空", groups = {ResiUserRequired.class})
private String sourceAddressCode;
/**
* 来源地区地址
*/
@NotBlank(message = "来自地区名称不能为空", groups = {ResiUserRequired.class})
private String sourceAddress;
/**
* 到达日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@NotNull(message = "来到本地时间不能为空", groups = {ResiUserRequired.class})
private Date arriveDate;
/**
* 离开日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date leaveDate;
/**
* 备注信息
*/
@Length(max = 500, message = "备注最多可输入500字", groups = {ResiUserRequired.class})
private String remark;
@NotBlank(message = "网格不能为空", groups = {ResiUserInternalGroup.class})
private String gridId;
//后端自己赋值
/**
* 用户id
*/
private String userId;
/**
* 居民端小程序的人resi;数字社区的居民icresi;未关联上的other
*/
private String userType;
}

13
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MyReportedTripFormDTO.java

@ -0,0 +1,13 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
/**
* 居民端小程序我的上报
*/
@Data
public class MyReportedTripFormDTO extends PageFormDTO {
private String userId;
private String customerId;
}

35
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java

@ -1,18 +1,25 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.dto.form.PageFormDTO;
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.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.service.IcTripReportRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -23,7 +30,7 @@ import java.util.Map;
* @since v1.0.0 2022-03-25
*/
@RestController
@RequestMapping("triprecord")
@RequestMapping("tripreport")
public class IcTripReportRecordController {
@Autowired
@ -67,6 +74,32 @@ public class IcTripReportRecordController {
return new Result();
}
/**
* 居民端小程序上报行程
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("resi-save")
public Result resiSave(@LoginUser TokenDto tokenDto, @RequestBody IcTripReportFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
formDTO.setUserType(IcResiUserConstant.USER_TYPE_RESI);
ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.ResiUserRequired.class,IcTripReportFormDTO.ResiUserInternalGroup.class);
return new Result().ok(icTripReportRecordService.resiSave(formDTO));
}
/**
* 居民端小程序我的上报
* @param tokenDto
* @return
*/
@PostMapping("resi-list")
public Result<List<IcTripReportRecordDTO>> resiList(@LoginUser TokenDto tokenDto,@RequestBody MyReportedTripFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
return new Result<List<IcTripReportRecordDTO>>().ok(icTripReportRecordService.resiList(formDTO));
}
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcTripReportRecordDao.java

@ -1,8 +1,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.entity.IcTripReportRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 行程上报信息
@ -12,5 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcTripReportRecordDao extends BaseDao<IcTripReportRecordEntity> {
List<IcTripReportRecordDTO> selectMyReported(@Param("userId") String userId, @Param("customerId") String customerId, @Param("idCard") String idCard);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java

@ -90,4 +90,6 @@ public interface UserBaseInfoDao extends BaseDao<UserBaseInfoEntity> {
Integer selectCountIdNum(@Param("idNum") String idNum,
@Param("customerId")String customerId,
@Param("excludeUserId")String excludeUserId);
String selectIdCard(String userId);
}

15
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java

@ -21,6 +21,21 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 居民端用户所在网格id,数字社区居民所属网格id
*/
private String gridId;
/**
* 居民端上报的存储用户所在网格的组织id;
*/
private String agencyId;
/**
* agency_id的所有上级
*/
private String pids;
/**
* 客户Id
*/

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java

@ -3,6 +3,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.entity.IcTripReportRecordEntity;
import java.util.List;
@ -75,4 +77,18 @@ public interface IcTripReportRecordService extends BaseService<IcTripReportRecor
* @date 2022-03-25
*/
void delete(String[] ids);
/**
* 居民端小程序上报行程
* @param formDTO
* @return
*/
String resiSave(IcTripReportFormDTO formDTO);
/**
* 居民端小程序我的上报
* @param formDTO
* @return
*/
List<IcTripReportRecordDTO> resiList(MyReportedTripFormDTO formDTO);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java

@ -155,6 +155,7 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void saveResi(ResiCollectFormDTO formDTO) {
IcResiCollectEntity origin = baseDao.selectByAddress(formDTO.getAddress());

55
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

@ -4,13 +4,24 @@ 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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcTripReportRecordDao;
import com.epmet.dao.UserBaseInfoDao;
import com.epmet.dto.IcTripReportRecordDTO;
import com.epmet.dto.form.IcTripReportFormDTO;
import com.epmet.dto.form.MyReportedTripFormDTO;
import com.epmet.entity.IcTripReportRecordEntity;
import com.epmet.service.IcTripReportRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -26,7 +37,8 @@ import java.util.Map;
*/
@Service
public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportRecordDao, IcTripReportRecordEntity> implements IcTripReportRecordService {
@Autowired
private UserBaseInfoDao userBaseInfoDao;
@Override
public PageData<IcTripReportRecordDTO> page(Map<String, Object> params) {
@ -80,4 +92,45 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 居民端小程序上报行程
*
* @param formDTO
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public String resiSave(IcTripReportFormDTO formDTO) {
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(formDTO.getGridId());
if (null == gridInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询网格信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(gridInfoCache.getPid());
if (null == agencyInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class);
entity.setAgencyId(gridInfoCache.getPid());
entity.setPids(agencyInfoCache.getPids());
insert(entity);
return entity.getId();
}
/**
* 居民端小程序我的上报
*
* @param formDTO
* @return
*/
@Override
public List<IcTripReportRecordDTO> resiList(MyReportedTripFormDTO formDTO) {
String idCard=userBaseInfoDao.selectIdCard(formDTO.getUserId());
PageInfo<IcTripReportRecordDTO> result = PageHelper.startPage(formDTO.getPageNo(),
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectMyReported(formDTO.getUserId(),
formDTO.getCustomerId(),idCard));
return result.getList();
}
}

17
epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml

@ -3,6 +3,23 @@
<mapper namespace="com.epmet.dao.IcTripReportRecordDao">
<select id="selectMyReported" parameterType="map" resultType="com.epmet.dto.IcTripReportRecordDTO">
SELECT
r.*,
r.CREATED_TIME AS reportTime
FROM
ic_trip_report_record r
WHERE
r.DEL_FLAG = '0'
AND r.CUSTOMER_ID = #{customerId}
AND ( r.CREATED_BY = #{userId}
<if test='null != idCard and "" != idCard'>
OR r.ID_CARD = #{idCard}
</if>
)
ORDER BY
r.CREATED_TIME DESC
</select>
</mapper>

10
epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

@ -143,4 +143,14 @@
AND ubi.user_id != #{excludeUserId}
</if>
</select>
<select id="selectIdCard" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
ubi.ID_NUM
FROM
user_base_info ubi
WHERE
ubi.USER_ID = #{userId}
AND ubi.DEL_FLAG = '0'
</select>
</mapper>

Loading…
Cancel
Save