34 changed files with 655 additions and 1261 deletions
@ -0,0 +1,38 @@ |
|||
package com.epmet.modules.resiregister.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.ResiRegisterFormDTO; |
|||
import com.epmet.dto.result.ResiRegisterResultDTO; |
|||
import com.epmet.modules.resiregister.service.ResiRegisterService; |
|||
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; |
|||
|
|||
/** |
|||
* @Description 居民端居民注册相关接口入口 |
|||
* @Author sun |
|||
* @Date 2020/3/30 |
|||
* @since v1.0.0 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("resiregister") |
|||
public class ResiRegisterController { |
|||
@Autowired |
|||
private ResiRegisterService resiMineGridService; |
|||
|
|||
/** |
|||
* @param |
|||
* @Author sun |
|||
* @Description 居民端-居民注册页面初始化-居民注册访问记录表新增数据 |
|||
* @Date 2020/3/30 |
|||
**/ |
|||
@PostMapping("init") |
|||
public Result<ResiRegisterResultDTO> init(@LoginUser TokenDto tokenDTO, @RequestBody ResiRegisterFormDTO resiRegisterFormDTO) { |
|||
return resiMineGridService.init(tokenDTO, resiRegisterFormDTO); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.modules.resiregister.service; |
|||
|
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.ResiRegisterFormDTO; |
|||
import com.epmet.dto.result.ResiRegisterResultDTO; |
|||
|
|||
/** |
|||
* @Description 居民端居民注册信息service |
|||
* @Author sun |
|||
* @Date 2020/3/30 |
|||
*/ |
|||
public interface ResiRegisterService { |
|||
|
|||
|
|||
/** |
|||
* 居民端-居民注册页面初始化-居民注册访问记录表新增数据 |
|||
* |
|||
* @param |
|||
* @return void |
|||
* @author sun |
|||
*/ |
|||
Result<ResiRegisterResultDTO> init(TokenDto tokenDTO, ResiRegisterFormDTO formDTO); |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.epmet.modules.resiregister.service.impl; |
|||
|
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.ResiRegisterFormDTO; |
|||
import com.epmet.dto.result.ResiRegisterResultDTO; |
|||
import com.epmet.modules.feign.EpmetUserFeignClient; |
|||
import com.epmet.modules.resiregister.service.ResiRegisterService; |
|||
import com.epmet.modules.utils.ModuleConstant; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @Description 居民端居民注册信息service |
|||
* @Author sun |
|||
* @Date 2020/3/30 |
|||
*/ |
|||
@Service |
|||
public class ResiRegisterServiceImpl implements ResiRegisterService { |
|||
|
|||
@Autowired |
|||
private EpmetUserFeignClient epmetUserFeignClient; |
|||
|
|||
@Override |
|||
public Result<ResiRegisterResultDTO> init(TokenDto tokenDTO, ResiRegisterFormDTO formDTO) { |
|||
if (null == tokenDTO || StringUtils.isBlank(tokenDTO.getUserId())) { |
|||
return new Result<ResiRegisterResultDTO>().error(ModuleConstant.USER_NOT_NULL); |
|||
} |
|||
formDTO.setUserId(tokenDTO.getUserId()); |
|||
return epmetUserFeignClient.init(formDTO); |
|||
} |
|||
} |
@ -1,127 +0,0 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 居民用户信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
@Data |
|||
public class CustomerUserDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 微信openId |
|||
*/ |
|||
private String wxOpenId; |
|||
|
|||
/** |
|||
* 微信unionId |
|||
*/ |
|||
private String unionId; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 性别:0.未知 1.男性2女性 |
|||
*/ |
|||
private Integer sex; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headImgUrl; |
|||
|
|||
/** |
|||
* 国家 |
|||
*/ |
|||
private String country; |
|||
|
|||
/** |
|||
* 省份 |
|||
*/ |
|||
private String province; |
|||
|
|||
/** |
|||
* 城市 |
|||
*/ |
|||
private String city; |
|||
|
|||
/** |
|||
* 语言 |
|||
*/ |
|||
private String language; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,59 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 居民端-居民注册页面初始化-居民访问记录表新增数据-配置入参 |
|||
* @author sun |
|||
*/ |
|||
@Data |
|||
public class ResiRegisterFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id CUSTOMER.id |
|||
*/ |
|||
@NotBlank(message = "客户ID不能为空") |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 网格Id |
|||
*/ |
|||
@NotBlank(message = "网格ID不能为空") |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 访问来源 指的是用户点的那个功能进入到的注册页面,就是一个功能模块的Id(value:feature+action) |
|||
*/ |
|||
@NotBlank(message = "访问来源不能为空") |
|||
private String visitFrom; |
|||
|
|||
/** |
|||
* 用户Id |
|||
*/ |
|||
@NotBlank(message = "用户ID不能为空") |
|||
private String userId; |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* 常量 |
|||
* @author sun |
|||
* @since 1.0.0 |
|||
*/ |
|||
public interface UserResiRegisterConstant { |
|||
|
|||
/** |
|||
* 最后一次操作行为-初始化 |
|||
*/ |
|||
String INITIALIZE = "initialize"; |
|||
|
|||
/** |
|||
* 最后一次操作行为-获取手机验证码 |
|||
*/ |
|||
String SMS_CODE = "sms_code"; |
|||
|
|||
/** |
|||
* 最后一次操作行为-提交成功 |
|||
*/ |
|||
String SUCCESS = "success"; |
|||
|
|||
/** |
|||
* 最后一次操作行为-提交失败 |
|||
*/ |
|||
String FAILD="faild"; |
|||
} |
@ -1,138 +0,0 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
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.dto.CustomerUserDTO; |
|||
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; |
|||
import com.epmet.dto.form.WxLoginUserInfoFormDTO; |
|||
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; |
|||
import com.epmet.excel.CustomerUserExcel; |
|||
import com.epmet.service.CustomerUserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 居民用户信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("customeruser") |
|||
public class CustomerUserController { |
|||
|
|||
@Autowired |
|||
private CustomerUserService customerUserService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<CustomerUserDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<CustomerUserDTO> page = customerUserService.page(params); |
|||
return new Result<PageData<CustomerUserDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<CustomerUserDTO> get(@PathVariable("id") String id){ |
|||
CustomerUserDTO data = customerUserService.get(id); |
|||
return new Result<CustomerUserDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody CustomerUserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
customerUserService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody CustomerUserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
customerUserService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
customerUserService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<CustomerUserDTO> list = customerUserService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, CustomerUserExcel.class); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author yinzuomei |
|||
* @Description 根据openId、app查询对应终端用户信息 |
|||
* @Date 2020/3/16 16:15 |
|||
**/ |
|||
@PostMapping("selecWxLoginUserInfo") |
|||
public Result<String> selecWxLoginUserInfo(@RequestBody WxLoginUserInfoFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return customerUserService.selecWxLoginUserInfo(formDTO); |
|||
} |
|||
|
|||
/** |
|||
* @param customerUserDTO |
|||
* @return 将获取到的居民微信信息,保存到customer_user表,返回主键 |
|||
* @Author yinzuomei |
|||
* @Description |
|||
* @Date 2020/3/16 15:49 |
|||
**/ |
|||
@PostMapping("saveOrUpdateCustomerUser") |
|||
public Result<String> saveOrUpdateCustomerUser(@RequestBody CustomerUserDTO customerUserDTO) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(customerUserDTO, AddGroup.class, DefaultGroup.class); |
|||
return customerUserService.saveOrUpdateCustomerUser(customerUserDTO); |
|||
} |
|||
|
|||
/** |
|||
* @param passwordLoginUserInfoFormDTO |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.PasswordLoginUserInfoResultDTO> |
|||
* @Author yinzuomei |
|||
* @Description 根据手机号、app获取对应终端用户信息 |
|||
* @Date 2020/3/16 16:15 |
|||
**/ |
|||
@PostMapping("selectLoginUserInfoByPassword") |
|||
public Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(passwordLoginUserInfoFormDTO); |
|||
Result<PasswordLoginUserInfoResultDTO> result= customerUserService.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO); |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,73 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
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.dto.UserDTO; |
|||
import com.epmet.dto.UserWechatDTO; |
|||
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; |
|||
import com.epmet.dto.form.WxLoginUserInfoFormDTO; |
|||
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; |
|||
import com.epmet.service.UserService; |
|||
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; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yinzuomei |
|||
* @Date 2020/3/30 12:42 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("user") |
|||
public class UserController { |
|||
@Autowired |
|||
private UserService userService; |
|||
|
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author yinzuomei |
|||
* @Description 根据openId、app查询对应终端用户信息 |
|||
* @Date 2020/3/16 16:15 |
|||
**/ |
|||
@PostMapping("selecWxLoginUserInfo") |
|||
public Result<UserDTO> selecWxLoginUserInfo(@RequestBody WxLoginUserInfoFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return userService.selecWxLoginUserInfo(formDTO); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @param userWechatDTO |
|||
* @return 将获取到的居民微信信息,保存到user_wechat表,返回主键 |
|||
* @Author yinzuomei |
|||
* @Description |
|||
* @Date 2020/3/16 15:49 |
|||
**/ |
|||
@PostMapping("saveOrUpdateUserWechatDTO") |
|||
public Result<UserDTO> saveOrUpdateUserWechatDTO(@RequestBody UserWechatDTO userWechatDTO) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(userWechatDTO, AddGroup.class, DefaultGroup.class); |
|||
return userService.saveOrUpdateUserWechatDTO(userWechatDTO); |
|||
} |
|||
|
|||
/** |
|||
* @param passwordLoginUserInfoFormDTO |
|||
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.PasswordLoginUserInfoResultDTO> |
|||
* @Author yinzuomei |
|||
* @Description 根据手机号、app获取对应终端用户信息 |
|||
* @Date 2020/3/16 16:15 |
|||
**/ |
|||
@PostMapping("selectLoginUserInfoByPassword") |
|||
public Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(passwordLoginUserInfoFormDTO); |
|||
Result<PasswordLoginUserInfoResultDTO> result= userService.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO); |
|||
return result; |
|||
} |
|||
} |
@ -1,88 +0,0 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; |
|||
import com.epmet.entity.CustomerUserEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 居民用户信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
@Mapper |
|||
public interface CustomerUserDao extends BaseDao<CustomerUserEntity> { |
|||
|
|||
/** |
|||
* @param openId |
|||
* @return userId |
|||
* @Author yinzuomei |
|||
* @Description 根据openId查询居民用户信息 |
|||
* @Date 2020/3/14 20:45 |
|||
**/ |
|||
String selectCustomerIdByOpenId(String openId); |
|||
|
|||
/** |
|||
* @param openId |
|||
* @return userId |
|||
* @Author yinzuomei |
|||
* @Description 根据openId查询政府工作人员信息 |
|||
* @Date 2020/3/14 20:45 |
|||
**/ |
|||
String selectCustomerStaffId(String openId); |
|||
|
|||
/** |
|||
* @param openId |
|||
* @return userId |
|||
* @Author yinzuomei |
|||
* @Description 根据openId查询运营人员信息 |
|||
* @Date 2020/3/14 20:45 |
|||
**/ |
|||
String selectOperUserId(String openId); |
|||
|
|||
|
|||
/** |
|||
* @param phone |
|||
* @return com.epmet.dto.result.PasswordLoginUserInfoResultDTO |
|||
* @Author yinzuomei |
|||
* @Description 根据手机号查询政府工作人员信息 |
|||
* @Date 2020/3/17 11:01 |
|||
**/ |
|||
PasswordLoginUserInfoResultDTO selectCustomerStaffByPhone(String phone); |
|||
|
|||
/** |
|||
* @param phone |
|||
* @return com.epmet.dto.result.PasswordLoginUserInfoResultDTO |
|||
* @Author yinzuomei |
|||
* @Description 根据手机号查询运营人员信息 |
|||
* @Date 2020/3/17 11:01 |
|||
**/ |
|||
PasswordLoginUserInfoResultDTO selectOperUserByPhone(String phone); |
|||
|
|||
/** |
|||
* @param phone |
|||
* @return com.epmet.dto.result.PasswordLoginUserInfoResultDTO |
|||
* @Author yinzuomei |
|||
* @Description 根据手机号查询居民信息 |
|||
* @Date 2020/3/17 11:01 |
|||
**/ |
|||
PasswordLoginUserInfoResultDTO selectCustomerUserByPhone(String phone); |
|||
} |
@ -1,96 +0,0 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 居民用户信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("customer_user") |
|||
public class CustomerUserEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id CUSTOMER.id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 微信openId |
|||
*/ |
|||
private String wxOpenId; |
|||
|
|||
/** |
|||
* 微信unionId |
|||
*/ |
|||
private String unionId; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 性别:0.未知 1.男性2女性 |
|||
*/ |
|||
private Integer sex; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headImgUrl; |
|||
|
|||
/** |
|||
* 国家 |
|||
*/ |
|||
private String country; |
|||
|
|||
/** |
|||
* 省份 |
|||
*/ |
|||
private String province; |
|||
|
|||
/** |
|||
* 城市 |
|||
*/ |
|||
private String city; |
|||
|
|||
/** |
|||
* 语言 |
|||
*/ |
|||
private String language; |
|||
|
|||
} |
@ -1,86 +0,0 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 居民用户信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
@Data |
|||
public class CustomerUserExcel { |
|||
|
|||
@Excel(name = "唯一标识") |
|||
private String id; |
|||
|
|||
@Excel(name = "客户Id CUSTOMER.id") |
|||
private String customerId; |
|||
|
|||
@Excel(name = "微信openId") |
|||
private String wxOpenId; |
|||
|
|||
@Excel(name = "手机号") |
|||
private String mobile; |
|||
|
|||
@Excel(name = "昵称") |
|||
private String nickname; |
|||
|
|||
@Excel(name = "性别:0.未知 1.男性2女性") |
|||
private Integer sex; |
|||
|
|||
@Excel(name = "头像") |
|||
private String headImgUrl; |
|||
|
|||
@Excel(name = "国家") |
|||
private String country; |
|||
|
|||
@Excel(name = "省份") |
|||
private String province; |
|||
|
|||
@Excel(name = "城市") |
|||
private String city; |
|||
|
|||
@Excel(name = "语言") |
|||
private String language; |
|||
|
|||
@Excel(name = "删除标识:0.未删除 1.已删除") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -1,127 +0,0 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.CustomerUserDTO; |
|||
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; |
|||
import com.epmet.dto.form.WxLoginUserInfoFormDTO; |
|||
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; |
|||
import com.epmet.entity.CustomerUserEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 居民用户信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
public interface CustomerUserService extends BaseService<CustomerUserEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<CustomerUserDTO> |
|||
* @author generator |
|||
* @date 2020-03-16 |
|||
*/ |
|||
PageData<CustomerUserDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<CustomerUserDTO> |
|||
* @author generator |
|||
* @date 2020-03-16 |
|||
*/ |
|||
List<CustomerUserDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return CustomerUserDTO |
|||
* @author generator |
|||
* @date 2020-03-16 |
|||
*/ |
|||
CustomerUserDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-16 |
|||
*/ |
|||
void save(CustomerUserDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-16 |
|||
*/ |
|||
void update(CustomerUserDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-16 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 根据openId、app查询对应终端用户信息 |
|||
* |
|||
* @param formDTO |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @date 2020-03-16 |
|||
*/ |
|||
Result selecWxLoginUserInfo(WxLoginUserInfoFormDTO formDTO); |
|||
|
|||
/** |
|||
* @param customerUserDTO |
|||
* @return 获取居民微信信息,保存到customer_user表,返回主键 |
|||
* @Author yinzuomei |
|||
* @Description |
|||
* @Date 2020/3/16 15:49 |
|||
**/ |
|||
Result<String> saveOrUpdateCustomerUser(CustomerUserDTO customerUserDTO); |
|||
|
|||
/** |
|||
* @param passwordLoginUserInfoFormDTO |
|||
* @return 根据手机号获取用户信息 |
|||
* @Author yinzuomei |
|||
* @Description |
|||
* @Date 2020/3/16 15:49 |
|||
**/ |
|||
Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO); |
|||
} |
@ -1,203 +0,0 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.common.token.constant.LoginConstant; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.constant.UserConstant; |
|||
import com.epmet.dao.CustomerUserDao; |
|||
import com.epmet.dao.UserDao; |
|||
import com.epmet.dao.UserWechatDao; |
|||
import com.epmet.dto.CustomerUserDTO; |
|||
import com.epmet.dto.UserWechatDTO; |
|||
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; |
|||
import com.epmet.dto.form.WxLoginUserInfoFormDTO; |
|||
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; |
|||
import com.epmet.entity.CustomerUserEntity; |
|||
import com.epmet.entity.UserEntity; |
|||
import com.epmet.entity.UserWechatEntity; |
|||
import com.epmet.redis.CustomerUserRedis; |
|||
import com.epmet.service.CustomerUserService; |
|||
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.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 居民用户信息表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-16 |
|||
*/ |
|||
@Service |
|||
public class CustomerUserServiceImpl extends BaseServiceImpl<CustomerUserDao, CustomerUserEntity> implements CustomerUserService { |
|||
|
|||
@Autowired |
|||
private CustomerUserRedis customerUserRedis; |
|||
|
|||
@Autowired |
|||
private UserWechatDao userWechatDao; |
|||
|
|||
@Autowired |
|||
private UserDao userDao; |
|||
|
|||
@Override |
|||
public PageData<CustomerUserDTO> page(Map<String, Object> params) { |
|||
IPage<CustomerUserEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, CustomerUserDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<CustomerUserDTO> list(Map<String, Object> params) { |
|||
List<CustomerUserEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, CustomerUserDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<CustomerUserEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<CustomerUserEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public CustomerUserDTO get(String id) { |
|||
CustomerUserEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, CustomerUserDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(CustomerUserDTO dto) { |
|||
CustomerUserEntity entity = ConvertUtils.sourceToTarget(dto, CustomerUserEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(CustomerUserDTO dto) { |
|||
CustomerUserEntity entity = ConvertUtils.sourceToTarget(dto, CustomerUserEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 根据openId、app查询对应终端用户信息 |
|||
* |
|||
* 居民端用户与政府端用户都在一张表内且都有微信登录的入口 |
|||
* user_wechat表保存每一个用户和微信(openId)的绑定关系 |
|||
* |
|||
* @return void |
|||
* @author yinzuomei |
|||
* @date 2020-03-16 |
|||
*/ |
|||
@Override |
|||
public Result<String> selecWxLoginUserInfo(WxLoginUserInfoFormDTO formDTO) { |
|||
String userId = ""; |
|||
|
|||
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) { |
|||
//查询customer_staff待完善
|
|||
//userId = baseDao.selectCustomerStaffId(formDTO.getOpenId());
|
|||
userId = userWechatDao.selectUserIdByOpenId(formDTO.getOpenId()); |
|||
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) { |
|||
//查询oper_staff待完善
|
|||
//userId = baseDao.selectOperUserId(formDTO.getOpenId());
|
|||
userId = userWechatDao.selectUserIdByOpenId(formDTO.getOpenId()); |
|||
} else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) { |
|||
//居民端
|
|||
//userId = baseDao.selectCustomerIdByOpenId(formDTO.getOpenId());
|
|||
userId = userWechatDao.selectUserIdByOpenId(formDTO.getOpenId()); |
|||
} |
|||
return new Result<String>().ok(userId); |
|||
} |
|||
|
|||
/** |
|||
* @param customerUserDTO |
|||
* @return com.epmet.commons.tools.utils.Result<java.lang.String> |
|||
* @Author yinzuomei |
|||
* @Description 将获取到的居民微信信息,保存到customer_user表,返回主键 |
|||
* @Date 2020/3/17 11:04 |
|||
**/ |
|||
@Override |
|||
public Result<String> saveOrUpdateCustomerUser(CustomerUserDTO customerUserDTO) { |
|||
CustomerUserEntity entity = ConvertUtils.sourceToTarget(customerUserDTO, CustomerUserEntity.class); |
|||
UserWechatDTO dto = ConvertUtils.sourceToTarget(customerUserDTO, UserWechatDTO.class); |
|||
|
|||
if (StringUtils.isNotBlank(customerUserDTO.getId())) { |
|||
//updateById(entity);
|
|||
|
|||
dto.setUserId(customerUserDTO.getId()); |
|||
userWechatDao.updateByUserId(dto); |
|||
} else { |
|||
//insert(entity);
|
|||
UserEntity userEntity = new UserEntity(); |
|||
userEntity.setFromApp(UserConstant.APP_RESI); |
|||
userEntity.setFromClient(UserConstant.CLIENT_WX); |
|||
userDao.insert(userEntity); |
|||
dto.setUserId(userEntity.getId()); |
|||
UserWechatEntity userWechatEntity = ConvertUtils.sourceToTarget(dto,UserWechatEntity.class); |
|||
userWechatDao.insert(userWechatEntity); |
|||
} |
|||
return new Result<String>().ok(entity.getId()); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return 根据手机号、app获取对应终端用户信息 |
|||
* @Author yinzuomei |
|||
* @Description |
|||
* @Date 2020/3/16 15:49 |
|||
**/ |
|||
@Override |
|||
public Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO formDTO) { |
|||
PasswordLoginUserInfoResultDTO passwordLoginUserInfoResultDTO = null; |
|||
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) { |
|||
//查询customer_staff待完善
|
|||
passwordLoginUserInfoResultDTO = baseDao.selectCustomerStaffByPhone(formDTO.getPhone()); |
|||
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) { |
|||
//查询oper_user待完善
|
|||
passwordLoginUserInfoResultDTO = baseDao.selectOperUserByPhone(formDTO.getPhone()); |
|||
} else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) { |
|||
passwordLoginUserInfoResultDTO = baseDao.selectCustomerUserByPhone(formDTO.getPhone()); |
|||
} |
|||
return new Result<PasswordLoginUserInfoResultDTO>().ok(passwordLoginUserInfoResultDTO); |
|||
} |
|||
|
|||
} |
@ -1,80 +0,0 @@ |
|||
<?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="com.epmet.dao.CustomerUserDao"> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<!-- 根据openId查询居民用户信息 --> |
|||
<select id="selectCustomerIdByOpenId" parameterType="java.lang.String" resultType="java.lang.String"> |
|||
SELECT |
|||
cu.id |
|||
FROM |
|||
customer_user cu |
|||
WHERE |
|||
cu.DEL_FLAG = '0' |
|||
AND cu.WX_OPEN_ID = #{openId} |
|||
</select> |
|||
|
|||
<!-- 根据openId查询政府工作人员信息--> |
|||
<select id="selectCustomerStaffId" parameterType="java.lang.String" resultType="java.lang.String"> |
|||
SELECT |
|||
cs.id |
|||
FROM |
|||
customer_staff cs |
|||
WHERE |
|||
cs.DEL_FLAG = '0' |
|||
AND cs.WX_OPEN_ID = #{openId} |
|||
</select> |
|||
|
|||
<!-- 根据openId查询运营人员信息--> |
|||
<select id="selectOperUserId" parameterType="java.lang.String" resultType="java.lang.String"> |
|||
SELECT |
|||
ou.id |
|||
FROM |
|||
oper_user ou |
|||
WHERE |
|||
ou.DEL_FLAG = '0' |
|||
AND ou.WX_OPEN_ID = #{openId} |
|||
</select> |
|||
|
|||
<!-- 根据手机号查询政府工作人员信息--> |
|||
<select id="selectCustomerStaffByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO"> |
|||
SELECT |
|||
cs.id AS userId, |
|||
PASSWORD AS PASSWORD |
|||
FROM |
|||
customer_staff cs |
|||
WHERE |
|||
cs.DEL_FLAG = '0' |
|||
AND cs.PHONE = #{phone} |
|||
</select> |
|||
|
|||
<!-- 根据手机号查询运营人员信息--> |
|||
<select id="selectOperUserByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO"> |
|||
SELECT |
|||
ou.USER_ID AS userId, |
|||
PASSWORD AS PASSWORD |
|||
FROM |
|||
oper_user ou |
|||
WHERE |
|||
ou.DEL_FLAG = '0' |
|||
AND ou.STATUS = '1' |
|||
AND ou.PHONE = #{phone} |
|||
</select> |
|||
|
|||
<!-- 根据手机号查询居民信息--> |
|||
<select id="selectCustomerUserByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO"> |
|||
SELECT |
|||
cu.id as userId, |
|||
null as password |
|||
FROM |
|||
customer_user cu |
|||
WHERE |
|||
cu.DEL_FLAG = '0' |
|||
AND cu.MOBILE = #{phone} |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue