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
From 4b96cd16ecd32d6436f4094ab7b8d878b488c2c0 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 20 Apr 2020 16:24:24 +0800
Subject: [PATCH 02/85] =?UTF-8?q?=E4=BF=AE=E6=94=B9auth=E3=80=81gateway?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97redis=E8=BF=9E=E6=8E=A5=E5=9C=B0=E5=9D=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
epmet-auth/pom.xml | 2 +-
epmet-gateway/pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml
index be588da1e1..93feb4625c 100644
--- a/epmet-auth/pom.xml
+++ b/epmet-auth/pom.xml
@@ -135,7 +135,7 @@
0
- 127.0.0.1
+ 192.168.1.130
6379
123456
diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml
index eed74d589d..5b943229db 100644
--- a/epmet-gateway/pom.xml
+++ b/epmet-gateway/pom.xml
@@ -95,7 +95,7 @@
0
- 127.0.0.1
+ 192.168.1.130
6379
123456
From 3d2c935228c2024bf311bd06bbc1bb8de6ec81d2 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 20 Apr 2020 16:36:04 +0800
Subject: [PATCH 03/85] =?UTF-8?q?getCustomerStaffInfo=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/java/com/epmet/service/GovLoginService.java | 2 +-
.../main/java/com/epmet/service/impl/GovLoginServiceImpl.java | 4 ++--
.../java/com/epmet/service/impl/CustomerStaffServiceImpl.java | 4 ++++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java
index b805bbf217..f01e6ef096 100644
--- a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java
+++ b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java
@@ -29,7 +29,7 @@ public interface GovLoginService {
* @Description 3、手机验证码获取组织
* @Date 2020/4/18 21:11
**/
- Result getorgs(GovWxmpGetOrgsFormDTO formDTO);
+ Result getorgs(GovWxmpGetOrgsFormDTO formDTO);
/**
* @param formDTO
diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
index f41e0b81d9..055d169e27 100644
--- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
+++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
@@ -96,7 +96,7 @@ public class GovLoginServiceImpl implements GovLoginService {
* @Date 2020/4/18 21:11
**/
@Override
- public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) {
+ public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) {
//1、根据手机号查询到用户信息
Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile());
if (!customerStaffResult.success()) {
@@ -106,7 +106,7 @@ public class GovLoginServiceImpl implements GovLoginService {
//2、验证码是否正确
String rightSmsCode = captchaRedis.getSmsCode(formDTO);
if (!formDTO.getSmsCode().equals(rightSmsCode)) {
- return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
+ return new Result<>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//3、TODO返回组织树
return new Result();
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 7fdbb725e3..9d9e11a64c 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
@@ -122,6 +122,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl getCustomerStaffInfo(CustomerStaffFormDTO formDTO) {
CustomerStaffDTO customerStaffDTO = baseDao.selectListCustomerStaffInfo(formDTO);
+ if (null == customerStaffDTO) {
+ logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]", formDTO.getMobile(), EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(), EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg()));
+ return new Result().error(EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode());
+ }
//判断用户是否已被禁用
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()));
From 84614c5a14bea25dc11859a5760ef823fc3c788b Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 20 Apr 2020 22:32:08 +0800
Subject: [PATCH 04/85] =?UTF-8?q?=E8=B5=9E=E6=8F=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../epmet/controller/GovLoginController.java | 11 +-
...OrgsFormDTO.java => StaffOrgsFormDTO.java} | 8 +-
.../com/epmet/feign/EpmetUserFeignClient.java | 2 +-
.../com/epmet/feign/GovOrgFeignClient.java | 27 ++++-
.../EpmetUserFeignClientFallback.java | 2 +-
.../fallback/GovOrgFeignClientFallback.java | 15 ++-
.../java/com/epmet/redis/CaptchaRedis.java | 7 +-
.../com/epmet/service/GovLoginService.java | 7 +-
.../service/impl/GovLoginServiceImpl.java | 104 +++++++++++-------
.../tools/security/dto/GovTokenDto.java | 13 ++-
....java => StaffLatestLoginGridFormDTO.java} | 5 +-
.../com/epmet/dto/form/StaffOrgFormDTO.java | 18 +++
...ava => StaffLatestLoginGridResultDTO.java} | 2 +-
.../epmet/dto/result/StaffOrgsResultDTO.java | 31 ++++++
.../controller/CustomerAgencyController.java | 15 ++-
.../java/com/epmet/dao/CustomerAgencyDao.java | 13 ++-
.../epmet/service/CustomerAgencyService.java | 12 ++
.../impl/CustomerAgencyServiceImpl.java | 13 ++-
.../resources/mapper/CustomerAgencyDao.xml | 17 ++-
.../resources/mapper/CustomerStaffDao.xml | 1 +
20 files changed, 254 insertions(+), 69 deletions(-)
rename epmet-auth/src/main/java/com/epmet/dto/form/{GovWxmpGetOrgsFormDTO.java => StaffOrgsFormDTO.java} (79%)
rename epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/{StaffGridInfoFormDTO.java => StaffLatestLoginGridFormDTO.java} (85%)
create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffOrgFormDTO.java
rename epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/{StaffGridInfoResultDTO.java => StaffLatestLoginGridResultDTO.java} (89%)
create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java
diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
index 0539be499d..ea4b5c8974 100644
--- a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
+++ b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
@@ -4,8 +4,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.GovWxmpEnteOrgFormDTO;
import com.epmet.dto.form.GovWxmpFormDTO;
-import com.epmet.dto.form.GovWxmpGetOrgsFormDTO;
import com.epmet.dto.form.SendSmsCodeFormDTO;
+import com.epmet.dto.form.StaffOrgsFormDTO;
+import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.GovLoginService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.util.List;
+
/**
* @Description 政府端登录
* @Author yinzuomei
@@ -58,10 +61,10 @@ public class GovLoginController {
* @Description 3、手机验证码获取组织
* @Date 2020/4/18 21:14
**/
- @PostMapping(value = "/loginwxmp/getorgs")
- public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) {
+ @PostMapping(value = "/loginwxmp/getmyorg")
+ public Result> getmyorg(StaffOrgsFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
- return govLoginService.getorgs(formDTO);
+ return govLoginService.getMyOrg(formDTO);
}
/**
diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgsFormDTO.java
similarity index 79%
rename from epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java
rename to epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgsFormDTO.java
index b2674f3277..e36c100809 100644
--- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java
+++ b/epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgsFormDTO.java
@@ -11,12 +11,18 @@ import java.io.Serializable;
* @Date 2020/4/18 10:38
*/
@Data
-public class GovWxmpGetOrgsFormDTO implements Serializable {
+public class StaffOrgsFormDTO implements Serializable {
private static final long serialVersionUID = 4193133227120225342L;
+ /**
+ * 手机号
+ */
@NotBlank(message = "手机号不能为空")
private String mobile;
+ /**
+ * 验证码
+ */
@NotBlank(message="验证码不能为空")
private String smsCode;
}
diff --git a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
index 45fe847c49..d62c41b2c4 100644
--- a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
+++ b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
@@ -76,7 +76,7 @@ public interface EpmetUserFeignClient {
* @Date 2020/4/18 22:44
**/
@PostMapping(value = "epmetuser/staffwechat/savestaffwechat", consumes = MediaType.APPLICATION_JSON_VALUE)
- Result savestaffwechat(@RequestBody StaffWechatFormDTO staffWechatFormDTO);
+ Result saveStaffWechat(@RequestBody StaffWechatFormDTO staffWechatFormDTO);
/**
* @param openId
diff --git a/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java
index 0d3fe7c566..f284da98ab 100644
--- a/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java
+++ b/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java
@@ -2,8 +2,10 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
-import com.epmet.dto.form.StaffGridInfoFormDTO;
-import com.epmet.dto.result.StaffGridInfoResultDTO;
+import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
+import com.epmet.dto.form.StaffOrgFormDTO;
+import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
+import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.feign.fallback.GovOrgFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
@@ -18,6 +20,23 @@ import java.util.List;
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallback.class)
public interface GovOrgFeignClient {
- @PostMapping(value = "getStaffGridInfo",consumes = MediaType.APPLICATION_JSON_VALUE)
- Result> getStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO);
+ /**
+ * @return com.epmet.commons.tools.utils.Result>
+ * @param staffGridInfoFormDTO
+ * @Author yinzuomei
+ * @Description
+ * @Date 2020/4/20 21:36
+ **/
+ @PostMapping(value = "gov/org/customergrid/getStaffGridInfo",consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result getStaffLatestLoginGrid(StaffLatestLoginGridFormDTO staffGridInfoFormDTO);
+
+ /**
+ * @return com.epmet.commons.tools.utils.Result>
+ * @param staffOrgFormDTO
+ * @Author yinzuomei
+ * @Description 获取客户对应的根级组织名称
+ * @Date 2020/4/20 21:37
+ **/
+ @PostMapping(value = "/gov/org/customeragency/getStaffOrgList",consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO);
}
diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
index 9126cf63b8..571785b43f 100644
--- a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
+++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
@@ -43,7 +43,7 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
}
@Override
- public Result savestaffwechat(StaffWechatFormDTO staffWechatFormDTO) {
+ public Result saveStaffWechat(StaffWechatFormDTO staffWechatFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffWechat", staffWechatFormDTO);
}
diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java
index 94a235f3ec..6121363dfd 100644
--- a/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java
+++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java
@@ -3,8 +3,10 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
-import com.epmet.dto.form.StaffGridInfoFormDTO;
-import com.epmet.dto.result.StaffGridInfoResultDTO;
+import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
+import com.epmet.dto.form.StaffOrgFormDTO;
+import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
+import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
@@ -18,8 +20,13 @@ import java.util.List;
@Component
public class GovOrgFeignClientFallback implements GovOrgFeignClient {
@Override
- public Result> getStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO) {
- return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGridInfo", staffGridInfoFormDTO);
+ public Result getStaffLatestLoginGrid(StaffLatestLoginGridFormDTO staffLatestLoginGridFormDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffLatestLoginGrid", staffLatestLoginGridFormDTO);
+ }
+
+ @Override
+ public Result> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffOrgList", staffOrgFormDTO);
}
}
diff --git a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
index 0ec9158dae..acdd85f490 100644
--- a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
+++ b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
@@ -11,7 +11,6 @@ package com.epmet.redis;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
-import com.epmet.dto.form.GovWxmpGetOrgsFormDTO;
import com.epmet.dto.form.SendSmsCodeFormDTO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -72,14 +71,14 @@ public class CaptchaRedis {
}
/**
- * @param formDTO
+ * @param mobile
* @return java.lang.String
* @Author yinzuomei
* @Description 获取登录时发送的验证码
* @Date 2020/4/18 21:33
**/
- public String getSmsCode(GovWxmpGetOrgsFormDTO formDTO) {
- String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_GOV, LoginConstant.CLIENT_WXMP, formDTO.getMobile());
+ public String getSmsCode(String mobile) {
+ String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_GOV, LoginConstant.CLIENT_WXMP, mobile);
String smsCode = (String) redisUtils.get(smsCodeKey);
return smsCode;
}
diff --git a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java
index f01e6ef096..8e98ad44de 100644
--- a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java
+++ b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java
@@ -3,10 +3,13 @@ package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.GovWxmpEnteOrgFormDTO;
import com.epmet.dto.form.GovWxmpFormDTO;
-import com.epmet.dto.form.GovWxmpGetOrgsFormDTO;
import com.epmet.dto.form.SendSmsCodeFormDTO;
+import com.epmet.dto.form.StaffOrgsFormDTO;
+import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
+import java.util.List;
+
/**
* @Description 政府端登录服务
* @Author yinzuomei
@@ -29,7 +32,7 @@ public interface GovLoginService {
* @Description 3、手机验证码获取组织
* @Date 2020/4/18 21:11
**/
- Result getorgs(GovWxmpGetOrgsFormDTO formDTO);
+ Result> getMyOrg(StaffOrgsFormDTO formDTO);
/**
* @param formDTO
diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
index 055d169e27..5f6480ef2c 100644
--- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
+++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
@@ -10,9 +10,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.PhoneValidatorUtils;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.*;
-import com.epmet.dto.result.LatestStaffWechatLoginResultDTO;
-import com.epmet.dto.result.StaffGridInfoResultDTO;
-import com.epmet.dto.result.UserTokenResultDTO;
+import com.epmet.dto.result.*;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.MessageFeignClient;
@@ -26,6 +24,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -96,7 +95,7 @@ public class GovLoginServiceImpl implements GovLoginService {
* @Date 2020/4/18 21:11
**/
@Override
- public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) {
+ public Result> getMyOrg(StaffOrgsFormDTO formDTO) {
//1、根据手机号查询到用户信息
Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile());
if (!customerStaffResult.success()) {
@@ -104,12 +103,19 @@ public class GovLoginServiceImpl implements GovLoginService {
return new Result().error(customerStaffResult.getCode());
}
//2、验证码是否正确
- String rightSmsCode = captchaRedis.getSmsCode(formDTO);
+ String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile());
if (!formDTO.getSmsCode().equals(rightSmsCode)) {
- return new Result<>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
+ return new Result>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
- //3、TODO返回组织树
- return new Result();
+ //3、查询用户所有的组织信息
+ List customerIdList = new ArrayList<>();
+ for (CustomerStaffDTO customerStaffDTO : customerStaffResult.getData()) {
+ customerIdList.add(customerStaffDTO.getCustomerId());
+ }
+ StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO();
+ staffOrgFormDTO.setCustomerIdList(customerIdList);
+ Result> result = govOrgFeignClient.getStaffOrgList(staffOrgFormDTO);
+ return result;
}
@Override
@@ -129,12 +135,34 @@ public class GovLoginServiceImpl implements GovLoginService {
//4、获取用户token
String token = this.generateGovWxmpToken(latestStaffWechatLoginDTO.getStaffId());
//5、保存到redis
- this.saveGovTokenDto(latestStaffWechatLoginDTO.getOrgId(), latestStaffWechatLoginDTO.getGridId(), latestStaffWechatLoginDTO.getStaffId(), wxMaJscode2SessionResult, token);
+ this.saveLatestGovTokenDto(latestStaffWechatLoginDTO, wxMaJscode2SessionResult, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return new Result().ok(userTokenResultDTO);
}
+ //保存tokenDto到redis
+ private void saveLatestGovTokenDto(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO,
+ WxMaJscode2SessionResult wxMaJscode2SessionResult,
+ String token) {
+ int expire = jwtTokenProperties.getExpire();
+ GovTokenDto govTokenDto = new GovTokenDto();
+ govTokenDto.setApp(LoginConstant.APP_GOV);
+ govTokenDto.setClient(LoginConstant.CLIENT_WXMP);
+ govTokenDto.setStaffId(latestStaffWechatLoginDTO.getStaffId());
+ govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid());
+ govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey());
+ govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid());
+ govTokenDto.setToken(token);
+ govTokenDto.setUpdateTime(System.currentTimeMillis());
+ govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
+ govTokenDto.setOrgId(latestStaffWechatLoginDTO.getOrgId());
+ govTokenDto.setGridId(latestStaffWechatLoginDTO.getGridId());
+ govTokenDto.setCustomerId(latestStaffWechatLoginDTO.getCustomerId());
+ cpUserDetailRedis.set(govTokenDto, expire);
+ logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
+ }
+
//保存登录日志
private Result saveStaffLoginRecord(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO) {
StaffLoginHistoryFormDTO staffLoginHistoryFormDTO = new StaffLoginHistoryFormDTO();
@@ -164,19 +192,30 @@ public class GovLoginServiceImpl implements GovLoginService {
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode());
//3、记录staff_wechat
this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
- //4、记录登录日志
- StaffGridInfoFormDTO staffGridInfoFormDTO = new StaffGridInfoFormDTO();
+ //4、查询用户绑定的网格
+ StaffLatestLoginGridResultDTO latestGridInfo = this.getLatestGridInfo(formDTO, customerStaff.getUserId());
+ //5、记录登录日志
+ this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), latestGridInfo.getGridId());
+ //1、获取用户token
+ String token = this.generateGovWxmpToken(customerStaff.getUserId());
+ //2、保存到redis
+ this.saveGovTokenDto(formDTO.getOrgId(), formDTO.getCustomerId(), latestGridInfo.getGridId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
+ UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
+ userTokenResultDTO.setToken(token);
+ return new Result().ok(userTokenResultDTO);
+ }
+
+ //查询用户绑定的网格
+ private StaffLatestLoginGridResultDTO getLatestGridInfo(GovWxmpEnteOrgFormDTO formDTO, String userId) {
+ StaffLatestLoginGridFormDTO staffGridInfoFormDTO = new StaffLatestLoginGridFormDTO();
staffGridInfoFormDTO.setCustomerId(formDTO.getCustomerId());
staffGridInfoFormDTO.setOrgId(formDTO.getOrgId());
- staffGridInfoFormDTO.setStaffId(customerStaff.getUserId());
- Result> staffGridInfoListResult = govOrgFeignClient.getStaffGridInfo(staffGridInfoFormDTO);
- String gridId = null;
- if (staffGridInfoListResult.success() && null != staffGridInfoListResult.getData() && staffGridInfoListResult.getData().size() > 0) {
- gridId = staffGridInfoListResult.getData().get(0).getGridId();
+ staffGridInfoFormDTO.setStaffId(userId);
+ Result staffGridInfoListResult = govOrgFeignClient.getStaffLatestLoginGrid(staffGridInfoFormDTO);
+ if (staffGridInfoListResult.success() && null != staffGridInfoListResult.getData()) {
+ return staffGridInfoListResult.getData();
}
- this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), gridId);
- UserTokenResultDTO userTokenResultDTO = this.getAuthorizationInfo(formDTO.getOrgId(), gridId, customerStaff.getUserId(), wxMaJscode2SessionResult);
- return new Result().ok(userTokenResultDTO);
+ return new StaffLatestLoginGridResultDTO();
}
//保存登录日志
@@ -192,18 +231,6 @@ public class GovLoginServiceImpl implements GovLoginService {
return staffLoginRecordResult;
}
- private UserTokenResultDTO getAuthorizationInfo(String orgId,
- String gridId,
- String staffId,
- WxMaJscode2SessionResult wxMaJscode2SessionResult) {
- //1、获取用户token
- String token = this.generateGovWxmpToken(staffId);
- //2、保存到redis
- this.saveGovTokenDto(orgId, gridId, staffId, wxMaJscode2SessionResult, token);
- UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
- userTokenResultDTO.setToken(token);
- return userTokenResultDTO;
- }
/**
* @param userId
@@ -217,7 +244,7 @@ public class GovLoginServiceImpl implements GovLoginService {
StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO();
staffWechatFormDTO.setUserId(userId);
staffWechatFormDTO.setWxOpenId(openid);
- return epmetUserFeignClient.savestaffwechat(staffWechatFormDTO);
+ return epmetUserFeignClient.saveStaffWechat(staffWechatFormDTO);
}
/**
@@ -238,11 +265,12 @@ public class GovLoginServiceImpl implements GovLoginService {
* @Description 生成token
* @Date 2020/4/18 23:04
**/
- private String saveGovTokenDto(String orgId,
- String gridId,
- String staffId,
- WxMaJscode2SessionResult wxMaJscode2SessionResult,
- String token) {
+ private void saveGovTokenDto(String orgId,
+ String customerId,
+ String gridId,
+ String staffId,
+ WxMaJscode2SessionResult wxMaJscode2SessionResult,
+ String token) {
int expire = jwtTokenProperties.getExpire();
GovTokenDto govTokenDto = new GovTokenDto();
govTokenDto.setApp(LoginConstant.APP_GOV);
@@ -256,9 +284,9 @@ public class GovLoginServiceImpl implements GovLoginService {
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
govTokenDto.setOrgId(orgId);
govTokenDto.setGridId(gridId);
+ govTokenDto.setCustomerId(customerId);
cpUserDetailRedis.set(govTokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
- return token;
}
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java
index 08d9954eda..e46a4c1119 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java
@@ -58,22 +58,27 @@ public class GovTokenDto implements Serializable {
private long updateTime;
/**
- * 当前登录的组织id
+ * 当前工作人员进入的客户id
+ */
+ private String customerId;
+
+ /**
+ * 当前登录的组织id(顶级)
*/
private String orgId;
/**
- * 待定
+ * 当前网格对应的组织结构id的全路径用:隔开
*/
private String orgIdPath;
/**
- * 待定
+ * 当前所在网格id
*/
private String gridId;
/**
- * 待定
+ * 部门id列表
*/
private List deptIdList;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java
similarity index 85%
rename from epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java
rename to epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java
index 85b321f25a..f07e657f73 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java
@@ -11,7 +11,7 @@ import java.io.Serializable;
* @Date 2020/4/20 15:29
*/
@Data
-public class StaffGridInfoFormDTO implements Serializable {
+public class StaffLatestLoginGridFormDTO implements Serializable {
/**
* 用户选择的组织所属的id
*/
@@ -24,6 +24,9 @@ public class StaffGridInfoFormDTO implements Serializable {
@NotBlank(message = "组织id不能为空")
private String orgId;
+ /**
+ * 工作人员id
+ */
@NotBlank(message = "staffId不能为空")
private String staffId;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffOrgFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffOrgFormDTO.java
new file mode 100644
index 0000000000..d2cb982645
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffOrgFormDTO.java
@@ -0,0 +1,18 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description 根据客户id查询组织结构信息入参
+ * @Author yinzuomei
+ * @Date 2020/4/20 21:42
+ */
+@Data
+public class StaffOrgFormDTO implements Serializable {
+ private static final long serialVersionUID = 2514896455028592288L;
+ private List customerIdList;
+}
+
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java
similarity index 89%
rename from epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java
rename to epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java
index e636db75ee..4c067bdbe2 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java
@@ -10,7 +10,7 @@ import java.io.Serializable;
* @Date 2020/4/20 15:22
*/
@Data
-public class StaffGridInfoResultDTO implements Serializable {
+public class StaffLatestLoginGridResultDTO implements Serializable {
/**
* ID 唯一标识
*/
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java
new file mode 100644
index 0000000000..58955cc634
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java
@@ -0,0 +1,31 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description 政府端工作人员获取我的组织
+ * @Author yinzuomei
+ * @Date 2020/4/20 18:45
+ */
+@Data
+public class StaffOrgsResultDTO implements Serializable {
+ private static final long serialVersionUID = -9148184731135509803L;
+
+ /**
+ * 组织id
+ */
+ private String orgId;
+
+ /**
+ * 客户id
+ */
+ private String customerId;
+
+ /**
+ * 组织名称
+ */
+ private String orgName;
+}
+
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
index 550cdb1832..a1e5ea58fe 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
@@ -23,9 +23,11 @@ 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.CustomerAgencyDTO;
+import com.epmet.dto.form.StaffOrgFormDTO;
+import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.excel.CustomerAgencyExcel;
import com.epmet.service.CustomerAgencyService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -91,4 +93,15 @@ public class CustomerAgencyController {
ExcelUtils.exportExcelToTarget(response, null, list, CustomerAgencyExcel.class);
}
+ /**
+ * @return com.epmet.commons.tools.utils.Result>
+ * @param staffOrgsFormDTO
+ * @Author yinzuomei
+ * @Description 登录-获取工作人员所有组织
+ * @Date 2020/4/20 21:59
+ **/
+ @PostMapping("getStaffOrgList")
+ public Result> getStaffOrgList(@RequestBody StaffOrgFormDTO staffOrgsFormDTO){
+ return customerAgencyService.getStaffOrgList(staffOrgsFormDTO);
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
index 185d2d33a1..4f85e09091 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
@@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.entity.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* 机关单位信息表
@@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerAgencyDao extends BaseDao {
-
+ /**
+ * @param customerIdList
+ * @return java.util.List
+ * @Author yinzuomei
+ * @Description 查询客户对应的根级组织
+ * @Date 2020/4/20 21:48
+ **/
+ List selectStaffOrgList(@Param("customerIdList") List customerIdList);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
index 319e26890f..62892b4576 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
@@ -19,7 +19,10 @@ 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.CustomerAgencyDTO;
+import com.epmet.dto.form.StaffOrgFormDTO;
+import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.entity.CustomerAgencyEntity;
import java.util.List;
@@ -92,4 +95,13 @@ public interface CustomerAgencyService extends BaseService
* @date 2020-04-20
*/
void delete(String[] ids);
+
+ /**
+ * @param staffOrgsFormDTO
+ * @return com.epmet.commons.tools.utils.Result>
+ * @Author yinzuomei
+ * @Description 根据客户id查询组织名称
+ * @Date 2020/4/20 21:45
+ **/
+ Result> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
index fa513326e4..2a2b79a024 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
@@ -20,11 +20,14 @@ 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.constant.FieldConstant;
+import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dto.CustomerAgencyDTO;
+import com.epmet.dto.form.StaffOrgFormDTO;
+import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.CustomerAgencyService;
@@ -101,4 +104,12 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO) {
+ if (null == staffOrgsFormDTO || staffOrgsFormDTO.getCustomerIdList().size() == 0) {
+ return new Result<>();
+ }
+ List list = baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList());
+ return new Result>().ok(list);
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
index 18bb63b7b9..03f2671806 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
@@ -21,5 +21,20 @@
-
+
+
\ 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 1a8958a306..3478b0fbba 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
@@ -8,6 +8,7 @@
select * from customer_staff cs
where cs.MOBILE=#{mobile}
and cs.DEL_FLAG='1'
+ order by cs.ACTIVE_TIME desc,cs.CREATED_TIME asc
From aa2c0d1ab76fd874fae0fa70ac03cda29a8a5b98 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 20 Apr 2020 23:06:26 +0800
Subject: [PATCH 05/85] =?UTF-8?q?=E5=88=A0=E9=99=A4staff=5Flogin=5Fhistory?=
=?UTF-8?q?=EF=BC=8C=E6=94=B9=E4=B8=BAstaff=5Fagency=5Fhistory?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/epmet/feign/EpmetUserFeignClient.java | 10 ++--
.../EpmetUserFeignClientFallback.java | 6 +-
.../service/impl/GovLoginServiceImpl.java | 58 +++++++++---------
.../controller/CustomerGridController.java | 6 +-
.../java/com/epmet/dao/CustomerGridDao.java | 6 +-
.../epmet/service/CustomerGridService.java | 6 +-
.../service/impl/CustomerGridServiceImpl.java | 16 ++---
.../main/resources/mapper/CustomerGridDao.xml | 2 +-
...ava => StaffLoginAgencyRecordFormDTO.java} | 2 +-
...O.java => StaffLatestAgencyResultDTO.java} | 7 +--
...java => StaffAgencyHistoryController.java} | 23 +++----
...oryDao.java => StaffAgencyHistoryDao.java} | 13 ++--
...ce.java => StaffAgencyHistoryService.java} | 33 +++++-----
...ava => StaffAgencyHistoryServiceImpl.java} | 60 +++++++++----------
14 files changed, 121 insertions(+), 127 deletions(-)
rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/{StaffLoginHistoryFormDTO.java => StaffLoginAgencyRecordFormDTO.java} (89%)
rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/{LatestStaffWechatLoginResultDTO.java => StaffLatestAgencyResultDTO.java} (80%)
rename epmet-user/epmet-user-server/src/main/java/com/epmet/controller/{StaffLoginHistoryController.java => StaffAgencyHistoryController.java} (68%)
rename epmet-user/epmet-user-server/src/main/java/com/epmet/dao/{StaffLoginHistoryDao.java => StaffAgencyHistoryDao.java} (78%)
rename epmet-user/epmet-user-server/src/main/java/com/epmet/service/{StaffLoginHistoryService.java => StaffAgencyHistoryService.java} (71%)
rename epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/{StaffLoginHistoryServiceImpl.java => StaffAgencyHistoryServiceImpl.java} (54%)
diff --git a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
index d62c41b2c4..d0a61aa757 100644
--- a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
+++ b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
@@ -6,8 +6,8 @@ import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.*;
-import com.epmet.dto.result.LatestStaffWechatLoginResultDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
+import com.epmet.dto.result.StaffLatestAgencyResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
@@ -85,8 +85,8 @@ public interface EpmetUserFeignClient {
* @Description 获取当前微信上次登录的账号信息
* @Date 2020/4/20 12:53
**/
- @GetMapping(value = "epmetuser/staffloginhistory/getlatest/{openId}")
- Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId);
+ @GetMapping(value = "epmetuser/staffagencyhistory/getlatest/{openId}")
+ Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId);
/**
* @param customerStaffFormDTO
@@ -105,6 +105,6 @@ public interface EpmetUserFeignClient {
* @Description 保存登录日志
* @Date 2020/4/20 14:38
**/
- @PostMapping(value = "epmetuser/staffloginhistory/saveStaffLoginRecord", consumes = MediaType.APPLICATION_JSON_VALUE)
- Result saveStaffLoginRecord(StaffLoginHistoryFormDTO staffLoginHistoryFormDTO);
+ @PostMapping(value = "epmetuser/staffagencyhistory/saveStaffLoginRecord", consumes = MediaType.APPLICATION_JSON_VALUE)
+ Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO staffLoginHistoryFormDTO);
}
diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
index 571785b43f..b08fcbca1a 100644
--- a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
+++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
@@ -7,8 +7,8 @@ import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.*;
-import com.epmet.dto.result.LatestStaffWechatLoginResultDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
+import com.epmet.dto.result.StaffLatestAgencyResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
@@ -48,7 +48,7 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
}
@Override
- public Result getLatestStaffWechatLoginRecord(String openId) {
+ public Result getLatestStaffWechatLoginRecord(String openId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestStaffWechatLoginRecord", openId);
}
@@ -58,7 +58,7 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
}
@Override
- public Result saveStaffLoginRecord(StaffLoginHistoryFormDTO staffLoginHistoryFormDTO) {
+ public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO staffLoginHistoryFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffLoginRecord", staffLoginHistoryFormDTO);
}
diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
index 5f6480ef2c..d8ebf53c1e 100644
--- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
+++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
@@ -122,57 +122,55 @@ public class GovLoginServiceImpl implements GovLoginService {
public Result loginByWxCode(GovWxmpFormDTO formDTO) {
//1、解析微信用户
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode());
- Result latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid());
+ Result latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid());
if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) {
logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg()));
return new Result().error(EpmetErrorCode.PLEASE_LOGIN.getCode());
}
- LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO = latestStaffWechat.getData();
+ StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData();
//2、记录staff_wechat
- this.savestaffwechat(latestStaffWechatLoginDTO.getStaffId(), wxMaJscode2SessionResult.getOpenid());
+ this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), wxMaJscode2SessionResult.getOpenid());
//3、记录登录日志
- this.saveStaffLoginRecord(latestStaffWechatLoginDTO);
+ this.saveStaffLoginRecord(staffLatestAgencyResultDTO);
//4、获取用户token
- String token = this.generateGovWxmpToken(latestStaffWechatLoginDTO.getStaffId());
+ String token = this.generateGovWxmpToken(staffLatestAgencyResultDTO.getStaffId());
//5、保存到redis
- this.saveLatestGovTokenDto(latestStaffWechatLoginDTO, wxMaJscode2SessionResult, token);
+ this.saveLatestGovTokenDto(staffLatestAgencyResultDTO, wxMaJscode2SessionResult, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return new Result().ok(userTokenResultDTO);
}
//保存tokenDto到redis
- private void saveLatestGovTokenDto(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO,
+ private void saveLatestGovTokenDto(StaffLatestAgencyResultDTO staffLatestAgency,
WxMaJscode2SessionResult wxMaJscode2SessionResult,
String token) {
int expire = jwtTokenProperties.getExpire();
GovTokenDto govTokenDto = new GovTokenDto();
govTokenDto.setApp(LoginConstant.APP_GOV);
govTokenDto.setClient(LoginConstant.CLIENT_WXMP);
- govTokenDto.setStaffId(latestStaffWechatLoginDTO.getStaffId());
+ govTokenDto.setStaffId(staffLatestAgency.getStaffId());
govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid());
govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey());
govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid());
govTokenDto.setToken(token);
govTokenDto.setUpdateTime(System.currentTimeMillis());
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
- govTokenDto.setOrgId(latestStaffWechatLoginDTO.getOrgId());
- govTokenDto.setGridId(latestStaffWechatLoginDTO.getGridId());
- govTokenDto.setCustomerId(latestStaffWechatLoginDTO.getCustomerId());
+ govTokenDto.setOrgId(staffLatestAgency.getOrgId());
+ govTokenDto.setCustomerId(staffLatestAgency.getCustomerId());
cpUserDetailRedis.set(govTokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
}
//保存登录日志
- private Result saveStaffLoginRecord(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO) {
- StaffLoginHistoryFormDTO staffLoginHistoryFormDTO = new StaffLoginHistoryFormDTO();
- staffLoginHistoryFormDTO.setCustomerId(latestStaffWechatLoginDTO.getCustomerId());
- staffLoginHistoryFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId());
- staffLoginHistoryFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId());
- staffLoginHistoryFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile());
- staffLoginHistoryFormDTO.setOrgId(latestStaffWechatLoginDTO.getOrgId());
- staffLoginHistoryFormDTO.setGridId(latestStaffWechatLoginDTO.getGridId());
- Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginHistoryFormDTO);
+ private Result saveStaffLoginRecord(StaffLatestAgencyResultDTO latestStaffWechatLoginDTO) {
+ StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO();
+ staffLoginAgencyRecordFormDTO.setCustomerId(latestStaffWechatLoginDTO.getCustomerId());
+ staffLoginAgencyRecordFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId());
+ staffLoginAgencyRecordFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId());
+ staffLoginAgencyRecordFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile());
+ staffLoginAgencyRecordFormDTO.setOrgId(latestStaffWechatLoginDTO.getOrgId());
+ Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO);
return staffLoginRecordResult;
}
@@ -199,7 +197,7 @@ public class GovLoginServiceImpl implements GovLoginService {
//1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId());
//2、保存到redis
- this.saveGovTokenDto(formDTO.getOrgId(), formDTO.getCustomerId(), latestGridInfo.getGridId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
+ this.saveGovTokenDto(formDTO.getOrgId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return new Result().ok(userTokenResultDTO);
@@ -220,14 +218,14 @@ public class GovLoginServiceImpl implements GovLoginService {
//保存登录日志
private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId, String grid) {
- StaffLoginHistoryFormDTO staffLoginHistoryFormDTO = new StaffLoginHistoryFormDTO();
- staffLoginHistoryFormDTO.setCustomerId(formDTO.getCustomerId());
- staffLoginHistoryFormDTO.setStaffId(staffId);
- staffLoginHistoryFormDTO.setWxOpenId(openId);
- staffLoginHistoryFormDTO.setMobile(formDTO.getMobile());
- staffLoginHistoryFormDTO.setOrgId(formDTO.getOrgId());
- staffLoginHistoryFormDTO.setGridId(grid);
- Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginHistoryFormDTO);
+ StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO();
+ staffLoginAgencyRecordFormDTO.setCustomerId(formDTO.getCustomerId());
+ staffLoginAgencyRecordFormDTO.setStaffId(staffId);
+ staffLoginAgencyRecordFormDTO.setWxOpenId(openId);
+ staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile());
+ staffLoginAgencyRecordFormDTO.setOrgId(formDTO.getOrgId());
+ staffLoginAgencyRecordFormDTO.setGridId(grid);
+ Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO);
return staffLoginRecordResult;
}
@@ -267,7 +265,6 @@ public class GovLoginServiceImpl implements GovLoginService {
**/
private void saveGovTokenDto(String orgId,
String customerId,
- String gridId,
String staffId,
WxMaJscode2SessionResult wxMaJscode2SessionResult,
String token) {
@@ -283,7 +280,6 @@ public class GovLoginServiceImpl implements GovLoginService {
govTokenDto.setUpdateTime(System.currentTimeMillis());
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
govTokenDto.setOrgId(orgId);
- govTokenDto.setGridId(gridId);
govTokenDto.setCustomerId(customerId);
cpUserDetailRedis.set(govTokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
index 8163a30c15..b9c8f8672f 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
@@ -28,9 +28,9 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
-import com.epmet.dto.form.StaffGridInfoFormDTO;
+import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
-import com.epmet.dto.result.StaffGridInfoResultDTO;
+import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.excel.CustomerGridExcel;
import com.epmet.service.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -135,7 +135,7 @@ public class CustomerGridController {
* @Date 2020/4/20 15:34
**/
@PostMapping(value = "getStaffGridInfo")
- public Result> getStaffGridInfo(@RequestBody StaffGridInfoFormDTO staffGridInfoFormDTO) {
+ public Result getStaffGridInfo(@RequestBody StaffLatestLoginGridFormDTO staffGridInfoFormDTO) {
ValidatorUtils.validateEntity(staffGridInfoFormDTO);
return customerGridService.listStaffGridInfo(staffGridInfoFormDTO);
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
index b42077b396..d8c308ec90 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
@@ -21,9 +21,9 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
-import com.epmet.dto.form.StaffGridInfoFormDTO;
+import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
-import com.epmet.dto.result.StaffGridInfoResultDTO;
+import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.entity.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
@@ -70,5 +70,5 @@ public interface CustomerGridDao extends BaseDao {
* @Description 查询工作人员绑定的网格列表
* @Date 2020/4/20 15:36
**/
- List selectListStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO);
+ List selectListStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
index d8728c39dd..7b48c8724d 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
@@ -23,9 +23,9 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
-import com.epmet.dto.form.StaffGridInfoFormDTO;
+import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
-import com.epmet.dto.result.StaffGridInfoResultDTO;
+import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.entity.CustomerGridEntity;
import java.util.List;
@@ -123,5 +123,5 @@ public interface CustomerGridService extends BaseService {
* @Description 根据用户选择的组织,查询用户与网格的关系列表
* @Date 2020/4/20 15:35
**/
- Result> listStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO);
+ Result listStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
index d4e61df8b1..b27f57019f 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
@@ -20,19 +20,18 @@ 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.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerGridDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
-import com.epmet.dto.form.StaffGridInfoFormDTO;
+import com.epmet.dto.form.StaffLatestLoginGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
-import com.epmet.dto.result.StaffGridInfoResultDTO;
+import com.epmet.dto.result.StaffLatestLoginGridResultDTO;
import com.epmet.entity.CustomerGridEntity;
-
import com.epmet.redis.CustomerGridRedis;
import com.epmet.service.CustomerGridService;
import com.epmet.util.ModuleConstant;
@@ -155,9 +154,12 @@ public class CustomerGridServiceImpl extends BaseServiceImpl> listStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO) {
- List list = baseDao.selectListStaffGridInfo(staffGridInfoFormDTO);
- return new Result>().ok(list);
+ public Result listStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO) {
+ List list = baseDao.selectListStaffGridInfo(staffGridInfoFormDTO);
+ if(null!=list&&list.size()>0){
+ return new Result().ok(list.get(0));
+ }
+ return new Result<>();
}
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
index 6ea3950fb8..5fa9468faa 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
@@ -94,7 +94,7 @@
-