Commit c135396d by 墨竹

Merge branch 'feature/login-token' into developer

parents 8c143302 b110b6a4
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* @author mozhu
* @date 2021/12/16 19:50
*/
public class StaffPrivacyUseLogDTO implements Serializable {
private static final long serialVersionUID = -9137221776834569940L;
/**
* id
*/
private Long id;
/**
* 员工id
*/
private String staffId;
/**
* 微信企业id
*/
private String wxEnterpriseId;
/**
* 是否同意隐私协议,1:是;0:否
*/
private Integer privacyUseFlag;
/**
* 手机号
*/
private String phoneNumber;
/**
* 好办版本
*/
private String welldoneVersion;
/**
* 企微版本
*/
private String weworkVersion;
/**
* 用户手机品牌
*/
private String staffPhoneBrand;
/**
* 用户手机型号
*/
private String staffPhoneModel;
/**
* 用户手机版本
*/
private String staffPhoneVersion;
/**
* 登录ip
*/
private String staffIp;
/**
* create_time
*/
private Date createTime;
/**
* update_time
*/
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public Integer getPrivacyUseFlag() {
return privacyUseFlag;
}
public void setPrivacyUseFlag(Integer privacyUseFlag) {
this.privacyUseFlag = privacyUseFlag;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getWelldoneVersion() {
return welldoneVersion;
}
public void setWelldoneVersion(String welldoneVersion) {
this.welldoneVersion = welldoneVersion;
}
public String getWeworkVersion() {
return weworkVersion;
}
public void setWeworkVersion(String weworkVersion) {
this.weworkVersion = weworkVersion;
}
public String getStaffPhoneBrand() {
return staffPhoneBrand;
}
public void setStaffPhoneBrand(String staffPhoneBrand) {
this.staffPhoneBrand = staffPhoneBrand;
}
public String getStaffPhoneModel() {
return staffPhoneModel;
}
public void setStaffPhoneModel(String staffPhoneModel) {
this.staffPhoneModel = staffPhoneModel;
}
public String getStaffPhoneVersion() {
return staffPhoneVersion;
}
public void setStaffPhoneVersion(String staffPhoneVersion) {
this.staffPhoneVersion = staffPhoneVersion;
}
public String getStaffIp() {
return staffIp;
}
public void setStaffIp(String staffIp) {
this.staffIp = staffIp;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
......@@ -9,63 +9,64 @@ import java.util.List;
public interface StaffApiService {
public StaffDTO selectById(String staffId);
StaffDTO selectById(String staffId);
public StaffDTO selectSuperByWxEnterpriseId(String wxEnterpriseId);
StaffDTO selectSuperByWxEnterpriseId(String wxEnterpriseId);
public List<StaffDTO> listByIds(List<String> staffIds);
List<StaffDTO> listByIds(List<String> staffIds);
public List<StaffDTO> listByWxUserId(String wxUserId);
List<StaffDTO> listByWxUserId(String wxUserId);
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
public ServiceResponse add(StaffDTO staff, String departmentIds);
ServiceResponse add(StaffDTO staff, String departmentIds);
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
public Page<StaffDTO> pageStaff(List<String> departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo, Integer relationFlag);
Page<StaffDTO> pageStaff(List<String> departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo, Integer relationFlag);
public void del(String staffDepartmentStaffRelatedId);
void del(String staffDepartmentStaffRelatedId);
/**
* 获取微信成员
*
* @param userId
* @param wxEnterpriseId
* @return
*/
public ServiceResponse getWxSaveNew(String userId,String wxEnterpriseId);
ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId);
public void wxGetAdd(String userId,String wxEnterpriseId);
void wxGetAdd(String userId, String wxEnterpriseId);
public void staffEdit(StaffDTO staffDTO, String departmentIds);
void staffEdit(StaffDTO staffDTO, String departmentIds);
public void syscGicClerk(String fieldListString);
void syscGicClerk(String fieldListString);
public StaffDTO selectByUserIdAndEnterpriseId(String userId,String wxEnterpriseId);
StaffDTO selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId);
public StaffDepartmentRelatedDTO getDepartmentIdAndStaffId(String departmentId, String staffId);
StaffDepartmentRelatedDTO getDepartmentIdAndStaffId(String departmentId, String staffId);
public int countByDepartmentId(String departmentId);
int countByDepartmentId(String departmentId);
public void syncGicClerk(String fieldListString);
void syncGicClerk(String fieldListString);
public void addGicClerk(GicClerkDTO clerkDTO);
void addGicClerk(GicClerkDTO clerkDTO);
StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code);
void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId,String taskId);
void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId, String taskId);
public List<String> listUnBindClerk(String storeId);
List<String> listUnBindClerk(String storeId);
public void cleanGicClerk(String clerkCode, String departmentId);
void cleanGicClerk(String clerkCode, String departmentId);
public String insertUserLoginLog(UserLoginLogDTO userLoginLogDTO);
String insertUserLoginLog(UserLoginLogDTO userLoginLogDTO);
public int countByDepartmentIds(List<String> departmentIds);
int countByDepartmentIds(List<String> departmentIds);
public List<StaffDTO> listByPhoneNumber(String phoneNumber);
List<StaffDTO> listByPhoneNumber(String phoneNumber);
public List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
/**
* 保存gic成员
......@@ -73,7 +74,7 @@ public interface StaffApiService {
* @param clerkDTO
* @return
*/
public ServiceResponse saveSyncStaffByGic(GicClerkDTO clerkDTO);
ServiceResponse saveSyncStaffByGic(GicClerkDTO clerkDTO);
/**
* 获取成员头像
......@@ -82,31 +83,44 @@ public interface StaffApiService {
* @param storeId
* @return
*/
public ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
void wxFristAdd(String userJson, String wxEnterpriseId);
List<String> listBindClerkUserId(String storeId);
public List<StaffClerkRelationDTO> listBindRelationUserId(String storeId);
List<StaffClerkRelationDTO> listBindRelationUserId(String storeId);
/**
* 激活
*
* @param staffId
* @return
*/
public boolean activeStaff(String staffId);
boolean activeStaff(String staffId);
/**
* 获取一个staff
*
* @param wxEnterpriseId
* @return
*/
public StaffDTO getWxStaffOne(String wxEnterpriseId);
StaffDTO getWxStaffOne(String wxEnterpriseId);
/**
* @param wxEnterpriseId
* @return
*/
public StaffDTO getAndAddSupperAdmin(String wxEnterpriseId);
StaffDTO getAndAddSupperAdmin(String wxEnterpriseId);
/**
* 是否隐私
*
* @param staffId 员工id
* @return {@link StaffPrivacyUseLogDTO }
* @author mozhu
* @date 2021-12-16 19:53:48
*/
StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId);
}
......@@ -40,6 +40,6 @@ public interface StaffPrivacyUseLogMapper {
* @author mozhu
* @date 2021-12-15 10:49:02
*/
List<TabStaffPrivacyUseLog> getByStaffId(@Param("staffId") String staffId);
TabStaffPrivacyUseLog getByStaffId(@Param("staffId") String staffId);
}
......@@ -38,5 +38,5 @@ public interface StaffPrivacyUseLogService {
* @author mozhu
* @date 2021-12-15 10:51:32
*/
List<TabStaffPrivacyUseLogVO> getByStaffId(String staffId);
StaffPrivacyUseLogBO getByStaffId(String staffId);
}
......@@ -4,14 +4,12 @@ import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.service.dao.mapper.StaffPrivacyUseLogMapper;
import com.gic.haoban.manage.service.entity.TabStaffPrivacyUseLog;
import com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO;
import com.gic.haoban.manage.service.pojo.vo.TabStaffPrivacyUseLogVO;
import com.gic.haoban.manage.service.service.StaffPrivacyUseLogService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author xuwenqian
......@@ -44,8 +42,8 @@ public class StaffPrivacyUseLogServiceImpl implements StaffPrivacyUseLogService
}
@Override
public List<TabStaffPrivacyUseLogVO> getByStaffId(String staffId) {
List<TabStaffPrivacyUseLog> staffPrivacyUseLogList = staffPrivacyUseLogMapper.getByStaffId(staffId);
return EntityUtil.changeEntityListByOrika(TabStaffPrivacyUseLogVO.class, staffPrivacyUseLogList);
public StaffPrivacyUseLogBO getByStaffId(String staffId) {
TabStaffPrivacyUseLog tabStaffPrivacyUseLog = staffPrivacyUseLogMapper.getByStaffId(staffId);
return EntityUtil.changeEntityByOrika(StaffPrivacyUseLogBO.class, tabStaffPrivacyUseLog);
}
}
......@@ -97,6 +97,8 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired
private SecretSettingService secretSettingService;
@Autowired
private StaffPrivacyUseLogService staffPrivacyUseLogService;
@Override
public StaffDTO selectById(String staffId) {
......@@ -1468,19 +1470,9 @@ public class StaffApiServiceImpl implements StaffApiService {
return staffDTO;
}
// private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber;
// return mobile;
// }
//
// private String getNationcode(String mobile){
// String nationcode = "";
// return nationcode;
// }
//
// private String getPhoneNumber(String mobile){
// String phoneNumber = "";
// return phoneNumber;
// }
@Override
public StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId) {
return EntityUtil.changeEntity(StaffPrivacyUseLogDTO.class, staffPrivacyUseLogService.getByStaffId(staffId));
}
}
......@@ -302,6 +302,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
//插入隐私协议
StaffPrivacyUseLogBO staffPrivacyUseLogBO = new StaffPrivacyUseLogBO();
BeanUtils.copyProperties(staffLoginDTO, staffPrivacyUseLogBO);
StaffPrivacyUseLogBO privacyUseLog = staffPrivacyUseLogService.getByStaffId(staffLoginDTO.getStaffId());
if (privacyUseLog == null) {
staffPrivacyUseLogService.insert(staffPrivacyUseLogBO);
}
}
}
......@@ -142,7 +142,7 @@
SELECT
<include refid="Base_Column_List"/>
FROM tab_staff_privacy_use_log
WHERE staff_id = #{staffId}
WHERE staff_id = #{staffId} order by create_time desc limit 1
</select>
</mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.gic.clerk.api.service.ClerkService;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.MaidianLogDTO;
import com.gic.haoban.manage.api.service.MaidianLogApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class MaidianLogController extends WebBaseController{
......@@ -27,6 +27,7 @@ public class MaidianLogController extends WebBaseController{
private StoreService storeService;
@RequestMapping("save-maidian-log")
@IgnoreLogin
public HaobanResponse saveUserLoginLog(String maidianLogStr) {
if(StringUtils.isBlank(maidianLogStr)){
return resultResponse(HaoBanErrCode.ERR_2);
......
......@@ -89,6 +89,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
@Autowired
private Config config;
/**
* code授权
*
......@@ -144,23 +145,27 @@ public class WxEnterpriseInfoController extends WebBaseController {
}
}
}
String staffId = loginStaff.getStaffId();
//激活状态
if (loginStaff.getActiveFlag() == 0) {
staffApiService.activeStaff(loginStaff.getStaffId());
staffApiService.activeStaff(staffId);
}
StaffPrivacyUseLogDTO staffPrivacyUseLogDTO = staffApiService.getStaffPrivacyByStaffId(staffId);
String wxEnterpriseId = loginStaff.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
String accesstoken = qywxCorpApiService.getCorpAccessToken(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid());
WellDoneLoginInfoVO wellDoneLoginInfoVo = new WellDoneLoginInfoVO();
wellDoneLoginInfoVo.setAccessToken(accesstoken);
wellDoneLoginInfoVo.setStaffId(loginStaff.getStaffId());
wellDoneLoginInfoVo.setStaffId(staffId);
wellDoneLoginInfoVo.setWxEnterpriseId(wxEnterpriseId);
wellDoneLoginInfoVo.setStaffName(loginStaff.getStaffName());
wellDoneLoginInfoVo.setPhoneNumber(loginStaff.getPhoneNumber());
wellDoneLoginInfoVo.setNationcode(loginStaff.getNationCode());
wellDoneLoginInfoVo.setWxUserId(loginStaff.getWxUserId());
if (staffPrivacyUseLogDTO != null) {
wellDoneLoginInfoVo.setPrivacyUseFlag(staffPrivacyUseLogDTO.getPrivacyUseFlag());
}
return resultResponse(HaoBanErrCode.ERR_1, wellDoneLoginInfoVo);
}
......@@ -204,6 +209,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @date 2021-12-10 18:34:12
*/
@RequestMapping(value = "welldone-token-refresh", method = RequestMethod.GET)
@IgnoreLogin
public HaobanResponse welldoneTokenRefresh() {
String token = AuthRequestWellDoneUtil.getToken();
if (ObjectUtil.isNull(token)) {
......
......@@ -55,7 +55,7 @@ public class MobileWebInterceptor extends HandlerInterceptorAdapter {
}
WellDoneLoginDTO wellDoneLoginDTO = (WellDoneLoginDTO) AuthRequestWellDoneUtil.getLoginUser();
if (wellDoneLoginDTO == null) {
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_4);
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_30009);
logger.info("用户不存在!");
return false;
}
......
......@@ -16,6 +16,7 @@ public class WellDoneLoginInfoVO implements Serializable {
private String phoneNumber;
private String nationcode;
private String wxUserId;
private Integer privacyUseFlag;
public String getWxUserId() {
return wxUserId;
......@@ -24,6 +25,7 @@ public class WellDoneLoginInfoVO implements Serializable {
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getStaffId() {
return staffId;
}
......@@ -51,14 +53,24 @@ public class WellDoneLoginInfoVO implements Serializable {
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getNationcode() {
return nationcode;
}
public void setNationcode(String nationcode) {
this.nationcode = nationcode;
}
public Integer getPrivacyUseFlag() {
return privacyUseFlag;
}
public void setPrivacyUseFlag(Integer privacyUseFlag) {
this.privacyUseFlag = privacyUseFlag;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment