init(TokenDto tokenDTO, @RequestBody ResiWarmheartedFormDTO resiWarmheartedFormDTO) {
ValidatorUtils.validateEntity(resiWarmheartedFormDTO);
return resiWarmheartedService.init(tokenDTO, resiWarmheartedFormDTO);
}
@@ -42,7 +41,7 @@ public class ResiWarmheartedController {
* @Description 居民端-热心居民申请-提交申请数据
**/
@PostMapping("submit")
- public Result submit(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmheartedSubmitFormDTO formDTO) {
+ public Result submit(TokenDto tokenDTO, @RequestBody ResiWarmheartedSubmitFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return resiWarmheartedService.submit(tokenDTO, formDTO);
}
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java
new file mode 100644
index 0000000000..6d1674936f
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java
@@ -0,0 +1,102 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 工作人员登录日志表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@Data
+public class StaffLoginHistoryDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 唯一标识
+ */
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * customer_staff.userId
+ */
+ private String staffId;
+
+ /**
+ * 微信openId
+ */
+ private String wxOpenId;
+
+ /**
+ * 手机号
+ */
+ private String mobile;
+
+ /**
+ * 组织机构id
+ */
+ private String orgId;
+
+ /**
+ * 网格表Id (CUSTOMER_GRID.id)
+ */
+ private String gridId;
+
+ /**
+ * 删除标识:0.未删除 1.已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间,登录时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffFormDTO.java
new file mode 100644
index 0000000000..43acb11d1c
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffFormDTO.java
@@ -0,0 +1,21 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @Description 根据手机号+客户id获取工作人员基本信息
+ * @Author yinzuomei
+ * @Date 2020/4/20 14:02
+ */
+@Data
+public class CustomerStaffFormDTO implements Serializable {
+ private static final long serialVersionUID = 7619815083427853431L;
+ @NotBlank(message = "手机号不能为空")
+ private String mobile;
+ @NotBlank(message = "客户id不能为空")
+ private String customerId;
+}
+
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java
new file mode 100644
index 0000000000..14a205d032
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java
@@ -0,0 +1,44 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description 保存工作人员登录日志
+ * @Author yinzuomei
+ * @Date 2020/4/20 14:26
+ */
+@Data
+public class StaffLoginHistoryFormDTO implements Serializable {
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * customer_staff.userId
+ */
+ private String staffId;
+
+ /**
+ * 微信openId
+ */
+ private String wxOpenId;
+
+ /**
+ * 手机号
+ */
+ private String mobile;
+
+ /**
+ * 组织机构id
+ */
+ private String orgId;
+
+ /**
+ * 网格表Id (CUSTOMER_GRID.id)
+ */
+ private String gridId;
+}
+
diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java
new file mode 100644
index 0000000000..5ad4ebde86
--- /dev/null
+++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java
@@ -0,0 +1,46 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description 当前微信上次登录的账号信息返参DTO
+ * @Author yinzuomei
+ * @Date 2020/4/20 12:23
+ */
+@Data
+public class LatestStaffWechatLoginResultDTO implements Serializable {
+ private static final long serialVersionUID = -7088774184276785902L;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * customer_staff.userId
+ */
+ private String staffId;
+
+ /**
+ * 微信openId
+ */
+ private String wxOpenId;
+
+ /**
+ * 手机号
+ */
+ private String mobile;
+
+ /**
+ * 组织机构id
+ */
+ private String orgId;
+
+ /**
+ * 网格表Id (CUSTOMER_GRID.id)
+ */
+ private String gridId;
+}
+
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
index f097f86d5e..b68ea382c6 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
@@ -23,9 +23,10 @@ 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.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerStaffDTO;
+import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.excel.CustomerStaffExcel;
import com.epmet.service.CustomerStaffService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,24 +46,24 @@ import java.util.Map;
@RestController
@RequestMapping("customerstaff")
public class CustomerStaffController {
-
+
@Autowired
private CustomerStaffService customerStaffService;
@GetMapping("page")
- public Result> page(@RequestParam Map params){
+ public Result> page(@RequestParam Map params) {
PageData page = customerStaffService.page(params);
return new Result>().ok(page);
}
@GetMapping("{id}")
- public Result get(@PathVariable("id") String id){
+ public Result get(@PathVariable("id") String id) {
CustomerStaffDTO data = customerStaffService.get(id);
return new Result().ok(data);
}
@PostMapping
- public Result save(@RequestBody CustomerStaffDTO dto){
+ public Result save(@RequestBody CustomerStaffDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
customerStaffService.save(dto);
@@ -70,7 +71,7 @@ public class CustomerStaffController {
}
@PutMapping
- public Result update(@RequestBody CustomerStaffDTO dto){
+ public Result update(@RequestBody CustomerStaffDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
customerStaffService.update(dto);
@@ -78,7 +79,7 @@ public class CustomerStaffController {
}
@DeleteMapping
- public Result delete(@RequestBody String[] ids){
+ public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
customerStaffService.delete(ids);
@@ -92,14 +93,27 @@ public class CustomerStaffController {
}
/**
- * @param phone 手机号
+ * @param mobile 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据手机号查询政府端工作人员基本信息,校验用户是否存在
* @Date 2020/4/18 14:07
**/
- @GetMapping(value = "getcustsomerstaffbyphone/{phone}")
- public Result getCustsomerStaffByPhone(@PathVariable("phone") String phone) {
- return customerStaffService.getCustsomerStaffByPhone(phone);
+ @GetMapping(value = "getcustsomerstaffbyphone/{mobile}")
+ public Result> getCustsomerStaffByPhone(@PathVariable("mobile") String mobile) {
+ return customerStaffService.getCustsomerStaffByPhone(mobile);
+ }
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据手机号+客户id获取工作人员基本信息
+ * @Date 2020/4/20 14:04
+ **/
+ @PostMapping(value = "getcustomerstaffinfo")
+ public Result getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO formDTO) {
+ ValidatorUtils.validateEntity(formDTO);
+ return customerStaffService.getCustomerStaffInfo(formDTO);
}
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java
index f9d88ddd6a..b44f404523 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java
@@ -17,7 +17,6 @@
package com.epmet.controller;
-import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@@ -109,7 +108,7 @@ public class OperUserController {
* @author zhaoqifeng
*/
@GetMapping("queryOperUserDto")
- public Result queryOperUserDto(@LoginUser TokenDto tokenDto) {
+ public Result queryOperUserDto(TokenDto tokenDto) {
OperUserDTO data = operUserService.getOperUserInfoById(tokenDto.getUserId());
QueryOperUserResultDto dto = ConvertUtils.sourceToTarget(data, QueryOperUserResultDto.class);
return new Result().ok(dto);
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java
new file mode 100644
index 0000000000..08c8e02c94
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.controller;
+
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.form.StaffLoginHistoryFormDTO;
+import com.epmet.dto.result.LatestStaffWechatLoginResultDTO;
+import com.epmet.service.StaffLoginHistoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 工作人员登录日志表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@RestController
+@RequestMapping("staffloginhistory")
+public class StaffLoginHistoryController {
+
+ @Autowired
+ private StaffLoginHistoryService staffLoginHistoryService;
+
+ /**
+ * @param openId
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 获取当前微信上次登录的账号信息
+ * @Date 2020/4/20 12:42
+ **/
+ @GetMapping(value = "getlatest/{openId}")
+ public Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) {
+ return staffLoginHistoryService.getLatestStaffWechatLoginRecord(openId);
+ }
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 保存登录日志
+ * @Date 2020/4/20 14:29
+ **/
+ @PostMapping(value = "saveStaffLoginRecord")
+ public Result saveStaffLoginRecord(@RequestBody StaffLoginHistoryFormDTO formDTO) {
+ return staffLoginHistoryService.saveStaffLoginRecord(formDTO);
+ }
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
index 6081d38fe1..8c1930d6ac 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
@@ -1,6 +1,5 @@
package com.epmet.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.commons.tools.validator.ValidatorUtils;
@@ -80,7 +79,7 @@ public class UserController {
* @Description 居民端个人信息-同步用户微信信息
**/
@PostMapping("updatewxuserinfo")
- public Result updateWxUserInfo(@LoginUser TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) {
+ public Result updateWxUserInfo(TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) {
wxUserInfoFormDTO.setUserId(tokenDTO.getUserId());
ValidatorUtils.validateEntity(wxUserInfoFormDTO);
return userService.updateWxUserInfo(wxUserInfoFormDTO);
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
index 89f2754a38..a676eb8a2c 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
@@ -18,9 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.CustomerStaffDTO;
+import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.entity.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
/**
* 政府工作人员表
*
@@ -29,5 +33,22 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerStaffDao extends BaseDao {
-
+
+ /**
+ * @param mobile
+ * @return java.util.List
+ * @Author yinzuomei
+ * @Description 根据手机号查询工作人员信息
+ * @Date 2020/4/20 13:17
+ **/
+ List selectListCustomerStaffDTO(String mobile);
+
+ /**
+ * @param formDTO
+ * @return com.epmet.dto.CustomerStaffDTO
+ * @Author yinzuomei
+ * @Description 根据手机号+客户id获取工作人员基本信息
+ * @Date 2020/4/20 14:08
+ **/
+ CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java
new file mode 100644
index 0000000000..1458be2a28
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.result.LatestStaffWechatLoginResultDTO;
+import com.epmet.entity.StaffLoginHistoryEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 工作人员登录日志表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@Mapper
+public interface StaffLoginHistoryDao extends BaseDao {
+
+ /**
+ * @return com.epmet.dto.result.LatestStaffWechatLoginDTO
+ * @param openId
+ * @Author yinzuomei
+ * @Description 获取当前微信上次登录的账号信息
+ * @Date 2020/4/20 12:45
+ **/
+ LatestStaffWechatLoginResultDTO selectLatestStaffWechatLoginRecord(String openId);
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java
new file mode 100644
index 0000000000..9a9377ecfe
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 工作人员登录日志表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("staff_login_history")
+public class StaffLoginHistoryEntity extends BaseEpmetEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * customer_staff.userId
+ */
+ private String staffId;
+
+ /**
+ * 微信openId
+ */
+ private String wxOpenId;
+
+ /**
+ * 手机号
+ */
+ private String mobile;
+
+ /**
+ * 组织机构id
+ */
+ private String orgId;
+
+ /**
+ * 网格表Id (CUSTOMER_GRID.id)
+ */
+ private String gridId;
+
+}
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
index ef5d1559b9..b459bdb83c 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
@@ -21,6 +21,7 @@ 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.CustomerStaffDTO;
+import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.entity.CustomerStaffEntity;
import java.util.List;
@@ -95,11 +96,20 @@ public interface CustomerStaffService extends BaseService {
void delete(String[] ids);
/**
- * @param phone 手机号
+ * @param mobile 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据手机号查询政府端工作人员基本信息,校验用户是否存在
* @Date 2020/4/18 14:07
**/
- Result getCustsomerStaffByPhone(String phone);
+ Result> getCustsomerStaffByPhone(String mobile);
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 根据手机号+客户id获取工作人员基本信息
+ * @Date 2020/4/20 14:05
+ **/
+ Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java
new file mode 100644
index 0000000000..fab2c9f20e
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java
@@ -0,0 +1,116 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+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.StaffLoginHistoryDTO;
+import com.epmet.dto.form.StaffLoginHistoryFormDTO;
+import com.epmet.dto.result.LatestStaffWechatLoginResultDTO;
+import com.epmet.entity.StaffLoginHistoryEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 工作人员登录日志表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+public interface StaffLoginHistoryService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-04-20
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-04-20
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return StaffLoginHistoryDTO
+ * @author generator
+ * @date 2020-04-20
+ */
+ StaffLoginHistoryDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-04-20
+ */
+ void save(StaffLoginHistoryDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-04-20
+ */
+ void update(StaffLoginHistoryDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-04-20
+ */
+ void delete(String[] ids);
+
+ /**
+ * @param openId
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 获取当前微信上次登录的账号信息
+ * @Date 2020/4/20 12:43
+ **/
+ Result getLatestStaffWechatLoginRecord(String openId);
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 保存登录日志
+ * @Date 2020/4/20 14:33
+ **/
+ Result saveStaffLoginRecord(StaffLoginHistoryFormDTO formDTO);
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
index 7470edc96d..7fdbb725e3 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
@@ -28,6 +28,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.dao.CustomerStaffDao;
import com.epmet.dto.CustomerStaffDTO;
+import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.entity.CustomerStaffEntity;
import com.epmet.redis.CustomerStaffRedis;
import com.epmet.service.CustomerStaffService;
@@ -107,23 +108,26 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl getCustsomerStaffByPhone(String phone) {
+ public Result> getCustsomerStaffByPhone(String mobile) {
//判断用户是否存在
- QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.eq(StringUtils.isNotBlank(phone), FieldConstant.MOBILE, phone);
- List customerStaffEntityList = baseDao.selectList(wrapper);
- if (null == customerStaffEntityList || customerStaffEntityList.size() == 0) {
- logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]",phone,EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(),EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg()));
+ List customerStaffDTOList = baseDao.selectListCustomerStaffDTO(mobile);
+ if (null == customerStaffDTOList || customerStaffDTOList.size() == 0) {
+ logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]", mobile, EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(), EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg()));
return new Result().error(EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode());
}
+ return new Result>().ok(customerStaffDTOList);
+ }
+
+
+ @Override
+ public Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO) {
+ CustomerStaffDTO customerStaffDTO = baseDao.selectListCustomerStaffInfo(formDTO);
//判断用户是否已被禁用
- CustomerStaffEntity customerStaff = customerStaffEntityList.get(0);
- if (UserConstant.DISABLED.equals(customerStaff.getEnableFlag())) {
- logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]",phone,EpmetErrorCode.GOV_STAFF_DISABLED.getCode(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg()));
+ if (null != customerStaffDTO && UserConstant.DISABLED.equals(customerStaffDTO.getEnableFlag())) {
+ logger.error(String.format("根据手机号查询用户异常,手机号:[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), EpmetErrorCode.GOV_STAFF_DISABLED.getCode(), EpmetErrorCode.GOV_STAFF_DISABLED.getMsg()));
return new Result().error(EpmetErrorCode.GOV_STAFF_DISABLED.getCode());
}
- CustomerStaffDTO customerStaffDTO=ConvertUtils.sourceToTarget(customerStaff, CustomerStaffDTO.class);
- return new Result().ok(customerStaffDTO);
+ return new Result().ok(customerStaffDTO);
}
}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffLoginHistoryServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffLoginHistoryServiceImpl.java
new file mode 100644
index 0000000000..2cccdf9f3e
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffLoginHistoryServiceImpl.java
@@ -0,0 +1,121 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.FieldConstant;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dao.StaffLoginHistoryDao;
+import com.epmet.dto.StaffLoginHistoryDTO;
+import com.epmet.dto.form.StaffLoginHistoryFormDTO;
+import com.epmet.dto.result.LatestStaffWechatLoginResultDTO;
+import com.epmet.entity.StaffLoginHistoryEntity;
+import com.epmet.service.StaffLoginHistoryService;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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-04-20
+ */
+@Service
+public class StaffLoginHistoryServiceImpl extends BaseServiceImpl implements StaffLoginHistoryService {
+ private static final Logger logger = LoggerFactory.getLogger(StaffLoginHistoryServiceImpl.class);
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, StaffLoginHistoryDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, StaffLoginHistoryDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public StaffLoginHistoryDTO get(String id) {
+ StaffLoginHistoryEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, StaffLoginHistoryDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(StaffLoginHistoryDTO dto) {
+ StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffLoginHistoryEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(StaffLoginHistoryDTO dto) {
+ StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffLoginHistoryEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ @Override
+ public Result getLatestStaffWechatLoginRecord(String openId) {
+ if (StringUtils.isNotBlank(openId)) {
+ logger.error("openId 不能为空");
+ return new Result();
+ }
+ LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId);
+ return new Result().ok(latestStaffWechatLoginDTO);
+ }
+
+ @Override
+ public Result saveStaffLoginRecord(StaffLoginHistoryFormDTO formDTO) {
+ StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffLoginHistoryEntity.class);
+ insert(entity);
+ return new Result();
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql
index 19f25df536..e09dd173a2 100644
--- a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql
+++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql
@@ -35,4 +35,22 @@ CREATE TABLE `staff_wechat` (
PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员微信关系表 ';
-alter table grid_latest MODIFY COLUMN PID VARCHAR(64) comment'上级组织ID (数据统计字段)'
\ No newline at end of file
+alter table grid_latest MODIFY COLUMN PID VARCHAR(64) comment'上级组织ID (数据统计字段)';
+alter table staff_wechat add column LATEST_LOGIN_TIME datetime NOT NULL COMMENT '最后一次登录时间';
+alter table staff_wechat drop column LATEST_LOGIN_TIME;
+CREATE TABLE `staff_login_history` (
+ `ID` varchar(64) NOT NULL COMMENT '唯一标识',
+ `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
+ `STAFF_ID` varchar(64) NOT NULL COMMENT 'customer_staff.userId',
+ WX_OPEN_ID varchar(64) NOT NULL COMMENT '微信openId',
+ `MOBILE` varchar(20) NOT NULL COMMENT '手机号',
+ `ORG_ID` varchar(64) NOT NULL COMMENT '组织机构id',
+ `GRID_ID` varchar(64) COMMENT '网格表Id (CUSTOMER_GRID.id)',
+ `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
+ `REVISION` int(11) NOT NULL COMMENT '乐观锁',
+ `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
+ `CREATED_TIME` datetime NOT NULL COMMENT '创建时间,登录时间',
+ `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人',
+ `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间',
+ PRIMARY KEY (`ID`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员登录日志表';
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
index c5ba17deab..1a8958a306 100644
--- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
@@ -3,26 +3,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml
new file mode 100644
index 0000000000..4f382bfa10
--- /dev/null
+++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file