22 changed files with 314 additions and 1263 deletions
@ -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; |
|
||||
|
|
||||
} |
|
||||
@ -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,47 +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.redis; |
|
||||
|
|
||||
import com.epmet.commons.tools.redis.RedisUtils; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
/** |
|
||||
* 居民用户信息表 |
|
||||
* |
|
||||
* @author generator generator@elink-cn.com |
|
||||
* @since v1.0.0 2020-03-16 |
|
||||
*/ |
|
||||
@Component |
|
||||
public class CustomerUserRedis { |
|
||||
@Autowired |
|
||||
private RedisUtils redisUtils; |
|
||||
|
|
||||
public void delete(Object[] ids) { |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public void set(){ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public String get(String id){ |
|
||||
return null; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -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