Commit 88913038 by 徐高华

parent bd5c9812
......@@ -19,16 +19,15 @@ import com.gic.haoban.manage.service.entity.chat.TabGroupChat;
* @CopyRight
*/
public interface GroupChatMapper {
public int getCountByStaffId(String staffId) ;
public int insert(TabGroupChat tabHaobanGroupChat);
public int deleteByPrimaryKey(Long groupChatId);
public int getCountByStaffId(String staffId);
public int update(TabGroupChat tabHaobanGroupChat);
public void updateWxChatId3th(@Param("staffId")String staffId , @Param("name")String name , @Param("chatAddTime")Date chatAddTime , @Param("wxChatId3th")String wxChatId3th);
public int insert(TabGroupChat chat);
public int update(TabGroupChat chat);
public void updateWxChatIdDk(@Param("staffId") String staffId, @Param("name") String name,
@Param("chatAddTime") Date chatAddTime, @Param("wxChatIdDk") String wxChatIdDk);
public int updateData();
......@@ -42,13 +41,9 @@ public interface GroupChatMapper {
public TabGroupChat selectByWxChatId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxChatId") String wxChatId);
public TabGroupChat selectByWxChatId3th(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxChatId3th") String wxChatId3th);
public List<TabGroupChat> listAllNeedInit();
public List<TabGroupChat> listAllNeedInitWxChatId3th();
public List<TabGroupChat> listAllNeedInitWxChatIdDk();
public List<TabGroupChat> list(GroupChatSearchQDTO qdto);
......
......@@ -53,7 +53,7 @@ public class TabGroupChat implements Serializable{
private String enterpriseId;
private Integer gicFlag;
private Integer initFlag ;
private String wxChatId3th;
private String wxChatIdDk;
private Date offTime ;
private String originalStaffId ;
......@@ -73,12 +73,12 @@ public class TabGroupChat implements Serializable{
this.originalStaffId = originalStaffId;
}
public String getWxChatId3th() {
return wxChatId3th;
public String getWxChatIdDk() {
return wxChatIdDk;
}
public void setWxChatId3th(String wxChatId3th) {
this.wxChatId3th = wxChatId3th;
public void setWxChatIdDk(String wxChatIdDk) {
this.wxChatIdDk = wxChatIdDk;
}
public Integer getInitFlag() {
......
package com.gic.haoban.manage.service.entity.chat;
import java.io.Serializable ;
import java.util.Date;
/**
*
......@@ -31,7 +30,6 @@ public class TabGroupChatPlanLog implements Serializable{
private java.util.Date updateTime;
private String enterpriseId ;
private Integer deleteFlag ;
private String wxChatId3th ;
public String getStaffId() {
return staffId;
......@@ -41,14 +39,6 @@ public class TabGroupChatPlanLog implements Serializable{
this.staffId = staffId;
}
public String getWxChatId3th() {
return wxChatId3th;
}
public void setWxChatId3th(String wxChatId3th) {
this.wxChatId3th = wxChatId3th;
}
public String getEnterpriseId() {
return enterpriseId;
}
......
......@@ -54,8 +54,6 @@ public interface GroupChatService {
public GroupChatBO getByWxChatId(String wxEnterpriseId, String wxChatId);
public GroupChatBO getByWxChatId3th(String wxEnterpriseId, String wxChatId3th);
/**
*
* @Title: listPage
......
......@@ -199,7 +199,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
this.groupChatPlanOwnerLogService.updateSendCount(ownerLog.getOwnerLogId(), sendCount,
list.get(0).getSendTime());
for (QywxSendMessageResultDTO item : list) {
String wxChatId3th = item.getChatId();
String wxChatId = item.getChatId();
Date sendTime = item.getSendTime();
TabGroupChatPlanLog entity = new TabGroupChatPlanLog();
entity.setLogId(UniqueIdUtils.uniqueLong());
......@@ -207,9 +207,8 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
entity.setOwnLogId(ownerLog.getOwnerLogId());
entity.setWxEnterpriseId(wxEnterpriseId);
entity.setEnterpriseId(enterpriseId);
entity.setWxChatId3th(wxChatId3th);
entity.setStaffId(staffId);
GroupChatBO chat = this.groupChatService.getByWxChatId3th(wxEnterpriseId, wxChatId3th);
GroupChatBO chat = this.groupChatService.getByWxChatId(wxEnterpriseId, wxChatId);
if (null != chat) {
entity.setGroupChatId(chat.getGroupChatId());
}
......
......@@ -177,12 +177,6 @@ public class GroupChatServiceImpl implements GroupChatService {
}
@Override
public GroupChatBO getByWxChatId3th(String wxEnterpriseId, String wxChatId3th) {
TabGroupChat groupChat = this.groupChatMapper.selectByWxChatId3th(wxEnterpriseId, wxChatId3th);
return EntityUtil.changeEntity(GroupChatBO.class, groupChat);
}
@Override
public Page<GroupChatBO> listPage(GroupChatSearchQDTO qdto, BasePageInfo basePageInfo) {
PageHelper.startPage(basePageInfo);
List<TabGroupChat> list = this.groupChatMapper.list(qdto);
......@@ -233,11 +227,11 @@ public class GroupChatServiceImpl implements GroupChatService {
}
}
List<TabGroupChat> list = this.groupChatMapper.listAllNeedInitWxChatId3th();
List<TabGroupChat> list = this.groupChatMapper.listAllNeedInitWxChatIdDk();
for (TabGroupChat item : list) {
String wxEnterpriseId = item.getWxEnterpriseId();
String staffId = item.getStaffId();
this.updateWxChatId3th(wxEnterpriseId, staffId);
this.updateWxChatIdDk(wxEnterpriseId, staffId);
}
}
......@@ -302,13 +296,7 @@ public class GroupChatServiceImpl implements GroupChatService {
private void syncGroupChatList(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor,
boolean syncDetailFlag) {
logger.info("qwDTO={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor);
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(),
SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting) {
logger.info("未配置代开应用");
}
String secret = secretSetting.getSecretVal();
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList(qwDTO.getDkCorpid(), secret,
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList3th(qwDTO.getDkCorpid(), config.getWxSuiteid(),
userIdList, limit, cursor);
if (!resp.isSuccess()) {
logger.info("拉取群列表异常={}", JSON.toJSON(resp));
......@@ -378,14 +366,8 @@ public class GroupChatServiceImpl implements GroupChatService {
Long groupChatId = chat.getGroupChatId();
String wxEnterpriseId = chat.getWxEnterpriseId();
String enterpriseId = chat.getEnterpriseId();
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId,
SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting) {
logger.info("没有配置代开应用");
}
String secret = secretSetting.getSecretVal();
ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService.groupchatDetail(qwDTO.getDkCorpid(),
secret, chat.getWxChatId(), 1);
ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService.groupchatDetail3th(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), chat.getWxChatId(), 1);
GroupChatDetailDTO detail = detailResp.getResult();
chat.setGroupChatId(groupChatId);
......@@ -558,20 +540,26 @@ public class GroupChatServiceImpl implements GroupChatService {
return wxEnterprise.getWxEnterpriseId();
}
private void updateWxChatId3th(String wxEnterpriseId, String staffId) {
private void updateWxChatIdDk(String wxEnterpriseId, String staffId) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
TabHaobanStaff stff = this.staffMapper.selectByPrimaryKey(staffId);
String userid = stff.getWxUserId();
if (qwDTO.needOpenUserId3th()) {
if (qwDTO.needOpenUserIdDk()) {
userid = stff.getWxOpenUseId();
}
this.updateWxChatId3th(qwDTO, Arrays.asList(userid), null, staffId);
this.updateWxChatIdDk(qwDTO, Arrays.asList(userid), null, staffId);
}
private void updateWxChatId3th(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor, String staffId) {
private void updateWxChatIdDk(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor, String staffId) {
logger.info("qwDTO={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor);
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList3th(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), userIdList, limit, cursor);
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(),
SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting) {
logger.info("未配置代开应用");
}
String secret = secretSetting.getSecretVal();
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList(qwDTO.getDkCorpid(),
secret, userIdList, limit, cursor);
if (!resp.isSuccess()) {
logger.info("拉取群异常={}", JSON.toJSON(resp));
return;
......@@ -580,18 +568,18 @@ public class GroupChatServiceImpl implements GroupChatService {
cursor = dto.getNext_cursor();
List<GroupChatListItemDTO> list = dto.getGroup_chat_list();
for (GroupChatListItemDTO item : list) {
String wxChatId3th = item.getChat_id();
String wxChatIdDk = item.getChat_id();
// 控制同时刷新
ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService
.groupchatDetail3th(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxChatId3th, 1);
.groupchatDetail(qwDTO.getDkCorpid(), secret, wxChatIdDk, 1);
GroupChatDetailDTO detail = detailResp.getResult();
Long createTimeLong = detail.getCreate_time() * 1000;
String name = detail.getName();
this.groupChatMapper.updateWxChatId3th(staffId, name, new Date(createTimeLong), wxChatId3th);
this.groupChatMapper.updateWxChatIdDk(staffId, name, new Date(createTimeLong), wxChatIdDk);
}
// 从企微拉取下一批数据
if (org.apache.commons.lang3.StringUtils.isNotBlank(cursor)) {
this.updateWxChatId3th(qwDTO, userIdList, cursor, staffId);
this.updateWxChatIdDk(qwDTO, userIdList, cursor, staffId);
}
}
......
......@@ -24,7 +24,7 @@
<result column="enterprise_id" property="enterpriseId" />
<result column="gic_flag" property="gicFlag" />
<result column="init_flag" property="initFlag" />
<result column="wx_chat_id_3th" property="wxChatId3th" />
<result column="wx_chat_id_dk" property="wxChatIdDk" />
<result column="off_time" property="offTime"/>
<result column="original_staff_id" property="originalStaffId"/>
</resultMap>
......@@ -48,7 +48,7 @@
quit_count,
quit_member_count,
enterprise_id,
gic_flag , init_flag , wx_chat_id_3th , off_time, original_staff_id
gic_flag , init_flag , wx_chat_id_dk , off_time, original_staff_id
</sql>
<!-- ===================== 新增 ======================== -->
<insert id="insert"
......@@ -100,14 +100,6 @@
]]>
</insert>
<!-- =====================删除==================== -->
<update id="deleteByPrimaryKey" parameterType="long">
UPDATE
tab_haoban_group_chat SET delete_flag = 1 , update_time=now() WHERE group_chat_id =
#{groupChatId}
</update>
<!-- ==================更新 ========== -->
<update id="update" parameterType="com.gic.haoban.manage.service.entity.chat.TabGroupChat">
<![CDATA[
......@@ -127,8 +119,8 @@
]]>
</update>
<update id="updateWxChatId3th">
update tab_haoban_group_chat set wx_chat_id_3th=#{wxChatId3th} where staff_id = #{staffId} and chat_add_time=#{chatAddTime} and name=#{name}
<update id="updateWxChatIdDk">
update tab_haoban_group_chat set wx_chat_id_dk=#{wxChatIdDk} where staff_id = #{staffId} and chat_add_time=#{chatAddTime} and name=#{name}
</update>
<update id="updateChatStatus">
......@@ -167,13 +159,6 @@
and delete_flag = 0
</select>
<select id="selectByWxChatId3th" resultMap="result-map-tabHaobanGroupChat">
select
<include refid="Base_Column_List" />
FROM tab_haoban_group_chat WHERE wx_chat_id_3th = #{wxChatId3th}
and wx_enterprise_id = #{wxEnterpriseId}
and delete_flag = 0
</select>
<select id="getCountByStaffId" resultType="int">
select count(*) from tab_haoban_group_chat where staff_id = #{staffId} and delete_flag = 0
......@@ -183,8 +168,8 @@
select <include refid="Base_Column_List" /> from tab_haoban_group_chat where create_time > DATE_ADD(NOW(),INTERVAL -7 day) and init_flag = 0
</select>
<select id="listAllNeedInitWxChatId3th" resultMap="result-map-tabHaobanGroupChat">
select wx_enterprise_id wxEnterpriseId , staff_id staffId from tab_haoban_group_chat where create_time > DATE_ADD(NOW(),INTERVAL -1 day) and wx_chat_id_3th is null and init_flag = 1 and name is not null
<select id="listAllNeedInitWxChatIdDk" resultMap="result-map-tabHaobanGroupChat">
select wx_enterprise_id wxEnterpriseId , staff_id staffId from tab_haoban_group_chat where create_time > DATE_ADD(NOW(),INTERVAL -1 day) and wx_chat_id_dk is null and init_flag = 1 and name is not null
group by wx_enterprise_id , staff_id
</select>
......
......@@ -14,7 +14,6 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_flag" property="deleteFlag"/>
<result column="wx_chat_id_3th" property="wxChatId3th"/>
<result column="staff_id" property="staffId"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -29,7 +28,7 @@
send_time,
delete_flag,
create_time,
update_time , wx_chat_id_3th , staff_id
update_time , staff_id
</sql>
<!-- ===================== 新增 ======================== -->
......@@ -47,7 +46,7 @@
send_time,
delete_flag,
create_time,
update_time , wx_chat_id_3th , staff_id
update_time , staff_id
)VALUES(
#{logId},
#{planId},
......@@ -60,7 +59,7 @@
#{sendTime},
0,
now(),
now() , #{wxChatId3th} , #{staffId}
now() ,#{staffId}
)
]]>
</insert>
......
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