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,71 +9,72 @@ import java.util.List; ...@@ -9,71 +9,72 @@ import java.util.List;
public interface StaffApiService { public interface StaffApiService {
public StaffDTO selectById(String staffId); StaffDTO selectById(String staffId);
public StaffDTO selectSuperByWxEnterpriseId(String wxEnterpriseId);
public List<StaffDTO> listByIds(List<String> staffIds); StaffDTO selectSuperByWxEnterpriseId(String wxEnterpriseId);
public List<StaffDTO> listByWxUserId(String wxUserId); List<StaffDTO> listByIds(List<String> staffIds);
public StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber); List<StaffDTO> listByWxUserId(String wxUserId);
public ServiceResponse add(StaffDTO staff, String departmentIds); StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId); ServiceResponse add(StaffDTO staff, String departmentIds);
public Page<StaffDTO> pageStaff(List<String> departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo, Integer relationFlag); List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
public void del(String staffDepartmentStaffRelatedId); Page<StaffDTO> pageStaff(List<String> departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo, Integer relationFlag);
void del(String staffDepartmentStaffRelatedId);
/** /**
* 获取微信成员 * 获取微信成员
*
* @param userId * @param userId
* @param wxEnterpriseId * @param wxEnterpriseId
* @return * @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); 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);
public List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId); List<StaffDTO> listByPhoneNumber(String phoneNumber);
/** List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
* 保存gic成员
* /**
* @param clerkDTO * 保存gic成员
* @return *
*/ * @param clerkDTO
public ServiceResponse saveSyncStaffByGic(GicClerkDTO clerkDTO); * @return
*/
ServiceResponse saveSyncStaffByGic(GicClerkDTO clerkDTO);
/** /**
* 获取成员头像 * 获取成员头像
...@@ -82,31 +83,44 @@ public interface StaffApiService { ...@@ -82,31 +83,44 @@ public interface StaffApiService {
* @param storeId * @param storeId
* @return * @return
*/ */
public ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId); ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
void wxFristAdd(String userJson, String wxEnterpriseId); void wxFristAdd(String userJson, String wxEnterpriseId);
List<String> listBindClerkUserId(String storeId); List<String> listBindClerkUserId(String storeId);
public List<StaffClerkRelationDTO> listBindRelationUserId(String storeId); List<StaffClerkRelationDTO> listBindRelationUserId(String storeId);
/** /**
* 激活 * 激活
*
* @param staffId * @param staffId
* @return * @return
*/ */
public boolean activeStaff(String staffId); boolean activeStaff(String staffId);
/** /**
* 获取一个staff * 获取一个staff
*
* @param wxEnterpriseId * @param wxEnterpriseId
* @return * @return
*/ */
public StaffDTO getWxStaffOne(String wxEnterpriseId); StaffDTO getWxStaffOne(String wxEnterpriseId);
/** /**
* @param wxEnterpriseId * @param wxEnterpriseId
* @return * @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 { ...@@ -40,6 +40,6 @@ public interface StaffPrivacyUseLogMapper {
* @author mozhu * @author mozhu
* @date 2021-12-15 10:49:02 * @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 { ...@@ -38,5 +38,5 @@ public interface StaffPrivacyUseLogService {
* @author mozhu * @author mozhu
* @date 2021-12-15 10:51:32 * @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; ...@@ -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.dao.mapper.StaffPrivacyUseLogMapper;
import com.gic.haoban.manage.service.entity.TabStaffPrivacyUseLog; import com.gic.haoban.manage.service.entity.TabStaffPrivacyUseLog;
import com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO; 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 com.gic.haoban.manage.service.service.StaffPrivacyUseLogService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author xuwenqian * @author xuwenqian
...@@ -44,8 +42,8 @@ public class StaffPrivacyUseLogServiceImpl implements StaffPrivacyUseLogService ...@@ -44,8 +42,8 @@ public class StaffPrivacyUseLogServiceImpl implements StaffPrivacyUseLogService
} }
@Override @Override
public List<TabStaffPrivacyUseLogVO> getByStaffId(String staffId) { public StaffPrivacyUseLogBO getByStaffId(String staffId) {
List<TabStaffPrivacyUseLog> staffPrivacyUseLogList = staffPrivacyUseLogMapper.getByStaffId(staffId); TabStaffPrivacyUseLog tabStaffPrivacyUseLog = staffPrivacyUseLogMapper.getByStaffId(staffId);
return EntityUtil.changeEntityListByOrika(TabStaffPrivacyUseLogVO.class, staffPrivacyUseLogList); return EntityUtil.changeEntityByOrika(StaffPrivacyUseLogBO.class, tabStaffPrivacyUseLog);
} }
} }
...@@ -97,6 +97,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -97,6 +97,8 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired @Autowired
private SecretSettingService secretSettingService; private SecretSettingService secretSettingService;
@Autowired
private StaffPrivacyUseLogService staffPrivacyUseLogService;
@Override @Override
public StaffDTO selectById(String staffId) { public StaffDTO selectById(String staffId) {
...@@ -1468,19 +1470,9 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1468,19 +1470,9 @@ public class StaffApiServiceImpl implements StaffApiService {
return staffDTO; return staffDTO;
} }
// private String getMobile(String phoneNumber,String nationcode){ @Override
// String mobile = nationcode + phoneNumber; public StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId) {
// return mobile; return EntityUtil.changeEntity(StaffPrivacyUseLogDTO.class, staffPrivacyUseLogService.getByStaffId(staffId));
// } }
//
// private String getNationcode(String mobile){
// String nationcode = "";
// return nationcode;
// }
//
// private String getPhoneNumber(String mobile){
// String phoneNumber = "";
// return phoneNumber;
// }
} }
...@@ -302,6 +302,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -302,6 +302,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
//插入隐私协议 //插入隐私协议
StaffPrivacyUseLogBO staffPrivacyUseLogBO = new StaffPrivacyUseLogBO(); StaffPrivacyUseLogBO staffPrivacyUseLogBO = new StaffPrivacyUseLogBO();
BeanUtils.copyProperties(staffLoginDTO, staffPrivacyUseLogBO); BeanUtils.copyProperties(staffLoginDTO, staffPrivacyUseLogBO);
staffPrivacyUseLogService.insert(staffPrivacyUseLogBO); StaffPrivacyUseLogBO privacyUseLog = staffPrivacyUseLogService.getByStaffId(staffLoginDTO.getStaffId());
if (privacyUseLog == null) {
staffPrivacyUseLogService.insert(staffPrivacyUseLogBO);
}
} }
} }
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM tab_staff_privacy_use_log FROM tab_staff_privacy_use_log
WHERE staff_id = #{staffId} WHERE staff_id = #{staffId} order by create_time desc limit 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller; 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.alibaba.fastjson.JSON;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService; 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.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.MaidianLogDTO; import com.gic.haoban.manage.api.dto.MaidianLogDTO;
import com.gic.haoban.manage.api.service.MaidianLogApiService; import com.gic.haoban.manage.api.service.MaidianLogApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; 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 @RestController
public class MaidianLogController extends WebBaseController{ public class MaidianLogController extends WebBaseController{
...@@ -25,8 +25,9 @@ public class MaidianLogController extends WebBaseController{ ...@@ -25,8 +25,9 @@ public class MaidianLogController extends WebBaseController{
private ClerkService clerkService; private ClerkService clerkService;
@Autowired @Autowired
private StoreService storeService; private StoreService storeService;
@RequestMapping("save-maidian-log") @RequestMapping("save-maidian-log")
@IgnoreLogin
public HaobanResponse saveUserLoginLog(String maidianLogStr) { public HaobanResponse saveUserLoginLog(String maidianLogStr) {
if(StringUtils.isBlank(maidianLogStr)){ if(StringUtils.isBlank(maidianLogStr)){
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
......
...@@ -89,6 +89,7 @@ public class WxEnterpriseInfoController extends WebBaseController { ...@@ -89,6 +89,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
@Autowired @Autowired
private Config config; private Config config;
/** /**
* code授权 * code授权
* *
...@@ -144,23 +145,27 @@ public class WxEnterpriseInfoController extends WebBaseController { ...@@ -144,23 +145,27 @@ public class WxEnterpriseInfoController extends WebBaseController {
} }
} }
} }
String staffId = loginStaff.getStaffId();
//激活状态 //激活状态
if (loginStaff.getActiveFlag() == 0) { if (loginStaff.getActiveFlag() == 0) {
staffApiService.activeStaff(loginStaff.getStaffId()); staffApiService.activeStaff(staffId);
} }
StaffPrivacyUseLogDTO staffPrivacyUseLogDTO = staffApiService.getStaffPrivacyByStaffId(staffId);
String wxEnterpriseId = loginStaff.getWxEnterpriseId(); String wxEnterpriseId = loginStaff.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
String accesstoken = qywxCorpApiService.getCorpAccessToken(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid()); String accesstoken = qywxCorpApiService.getCorpAccessToken(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid());
WellDoneLoginInfoVO wellDoneLoginInfoVo = new WellDoneLoginInfoVO(); WellDoneLoginInfoVO wellDoneLoginInfoVo = new WellDoneLoginInfoVO();
wellDoneLoginInfoVo.setAccessToken(accesstoken); wellDoneLoginInfoVo.setAccessToken(accesstoken);
wellDoneLoginInfoVo.setStaffId(loginStaff.getStaffId()); wellDoneLoginInfoVo.setStaffId(staffId);
wellDoneLoginInfoVo.setWxEnterpriseId(wxEnterpriseId); wellDoneLoginInfoVo.setWxEnterpriseId(wxEnterpriseId);
wellDoneLoginInfoVo.setStaffName(loginStaff.getStaffName()); wellDoneLoginInfoVo.setStaffName(loginStaff.getStaffName());
wellDoneLoginInfoVo.setPhoneNumber(loginStaff.getPhoneNumber()); wellDoneLoginInfoVo.setPhoneNumber(loginStaff.getPhoneNumber());
wellDoneLoginInfoVo.setNationcode(loginStaff.getNationCode()); wellDoneLoginInfoVo.setNationcode(loginStaff.getNationCode());
wellDoneLoginInfoVo.setWxUserId(loginStaff.getWxUserId()); wellDoneLoginInfoVo.setWxUserId(loginStaff.getWxUserId());
if (staffPrivacyUseLogDTO != null) {
wellDoneLoginInfoVo.setPrivacyUseFlag(staffPrivacyUseLogDTO.getPrivacyUseFlag());
}
return resultResponse(HaoBanErrCode.ERR_1, wellDoneLoginInfoVo); return resultResponse(HaoBanErrCode.ERR_1, wellDoneLoginInfoVo);
} }
...@@ -204,6 +209,7 @@ public class WxEnterpriseInfoController extends WebBaseController { ...@@ -204,6 +209,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @date 2021-12-10 18:34:12 * @date 2021-12-10 18:34:12
*/ */
@RequestMapping(value = "welldone-token-refresh", method = RequestMethod.GET) @RequestMapping(value = "welldone-token-refresh", method = RequestMethod.GET)
@IgnoreLogin
public HaobanResponse welldoneTokenRefresh() { public HaobanResponse welldoneTokenRefresh() {
String token = AuthRequestWellDoneUtil.getToken(); String token = AuthRequestWellDoneUtil.getToken();
if (ObjectUtil.isNull(token)) { if (ObjectUtil.isNull(token)) {
......
...@@ -55,7 +55,7 @@ public class MobileWebInterceptor extends HandlerInterceptorAdapter { ...@@ -55,7 +55,7 @@ public class MobileWebInterceptor extends HandlerInterceptorAdapter {
} }
WellDoneLoginDTO wellDoneLoginDTO = (WellDoneLoginDTO) AuthRequestWellDoneUtil.getLoginUser(); WellDoneLoginDTO wellDoneLoginDTO = (WellDoneLoginDTO) AuthRequestWellDoneUtil.getLoginUser();
if (wellDoneLoginDTO == null) { if (wellDoneLoginDTO == null) {
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_4); this.errorResult(httpServletResponse, HaoBanErrCode.ERR_30009);
logger.info("用户不存在!"); logger.info("用户不存在!");
return false; return false;
} }
......
...@@ -16,6 +16,7 @@ public class WellDoneLoginInfoVO implements Serializable { ...@@ -16,6 +16,7 @@ public class WellDoneLoginInfoVO implements Serializable {
private String phoneNumber; private String phoneNumber;
private String nationcode; private String nationcode;
private String wxUserId; private String wxUserId;
private Integer privacyUseFlag;
public String getWxUserId() { public String getWxUserId() {
return wxUserId; return wxUserId;
...@@ -24,6 +25,7 @@ public class WellDoneLoginInfoVO implements Serializable { ...@@ -24,6 +25,7 @@ public class WellDoneLoginInfoVO implements Serializable {
public void setWxUserId(String wxUserId) { public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId; this.wxUserId = wxUserId;
} }
public String getStaffId() { public String getStaffId() {
return staffId; return staffId;
} }
...@@ -51,14 +53,24 @@ public class WellDoneLoginInfoVO implements Serializable { ...@@ -51,14 +53,24 @@ public class WellDoneLoginInfoVO implements Serializable {
public String getPhoneNumber() { public String getPhoneNumber() {
return phoneNumber; return phoneNumber;
} }
public void setPhoneNumber(String phoneNumber) { public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber; this.phoneNumber = phoneNumber;
} }
public String getNationcode() { public String getNationcode() {
return nationcode; return nationcode;
} }
public void setNationcode(String nationcode) { public void setNationcode(String nationcode) {
this.nationcode = 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