Commit ffaaac0a authored by Shen's avatar Shen

1.添加用户收货地址模块

2.新增查询用户地址接口
parent 4f369cd6
package io.hmit.modules.serviceOrder.controller;
import io.hmit.common.annotation.LogOperation;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.ExcelUtils;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.AssertUtils;
import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.excel.PensionConsigneeExcel;
import io.hmit.modules.serviceOrder.service.PensionConsigneeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@RestController
@RequestMapping("serviceOrder/pensionconsignee")
@Api(tags="")
public class PensionConsigneeController {
@Autowired
private PensionConsigneeService pensionConsigneeService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
@RequiresPermissions("serviceOrder:pensionconsignee:page")
public Result<PageData<PensionConsigneeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionConsigneeDTO> page = pensionConsigneeService.page(params);
return new Result<PageData<PensionConsigneeDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@RequiresPermissions("serviceOrder:pensionconsignee:info")
public Result<PensionConsigneeDTO> get(@PathVariable("id") Long id){
PensionConsigneeDTO data = pensionConsigneeService.get(id);
return new Result<PensionConsigneeDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@RequiresPermissions("serviceOrder:pensionconsignee:save")
public Result save(@RequestBody PensionConsigneeDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
pensionConsigneeService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("serviceOrder:pensionconsignee:update")
public Result update(@RequestBody PensionConsigneeDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
pensionConsigneeService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@RequiresPermissions("serviceOrder:pensionconsignee:delete")
public Result delete(@RequestBody Long[] ids){
//校验数据
AssertUtils.isArrayEmpty(ids, "id");
pensionConsigneeService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@RequiresPermissions("serviceOrder:pensionconsignee:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<PensionConsigneeDTO> list = pensionConsigneeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, PensionConsigneeExcel.class);
}
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Mapper
public interface PensionConsigneeDao extends BaseDao<PensionConsigneeEntity> {
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Data
@ApiModel(value = "")
public class PensionConsigneeDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "收货人姓名")
private String consigneeName;
@ApiModelProperty(value = "收货人电话")
private String consigneeMobile;
@ApiModelProperty(value = "省份")
private String consigneeProvince;
@ApiModelProperty(value = "城市")
private String consigneeCity;
@ApiModelProperty(value = "区/县")
private String consigneeDistrict;
@ApiModelProperty(value = "详细地址")
private String consigneeAddress;
@ApiModelProperty(value = "邮编")
private String consigneeZip;
@ApiModelProperty(value = "是否为默认地址")
private Integer ifDefault;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "更新时间")
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pension_consignee")
public class PensionConsigneeEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private Long userId;
/**
* 收货人姓名
*/
private String consigneeName;
/**
* 收货人电话
*/
private String consigneeMobile;
/**
* 省份
*/
private String consigneeProvince;
/**
* 城市
*/
private String consigneeCity;
/**
* 区/县
*/
private String consigneeDistrict;
/**
* 详细地址
*/
private String consigneeAddress;
/**
* 邮编
*/
private String consigneeZip;
/**
* 是否为默认地址
*/
private Integer ifDefault;
/**
* 状态
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 更新时间
*/
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Data
public class PensionConsigneeExcel {
@Excel(name = "")
private Long id;
@Excel(name = "用户ID")
private Long userId;
@Excel(name = "收货人姓名")
private String consigneeName;
@Excel(name = "收货人电话")
private String consigneeMobile;
@Excel(name = "省份")
private String consigneeProvince;
@Excel(name = "城市")
private String consigneeCity;
@Excel(name = "区/县")
private String consigneeDistrict;
@Excel(name = "详细地址")
private String consigneeAddress;
@Excel(name = "邮编")
private String consigneeZip;
@Excel(name = "是否为默认地址")
private Integer ifDefault;
@Excel(name = "状态")
private Integer status;
@Excel(name = "备注")
private String remark;
@Excel(name = "创建时间")
private Date createDate;
@Excel(name = "更新时间")
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.service;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
public interface PensionConsigneeService extends CrudService<PensionConsigneeEntity, PensionConsigneeDTO> {
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionConsigneeDao;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
import io.hmit.modules.serviceOrder.service.PensionConsigneeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Service
public class PensionConsigneeServiceImpl extends CrudServiceImpl<PensionConsigneeDao, PensionConsigneeEntity, PensionConsigneeDTO> implements PensionConsigneeService {
@Override
public QueryWrapper<PensionConsigneeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<PensionConsigneeEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.hmit.modules.serviceOrder.dao.PensionConsigneeDao">
<resultMap type="io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity" id="pensionConsigneeMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="consigneeName" column="consignee_name"/>
<result property="consigneeMobile" column="consignee_mobile"/>
<result property="consigneeProvince" column="consignee_province"/>
<result property="consigneeCity" column="consignee_city"/>
<result property="consigneeDistrict" column="consignee_district"/>
<result property="consigneeAddress" column="consignee_address"/>
<result property="consigneeZip" column="consignee_zip"/>
<result property="ifDefault" column="if_default"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="createDate" column="create_date"/>
<result property="updateDate" column="update_date"/>
</resultMap>
</mapper>
\ No newline at end of file
...@@ -27,7 +27,7 @@ public class SwaggerConfig { ...@@ -27,7 +27,7 @@ public class SwaggerConfig {
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.host("byyl.zjhmit.com") // .host("byyl.zjhmit.com")
.apiInfo(apiInfo()) .apiInfo(apiInfo())
.select() .select()
//加了ApiOperation注解的类,才生成接口文档 //加了ApiOperation注解的类,才生成接口文档
......
...@@ -14,6 +14,7 @@ import io.hmit.entity.UserEntity; ...@@ -14,6 +14,7 @@ import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO; import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO;
import io.hmit.modules.serviceOrder.dto.UserAddressDTO;
import io.hmit.modules.serviceOrder.service.PensionOldFamilyService; import io.hmit.modules.serviceOrder.service.PensionOldFamilyService;
import io.hmit.service.UserService; import io.hmit.service.UserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -98,5 +99,15 @@ public class UserController { ...@@ -98,5 +99,15 @@ public class UserController {
return new Result(); return new Result();
} }
@Login
@GetMapping("findUserAdderss")
@ApiOperation("根据手机号或用户姓名查找用户地址")
public Result<List<UserAddressDTO>> findUserAdderss(@RequestParam("str") String str){
if (str.trim().isEmpty()) {
return new Result<List<UserAddressDTO>>().ok(null);
}
List<UserAddressDTO> userAddressDTOList = userService.findUserAddressByUsernameOrMobile(str);
return new Result<List<UserAddressDTO>>().ok(userAddressDTOList);
}
} }
...@@ -5,6 +5,7 @@ import io.hmit.dto.OrgUserInfoDTO; ...@@ -5,6 +5,7 @@ import io.hmit.dto.OrgUserInfoDTO;
import io.hmit.dto.ServiceUserInfoDTO; import io.hmit.dto.ServiceUserInfoDTO;
import io.hmit.dto.UserRegisterDTO; import io.hmit.dto.UserRegisterDTO;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.UserAddressDTO;
import io.hmit.modules.serviceOrder.dto.UserRoleInfoDTO; import io.hmit.modules.serviceOrder.dto.UserRoleInfoDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -34,4 +35,9 @@ public interface UserDao extends BaseDao<UserEntity> { ...@@ -34,4 +35,9 @@ public interface UserDao extends BaseDao<UserEntity> {
UserRegisterDTO getUserInfoByIdCardNo(Long idCardNo); UserRegisterDTO getUserInfoByIdCardNo(Long idCardNo);
/**
* 根据用户手机号或姓名(模糊)查询用户地址
*/
List<UserAddressDTO> findUserAddressByUsernameOrMobile(String username, String mobile);
} }
package io.hmit.modules.serviceOrder.controller;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.AssertUtils;
import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.service.PensionConsigneeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@RestController
@RequestMapping("serviceOrder/pensionconsignee")
@Api(tags="用户地址")
public class PensionConsigneeController {
@Autowired
private PensionConsigneeService pensionConsigneeService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<PensionConsigneeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionConsigneeDTO> page = pensionConsigneeService.page(params);
return new Result<PageData<PensionConsigneeDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<PensionConsigneeDTO> get(@PathVariable("id") Long id){
PensionConsigneeDTO data = pensionConsigneeService.get(id);
return new Result<PensionConsigneeDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
public Result save(@RequestBody PensionConsigneeDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
pensionConsigneeService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
public Result update(@RequestBody PensionConsigneeDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
pensionConsigneeService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
public Result delete(@RequestBody Long[] ids){
//校验数据
AssertUtils.isArrayEmpty(ids, "id");
pensionConsigneeService.delete(ids);
return new Result();
}
}
\ No newline at end of file
...@@ -176,7 +176,7 @@ public class PensionOrderController { ...@@ -176,7 +176,7 @@ public class PensionOrderController {
} }
@Login @Login
@PutMapping("takingOrder/{id}") @GetMapping("takingOrder/{id}")
@ApiOperation("接单(志愿者)") @ApiOperation("接单(志愿者)")
public Result takingOrder(@ApiIgnore @LoginUser UserEntity user, public Result takingOrder(@ApiIgnore @LoginUser UserEntity user,
@PathVariable("id") Long id){ @PathVariable("id") Long id){
......
package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Mapper
public interface PensionConsigneeDao extends BaseDao<PensionConsigneeEntity> {
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Data
@ApiModel(value = "")
public class PensionConsigneeDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "收货人姓名")
private String consigneeName;
@ApiModelProperty(value = "收货人电话")
private String consigneeMobile;
@ApiModelProperty(value = "省份")
private String consigneeProvince;
@ApiModelProperty(value = "城市")
private String consigneeCity;
@ApiModelProperty(value = "区/县")
private String consigneeDistrict;
@ApiModelProperty(value = "详细地址")
private String consigneeAddress;
@ApiModelProperty(value = "邮编")
private String consigneeZip;
@ApiModelProperty(value = "是否为默认地址")
private Integer ifDefault;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "更新时间")
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description : 提供用户地址信息(非用户收货地址信息)
* @Author : Shen Yuanfeng
* @Date : 2021/5/6 13:30
*/
@Data
@ApiModel(value = "用户地址信息")
public class UserAddressDTO {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "用户姓名")
private String username;
@ApiModelProperty(value = "用户手机号")
private String mobile;
@ApiModelProperty(value = "用户地址_地区")
private String addressArea;
@ApiModelProperty(value = "用户详细地址")
private String address;
}
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pension_consignee")
public class PensionConsigneeEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private Long userId;
/**
* 收货人姓名
*/
private String consigneeName;
/**
* 收货人电话
*/
private String consigneeMobile;
/**
* 省份
*/
private String consigneeProvince;
/**
* 城市
*/
private String consigneeCity;
/**
* 区/县
*/
private String consigneeDistrict;
/**
* 详细地址
*/
private String consigneeAddress;
/**
* 邮编
*/
private String consigneeZip;
/**
* 是否为默认地址
*/
private Integer ifDefault;
/**
* 状态
*/
private Integer status;
/**
* 备注
*/
private String remark;
/**
* 更新时间
*/
private Date updateDate;
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.service;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
public interface PensionConsigneeService extends CrudService<PensionConsigneeEntity, PensionConsigneeDTO> {
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionConsigneeDao;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
import io.hmit.modules.serviceOrder.service.PensionConsigneeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
*
*
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Service
public class PensionConsigneeServiceImpl extends CrudServiceImpl<PensionConsigneeDao, PensionConsigneeEntity, PensionConsigneeDTO> implements PensionConsigneeService {
@Override
public QueryWrapper<PensionConsigneeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<PensionConsigneeEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}
\ No newline at end of file
...@@ -5,7 +5,9 @@ import io.hmit.common.service.BaseService; ...@@ -5,7 +5,9 @@ import io.hmit.common.service.BaseService;
import io.hmit.dto.*; import io.hmit.dto.*;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.UserAddressDTO;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -49,4 +51,6 @@ public interface UserService extends BaseService<UserEntity> { ...@@ -49,4 +51,6 @@ public interface UserService extends BaseService<UserEntity> {
void registerUser(UserRegisterDTO dto); void registerUser(UserRegisterDTO dto);
List<UserAddressDTO> findUserAddressByUsernameOrMobile(String str);
} }
...@@ -12,6 +12,7 @@ import io.hmit.dao.UserDao; ...@@ -12,6 +12,7 @@ import io.hmit.dao.UserDao;
import io.hmit.dto.*; import io.hmit.dto.*;
import io.hmit.entity.TokenEntity; import io.hmit.entity.TokenEntity;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.UserAddressDTO;
import io.hmit.modules.serviceOrder.dto.UserRoleInfoDTO; import io.hmit.modules.serviceOrder.dto.UserRoleInfoDTO;
import io.hmit.modules.serviceOrder.service.PensionOldFamilyService; import io.hmit.modules.serviceOrder.service.PensionOldFamilyService;
import io.hmit.modules.serviceOrder.service.RoleUserService; import io.hmit.modules.serviceOrder.service.RoleUserService;
...@@ -24,6 +25,8 @@ import org.springframework.stereotype.Service; ...@@ -24,6 +25,8 @@ import org.springframework.stereotype.Service;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -182,4 +185,21 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -182,4 +185,21 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
} }
} }
@Override
public List<UserAddressDTO> findUserAddressByUsernameOrMobile(String str) {
List<UserAddressDTO> userAddress = null;
String mobile = null;
if (str.length()==11){
String regex = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$";
Pattern p = Pattern.compile(regex);
Matcher matcher = p.matcher(str);
if (matcher.matches()) {
mobile = str;
str = null;
}
}
userAddress = userDao.findUserAddressByUsernameOrMobile(str, mobile);
return userAddress;
}
} }
\ No newline at end of file
...@@ -44,4 +44,15 @@ ...@@ -44,4 +44,15 @@
WHERE tb_user.id_card_no = #{idCardNo}; WHERE tb_user.id_card_no = #{idCardNo};
</select> </select>
<select id="findUserAddressByUsernameOrMobile" resultType="io.hmit.modules.serviceOrder.dto.UserAddressDTO">
SELECT tu.id, tu.username, tu.mobile, tu.address_area, tu.address
FROM tb_user tu WHERE
<if test="username != null">
tu.username LIKE CONCAT('%', #{username}, '%')
</if>
<if test="mobile != null">
tu.mobile = #{mobile}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.hmit.modules.serviceOrder.dao.PensionConsigneeDao">
<resultMap type="io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity" id="pensionConsigneeMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="consigneeName" column="consignee_name"/>
<result property="consigneeMobile" column="consignee_mobile"/>
<result property="consigneeProvince" column="consignee_province"/>
<result property="consigneeCity" column="consignee_city"/>
<result property="consigneeDistrict" column="consignee_district"/>
<result property="consigneeAddress" column="consignee_address"/>
<result property="consigneeZip" column="consignee_zip"/>
<result property="ifDefault" column="if_default"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="createDate" column="create_date"/>
<result property="updateDate" column="update_date"/>
</resultMap>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment