Commit 9dcd3190 by 徐高华

Merge branch 'feature/xgh/2406企微托管' into 'master'

Feature/xgh/2406企微托管

See merge request !2018
parents febd5e40 65e8a3f5
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* tab_haoban_open_staff
*/
public class OpenStaffDTO implements Serializable {
/**
* 主键
*/
private Long openStaffId;
/**
* 企微id
*/
private String wxEnterpriseId;
private String enterpriseId ;
/**
* 成员id
*/
private String staffId;
/**
* 成员名称
*/
private String staffName ;
/**
* 成员头像
*/
private String staffHeadImg ;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 客户端id
*/
private String uuid;
/**
* 是否删除1是0否
*/
private Integer deleteFlag;
/**
* 1授权中 2未登录(已过期)
*/
private Integer statusFlag;
/**
* 登录步骤1已扫码 2取消登录 3超时 4验证码正确
*/
private Integer step;
/**
* 企微的userid
*/
private Long qwUserId;
/**
* 企微的企业id
*/
private Long wxCorpId;
/**
* 一次扫码内容
*/
private String qrCode1;
/**
* 一次扫码内容
*/
private String key1;
/**
* 二次扫码内容
*/
private String qrCode2;
/**
* 二次扫码内容
*/
private String key2;
/**
* 是否需要验证码
*/
private Integer validFlag;
/**
* 最新授权时间
*/
private Date authTime;
/**
* 首次授权时间
*/
private Date firstAuthTime;
/**
* 需要二次扫码
*/
private Integer validQrcodeFlag ;
/**
* 登录错误信息
*/
private String loginRemark ;
private String qrcodeData ;
/**
* 下一次加好友间隔时间分钟
*/
private int addStopTime ;
/**
* 下一次删除好友间隔时间分钟
*/
private int delStopTime ;
/**
* tab_haoban_open_staff
*/
private static final long serialVersionUID = 1L;
public int getAddStopTime() {
return addStopTime;
}
public void setAddStopTime(int addStopTime) {
this.addStopTime = addStopTime;
}
public int getDelStopTime() {
return delStopTime;
}
public void setDelStopTime(int delStopTime) {
this.delStopTime = delStopTime;
}
public String getQrcodeData() {
return qrcodeData;
}
public void setQrcodeData(String qrcodeData) {
this.qrcodeData = qrcodeData;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getStaffHeadImg() {
return staffHeadImg;
}
public void setStaffHeadImg(String staffHeadImg) {
this.staffHeadImg = staffHeadImg;
}
public String getLoginRemark() {
return loginRemark;
}
public void setLoginRemark(String loginRemark) {
this.loginRemark = loginRemark;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getValidQrcodeFlag() {
return validQrcodeFlag;
}
public void setValidQrcodeFlag(Integer validQrcodeFlag) {
this.validQrcodeFlag = validQrcodeFlag;
}
public Long getOpenStaffId() {
return openStaffId;
}
public void setOpenStaffId(Long openStaffId) {
this.openStaffId = openStaffId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId == null ? null : wxEnterpriseId.trim();
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId == null ? null : staffId.trim();
}
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;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid == null ? null : uuid.trim();
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Integer getStep() {
return step;
}
public void setStep(Integer step) {
this.step = step;
}
public Long getQwUserId() {
return qwUserId;
}
public void setQwUserId(Long qwUserId) {
this.qwUserId = qwUserId;
}
public Long getWxCorpId() {
return wxCorpId;
}
public void setWxCorpId(Long wxCorpId) {
this.wxCorpId = wxCorpId;
}
public String getQrCode1() {
return qrCode1;
}
public void setQrCode1(String qrCode1) {
this.qrCode1 = qrCode1 == null ? null : qrCode1.trim();
}
public String getKey1() {
return key1;
}
public void setKey1(String key1) {
this.key1 = key1 == null ? null : key1.trim();
}
public String getQrCode2() {
return qrCode2;
}
public void setQrCode2(String qrCode2) {
this.qrCode2 = qrCode2 == null ? null : qrCode2.trim();
}
public String getKey2() {
return key2;
}
public void setKey2(String key2) {
this.key2 = key2 == null ? null : key2.trim();
}
public Integer getValidFlag() {
return validFlag;
}
public void setValidFlag(Integer validFlag) {
this.validFlag = validFlag;
}
public Date getAuthTime() {
return authTime;
}
public void setAuthTime(Date authTime) {
this.authTime = authTime;
}
public Date getFirstAuthTime() {
return firstAuthTime;
}
public void setFirstAuthTime(Date firstAuthTime) {
this.firstAuthTime = firstAuthTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
public class OpenStaffLicenseDTO implements Serializable {
private int total ;
private int gicTotal ;
private int useNum ;
private int validNum ;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getGicTotal() {
return gicTotal;
}
public void setGicTotal(int gicTotal) {
this.gicTotal = gicTotal;
}
public int getUseNum() {
return useNum;
}
public void setUseNum(int useNum) {
this.useNum = useNum;
}
public int getValidNum() {
return validNum;
}
public void setValidNum(int validNum) {
this.validNum = validNum;
}
}
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.List;
/**
* tab_haoban_open_staff
*/
public class OpenStaffListDTO extends OpenStaffDTO implements Serializable {
/**
* 关联导购
*/
List<StoreClerkDTO> clerkList ;
public List<StoreClerkDTO> getClerkList() {
return clerkList;
}
public void setClerkList(List<StoreClerkDTO> clerkList) {
this.clerkList = clerkList;
}
}
\ No newline at end of file
......@@ -73,6 +73,19 @@ public class StaffListDTO implements Serializable {
private String loginEnterpriseId ;
/**
* 企微托管页面查询1是0否
*/
private int qwOpenFlag ;
public int getQwOpenFlag() {
return qwOpenFlag;
}
public void setQwOpenFlag(int qwOpenFlag) {
this.qwOpenFlag = qwOpenFlag;
}
public String getLoginEnterpriseId() {
return loginEnterpriseId;
}
......
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
public class StoreClerkDTO implements Serializable {
private String storeId ;
private String storeName ;
private String storeCode ;
private String clerkId ;
private String clerkName ;
private String clerkCode ;
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
}
......@@ -24,6 +24,16 @@ public class WxUserAddLogQDTO implements Serializable{
private Long qwAddTime ;
private String friendClerkId ;
private String friendStoreId ;
// 0手动 1系统
private int delType ;
public int getDelType() {
return delType;
}
public void setDelType(int delType) {
this.delType = delType;
}
public String getFriendClerkId() {
return friendClerkId;
......
......@@ -66,6 +66,7 @@ public enum NoticeMessageTypeEnum {
CUSTOMER_APPLY_ORDER_REFUND(4005, "客户申请退单通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(), "customer_apply_order_refund", "/pages/route/index?pageType=", "hbapp_customer_order_detail", "customerApplyChargebackOrder", "haobanNotice"),
CUSTOMER_SUCCESS_ORDER_REFUND(4006, "客户成功退单通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(), "customer_success_order_refund", "/pages/route/index?pageType=", "hbapp_user_bill_detail", "customerChargebackOrderSuccess", "haobanNotice"),
FRIEND_DEL_STAFF(4007,"删除好友通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(),"friend_del_staff","/pages/route/index?pageType=","hbapp_customer_detail","friendDelStaff","haobanNotice"),
HAOBAN_OPEN_STAFF_LOGOUT(4008,"企微托管账号退出登录", NoticeMessageCategoryTypeEnum.AUTHORIZED.getType(),"haoban_open_staff_logout","/pages/route/index?pageType=","hbapp_video_auth","haobanOpenStaffLogout","haobanNotice"),
// 订单- 待发货订单提醒
......
package com.gic.haoban.manage.api.enums;
public enum OpenStaffOfflineEnum {
OFFLINE1(1, "首次托管,需要二次验证"),
OFFLINE2(2, "异常断开"),
OFFLINE3(3, "手机端结束登录"),
OFFLINE4(4, "当前账号在其它设备登录");
OpenStaffOfflineEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
private int code;
private String desc;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.gic.haoban.manage.api.enums;
public enum QwOpenStepEnum {
step1(1, "用户已扫码"),
step2(2,"取消登录"),
step3(3,"超时未扫码") ,
step4(4,"验证码正确") ;
QwOpenStepEnum(Integer step, String desc){
this.step = step;
this.desc = desc;
}
private int step;
private String desc;
public int getStep() {
return step;
}
public void setStep(int step) {
this.step = step;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static boolean isFail(int step) {
return step == step2.getStep() || step == step3.getStep() ;
}
}
package com.gic.haoban.manage.api.qdto;
import java.io.Serializable;
public class OpenStaffInitQDTO implements Serializable {
private String wxEnterpriseId ;
private String enterpriseId ;
private String staffId ;
private int loginAgainFlag ;
public int getLoginAgainFlag() {
return loginAgainFlag;
}
public void setLoginAgainFlag(int loginAgainFlag) {
this.loginAgainFlag = loginAgainFlag;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
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;
}
}
package com.gic.haoban.manage.api.qdto;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class OpenStaffPageQDTO implements Serializable {
private String wxEnterpriseId ;
private String enterpriseId ;
/**
* 1授权中 2已过期 3待验证 4待授权 0全部
*/
private int status ;
/**
* 导购
*/
private String clerkId ;
/**
* 成员
*/
private String staffParams ;
/**
* 门店分组
*/
private List<String> storeGroupIdList ;
/**
* 开始日期
*/
private Date startDate ;
/**
* 结束日期
*/
private Date endDate ;
private List<String> staffIds ;
private String loginClerkId ;
public String getLoginClerkId() {
return loginClerkId;
}
public void setLoginClerkId(String loginClerkId) {
this.loginClerkId = loginClerkId;
}
public List<String> getStaffIds() {
return staffIds;
}
public void setStaffIds(List<String> staffIds) {
this.staffIds = staffIds;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getStaffParams() {
return staffParams;
}
public void setStaffParams(String staffParams) {
this.staffParams = staffParams;
}
public List<String> getStoreGroupIdList() {
return storeGroupIdList;
}
public void setStoreGroupIdList(List<String> storeGroupIdList) {
this.storeGroupIdList = storeGroupIdList;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
}
......@@ -341,4 +341,7 @@ public interface ExternalClerkRelatedApiService {
Page<ExternalClerkRelatedDTO> halfFriendPage(String wxEnterpriseId , String storeId , String clerkId , String staffId,int type, BasePageInfo basePageInfo) ;
ExternalClerkRelatedDTO getDelFriend(String wxEnterpriseId , String enterpriseId , String staffId) ;
}
......@@ -122,5 +122,16 @@ public interface HaobanTimerApiService {
public void halfTimer(String wxEnterpriseId) ;
/**
* 校验是否登录中
* @param params
*/
void openStaffTimer(String params) ;
/**
* 托管服务到期
* @param params
*/
void openStaffServiceTimer(String params) ;
}
package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.OpenStaffDTO;
import com.gic.haoban.manage.api.dto.OpenStaffLicenseDTO;
import com.gic.haoban.manage.api.dto.OpenStaffListDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.enums.OpenStaffOfflineEnum;
import com.gic.haoban.manage.api.qdto.OpenStaffInitQDTO;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import java.util.List;
public interface OpenStaffApiService {
/**
* 授权绑定
* @param qdto
* @return
*/
public ServiceResponse<OpenStaffDTO> init(OpenStaffInitQDTO qdto) ;
/**
* id查询
* @param openStaffId
* @return
*/
public ServiceResponse<OpenStaffDTO> getById(Long openStaffId) ;
public ServiceResponse<OpenStaffDTO> getByStaffId(String staffId) ;
public ServiceResponse<OpenStaffDTO> getByUUID(String uuid) ;
public ServiceResponse<OpenStaffDTO> getByQwUserId(Long qwUserId) ;
/**
* 删除
* @param id
* @return
*/
public ServiceResponse<Void> delete(Long id) ;
/**
* 设置需要输入验证码
* @param uuid
* @return
*/
public ServiceResponse<Void> updateValiFlag(String uuid) ;
/**
* 设置需要二次验证扫码
* @param uuid
* @return
*/
public ServiceResponse<Void> update2QrcodeFlag(String uuid) ;
/**
* 获取二次验证码
* @param id
* @return
*/
public ServiceResponse<OpenStaffDTO> get2Qrcode(long id) ;
/**
* 登录成功
*/
public ServiceResponse<Void> login(String uuid , Long qwCorpid ,String corpNam , Long qwUserId) ;
/**
* 退出登录
*/
public ServiceResponse<Void> logout(String uuid , OpenStaffOfflineEnum offlineEnum) ;
public ServiceResponse<Void> logout(Long openStaffId) ;
/**
* 校验验证码
* @param openStaffId
* @param validCode
* @return
*/
public ServiceResponse<Void> checkCode(Long openStaffId, String validCode) ;
/**
*
* @param uuid
* @param step
* @return
*/
public ServiceResponse<Void> updateLoginStep(String uuid , int step) ;
ServiceResponse<OpenStaffLicenseDTO> getLicenseInfo(String wxEnterpriseId, String enterpriseId);
ServiceResponse<Page<OpenStaffListDTO>> page(OpenStaffPageQDTO qdto, BasePageInfo basePageInfo);
/**
* 查询托管的导购
* @param wxEnterpriseId
* @param enterpriseIdList
* @param clerkIdList
* @return
*/
List<StaffClerkRelationDTO> listOpenStaffByClerk(String wxEnterpriseId , String enterpriseIdList , List<String> clerkIdList) ;
List<StaffClerkRelationDTO> listOpenStaffByStore(String wxEnterpriseId , String enterpriseIdList , List<String> storeIdList) ;
List<String> listAllOnlineStaff() ;
List<String> listAllOnlineStaff(String wxEnterpriseId , String enterpriseId) ;
/**
* 查询所有托管的门店
* @param wxEnterpriseId
* @param enterpriseId
* @return
*/
List<String> listOpenStoreId(String wxEnterpriseId , String enterpriseId) ;
/**
* 更新下一次间隔时间
* @param openStaffId
* @param type
* @param time
*/
public void updateStopTime(Long openStaffId , int type , int time) ;
}
......@@ -160,4 +160,17 @@ public interface GroupChatApiService {
*/
public ServiceResponse<List<GroupChatDTO>> listChatByIdList(String wxEnterpriseId, List<Long> groupChatIdList);
public ServiceResponse<GroupChatDTO> getByWxChatId(String wxEnterpriseId, String wxChatId);
public GroupChatUserDTO getGroupUserInfo(Long groupChatId , String externalUserId) ;
/**
* 自动群群发的id
* @param enterpriseId
* @param staffId
* @return
*/
public List<String> listOpenGroupChatDK(String enterpriseId , String staffId) ;
}
......@@ -8,6 +8,7 @@ import com.gic.haoban.manage.api.dto.notify.qdto.NotifyMessageBatchQDTO;
import com.gic.haoban.manage.api.dto.qdto.NoticeMessageQDTO;
import java.util.List;
import java.util.Map;
/**
* Created 2021/12/17.
......@@ -91,4 +92,12 @@ public interface NoticeMessageApiService {
*/
public ServiceResponse<Boolean> addOrCreateNoticeMessage(List<NoticeMessageQDTO> qdto);
/**
* 托管账号退出-发送公众号消息
* @param enterpriseId
* @param accountName
* @param reason
*/
public void sendMessageForOpenStaff(String enterpriseId, String accountName, String reason) ;
}
\ No newline at end of file
package com.gic.haoban.manage.web.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.authcenter.commons.util.IgnoreLogin;
import com.gic.commons.util.GlobalVar;
import com.gic.commons.util.HttpClient;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.enums.OpenStaffOfflineEnum;
import com.gic.haoban.manage.api.enums.QwOpenStepEnum;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.task.manage.api.dto.open.OpenQwMessageDTO;
import com.gic.haoban.task.manage.api.enums.OpenQwMsgTypeEnum;
import com.gic.mq.sdk.GicMQClient;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Controller
public class QywxCallbackController extends WebBaseController {
private static final Logger logger = LoggerFactory.getLogger(QywxCallbackController.class);
GicMQClient gicMQClient = GICMQClientUtil.getClientInstance();
private static final String url = "http://47.94.7.218:8089/wxwork/%s" ;
@Autowired
private OpenStaffApiService openStaffApiService ;
@Autowired
private com.gic.haoban.task.manage.api.service.OpenQwApiService openQwApiService ;
@RequestMapping("qywx-msg-notice")
@IgnoreLogin
public Object callback(HttpServletRequest request , HttpServletResponse response) throws IOException {
public Object callback(HttpServletRequest request , HttpServletResponse response) {
try {
String body = IOUtils.toString(request.getInputStream()) ;
logger.info("企微消息下发={}",body);
JSONObject jsonObject = JSONObject.parseObject(body) ;
int type = jsonObject.getIntValue("type") ;
String uuid = jsonObject.getString("uuid") ;
Long qwStaffId = jsonObject.getLong("vid") ;
JSONObject json = jsonObject.getJSONObject("json") ;
this.post(type,uuid,json);
this.post(type,uuid,json , qwStaffId);
Map<String,String> map = new HashMap<>() ;
map.put("errcode","0") ;
map.put("errmsg","ok") ;
......@@ -47,8 +55,14 @@ public class QywxCallbackController extends WebBaseController {
return "ok" ;
}
private void post(int type , String uuid , JSONObject json) {
private void post(int type , String uuid , JSONObject json , Long qwStaffId) {
switch (type) {
case 116002:
this.addFriend(json , qwStaffId) ;
break;
case 102000:
this.chat(uuid,json) ;
break;
case 100001 :
this.v100001(uuid,json) ;
break;
......@@ -62,7 +76,7 @@ public class QywxCallbackController extends WebBaseController {
this.v100004(uuid,json) ;
break;
case 100005 :
this.close(uuid,json) ;
this.close(uuid,OpenStaffOfflineEnum.OFFLINE3) ;
break;
case 104001 :
this.loginSuccess(uuid,json) ;
......@@ -73,55 +87,212 @@ public class QywxCallbackController extends WebBaseController {
case 100009 :
this.v100009(uuid,json) ;
break;
case 100008:
this.close(uuid,OpenStaffOfflineEnum.OFFLINE4);
break;
case 100007:
this.close(uuid,OpenStaffOfflineEnum.OFFLINE2);
break;
default:
break;
}
}
// 加好友
private void addFriend(JSONObject json, Long qwStaffId) {
logger.info("加好友、删好友");
JSONArray array = json.getJSONArray("list");
List<Long> list = new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
JSONObject jsonObject = array.getJSONObject(i);
int status = jsonObject.getIntValue("status");
if (status == 9) {
Long qwUserId = jsonObject.getLong("user_id");
list.add(qwUserId);
}
}
if (CollectionUtils.isEmpty(list)) {
return;
}
JSONObject mq = new JSONObject();
mq.put("qwStaffId", qwStaffId);
mq.put("qwUserIdList", list);
try {
gicMQClient.sendMessage("addFriendSuccessNoticeMQ", mq.toJSONString());
} catch (Exception e) {
logger.info("异常", e);
}
}
private void chat(String uuid, JSONObject json) {
int msgtype = json.getIntValue("msgtype");
// 群发任务
if (msgtype == 573) {
json.put("uuid", uuid);
this.openQwApiService.saveNotice(json.toJSONString());
return;
}
// 6 位置
// 41 名片
// 40 语音视频通话时常消息通知
// 503 语音或者视频通话,未接听消息
// 16 语音消息
// 14 101 图片
// 23 103(微信) 视频消息
// 15 102(微信) 文件消息
// 104 gif表情消息类型 29
// 26 红包
// 78 小程序
// 13 链接
List<String> msgList = Arrays.asList("0","2","101","6","41","40","14","16","23","103","15","102","104","26","78","13","29") ;
if(!msgList.contains(msgtype+"")) {
logger.info("不处理的消息");
return ;
}
logger.info("处理消息");
int isRoom = json.getIntValue("is_room") ;
Long receiver = json.getLong("receiver") ;
Long sender = json.getLong("sender") ;
String content = json.getString("content") ;
String fileId = json.getString("file_id") ;
Long roomId = json.getLong("room_conversation_id") ;
Integer fileSize = json.getInteger("file_size") ;
OpenQwMessageDTO msg = new OpenQwMessageDTO();
msg.setImageType(json.getIntValue("is_hd"));
msg.setFileSize(fileSize);
msg.setIsRoom(isRoom);
msg.setUuid(uuid);
msg.setReceiver(receiver);
msg.setSender(sender);
msg.setContent(content);
msg.setRoomId(roomId);
msg.setFileId(fileId);
msg.setSendTime(json.getLong("send_time"));
msg.setOpenimCdnAuthkey(json.getString("openim_cdn_authkey"));
if(msgtype==101 || msgtype==14) {
if(msgtype==101) {
msg.setAeskey(json.getString("aeskey"));
}
if(msgtype==14) {
msg.setAeskey(json.getString("aes_key"));
}
msg.setMsgtype(OpenQwMsgTypeEnum.IMAGE);
}else if(msgtype==13) {
msg.setMsgtype(OpenQwMsgTypeEnum.LINK);
msg.setContent(json.getString("url"));
}else if(msgtype==78) {
msg.setMsgtype(OpenQwMsgTypeEnum.WXA);
msg.setContent(json.getString("desc"));
}else if(msgtype == 26) {
msg.setMsgtype(OpenQwMsgTypeEnum.RED);
msg.setContent(json.getString("remark"));
}else if(msgtype==104 || msgtype==29) {
msg.setMsgtype(OpenQwMsgTypeEnum.GIF);
msg.setContent(json.getString("url"));
}else if(msgtype==23 || msgtype==103){
msg.setMsgtype(OpenQwMsgTypeEnum.VIDEO);
msg.setAeskey(json.getString("aes_key"));
}else if(msgtype==15 || msgtype==102){
msg.setMsgtype(OpenQwMsgTypeEnum.FILE);
msg.setAeskey(json.getString("aes_key"));
msg.setContent(json.getString("file_name"));
}else if(msgtype==6) {
msg.setMsgtype(OpenQwMsgTypeEnum.LOCAL);
msg.setContent(json.getString("address"));
}else if (msgtype==41) {
msg.setMsgtype(OpenQwMsgTypeEnum.NAME_CARD);
msg.setContent(json.getString("nickname"));
}else if (msgtype==16) {
msg.setMsgtype(OpenQwMsgTypeEnum.VOICE);
msg.setContent(json.getString("语音消息"));
msg.setFileSize(json.getInteger("voice_size"));
msg.setAeskey(json.getString("aes_key"));
msg.setFileId(json.getString("voice_id"));
}else if (msgtype==40) {
// 2语音电话 1视频电话
int callType = json.getIntValue("invitetype") ;
if(!this.setTelType(callType,msg)) {
return;
}
// //1代表对方取消 5代表语音结束
msg.setContent(json.getString("recordwording"));
}else if (msgtype==503) {
// 2语音 1视频
int callType = json.getIntValue("invitetype") ;
if(!this.setTelType(callType,msg)) {
return;
}
msg.setContent(json.getString("recordwording"));
} else {
msg.setMsgtype(OpenQwMsgTypeEnum.text);
}
this.setSendType(msgtype, msg);
if(null != msg.getContent()) {
msg.setContent(msg.getContent().trim()) ;
}
try {
gicMQClient.sendMessage("saveChatLogMQ", JSONObject.toJSONString(msg));
} catch (Exception e) {
logger.info("异常", e);
}
}
private boolean setTelType( int callType , OpenQwMessageDTO msg) {
if(callType==1) {
msg.setMsgtype(OpenQwMsgTypeEnum.VIDEO_TEL);
}else if(callType==2) {
msg.setMsgtype(OpenQwMsgTypeEnum.VOICE_TEL);
}else {
return false;
}
return true ;
}
private void setSendType(int msgtype , OpenQwMessageDTO msg) {
if(msgtype==101) {
msg.setSendType(2);
}else if(msgtype==14) {
msg.setSendType(1);
}else {
msg.setSendType(0);
}
}
private void v100012(String uuid , JSONObject json) {
logger.info("需要二次扫码");
this.openStaffApiService.update2QrcodeFlag(uuid) ;
}
private void v100009(String uuid , JSONObject json) {
logger.info("超时未扫码关闭");
this.openStaffApiService.updateLoginStep(uuid, QwOpenStepEnum.step3.getStep()) ;
}
private void v100001(String uuid , JSONObject json) {
logger.info("用户扫码={}",uuid);
this.openStaffApiService.updateLoginStep(uuid,QwOpenStepEnum.step1.getStep()) ;
}
private void v100004(String uuid , JSONObject json) {
logger.info("需要输入验证码校验={}",uuid);
this.openStaffApiService.updateValiFlag(uuid) ;
}
private void v100002(String uuid , JSONObject json) {
logger.info("验证码校验成功返回={}",uuid);
this.openStaffApiService.updateLoginStep(uuid,QwOpenStepEnum.step4.getStep()) ;
}
private void loginSuccess(String uuid , JSONObject json) {
logger.info("登录成功={}",uuid);
Long qwCorpId = json.getLong("corp_id") ;
Long qwUserid = json.getLong("user_id") ;
String corpName = json.getString("corp_name") ;
this.openStaffApiService.login(uuid,qwCorpId,corpName,qwUserid) ;
}
private void close(String uuid , JSONObject json) {
private void close(String uuid , OpenStaffOfflineEnum offlineEnum) {
logger.info("退出={}",uuid);
this.openStaffApiService.logout(uuid, offlineEnum) ;
}
private void v100003(String uuid , JSONObject json) {
logger.info("取消登录={}",uuid);
}
@RequestMapping("qywx-init")
@IgnoreLogin
public HaobanResponse init() {
String callbackUrl = GlobalVar.ctxPropertiesMap.get("haoban_service_host")+"/haoban-manage3-operation-web/qywx-msg-notice" ;
String map1 = HttpClient.sendPostJSON(String.format(url,"init") ,"{}","utf-8") ;
logger.info(map1);
JSONObject json = JSONObject.parseObject(map1) ;
String uuid = json.getJSONObject("data").getString("uuid") ;
JSONObject setCallbackUrl = new JSONObject() ;
setCallbackUrl.put("uuid",uuid) ;
setCallbackUrl.put("url",callbackUrl) ;
String map2 = HttpClient.sendPostJSON(String.format(url,"SetCallbackUrl"),setCallbackUrl.toJSONString(),"utf-8") ;
String map3 = HttpClient.sendPostJSON(String.format(url,"getQrCode"),setCallbackUrl.toJSONString(),"utf-8") ;
List<String> list = new ArrayList<>() ;
list.add(map1);
list.add(map2);
list.add(map3);
HaobanResponse resp = new HaobanResponse() ;
resp.setResult(list);
return resp ;
this.openStaffApiService.updateLoginStep(uuid,QwOpenStepEnum.step2.getStep()) ;
}
}
......@@ -14,7 +14,8 @@
<dubbo:application name="haoban-manage3-operation-web"/>
<dubbo:protocol name="dubbo" port="300112"/>
<dubbo:reference interface="com.gic.haoban.task.manage.api.service.OpenQwApiService" id="openQwApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.OpenStaffApiService" id="openStaffApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffApiService" id="staffApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.TestApiService" id="testApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffClerkRelationApiService" id="staffClerkRelationApiService"/>
......
......@@ -87,6 +87,12 @@
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-task-manage-api</artifactId>
<version>${haoban-task-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-api</artifactId>
<version>${gic-enterprise-api}</version>
<exclusions>
......
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.api.dto.OpenStaffListDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import com.gic.haoban.manage.service.entity.TabOpenStaff;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface OpenStaffMapper {
/**
* 根据主键删除
*/
int deleteByPrimaryKey(@Param("id") Long id);
/**
* 插入一条记录
*/
int insert(TabOpenStaff record);
int update(TabOpenStaff tab) ;
TabOpenStaff getByStaffId(@Param("staffId")String staffId) ;
TabOpenStaff getByUUID(@Param("uuid") String uuid) ;
void updateValidFlag(@Param("uuid")String uuid);
TabOpenStaff getById(Long openStaffId);
void update2QrcodeFlag(@Param("id") Long openStaffId);
void update2Qrcode(@Param("id") Long id , @Param("qrcode")String qrcode , @Param("key")String key) ;
void updateLoginStep(@Param("id")Long openStaffId, @Param("step")int step);
List<OpenStaffListDTO> list(OpenStaffPageQDTO qdto);
TabOpenStaff getByQwUserId(@Param("qwUserId")Long qwUserId);
List<String> listAllStaffId(String wxEnterpriseId);
List<StaffClerkRelationDTO> listOpenStaffByClerk(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId")String enterpriseId, @Param("list")List<String> clerkIdList);
List<StaffClerkRelationDTO> listOpenStaffByStore(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId")String enterpriseId, @Param("list")List<String> storeIdList);
List<TabOpenStaff> listAllOnline(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId")String enterpriseId) ;
List<String> listOpenStoreId(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId")String enterpriseId);
void updateStopTime(@Param("id") Long openStaffId, @Param("type") int type, @Param("time") int time);
int getNum(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId")String enterpriseId , @Param("status")int status) ;
int updateByAutoLogin(@Param("id") Long openStaffId ,@Param("uuid") String uuid) ;
List<TabOpenStaff> listAllOnlineEnterprise() ;
}
\ No newline at end of file
......@@ -443,7 +443,7 @@ public interface TabHaobanExternalClerkRelatedMapper {
List<TabHaobanExternalClerkRelated> halfFriendPage(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("storeId")String storeId, @Param("clerkId")String clerkId, @Param("staffId")String staffId, @Param("type")int type);
List<TabHaobanExternalClerkRelated> halfDelFriendPage(@Param("wxEnterpriseId") String wxEnterpriseId , @Param("startItem")int startItem);
TabHaobanExternalClerkRelated getDelFriend(@Param("wxEnterpriseId") String wxEnterpriseId , @Param("enterpriseId") String enterpriseId , @Param("staffId")String staffId) ;
void updateHalfTime(@Param("id") String id , @Param("delTime") Date delTime) ;
}
\ No newline at end of file
......@@ -146,4 +146,6 @@ public interface TabHaobanStaffClerkRelationMapper {
List<String> taskoverClerkIdList(@Param("staffId")String staffId, @Param("delTime") Date delTime) ;
List<TabHaobanStaffClerkRelation> taskoverClerkIdListAll(@Param("staffId")String staffId) ;
List<String> listAllStaffIdForOpenStaff(@Param("enterpriseId")String enterpriseId, @Param("wxEnterpriseId")String wxEnterpriseId, @Param("clerkId") String clerkId, @Param(("storeIdList")) List<String> storeIdList);
}
\ No newline at end of file
......@@ -94,4 +94,6 @@ public interface WxEnterpriseMapper {
* @return
*/
List<String> listWxEnterpriseByCallbackFlag(@Param("callbackFlag")Integer callbackFlag);
List<String> getWxEnterpriseIdByName(@Param("corpName")String corpName);
}
\ No newline at end of file
......@@ -75,4 +75,6 @@ public interface GroupChatMapper {
@Param("force") int force);
public List<GroupChatDTO> listChangeOwner() ;
List<String> listOpenGroupChatDK(@Param("enterpriseId")String enterpriseId, @Param("staffId") String staffId);
}
\ No newline at end of file
......@@ -32,6 +32,8 @@ public interface GroupChatUserMapper {
public TabGroupChatUser selectById(Long chatUserId);
public TabGroupChatUser getGroupUserInfo(@Param("groupChatId") Long groupChatId , @Param("userId") String externalUserId) ;
public TabGroupChatUser selectByUserIdAndChatId(@Param("groupChatId") Long groupChatId,
@Param("userId") String userId);
......
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
/**
* tab_haoban_open_staff
*/
public class TabOpenStaff implements Serializable {
/**
* 主键
*/
private Long openStaffId;
/**
* 企微id
*/
private String wxEnterpriseId;
private String enterpriseId ;
/**
* 成员id
*/
private String staffId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 客户端id
*/
private String uuid;
/**
* 是否删除1是0否
*/
private Integer deleteFlag;
/**
* 0待验证 1授权中 2已过期
*/
private Integer statusFlag;
/**
* 登录步骤
*/
private Integer step;
/**
* 企微的userid
*/
private Long qwUserId;
/**
* 企微的企业id
*/
private Long wxCorpId;
/**
* 一次扫码内容
*/
private String qrCode1;
/**
* 一次扫码内容
*/
private String key1;
/**
* 二次扫码内容
*/
private String qrCode2;
/**
* 二次扫码内容
*/
private String key2;
/**
* 是否需要验证码
*/
private Integer validFlag;
/**
* 最新授权时间
*/
private Date authTime;
/**
* 首次授权时间
*/
private Date firstAuthTime;
private Integer validQrcodeFlag ;
private String loginRemark ;
/**
* 下一次加好友间隔时间分钟
*/
private int addStopTime ;
/**
* 下一次删除好友间隔时间分钟
*/
private int delStopTime ;
public int getAddStopTime() {
return addStopTime;
}
public void setAddStopTime(int addStopTime) {
this.addStopTime = addStopTime;
}
public int getDelStopTime() {
return delStopTime;
}
public void setDelStopTime(int delStopTime) {
this.delStopTime = delStopTime;
}
public String getLoginRemark() {
return loginRemark;
}
public void setLoginRemark(String loginRemark) {
this.loginRemark = loginRemark;
}
/**
* tab_haoban_open_staff
*/
private static final long serialVersionUID = 1L;
public Integer getValidQrcodeFlag() {
return validQrcodeFlag;
}
public void setValidQrcodeFlag(Integer validQrcodeFlag) {
this.validQrcodeFlag = validQrcodeFlag;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Long getOpenStaffId() {
return openStaffId;
}
public void setOpenStaffId(Long openStaffId) {
this.openStaffId = openStaffId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId == null ? null : wxEnterpriseId.trim();
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId == null ? null : staffId.trim();
}
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;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid == null ? null : uuid.trim();
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Integer getStep() {
return step;
}
public void setStep(Integer step) {
this.step = step;
}
public Long getQwUserId() {
return qwUserId;
}
public void setQwUserId(Long qwUserId) {
this.qwUserId = qwUserId;
}
public Long getWxCorpId() {
return wxCorpId;
}
public void setWxCorpId(Long wxCorpId) {
this.wxCorpId = wxCorpId;
}
public String getQrCode1() {
return qrCode1;
}
public void setQrCode1(String qrCode1) {
this.qrCode1 = qrCode1 == null ? null : qrCode1.trim();
}
public String getKey1() {
return key1;
}
public void setKey1(String key1) {
this.key1 = key1 == null ? null : key1.trim();
}
public String getQrCode2() {
return qrCode2;
}
public void setQrCode2(String qrCode2) {
this.qrCode2 = qrCode2 == null ? null : qrCode2.trim();
}
public String getKey2() {
return key2;
}
public void setKey2(String key2) {
this.key2 = key2 == null ? null : key2.trim();
}
public Integer getValidFlag() {
return validFlag;
}
public void setValidFlag(Integer validFlag) {
this.validFlag = validFlag;
}
public Date getAuthTime() {
return authTime;
}
public void setAuthTime(Date authTime) {
this.authTime = authTime;
}
public Date getFirstAuthTime() {
return firstAuthTime;
}
public void setFirstAuthTime(Date firstAuthTime) {
this.firstAuthTime = firstAuthTime;
}
}
\ No newline at end of file
......@@ -63,6 +63,15 @@ public class TabWxUserAddLog implements Serializable {
private String friendClerkId ;
private String friendStoreId ;
private int delType ;
public int getDelType() {
return delType;
}
public void setDelType(int delType) {
this.delType = delType;
}
public String getFriendClerkId() {
return friendClerkId;
......
package com.gic.haoban.manage.service.pojo;
import java.io.Serializable;
public class QwOpenResultBO implements Serializable {
private int errcode ;
private String errmsg ;
private Object data ;
public int getErrcode() {
return errcode;
}
public void setErrcode(int errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public boolean isOk() {
return this.errcode == 0 ;
}
}
package com.gic.haoban.manage.service.pojo;
import java.io.Serializable;
public class QwOpenResultInitBO implements Serializable {
private boolean is_login ;
private String uuid ;
private String qrcode ;
private String Key ;
private String qrcode_data ;
public boolean isIs_login() {
return is_login;
}
public void setIs_login(boolean is_login) {
this.is_login = is_login;
}
public String getQrcode_data() {
return qrcode_data;
}
public void setQrcode_data(String qrcode_data) {
this.qrcode_data = qrcode_data;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getQrcode() {
return qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
public String getKey() {
return Key;
}
public void setKey(String key) {
Key = key;
}
}
package com.gic.haoban.manage.service.service;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.OpenStaffListDTO;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import com.gic.haoban.manage.service.entity.TabOpenStaff;
import java.util.List;
public interface OpenStaffService {
TabOpenStaff save(TabOpenStaff tab) ;
TabOpenStaff getByUUID(String uuid) ;
void logout(String uuid, String loginRemark, int step , String noticeReason) ;
ServiceResponse<Page<OpenStaffListDTO>> page(OpenStaffPageQDTO qdto, BasePageInfo basePageInfo);
List<String> listAllStaffId(String wxEnterpriseId) ;
/**
* 自动登录 返回新的uuid
* @param openStaffId
* @param qwUserId
* @return
*/
String autoLogin(Long openStaffId , Long qwUserId) ;
void openStaffTimer();
void openStaffServiceTimer();
}
......@@ -194,4 +194,6 @@ public interface StaffClerkRelationService {
* @return
*/
List<String> listAllStaffIdByEnterpriseId(String enterpriseId,String wxEnterpriseId);
List<String> listAllStaffIdForOpenStaff(String enterpriseId,String wxEnterpriseId,String clerkId , List<String> storeIdList);
}
......@@ -99,4 +99,11 @@ public interface WxEnterpriseService {
*/
List<String> listWxEnterpriseByCallbackFlag(Integer callbackFlag);
/**
* 查询id
* @param corpName
* @return
*/
List<String> getWxEnterpriseIdByName(String corpName) ;
}
......@@ -150,6 +150,7 @@ public class WxUserAddLogServiceImpl implements WxUserAddLogService {
entity.setQwAddTime(qdto.getQwAddTime());
entity.setFriendClerkId(qdto.getFriendClerkId());
entity.setFriendStoreId(qdto.getFriendStoreId());
entity.setDelType(qdto.getDelType());
this.wxUserAddLogMapper.insert(entity);
}catch(Exception e) {
log.info("异常",e);
......
......@@ -27,6 +27,7 @@ import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.WxUserAddLogService;
import com.gic.haoban.task.manage.api.service.OpenQwApiService;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.dto.MemberSourceDetailDTO;
import com.gic.member.api.dto.MemberSourceShowDTO;
......@@ -84,6 +85,8 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
private TabHaobanRepairExternalUserMapper tabHaobanRepairExternalUserMapper;
@Autowired
private SecretSettingService secretSettingService;
@Autowired
private OpenQwApiService openQwApiService ;
@Override
public void insert(TabHaobanExternalClerkRelated related) {
......@@ -172,6 +175,10 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
}
wxUserAddLogQDTO.setFriendClerkId(related.getClerkId());
wxUserAddLogQDTO.setFriendStoreId(related.getStoreId());
int autoDelNum = this.openQwApiService.getAutoDelNum(staffId,externalUserid) ;
if(autoDelNum>0) {
wxUserAddLogQDTO.setDelType(1);
}
wxUserAddLogService.save(wxUserAddLogQDTO);
//定制
addDelFriendEvent(related.getUnionid(), related.getClerkId(), wxEnterpriseId, enterpriseId, related.getMemberId(), related.getStoreId(), 0);
......
package com.gic.haoban.manage.service.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreSearchDTO;
import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.manage.api.dto.OpenStaffListDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StoreClerkDTO;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.OpenStaffOfflineEnum;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.notify.NoticeMessageApiService;
import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabOpenStaff;
import com.gic.haoban.manage.service.pojo.QwOpenResultInitBO;
import com.gic.haoban.manage.service.service.OpenStaffService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.util.OpenUtils;
import com.gic.redis.data.util.RedisUtil;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
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 java.util.*;
import java.util.stream.Collectors;
@Service("openStaffService")
public class OpenStaffServiceImpl implements OpenStaffService {
private static final Logger log = LogManager.getLogger(OpenStaffService.class);
@Autowired
private OpenStaffMapper openStaffMapper;
@Autowired
private StaffClerkRelationService staffClerkRelationService;
@Autowired
private StoreGroupService storeGroupService;
@Autowired
private StoreService storeService;
@Autowired
private ClerkService clerkService;
@Autowired
private NoticeMessageApiService noticeMessageApiService;
@Autowired
private StaffMapper staffMapper;
@Autowired
private EnterpriseUseForbidService enterpriseUseForbidService;
@Autowired
private StaffApiService staffApiService ;
@Override
public TabOpenStaff save(TabOpenStaff tab) {
tab.setUpdateTime(new Date());
if (null == tab.getOpenStaffId()) {
tab.setOpenStaffId(UniqueIdUtils.uniqueLong());
tab.setDeleteFlag(0);
tab.setCreateTime(new Date());
this.openStaffMapper.insert(tab);
} else {
this.openStaffMapper.update(tab);
}
return tab;
}
@Override
public TabOpenStaff getByUUID(String uuid) {
TabOpenStaff openStaff = this.openStaffMapper.getByUUID(uuid);
if (null == openStaff) {
log.info("通过uuid查不到={}", uuid);
OpenUtils.logout(uuid);
}
return openStaff;
}
@Override
public void logout(String uuid, String loginRemark, int step, String noticeReason) {
TabOpenStaff openStaff = this.getByUUID(uuid);
if (null == openStaff) {
return;
}
OpenUtils.logout(uuid);
openStaff.setStep(step);
openStaff.setStatusFlag(2);
openStaff.setValidFlag(0);
openStaff.setValidQrcodeFlag(0);
openStaff.setQrCode1(null);
openStaff.setQrCode2(null);
openStaff.setKey1(null);
openStaff.setKey2(null);
openStaff.setUuid(uuid);
openStaff.setLoginRemark(loginRemark);
this.openStaffMapper.update(openStaff);
// 发送通知
if (StringUtils.isNotBlank(noticeReason)) {
log.info("发送退出登录通知,staffId={}", openStaff.getStaffId());
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(openStaff.getStaffId());
this.noticeMessageApiService.sendMessageForOpenStaff(openStaff.getEnterpriseId(), staff.getStaffName(), noticeReason);
// 发送通知
Map<String, String> map = new HashMap<String, String>();
map.put("reason", noticeReason);
int messageType = NoticeMessageTypeEnum.HAOBAN_OPEN_STAFF_LOGOUT.getType();
NoticeMessageUtil.sendNoticeMessageByStaff(openStaff.getEnterpriseId(), openStaff.getStaffId(), "-1", messageType, null, map, null);
}
}
@Override
public ServiceResponse<Page<OpenStaffListDTO>> page(OpenStaffPageQDTO qdto, BasePageInfo basePageInfo) {
log.info("分页查询条件={}", JSONObject.toJSONString(qdto));
String wxEnterpriseId = qdto.getWxEnterpriseId();
String enterpriseId = qdto.getEnterpriseId();
List<String> storeIdList = staffApiService.getHaoBanStoreIdsRolesByClerkId(qdto.getLoginClerkId(), wxEnterpriseId);
if(CollectionUtils.isEmpty(storeIdList)) {
return ServiceResponse.success(new Page<>());
}
if (CollectionUtils.isNotEmpty(qdto.getStoreGroupIdList())) {
storeIdList = this.getStoreIdList(enterpriseId, qdto.getStoreGroupIdList(),storeIdList);
}
if((storeIdList.size()==1 && storeIdList.contains("-1"))) {
storeIdList = null ;
}
if (StringUtils.isNotBlank(qdto.getClerkId()) || CollectionUtils.isNotEmpty(storeIdList)) {
List<String> staffIds = staffClerkRelationService.listAllStaffIdForOpenStaff(enterpriseId, wxEnterpriseId, qdto.getClerkId(), storeIdList);
if (CollectionUtils.isEmpty(staffIds)) {
return ServiceResponse.success(new Page<>());
}
qdto.setStaffIds(staffIds);
}
PageHelper.startPage(basePageInfo);
List<OpenStaffListDTO> list = this.openStaffMapper.list(qdto);
if (CollectionUtils.isEmpty(list)) {
return ServiceResponse.success(new Page<>());
}
Set<String> staffIdList = list.stream().map(dto -> dto.getStaffId()).collect(Collectors.toSet());
List<StaffClerkRelationDTO> relationDTOList = staffClerkRelationService.listByWxEnterpriseIdAndStaffId(wxEnterpriseId, staffIdList);
relationDTOList = relationDTOList.stream().filter(o -> o.getEnterpriseId().equals(enterpriseId)).collect(Collectors.toList());
Map<String, ClerkDTO> clerkMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(relationDTOList)) {
Set<String> clerkIdSet = relationDTOList.stream().map(o -> o.getClerkId()).collect(Collectors.toSet());
if (CollectionUtils.isNotEmpty(clerkIdSet)) {
List<ClerkDTO> clerkDTOS = this.clerkService.getClerkByIds(clerkIdSet);
clerkMap.putAll(clerkDTOS.stream().collect(Collectors.toMap(o -> o.getClerkId(), o -> o, (k1, k2) -> k1)));
}
}
log.info("导购={}", JSONObject.toJSONString(clerkMap));
for (OpenStaffListDTO item : list) {
String staffId = item.getStaffId();
List<StoreClerkDTO> clerkList = new ArrayList<>();
for (StaffClerkRelationDTO clerkRelation : relationDTOList) {
if (clerkRelation.getStaffId().equals(staffId)) {
String storeId = clerkRelation.getStoreId();
String clerkId = clerkRelation.getClerkId();
ClerkDTO clerkDTO = clerkMap.get(clerkId);
if (null != clerkDTO) {
StoreClerkDTO cs = new StoreClerkDTO();
cs.setClerkId(clerkId);
cs.setClerkName(clerkDTO.getClerkName());
cs.setClerkCode(clerkDTO.getClerkCode());
StoreDTO store = this.storeService.getStore(storeId);
if (null != store) {
cs.setStoreId(storeId);
cs.setStoreName(store.getStoreName());
cs.setStoreCode(store.getStoreCode());
}
clerkList.add(cs);
}
}
}
item.setClerkList(clerkList);
}
Page<OpenStaffListDTO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, OpenStaffListDTO.class);
log.info("分页查询结果={}", JSONObject.toJSONString(retPage, true));
return ServiceResponse.success(retPage);
}
@Override
public List<String> listAllStaffId(String wxEnterpriseId) {
return this.openStaffMapper.listAllStaffId(wxEnterpriseId);
}
private List<String> getStoreIdList(String enterpriseId, List<String> storeGroupIds , List<String> storeList) {
StoreSearchDTO storeSearch = new StoreSearchDTO();
List<String> groupIds = storeGroupService.getStoreGroupIdsByParentGroupId(enterpriseId, storeGroupIds);
storeSearch.setStoreGroupIdList(groupIds);
storeSearch.setEnterpriseId(enterpriseId);
storeSearch.setStatus("2");
Page pageStore = new Page<>();
//-1代表不分页
pageStore.setCurrentPage(-1);
if(!(storeList.size()==1 && storeList.contains("-1"))) {
storeSearch.setStoreIdList(storeList);
}
Page resultPage = storeService.storeListPage(pageStore, storeSearch);
List<StoreDTO> storeDTOList = resultPage.getResult();
if (CollectionUtils.isEmpty(storeDTOList)) {
return new ArrayList<>();
}
log.info("门店条件查询,返回={}条", storeDTOList.size());
List<String> searchStoreIds = storeDTOList.stream().map(StoreDTO::getStoreId).distinct().collect(Collectors.toList());
return searchStoreIds;
}
@Override
public String autoLogin(Long openStaffId, Long qwUserId) {
ServiceResponse<QwOpenResultInitBO> initResp = OpenUtils.init(qwUserId, false);
log.info("自动登录-初始化={},{}", qwUserId, JSONObject.toJSONString(initResp));
if (initResp.isSuccess() && StringUtils.isNotBlank(initResp.getResult().getUuid())) {
QwOpenResultInitBO bo = initResp.getResult();
String newUuid = bo.getUuid();
if (bo.isIs_login()) {
this.openStaffMapper.updateByAutoLogin(qwUserId, newUuid);
return newUuid;
}
boolean autLogin = OpenUtils.autoLogin(newUuid);
if (autLogin) {
this.openStaffMapper.updateByAutoLogin(qwUserId, newUuid);
return newUuid;
}
}
return null;
}
/**
* 1. 首次登录流程
* 初始化 扫码登录
* <p>
* 2. 自动重连流程
* 如果登录了很多号,我结束服务,重启服务后
* 初始化接口 vid传登陆过的账号userid 然后 初始化接口返回有个is_login=true 代表连上了如果是false就走自动登录接口
* 如果自动登录失败,获取二维码扫码登录
* <p>
* 3. 自动登录
* 如果一个号登录了,调用了退出接口,下次初始化接口vid填这个号的id然后调用自动登录接口,登录失败 走扫码
*/
@Override
public void openStaffTimer() {
log.info("定时检查托管状态");
Object o = RedisUtil.getCache("haobansilk2mp3") ;
if(null == o) {
com.gic.haoban.common.utils.DingUtils.send("请检查silk2mp3", false);
}
List<TabOpenStaff> list = this.openStaffMapper.listAllOnline(null, null);
for (TabOpenStaff item : list) {
try{
String uuid = item.getUuid();
boolean isLogin = OpenUtils.isLogin(uuid);
// 未登录
if (!isLogin) {
String autLogin = this.autoLogin(item.getOpenStaffId(), item.getQwUserId());
if (null == autLogin) {
this.logout(uuid, "定时检查异", 0, OpenStaffOfflineEnum.OFFLINE2.getDesc());
}
}
}catch (Exception e) {
log.info("异常",e);
}
}
}
@Override
public void openStaffServiceTimer() {
log.info("托管服务到期");
List<TabOpenStaff> list = this.openStaffMapper.listAllOnlineEnterprise();
if(CollectionUtils.isNotEmpty(list)) {
for (TabOpenStaff item : list) {
String wxEnterpriseId = item.getWxEnterpriseId() ;
String enterpriseId = item.getEnterpriseId() ;
boolean isValid = this.isValid(wxEnterpriseId,enterpriseId) ;
log.info("是否有效={},{},{}",isValid,wxEnterpriseId,enterpriseId);
if (!isValid) {
List<TabOpenStaff> staffList = this.openStaffMapper.listAllOnline(wxEnterpriseId, enterpriseId);
if(CollectionUtils.isNotEmpty(staffList)) {
staffList.forEach(o->{
try {
this.logout(o.getUuid(), "服务过期", 0, null);
}catch (Exception e) {
log.info("异常",e);
}
});
}
}
}
}
}
private boolean isValid(String wxEnterpriseId, String enterpriseId) {
ServiceResponse<EnterpriseUsingPermissionDto> resp = this.enterpriseUseForbidService.getWxEnterpriseService(enterpriseId, wxEnterpriseId);
log.info("托管许可={}", JSONObject.toJSONString(resp));
if (resp.isSuccess()) {
EnterpriseUsingPermissionDto dto = resp.getResult();
if (null == dto) {
return false ;
} else {
if (dto.getServiceEndDate().before(new Date())) {
return false ;
}
}
}
return true ;
}
}
......@@ -614,4 +614,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
public List<String> listAllStaffIdByEnterpriseId(String enterpriseId, String wxEnterpriseId) {
return this.mapper.listAllStaffIdByEnterpriseId(enterpriseId,wxEnterpriseId);
}
@Override
public List<String> listAllStaffIdForOpenStaff(String enterpriseId, String wxEnterpriseId, String clerkId, List<String> storeIdList) {
return this.mapper.listAllStaffIdForOpenStaff(enterpriseId,wxEnterpriseId,clerkId,storeIdList);
}
}
......@@ -316,4 +316,9 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
public List<String> listWxEnterpriseByCallbackFlag(Integer callbackFlag) {
return this.mapper.listWxEnterpriseByCallbackFlag(callbackFlag);
}
@Override
public List<String> getWxEnterpriseIdByName(String corpName) {
return this.mapper.getWxEnterpriseIdByName(corpName) ;
}
}
......@@ -13,9 +13,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.gic.clerk.api.dto.ClerkListDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.commons.util.*;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.notify.dto.NotifyMessageMQDTO;
import com.gic.haoban.manage.api.dto.notify.qdto.NotifyMessageBatchQDTO;
......@@ -28,6 +26,7 @@ import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import com.gic.haoban.manage.service.service.message.NoticeMessageHandler;
import com.gic.haoban.manage.service.util.ApolloUtils;
import com.gic.message.center.api.subscribe.model.NoticeMessageForm;
import com.gic.mq.sdk.GicMQClient;
import com.gic.wechat.api.dto.qywx.QywxTemplateCardSendMessageDTO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
......@@ -41,7 +40,6 @@ import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Constant;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.PageHelperUtils;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.notify.dto.NoticeMessageInfoDTO;
......@@ -146,7 +144,7 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
noticeMessageBO.setMessageType(messageQDTO.getMessageType());
noticeMessageBO.setClerkId(messageQDTO.getClerkId() != null ? messageQDTO.getClerkId() : "-1");
noticeMessageBO.setStoreId(clerkRelationDTO != null ? clerkRelationDTO.getStoreId() : "-1");
noticeMessageBO.setTitle(StringUtils.isNotBlank(messageQDTO.getTitle())?messageQDTO.getTitle():messageTypeEnum.getName());
noticeMessageBO.setTitle(StringUtils.isNotBlank(messageQDTO.getTitle()) ? messageQDTO.getTitle() : messageTypeEnum.getName());
noticeMessageBO.setTemplateCode(messageTypeEnum.getTemplateCode());
noticeMessageBO.setDescription(haobanNotice);
noticeMessageBO.setEnterpriseId(messageQDTO.getEnterpriseId());
......@@ -154,13 +152,13 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
noticeMessageBO.setMessageContent(messageQDTO.getExtendContent() != null ? JSONObject.toJSONString(messageQDTO.getExtendContent()) : null);
noticeMessageService.addOrCreateNoticeMessage(noticeMessageBO);
//发送企业微信
sendMessage(contentList, wxEnterpriseId, staffId, messageTypeEnum, noticeMessageBO.getMessageContent(),messageQDTO.getTitle());
sendMessage(contentList, wxEnterpriseId, staffId, messageTypeEnum, noticeMessageBO.getMessageContent(), messageQDTO.getTitle());
}
@Override
public void noticeMessageMq(String json) {
if (!ApolloUtils.useMessageCenter()){
if (!ApolloUtils.useMessageCenter()) {
logger.info("消息中心-走老版消息通知");
this.noticeMessageMq_old(json);
return;
......@@ -207,14 +205,14 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
.enterpriseId(messageQDTO.getEnterpriseId())
.uniqueKey(UniqueIdUtils.uniqueLongHex())
.variableMap(variableMap).build();
if (clerkRelationDTO != null){
if (clerkRelationDTO != null) {
build.setUserIdList(Collections.singletonList(clerkRelationDTO.getClerkId()));
} else {
build.setStaffIdList(Collections.singletonList(staffId));
}
noticeMessageHandler.sendMessage(build);
} catch (Exception e) {
logger.error("发送消息通知失败",e);
logger.error("发送消息通知失败", e);
}
}
......@@ -227,7 +225,7 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
@Override
public void noticeMessageBatchMq(String json) {
NotifyMessageBatchQDTO notifyMessageBatchQDTO = JSONObject.parseObject(json, NotifyMessageBatchQDTO.class);
if (!ApolloUtils.useMessageCenter()){
if (!ApolloUtils.useMessageCenter()) {
logger.info("消息中心-走老版消息通知");
this.batchSendMessage_old(notifyMessageBatchQDTO);
return;
......@@ -267,11 +265,11 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
return ServiceResponse.success();
}
notifyMessageBatchQDTO.setTemplateCode(messageTypeEnum.getTemplateCode());
Map<String, List<StaffClerkRelationDTO>> map = relationList.stream().filter(x->wxEnterpriseIdList.contains(x.getWxEnterpriseId())).collect(Collectors.groupingBy(StaffClerkRelationDTO::getWxEnterpriseId));
map.forEach((wxEnterpriseId,v)->{
Map<String, List<StaffClerkRelationDTO>> map = relationList.stream().filter(x -> wxEnterpriseIdList.contains(x.getWxEnterpriseId())).collect(Collectors.groupingBy(StaffClerkRelationDTO::getWxEnterpriseId));
map.forEach((wxEnterpriseId, v) -> {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO == null) {
logger.info("企业为空:{}",wxEnterpriseId);
logger.info("企业为空:{}", wxEnterpriseId);
return;
}
// 用于成员去重
......@@ -279,9 +277,9 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
List<List<StaffClerkRelationDTO>> listList = ListUtil.split(v, 1000);
for (List<StaffClerkRelationDTO> list : listList) {
try {
sendMessage(notifyMessageBatchQDTO, list,userIdSet, qwDTO);
sendMessage(notifyMessageBatchQDTO, list, userIdSet, qwDTO);
} catch (Exception e) {
logger.error("发送消息通知失败",e);
logger.error("发送消息通知失败", e);
}
}
});
......@@ -346,7 +344,7 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
.variableMap(variableMap).build());
}
} catch (Exception e) {
logger.error("发送消息通知失败",e);
logger.error("发送消息通知失败", e);
}
return ServiceResponse.success();
......@@ -365,7 +363,7 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
return data;
}
private void sendMessage(NotifyMessageBatchQDTO notifyMessageBatchQDTO, List<StaffClerkRelationDTO> list,Set<String> userIdSet, WxEnterpriseQwDTO qwDTO) {
private void sendMessage(NotifyMessageBatchQDTO notifyMessageBatchQDTO, List<StaffClerkRelationDTO> list, Set<String> userIdSet, WxEnterpriseQwDTO qwDTO) {
//企业微信模板
List<TemplateContentBO> contentList = getDescriotion(notifyMessageBatchQDTO);
......@@ -384,9 +382,9 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
List<String> wxUserIdList = new ArrayList<>();
List<NoticeMessageBO> noticeMessageBOList = new ArrayList<>();
for (StaffClerkRelationDTO relationDTO : list) {
String wxUserId = relationDTO.getQwUserId() ;
if(qwDTO.needOpenUserId3th()) {
wxUserId = relationDTO.getOpenUserId() ;
String wxUserId = relationDTO.getQwUserId();
if (qwDTO.needOpenUserId3th()) {
wxUserId = relationDTO.getOpenUserId();
}
if (userIdSet.add(wxUserId)) {
wxUserIdList.add(wxUserId);
......@@ -397,7 +395,7 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
noticeMessageBO.setMessageType(notifyMessageBatchQDTO.getMessageType());
noticeMessageBO.setClerkId(relationDTO.getClerkId() != null ? relationDTO.getClerkId() : "-1");
noticeMessageBO.setStoreId(relationDTO.getStoreId() != null ? relationDTO.getStoreId() : "-1");
noticeMessageBO.setTitle(StringUtils.isNotBlank(notifyMessageBatchQDTO.getTitle())? notifyMessageBatchQDTO.getTitle(): messageTypeEnum.getName());
noticeMessageBO.setTitle(StringUtils.isNotBlank(notifyMessageBatchQDTO.getTitle()) ? notifyMessageBatchQDTO.getTitle() : messageTypeEnum.getName());
noticeMessageBO.setTemplateCode(messageTypeEnum.getTemplateCode());
noticeMessageBO.setDescription(haobanNotice);
noticeMessageBO.setEnterpriseId(notifyMessageBatchQDTO.getEnterpriseId());
......@@ -427,18 +425,18 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
messageDTO.setAgentName(qwDTO.getAgentName());
messageDTO.setUserIds(wxUserIdList);
messageDTO.setPage(appUrl);
messageDTO.setTitle(StringUtils.isNotBlank(title)?title: messageTypeEnum.getName());
messageDTO.setTitle(StringUtils.isNotBlank(title) ? title : messageTypeEnum.getName());
messageDTO.setContent(contentList.get(0).getVal());
boolean sendMessage = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
boolean sendMessage = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), messageDTO, qwDTO.isSelf(), qwDTO.getUrlHost());
NotifyMessageMQDTO mqdto = new NotifyMessageMQDTO();
List<String> clerkIdList = list.stream().map(StaffClerkRelationDTO::getClerkId).collect(Collectors.toList());
mqdto.setClerkIdList(clerkIdList);
mqdto.setEnterpriseId(notifyMessageBatchQDTO.getEnterpriseId());
mqdto.setTemplateCode(messageTypeEnum.getTemplateCode());
mqdto.setExtendContent(notifyMessageBatchQDTO.getExtendContent());
mqdto.setResult(sendMessage?Constant.FLAG_TRUE:Constant.FLAG_FALSE);
mqdto.setResult(sendMessage ? Constant.FLAG_TRUE : Constant.FLAG_FALSE);
try {
GICMQClientUtil.getClientInstance().sendMessage("haobanNotifyEvent",JSON.toJSONString(mqdto));
GICMQClientUtil.getClientInstance().sendMessage("haobanNotifyEvent", JSON.toJSONString(mqdto));
} catch (Exception e) {
logger.info(e.getMessage(), e);
}
......@@ -545,14 +543,14 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
* 发送消息
*
* @param contentList
* @param wxUserId
* @param
* @param messageTypeEnum
*/
private void sendMessage(List<TemplateContentBO> contentList, String wxEnterpriseId, String staffId, NoticeMessageTypeEnum messageTypeEnum, String data,String title) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
private void sendMessage(List<TemplateContentBO> contentList, String wxEnterpriseId, String staffId, NoticeMessageTypeEnum messageTypeEnum, String data, String title) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
String corpid = qwDTO.getThirdCorpid() ;
TabHaobanStaff tabHaobanStaff = staffService.selectById(staffId) ;
String corpid = qwDTO.getThirdCorpid();
TabHaobanStaff tabHaobanStaff = staffService.selectById(staffId);
if (tabHaobanStaff == null) {
logger.error("未查询到员工:staffId:{}", staffId);
return;
......@@ -585,8 +583,32 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(userList);
messageDTO.setPage(appUrl);
messageDTO.setTitle(StringUtils.isNotBlank(title)?title:messageTypeEnum.getName());
messageDTO.setTitle(StringUtils.isNotBlank(title) ? title : messageTypeEnum.getName());
messageDTO.setItems(items);
qywxSuiteApiService.sendMessage(corpid, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
qywxSuiteApiService.sendMessage(corpid, qwDTO.getSelf3thSecret(), messageDTO, qwDTO.isSelf(), qwDTO.getUrlHost());
}
public void sendMessageForOpenStaff(String enterpriseId, String accountName, String reason) {
Map<String, String> map = new HashMap<>();
map.put("accountName", accountName);
map.put("errorTime", DateUtil.dateToStr(new Date(), "yyyy年MM月dd日 hh:mm"));
map.put("reason", reason);
String mqName = "haobanNotice";
NoticeMessageForm noticeMessageForm = new NoticeMessageForm();
noticeMessageForm.setMessageCode("haobanOpenStaffNotice");
noticeMessageForm.setMqRouterCode(mqName);
noticeMessageForm.setEnterpriseId(enterpriseId);
noticeMessageForm.setBusinessId(ToolUtil.randomUUID());
noticeMessageForm.setUniqueKey(UniqueIdUtils.uniqueLongHex());
noticeMessageForm.setUserIdList(null);
noticeMessageForm.setCreateTime(new Date());
noticeMessageForm.setVariableMap(map);
try {
GicMQClient client = GICMQClientUtil.getClientInstance();
client.sendMessage(mqName, JSON.toJSONString(noticeMessageForm));
} catch (Exception e) {
logger.error("路由规则名称:" + mqName + ",message:" + JSON.toJSONString(noticeMessageForm), e);
}
}
}
......@@ -836,6 +836,16 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
}
@Override
public ExternalClerkRelatedDTO getDelFriend(String wxEnterpriseId, String enterpriseId, String staffId) {
TabHaobanExternalClerkRelated tab = this.tabHaobanExternalClerkRelatedMapper.getDelFriend(wxEnterpriseId,enterpriseId,staffId) ;
if(null != tab) {
ExternalClerkRelatedDTO dto = EntityUtil.changeEntityByJSON(ExternalClerkRelatedDTO.class,tab) ;
return dto ;
}
return null;
}
@Override
public Page<ExternalClerkRelatedDTO> halfFriendPage(String wxEnterpriseId, String storeId, String clerkId, String staffId, int type, BasePageInfo basePageInfo) {
Page<ExternalClerkRelatedDTO> retPage = null ;
try {
......@@ -855,4 +865,6 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
}
return retPage;
}
}
......@@ -7,7 +7,7 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMap
import com.gic.haoban.manage.service.dao.mapper.hm.WxUserAddLogMapper;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog;
import com.gic.haoban.manage.service.service.QywxErrorLogService;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.chat.GroupChatDataService;
import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.haoban.manage.service.util.HBQwMonitorUtils;
......@@ -16,16 +16,12 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joda.time.DateTime;
import org.redisson.api.RMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.ExternalMemberService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
......@@ -56,6 +52,8 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
private WxUserAddLogMapper wxUserAddLogMapper ;
@Autowired
private HaobanCommonMQApiService haobanCommonMQApiService ;
@Autowired
private OpenStaffService openStaffService ;
@Override
......@@ -178,4 +176,14 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
DingUtils.send("halfTimer告警,wxEnterpriseId="+wxEnterpriseId, null, false);
log.info("结束单向数据={}",wxEnterpriseId);
}
@Override
public void openStaffTimer(String params) {
this.openStaffService.openStaffTimer() ;
}
@Override
public void openStaffServiceTimer(String params) {
this.openStaffService.openStaffServiceTimer() ;
}
}
package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.OpenStaffDTO;
import com.gic.haoban.manage.api.dto.OpenStaffLicenseDTO;
import com.gic.haoban.manage.api.dto.OpenStaffListDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.enums.OpenStaffOfflineEnum;
import com.gic.haoban.manage.api.enums.QwOpenStepEnum;
import com.gic.haoban.manage.api.qdto.OpenStaffInitQDTO;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper;
import com.gic.haoban.manage.service.entity.TabOpenStaff;
import com.gic.haoban.manage.service.pojo.QwOpenResultInitBO;
import com.gic.haoban.manage.service.service.OpenStaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.OpenUtils;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.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 java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 企微托管账号
*/
@Service("openStaffApiService")
public class OpenStaffApiServiceImpl implements OpenStaffApiService {
private static final Logger log = LogManager.getLogger(OpenStaffApiService.class);
@Autowired
private OpenStaffMapper openStaffMapper;
@Autowired
private OpenStaffService openStaffService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Override
public ServiceResponse<Void> delete(Long id) {
TabOpenStaff staff = this.openStaffMapper.getById(id);
if (null != staff) {
this.openStaffService.logout(staff.getUuid(), "删除", 0, null);
}
this.openStaffMapper.deleteByPrimaryKey(id);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> updateValiFlag(String uuid) {
this.openStaffMapper.updateValidFlag(uuid);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> update2QrcodeFlag(String uuid) {
TabOpenStaff openStaff = this.openStaffService.getByUUID(uuid);
if (null == openStaff) {
return ServiceResponse.failure("9999", "登录错误");
}
// 需要二次验证
this.openStaffService.logout(uuid, OpenStaffOfflineEnum.OFFLINE1.getDesc(), 0, OpenStaffOfflineEnum.OFFLINE1.getDesc());
this.openStaffMapper.update2QrcodeFlag(openStaff.getOpenStaffId());
return ServiceResponse.success();
}
@Override
public ServiceResponse<OpenStaffDTO> get2Qrcode(long id) {
TabOpenStaff openStaff = this.openStaffMapper.getById(id);
if (null == openStaff) {
return ServiceResponse.failure("9999", "登录错误");
}
ServiceResponse<QwOpenResultInitBO> resp = OpenUtils.getQrcode(openStaff.getUuid(), null, 2);
String qrcodeData = null;
if (resp.isSuccess()) {
String qrcode = resp.getResult().getQrcode();
String key = resp.getResult().getKey();
this.openStaffMapper.update2Qrcode(openStaff.getOpenStaffId(), qrcode, key);
openStaff.setQrCode2(qrcode);
qrcodeData = resp.getResult().getQrcode_data();
} else {
return ServiceResponse.failure("9999", resp.getMessage());
}
OpenStaffDTO dto = EntityUtil.changeEntityByJSON(OpenStaffDTO.class, openStaff);
dto.setQrcodeData(qrcodeData);
return ServiceResponse.success(dto);
}
@Override
public ServiceResponse<Void> updateLoginStep(String uuid, int step) {
TabOpenStaff openStaff = this.openStaffService.getByUUID(uuid);
if (null == openStaff) {
return ServiceResponse.failure("9999", "登录错误");
}
this.openStaffMapper.updateLoginStep(openStaff.getOpenStaffId(), step);
if (QwOpenStepEnum.isFail(step)) {
this.openStaffService.logout(uuid, "企微返回退出/登录超时", 0, null);
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> login(String uuid, Long qwCorpId, String corpName, Long qwUserId) {
TabOpenStaff openStaff = this.openStaffService.getByUUID(uuid);
if (null == openStaff) {
return ServiceResponse.failure("9999", "登录错误");
}
String wxEnterpriseId = openStaff.getWxEnterpriseId();
List<String> backWxEnterpriseIdList = this.wxEnterpriseService.getWxEnterpriseIdByName(corpName);
if (CollectionUtils.isEmpty(backWxEnterpriseIdList) || backWxEnterpriseIdList.size() > 1 || !backWxEnterpriseIdList.get(0).equals(wxEnterpriseId)) {
this.openStaffService.logout(uuid, "授权登录账号与当前账号不一致", 10, null);
log.info("登录的企业不对={},{}", uuid, corpName);
return ServiceResponse.failure("9999", "登录错误");
}
TabOpenStaff staff = this.openStaffMapper.getByQwUserId(qwUserId);
if (null != staff && !staff.getWxEnterpriseId().equals(wxEnterpriseId)) {
this.openStaffService.logout(uuid, "只能托管一个企微企业", 0, null);
log.info("只能托管一个企业={},{}", uuid, corpName);
return ServiceResponse.failure("9999", "只能托管一个企业");
}
openStaff.setWxCorpId(qwCorpId);
openStaff.setQwUserId(qwUserId);
if (null == openStaff.getFirstAuthTime()) {
openStaff.setFirstAuthTime(new Date());
}
openStaff.setAuthTime(new Date());
openStaff.setStatusFlag(1);
this.openStaffMapper.update(openStaff);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> logout(String uuid, OpenStaffOfflineEnum offlineEnum) {
this.openStaffService.logout(uuid, offlineEnum.getDesc(), 0, offlineEnum.getDesc());
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> logout(Long openStaffId) {
TabOpenStaff staff = this.openStaffMapper.getById(openStaffId);
this.openStaffService.logout(staff.getUuid(), "取消授权", 0, null);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> checkCode(Long openStaffId, String validCode) {
TabOpenStaff tab = this.openStaffMapper.getById(openStaffId);
if (null == tab) {
return ServiceResponse.failure("9999", "记录不存在");
}
return OpenUtils.checkCode(tab.getUuid(), tab.getKey1(), validCode);
}
@Override
public ServiceResponse<OpenStaffDTO> getById(Long openStaffId) {
TabOpenStaff openStaff = this.openStaffMapper.getById(openStaffId);
if (null == openStaff) {
return ServiceResponse.failure("9999", "已删除");
}
OpenStaffDTO dto = EntityUtil.changeEntityByJSON(OpenStaffDTO.class, openStaff);
return ServiceResponse.success(dto);
}
@Override
public ServiceResponse<OpenStaffDTO> getByQwUserId(Long qwUserId) {
TabOpenStaff openStaff = this.openStaffMapper.getByQwUserId(qwUserId);
if (null == openStaff) {
return ServiceResponse.failure("9999", "已删除");
}
OpenStaffDTO dto = EntityUtil.changeEntityByJSON(OpenStaffDTO.class, openStaff);
return ServiceResponse.success(dto);
}
@Override
public ServiceResponse<OpenStaffDTO> init(OpenStaffInitQDTO qdto) {
String staffId = qdto.getStaffId();
if (StringUtils.isBlank(staffId)) {
log.info("staffId is null");
return ServiceResponse.failure("9999", "staffId为空");
}
String lockKey = "lock:qywx:open:" + staffId;
try {
RedisUtil.lock(lockKey, 3L);
TabOpenStaff openStaff = this.openStaffMapper.getByStaffId(staffId);
Long qwUserId = null;
if (null != openStaff) {
if (openStaff.getStatusFlag() == 1 && qdto.getLoginAgainFlag() == 0) {
return ServiceResponse.failure("9999", "成员已托管中");
}
qwUserId = openStaff.getQwUserId();
log.info("重新初始化");
this.openStaffService.logout(openStaff.getUuid(), "重新初始化", 0, null);
// 自动登录
String newUuid = this.openStaffService.autoLogin(openStaff.getOpenStaffId(),openStaff.getQwUserId()) ;
if(null != newUuid) {
log.info("自动登录成功");
openStaff.setAuthTime(new Date());
openStaff.setStatusFlag(1);
openStaff.setUuid(newUuid);
openStaff.setLoginRemark("自动登录成功");
this.openStaffMapper.update(openStaff);
OpenStaffDTO dto = EntityUtil.changeEntityByJSON(OpenStaffDTO.class, openStaff);
return ServiceResponse.success(dto);
}
}
if (null == openStaff) {
openStaff = new TabOpenStaff();
openStaff.setStaffId(staffId);
openStaff.setWxEnterpriseId(qdto.getWxEnterpriseId());
openStaff.setEnterpriseId(qdto.getEnterpriseId());
}
ServiceResponse<QwOpenResultInitBO> resp = OpenUtils.init(qwUserId,true);
log.info("resp={}", JSONObject.toJSONString(resp));
QwOpenResultInitBO init = resp.getResult();
openStaff.setUuid(init.getUuid());
openStaff.setQrCode1(init.getQrcode());
openStaff.setKey1(init.getKey());
openStaff.setStatusFlag(2);
openStaff.setStep(0);
openStaff.setValidFlag(0);
openStaff.setValidQrcodeFlag(0);
openStaff.setQrCode2(null);
openStaff.setKey2(null);
openStaff = this.openStaffService.save(openStaff);
OpenStaffDTO dto = EntityUtil.changeEntityByJSON(OpenStaffDTO.class, openStaff);
dto.setQrcodeData(init.getQrcode_data());
return ServiceResponse.success(dto);
} catch (Exception e) {
log.info("异常", e);
}
return ServiceResponse.failure("9999", "登录失败");
}
@Override
public ServiceResponse<OpenStaffLicenseDTO> getLicenseInfo(String wxEnterpriseId, String enterpriseId) {
OpenStaffLicenseDTO dto = new OpenStaffLicenseDTO();
int useNum = this.openStaffMapper.getNum(wxEnterpriseId, enterpriseId, 0);
int validNum = this.openStaffMapper.getNum(wxEnterpriseId, enterpriseId, 1);
dto.setUseNum(useNum);
dto.setValidNum(validNum);
return ServiceResponse.success(dto);
}
@Override
public ServiceResponse<Page<OpenStaffListDTO>> page(OpenStaffPageQDTO qdto, BasePageInfo basePageInfo) {
return this.openStaffService.page(qdto, basePageInfo);
}
@Override
public ServiceResponse<OpenStaffDTO> getByStaffId(String staffId) {
TabOpenStaff tab = this.openStaffMapper.getByStaffId(staffId);
if (null == tab) {
return ServiceResponse.failure("9999", "已删除");
}
OpenStaffDTO dto = EntityUtil.changeEntityByJSON(OpenStaffDTO.class, tab);
return ServiceResponse.success(dto);
}
@Override
public ServiceResponse<OpenStaffDTO> getByUUID(String uuid) {
TabOpenStaff tab = this.openStaffMapper.getByUUID(uuid);
if (null == tab) {
return ServiceResponse.failure("9999", "不存在");
}
OpenStaffDTO dto = EntityUtil.changeEntityByJSON(OpenStaffDTO.class, tab);
return ServiceResponse.success(dto);
}
@Override
public List<StaffClerkRelationDTO> listOpenStaffByClerk(String wxEnterpriseId, String enterpriseId, List<String> clerkIdList) {
return this.openStaffMapper.listOpenStaffByClerk(wxEnterpriseId, enterpriseId, clerkIdList);
}
@Override
public List<StaffClerkRelationDTO> listOpenStaffByStore(String wxEnterpriseId, String enterpriseId, List<String> storeIdList) {
return this.openStaffMapper.listOpenStaffByStore(wxEnterpriseId, enterpriseId, storeIdList);
}
@Override
public List<String> listAllOnlineStaff() {
return this.listAllOnlineStaff(null, null);
}
@Override
public List<String> listAllOnlineStaff(String wxEnterpriseId, String enterpriseId) {
List<TabOpenStaff> list = this.openStaffMapper.listAllOnline(wxEnterpriseId, enterpriseId);
return list.stream().map(o -> o.getStaffId()).collect(Collectors.toList());
}
@Override
public List<String> listOpenStoreId(String wxEnterpriseId, String enterpriseId) {
return this.openStaffMapper.listOpenStoreId(wxEnterpriseId, enterpriseId);
}
@Override
public void updateStopTime(Long openStaffId, int type, int time) {
this.openStaffMapper.updateStopTime(openStaffId, type, time);
}
}
......@@ -135,6 +135,8 @@ public class StaffApiServiceImpl implements StaffApiService {
private MessageApiService messageApiService ;
@Autowired
private StoreService storeService ;
@Autowired
private OpenStaffService openStaffService ;
@Override
public StaffDTO selectById(String staffId) {
......@@ -174,6 +176,9 @@ public class StaffApiServiceImpl implements StaffApiService {
String wxEnterpriseId = staffListDTO.getWxEnterpriseId();
BasePageInfo pageInfo = staffListDTO.getPageInfo();
String enterpriseIdParam = staffListDTO.getEnterpriseIdParam();
if(staffListDTO.getQwOpenFlag()==1) {
enterpriseIdParam = staffListDTO.getLoginEnterpriseId() ;
}
List<String> staffIds = new ArrayList<>();
//查询所属品牌成员id
if(StrUtil.isNotBlank(enterpriseIdParam)){
......@@ -196,6 +201,13 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
}
if(staffListDTO.getQwOpenFlag()==1) {
List<String> list = this.openStaffService.listAllStaffId(wxEnterpriseId) ;
staffIds = staffIds.stream().filter(o->!list.contains(o)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(staffIds)){
return new Page<>();
}
}
StaffListBO staffListBO = EntityUtil.changeEntityByJSON(StaffListBO.class, staffListDTO);
staffListBO.setStaffIds(staffIds);
staffListBO.setRelationFlag(relationFlag);
......
......@@ -11,7 +11,11 @@ import java.util.stream.Collectors;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatUserMapper;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.entity.chat.TabGroupChat;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -69,6 +73,10 @@ public class GroupChatApiServiceImpl implements GroupChatApiService {
private TabHaobanClerkMainStoreRelatedMapper clerkMainStoreRelatedMapper ;
@Autowired
private StoreService storeService ;
@Autowired
private GroupChatMapper groupChatMapper ;
@Autowired
private GroupChatUserMapper groupChatUserMapper ;
@Override
public ServiceResponse<Page<GroupChatDTO>> listPage(GroupChatSearchQDTO qdto, BasePageInfo basePageInfo) {
......@@ -284,4 +292,32 @@ public class GroupChatApiServiceImpl implements GroupChatApiService {
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<GroupChatDTO> getByWxChatId(String wxEnterpriseId, String wxChatId) {
TabGroupChat groupChat = this.groupChatMapper.selectByWxChatId(wxEnterpriseId, wxChatId);
if(null == groupChat) {
groupChat = this.groupChatMapper.selectByWxChatIdDk(wxEnterpriseId,wxChatId) ;
}
if(null == groupChat) {
return ServiceResponse.success(null) ;
}
GroupChatDTO dto = EntityUtil.changeEntityByJSON(GroupChatDTO.class,groupChat) ;
return ServiceResponse.success(dto);
}
@Override
public GroupChatUserDTO getGroupUserInfo(Long groupChatId, String externalUserId) {
TabGroupChatUser tab = this.groupChatUserMapper.getGroupUserInfo(groupChatId,externalUserId) ;
if(null != tab) {
GroupChatUserDTO dto = EntityUtil.changeEntityByJSON(GroupChatUserDTO.class,tab) ;
return dto ;
}
return null;
}
@Override
public List<String> listOpenGroupChatDK(String enterpriseId, String staffId) {
return this.groupChatMapper.listOpenGroupChatDK(enterpriseId,staffId);
}
}
package com.gic.haoban.manage.service.util;
import com.gic.commons.switcher.Switcher;
import com.gic.commons.switcher.SwitcherNamespace;
@SwitcherNamespace("BUZ.qywx.open")
public class CustomSwitcher {
/**
* 积分触不通知会员名单
*/
@Switcher
public static String qywx_open_host ;
}
\ No newline at end of file
package com.gic.haoban.manage.service.util;
import com.alibaba.fastjson.JSONObject;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.GlobalVar;
import com.gic.commons.util.HttpClient;
import com.gic.haoban.manage.service.pojo.QwOpenResultBO;
import com.gic.haoban.manage.service.pojo.QwOpenResultInitBO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* https://www.showdoc.com.cn/1889765213630885/8704551724545128 密码:147258
*/
public class OpenUtils {
private static Logger logger = LogManager.getLogger(OpenUtils.class);
private static final String gicCallbackHost = GlobalVar.ctxPropertiesMap.get("haoban_service_host") + "/haoban-manage3-operation-web/qywx-msg-notice";
private static String getHost() {
return CustomSwitcher.qywx_open_host ;
}
public static ServiceResponse<QwOpenResultInitBO> init(Long qwUserId, boolean qrcodeFlag) {
JSONObject initJson = new JSONObject();
if (null != qwUserId) {
initJson.put("vid", qwUserId);
}
String initStr = HttpClient.sendPostJSON(String.format(getHost(), "init"), initJson.toJSONString(), "utf-8");
logger.info("企微初始化,req={},{}", initJson.toJSONString(), initStr);
QwOpenResultBO initResult = result(initStr);
if (!initResult.isOk()) {
return ServiceResponse.failure("9999", initResult.getErrmsg());
}
QwOpenResultInitBO initBO = JSONObject.parseObject(initResult.getData().toString(), QwOpenResultInitBO.class);
String uuid = initBO.getUuid();
// 设置回调
setCallback(uuid);
if (initBO.isIs_login()) {
logger.info("客户端是登录中的={}", qwUserId);
return ServiceResponse.success(initBO);
}
if (qrcodeFlag) {
// 获取二维码
ServiceResponse<QwOpenResultInitBO> response = getQrcode(uuid, initBO, 1);
if (!response.isSuccess()) {
return response;
}
}
return ServiceResponse.success(initBO);
}
public static ServiceResponse<Void> checkCode(String uuid, String qrcodeKey, String validCode) {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
json.put("qrcodeKey", qrcodeKey);
json.put("code", validCode);
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "CheckCode"), json.toJSONString(), "utf-8");
logger.info("校验验证码={},uuid={}", backJson, uuid);
QwOpenResultBO bo = result(backJson);
if (!bo.isOk()) {
return ServiceResponse.failure("9999", bo.getErrmsg());
}
return ServiceResponse.success();
}
public static void logout(String uuid) {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "LoginOut"), json.toJSONString(), "utf-8");
logger.info("退出={},uuid={}", backJson, uuid);
}
private static void setCallback(String uuid) {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
json.put("url", gicCallbackHost);
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "SetCallbackUrl"), json.toJSONString(), "utf-8");
logger.info("设置回调={},uuid={}", backJson, uuid);
}
public static ServiceResponse<QwOpenResultInitBO> getQrcode(String uuid, QwOpenResultInitBO initBO, int times) {
String req = "getQrCode";
if (times == 2) {
req = "SecondaryValidation";
}
JSONObject json = new JSONObject();
json.put("uuid", uuid);
String backJson = HttpClient.sendPostJSON(String.format(getHost(), req), json.toJSONString(), "utf-8");
logger.info("获取qrcode={},uuid={},times={}", backJson, uuid, times);
QwOpenResultBO initResult = result(backJson);
if (!initResult.isOk()) {
return ServiceResponse.failure("9999", initResult.getErrmsg());
}
QwOpenResultInitBO backBO = JSONObject.parseObject(initResult.getData().toString(), QwOpenResultInitBO.class);
if (null == initBO) {
return ServiceResponse.success(backBO);
}
initBO.setQrcode(backBO.getQrcode());
initBO.setKey(backBO.getKey());
initBO.setQrcode_data(backBO.getQrcode_data());
return ServiceResponse.success(initBO);
}
private static QwOpenResultBO result(String json) {
QwOpenResultBO bo = JSONObject.parseObject(json, QwOpenResultBO.class);
return bo;
}
/**
* 自动登录
*
* @param uuid
*/
public static boolean autoLogin(String uuid) {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "automaticLogin"), json.toJSONString(), "utf-8");
logger.info("自动登录={},uuid={}", backJson, uuid);
JSONObject resultJson = JSONObject.parseObject(backJson);
int errcode = resultJson.getIntValue("errcode");
if (errcode == 0) {
logger.info("自动登录成功={}");
return true;
}
return false;
}
/**
* 判断账号是否登录中
*
* @param uuid
* @return
*/
public static boolean isLogin(String uuid) {
JSONObject json = new JSONObject();
json.put("uuid", uuid);
String backJson = HttpClient.sendPostJSON(String.format(getHost(), "GetProfile"), json.toJSONString(), "utf-8");
logger.info("获取当前账号详情={},uuid={}", backJson, uuid);
JSONObject resultJson = JSONObject.parseObject(backJson);
int errcode = resultJson.getIntValue("errcode");
if (errcode == 500 && resultJson.getString("errmsg").contains("实例不存在")) {
return false;
}
return true;
}
}
package com.gic.haoban.manage.service.util;
import com.gic.commons.switcher.SwitcherApplication;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import java.util.concurrent.atomic.AtomicBoolean;
@Component
public class SwitcherInitialization implements InitializingBean {
static AtomicBoolean INIT = new AtomicBoolean(false);
@Override
public void afterPropertiesSet() throws Exception {
SwitcherApplication.init(CustomSwitcher.class);
}
}
\ No newline at end of file
......@@ -218,7 +218,9 @@
ref="interactRecordApiService" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.content.MallOrderStatusChangeApiService"
ref="mallOrderStatusChangeApiService" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.OpenStaffApiService"
ref="openStaffApiService" timeout="10000" />
<dubbo:reference interface="com.gic.haoban.task.manage.api.service.OpenQwApiService" id="openQwApiService"/>
<dubbo:reference interface="com.gic.store.goods.service.GoodsInfoOutApiService" id="goodsInfoOutApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.store.goods.service.GoodsCenterApiService" id="goodsCenterApiService" timeout="10000" retries="0" check="false"/>
<dubbo:reference interface="com.gic.business.order.service.ordermanage.OrderInfoOutApiService" id="orderInfoOutApiService" timeout="10000" retries="0" check="false"/>
......@@ -237,4 +239,5 @@
<dubbo:reference interface="com.gic.content.api.service.ContentSettingApiService" id="contentSettingApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.clerk.api.service.MenuApiService" id="menuApiService" timeout="10000" retries="0" check="false" />
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabOpenStaff">
<id column="open_staff_id" javaType="long" jdbcType="BIGINT" property="openStaffId"/>
<result column="wx_enterprise_id" javaType="String" jdbcType="CHAR" property="wxEnterpriseId"/>
<result column="enterprise_id" property="enterpriseId"/>
<result column="staff_id" javaType="String" jdbcType="CHAR" property="staffId"/>
<result column="create_time" javaType="java.util.Date" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" javaType="java.util.Date" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="uuid" javaType="String" jdbcType="VARCHAR" property="uuid"/>
<result column="delete_flag" javaType="int" jdbcType="INTEGER" property="deleteFlag"/>
<result column="status_flag" javaType="int" jdbcType="INTEGER" property="statusFlag"/>
<result column="step" javaType="int" jdbcType="INTEGER" property="step"/>
<result column="qw_user_id" javaType="long" jdbcType="BIGINT" property="qwUserId"/>
<result column="wx_corp_id" javaType="long" jdbcType="BIGINT" property="wxCorpId"/>
<result column="qr_code_1" javaType="String" jdbcType="VARCHAR" property="qrCode1"/>
<result column="key_1" javaType="String" jdbcType="VARCHAR" property="key1"/>
<result column="qr_code_2" javaType="String" jdbcType="VARCHAR" property="qrCode2"/>
<result column="key_2" javaType="String" jdbcType="VARCHAR" property="key2"/>
<result column="valid_flag" javaType="int" jdbcType="INTEGER" property="validFlag"/>
<result column="auth_time" javaType="java.util.Date" jdbcType="TIMESTAMP" property="authTime"/>
<result column="first_auth_time" javaType="java.util.Date" jdbcType="TIMESTAMP" property="firstAuthTime"/>
<result column="valid_qrcode_flag" property="validQrcodeFlag"/>
<result column="login_remark" property="loginRemark" />
<result column="add_stop_time" property="addStopTime" />
<result column="del_stop_time" property="delStopTime" />
</resultMap>
<sql id="Base_Column_List">
open_staff_id
, wx_enterprise_id,enterprise_id, staff_id, create_time, update_time, uuid, delete_flag,status_flag, step, qw_user_id, wx_corp_id, qr_code_1, key_1,
qr_code_2, key_2, valid_flag, auth_time,first_auth_time , valid_qrcode_flag , login_remark , add_stop_time , del_stop_time
</sql>
<insert id="insert" parameterType="com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper">
<![CDATA[
INSERT INTO tab_haoban_open_staff(open_staff_id, wx_enterprise_id, staff_id, create_time, update_time, uuid,
delete_flag, status_flag, step, qw_user_id, wx_corp_id, qr_code_1, key_1,
qr_code_2, key_2, valid_flag, auth_time, first_auth_time, enterprise_id,
valid_qrcode_flag)
VALUES (#{openStaffId,jdbcType=BIGINT}, #{wxEnterpriseId,jdbcType=CHAR}, #{staffId,jdbcType=CHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{uuid,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER},
#{step,jdbcType=INTEGER}, #{qwUserId,jdbcType=BIGINT}, #{wxCorpId,jdbcType=BIGINT},
#{qrCode1,jdbcType=VARCHAR},
#{key1,jdbcType=VARCHAR}, #{qrCode2,jdbcType=VARCHAR}, #{key2,jdbcType=VARCHAR},
#{validFlag,jdbcType=INTEGER},
#{authTime,jdbcType=TIMESTAMP}, #{firstAuthTime,jdbcType=TIMESTAMP}, #{enterpriseId},
#{validQrcodeFlag})
]]>
</insert>
<update id="update" parameterType="com.gic.haoban.manage.service.entity.TabOpenStaff">
update tab_haoban_open_staff set uuid = #{uuid} , status_flag=#{statusFlag},
step=#{step}, qr_code_1=#{qrCode1}, key_1=#{key1}, qr_code_2=#{qrCode2}, key_2=#{key2}, valid_flag=#{validFlag},
valid_qrcode_flag = #{validQrcodeFlag} ,
<if test="null != qwUserId">
qw_user_id=#{qwUserId,jdbcType=BIGINT},
</if>
<if test="null != wxCorpId">
wx_corp_id=#{wxCorpId,jdbcType=BIGINT},
</if>
<if test="null != authTime">
auth_time=#{authTime,jdbcType=TIMESTAMP},
</if>
<if test="null != firstAuthTime">
first_auth_time=#{firstAuthTime} ,
</if>
<if test="null != loginRemark">
login_remark = #{loginRemark} ,
</if>
update_time=now()
where open_staff_id = #{openStaffId}
</update>
<update id="updateValidFlag">
update tab_haoban_open_staff
set valid_flag = 1
where uuid = #{uuid}
</update>
<update id="update2QrcodeFlag">
update tab_haoban_open_staff
set valid_qrcode_flag = 1
where open_staff_id = #{id}
</update>
<update id="update2Qrcode">
update tab_haoban_open_staff
set qr_code_2 = #{qrCode},
key_2 = #{key}
where open_staff_id = #{id}
</update>
<update id="updateLoginStep">
update tab_haoban_open_staff
set step = #{step}
where open_staff_id = #{id}
</update>
<update id="updateStopTime">
update tab_haoban_open_staff set
<if test="type==1">
add_stop_time = #{time}
</if>
<if test="type==2">
del_stop_time = #{time}
</if>
where open_staff_id = #{id}
</update>
<update id="updateByAutoLogin">
update tab_haoban_open_staff set uuid=#{uuid} , login_remark = '自动登录成功' where open_staff_id = #{id}
</update>
<delete id="deleteByPrimaryKey">
update tab_haoban_open_staff
set delete_flag = 1,
update_time =now()
where open_staff_id = #{id}
</delete>
<select id="getByStaffId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_open_staff where staff_id = #{staffId} and delete_flag = 0
</select>
<select id="getById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_open_staff where open_staff_id = #{id} and delete_flag = 0
</select>
<select id="getByUUID" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_open_staff where uuid = #{uuid} and delete_flag = 0
</select>
<select id="list" resultType="com.gic.haoban.manage.api.dto.OpenStaffListDTO" parameterType="com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO">
select a.open_staff_id openStaffId ,
a.wx_enterprise_id wxEnterpriseId ,
a.enterprise_id enterpriseId ,
a.staff_id staffId ,
a.create_time createTime ,
a.update_time updateTime ,
a.uuid uuid ,
a.delete_flag deleteFlag ,
a.status_flag statusFlag ,
a.step step ,
a.qw_user_id qwUserId ,
a.wx_corp_id wxCorpId ,
a.qr_code_1 qrCode1 ,
a.key_1 key1 ,
a.qr_code_2 qrCode2 ,
a.key_2 key2 ,
a.valid_flag validFlag ,
a.auth_time authTime ,
a.first_auth_time firstAuthTime ,
a.valid_qrcode_flag validQrcodeFlag ,
a.login_remark loginRemark ,
b.staff_name staffName ,
b.wx_user_id wxUserId ,
b.wx_open_user_id wxOpenUserId
from tab_haoban_open_staff a left JOIN tab_haoban_staff b on a.staff_id = b.staff_id
where a.wx_enterprise_id = #{wxEnterpriseId} and a.enterprise_id=#{enterpriseId}
<if test="status==1">
and a.status_flag = 1
</if>
<if test="status==2">
and a.status_flag = 2 and a.first_auth_time is not null
</if>
<if test="status==3">
and a.status_flag = 2 and a.valid_qrcode_flag = 1
</if>
<if test="status==4">
and a.status_flag = 2 and a.first_auth_time is null
</if>
<if test="staffParams != null and staffParams != ''">
and (b.staff_name like CONCAT('%',#{staffParams},'%') or b.wx_user_id like CONCAT('%',#{staffParams},'%') or b.wx_open_user_id like CONCAT('%',#{staffParams},'%') )
</if>
<if test="null != startDate">
and a.create_time <![CDATA[>=]]> #{startDate}
</if>
<if test="null != endDate">
and a.create_time <![CDATA[<=]]> #{endDate}
</if>
<if test="staffIds != null and staffIds.size >0">
and a.staff_id IN
<foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
and delete_flag = 0
order by a.create_time desc
</select>
<select id="getByQwUserId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_open_staff where qw_user_id = #{qwUserId} and delete_flag = 0
</select>
<select id="listAllStaffId" resultType="java.lang.String">
select staff_id from tab_haoban_open_staff where wx_enterprise_id = #{wxEnterpriseId} and delete_flag = 0
</select>
<select id="listOpenStaffByClerk" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select a.staff_id staffId , b.clerk_id clerkId , b.store_id storeId from tab_haoban_open_staff a left join tab_haoban_staff_clerk_relation b
on a.staff_id = b.staff_id and b.status_flag = 1
where a.wx_enterprise_id = #{wxEnterpriseId} and a.enterprise_id = #{enterpriseId} and a.status_flag = 1
and b.clerk_id in
<foreach collection="list" index="idex" item="item" separator="," close=")" open="(">
#{item}
</foreach>
and a.delete_flag = 0
</select>
<select id="listOpenStaffByStore" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select a.staff_id staffId , b.clerk_id clerkId , b.store_id storeId from tab_haoban_open_staff a left join tab_haoban_staff_clerk_relation b
on a.staff_id = b.staff_id and b.status_flag = 1
where a.wx_enterprise_id = #{wxEnterpriseId} and a.enterprise_id = #{enterpriseId} and a.status_flag = 1
and b.store_id in
<foreach collection="list" index="idex" item="item" separator="," close=")" open="(">
#{item}
</foreach>
and a.delete_flag = 0
</select>
<select id="listAllOnline" resultMap="BaseResultMap">
select <include refid="Base_Column_List" /> from tab_haoban_open_staff where
status_flag = 1 and delete_flag = 0
<if test="null !=wxEnterpriseId">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="null !=enterpriseId">
and enterprise_id=#{enterpriseId}
</if>
</select>
<select id="listAllOnlineEnterprise" resultMap="BaseResultMap">
select wx_enterprise_id,enterprise_id from tab_haoban_open_staff where
status_flag = 1 and delete_flag = 0 group by wx_enterprise_id , enterprise_id
</select>
<select id="listOpenStoreId" resultType="java.lang.String">
select a.store_id from tab_haoban_staff_clerk_relation a left join tab_haoban_open_staff b on a.staff_id = b.staff_id
where a.wx_enterprise_id = #{wxEnterpriseId} and a.enterprise_id=#{enterpriseId} and a.status_flag = 1
and b.status_flag = 1 and b.delete_flag = 0
</select>
<select id="getNum" resultType="java.lang.Integer">
select count(*) from tab_haoban_open_staff where wx_enterprise_id = #{wxEnterpriseId} and enterprise_id=#{enterpriseId}
<if test="status==1">
and status_flag = 1
</if>
and delete_flag = 0
</select>
</mapper>
\ No newline at end of file
......@@ -933,6 +933,12 @@
and half_del_time is null limit 1000
</select>
<select id="getDelFriend" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from tab_haoban_external_clerk_related
where wx_enterprise_id = #{wxEnterpriseId} and status_flag in (1,3,4) and external_status = 3
and staff_id =#{staffId} and enterprise_id=#{enterpriseId} limit 1
</select>
<update id="updateHalfTime">
update tab_haoban_external_clerk_related set
half_del_time = #{delTime}
......
......@@ -443,7 +443,7 @@
select
staff_id staffId,
enterprise_id enterpriseId ,
clerk_id clerkId
clerk_id clerkId , store_id storeId
from tab_haoban_staff_clerk_relation
WHERE
wx_enterprise_id = #{wxEnterpriseId}
......@@ -491,4 +491,20 @@
select <include refid="Base_Column_List"/> from tab_haoban_staff_clerk_relation where staff_id =#{staffId} order by update_time desc
</select>
<select id="listAllStaffIdForOpenStaff" resultType="java.lang.String">
select a.staff_id
from tab_haoban_staff_clerk_relation a left join tab_haoban_staff b on b.staff_id = a.staff_id
where a.enterprise_id = #{enterpriseId} and a.status_flag=1 and b.status_flag = 1 and a.wx_enterprise_id = #{wxEnterpriseId}
<if test="null != clerkId and clerkId != '' ">
and a.clerk_id = #{clerkId}
</if>
<if test="null != storeIdList">
AND a.store_id in
<foreach collection="storeIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
GROUP BY a.staff_id
</select>
</mapper>
\ No newline at end of file
......@@ -603,4 +603,9 @@
and callback_flag = #{callbackFlag}
</select>
<select id="getWxEnterpriseIdByName" resultType="java.lang.String">
select wx_enterprise_id from tab_haoban_wx_enterprise where corp_name = #{corpName} and status_flag = 1 and wx_security_type > 0
</select>
</mapper>
\ No newline at end of file
......@@ -365,4 +365,8 @@
select wx_enterprise_id wxEnterpriseId , staff_id staffId FROM tab_haoban_group_chat WHERE update_time > DATE_ADD(NOW(),INTERVAL -7 DAY) AND chat_status = 1 and staff_id is not null
</select>
<select id="listOpenGroupChatDK" resultType="java.lang.String">
select wx_chat_id_dk from tab_haoban_group_chat where enterprise_id=#{enterpriseId} and staff_id = #{staffId} and delete_flag=0 and chat_status != 4 and wx_chat_id_dk is not null
</select>
</mapper>
\ No newline at end of file
......@@ -310,4 +310,9 @@
and user_quit_time <![CDATA[<=]]> #{end} and status_flag = 2 group by quit_staff_id
</select>
<select id="getGroupUserInfo" resultMap="result-map-tabHaobanGroupChatUser">
select <include refid="Base_Column_List"/> from tab_haoban_group_chat_user where group_chat_id = #{groupChatId} and user_id = #{userId}
and delete_flag = 0 and status_flag = 1 limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -106,7 +106,7 @@
create_time,
update_time,
add_time,
all_del_flag , qw_add_time , friend_clerk_id , friend_store_id)
all_del_flag , qw_add_time , friend_clerk_id , friend_store_id , del_type )
VALUES (#{logId,jdbcType=BIGINT},
#{wxEnterpriseId,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=CHAR},
......@@ -138,7 +138,7 @@
now(),
now(),
now(),
#{allDelFlag,jdbcType=INTEGER} , #{qwAddTime} , #{friendClerkId} , #{friendStoreId})
#{allDelFlag,jdbcType=INTEGER} , #{qwAddTime} , #{friendClerkId} , #{friendStoreId} , #{delType})
]]>
</insert>
......
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.lang3.StringUtils;
public class FileUtils {
public static void main(String[] args) {
System.out.println(JSONArray.parseArray(getText().toString()));
}
public static StringBuilder getText(){
StringBuilder list = new StringBuilder() ;
return list ;
}
}
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import org.apache.commons.lang3.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.crypto.SecureUtil;
public class FileUtils2 {
public static void main(String[] args) {
System.out.println(SecureUtil.md5("2af5e413ec4e44c29b4bab61021071ba" + "wmNYNmCgAA7AohTQh62UPdSKyr3m9bIg"));
/*String s = getText();
JSONArray jsonArr = JSONObject.parseObject(s).getJSONArray("value");
System.out.println(JSON.toJSONString(jsonArr));*/
}
public static String getText(){
try {
BufferedReader bw = new BufferedReader(new FileReader(new File("c:\\b.txt"))) ;
StringBuilder sb = new StringBuilder() ;
while(true) {
String s = bw.readLine() ;
if(StringUtils.isBlank(s)) {
break ;
}else {
String ss = new String(s.getBytes(),"UTF-8") ;
sb.append(ss) ;
}
}
bw.close();
return sb.toString() ;
}catch(Exception e) {
}
return null ;
}
}
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
public class FileUtils3 {
public static void main(String[] args) {
System.out.println(getText().get(0));
}
public static List<String> getText(){
List<String> list = new ArrayList<>();
try {
BufferedReader bw = new BufferedReader(new FileReader(new File("c:\\b.txt"))) ;
StringBuilder sb = new StringBuilder() ;
while(true) {
String s = bw.readLine() ;
if(StringUtils.isBlank(s)) {
break ;
}else {
String ss = new String(s.getBytes(),"UTF-8") ;
list.add(ss) ;
}
}
bw.close();
}catch(Exception e) {
}
return list ;
}
}
import org.apache.commons.lang3.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
public class FileUtils4 {
public static String getText(){
try {
BufferedReader bw = new BufferedReader(new FileReader(new File("c:\\c.txt"))) ;
StringBuilder sb = new StringBuilder() ;
while(true) {
String s = bw.readLine() ;
if(StringUtils.isBlank(s)) {
break ;
}else {
String ss = new String(s.getBytes(),"UTF-8") ;
sb.append(ss) ;
}
}
bw.close();
return sb.toString() ;
}catch(Exception e) {
}
return null ;
}
}
import com.gic.api.base.commons.BasePageInfo;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import com.gic.haoban.manage.api.service.notify.NoticeMessageApiService;
import com.gic.haoban.manage.api.service.role.HaobanRoleApiService;
import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.service.OpenStaffService;
import com.gic.weimob.common.Md5Util;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class HalfFriendTest {
@Autowired
private OpenStaffService openStaffService ;
@Autowired
private NoticeMessageApiService noticeMessageApiService ;
@Test
public void tt() {
Map<String,String> map = new HashMap<>() ;
map.put("accountName","111222333111K") ;
map.put("errorTime","2024年4月20日 22:22") ;
map.put("reason","异常断开") ;
this.noticeMessageApiService.sendMessageForOpenStaff("ff8080815dacd3a2015dacd3ef5c0000","xgh","首次托管,需要二次验证");
/*OpenStaffPageQDTO qdto = new OpenStaffPageQDTO() ;
qdto.setWxEnterpriseId("ca66a01b79474c40b3e7c7f93daf1a3b");
qdto.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
qdto.setClerkId("b2ef17cce11f476b996d0b27ebadf7fb");
qdto.setStoreGroupIdList(Arrays.asList("ff8080815dacd3a2015dacd3f4fc0033"));
qdto.setStaffParams("徐高华");
BasePageInfo basePageInfo = new BasePageInfo() ;
basePageInfo.setPageSize(11);
basePageInfo.setPageNum(1);
this.openStaffService.page(qdto,basePageInfo) ;*/
int messageType = NoticeMessageTypeEnum.HAOBAN_OPEN_STAFF_LOGOUT.getType();
// NoticeMessageUtil.sendNoticeMessageByStaff("ff8080815dacd3a2015dacd3ef5c0000","52995ea8c81c4cc286a9b82bc36a7081","-1",messageType,null,map,null);
}
}
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Arrays;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class HalfFriendTest123 {
@Autowired
private HaobanTimerApiService haobanTimerApiService ;
@Test
public void tt() {
List<String> list = Arrays.asList("27f6a5b4ed474c7889f9f35efdd90acb",
"c2a7904f682343efb9bc1cae026888a3",
"8477c149d8774f06ab841f042645832b") ;
for (String s : list) {
this.haobanTimerApiService.halfTimer(s);
}
}
}
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Arrays;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class HalfFriendTest333 {
@Autowired
private HaobanTimerApiService haobanTimerApiService ;
@Test
public void tt() {
List<String> list = Arrays.asList("93416e3a92504683b5b13513477a840a","369038a3568b46a6898d635843b73dc6","7f8c0c0eedd546ed9c4b355bb9cc2f31","9a7a89d2d1534c47980ea0886a202d3c") ;
for (String s : list) {
this.haobanTimerApiService.halfTimer(s);
}
}
}
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Arrays;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class HalfFriendTest444 {
@Autowired
private HaobanTimerApiService haobanTimerApiService ;
@Test
public void tt() {
List<String> list = Arrays.asList(
"727f05dbe66d48009719f63a189b9965",
"31060eb76d7a42969516c7ff12f9a1ea",
"703207906c5942b0937f8eda35036e9b",
"7a11c347030342eba50d188b96b646c0") ;
for (String s : list) {
this.haobanTimerApiService.halfTimer(s);
}
}
}
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Arrays;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class HalfFriendTest55 {
@Autowired
private HaobanTimerApiService haobanTimerApiService ;
@Test
public void tt() {
List<String> list = Arrays.asList(
"a0e2b8466e554aa88fa25e6f3757aa06",
"a253a78e2f1349fb9e8727015e48cd2b",
"d672eda301b2499a899902a02e55041c",
"626a8fd134ea4b91a83d472e0aba4081",
"9b5eda19379f412eaf1c55477910b792",
"2834fc85368847fd9c9614993a7a31a0",
"16e40d9a63814668873e36fa3bdd2d2a",
"e03b7089bfbf46cba60479f147adf6eb",
"2fdb7927db174a8e9d68c975538364d5",
"ac451a350eed4a96958dd5c7377f8bd9",
"89fd6ad36b3f4d0f9b06c856e4d91441",
"e0e12e08d62b47ac823b7d8d99fb9495",
"7c140f63c6c14acab2eac5290ed0c59d",
"c05df62cd6f844cea55778321c5552e5",
"784b6d7711664b278d7d73f92940958f",
"8bb1442e0f5943989cf9e5513acb1f03",
"f47cf73c887c444a909eb60feac0e6b2",
"cd688b9b915b4c4d81a967abf5ce2399",
"c50a57f2a59042e9aa4ff8361f2d61f7",
"f04df76f35a14d819fc7192d8d75d33a",
"2e5db471800b4c529e52dc4f98f6651a",
"9aad8308f8524b6cac451519f6d65792",
"5fff1b5ff62149f8bad5b10b141bcc6b",
"4e801e4b9cd4489389a4c12c30b5595f",
"8af6367375d643f4adf0bd255349d52a",
"abcd03d17eb349d491b983b09d678a4a",
"1dac964159694e4d9a8f03a3e6d65d75",
"46a4b60dea4b4b83a6ff81108c1d0d17",
"bf0f8b4351754819984ce12fbc3a8a4f",
"9900848270d6422c891c8b674c729a04",
"4119c628c1ab42da9c7976f405a0d013",
"3807d1017a1544d3be888e6108494dd2",
"f079bd6c985a4b8296ce1ba5b7a4e41e",
"acbfeb379b5242d5b2e44ab50e1047a1",
"4b18675afa7e4dfaa7b9c66b11ca6474",
"1d1e13c75d314c1fb01b97f104baf74b",
"7d1a509a3ad94a9f8c001ead0394e199",
"0dd77eacc16d4499a7310d0d663a27f6",
"8ee3e7e1016142fba939460fb9098c08",
"e9254b614d6e43ffa7c74094be1f07f2",
"0e33e5b6c97b46d39d3502335f227fed",
"e125f933481749828eb3b8bf9bb03801",
"8824ef05d5394f7085cf909141ef6d4c",
"b4fa8b82902944778c740c7fc08fd7bc",
"6dccb1983a8e400987d8608fb63db7b1",
"1cc9bc27a7b5483f9191f1f930b15987",
"7df48a749ec1457594e85f80233ee4a3",
"d4210ec4393d4be9b75b79f7e4db4287",
"a238657d62c04ad2bb04b30d77552f6f",
"057b77b82e4349b59a8f6613c790b578",
"7d1e3ee9b5ed4751a9beb9193a263c8e",
"198413be4c614564acda9d05e1b845fd",
"2db544a8d44d429982d0fd1ad0cd81fe",
"7a6656b229db40b2b87719ad92dc6da9",
"213ee71a87184dddbbbceeb5b38fecde",
"eec55cf2133d48a6ab99292ca914798f",
"c44499b124c24b669c8185dce2001bcd",
"ee364e50f36b45c791b10568d61689f8",
"e34cf346f9ff4920ab186085f0f78527",
"8109cb858d174b7782280f61ec31f0a5",
"500f8256e232465da60adbe3a6e308fd",
"2eb11d95dc364ee79bef12a0a7c9048f",
"ab118565196540d9a0b6752b080c6a57",
"a8e33b39a1134fa28faf3090346ec298",
"3261f11ed58542ad903f753e4d7140f5",
"771859eba515470d80d7c99cad6de224",
"ec399cbc2b204863929070ae05ad373f",
"da15c53d69534f6db9238001fb7f4595",
"31ebe5173e6348718a525e8784b618cb",
"cad5cb747e154a1bb02ad13d1fc1cbbe",
"e78d7726ce75428aa16ad4a029ba2fbf",
"faf70a82e8db433ea58a3be12d6f31e0",
"47a76bacad474d95a8111756b7ba9b2d",
"d4d2ad3949314b93963c29a88bfcffae",
"ae8452c5ad8140e9ba39fd39a0452ea0",
"1e98842f50a545e8a74810f5685ac5c4",
"03921c5bcc8f471fbd341e0c1d532c4f",
"66d97c3272794dd79ff025bc48eadb00",
"3c881f84f5f743f2a03a79384e6a938a",
"e5b606108d294886a708555a080cf938",
"dace034955de48e89192e583379b36af",
"aec90d5293f949859f3cd05b86a561e3",
"3d2cb5eaa8744cb2ae9ea372a0cef9be",
"05b30f42a224488f9d064765b983e8cf",
"0051a2bbbfa442568d472e446244ddb6",
"4044dde9ad46432198452534f06ec6b5",
"58dc9f135c764e82a932a790bd0e519e",
"fbd75796d20541c2b998e6f36126b495",
"953299696d2b4eaebaeb52dd597d3f63",
"f550da66c436459ba4a7eb482aa63afb",
"9dd18b31dfa342e190d0001e764cd1a8",
"a899e618f5104813bf445a9e5175defb",
"e46d2eb33b4842c3b2348e5362353a3a",
"8d4a6f15b2684806956d8610db9e2578",
"ae6737b9ef234dc3be12922cdbe7a404",
"b6d49b95afa047c6a6f3009173a9c089",
"7515993f8afb46d6856c138f8236c372",
"3a86592d9c3f4aa39eb208eeb50dbbf3",
"ad6c4b35b4c54efabef8fde8ebf7d1ac",
"95d21303782e45cc99af09da5b819ab1",
"5f184bc85e614af6beb2e8f93b6809f4",
"b3fea34fe8ee435b87e9af61b34bb983",
"9698ba9e797b42b3ad924ba58b39f4c0",
"e72d6e4b44844abd95e7dc3a98c92628",
"cfc7dd59adf34dc88c4c714f55c40b53",
"4b954d56885d48c4a318d66f213006ef",
"f4e5c659e6f848749b8c25535263a8ad",
"028228f414164b5282755952f080ccfe",
"984fa35315b341e8894078d6aba930e3",
"28dacca98f804ad586b4fab4d89df91b",
"a9f344da556c4ef196fe7d19f3ec3a89",
"238f0503143441c189e791347daf2dd1",
"16c336c516fb42adb843d403f861cd0b",
"521edc4920bf43fa98caee105d297556",
"fcae29cc5d7d4739a353e777e5e77d82",
"edbc2a17e4e341999b625d2cd8d31b9b",
"692441406a9c41ce9e54afb495d1b536",
"d1bc85085ac34061a3be378ac3905279",
"2313e41b16d843ad8d45828f4b475643",
"de600085669b46149213f641c3768933",
"2cae93c93d594499be7afdef3999c187",
"bb55da16836540979dc83901b310ff7b",
"165d3fd1b452492f95f9c58380c344f3",
"c28402611777477780a29f237d4e7823",
"dcc57fbe466942fb9338e22c4f55a58d",
"376cece6904342b1a948b36c95ae8d3c",
"49896d89f00e45ee975100bdfba29c9e",
"59d8d6421d3044cfb1c87e15797219ca",
"0ee6d7931966427c9c12451ff9bb7f9a",
"d2c5f455738c4133a18f747c7b89382e",
"1d5a0540002049e997d7b71bc95029ba",
"05571082787c49498dd5facc9b97df3e",
"99cdf0fe5747447aa88e6249bce60a91",
"31a820018562417d9947f0f4771ddfc2",
"b516bdfeae5642b888a268f8e7de4e09",
"b585912573ce49d98e98b7ccc2c80292",
"1aad46766eae42c09de19ec5cedb004b",
"41203c07d05f494a82a633ed964d39d3",
"a833a4a4d3ee430b88847e427f5f548f",
"f299dee10f36493e821b192e25d2689a",
"207b879084324809be5810d70d287fd1",
"24d1ca5d21534ceaa8db841e10231681",
"faacb0a2dcad4db8909e1bbcf23f46bf",
"29369c6903fd4fedbf0dfb8260778765",
"7c0ecea6657a41f59da66a09f191705d",
"168fd30abe1d4bb683f7024331bf6d55",
"98857d4d88154249b3c17a7bde76127a",
"0a2e14b5535d490588314c288527ca12",
"6dd39faa087745d1bcd6de10b1175158",
"b18b5c361ae14528be9d4509c85bf378",
"1ccbf4b3646a4697969760bfe9879816",
"48348858663f4c4b8729cbf86919fb81",
"94080b033a204fbc8491b83b8ab1ebad",
"8d998a7656a148f0ac3eeff11339021f",
"b584cc828ca44594b83238ca7525c715",
"1d84dc1cd6ea43068c4640264fe9cf6c",
"771c4c6d5d9844ff85550f3764fe3741",
"bd833266bc0c40cdb34bd24a21a6f662",
"b724dd8c26684db4ba3993972c4f76ae",
"b0d73b83f534460ca6dc7f518f7745f1",
"aaeb11a19ebc49d0b9e05f4c6e0ee98e",
"b9bfccb9aacf47aab70871bf491bc80d",
"fb85fc977e1e462492307e868e7eef3d",
"0a265e8a78ce458989e32964d138da82",
"ac3ec79249a3495e92947c05034986a3",
"b9246e6d35854fb9816dcbf7f44a0e7e",
"a05c50e72a0945b9afe175d4ad3f258f",
"27ef74e052054cf3bccf15235abb0fb2",
"827041d9dd6a4a1a983585e590c93124",
"b95b164425204fe2baf1fa8cdb1be695",
"d7928daea8d344aaa5aa7b8d8debea04",
"8e4917cfd89b4170877db0dd186a2372",
"0e4819d814fc4c2698273a0f9e12ca24",
"e0e2e8c7f9a040759025b79094081640",
"68d1fa15838a4604a58af9c5dcff1a23",
"70ec36aa789f41ed9c8e11210e06fae2",
"0bd39f2386824e41a0a145cc4dcda29d",
"54bc94380dbe42d69feeeff7992da1f6",
"00ce3f9d57b041b3a8ab74cde731230b",
"29f5926b34c749c3a8b95739a963748d",
"64f807355a9f47378311466ad147b178",
"f7dea30408aa47a6aed0edcd801e1500",
"e0f02a8502a34be3b0003ab95b918359",
"d4516c84caf44742a4723e2ce84e6720",
"60dd1a7f176347ce993a2d0d5c7a3331",
"8167f2030c06456f91020f2ea62b231a",
"8e095672232f4a2a965606731b9f4b33",
"462995bc8bd44249a3abab182d583b4b",
"f7feddfa8a1e45e48468b8c618193a68",
"4ab90369954d4687b2f0e18ccd962ea2",
"2277c0c559bc4671bf2246905217136b",
"bf1df4c8e6314d4cab62a3f99eb6d942",
"533103b705d448f991edf24d2a244c10",
"94a8d2b32e4c494db3055cd39771e1d6",
"f482ab6f37d9401885acc7e7b07170ee",
"6c1b24df774d4b589629035de4c4ac34",
"d0f476b576ef4f84adb02486bad453eb",
"861e0e0d31ae477b9c3c5366b3f248f5",
"aff51a3b36e44beb9edc55a68de73f4d",
"b72b31ece29b4c6c984a1feefbe04665",
"cefee250b1e44d9ebbc13dac07bc8056",
"398fa1d1021c4ed6b40582d6c695a495",
"24e96b7c7a6e42a0bc26531aded9dde0",
"def740442c684ac18532a72f8eb15e31",
"457d80d1ac65483fb04d37fc4ef945a9",
"71ccfa9715f745d69d6c998ed02d7a05",
"23a5357cf9b94e808899e0bb7ac7309f",
"716fd0e5cc354cfd9cb1169d026d86db",
"9ac676478e6f44998a8b03f7b4791d0e",
"702a4ede9999412b917b15afd743c0a7",
"1221cea0a12840429a56d823489c4295",
"267c13c9a6f049bfacfc05b9419462a1",
"0e63727e35e14d69b86cd4e422a07663",
"66989aef012148af92869e3e833b9965",
"d734b9a19f52484db17fdee7ba4f1eda",
"b0bdf01506a346bf9ae64907082ced24",
"1debfbd39d4249ef9ccf6e2d5c1ee199",
"533a1ad1d4a1428fa3ea8a81a90ba975",
"939605cf70c5454692425ad99afd5259",
"18e66bd54f694399be7271befe2205bc",
"29b810cb1ad146e2a0bf9724c7f2b99e",
"249d8e02797b40fba8c38c88d01d2fcb",
"39fe8f2571594ea49c8e5ed18f88aafd",
"0cba15ff7ea84d60aeae3c9b2f50252a",
"40d1fab667f443b1b120373d01b31f2a",
"2d7d999184b74afdb1a421d79a67f1e0",
"6d1155b55c4147a1877f8a2d438b53fa",
"1382a56af61147e1917a78ef8e6cf000",
"4bb66817efe44cde8d5ca53fce61a1bd",
"c50dc2164f1e4a3b95dbfbc824278ce5",
"0fc1ef4f8f8f4f89bd09e9c5a9428961",
"25f358d8e8ad4feaa01d773fbbc30fef",
"f0301cf9ff34438baa168cc6b6ea7c13",
"45a039d8b56a4b78b4cd316b9485fc7a",
"602b72561d4d47aabf88897f754456f3",
"515b2222eea248f9b0c68864ab63bfb2",
"d0a9e3cd351e4c26a526082a8c210f03",
"7a11c347030342eba50d188b96b646c0",
"1ad8582021b148b8a1d30bf428afc84c",
"f88a91e0f38b4d819f4a352dc63e2f77",
"0abea1dfeb5a4b69999b397767766ff7",
"6f66f42fa55c4c27a63eb8cf07032a3d",
"ee4314d1f60546f38c7f51b97e2857d7",
"fd97e7eb254843d88f2d1493bed7c97d",
"e034e2bd5d0b44d3bf553c9f8204094c",
"25cda90a9530445ba5aa3e20155f930e",
"e8ed7566c9ef421895235b69b51d01fd",
"55902436994f4949a3f6e6b901510061",
"7c994af4c1724b2fa9a552c553b4da07",
"6404f37c4a4d4ab6ae20c9980575daa0",
"3a5f74cd7e254ae4a20c6aab4871ea30",
"3e98de1a1b61422f904f8128c71eab95",
"f1f32aea8eee4a15be09d8c755d906bc",
"513657bcaff3411b9a70200d4bce4826",
"0a19a96f7a7049c9aa4499a206512e94",
"0b149af4d61e4c2aaa2da768642f201b",
"f5492cd1489f4cbbb3934dca96fee20a",
"4a3b8f75ceee456cb6c7fa3ca645d587",
"d226a840168e435c9315b2e873ee73ad",
"a2537fd63e594221bfcdfaea9013c2a9",
"df254df0249f45bc9e4b1a4b4642e7a7",
"be71a7e3f725426f98dd8d58e4d2ec2e",
"8a3c64520eff477c8b1079bf528d8e9a",
"933f0b01d30742e88671dab2b45b50df",
"376884c2ef0842bab78a04445899b8ef",
"0243d0611e4742cbb79fe6015e594c4e",
"8dfe18d9077a4192bc6f76463052a8e3",
"dac3f98aa9d741d68d3d58f82c1abf05",
"1c5117d581724e3b88b8adedb0c5fa8d",
"91a7d4ce31e34163a7cd56d1487decb1",
"73e457a2ad364825b33c3212bba05128",
"ed93ec911008400c95d5f4193c050bbb",
"27c3a1376f0a4d93958cb61767f74772",
"232389f7ab2e4e529b6818ff0eeacd5c",
"5f72493993aa4ace92f6705156629669",
"fb40256db41142a196b21ccf03e58507",
"0147e8313a4547ac922231f12f9c556a",
"90456a871bf0410493fb33660f85cfc9",
"3226ba2b1e12464abae09a3d3adf8825",
"d41dc7d775f747aaa8e0b25e7d937b09",
"90d286dd72e34b8db5c92ad4045e38b4",
"9a2c0dadbaf24b97824a1d77bc86bf4d",
"f2b989f5dadb4f0091eabd3fd6397116",
"48d391befc8845368d79c6716c2aff4a",
"82f9dcb8378d4a06ae7124597a0eafde",
"fa41098cf7494eae875e3607a74bd677",
"09bcb860e59e4a0894db0db114ba0ec4",
"67608fa7be9649afb32705093179ac8b",
"6f279de1d6ff4769bebbad54189d1feb",
"bfb6977d8caf4b6baf44e464ab234d41",
"30f1875cc4e44a62b455da724a7497f7",
"0e163cb429b848c391a846e7363a1930",
"804de988ce48423584f0df6b52735fd9",
"85be128d963a4889a43a4efc2834fce5",
"67897dbb905d4720a4718a6c5539afa5",
"4483a850c6a94d248d81038f78c56eb8",
"b84b8f411cc445e983596589931fccd6",
"ef8607976407491fb5ff66611b1d57ea",
"1f29d6d940254005a805041a24684b1c",
"73858f5b9a1243bba2fb10c9c026fc34",
"8e4e3768c05048dfb286aca9e097c053",
"3b06ddfc9eed4e9ba4b7af13926402cc",
"a21fdabbde9a4245a8081bc02e96ab85",
"67346a682cc44ed09f983094a53c904b",
"8ec4350fbbba498789d78a757f4fd701",
"9b866258d1f24b44acf381b4df321ba8",
"d80500ce620642d7aee9aa526b5f8ae5",
"3e6813f9a13745beb743bc4f44629a80",
"c65be37e397d4f2fbd90b8e59b6b4e53",
"5c1a02dcd9b84bc2826a15513c92cc02",
"9a8d1aa99e8f478d8492d19053a84974",
"a8dabcc56bd0465f997c2ea3ade42864",
"bbf8e5d0aac64b0b982e3afd971b8ff0",
"2212298dd8ed40208f8bcfb1cf6932a7",
"c3ec4364f73c4959b84a6f01a9d806ef",
"6326baa3cb7a4ba6a9d75a85a2c07769",
"0069ccdd34cb4d4988786e012c2276f7",
"37331d01245d434896bc54bffc69dcf6",
"db6c58bc454c4a25bd0d8caed3c0959f",
"4e0506105a5e47f8913884c8a5059fd9",
"3b63712d97944996959b72c1df443491",
"2f33e0fe33924dd5866ec12821ec9ba3",
"ac7baaba195746f099bd7e10024f275d",
"ae362ff647154014ba6e376f6c57e045",
"fa88746dfe964acd8761d1de8ff7d139",
"37339f333a3a49f1bcc89e3b7999114a",
"1d6385d0541240ec93daea8930b63f37",
"6d52f722471343eeb7fbed87994cbdf8",
"0daeb2f5ceaf441f9b61d88ae80d1c7f",
"49800ac8431b420da8c82ae31dc96cbd",
"9648ba4ea629437e801794b6d06d97c0",
"14674e3df079419b867c8c9201b79097",
"b52cb724276e443ab07e8bfc8a3f24d9",
"b29a41a5518b45a6ace7e9703036c77d",
"13dea65945c84640a2560dd35b4a7ea9",
"b914c346d6344fd2a0fd68f7c5e24fe5",
"1dc6a4dca67f4711885d6058a722e743",
"0feac8068fef4736b03a57aeb0c03cb5",
"3c0b0cff087045e08c310005cc435ee0",
"b8e88fabdf0a4282b5b5ad641240e98f",
"c3e61531cf4f4d85a7e5ed7647f7520a",
"2310164457b4441db19548f0f3aeddc9",
"ffc6490b2a8144e4a8059fb604810987",
"c054c2bb07a04b6b83a3ecb1f1d2fea0",
"463045fde3ac4b4da2778b46f1c55155",
"28964c9168ec4e6bbc3aa072e3374b7e",
"d672389548dd4442b76f2aa07a1cb8b0",
"689c1cdf2d35435eb9065066bb41d028",
"902a34cf07784b08831cb490cfe6ce3f",
"12501f4b793343e6a5afd148112c5949",
"6d8130c450a74a498d773c4e2b46cb62",
"255903d9ba5c4aa1b7c5f81912dfbd37") ;
for (String s : list) {
this.haobanTimerApiService.halfTimer(s);
}
}
}
import com.gic.commons.util.CollectionUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import com.gic.haoban.manage.service.dao.mapper.role.TabHaobanRoleMapper;
import com.gic.haoban.manage.service.dao.mapper.role.TabHaobanRoleMenuMapper;
import com.gic.haoban.manage.service.entity.role.TabHaobanRole;
import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu;
import org.apache.commons.collections.CollectionUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class HaobanRoleTest {
@Autowired
private TabHaobanRoleMenuMapper haobanRoleMenuMapper ;
@Autowired
private TabHaobanRoleMapper haobanRoleMapper ;
@Test
public void tt() {
List<String> list = Arrays.asList("a0e2b8466e554aa88fa25e6f3757aa06",
"a253a78e2f1349fb9e8727015e48cd2b",
"d672eda301b2499a899902a02e55041c",
"626a8fd134ea4b91a83d472e0aba4081",
"9b5eda19379f412eaf1c55477910b792",
"2834fc85368847fd9c9614993a7a31a0",
"16e40d9a63814668873e36fa3bdd2d2a",
"e03b7089bfbf46cba60479f147adf6eb",
"2fdb7927db174a8e9d68c975538364d5",
"89fd6ad36b3f4d0f9b06c856e4d91441",
"e0e12e08d62b47ac823b7d8d99fb9495",
"7c140f63c6c14acab2eac5290ed0c59d",
"c05df62cd6f844cea55778321c5552e5",
"784b6d7711664b278d7d73f92940958f",
"8bb1442e0f5943989cf9e5513acb1f03",
"f47cf73c887c444a909eb60feac0e6b2",
"cd688b9b915b4c4d81a967abf5ce2399",
"c50a57f2a59042e9aa4ff8361f2d61f7",
"f04df76f35a14d819fc7192d8d75d33a",
"2e5db471800b4c529e52dc4f98f6651a",
"9aad8308f8524b6cac451519f6d65792",
"5fff1b5ff62149f8bad5b10b141bcc6b",
"4e801e4b9cd4489389a4c12c30b5595f",
"8af6367375d643f4adf0bd255349d52a",
"abcd03d17eb349d491b983b09d678a4a",
"1dac964159694e4d9a8f03a3e6d65d75",
"46a4b60dea4b4b83a6ff81108c1d0d17",
"bf0f8b4351754819984ce12fbc3a8a4f",
"9900848270d6422c891c8b674c729a04",
"4119c628c1ab42da9c7976f405a0d013",
"3807d1017a1544d3be888e6108494dd2",
"f079bd6c985a4b8296ce1ba5b7a4e41e",
"acbfeb379b5242d5b2e44ab50e1047a1",
"4b18675afa7e4dfaa7b9c66b11ca6474",
"1d1e13c75d314c1fb01b97f104baf74b",
"7d1a509a3ad94a9f8c001ead0394e199",
"0dd77eacc16d4499a7310d0d663a27f6",
"8ee3e7e1016142fba939460fb9098c08",
"e9254b614d6e43ffa7c74094be1f07f2",
"0e33e5b6c97b46d39d3502335f227fed",
"e125f933481749828eb3b8bf9bb03801",
"8824ef05d5394f7085cf909141ef6d4c",
"b4fa8b82902944778c740c7fc08fd7bc",
"6dccb1983a8e400987d8608fb63db7b1",
"7df48a749ec1457594e85f80233ee4a3",
"d4210ec4393d4be9b75b79f7e4db4287",
"a238657d62c04ad2bb04b30d77552f6f",
"057b77b82e4349b59a8f6613c790b578",
"7d1e3ee9b5ed4751a9beb9193a263c8e",
"198413be4c614564acda9d05e1b845fd",
"2db544a8d44d429982d0fd1ad0cd81fe",
"7a6656b229db40b2b87719ad92dc6da9",
"213ee71a87184dddbbbceeb5b38fecde",
"eec55cf2133d48a6ab99292ca914798f",
"c44499b124c24b669c8185dce2001bcd",
"ee364e50f36b45c791b10568d61689f8",
"e34cf346f9ff4920ab186085f0f78527",
"8109cb858d174b7782280f61ec31f0a5",
"500f8256e232465da60adbe3a6e308fd",
"2eb11d95dc364ee79bef12a0a7c9048f",
"ab118565196540d9a0b6752b080c6a57",
"a8e33b39a1134fa28faf3090346ec298",
"3261f11ed58542ad903f753e4d7140f5",
"771859eba515470d80d7c99cad6de224",
"ec399cbc2b204863929070ae05ad373f",
"da15c53d69534f6db9238001fb7f4595",
"31ebe5173e6348718a525e8784b618cb",
"cad5cb747e154a1bb02ad13d1fc1cbbe",
"e78d7726ce75428aa16ad4a029ba2fbf",
"faf70a82e8db433ea58a3be12d6f31e0",
"47a76bacad474d95a8111756b7ba9b2d",
"d4d2ad3949314b93963c29a88bfcffae",
"ae8452c5ad8140e9ba39fd39a0452ea0",
"1e98842f50a545e8a74810f5685ac5c4",
"03921c5bcc8f471fbd341e0c1d532c4f",
"66d97c3272794dd79ff025bc48eadb00",
"3c881f84f5f743f2a03a79384e6a938a",
"e5b606108d294886a708555a080cf938",
"dace034955de48e89192e583379b36af",
"aec90d5293f949859f3cd05b86a561e3",
"3d2cb5eaa8744cb2ae9ea372a0cef9be",
"05b30f42a224488f9d064765b983e8cf",
"0051a2bbbfa442568d472e446244ddb6",
"58dc9f135c764e82a932a790bd0e519e",
"fbd75796d20541c2b998e6f36126b495",
"953299696d2b4eaebaeb52dd597d3f63",
"f550da66c436459ba4a7eb482aa63afb",
"9dd18b31dfa342e190d0001e764cd1a8",
"a899e618f5104813bf445a9e5175defb",
"e46d2eb33b4842c3b2348e5362353a3a",
"8d4a6f15b2684806956d8610db9e2578",
"ae6737b9ef234dc3be12922cdbe7a404",
"b6d49b95afa047c6a6f3009173a9c089",
"7515993f8afb46d6856c138f8236c372",
"3a86592d9c3f4aa39eb208eeb50dbbf3",
"ad6c4b35b4c54efabef8fde8ebf7d1ac",
"95d21303782e45cc99af09da5b819ab1",
"5f184bc85e614af6beb2e8f93b6809f4",
"b3fea34fe8ee435b87e9af61b34bb983",
"9698ba9e797b42b3ad924ba58b39f4c0",
"e72d6e4b44844abd95e7dc3a98c92628",
"cfc7dd59adf34dc88c4c714f55c40b53",
"4b954d56885d48c4a318d66f213006ef",
"f4e5c659e6f848749b8c25535263a8ad",
"93416e3a92504683b5b13513477a840a",
"369038a3568b46a6898d635843b73dc6",
"028228f414164b5282755952f080ccfe",
"984fa35315b341e8894078d6aba930e3",
"28dacca98f804ad586b4fab4d89df91b",
"a9f344da556c4ef196fe7d19f3ec3a89",
"238f0503143441c189e791347daf2dd1",
"16c336c516fb42adb843d403f861cd0b",
"eef50d95636c4821869ac3315efac814",
"521edc4920bf43fa98caee105d297556",
"27f6a5b4ed474c7889f9f35efdd90acb",
"fcae29cc5d7d4739a353e777e5e77d82",
"edbc2a17e4e341999b625d2cd8d31b9b",
"692441406a9c41ce9e54afb495d1b536",
"d1bc85085ac34061a3be378ac3905279",
"de600085669b46149213f641c3768933",
"2cae93c93d594499be7afdef3999c187",
"bb55da16836540979dc83901b310ff7b",
"165d3fd1b452492f95f9c58380c344f3",
"c28402611777477780a29f237d4e7823",
"dcc57fbe466942fb9338e22c4f55a58d",
"376cece6904342b1a948b36c95ae8d3c",
"49896d89f00e45ee975100bdfba29c9e",
"59d8d6421d3044cfb1c87e15797219ca",
"0ee6d7931966427c9c12451ff9bb7f9a",
"d2c5f455738c4133a18f747c7b89382e",
"9a7a89d2d1534c47980ea0886a202d3c",
"1d5a0540002049e997d7b71bc95029ba",
"05571082787c49498dd5facc9b97df3e",
"99cdf0fe5747447aa88e6249bce60a91",
"31a820018562417d9947f0f4771ddfc2",
"b516bdfeae5642b888a268f8e7de4e09",
"b585912573ce49d98e98b7ccc2c80292",
"1aad46766eae42c09de19ec5cedb004b",
"41203c07d05f494a82a633ed964d39d3",
"6a2ec77394e54d448f7de350ae0737cc",
"a833a4a4d3ee430b88847e427f5f548f",
"7f8c0c0eedd546ed9c4b355bb9cc2f31",
"74394d101c40405a9303d0d3fedc178f",
"f299dee10f36493e821b192e25d2689a",
"207b879084324809be5810d70d287fd1",
"24d1ca5d21534ceaa8db841e10231681",
"faacb0a2dcad4db8909e1bbcf23f46bf",
"29369c6903fd4fedbf0dfb8260778765",
"7c0ecea6657a41f59da66a09f191705d",
"168fd30abe1d4bb683f7024331bf6d55",
"98857d4d88154249b3c17a7bde76127a",
"0a2e14b5535d490588314c288527ca12",
"6dd39faa087745d1bcd6de10b1175158",
"b18b5c361ae14528be9d4509c85bf378",
"1ccbf4b3646a4697969760bfe9879816",
"48348858663f4c4b8729cbf86919fb81",
"94080b033a204fbc8491b83b8ab1ebad",
"8d998a7656a148f0ac3eeff11339021f",
"b584cc828ca44594b83238ca7525c715",
"1d84dc1cd6ea43068c4640264fe9cf6c",
"771c4c6d5d9844ff85550f3764fe3741",
"bd833266bc0c40cdb34bd24a21a6f662",
"b724dd8c26684db4ba3993972c4f76ae",
"b0d73b83f534460ca6dc7f518f7745f1",
"aaeb11a19ebc49d0b9e05f4c6e0ee98e",
"b9bfccb9aacf47aab70871bf491bc80d",
"fb85fc977e1e462492307e868e7eef3d",
"0a265e8a78ce458989e32964d138da82",
"ac3ec79249a3495e92947c05034986a3",
"b9246e6d35854fb9816dcbf7f44a0e7e",
"a05c50e72a0945b9afe175d4ad3f258f",
"27ef74e052054cf3bccf15235abb0fb2",
"827041d9dd6a4a1a983585e590c93124",
"b95b164425204fe2baf1fa8cdb1be695",
"d7928daea8d344aaa5aa7b8d8debea04",
"8e4917cfd89b4170877db0dd186a2372",
"0e4819d814fc4c2698273a0f9e12ca24",
"e0e2e8c7f9a040759025b79094081640",
"b8f2f238e73844219d8c1ac563cec0db",
"68d1fa15838a4604a58af9c5dcff1a23",
"70ec36aa789f41ed9c8e11210e06fae2",
"0bd39f2386824e41a0a145cc4dcda29d",
"54bc94380dbe42d69feeeff7992da1f6",
"00ce3f9d57b041b3a8ab74cde731230b",
"29f5926b34c749c3a8b95739a963748d",
"64f807355a9f47378311466ad147b178",
"f7dea30408aa47a6aed0edcd801e1500",
"e0f02a8502a34be3b0003ab95b918359",
"d4516c84caf44742a4723e2ce84e6720",
"60dd1a7f176347ce993a2d0d5c7a3331",
"8167f2030c06456f91020f2ea62b231a",
"8e095672232f4a2a965606731b9f4b33",
"462995bc8bd44249a3abab182d583b4b",
"f7feddfa8a1e45e48468b8c618193a68",
"8477c149d8774f06ab841f042645832b",
"4ab90369954d4687b2f0e18ccd962ea2",
"2277c0c559bc4671bf2246905217136b",
"bf1df4c8e6314d4cab62a3f99eb6d942",
"533103b705d448f991edf24d2a244c10",
"94a8d2b32e4c494db3055cd39771e1d6",
"f482ab6f37d9401885acc7e7b07170ee",
"6c1b24df774d4b589629035de4c4ac34",
"d0f476b576ef4f84adb02486bad453eb",
"861e0e0d31ae477b9c3c5366b3f248f5",
"aff51a3b36e44beb9edc55a68de73f4d",
"b72b31ece29b4c6c984a1feefbe04665",
"cefee250b1e44d9ebbc13dac07bc8056",
"398fa1d1021c4ed6b40582d6c695a495",
"24e96b7c7a6e42a0bc26531aded9dde0",
"def740442c684ac18532a72f8eb15e31",
"457d80d1ac65483fb04d37fc4ef945a9",
"71ccfa9715f745d69d6c998ed02d7a05",
"23a5357cf9b94e808899e0bb7ac7309f",
"716fd0e5cc354cfd9cb1169d026d86db",
"9ac676478e6f44998a8b03f7b4791d0e",
"702a4ede9999412b917b15afd743c0a7",
"1221cea0a12840429a56d823489c4295",
"267c13c9a6f049bfacfc05b9419462a1",
"0e63727e35e14d69b86cd4e422a07663",
"66989aef012148af92869e3e833b9965",
"d734b9a19f52484db17fdee7ba4f1eda",
"31060eb76d7a42969516c7ff12f9a1ea",
"b0bdf01506a346bf9ae64907082ced24",
"1debfbd39d4249ef9ccf6e2d5c1ee199",
"533a1ad1d4a1428fa3ea8a81a90ba975",
"939605cf70c5454692425ad99afd5259",
"18e66bd54f694399be7271befe2205bc",
"29b810cb1ad146e2a0bf9724c7f2b99e",
"249d8e02797b40fba8c38c88d01d2fcb",
"39fe8f2571594ea49c8e5ed18f88aafd",
"0cba15ff7ea84d60aeae3c9b2f50252a",
"40d1fab667f443b1b120373d01b31f2a",
"2d7d999184b74afdb1a421d79a67f1e0",
"6d1155b55c4147a1877f8a2d438b53fa",
"1382a56af61147e1917a78ef8e6cf000",
"4bb66817efe44cde8d5ca53fce61a1bd",
"c50dc2164f1e4a3b95dbfbc824278ce5",
"0fc1ef4f8f8f4f89bd09e9c5a9428961",
"25f358d8e8ad4feaa01d773fbbc30fef",
"f0301cf9ff34438baa168cc6b6ea7c13",
"45a039d8b56a4b78b4cd316b9485fc7a",
"602b72561d4d47aabf88897f754456f3",
"515b2222eea248f9b0c68864ab63bfb2",
"d0a9e3cd351e4c26a526082a8c210f03",
"7a11c347030342eba50d188b96b646c0",
"1ad8582021b148b8a1d30bf428afc84c",
"f88a91e0f38b4d819f4a352dc63e2f77",
"0abea1dfeb5a4b69999b397767766ff7",
"6f66f42fa55c4c27a63eb8cf07032a3d",
"ee4314d1f60546f38c7f51b97e2857d7",
"fd97e7eb254843d88f2d1493bed7c97d",
"e034e2bd5d0b44d3bf553c9f8204094c",
"25cda90a9530445ba5aa3e20155f930e",
"e8ed7566c9ef421895235b69b51d01fd",
"55902436994f4949a3f6e6b901510061",
"7c994af4c1724b2fa9a552c553b4da07",
"6404f37c4a4d4ab6ae20c9980575daa0",
"3a5f74cd7e254ae4a20c6aab4871ea30",
"3e98de1a1b61422f904f8128c71eab95",
"f1f32aea8eee4a15be09d8c755d906bc",
"513657bcaff3411b9a70200d4bce4826",
"0a19a96f7a7049c9aa4499a206512e94",
"0b149af4d61e4c2aaa2da768642f201b",
"f5492cd1489f4cbbb3934dca96fee20a",
"4a3b8f75ceee456cb6c7fa3ca645d587",
"d226a840168e435c9315b2e873ee73ad",
"a2537fd63e594221bfcdfaea9013c2a9",
"df254df0249f45bc9e4b1a4b4642e7a7",
"be71a7e3f725426f98dd8d58e4d2ec2e",
"8a3c64520eff477c8b1079bf528d8e9a",
"933f0b01d30742e88671dab2b45b50df",
"376884c2ef0842bab78a04445899b8ef",
"0243d0611e4742cbb79fe6015e594c4e",
"8dfe18d9077a4192bc6f76463052a8e3",
"dac3f98aa9d741d68d3d58f82c1abf05",
"1c5117d581724e3b88b8adedb0c5fa8d",
"91a7d4ce31e34163a7cd56d1487decb1",
"73e457a2ad364825b33c3212bba05128",
"ed93ec911008400c95d5f4193c050bbb",
"27c3a1376f0a4d93958cb61767f74772",
"232389f7ab2e4e529b6818ff0eeacd5c",
"5f72493993aa4ace92f6705156629669",
"fb40256db41142a196b21ccf03e58507",
"0147e8313a4547ac922231f12f9c556a",
"90456a871bf0410493fb33660f85cfc9",
"3226ba2b1e12464abae09a3d3adf8825",
"d41dc7d775f747aaa8e0b25e7d937b09",
"90d286dd72e34b8db5c92ad4045e38b4",
"9a2c0dadbaf24b97824a1d77bc86bf4d",
"f2b989f5dadb4f0091eabd3fd6397116",
"48d391befc8845368d79c6716c2aff4a",
"82f9dcb8378d4a06ae7124597a0eafde",
"fa41098cf7494eae875e3607a74bd677",
"09bcb860e59e4a0894db0db114ba0ec4",
"67608fa7be9649afb32705093179ac8b",
"6f279de1d6ff4769bebbad54189d1feb",
"bfb6977d8caf4b6baf44e464ab234d41",
"30f1875cc4e44a62b455da724a7497f7",
"0e163cb429b848c391a846e7363a1930",
"804de988ce48423584f0df6b52735fd9",
"85be128d963a4889a43a4efc2834fce5",
"67897dbb905d4720a4718a6c5539afa5",
"703207906c5942b0937f8eda35036e9b",
"4483a850c6a94d248d81038f78c56eb8",
"727f05dbe66d48009719f63a189b9965",
"b84b8f411cc445e983596589931fccd6",
"ef8607976407491fb5ff66611b1d57ea",
"1f29d6d940254005a805041a24684b1c",
"73858f5b9a1243bba2fb10c9c026fc34",
"8e4e3768c05048dfb286aca9e097c053",
"3b06ddfc9eed4e9ba4b7af13926402cc",
"a21fdabbde9a4245a8081bc02e96ab85",
"67346a682cc44ed09f983094a53c904b",
"8ec4350fbbba498789d78a757f4fd701",
"9b866258d1f24b44acf381b4df321ba8",
"d80500ce620642d7aee9aa526b5f8ae5",
"3e6813f9a13745beb743bc4f44629a80",
"c65be37e397d4f2fbd90b8e59b6b4e53",
"5c1a02dcd9b84bc2826a15513c92cc02",
"9a8d1aa99e8f478d8492d19053a84974",
"a8dabcc56bd0465f997c2ea3ade42864",
"bbf8e5d0aac64b0b982e3afd971b8ff0",
"2212298dd8ed40208f8bcfb1cf6932a7",
"c3ec4364f73c4959b84a6f01a9d806ef",
"6326baa3cb7a4ba6a9d75a85a2c07769",
"0069ccdd34cb4d4988786e012c2276f7",
"37331d01245d434896bc54bffc69dcf6",
"db6c58bc454c4a25bd0d8caed3c0959f",
"c2a7904f682343efb9bc1cae026888a3",
"4e0506105a5e47f8913884c8a5059fd9",
"3b63712d97944996959b72c1df443491",
"2f33e0fe33924dd5866ec12821ec9ba3",
"ac7baaba195746f099bd7e10024f275d",
"ae362ff647154014ba6e376f6c57e045",
"fa88746dfe964acd8761d1de8ff7d139",
"37339f333a3a49f1bcc89e3b7999114a",
"1d6385d0541240ec93daea8930b63f37",
"6d52f722471343eeb7fbed87994cbdf8",
"0daeb2f5ceaf441f9b61d88ae80d1c7f",
"49800ac8431b420da8c82ae31dc96cbd",
"9648ba4ea629437e801794b6d06d97c0",
"14674e3df079419b867c8c9201b79097",
"b52cb724276e443ab07e8bfc8a3f24d9",
"b29a41a5518b45a6ace7e9703036c77d",
"13dea65945c84640a2560dd35b4a7ea9",
"b914c346d6344fd2a0fd68f7c5e24fe5",
"1dc6a4dca67f4711885d6058a722e743",
"0feac8068fef4736b03a57aeb0c03cb5",
"3c0b0cff087045e08c310005cc435ee0",
"b8e88fabdf0a4282b5b5ad641240e98f",
"c3e61531cf4f4d85a7e5ed7647f7520a",
"2310164457b4441db19548f0f3aeddc9",
"ffc6490b2a8144e4a8059fb604810987",
"c054c2bb07a04b6b83a3ecb1f1d2fea0",
"463045fde3ac4b4da2778b46f1c55155",
"28964c9168ec4e6bbc3aa072e3374b7e",
"d672389548dd4442b76f2aa07a1cb8b0",
"689c1cdf2d35435eb9065066bb41d028",
"902a34cf07784b08831cb490cfe6ce3f",
"12501f4b793343e6a5afd148112c5949",
"6d8130c450a74a498d773c4e2b46cb62") ;
for(int i=0;i<list.size();i++) {
this.add(list.get(i));
}
}
private void add(String wxEnterpriseId) {
List<TabHaobanRoleMenu> addList = new ArrayList<>() ;
List<TabHaobanRole> list = this.haobanRoleMapper.getListByWxEnterpriseId(wxEnterpriseId,1) ;
for(TabHaobanRole role : list) {
if(role.getClerkType()==0 || role.getClerkType()==1) {
TabHaobanRoleMenu m = new TabHaobanRoleMenu() ;
m.setRoleMenuId(UniqueIdUtils.uniqueLong());
m.setMenuCode("singleFriends");
m.setStatusFlag(1);
m.setCreateTime(new Date());
m.setUpdateTime(new Date());
m.setWxEnterpriseId(wxEnterpriseId);
m.setRoleId(role.getRoleId());
addList.add(m);
}
}
if(CollectionUtils.isNotEmpty(addList)) {
this.haobanRoleMenuMapper.insertBatch(addList);
}
}
}
import com.gic.haoban.manage.api.qdto.OpenStaffInitQDTO;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class QwOpenTest {
@Autowired
private OpenStaffApiService openStaffApiService ;
@Test
public void tt() {
OpenStaffInitQDTO s = new OpenStaffInitQDTO() ;
s.setStaffId("52995ea8c81c4cc286a9b82bc36a7081");
s.setWxEnterpriseId("ca66a01b79474c40b3e7c7f93daf1a3b");
s.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
this.openStaffApiService.init(s) ;
}
}
package log;
import lombok.Data;
import java.util.List;
@Data
public class EsResult {
private List<Hits> hits;
private String _scroll_id;
@Data
public static class Hits {
private List<Source> hits;
private Long total;
private Long totalNum;
}
@Data
public static class Total {
private Long value;
}
@Data
public static class Source {
private String _source;
}
@Data
public static class Message {
private String message;
}
}
package log;
import org.apache.http.impl.client.CloseableHttpClient;
/**
* 基于枚举的http单例
* @author jiaotianqi
* @date 2021/7/15 15:41
*/
public enum HttpClientEnum {
INITIALIZE;
private CloseableHttpClient httpClient = HttpClientInit.getHttpClient();
public CloseableHttpClient getHttpClient() {
return httpClient;
}
}
package log;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpRequest;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.HttpRequestRetryHandler;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.conn.HttpHostConnectException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.protocol.HttpContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLPeerUnverifiedException;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.concurrent.TimeUnit;
public class HttpClientInit {
/**
* 最大连接数
*/
public final static int MAX_TOTAL_CONNECTIONS = 1200;
/**
* 获取连接的最大等待时间
*/
public final static int WAIT_TIMEOUT = 30000;
/**
* 每个路由最大连接数
*/
public final static int MAX_ROUTE_CONNECTIONS = 400;
/**
* 连接超时时间
*/
public final static int CONNECT_TIMEOUT = 10000;
public static CloseableHttpClient getHttpClient() {
HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() {
@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
if (executionCount >= 3) {
// Do not retry if over max retry count
return false;
}
if (exception instanceof InterruptedIOException) {
// Timeout
return true;
}
if (exception instanceof UnknownHostException) {
// Unknown host
return false;
}
if (exception instanceof ConnectTimeoutException) {
return true;
}
if (exception instanceof SSLException) {
return true;
}
if (exception instanceof SSLPeerUnverifiedException) {
// SSL handshake exception
System.out.println("https证书异常");
return true;
}
if (exception instanceof SocketTimeoutException) {
// SSL handshake exception
System.out.println("socket超时异常");
return true;
}
if (exception instanceof NoHttpResponseException) {
// SSL handshake exception
System.out.println("http无响应异常");
return true;
}
if (exception instanceof HttpHostConnectException) {
// SSL handshake exception
System.out.println("http主机连接异常");
return true;
}
HttpClientContext clientContext = HttpClientContext.adapt(context);
HttpRequest request = clientContext.getRequest();
boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
if (idempotent) {
return true;
}
return false;
}
};
RequestConfig requestConfig = RequestConfig.custom()
// 获取连接超时时间
.setConnectionRequestTimeout(CONNECT_TIMEOUT)
// 请求超时时间
.setConnectTimeout(CONNECT_TIMEOUT)
// 响应超时时间
.setSocketTimeout(CONNECT_TIMEOUT)
.build();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
cm.setMaxTotal(MAX_TOTAL_CONNECTIONS);
cm.setDefaultMaxPerRoute(MAX_ROUTE_CONNECTIONS);
//单个路由设置其连接大小
//cm.setMaxPerRoute(new HttpRoute(new HttpHost("jd.com",80)), 100);
CloseableHttpClient httpClient = HttpClients.custom()
.setDefaultRequestConfig(requestConfig)
.setRetryHandler(retryHandler)
.setConnectionManager(cm)
//定期回收空闲连接
.evictExpiredConnections()
.setConnectionTimeToLive(1, TimeUnit.HOURS)
.build();
return httpClient;
}
}
package log;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* http工具类
* @author jiaotianqi
*/
public class HttpClientUtil {
static Logger logger = LogManager.getLogger(HttpClientUtil.class);
/**
* 描述:form表单提交
*
* @param url
* @param param
* @param header
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:15
* @since v1.0.0
*/
public static String doPost(String url, Map<String, String> param, Map<String, String> header) {
return getHttpClientRetStr(doPostRetResp(url, param, header));
}
/**
* 描述:form表单提交
*
* @param url
* @param param
* @param header
* @return CloseableHttpResponse
* @author jiaotq
* @created 2019/5/29 9:15
* @since v1.0.0
*/
public static CloseableHttpResponse doPostRetResp(String url, Map<String, String> param, Map<String, String> header) {
HttpPost httppost = new HttpPost(url);
if (header != null) {
header.forEach(httppost::setHeader);
}
// 创建参数队列
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
if (param != null) {
for (Entry<String, String> value : param.entrySet()) {
formparams.add(new BasicNameValuePair(value.getKey(), value.getValue()));
}
}
UrlEncodedFormEntity uefEntity = null;
try {
uefEntity = new UrlEncodedFormEntity(formparams, "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.warn(e.getMessage(), e);
}
httppost.setEntity(uefEntity);
return getHttpResponse(httppost);
}
/**
* 描述:form表单提交
*
* @param url
* @param param
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:15
* @since v1.0.0
*/
public static String doPost(String url, Map<String, String> param) {
return doPost(url, param, null);
}
/**
* 描述:post传文件
* @param url
* @param fileName
* @param bytes
* @param param
* @param header
* @return String
* @author jiaotq
* @created 2019/5/29 9:16
* @since v1.0.0
*/
public static String postMultipart(String url, String fileName, byte[] bytes,
Map<String, String> param, Map<String, String> header) {
return getHttpClientRetStr(postMultiparRetResp(url, fileName, bytes, param, header));
}
/**
* 描述:post传多个文件
* @param url
* @param files key文件名称,value 文件流
* @param param
* @param header
* @return String
* @author jiaotq
* @created 2019/5/29 9:16
* @since v1.0.0
*/
public static String postMultiparts(String url,Map<String,byte[]> files,
Map<String, String> param, Map<String, String> header) {
return getHttpClientRetStr(postMultiparsRetResp(url, files, param, header));
}
/**
* 描述:post传文件
* 返回 CloseableHttpResponse 对象,需要手动将连接归还池中
* ,请调用 HttpClientUtil.close(CloseableHttpResponse) 方法
* @param url
* @param fileName
* @param bytes
* @param param
* @param header
* @return CloseableHttpResponse
* @author jiaotq
* @created 2019/5/29 9:16
* @since v1.0.0
*/
public static CloseableHttpResponse postMultiparRetResp(String url, String fileName, byte[] bytes,
Map<String, String> param, Map<String, String> header) {
return postMultiparRetResp(url,fileName,new ByteArrayBody(bytes,ContentType.MULTIPART_FORM_DATA,fileName),param,header);
}
/**
* 描述:post传文件
* 返回 CloseableHttpResponse 对象,需要手动将连接归还池中
* ,请调用 HttpClientUtil.close(CloseableHttpResponse) 方法
* @param url
* @param paramName
* @param data
* @param param
* @param header
* @return CloseableHttpResponse
* @author jiaotq
* @created 2019/5/29 9:16
* @since v1.0.0
*/
public static CloseableHttpResponse postMultiparRetResp(String url, String paramName, ByteArrayBody data,
Map<String, String> param, Map<String, String> header) {
HttpPost httppost = new HttpPost(url);
if (header != null) {
header.forEach((k, v) -> {
httppost.setHeader(k, v);
});
}
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addPart(paramName, data);
if (param != null) {
param.forEach((k, v) -> {
builder.addTextBody(k, v, ContentType.TEXT_PLAIN);
});
}
HttpEntity entity = builder.build();
httppost.setEntity(entity);
return getHttpResponse(httppost);
}
/**
* 描述:post多个传文件
* 返回 CloseableHttpResponse 对象,需要手动将连接归还池中
* ,请调用 HttpClientUtil.close(CloseableHttpResponse) 方法
* @param url
* @param files key文件名称,value 文件流
* @param param
* @param header
* @return CloseableHttpResponse
* @author jiaotq
* @created 2019/5/29 9:16
* @since v1.0.0
*/
public static CloseableHttpResponse postMultiparsRetResp(String url,Map<String,byte[]> files,
Map<String, String> param, Map<String, String> header) {
HttpPost httppost = new HttpPost(url);
if (header != null) {
header.forEach((k, v) -> {
httppost.setHeader(k, v);
});
}
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
if(files!=null){
files.forEach((k,v)->{
builder.addBinaryBody(k, v, ContentType.MULTIPART_FORM_DATA, k);
});
}
if (param != null) {
param.forEach((k, v) -> {
builder.addTextBody(k, v, ContentType.TEXT_PLAIN);
});
}
HttpEntity entity = builder.build();
httppost.setEntity(entity);
return getHttpResponse(httppost);
}
/**
* 描述:post传xml
*
* @param url
* @param xml
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:17
* @since v1.0.0
*/
public static String postXml(String url, String xml) {
return postXml(url, xml, null);
}
/**
* 描述:post传xml
*
* @param url
* @param xml
* @param header
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:17
* @since v1.0.0
*/
public static String postXml(String url, String xml, Map<String, String> header) {
return getHttpClientRetStr(postXmlRetResp(url, xml, header));
}
/**
* 描述:post提交xml
* 返回 CloseableHttpResponse 对象,需要手动将连接归还池中
* ,请调用 HttpClientUtil.close(CloseableHttpResponse) 方法
*
* @param url
* @param xml
* @param header
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:17
* @since v1.0.0
*/
public static CloseableHttpResponse postXmlRetResp(String url, String xml, Map<String, String> header) {
HttpPost httppost = new HttpPost(url);
if (header != null) {
header.forEach((k, v) -> {
httppost.setHeader(k, v);
});
}
StringEntity postingString = new StringEntity(xml, "UTF-8");
httppost.setEntity(postingString);
httppost.setHeader("Content-type", "text/xml");
return getHttpResponse(httppost);
}
/**
* 描述:post传json
*
* @param url
* @param json
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:17
* @since v1.0.0
*/
public static String postJson(String url, String json) {
return postJson(url, json, null);
}
/**
* 描述:post传json
*
* @param url
* @param json
* @param header
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:17
* @since v1.0.0
*/
public static String postJson(String url, String json, Map<String, String> header) {
return getHttpClientRetStr(postJsonRetResp(url, json, header));
}
public static String postDelJson(String url, String json, Map<String, String> header) {
return getHttpClientRetStr(postDelJsonResp(url, json, header));
}
private static CloseableHttpResponse postDelJsonResp(String url, String json, Map<String, String> header) {
HttpDeleteWithBody deleteWithBody = new HttpDeleteWithBody(url);
if (header != null) {
header.forEach(deleteWithBody::setHeader);
}
StringEntity postingString = new StringEntity(json, "UTF-8");
deleteWithBody.setEntity(postingString);
deleteWithBody.setHeader("Content-type", "application/json");
return getHttpResponse(deleteWithBody);
}
/**
* 描述:post 提交json
* 返回 CloseableHttpResponse 对象,需要手动将连接归还池中
* ,请调用 HttpClientUtil.close(CloseableHttpResponse) 方法
*
* @param url
* @param json
* @param header
* @return org.apache.http.client.methods.CloseableHttpResponse
* @author jiaotq
* @created 2019/6/10 11:44
* @since v1.0.0
*/
public static CloseableHttpResponse postJsonRetResp(String url, String json, Map<String, String> header) {
HttpPost httppost = new HttpPost(url);
if (header != null) {
header.forEach(httppost::setHeader);
}
StringEntity postingString = new StringEntity(json, "UTF-8");
httppost.setEntity(postingString);
RequestConfig config = RequestConfig.custom().setConnectionRequestTimeout(10000).build() ;
httppost.setConfig(config);
httppost.setHeader("Content-type", "application/json");
return getHttpResponse(httppost);
}
/**
* 描述:get提交
*
* @param url
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:17
* @since v1.0.0
*/
public static String get(String url) {
return get(url, null, null);
}
/**
* 描述:get提交
*
* @param url
* @param param
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:17
* @since v1.0.0
*/
public static String get(String url, Map<String, String> param) {
return get(url, param, null);
}
/**
* 描述:get提交
*
* @param url
* @param param
* @param header
* @return java.lang.String
* @author jiaotq
* @created 2019/5/29 9:17
* @since v1.0.0
*/
public static String get(String url, Map<String, String> param, Map<String, String> header) {
return getHttpClientRetStr(getHttpResponse(url, param, header));
}
/**
* 描述: get 获取
* 返回 CloseableHttpResponse 对象,需要手动将连接归还池中
* ,请调用 HttpClientUtil.close(CloseableHttpResponse) 方法
*
* @param url
* @param param
* @param header
* @return org.apache.http.client.methods.CloseableHttpResponse
* @author jiaotq
* @created 2019/6/10 11:35
* @since v1.0.0
*/
public static CloseableHttpResponse getHttpResponse(String url, Map<String, String> param, Map<String, String> header) {
StringBuilder reqParamStr = new StringBuilder();
if (param != null) {
reqParamStr.append("?");
param.forEach((k, v) -> {
reqParamStr.append(k).append("=").append(v).append("&");
});
}
HttpGet httpGet = new HttpGet(url + reqParamStr.toString());
if (header != null) {
header.forEach((k, v) -> {
httpGet.setHeader(k, v);
});
}
return getHttpResponse(httpGet);
}
public static CloseableHttpResponse getHttpResponse(HttpRequestBase http) {
CloseableHttpClient httpClient = HttpClientEnum.INITIALIZE.getHttpClient();
CloseableHttpResponse response = null;
try {
response = httpClient.execute(http);
} catch (Exception e) {
logger.warn(e.getMessage(), e);
close(response);
}
return response;
}
/**
* 描述:归还连接池
*
* @param response
* @return void
* @author jiaotq
* @created 2019/6/10 12:41
* @since v1.0.0
*/
public static void close(CloseableHttpResponse response) {
if (response != null) {
try {
response.close();
} catch (IOException e) {
logger.warn(e.getMessage(), e);
}
}
}
/**
* 描述:以字符串形式返回响应的结果
*
* @param response
* @return java.lang.String
* @author jiaotq
* @created 2019/6/10 12:48
* @since v1.0.0
*/
public static String getHttpClientRetStr(CloseableHttpResponse response) {
if (response == null) {
return null;
}
HttpEntity responseEntity = response.getEntity();
if (responseEntity != null) {
try {
return EntityUtils.toString(responseEntity, "UTF-8");
} catch (Exception e) {
logger.warn(e.getMessage(), e);
} finally {
close(response);
}
}
return null;
}
/**
* 描述:将流转bytes数组 *
* @author jiaotq
* @created 2019/6/10 12:54
* @since v1.0.0
*/
public static final byte[] inputToByte(InputStream inStream) throws IOException {
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[1024];
int rc = 0;
while ((rc = inStream.read(buff, 0, 1024)) > 0) {
swapStream.write(buff, 0, rc);
}
byte[] in2b = swapStream.toByteArray();
swapStream.close();
return in2b;
}
}
package log;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import java.net.URI;
public class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase {
public static final String METHOD_NAME = "DELETE";
public String getMethod() {
return METHOD_NAME;
}
public HttpDeleteWithBody(final String uri) {
super();
setURI(URI.create(uri));
}
public HttpDeleteWithBody(final URI uri) {
super();
setURI(uri);
}
public HttpDeleteWithBody() {
super();
}
}
\ No newline at end of file
package log;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gic.commons.util.DateUtil;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class KibanaLogDownload {
static KibanaLogDownload esQueryHelper = new KibanaLogDownload();
ObjectMapper objectMapper = new ObjectMapper();
private String indexName = "filebeat-6.7.2*";
private String ip = "http://10.0.2.11:9200";
private int skipTime = 1000 * 60 * 60 * 4;
public static KibanaLogDownload getInstance() {
return esQueryHelper;
}
public KibanaLogDownload setIndexName(String indexName) {
this.indexName = indexName;
return this;
}
public KibanaLogDownload setIp(String ip) {
this.ip = ip;
return this;
}
/**
* 游标查询
* @param param 参数
* @param time 失效时间
* @param consumer 单条回调
*/
public void postScroll(String param, String time, Consumer<String> consumer) {
EsResult res = null;
String htt = ip + "/" + indexName + "/_search?scroll=" + time;
String s = HttpClientUtil.postJson(htt, param, null);
String scrollId = null ;
try {
res = JSON.parseObject(s, EsResult.class);
scrollId = res.get_scroll_id();
for (EsResult.Hits hits2 : res.getHits()) {
for (EsResult.Source hit : hits2.getHits()) {
consumer.accept(hit.get_source());
}
}
boolean empty;
do {
empty=true;
String htt2 = ip + "/_search/scroll";
Map<String, String> pa = new HashMap<>();
pa.put("scroll", time);
pa.put("scroll_id", scrollId);
String s2 = HttpClientUtil.postJson(htt2, JSON.toJSONString(pa), null);
res = JSON.parseObject(s2, EsResult.class);
for (EsResult.Hits hits2 : res.getHits()) {
for (EsResult.Source hit : hits2.getHits()) {
empty=false;
consumer.accept(hit.get_source());
}
}
} while (!empty);
Map<String, String> pa = new HashMap<>();
pa.put("scroll_id", scrollId);
String clearScrollRes = HttpClientUtil.postDelJson(ip + "/_search/scroll/", JSON.toJSONString(pa), null);
System.out.println("游标清除1:"+clearScrollRes);
}catch (Exception e) {
e.printStackTrace();
if (null != scrollId) {
Map<String, String> pa = new HashMap<>();
pa.put("scroll_id", scrollId);
String clearScrollRes = HttpClientUtil.postDelJson(ip + "/_search/scroll/", JSON.toJSONString(pa), null);
System.out.println("游标清除2:"+clearScrollRes);
}
}
}
static int logCount = 0 ;
public static void main(String[] args) throws InterruptedException {
String startTime = "2024-05-08 19:00" ;
String endTime = "2024-05-08 22:00" ;
long start = DateUtil.strToDate(startTime,"yyyy-MM-dd HH:mm").getTime() ;
long end = DateUtil.strToDate(endTime,"yyyy-MM-dd HH:mm").getTime() ;
//long start = 1714446600000l ;
//long end = 1714448399999l ;
int size = 10000 ;
int batch = 1 ;
JSONArray arr = new JSONArray() ;
for(int i=0;i<batch;i++) {
long per = (end - start) / batch ;
long s1 = start+ (i)*per ;
long s2 = start+ (i+1)*per ;
System.out.println(s1 + " " + s2);
JSONObject root = JSONObject.parseObject("{}") ;
root.put("size",size) ;
JSONObject query = JSONObject.parseObject("{\"bool\":{\"must\":[{\"match_all\":{}},{\"bool\":{\"should\":[{\"match_phrase\":{\"message\":\"创蓝彩信回执=\"}}],\"minimum_should_match\":1}},{\"range\":{\"@timestamp\":{\"gte\":1715166000000,\"lte\":1715176800000,\"format\":\"epoch_millis\"}}}],\"filter\":[],\"should\":[],\"must_not\":[]}}") ;
root.put("query",query) ;
KibanaLogDownload.getInstance().postScroll(root.toJSONString(), "15m", source -> {
try {
//System.out.println(source + (logCount++));
//
// System.out.println((source.split("创蓝彩信回执=")[1]));
Pattern p = Pattern.compile("\\[.*\\]") ;
Matcher m = p.matcher(source.split("创蓝彩信回执=")[1]) ;
while(m.find()) {
String s = m.group() ;
// System.out.println(s);
JSONArray xx = JSONArray.parseArray(s.replace("\\",""));
// System.out.println(xx.toJSONString());
arr.addAll(xx) ;
}
}catch (Exception e) {
}
});
}
System.out.println(arr.toJSONString());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:gic-haoban-init.xml" />
<import resource="classpath*:redis-init.xml"/>
<import resource="classpath:dubbo-haoban-manage-service.xml" />
<import resource="classpath:dubbo-setting-test.xml"/>
<import resource="classpath:jdbc-haoban-manage-service.xml" />
<import resource="classpath*:log-record-init.xml" />
</beans>
\ No newline at end of file
......@@ -38,6 +38,11 @@
<dependencies>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-task-manage-api</artifactId>
<version>${haoban-task-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-common</artifactId>
<version>${haoban-common}</version>
</dependency>
......
......@@ -2,6 +2,8 @@ package com.gic.haoban.manage.web.controller;
import java.util.Date;
import com.gic.search.engine.api.constant.OperateEnum;
import com.gic.search.engine.api.filter.NewNodeAddUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -66,7 +68,7 @@ public class MemberController {
*/
@RequestMapping("member-count")
@ResponseBody
public RestResponse<Object> getMemberCount(String searchParams, @RequestParam(defaultValue="0")int type) {
public RestResponse<Object> getMemberCount(String searchParams, @RequestParam(defaultValue="0")int type , @RequestParam(defaultValue="0")int qywxFlag) {
if (StringUtils.isBlank(searchParams)) {
return RestResponse.successResult(0);
}
......@@ -83,6 +85,9 @@ public class MemberController {
if (!StringUtils.isBlank(searchParams)) {
searchJson = JSON.parseObject(searchParams);
}
if(qywxFlag==1) {
searchJson = NewNodeAddUtil.addNewNodeForAnd("qywxFlag", OperateEnum.OPERATE_EQ.getValue(), 0, searchJson);
}
DynamicSearchDTO search = new DynamicSearchDTO();
searchJson = this.storeService.parseSelectData(searchJson, enterpriseId, clerkId, new Date());
search.setSearchJson(searchJson);
......
package com.gic.haoban.manage.web.controller.open;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.web.vo.open.AddMemberExcelVO;
import com.gic.haoban.task.manage.api.dto.open.OpenQwAddTaskMemberDTO;
import com.gic.haoban.task.manage.api.qdto.open.AddTaskMemberPageQDTO;
import com.gic.haoban.task.manage.api.service.OpenQwApiService;
import com.gic.web.common.download.DownloadHandlerAbstract;
import com.gic.web.common.download.context.Context;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
@Service
public class OpenAddMemberExcelHandler extends DownloadHandlerAbstract<AddMemberExcelVO> {
@Autowired
private OpenQwApiService openQwApiService;
@Override
public List<AddMemberExcelVO> getData(Context context, String json, Integer currentPage) {
AddTaskMemberPageQDTO qdto = JSON.parseObject(json, AddTaskMemberPageQDTO.class);
BasePageInfo pageInfo = new BasePageInfo();
pageInfo.setPageSize(this.getPageSize());
pageInfo.setPageNum(currentPage);
ServiceResponse<Page<OpenQwAddTaskMemberDTO>> page = this.openQwApiService.addFriendPage(qdto, pageInfo);
List<AddMemberExcelVO> voList = new ArrayList<>();
if (null != page && CollectionUtils.isNotEmpty(page.getResult().getResult())) {
for (OpenQwAddTaskMemberDTO item : page.getResult().getResult()) {
AddMemberExcelVO vo = EntityUtil.changeEntityByJSON(AddMemberExcelVO.class, item);
if (item.getStatusFlag() == 1) {
vo.setStatusExcel("待通过");
} else {
vo.setStatusExcel("已添加");
}
if (null != item.getApplyTime()) {
vo.setApplyTimeExcel(DateUtil.dateToStr(item.getApplyTime(), "yyyy-MM-dd HH:mm:ss"));
}
if (null != item.getAddTime()) {
vo.setAddTimeExcel(DateUtil.dateToStr(item.getAddTime(), "yyyy-MM-dd HH:mm:ss"));
}
voList.add(vo);
}
}
return voList;
}
@Override
public List<String> getColumnNames() {
return Arrays.asList("成员姓名", "导购姓名", "导购code", "导购所属门店名称", "导购所属门店code", "客户姓名", "客户昵称", "客户手机号", "状态", "添加好友时间", "申请添加时间");
}
@Override
public LinkedHashMap<String, List<String>> doubleColumnNames() {
return null;
}
@Override
public List<String> getColumns() {
return Arrays.asList("staffName", "clerkName", "clerkCode", "storeName", "storeCode", "memberName", "memberNick", "memberPhone", "statusExcel", "addTimeExcel", "applyTimeExcel");
}
@Override
public Integer getPageSize() {
return 1000;
}
}
package com.gic.haoban.manage.web.controller.open;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.web.vo.open.OpenQwAlarmLogExcelVO;
import com.gic.haoban.task.manage.api.dto.open.OpenQwAlarmLogDTO;
import com.gic.haoban.task.manage.api.qdto.open.AlarmWordsLogQDTO;
import com.gic.haoban.task.manage.api.service.OpenQwApiService;
import com.gic.web.common.download.DownloadHandlerAbstract;
import com.gic.web.common.download.context.Context;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
@Service
public class OpenAlarmWordsLogExcelHandler extends DownloadHandlerAbstract<OpenQwAlarmLogExcelVO> {
@Autowired
private OpenQwApiService openQwApiService;
@Override
public List<OpenQwAlarmLogExcelVO> getData(Context context, String json, Integer currentPage) {
AlarmWordsLogQDTO qdto = JSON.parseObject(json, AlarmWordsLogQDTO.class);
BasePageInfo pageInfo = new BasePageInfo();
pageInfo.setPageSize(this.getPageSize());
pageInfo.setPageNum(currentPage);
ServiceResponse<Page<OpenQwAlarmLogDTO>> page = this.openQwApiService.alarmWordsLogPage(qdto, pageInfo);
List<OpenQwAlarmLogExcelVO> voList = new ArrayList<>();
if (null != page && CollectionUtils.isNotEmpty(page.getResult().getResult())) {
for (OpenQwAlarmLogDTO item : page.getResult().getResult()) {
OpenQwAlarmLogExcelVO vo = EntityUtil.changeEntityByJSON(OpenQwAlarmLogExcelVO.class, item);
if (item.getChatType() == 1) {
vo.setChatTypeExcel("单聊");
} else {
vo.setChatTypeExcel("群聊");
}
vo.setCreateTimeExcel(DateUtil.dateToStr(item.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
voList.add(vo);
}
}
return voList;
}
@Override
public List<String> getColumnNames() {
return Arrays.asList("成员姓名", "导购姓名", "导购code", "导购所属门店名称", "导购所属门店code", "会话类型", "客户姓名", "客户昵称", "客户手机号", "群名称", "敏感词", "会话内容", "会话时间");
}
@Override
public LinkedHashMap<String, List<String>> doubleColumnNames() {
return null;
}
@Override
public List<String> getColumns() {
return Arrays.asList("staffName", "clerkName", "clerkCode", "storeName", "storeCode", "chatTypeExcel", "memberName", "memberNick", "memberPhone", "groupChatName", "alarmWords", "content", "createTimeExcel");
}
@Override
public Integer getPageSize() {
return 1000;
}
}
package com.gic.haoban.manage.web.controller.open;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.OpenStaffListDTO;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.manage.web.vo.open.OpenStaffExcelVO;
import com.gic.web.common.download.DownloadHandlerAbstract;
import com.gic.web.common.download.context.Context;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class OpenStaffExcelHandler extends DownloadHandlerAbstract<OpenStaffExcelVO> {
@Autowired
private OpenStaffApiService openStaffApiService ;
@Autowired
private EnterpriseService enterpriseService ;
@Override
public List<OpenStaffExcelVO> getData(Context context, String json, Integer currentPage) {
OpenStaffPageQDTO qdto = JSON.parseObject(json, OpenStaffPageQDTO.class);
BasePageInfo pageInfo = new BasePageInfo() ;
pageInfo.setPageSize(this.getPageSize());
pageInfo.setPageNum(currentPage);
ServiceResponse<Page<OpenStaffListDTO>> page = this.openStaffApiService.page(qdto, pageInfo);
List<OpenStaffExcelVO> voList = new ArrayList<>();
if (null != page && CollectionUtils.isNotEmpty(page.getResult().getResult())) {
EnterpriseDTO en = this.enterpriseService.getEnterpriseById(qdto.getEnterpriseId()) ;
for(OpenStaffListDTO item : page.getResult().getResult()) {
OpenStaffExcelVO vo = EntityUtil.changeEntityByJSON(OpenStaffExcelVO.class,item) ;
vo.setCreateTimeExcel(DateUtil.dateToStr(item.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
if(null != item.getAuthTime()) {
vo.setLastTimeExcel(DateUtil.dateToStr(item.getAuthTime(),"yyyy-MM-dd HH:mm:ss"));
}
if(CollectionUtils.isNotEmpty(item.getClerkList())) {
vo.setStoreCodes(item.getClerkList().stream().map(o->o.getStoreCode()).collect(Collectors.joining(",")));
vo.setStoreNames(item.getClerkList().stream().map(o->o.getStoreName()).collect(Collectors.joining(",")));
vo.setClerkCodes(item.getClerkList().stream().map(o->o.getClerkCode()).collect(Collectors.joining(",")));
vo.setClerkNames(item.getClerkList().stream().map(o->o.getClerkName()).collect(Collectors.joining(",")));
}
if(item.getStatusFlag()==1) {
vo.setStatusExcel("托管中");
}else {
if(item.getValidQrcodeFlag()==1) {
vo.setStatusExcel("待验证");
}else {
if (null == item.getFirstAuthTime()) {
vo.setStatusExcel("待授权");
}else{
vo.setStatusExcel("已过期");
}
}
}
vo.setBrandName(en.getBrandName());
voList.add(vo) ;
}
}
return voList;
}
@Override
public List<String> getColumnNames() {
return Arrays.asList("成员姓名", "托管状态","关联导购姓名","关联导购code","关联门店姓名","关联门店code","所属商户","最近托管授权时间","新增时间");
}
@Override
public LinkedHashMap<String, List<String>> doubleColumnNames() {
return null;
}
@Override
public List<String> getColumns() {
return Arrays.asList("staffName", "statusExcel", "clerkNames","clerkCodes", "storeNames","storeCodes","brandName","lastTimeExcel","createTimeExcel");
}
@Override
public Integer getPageSize() {
return 1000 ;
}
}
package com.gic.haoban.manage.web.controller.open;
import cn.hutool.core.date.DatePattern;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.JSONResponse;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.AuthorizedUser;
import com.gic.commons.util.DateUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.web.qo.open.AlarmWordsLogPageQO;
import com.gic.haoban.manage.web.qo.open.AlarmWordsPageQO;
import com.gic.haoban.manage.web.qo.open.AlarmWordsQO;
import com.gic.haoban.task.manage.api.dto.open.*;
import com.gic.haoban.task.manage.api.qdto.open.AlarmWordsLogQDTO;
import com.gic.haoban.task.manage.api.qdto.open.QwOpenAlarmWordsQDTO;
import com.gic.haoban.task.manage.api.service.OpenQwApiService;
import com.gic.qcloud.BucketNameEnum;
import com.gic.web.common.download.DownloadTask;
import com.gic.web.common.download.DownloadTaskUtil;
import com.gic.web.common.download.constants.TaskTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* 企微托管-敏感词
*/
@RestController
@RequestMapping("/qw-open")
public class QywxAlarmWordsController {
@Autowired
private OpenQwApiService openQwApiService ;
@Autowired
private OpenAlarmWordsLogExcelHandler openAlarmWordsLogExcelHandler ;
/**
* 敏感词列表
*/
@RequestMapping("page-alarm-words")
public RestResponse<Page<OpenQwAlarmWordsDTO>> pageAlarmWords(@RequestBody AlarmWordsPageQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId() ;
String enterpriseId = loginUser.getEnterpriseId() ;
BasePageInfo basePageInfo = new BasePageInfo() ;
basePageInfo.setPageNum(qo.getPageNum());
basePageInfo.setPageSize(qo.getPageSize());
QwOpenAlarmWordsQDTO qdto = EntityUtil.changeEntityByJSON(QwOpenAlarmWordsQDTO.class,qo) ;
if (null != qdto.getEndDate()) {
qdto.setEndDate(DateUtil.getEndTimeOfDay(qdto.getEndDate()));
}
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setEnterpriseId(enterpriseId);
ServiceResponse<Page<OpenQwAlarmWordsDTO>> resp = this.openQwApiService.alarmWordsPage(qdto,basePageInfo) ;
if(!resp.isSuccess()) {
return RestResponse.failure("9999",resp.getMessage()) ;
}
return RestResponse.successResult(resp.getResult()) ;
}
/**
* 保存敏感词
* @param qo
* @return
*/
@RequestMapping("save-alarm-words")
public RestResponse<Void> saveAlarmWords(@RequestBody AlarmWordsQO qo) {
OpenQwAlarmWordsDTO dto = EntityUtil.changeEntityByJSON(OpenQwAlarmWordsDTO.class,qo) ;
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId() ;
String enterpriseId = loginUser.getEnterpriseId() ;
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setEnterpriseId(enterpriseId);
dto.setCreatorId(loginUser.getClerkId());
dto.setCreatorName(loginUser.getClerkName());
ServiceResponse<Void> resp = this.openQwApiService.saveAlarmWords(dto) ;
if(!resp.isSuccess()) {
return RestResponse.failure("9999",resp.getMessage()) ;
}
return RestResponse.successResult() ;
}
/**
* 删除敏感词
* @param id
* @return
*/
@RequestMapping("del-alarm-words")
public RestResponse<Void> delAlarmWords(Long id) {
ServiceResponse<Void> resp = this.openQwApiService.delAlarmWords(id) ;
if(!resp.isSuccess()) {
return RestResponse.failure("9999",resp.getMessage()) ;
}
return RestResponse.successResult() ;
}
/**
* 敏感词监控列表
*/
@RequestMapping("page-alarm-words-log")
public RestResponse<Page<OpenQwAlarmLogDTO>> pageAlarmLog(@RequestBody AlarmWordsLogPageQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId() ;
String enterpriseId = loginUser.getEnterpriseId() ;
BasePageInfo basePageInfo = new BasePageInfo() ;
basePageInfo.setPageNum(qo.getPageNum());
basePageInfo.setPageSize(qo.getPageSize());
AlarmWordsLogQDTO qdto = EntityUtil.changeEntityByJSON(AlarmWordsLogQDTO.class,qo) ;
if (null != qdto.getEndDate()) {
qdto.setEndDate(DateUtil.getEndTimeOfDay(qdto.getEndDate()));
}
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setEnterpriseId(enterpriseId);
qdto.setLoginClerkId(loginUser.getClerkId());
ServiceResponse<Page<OpenQwAlarmLogDTO>> resp = this.openQwApiService.alarmWordsLogPage(qdto,basePageInfo) ;
if(!resp.isSuccess()) {
return RestResponse.failure("9999",resp.getMessage()) ;
}
return RestResponse.successResult(resp.getResult()) ;
}
/**
* 敏感词监控列表导出
* @param qo
* @return
*/
@RequestMapping("alarm-words-log-excel")
public RestResponse<String> excel(@RequestBody AlarmWordsLogPageQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
AlarmWordsLogQDTO qdto = EntityUtil.changeEntityByJSON(AlarmWordsLogQDTO.class,qo) ;
if (null != qdto.getEndDate()) {
qdto.setEndDate(DateUtil.getEndTimeOfDay(qdto.getEndDate()));
}
qdto.setWxEnterpriseId(loginUser.getWxEnterpriseId());
qdto.setEnterpriseId(loginUser.getEnterpriseId());
BasePageInfo basePageInfo = new BasePageInfo() ;
basePageInfo.setPageNum(1);
basePageInfo.setPageSize(1);
qdto.setLoginClerkId(loginUser.getClerkId());
ServiceResponse<Page<OpenQwAlarmLogDTO>> pageResp =this.openQwApiService.alarmWordsLogPage(qdto,basePageInfo) ;
final int totalCount = pageResp.getResult().getTotalCount() ;
if (totalCount == 0) {
return RestResponse.failure("9999", "导出数据条数为0");
}
AuthorizedUser user = new AuthorizedUser();
user.setUserId(loginUser.getClerkId());
user.setEnterpriseId(loginUser.getEnterpriseId());
user.setRealName(loginUser.getClerkName());
String fileName = "敏感词" ;
Date startDate = qdto.getStartDate();
Date endDate = qdto.getEndDate() ;
if(null != startDate && null != endDate) {
fileName = fileName + "-" + DateUtil.formatString(startDate, "yyyy-MM-dd") + "到" + DateUtil.formatString(endDate, "yyyy-MM-dd");
}
// 1.组装数据查询条件
DownloadTask task = new DownloadTask();
task.setTaskTypeEnum(TaskTypeEnum.HAOBAN_ALARM_WORDS);
task.setUser(user);
task.setDataType(qo.getDataType());
task.setTotalCount(totalCount);
task.setFileName(fileName);
task.setChannelName(TaskTypeEnum.HAOBAN_ALARM_WORDS.getName());
task.setBucketName(BucketNameEnum.REPORT_50000.getName());
task.setSearchDataParams(JSON.toJSONStringWithDateFormat(qdto, DatePattern.NORM_DATETIME_PATTERN));
task.setHandler(openAlarmWordsLogExcelHandler);
JSONResponse jsonResponse = DownloadTaskUtil.createDownloadTask(task);
final String reportId;
if (jsonResponse.isSuccess()) {
reportId = (String) jsonResponse.getResult();
} else {
return RestResponse.failure("9999",jsonResponse.getErrorMessage());
}
return RestResponse.successResult(reportId);
}
}
package com.gic.haoban.manage.web.controller.open;
import cn.hutool.core.date.DatePattern;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.JSONResponse;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.AuthorizedUser;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto;
import com.gic.enterprise.api.dto.WechatWorkServiceSetting;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.qdto.OpenStaffInitQDTO;
import com.gic.haoban.manage.api.qdto.OpenStaffPageQDTO;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.web.qo.open.OpenStaffQO;
import com.gic.haoban.manage.web.vo.open.OpenQwAccountInfoVO;
import com.gic.haoban.manage.web.vo.open.OpenStaffVO;
import com.gic.qcloud.BucketNameEnum;
import com.gic.web.common.download.DownloadTask;
import com.gic.web.common.download.DownloadTaskUtil;
import com.gic.web.common.download.constants.TaskTypeEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 企微托管
*/
@RestController
@RequestMapping("/qw-open")
public class QywxOpenController {
private static final Logger log = LogManager.getLogger(QywxOpenController.class);
@Autowired
private OpenStaffApiService openStaffApiService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private OpenStaffExcelHandler openStaffExcelHandler;
@Autowired
private EnterpriseUseForbidService enterpriseUseForbidService;
/**
* 托管列表
*
* @param qo
* @return
*/
@RequestMapping("open-staff-page")
public RestResponse<Page<OpenStaffVO>> page(@RequestBody OpenStaffQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
OpenStaffPageQDTO qdto = EntityUtil.changeEntityByJSON(OpenStaffPageQDTO.class, qo);
String enterpriseId = loginUser.getEnterpriseId();
qdto.setWxEnterpriseId(loginUser.getWxEnterpriseId());
qdto.setEnterpriseId(enterpriseId);
BasePageInfo basePageInfo = new BasePageInfo();
basePageInfo.setPageNum(qo.getPageNum());
basePageInfo.setPageSize(qo.getPageSize());
if (null != qdto.getEndDate()) {
qdto.setEndDate(DateUtil.getEndTimeOfDay(qdto.getEndDate()));
}
qdto.setLoginClerkId(loginUser.getClerkId());
ServiceResponse<Page<OpenStaffListDTO>> pageResp = this.openStaffApiService.page(qdto, basePageInfo);
Page<OpenStaffListDTO> page = pageResp.getResult();
Page<OpenStaffVO> retPage = PageHelperUtils.changePageToCurrentPage(page, OpenStaffVO.class);
if (CollectionUtils.isNotEmpty(retPage.getResult())) {
EnterpriseDTO en = this.enterpriseService.getEnterpriseById(enterpriseId);
retPage.getResult().forEach(o -> {
o.setBrandName(en.getBrandName());
});
}
return RestResponse.successResult(retPage);
}
/**
* 托管列表导出
*
* @param qo
* @return
*/
@RequestMapping("open-staff-excel")
public RestResponse<String> excel(@RequestBody OpenStaffQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
OpenStaffPageQDTO qdto = EntityUtil.changeEntityByJSON(OpenStaffPageQDTO.class, qo);
qdto.setWxEnterpriseId(loginUser.getWxEnterpriseId());
qdto.setEnterpriseId(loginUser.getEnterpriseId());
BasePageInfo basePageInfo = new BasePageInfo();
basePageInfo.setPageNum(1);
basePageInfo.setPageSize(1);
if (null != qdto.getEndDate()) {
qdto.setEndDate(DateUtil.getEndTimeOfDay(qdto.getEndDate()));
}
qdto.setLoginClerkId(loginUser.getClerkId());
ServiceResponse<Page<OpenStaffListDTO>> pageResp = this.openStaffApiService.page(qdto, basePageInfo);
final int totalCount = pageResp.getResult().getTotalCount();
if (totalCount == 0) {
return RestResponse.failure("9999", "导出数据条数为0");
}
AuthorizedUser user = new AuthorizedUser();
user.setUserId(loginUser.getClerkId());
user.setEnterpriseId(loginUser.getEnterpriseId());
user.setRealName(loginUser.getClerkName());
String fileName = "好办托管企微号";
Date startDate = qdto.getStartDate();
Date endDate = qdto.getEndDate();
if (null != startDate && null != endDate) {
fileName = "好办托管企微号" + "-" + DateUtil.formatString(startDate, "yyyy-MM-dd") + "到" + DateUtil.formatString(endDate, "yyyy-MM-dd");
}
// 1.组装数据查询条件
DownloadTask task = new DownloadTask();
task.setTaskTypeEnum(TaskTypeEnum.HAOBAN_OPEN_STAFF_LIST);
task.setUser(user);
task.setDataType(1);
task.setTotalCount(totalCount);
task.setFileName(fileName);
task.setChannelName(TaskTypeEnum.HAOBAN_OPEN_STAFF_LIST.getName());
task.setBucketName(BucketNameEnum.REPORT_50000.getName());
task.setSearchDataParams(JSON.toJSONStringWithDateFormat(qdto, DatePattern.NORM_DATETIME_PATTERN));
task.setHandler(openStaffExcelHandler);
JSONResponse jsonResponse = DownloadTaskUtil.createDownloadTask(task);
final String reportId;
if (jsonResponse.isSuccess()) {
reportId = (String) jsonResponse.getResult();
} else {
return RestResponse.failure("9999", jsonResponse.getErrorMessage());
}
return RestResponse.successResult(reportId);
}
/**
* 登录初始化
*
* @param staffId
* @return
*/
@RequestMapping("login-init")
public RestResponse<OpenStaffDTO> init(String staffId, @RequestParam(defaultValue = "0") int loginAgainFlag) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
String enterpriseId = login.getEnterpriseId();
ServiceResponse<OpenStaffDTO> staffResp = this.openStaffApiService.getByStaffId(staffId) ;
String checkMsg = this.check(wxEnterpriseId, enterpriseId , null != staffResp.getResult());
if (null != checkMsg) {
return RestResponse.failure("9999", checkMsg);
}
if (StringUtils.isBlank(staffId)) {
return RestResponse.failure("9999", "请先选择成员");
}
StaffDTO staff = this.staffApiService.selectById(staffId);
if (null == staff || !staff.getWxEnterpriseId().equals(wxEnterpriseId)) {
return RestResponse.failure("9999", "成员不存在");
}
List<StaffClerkRelationDTO> relationList = this.staffClerkRelationApiService.listByStaffId(wxEnterpriseId, staffId);
if (CollectionUtils.isEmpty(relationList)) {
return RestResponse.failure("9999", "成员未关联导购");
}
relationList = relationList.stream().filter(o -> o.getClerkType() <= 1 && o.getEnterpriseId().equals(enterpriseId)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(relationList)) {
return RestResponse.failure("9999", "成员需关联gic商户下导购");
}
OpenStaffInitQDTO initQDTO = new OpenStaffInitQDTO();
initQDTO.setWxEnterpriseId(wxEnterpriseId);
initQDTO.setEnterpriseId(enterpriseId);
initQDTO.setStaffId(staffId);
initQDTO.setLoginAgainFlag(loginAgainFlag);
ServiceResponse<OpenStaffDTO> resp = this.openStaffApiService.init(initQDTO);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
OpenStaffDTO openStaffDTO = resp.getResult();
openStaffDTO.setStaffHeadImg(staff.getHeadImg());
openStaffDTO.setStaffName(staff.getStaffName());
return RestResponse.successResult(openStaffDTO);
}
/**
* 获取账号详情
*
* @param openStaffId
* @return
*/
@RequestMapping("get-open-staff")
public RestResponse<OpenStaffDTO> getOpenStaff(Long openStaffId) {
ServiceResponse<OpenStaffDTO> resp = this.openStaffApiService.getById(openStaffId);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
OpenStaffDTO openStaffDTO = resp.getResult();
StaffDTO staff = this.staffApiService.selectById(openStaffDTO.getStaffId());
openStaffDTO.setStaffHeadImg(staff.getHeadImg());
openStaffDTO.setStaffName(staff.getStaffName());
return RestResponse.successResult(openStaffDTO);
}
/**
* 校验验证码
*
* @param openStaffId
* @param code
* @return
*/
@RequestMapping("check-code")
public RestResponse<Void> checkCode(Long openStaffId, String code) {
ServiceResponse<Void> resp = this.openStaffApiService.checkCode(openStaffId, code);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult();
}
/**
* 获取2次验证二维码
*
* @param openStaffId
* @return
*/
@RequestMapping("get-2qrcode")
public RestResponse<OpenStaffDTO> get2Qrcode(Long openStaffId) {
ServiceResponse<OpenStaffDTO> resp = this.openStaffApiService.get2Qrcode(openStaffId);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult(resp.getResult());
}
/**
* 许可数量查询
*/
@RequestMapping("license-info")
public RestResponse<OpenQwAccountInfoVO> licenseInfo() {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
String enterpriseId = login.getEnterpriseId();
OpenQwAccountInfoVO vo = this.getCheckInfo(wxEnterpriseId, enterpriseId);
return RestResponse.successResult(vo);
}
/**
* 删除托管
*
* @return
*/
@RequestMapping("del-open-staff")
public RestResponse<Void> delOpenStaff(Long openStaffId) {
ServiceResponse<Void> resp = this.openStaffApiService.delete(openStaffId);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult();
}
/**
* 取消授权
*
* @return
*/
@RequestMapping("cancel-open-staff")
public RestResponse<Void> cancelOpenStaff(Long openStaffId) {
ServiceResponse<Void> resp = this.openStaffApiService.logout(openStaffId);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult();
}
private String check(String wxEnterpriseId, String enterpriseId , boolean useFlag) {
OpenQwAccountInfoVO vo = this.getCheckInfo(wxEnterpriseId, enterpriseId);
if (vo.getStatus() == 0) {
return "请联系商务经理购买服务后再进行账号托管";
}
if (vo.getStatus() == 2) {
return "当前企微服务已过期";
}
if(!useFlag) {
if (vo.getGicTotal() <= vo.getUseNum()) {
return "托管账号数量已达上线";
}
}
return null;
}
private OpenQwAccountInfoVO getCheckInfo(String wxEnterpriseId, String enterpriseId) {
OpenQwAccountInfoVO vo = new OpenQwAccountInfoVO();
ServiceResponse<EnterpriseUsingPermissionDto> resp = this.enterpriseUseForbidService.getWxEnterpriseService(enterpriseId, wxEnterpriseId);
log.info("托管许可={}", JSONObject.toJSONString(resp));
if (resp.isSuccess()) {
EnterpriseUsingPermissionDto dto = resp.getResult();
if (null == dto) {
vo.setStatus(0);
} else {
vo.setExpireDate(dto.getServiceEndDate());
vo.setStatus(1);
if (dto.getServiceEndDate().before(new Date())) {
vo.setStatus(2);
}
String json = dto.getModuleSetting();
WechatWorkServiceSetting bo = JSONObject.parseObject(json, WechatWorkServiceSetting.class);
vo.setGicTotal(bo.getAccountNumber());
vo.setVersion(dto.getModuleVersion());
}
}
ServiceResponse<OpenStaffLicenseDTO> hbResp = this.openStaffApiService.getLicenseInfo(wxEnterpriseId, enterpriseId);
vo.setUseNum(hbResp.getResult().getUseNum());
vo.setValidNum(hbResp.getResult().getValidNum());
log.info("OpenQwAccountInfoVO={}", JSONObject.toJSONString(vo));
return vo;
}
}
package com.gic.haoban.manage.web.controller.open;
import cn.hutool.core.date.DatePattern;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.JSONResponse;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.AuthorizedUser;
import com.gic.commons.util.DateUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.manage.web.controller.MemberController;
import com.gic.haoban.manage.web.log.LogRecordUserServiceImpl;
import com.gic.haoban.manage.web.qo.open.AddTaskDataQO;
import com.gic.haoban.manage.web.qo.open.AddTaskMemberPageQO;
import com.gic.haoban.manage.web.qo.open.AddTaskPageQO;
import com.gic.haoban.manage.web.utils.CreatorUtils;
import com.gic.haoban.manage.web.vo.MemberTagGroupVO;
import com.gic.haoban.manage.web.vo.open.AddTaskDetailVO;
import com.gic.haoban.manage.web.vo.open.OpenAddDataVO;
import com.gic.haoban.task.manage.api.dto.open.*;
import com.gic.haoban.task.manage.api.qdto.open.AddTaskMemberPageQDTO;
import com.gic.haoban.task.manage.api.qdto.open.QwAddTaskPageQDTO;
import com.gic.haoban.task.manage.api.service.OpenQwApiService;
import com.gic.log.record.anno.GicLogRecord;
import com.gic.log.record.util.GicLogRecordCategoryEnum;
import com.gic.log.record.util.GicLogRecordEvaluationContext;
import com.gic.log.record.util.GicLogRecordOptTypeEnum;
import com.gic.member.tag.api.dto.MemberTagDTO;
import com.gic.member.tag.api.dto.MemberTagGroupDTO;
import com.gic.member.tag.api.dto.MemberTagItemDTO;
import com.gic.member.tag.api.service.MemberTagApiService;
import com.gic.member.tag.api.service.MemberTagGroupApiService;
import com.gic.qcloud.BucketNameEnum;
import com.gic.redis.data.util.RedisUtil;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum;
import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum;
import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
import com.gic.web.common.download.DownloadTask;
import com.gic.web.common.download.DownloadTaskUtil;
import com.gic.web.common.download.constants.TaskTypeEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
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.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* 企微托管任务
*/
@RestController
@RequestMapping("/qw-open-task")
public class QywxOpenTaskController {
private static final Logger log = LogManager.getLogger(QywxOpenTaskController.class);
@Autowired
private OpenQwApiService openQwApiService;
@Autowired
private OpenAddMemberExcelHandler openAddMemberExcelHandler;
@Autowired
private MemberTagApiService memberTagApiService;
@Autowired
private MemberTagGroupApiService memberTagGroupApiService;
@Autowired
private StoreService storeService;
@Autowired
private OpenStaffApiService openStaffApiService;
@Autowired
private MemberController memberController;
@Autowired
private EnterpriseService enterpriseService;
/**
* 加好友任务列表
*/
@RequestMapping("page-add-task")
public RestResponse<Page<OpenQwAddTaskDTO>> pageAddTask(@RequestBody AddTaskPageQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
BasePageInfo basePageInfo = new BasePageInfo();
basePageInfo.setPageNum(qo.getPageNum());
basePageInfo.setPageSize(qo.getPageSize());
QwAddTaskPageQDTO qdto = EntityUtil.changeEntityByJSON(QwAddTaskPageQDTO.class, qo);
if (null != qdto.getEndDate()) {
qdto.setEndDate(DateUtil.getEndTimeOfDay(qdto.getEndDate()));
}
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setEnterpriseId(enterpriseId);
// 创建人
List<String> creatorIdList = CreatorUtils.getCreatorIdList(0);
if (CollectionUtils.isNotEmpty(creatorIdList)) {
qdto.setCreatorIdList(creatorIdList);
}
ServiceResponse<Page<OpenQwAddTaskDTO>> resp = this.openQwApiService.addTaskPage(qdto, basePageInfo);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult(resp.getResult());
}
/**
* 保存更新加好友任务
*
* @param dto
* @return
*/
@RequestMapping("save-add-task")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_ADD, optType = GicLogRecordOptTypeEnum.QW_ADD_02, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-自动加好友")
public RestResponse<OpenQwAddTaskDTO> saveAddTask(@RequestBody OpenQwAddTaskDTO dto) {
OpenQwAddTaskSettingDTO setting = this.getAddSetting();
if (null == setting) {
return RestResponse.failure("9999", "请先设置添加好友规则");
}
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setEnterpriseId(enterpriseId);
dto.setCreatorId(loginUser.getClerkId());
dto.setCreatorName(loginUser.getClerkName());
Long addTaskId = dto.getAddTaskId();
OpenQwAddTaskDTO oldDTO = null;
if (null != addTaskId) {
ServiceResponse<OpenQwAddTaskDTO> oldResp = this.openQwApiService.getAddTask(addTaskId);
oldDTO = oldResp.getResult();
}
if (null != oldDTO) {
String oldName = oldDTO.getName() + "-" + addTaskId;
String title = "编辑任务【" + oldName + "】";
int oldMemberType = oldDTO.getMemberType();
int newMemberType = dto.getMemberType();
String oldMemberTypeTitle = oldMemberType == 0 ? "客户筛选" : "客户分组";
String newMemberTypeTitle = newMemberType == 0 ? "客户筛选" : "客户分组";
String logContent1 = this.otherLog(oldMemberType, newMemberType, "参与人群", oldMemberTypeTitle, newMemberTypeTitle);
int oldMemberRule = oldDTO.getMemberRule();
int newMemberRule = dto.getMemberRule();
String oldMemberRuleTitle = oldMemberRule == 1 ? "和专属导购没有好友关系的客户" : "和企业下所有导购均没有好友关系的客户";
String newMemberRuleTitle = newMemberRule == 1 ? "和专属导购没有好友关系的客户" : "和企业下所有导购均没有好友关系的客户";
String logContent2 = this.otherLog(oldMemberRule, newMemberRule, "人群规则", oldMemberRuleTitle, newMemberRuleTitle);
String oldLabel = oldDTO.getMemberLabelId();
String newLabel = dto.getMemberLabelId();
String logContent3 = this.membrLabel(oldLabel, newLabel);
String logContent = this.addListForLog(logContent1, logContent2, logContent3);
if (StringUtils.isNotBlank(logContent)) {
logContent = title + logContent;
GicLogRecordEvaluationContext.putAttribute("logValue", logContent);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
} else {
GicLogRecordEvaluationContext.noWriteLog();
}
}
ServiceResponse<OpenQwAddTaskDTO> resp = this.openQwApiService.saveAddTask(dto);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult(resp.getResult());
}
private String otherLog(int oldValue, int newValue, String s1, String s2, String s3) {
if (oldValue != newValue) {
return s1 + "从【" + s2 + "】修改为【" + s3 + "】";
}
return "";
}
private String membrLabel(String oldValue, String newValue) {
if (!oldValue.equals(newValue)) {
MemberTagItemDTO oldResp = this.memberTagApiService.findMemberTagItem(oldValue);
MemberTagItemDTO newResp = this.memberTagApiService.findMemberTagItem(newValue);
if (null != oldResp) {
oldValue = oldResp.getTagItemName();
}
if (null != newResp) {
newValue = newResp.getTagItemName();
}
return "标签从【" + oldValue + "】修改为【" + newValue + "】";
}
return "";
}
/**
* 获取加好友任务详情
*
* @param addTaskId
* @return
*/
@RequestMapping("get-add-task")
public RestResponse<AddTaskDetailVO> getAddTask(Long addTaskId) {
ServiceResponse<OpenQwAddTaskDTO> resp = this.openQwApiService.getAddTask(addTaskId);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
AddTaskDetailVO vo = EntityUtil.changeEntityByJSON(AddTaskDetailVO.class, resp.getResult());
if (StringUtils.isNotBlank(vo.getMemberLabelId())) {
MemberTagItemDTO tagItem = this.memberTagApiService.findMemberTagItem(vo.getMemberLabelId());
if (null != tagItem) {
String tagId = tagItem.getTagId();
MemberTagDTO tag = this.memberTagApiService.getMemberTagById(tagId);
vo.setMemberLabelName(tag.getTagName() + "-" + tagItem.getTagItemName());
vo.setMemberLabelStatus(tagItem.getStatus());
}
}
// 会员分组
if (vo.getMemberType() == 1) {
List<MemberTagGroupVO> memberTagGroupVOS = this.listMemberTagGroupInfoByGoupIds(vo
.getSearchParams());
vo.setTagGroupList(memberTagGroupVOS);
}
return RestResponse.successResult(vo);
}
public List<MemberTagGroupVO> listMemberTagGroupInfoByGoupIds(String tagGroupIds) {
List<MemberTagGroupVO> result = new ArrayList<>();
if (StringUtils.isBlank(tagGroupIds)) {
return result;
}
String[] tagGroupIdArr = tagGroupIds.split(",");
if (ArrayUtils.isEmpty(tagGroupIdArr)) {
return result;
}
List<MemberTagGroupDTO> memberTagGroupDTOList = memberTagGroupApiService.findListByIds(
new ArrayList<>(Arrays.asList(tagGroupIdArr)));
if (CollectionUtils.isNotEmpty(memberTagGroupDTOList)) {
for (MemberTagGroupDTO memberTagGroupDTO : memberTagGroupDTOList) {
MemberTagGroupVO memberTagGroupVO = new MemberTagGroupVO();
memberTagGroupVO.setGroupName(memberTagGroupDTO.getGroupName());
memberTagGroupVO.setMemberTagGroupId(memberTagGroupDTO.getMemberTagGroupId());
memberTagGroupVO.setEffectiveStatus(memberTagGroupDTO.getEffectiveStatus());
memberTagGroupVO.setIsRealTime(memberTagGroupDTO.getIsRealTime());
memberTagGroupVO.setFixedType(memberTagGroupDTO.getFixedType());
result.add(memberTagGroupVO);
}
}
return result;
}
/**
* 终止加好友任务
*
* @param addTaskId
* @return
*/
@RequestMapping("stop-add-task")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_ADD, optType = GicLogRecordOptTypeEnum.QW_ADD_02, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-自动加好友")
public RestResponse<Void> stopAddTask(Long addTaskId) {
ServiceResponse<Void> resp = this.openQwApiService.updateAddTaskStatus(addTaskId, 1);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
ServiceResponse<OpenQwAddTaskDTO> taskResp = this.openQwApiService.getAddTask(addTaskId);
String logContent = "终止【" + taskResp.getResult().getName() + "-" + addTaskId + "】";
GicLogRecordEvaluationContext.putAttribute("logValue", logContent);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
return RestResponse.successResult();
}
/**
* 加好友任务-添加明细列表
*/
@RequestMapping("page-add-task-member")
public RestResponse<Page<OpenQwAddTaskMemberDTO>> pageAddTaskMember(@RequestBody AddTaskMemberPageQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
BasePageInfo basePageInfo = new BasePageInfo();
basePageInfo.setPageNum(qo.getPageNum());
basePageInfo.setPageSize(qo.getPageSize());
AddTaskMemberPageQDTO qdto = EntityUtil.changeEntityByJSON(AddTaskMemberPageQDTO.class, qo);
if (null != qdto.getEndDate()) {
qdto.setEndDate(DateUtil.getEndTimeOfDay(qdto.getEndDate()));
}
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setEnterpriseId(enterpriseId);
ServiceResponse<Page<OpenQwAddTaskMemberDTO>> resp = this.openQwApiService.addFriendPage(qdto, basePageInfo);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult(resp.getResult());
}
/**
* 加好友任务-添加明细列表-导出
*/
@RequestMapping("add-task-member-excel")
public RestResponse<String> addTaskMemberExcel(@RequestBody AddTaskMemberPageQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
AddTaskMemberPageQDTO qdto = EntityUtil.changeEntityByJSON(AddTaskMemberPageQDTO.class, qo);
qdto.setWxEnterpriseId(loginUser.getWxEnterpriseId());
qdto.setEnterpriseId(loginUser.getEnterpriseId());
if (null != qdto.getEndDate()) {
qdto.setEndDate(DateUtil.getEndTimeOfDay(qdto.getEndDate()));
}
BasePageInfo basePageInfo = new BasePageInfo();
basePageInfo.setPageNum(1);
basePageInfo.setPageSize(1);
ServiceResponse<Page<OpenQwAddTaskMemberDTO>> pageResp = this.openQwApiService.addFriendPage(qdto, basePageInfo);
final int totalCount = pageResp.getResult().getTotalCount();
if (totalCount == 0) {
return RestResponse.failure("9999", "导出数据条数为0");
}
AuthorizedUser user = new AuthorizedUser();
user.setUserId(loginUser.getClerkId());
user.setEnterpriseId(loginUser.getEnterpriseId());
user.setRealName(loginUser.getClerkName());
String fileName = "好办自动加好友";
Date startDate = qo.getStartDate();
Date endDate = qo.getEndDate();
if (null != startDate && null != endDate) {
fileName = fileName + "-" + DateUtil.formatString(startDate, "yyyy-MM-dd") + "到" + DateUtil.formatString(endDate, "yyyy-MM-dd");
}
// 1.组装数据查询条件
DownloadTask task = new DownloadTask();
task.setTaskTypeEnum(TaskTypeEnum.HAOBAN_OPEN_ADD);
task.setUser(user);
task.setDataType(qo.getDataType());
task.setTotalCount(totalCount);
task.setFileName(fileName);
task.setChannelName(TaskTypeEnum.HAOBAN_OPEN_ADD.getName());
task.setBucketName(BucketNameEnum.REPORT_50000.getName());
task.setSearchDataParams(JSON.toJSONStringWithDateFormat(qdto, DatePattern.NORM_DATETIME_PATTERN));
task.setHandler(openAddMemberExcelHandler);
JSONResponse jsonResponse = DownloadTaskUtil.createDownloadTask(task);
final String reportId;
if (jsonResponse.isSuccess()) {
reportId = (String) jsonResponse.getResult();
} else {
return RestResponse.failure("9999", jsonResponse.getErrorMessage());
}
return RestResponse.successResult(reportId);
}
/**
* 加好友数据图表
*/
@RequestMapping("list-add-data")
public RestResponse<OpenAddDataVO> pageAdTask(@RequestBody AddTaskDataQO qo) {
ServiceResponse<List<OpenQwAddTaskDataDTO>> resp = this.openQwApiService.taskData(qo.getAddTaskId(), qo.getStartDate(), qo.getEndDate());
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
OpenAddDataVO vo = new OpenAddDataVO();
int applyNum = 0;
int addNum = 0;
for (OpenQwAddTaskDataDTO dto : resp.getResult()) {
applyNum += dto.getApplyNum();
addNum += dto.getAddNum();
}
vo.setApplyNum(applyNum);
vo.setAddNum(addNum);
vo.setList(resp.getResult());
return RestResponse.successResult(vo);
}
/**
* 添加好友规则设置
*
* @return
*/
@RequestMapping("get-add-task-setting")
public RestResponse<OpenQwAddTaskSettingDTO> getTaskSetting() {
OpenQwAddTaskSettingDTO dto = this.getAddSetting();
return RestResponse.successResult(dto);
}
private OpenQwAddTaskSettingDTO getAddSetting() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
ServiceResponse<OpenQwAddTaskSettingDTO> resp = this.openQwApiService.geAddSetting(wxEnterpriseId, enterpriseId);
if (!resp.isSuccess()) {
return null;
}
return resp.getResult();
}
/**
* 保存添加好友规则配置
*
* @param dto
* @return
*/
@RequestMapping("save-add-task-setting")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_ADD, optType = GicLogRecordOptTypeEnum.QW_ADD_01, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-自动加好友")
public RestResponse<OpenQwAddTaskSettingDTO> saveTaskSetting(@RequestBody OpenQwAddTaskSettingDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setEnterpriseId(enterpriseId);
ServiceResponse<OpenQwAddTaskSettingDTO> oldResp = this.openQwApiService.geAddSetting(wxEnterpriseId, enterpriseId);
if (null != oldResp.getResult()) {
OpenQwAddTaskSettingDTO oldDTO = oldResp.getResult();
String logContent1 = "";
String logContent2 = "";
String oldAddTime = oldDTO.getAddTime();
String newAddTime = dto.getAddTime();
if (!oldAddTime.equals(newAddTime)) {
logContent1 = "添加时段从【" + oldAddTime + "】修改为【" + newAddTime + "】 ";
}
String oldInt = oldDTO.getAddIntervalStart() + "-" + oldDTO.getAddIntervalEnd();
String newInt = dto.getAddIntervalStart() + "-" + dto.getAddIntervalEnd();
if (!oldInt.equals(newInt)) {
logContent2 = "添加间隔从【" + oldInt + "】修改为【" + newInt + "】 ";
}
String n1 = this.numLog(oldDTO.getReAddTime(), dto.getReAddTime(), "客户未通过好友重新添加时间从【%s】修改未【%s】");
String n2 = this.numLog(oldDTO.getReAddTimes(), dto.getReAddTimes(), "最多重新添加次数从【%s】修改为【%s】");
String n3 = this.openLog(oldDTO.getReAddFlag(), dto.getReAddFlag(), "自动重新添加");
String logContent3 = "";
if (!StringUtils.isAllBlank(n1, n2, n3)) {
logContent3 = this.addListForLog(n1, n2, n3);
}
String logContent4 = this.storeLog(oldDTO.getMainStoreJson(), dto.getMainStoreJson(), "服务门店");
String logContent5 = this.storeLog(oldDTO.getOtherStoreJson(), dto.getOtherStoreJson(), "协管门店");
String logContent6 = this.storeLog(oldDTO.getAssignStoreJson(), dto.getAssignStoreJson(), "指定门店");
String logContent = this.addListForLog(logContent1, logContent2, logContent3, logContent4, logContent5, logContent6);
if (StringUtils.isNotBlank(logContent)) {
GicLogRecordEvaluationContext.putAttribute("logValue", logContent);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
} else {
GicLogRecordEvaluationContext.noWriteLog();
}
}
ServiceResponse<OpenQwAddTaskSettingDTO> resp = this.openQwApiService.saveAddSetting(dto);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult(resp.getResult());
}
private String storeLog(String oldStr, String newStr, String name) {
JSONObject oldJson = JSONObject.parseObject(oldStr);
int oldFlag = oldJson.getIntValue("open");
JSONObject newJson = JSONObject.parseObject(newStr);
int newFlag = newJson.getInteger("open");
String s1 = this.openLog(oldFlag, newFlag, name);
String s2Old = this.getLogOption(oldJson.getIntValue("zs"), oldJson.getIntValue("dz"), oldJson.getIntValue("dy"), oldJson.getIntValue("xg"));
String s2New = this.getLogOption(newJson.getIntValue("zs"), newJson.getIntValue("dz"), newJson.getIntValue("dy"), newJson.getIntValue("xg"));
String s2 = "";
if (!s2Old.equals(s2New)) {
s2 = String.format("%s从【%s】修改为【%s】", name, s2Old, s2New);
}
String s3 = "";
if ("指定门店".equals(name)) {
s3 = this.getStore(oldJson.getString("store"), newJson.getString("store"));
}
return this.addListForLog(s1, s3, s2);
}
private String getStore(String oldStoreId, String newStoreId) {
if (null == oldStoreId) {
oldStoreId = "";
}
if (null == newStoreId) {
newStoreId = "";
}
if (!oldStoreId.equals(newStoreId)) {
String oldName = "--";
if (StringUtils.isNotBlank(oldStoreId)) {
StoreDTO oldStore = this.storeService.getStore(oldStoreId);
if (null != oldStore) {
oldName = oldStore.getStoreName() + "、" + oldStore.getStoreCode();
}
}
String newName = "--";
if (StringUtils.isNotBlank(newStoreId)) {
StoreDTO newStore = this.storeService.getStore(newStoreId);
if (null != newStore) {
newName = newStore.getStoreName() + "、" + newStore.getStoreCode();
}
}
String s = String.format("指定门店从【%s】修改为【%s】", oldName, newName);
return s;
}
return "";
}
private String getLogOption(int zs, int dz, int dy, int xg) {
List<String> list = new ArrayList<>();
if (zs == 1) {
list.add("专属导购");
}
if (xg == 1) {
list.add("协管导购");
}
if (dz == 1) {
list.add("店长");
}
if (dy == 1) {
list.add("其他导购随机");
}
return list.stream().collect(Collectors.joining("、"));
}
private String openLog(int oldFlag, int openFlag, String title) {
if (oldFlag == openFlag) {
return "";
}
if (oldFlag == openFlag) {
return "";
}
if (openFlag == 1) {
return "开启" + title;
}
return "关闭" + title;
}
private String numLog(int old, int newValue, String title) {
if (old != newValue) {
return String.format(title, old + "", newValue + "");
}
return "";
}
/**
* 删除好友配置
*
* @return
*/
@RequestMapping("get-del-task-setting")
public RestResponse<OpenQwDelTaskDTO> getDelTaskSetting() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
ServiceResponse<OpenQwDelTaskDTO> resp = this.openQwApiService.getDelTask(wxEnterpriseId, enterpriseId);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult(resp.getResult());
}
/**
* 保存删除好友配置
*
* @param dto
* @return
*/
@RequestMapping("save-del-task-setting")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_DEL, optType = GicLogRecordOptTypeEnum.QW_DEL_01, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-自动删好友")
public RestResponse<OpenQwDelTaskDTO> saveDelTaskSetting(@RequestBody OpenQwDelTaskDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setEnterpriseId(enterpriseId);
ServiceResponse<OpenQwDelTaskDTO> oldResp = this.openQwApiService.getDelTask(wxEnterpriseId, enterpriseId);
OpenQwDelTaskDTO oldDTO = null;
if (null != oldResp.getResult()) {
oldDTO = oldResp.getResult();
}
ServiceResponse<OpenQwDelTaskDTO> resp = this.openQwApiService.saveDelTask(dto);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
if (null != oldDTO) {
String logContent1 = "";
String logContent2 = "";
String logContent3 = "";
String oldAddTime = oldDTO.getAddTime();
String newAddTime = dto.getAddTime();
if (!oldAddTime.equals(newAddTime)) {
logContent1 = "删除时段从【" + oldAddTime + "】修改为【" + newAddTime + "】";
}
String oldInt = oldDTO.getAddIntervalStart() + "-" + oldDTO.getAddIntervalEnd();
String newInt = dto.getAddIntervalStart() + "-" + dto.getAddIntervalEnd();
if (!oldInt.equals(newInt)) {
logContent2 = "删除间隔从【" + oldInt + "】修改为【" + newInt + "】";
}
int oldOpenFlag = oldDTO.getOpenFlag();
int newOpenFlag = dto.getOpenFlag();
if (oldOpenFlag != newOpenFlag) {
if (newOpenFlag == 1) {
logContent3 = "状态从【停用自动删除】修改为【启用自动删除】";
} else {
logContent3 = "状态从【启用自动删除】修改为【停用自动删除】";
}
}
String logContent = this.addListForLog(logContent1, logContent2, logContent3);
if (StringUtils.isNotBlank(logContent)) {
GicLogRecordEvaluationContext.putAttribute("logValue", logContent);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
} else {
GicLogRecordEvaluationContext.noWriteLog();
}
}
return RestResponse.successResult(resp.getResult());
}
/**
* 任务自动执行配置
*
* @return
*/
@RequestMapping("get-auto-send-task-setting")
public RestResponse<OpenQwAutoSendDTO> getAutoSendTaskSetting() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
ServiceResponse<OpenQwAutoSendDTO> resp = this.openQwApiService.getAutoSend(wxEnterpriseId, enterpriseId);
if (!resp.isSuccess()) {
return RestResponse.failure("9999", resp.getMessage());
}
return RestResponse.successResult(resp.getResult());
}
/**
* 保存任务自动执行配置
*
* @param dto
* @return
*/
@RequestMapping("save-auto-send-task-setting")
@GicLogRecord(value = "${#logValue}", category = GicLogRecordCategoryEnum.QW_AUTO_SEND, optType = GicLogRecordOptTypeEnum.QW_AUTO_SEND_01, userFunc = LogRecordUserServiceImpl.class, optPage = "企微运营-任务自动执行")
public RestResponse<OpenQwAutoSendDTO> saveAutoSendTaskSetting(@RequestBody OpenQwAutoSendDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setEnterpriseId(enterpriseId);
ServiceResponse<OpenQwAutoSendDTO> oldResp = this.openQwApiService.getAutoSend(wxEnterpriseId, enterpriseId);
OpenQwAutoSendDTO oldDTO = null;
if (null != oldResp.getResult()) {
oldDTO = oldResp.getResult();
}
ServiceResponse<OpenQwAutoSendDTO> resp = this.openQwApiService.saveAutoSend(dto);
if (!resp.isSuccess()) {
GicLogRecordEvaluationContext.noWriteLog();
return RestResponse.failure("9999", resp.getMessage());
}
if (null != oldDTO) {
int oldOpenFlag = oldDTO.getOpenFlag();
int newOpenFlag = dto.getOpenFlag();
String logContent1 = "";
if (oldOpenFlag != newOpenFlag) {
if (newOpenFlag == 1) {
logContent1 = "任务从【关闭】修改为【启用】";
} else {
logContent1 = "任务从【启用】修改为【关闭】";
}
}
String logContent2 = "";
String oldType = "";
String newType = "";
String oldSendType = oldDTO.getSendType();
String newSendType = dto.getSendType();
if (oldSendType.contains("1")) {
oldType += "客户群发";
}
if (newSendType.contains("1")) {
newType += "客户群发";
}
if (oldSendType.contains("2")) {
if (StringUtils.isNotBlank(oldType)) {
oldType += "、";
}
oldType += "社群群发";
}
if (newSendType.contains("2")) {
if (StringUtils.isNotBlank(newType)) {
newType += "、";
}
newType += "社群群发";
}
if (!oldType.equals(newType)) {
logContent2 += "执行消息类型从【" + oldType + "】修改为【" + newType + "】";
}
String logContent = this.addListForLog(logContent1, logContent2);
if (StringUtils.isNotBlank(logContent)) {
GicLogRecordEvaluationContext.putAttribute("logValue", logContent);
GicLogRecordEvaluationContext.putOptTargetId(AuthWebRequestUtil.getLoginUser().getClerkId());
} else {
GicLogRecordEvaluationContext.noWriteLog();
}
}
return RestResponse.successResult(resp.getResult());
}
private String addListForLog(String... arr) {
List<String> list = new ArrayList<>();
for (String s : arr) {
if (StringUtils.isNotBlank(s)) {
list.add(s);
}
}
if (CollectionUtils.isNotEmpty(list)) {
return list.stream().collect(Collectors.joining(","));
}
return "";
}
/**
* 预估需要执行的天数
*
* @param dto
* @return
*/
@RequestMapping("calculate-add-day")
public RestResponse<Integer> calculateAddDay(@RequestBody OpenQwAddTaskDTO dto) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
// 添加的人数 1和专属无好友 2和所有无好友
int memberRule= dto.getMemberRule() ;
int qywxFlag = 0 ;
if(memberRule==2) {
qywxFlag = 1 ;
}
int memberNum = this.getMemberNum(dto.getSearchParams(), dto.getMemberType(),qywxFlag);
// 成员数
int staffNum = this.openStaffApiService.listAllOnlineStaff(wxEnterpriseId, enterpriseId).size();
if (staffNum == 0) {
return RestResponse.successResult(0);
}
// 一次添加人数
OpenQwAddTaskSettingDTO setting = this.getAddSetting();
if (null == setting) {
return RestResponse.successResult(0);
}
int min = (setting.getAddIntervalEnd() + setting.getAddIntervalStart()) / 2;
int hour = Integer.valueOf(setting.getAddTime().split("-")[1].split(":")[0]) -
Integer.valueOf(setting.getAddTime().split("-")[0].split(":")[0]);
int m = (hour * 60 / min);
int days = BigDecimal.valueOf(memberNum).divide(BigDecimal.valueOf(m * staffNum), BigDecimal.ROUND_UP).intValue();
log.info("member={},staff={},m={}", memberNum, staffNum, m);
return RestResponse.successResult(days);
}
private int getMemberNum(String searchParams, int memberType , int qywxFlag) {
RestResponse<Object> resp = this.memberController.getMemberCount(searchParams, memberType,qywxFlag);
return Integer.valueOf(resp.getResult().toString());
}
@RequestMapping("test")
public RestResponse<Object> test(String memberId) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String enterpriseId = loginUser.getEnterpriseId();
String ret = this.openQwApiService.matchStaffTest(wxEnterpriseId, enterpriseId, memberId);
return RestResponse.successResult(ret);
}
/**
* 音频文件转mp3
* @return
*/
@RequestMapping("list-silk")
@com.gic.web.common.ano.IgnoreLogin
@IgnoreLogin
public Object listSilk() {
List<OpenQwSilkMp3DTO> ret = this.openQwApiService.listSilk();
RedisUtil.setCache("haobansilk2mp3",1,3L, TimeUnit.MINUTES);
return RestResponse.successResult(ret);
}
@RequestMapping("silk2mp3")
@com.gic.web.common.ano.IgnoreLogin
@IgnoreLogin
public Object silk2Mp3(HttpServletRequest request, String enterpriseId, int type, Long id , Long relationId) throws IOException {
EnterpriseDTO enterpriseDTO = this.enterpriseService.getEnterpriseById(enterpriseId);
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
List<MultipartFile> list = multiRequest.getMultiFileMap().get("media");
MultipartFile mf = list.get(0);
byte[] data = mf.getBytes();
CloudFileInfo uploadInfo = CloudFileUtil.uploadFile(data, "mp3", CloudFileTypeEnum.AUDIO, enterpriseDTO.getFactoryCode(), CloudFileBusinessOptEnum.COMMON_QYWX);
log.info("silk2mp3={}",uploadInfo);
this.openQwApiService.updateToMp3(enterpriseId,type,id,relationId,uploadInfo.getOrgFileUrl());
return uploadInfo;
}
}
......@@ -65,6 +65,19 @@ public class StaffListQO implements Serializable {
private String clerkId ;
/**
* 企微托管页面查询1是0否
*/
private int qwOpenFlag ;
public int getQwOpenFlag() {
return qwOpenFlag;
}
public void setQwOpenFlag(int qwOpenFlag) {
this.qwOpenFlag = qwOpenFlag;
}
public String getClerkId() {
return clerkId;
}
......
package com.gic.haoban.manage.web.qo.open;
import java.io.Serializable;
import java.util.Date;
public class AddTaskDataQO implements Serializable {
private Long addTaskId ;
private Date startDate ;
private Date endDate ;
public Long getAddTaskId() {
return addTaskId;
}
public void setAddTaskId(Long addTaskId) {
this.addTaskId = addTaskId;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}
package com.gic.haoban.manage.web.qo.open;
import com.gic.api.base.commons.BasePageInfo;
import java.io.Serializable;
import java.util.Date;
public class AddTaskMemberPageQO extends BasePageInfo implements Serializable {
private String clerkParams ;
private String memberParams ;
// 1已申请
private int status ;
private Date startDate;
private Date endDate;
private Long addTaskId ;
private int dataType ;
public int getDataType() {
return dataType;
}
public void setDataType(int dataType) {
this.dataType = dataType;
}
public Long getAddTaskId() {
return addTaskId;
}
public void setAddTaskId(Long addTaskId) {
this.addTaskId = addTaskId;
}
public String getClerkParams() {
return clerkParams;
}
public void setClerkParams(String clerkParams) {
this.clerkParams = clerkParams;
}
public String getMemberParams() {
return memberParams;
}
public void setMemberParams(String memberParams) {
this.memberParams = memberParams;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}
package com.gic.haoban.manage.web.qo.open;
import com.gic.api.base.commons.BasePageInfo;
import java.io.Serializable;
import java.util.Date;
public class AddTaskPageQO extends BasePageInfo implements Serializable {
// -1全部 0未开始 1进行中 2已结束
private int status = -1 ;
/**
* 任务名称或id
*/
private String search ;
private Date startDate ;
private Date endDate ;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getSearch() {
return search;
}
public void setSearch(String search) {
this.search = search;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}
package com.gic.haoban.manage.web.qo.open;
import com.gic.api.base.commons.BasePageInfo;
import java.io.Serializable;
import java.util.Date;
public class AlarmWordsLogPageQO extends BasePageInfo implements Serializable {
/**
* 导购
*/
private String clerkParams;
/**
* 门店
*/
private String storeParams;
/**
* 0全部 1单聊 2群
*/
private int chatType;
private Date startDate;
private Date endDate;
private int dataType ;
public int getDataType() {
return dataType;
}
public void setDataType(int dataType) {
this.dataType = dataType;
}
public String getClerkParams() {
return clerkParams;
}
public void setClerkParams(String clerkParams) {
this.clerkParams = clerkParams;
}
public String getStoreParams() {
return storeParams;
}
public void setStoreParams(String storeParams) {
this.storeParams = storeParams;
}
public int getChatType() {
return chatType;
}
public void setChatType(int chatType) {
this.chatType = chatType;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}
package com.gic.haoban.manage.web.qo.open;
import com.gic.api.base.commons.BasePageInfo;
import java.io.Serializable;
import java.util.Date;
public class AlarmWordsPageQO extends BasePageInfo implements Serializable {
private String searchParam ;
private Date startDate;
private Date endDate ;
public String getSearchParam() {
return searchParam;
}
public void setSearchParam(String searchParam) {
this.searchParam = searchParam;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}
package com.gic.haoban.manage.web.qo.open;
import java.io.Serializable;
public class AlarmWordsQO implements Serializable {
/**敏感词*/
private String words;
public String getWords() {
return words;
}
public void setWords(String words) {
this.words = words;
}
}
package com.gic.haoban.manage.web.qo.open;
import com.gic.api.base.commons.BasePageInfo;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class OpenStaffQO extends BasePageInfo implements Serializable{
/**
* 1授权中 2已过期 3待验证 4待授权 0全部
*/
private int status ;
/**
* 导购
*/
private String clerkId ;
/**
* 成员
*/
private String staffParams ;
/**
* 门店分组
*/
private List<String> storeGroupIdList ;
/**
* 开始日期
*/
private Date startDate ;
/**
* 结束日期
*/
private Date endDate ;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getStaffParams() {
return staffParams;
}
public void setStaffParams(String staffParams) {
this.staffParams = staffParams;
}
public List<String> getStoreGroupIdList() {
return storeGroupIdList;
}
public void setStoreGroupIdList(List<String> storeGroupIdList) {
this.storeGroupIdList = storeGroupIdList;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
/**
* 会员分组信息VO
* @Author: FangXu
* @Date: 2018/12/17 13:55
* @Version 1.0
*/
public class MemberTagGroupVO implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6813792225053490935L;
/** 分组名称 **/
private String groupName;
/** 分组ID **/
private String memberTagGroupId;
/** 分组有效状态 **/
private Integer effectiveStatus;
/** 失效状态: 实时, 非实时 **/
private Integer isRealTime;
/**
* 0普通分组 1固化分组
*/
private Integer fixedType;
public Integer getFixedType() {
return fixedType;
}
public void setFixedType(Integer fixedType) {
this.fixedType = fixedType;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getMemberTagGroupId() {
return memberTagGroupId;
}
public void setMemberTagGroupId(String memberTagGroupId) {
this.memberTagGroupId = memberTagGroupId;
}
public Integer getEffectiveStatus() {
return effectiveStatus;
}
public void setEffectiveStatus(Integer effectiveStatus) {
this.effectiveStatus = effectiveStatus;
}
public Integer getIsRealTime() {
return isRealTime;
}
public void setIsRealTime(Integer isRealTime) {
this.isRealTime = isRealTime;
}
}
package com.gic.haoban.manage.web.vo.open;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.gic.web.common.jsonSeralizer.CardNoJsonSeralizer;
import com.gic.web.common.jsonSeralizer.PhoneNumberJsonSeralizer;
import com.gic.web.common.jsonSeralizer.UserNameJsonSeralizer;
import java.io.Serializable;
import java.util.Date;
public class AddMemberExcelVO implements Serializable {
/**
* 申请时间
*/
private String applyTimeExcel;
/**
* 加成功时间
*/
private String addTimeExcel;
/**
* 会员Nick
*/
@JsonSerialize(using = UserNameJsonSeralizer.class)
private String memberNick;
/**
* 会员姓名
*/
@JsonSerialize(using = UserNameJsonSeralizer.class)
private String memberName;
/**
* 会员卡
*/
@JsonSerialize(using = CardNoJsonSeralizer.class)
private String memberCard;
/**
* 会员手机号
*/
@JsonSerialize(using = PhoneNumberJsonSeralizer.class)
private String memberPhone;
/**
* 导购code
*/
private String clerkCode;
/**
* 导购名称
*/
private String clerkName;
/**
* 门店
*/
private String storeCode;
/**
* 门店
*/
private String storeName;
private String staffName;
private String statusExcel;
public String getApplyTimeExcel() {
return applyTimeExcel;
}
public void setApplyTimeExcel(String applyTimeExcel) {
this.applyTimeExcel = applyTimeExcel;
}
public String getAddTimeExcel() {
return addTimeExcel;
}
public void setAddTimeExcel(String addTimeExcel) {
this.addTimeExcel = addTimeExcel;
}
public String getMemberNick() {
return memberNick;
}
public void setMemberNick(String memberNick) {
this.memberNick = memberNick;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public String getMemberCard() {
return memberCard;
}
public void setMemberCard(String memberCard) {
this.memberCard = memberCard;
}
public String getMemberPhone() {
return memberPhone;
}
public void setMemberPhone(String memberPhone) {
this.memberPhone = memberPhone;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getStatusExcel() {
return statusExcel;
}
public void setStatusExcel(String statusExcel) {
this.statusExcel = statusExcel;
}
}
package com.gic.haoban.manage.web.vo.open;
import com.gic.haoban.manage.web.vo.MemberTagGroupVO;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class AddTaskDetailVO implements Serializable {
/**id*/
private Long addTaskId;
/**企业id*/
private String wxEnterpriseId;
/**企业id*/
private String enterpriseId;
/**任务名称*/
private String name;
/**会员标签*/
private String memberLabelId;
private String memberLabelName ;
private int memberLabelStatus ;
/**开始时间*/
private java.util.Date startTime;
/**结束时间*/
private java.util.Date endTime;
/**欢迎语*/
private String welcomeId;
/**(0:会员筛选, 1:会员分组)*/
private int memberType;
/**人群筛选条件(JSON)*/
private String searchParams;
/**1和专属无好友 2和所有无好友*/
private int memberRule;
private java.util.Date createTime;
private java.util.Date updateTime;
/**创建人*/
private String creatorId;
/**创建人*/
private String creatorName;
/**是否删除*/
private int deleteFlag;
/**状态*/
private int statusFlag;
/**申请数 */
private int applyNum ;
/**添加成功数 */
private int addNum ;
/** 人群id用于回显 */
private String searchParamsId ;
private List<MemberTagGroupVO> tagGroupList;
public List<MemberTagGroupVO> getTagGroupList() {
return tagGroupList;
}
public void setTagGroupList(List<MemberTagGroupVO> tagGroupList) {
this.tagGroupList = tagGroupList;
}
public String getSearchParamsId() {
return searchParamsId;
}
public void setSearchParamsId(String searchParamsId) {
this.searchParamsId = searchParamsId;
}
public Long getAddTaskId() {
return addTaskId;
}
public void setAddTaskId(Long addTaskId) {
this.addTaskId = addTaskId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMemberLabelId() {
return memberLabelId;
}
public void setMemberLabelId(String memberLabelId) {
this.memberLabelId = memberLabelId;
}
public String getMemberLabelName() {
return memberLabelName;
}
public void setMemberLabelName(String memberLabelName) {
this.memberLabelName = memberLabelName;
}
public int getMemberLabelStatus() {
return memberLabelStatus;
}
public void setMemberLabelStatus(int memberLabelStatus) {
this.memberLabelStatus = memberLabelStatus;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getWelcomeId() {
return welcomeId;
}
public void setWelcomeId(String welcomeId) {
this.welcomeId = welcomeId;
}
public int getMemberType() {
return memberType;
}
public void setMemberType(int memberType) {
this.memberType = memberType;
}
public String getSearchParams() {
return searchParams;
}
public void setSearchParams(String searchParams) {
this.searchParams = searchParams;
}
public int getMemberRule() {
return memberRule;
}
public void setMemberRule(int memberRule) {
this.memberRule = memberRule;
}
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;
}
public String getCreatorId() {
return creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
public int getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(int deleteFlag) {
this.deleteFlag = deleteFlag;
}
public int getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(int statusFlag) {
this.statusFlag = statusFlag;
}
public int getApplyNum() {
return applyNum;
}
public void setApplyNum(int applyNum) {
this.applyNum = applyNum;
}
public int getAddNum() {
return addNum;
}
public void setAddNum(int addNum) {
this.addNum = addNum;
}
}
package com.gic.haoban.manage.web.vo.open;
import com.gic.haoban.task.manage.api.dto.open.OpenQwAddTaskDataDTO;
import java.io.Serializable;
import java.util.List;
public class OpenAddDataVO implements Serializable {
/**
* 申请数
*/
private int applyNum ;
/**
* 添加成功数
*/
private int addNum ;
private List<OpenQwAddTaskDataDTO> list ;
public int getApplyNum() {
return applyNum;
}
public void setApplyNum(int applyNum) {
this.applyNum = applyNum;
}
public int getAddNum() {
return addNum;
}
public void setAddNum(int addNum) {
this.addNum = addNum;
}
public List<OpenQwAddTaskDataDTO> getList() {
return list;
}
public void setList(List<OpenQwAddTaskDataDTO> list) {
this.list = list;
}
}
package com.gic.haoban.manage.web.vo.open;
import com.gic.haoban.manage.api.dto.OpenStaffLicenseDTO;
import java.io.Serializable;
import java.util.Date;
/**
* 托管账号信息
*/
public class OpenQwAccountInfoVO extends OpenStaffLicenseDTO implements Serializable {
// 0为购买 1已购买且有效 2已过期
private int status;
/**
* 到期时间
*/
private Date expireDate;
/**
* 版本
*/
private Integer version ;
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getExpireDate() {
return expireDate;
}
public void setExpireDate(Date expireDate) {
this.expireDate = expireDate;
}
}
package com.gic.haoban.manage.web.vo.open;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.gic.web.common.jsonSeralizer.CardNoJsonSeralizer;
import com.gic.web.common.jsonSeralizer.PhoneNumberJsonSeralizer;
import com.gic.web.common.jsonSeralizer.UserNameJsonSeralizer;
import java.io.Serializable;
import java.util.Date;
/**
* @ClassName: TabOpenQwAlarmLog
* @Description: TODO
* @Author 徐高华
* @Date 2024年06月12日 12:45:27
* @Modify
* @CopyRight 杭州
*/
public class OpenQwAlarmLogExcelVO implements Serializable {
private static final long serialVersionUID = 98010897759200L;
/**
* 1单聊 2群聊
*/
private String chatTypeExcel;
/**
* 敏感词
*/
private String alarmWords;
/**
* 内容
*/
private String content;
/**
* 昵称
*/
@JsonSerialize(using = UserNameJsonSeralizer.class)
private String memberName;
/**
* 创建时间
*/
private String createTimeExcel;
/**
* 群名称
*/
private String groupChatName;
/**
* 会员Nick
*/
@JsonSerialize(using = UserNameJsonSeralizer.class)
private String memberNick;
/**
* 会员卡
*/
@JsonSerialize(using = CardNoJsonSeralizer.class)
private String memberCard;
/**
* 手机号
*/
@JsonSerialize(using = PhoneNumberJsonSeralizer.class)
private String memberPhone;
/**
* 导购
*/
private String clerkCode;
/**
* 导购
*/
private String clerkName;
/**
* 门店
*/
private String storeCode;
/**
* 门店
*/
private String storeName;
/**
* 成员名称
*/
private String staffName ;
public String getChatTypeExcel() {
return chatTypeExcel;
}
public void setChatTypeExcel(String chatTypeExcel) {
this.chatTypeExcel = chatTypeExcel;
}
public String getAlarmWords() {
return alarmWords;
}
public void setAlarmWords(String alarmWords) {
this.alarmWords = alarmWords;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public String getCreateTimeExcel() {
return createTimeExcel;
}
public void setCreateTimeExcel(String createTimeExcel) {
this.createTimeExcel = createTimeExcel;
}
public String getGroupChatName() {
return groupChatName;
}
public void setGroupChatName(String groupChatName) {
this.groupChatName = groupChatName;
}
public String getMemberNick() {
return memberNick;
}
public void setMemberNick(String memberNick) {
this.memberNick = memberNick;
}
public String getMemberCard() {
return memberCard;
}
public void setMemberCard(String memberCard) {
this.memberCard = memberCard;
}
public String getMemberPhone() {
return memberPhone;
}
public void setMemberPhone(String memberPhone) {
this.memberPhone = memberPhone;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
}
\ No newline at end of file
package com.gic.haoban.manage.web.vo.open;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class OpenStaffExcelVO implements Serializable {
/**
* 成员名称
*/
private String staffName;
/**
* 成员code
*/
private String wxUserId;
/**
* 品牌名称
*/
private String brandName;
private String clerkNames;
private String clerkCodes;
private String storeNames;
private String storeCodes;
/**
* 创建时间
*/
private String createTimeExcel;
/**
* 1授权中 2未登录(已过期)
*/
private String statusExcel;
private String lastTimeExcel;
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public String getClerkNames() {
return clerkNames;
}
public void setClerkNames(String clerkNames) {
this.clerkNames = clerkNames;
}
public String getClerkCodes() {
return clerkCodes;
}
public void setClerkCodes(String clerkCodes) {
this.clerkCodes = clerkCodes;
}
public String getStoreNames() {
return storeNames;
}
public void setStoreNames(String storeNames) {
this.storeNames = storeNames;
}
public String getStoreCodes() {
return storeCodes;
}
public void setStoreCodes(String storeCodes) {
this.storeCodes = storeCodes;
}
public String getCreateTimeExcel() {
return createTimeExcel;
}
public void setCreateTimeExcel(String createTimeExcel) {
this.createTimeExcel = createTimeExcel;
}
public String getStatusExcel() {
return statusExcel;
}
public void setStatusExcel(String statusExcel) {
this.statusExcel = statusExcel;
}
public String getLastTimeExcel() {
return lastTimeExcel;
}
public void setLastTimeExcel(String lastTimeExcel) {
this.lastTimeExcel = lastTimeExcel;
}
}
\ No newline at end of file
package com.gic.haoban.manage.web.vo.open;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class OpenStaffVO implements Serializable {
/**
* 主键
*/
private Long openStaffId;
/**
* 成员id
*/
private String staffId;
/**
* 成员名称
*/
private String staffName ;
/**
* 关联导购
*/
List<StoreClerkVO> clerkList ;
/**
* 品牌名称
*/
private String brandName ;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 客户端id
*/
private String uuid;
/**
* 1授权中 2未登录(已过期)
*/
private Integer statusFlag;
/**
* 登录步骤1已扫码 2取消登录 3超时 4验证码正确
*/
private Integer step;
/**
* 企微的userid
*/
private Long qwUserId;
/**
* 企微的企业id
*/
private Long wxCorpId;
/**
* 一次扫码内容
*/
private String qrCode1;
/**
* 一次扫码内容
*/
private String key1;
/**
* 二次扫码内容
*/
private String qrCode2;
/**
* 二次扫码内容
*/
private String key2;
/**
* 是否需要验证码
*/
private Integer validFlag;
/**
* 最新授权时间
*/
private Date authTime;
/**
* 首次授权时间
*/
private Date firstAuthTime;
/**
* 需要二次扫码
*/
private Integer validQrcodeFlag ;
public Long getOpenStaffId() {
return openStaffId;
}
public void setOpenStaffId(Long openStaffId) {
this.openStaffId = openStaffId;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public List<StoreClerkVO> getClerkList() {
return clerkList;
}
public void setClerkList(List<StoreClerkVO> clerkList) {
this.clerkList = clerkList;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
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;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Integer getStep() {
return step;
}
public void setStep(Integer step) {
this.step = step;
}
public Long getQwUserId() {
return qwUserId;
}
public void setQwUserId(Long qwUserId) {
this.qwUserId = qwUserId;
}
public Long getWxCorpId() {
return wxCorpId;
}
public void setWxCorpId(Long wxCorpId) {
this.wxCorpId = wxCorpId;
}
public String getQrCode1() {
return qrCode1;
}
public void setQrCode1(String qrCode1) {
this.qrCode1 = qrCode1;
}
public String getKey1() {
return key1;
}
public void setKey1(String key1) {
this.key1 = key1;
}
public String getQrCode2() {
return qrCode2;
}
public void setQrCode2(String qrCode2) {
this.qrCode2 = qrCode2;
}
public String getKey2() {
return key2;
}
public void setKey2(String key2) {
this.key2 = key2;
}
public Integer getValidFlag() {
return validFlag;
}
public void setValidFlag(Integer validFlag) {
this.validFlag = validFlag;
}
public Date getAuthTime() {
return authTime;
}
public void setAuthTime(Date authTime) {
this.authTime = authTime;
}
public Date getFirstAuthTime() {
return firstAuthTime;
}
public void setFirstAuthTime(Date firstAuthTime) {
this.firstAuthTime = firstAuthTime;
}
public Integer getValidQrcodeFlag() {
return validQrcodeFlag;
}
public void setValidQrcodeFlag(Integer validQrcodeFlag) {
this.validQrcodeFlag = validQrcodeFlag;
}
}
package com.gic.haoban.manage.web.vo.open;
import java.io.Serializable;
public class StoreClerkVO implements Serializable {
private String storeId ;
private String storeName ;
private String storeCode ;
private String clerkId ;
private String clerkName ;
private String clerkCode ;
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
}
......@@ -14,6 +14,10 @@
<dubbo:application name="haoban-manage3-web"/>
<dubbo:protocol name="dubbo" port="30009"/>
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
<dubbo:reference interface="com.gic.member.tag.api.service.MemberTagGroupApiService" id="memberTagGroupApiService"/>
<dubbo:reference interface="com.gic.haoban.task.manage.api.service.OpenQwApiService" id="openQwApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.OpenStaffApiService" id="openStaffApiService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseActiveDataApiService" id="wxEnterpriseActiveDataApiService" timeout="10000"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DownloadReportService" id="downloadReportService" timeout="10000"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.chat.GroupChatDataApiService" id="groupChatDataApiService" timeout="10000"/>
......
......@@ -3,6 +3,8 @@ package com.gic.haoban.manage.web.controller;
import com.alibaba.fastjson.JSON;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.GlobalVar;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.utils.CheckSmsCodeUtil;
import com.gic.haoban.common.utils.GooglePhoneNumberUtil;
......@@ -11,6 +13,7 @@ import com.gic.haoban.manage.api.response.SendSmsResponse;
import com.gic.haoban.manage.api.service.ValidationCodeApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.redis.data.util.RedisUtil;
import com.task.allocation.util.MemCachedInstance;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -19,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@RestController
public class SendCodeController extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(SendCodeController.class);
......@@ -27,6 +32,8 @@ public class SendCodeController extends WebBaseController {
private ValidationCodeApiService validationCodeService;
@Autowired
private ClerkService clerkService ;
static MemCachedInstance memCachedInstance = MemCachedInstance.getInstance(
GlobalVar.getMemCachedIp(), GlobalVar.getMemCachedPort());
/**
* 验证码发送
......@@ -61,7 +68,10 @@ public class SendCodeController extends WebBaseController {
} else {
RedisUtil.setCache(cacheKey, true, 60L);
}
if (this.getVcodeTimes(phoneNumber) <= 0) {
logger.info("验证 达到上线");
return this.fail("验证码发送达到上限") ;
}
String smsCode = "";
if (CheckSmsCodeUtil.getCacheSmsCode(nationcode + "-" + phoneNumber, type) != null) {
smsCode = (String) CheckSmsCodeUtil.getCacheSmsCode(nationcode + "-" + phoneNumber, type);
......@@ -111,4 +121,23 @@ public class SendCodeController extends WebBaseController {
}
}
public static int getVcodeTimes(String phoneNumber) {
String key = phoneNumber
+ DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATE_8);
int times = 10;
Object res = memCachedInstance.getValue(key);
logger.info("好办验证码次数={}",res);
if (null == res) {
memCachedInstance.setValue(key, 10, 24 * 60 * 60 * 1000);
}
else {
times = Integer.parseInt(String.valueOf(res));
}
if (times > 0) {
memCachedInstance.setValue(key, (times - 1), 24 * 60 * 60 * 1000);
}
return times;
}
}
package com.gic.haoban.manage.web.controller.haoban;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.qdto.OpenStaffInitQDTO;
import com.gic.haoban.manage.api.service.OpenStaffApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.vo.OpenStaffVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 企微托管-好办小程序
*/
@RestController
@RequestMapping("/qw-open")
public class QywxOpenController {
@Autowired
private OpenStaffApiService openStaffApiService ;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService ;
@Autowired
private StaffApiService staffApiService ;
/**
* 获取详情
* @param staffId
* @param authFlag 1授权 0查询
* @return
*/
@RequestMapping("get-open-staff")
public RestResponse<OpenStaffVO> getOpenStaff(String staffId , @RequestParam(defaultValue = "0") int authFlag) {
ServiceResponse<OpenStaffDTO> resp = this.openStaffApiService.getByStaffId(staffId) ;
if(!resp.isSuccess()) {
return RestResponse.failure("9999","数据查询失败");
}
OpenStaffVO vo = new OpenStaffVO() ;
OpenStaffDTO dto = resp.getResult();
String wxEnterpriseId = dto.getWxEnterpriseId() ;
String enterpriseId = dto.getEnterpriseId() ;
WxEnterpriseDTO en = this.wxEnterpriseApiService.getOne(wxEnterpriseId) ;
vo.setCorpName(en.getCorpName());
StaffDTO staffDTO = this.staffApiService.selectById(staffId) ;
vo.setStaffName(staffDTO.getStaffName());
vo.setStaffImage(staffDTO.getHeadImg());
if(dto.getStatusFlag()==1) {
if(authFlag==1) {
//return RestResponse.failure("9999","无需授权,账号托管中");
vo.setStatusFlag(1);
return RestResponse.successResult(vo);
}
vo.setStatusFlag(1);
}else {
vo.setStatusFlag(2);
if(authFlag==1) {
OpenStaffInitQDTO qdto = new OpenStaffInitQDTO() ;
qdto.setStaffId(staffId);
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setEnterpriseId(enterpriseId);
ServiceResponse<OpenStaffDTO> codeResp = this.openStaffApiService.init(qdto) ;
if(null == codeResp.getResult()) {
return RestResponse.failure("9999",codeResp.getMessage());
}
vo.setQrcode(codeResp.getResult().getQrCode1());
vo.setQrcodeData(codeResp.getResult().getQrcodeData());
vo.setStatusFlag(codeResp.getResult().getStatusFlag());
}
}
return RestResponse.successResult(vo);
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
public class OpenStaffVO implements Serializable {
/**
* 成员名称
*/
private String staffName ;
/**
* 成员头像
*/
private String staffImage ;
/**
* 企业名称
*/
private String corpName ;
/**
* 1 已登录 2未登录
*/
private Integer statusFlag ;
/**
* 二维码
*/
private String qrcode ;
/**
* base64
*/
private String qrcodeData ;
public String getQrcodeData() {
return qrcodeData;
}
public void setQrcodeData(String qrcodeData) {
this.qrcodeData = qrcodeData;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getStaffImage() {
return staffImage;
}
public void setStaffImage(String staffImage) {
this.staffImage = staffImage;
}
public String getCorpName() {
return corpName;
}
public void setCorpName(String corpName) {
this.corpName = corpName;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public String getQrcode() {
return qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
}
......@@ -13,6 +13,7 @@
<dubbo:application name="haoban-manage3-wx"/>
<dubbo:protocol name="dubbo" port="30010"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.OpenStaffApiService" id="openStaffApiService" />
<dubbo:reference interface="com.gic.haoban.manage.api.service.chat.GroupChatPlanApiService" id="groupChatPlanApiService" />
<dubbo:reference interface="com.gic.member.api.service.GradeService" id="gradeService" />
<dubbo:reference interface="com.gic.ecm.api.service.EcmPlanService" id="ecmPlanService" />
......
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