Browse Source

登录相关接口修改

master
yinzuomei 6 years ago
parent
commit
a48ed358b0
  1. 8
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  2. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  3. 14
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  4. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  5. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java
  6. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  7. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffWechatServiceImpl.java
  8. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

8
epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java

@ -193,13 +193,13 @@ public class GovLoginServiceImpl implements GovLoginService {
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
//2、解析微信用户
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode());
//3、记录staff_wechat
//3、记录staff_wechat,并记录用户激活状态,激活时间
this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//5、记录登录日志
//4、记录登录日志
this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//1、获取用户token
//5.1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId());
//2、保存到redis
//5.2、保存到redis
this.saveGovTokenDto(formDTO.getAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -132,7 +132,7 @@ public class CustomerGridController {
* @Description 根据userId查询该用户涉及的所有网格列表
* @Author sun
*/
@PostMapping("getmygrids/{userId}")
@GetMapping("getmygrids/{userId}")
public Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(@PathVariable("userId") String userId) {
return customerGridService.getMyGrids(userId);
}

14
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -24,15 +24,15 @@
<!-- 查询客户对应的根级组织 -->
<select id="selectStaffOrgList" parameterType="map" resultType="com.epmet.dto.result.StaffOrgsResultDTO">
SELECT
cta.pid AS orgId,
cta.CUSTOMER_ID AS customerId,
cta.ORGANIZATION_NAME AS orgName
ca.pid AS orgId,
ca.CUSTOMER_ID AS customerId,
ca.ORGANIZATION_NAME AS orgName
FROM
customer_staff_agency cta
customer_agency ca
WHERE
cta.DEL_FLAG = '0'
AND co.PID = '0'
and cta.CUSTOMER_ID IN
ca.DEL_FLAG = '0'
AND ca.PID = '0'
and ca.CUSTOMER_ID IN
<foreach item="customerId" collection="customerIdList" open="(" separator="," close=")">
#{customerId}
</foreach>

3
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -105,8 +105,7 @@
cg.del_flag = '0'
AND csg.del_flag = '0'
AND csg.user_id = #{userId}
ORDER BY
cg.created_time DESC
ORDER BY cg.GRID_NAME ASC
</select>
<!-- 根据gridId获取网格详情 -->

10
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java

@ -57,4 +57,14 @@ public interface UserConstant {
* 未禁用enable,已禁用diabled
*/
String DISABLED="disabled";
/**
* inactive未激活active已激活
*/
String INACTIVE="inactive";
/**
* inactive未激活active已激活
*/
String ACTIVE="active";
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -62,4 +62,13 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @return
*/
List<StaffGridListDTO> selectStaffGridListByUserId(List<CustomerStaffGridDTO> customerStaffGridDTOS);
/**
* @return com.epmet.entity.CustomerStaffEntity
* @param userId
* @Author yinzuomei
* @Description 根据staffid查询用户基本信息
* @Date 2020/4/23 16:46
**/
CustomerStaffEntity selectByUserId(String userId);
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffWechatServiceImpl.java

@ -24,18 +24,23 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.dao.CustomerStaffDao;
import com.epmet.dao.StaffWechatDao;
import com.epmet.dto.StaffWechatDTO;
import com.epmet.dto.form.StaffWechatFormDTO;
import com.epmet.entity.CustomerStaffEntity;
import com.epmet.entity.StaffWechatEntity;
import com.epmet.service.StaffWechatService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -48,7 +53,8 @@ import java.util.Map;
@Service
public class StaffWechatServiceImpl extends BaseServiceImpl<StaffWechatDao, StaffWechatEntity> implements StaffWechatService {
private Logger logger = LogManager.getLogger(getClass());
@Autowired
private CustomerStaffDao customerStaffDao;
@Override
public PageData<StaffWechatDTO> page(Map<String, Object> params) {
IPage<StaffWechatEntity> page = baseDao.selectPage(
@ -119,6 +125,14 @@ public class StaffWechatServiceImpl extends BaseServiceImpl<StaffWechatDao, Staf
logger.info(String.format("staff_Wechat记录已存在,userId[%s],wxOpenId[%s]", formDTO.getUserId(), formDTO.getWxOpenId()));
this.update(staffWechatDTO);
}
//记录用户激活状态,激活时间
CustomerStaffEntity customerStaffEntity=customerStaffDao.selectByUserId(formDTO.getUserId());
if(null!=customerStaffEntity&&null==customerStaffEntity.getActiveTime()){
customerStaffEntity.setActiveTime(new Date());
//inactive未激活,active已激活
customerStaffEntity.setActiveFlag(UserConstant.ACTIVE);
customerStaffDao.updateById(customerStaffEntity);
}
return new Result();
}

11
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -41,4 +41,15 @@
</foreach>
AND cs.del_flag = 0
</select>
<!-- 根据staffid查询用户基本信息 -->
<select id="selectByUserId" parameterType="java.lang.String" resultType="com.epmet.entity.CustomerStaffEntity">
SELECT
*
FROM
customer_staff CS
WHERE
cs.DEL_FLAG = '0'
AND CS.USER_ID =#{userId}
</select>
</mapper>
Loading…
Cancel
Save