Commit c8025a4b by 裴大威

Merge branch 'zcy/addIp' into 'master'

add ip

See merge request rays/pcloud-book!72
parents 384a9a26 dfe53c32
...@@ -26,6 +26,10 @@ public class BookWxQrcodeDTO implements Serializable { ...@@ -26,6 +26,10 @@ public class BookWxQrcodeDTO implements Serializable {
*/ */
private String robotWxId; private String robotWxId;
private Integer generation;
private String wechatGroupIp;
public String getWeixinGroupId() { public String getWeixinGroupId() {
return weixinGroupId; return weixinGroupId;
} }
...@@ -42,6 +46,22 @@ public class BookWxQrcodeDTO implements Serializable { ...@@ -42,6 +46,22 @@ public class BookWxQrcodeDTO implements Serializable {
this.robotWxId = robotWxId; this.robotWxId = robotWxId;
} }
public Integer getGeneration() {
return generation;
}
public void setGeneration(Integer generation) {
this.generation = generation;
}
public String getWechatGroupIp() {
return wechatGroupIp;
}
public void setWechatGroupIp(String wechatGroupIp) {
this.wechatGroupIp = wechatGroupIp;
}
@Override @Override
public String toString() { public String toString() {
return "BookWxQrcodeDTO{" + return "BookWxQrcodeDTO{" +
......
...@@ -2,12 +2,16 @@ package com.pcloud.book.group.dto; ...@@ -2,12 +2,16 @@ package com.pcloud.book.group.dto;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data;
/** /**
* @author lily * @author lily
* @date 2019/3/5 9:49 * @date 2019/3/5 9:49
*/ */
@Data
public class UpdateQrDTO implements Serializable { public class UpdateQrDTO implements Serializable {
private static final long serialVersionUID = 7244150746099558299L;
/** /**
* 群二维码标识 * 群二维码标识
*/ */
...@@ -30,54 +34,11 @@ public class UpdateQrDTO implements Serializable { ...@@ -30,54 +34,11 @@ public class UpdateQrDTO implements Serializable {
*/ */
private String robotWxId; private String robotWxId;
public String getRobotWxId() { /**
return robotWxId; * com.sdk.wxgroup.RefreshUrlEnum
} */
private Integer env;
public void setRobotWxId(String robotWxId) {
this.robotWxId = robotWxId;
}
public String getRequestUrl() {
return requestUrl;
}
public void setRequestUrl(String requestUrl) {
this.requestUrl = requestUrl;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Integer getUpdateState() {
return updateState;
}
public void setUpdateState(Integer updateState) { private Integer generation;
this.updateState = updateState;
}
@Override
public String toString() {
return "UpdateQrDTO{" +
"id=" + id +
", url='" + url + '\'' +
", updateState=" + updateState +
", requestUrl='" + requestUrl + '\'' +
", robotWxId='" + robotWxId + '\'' +
'}';
}
} }
...@@ -13,6 +13,8 @@ import org.springframework.http.ResponseEntity; ...@@ -13,6 +13,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
...@@ -77,6 +79,10 @@ public interface WeixinQrcodeService { ...@@ -77,6 +79,10 @@ public interface WeixinQrcodeService {
@GetMapping("inviteNewRobot") @GetMapping("inviteNewRobot")
void inviteNewRobot(@RequestParam("wxUserId") String wxUserId); void inviteNewRobot(@RequestParam("wxUserId") String wxUserId);
@ApiOperation(value = "通过群id获取群版本信息", httpMethod = "GET")
@RequestMapping(value = "getGroupVersionIp", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Map<String, BookWxQrcodeDTO>>> getGroupVersionIp(@RequestBody List<String> wxGroupIds);
} }
...@@ -127,4 +127,6 @@ public interface WeixinQrcodeBiz { ...@@ -127,4 +127,6 @@ public interface WeixinQrcodeBiz {
* @param wxUserId 用户微信ID * @param wxUserId 用户微信ID
*/ */
void inviteNewRobot(String wxUserId); void inviteNewRobot(String wxUserId);
Map<String, BookWxQrcodeDTO> getGroupVersion(List<String> wxGroupIds);
} }
package com.pcloud.book.group.biz.impl; package com.pcloud.book.group.biz.impl;
import com.alibaba.fastjson.JSON;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.promotion.PromotionConsr; import com.pcloud.book.consumer.promotion.PromotionConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr; import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
...@@ -14,6 +15,7 @@ import com.pcloud.book.group.dto.WeixinQrcodeCountDTO; ...@@ -14,6 +15,7 @@ import com.pcloud.book.group.dto.WeixinQrcodeCountDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO; import com.pcloud.book.group.dto.WeixinQrcodeDTO;
import com.pcloud.book.group.entity.WeixinQrcode; import com.pcloud.book.group.entity.WeixinQrcode;
import com.pcloud.book.group.enums.UpdateStatusEnum; import com.pcloud.book.group.enums.UpdateStatusEnum;
import com.pcloud.book.group.tools.Kit;
import com.pcloud.book.group.tools.QrcodeTools; import com.pcloud.book.group.tools.QrcodeTools;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.QrStatisticsVO; import com.pcloud.book.group.vo.QrStatisticsVO;
...@@ -28,6 +30,7 @@ import com.pcloud.common.utils.string.StringUtil; ...@@ -28,6 +30,7 @@ import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.group.dto.GroupRobotDTO; import com.pcloud.wechatgroup.group.dto.GroupRobotDTO;
import com.sdk.wxgroup.AddToGroupVO; import com.sdk.wxgroup.AddToGroupVO;
import com.sdk.wxgroup.GroupInfoVO; import com.sdk.wxgroup.GroupInfoVO;
import com.sdk.wxgroup.QrcodeVO;
import com.sdk.wxgroup.WxGroupSDK; import com.sdk.wxgroup.WxGroupSDK;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -39,6 +42,7 @@ import org.springframework.stereotype.Component; ...@@ -39,6 +42,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -118,10 +122,10 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -118,10 +122,10 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
@Override @Override
public void setUpdateQrUrlByQuartz() { public void setUpdateQrUrlByQuartz() {
EXECUTOR_SERVICE.execute(() -> { // ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> {
setUpdateQrUrl(); // setUpdateQrUrl();
setUpdateQr4Error(null); // setUpdateQr4Error(null);
}); // });
} }
@Override @Override
...@@ -145,7 +149,7 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -145,7 +149,7 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
.map(UpdateQrDTO::getId).distinct() .map(UpdateQrDTO::getId).distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
weixinQrcodeDao.setOnUpdate(qrIds); weixinQrcodeDao.setOnUpdate(qrIds);
SendWeixinRequestTools.updateQrUrl(updateQrs); //SendWeixinRequestTools.updateQrUrl(updateQrs);
} }
} }
...@@ -192,7 +196,7 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -192,7 +196,7 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
if (ListUtils.isEmpty(updateQrs)) { if (ListUtils.isEmpty(updateQrs)) {
break; break;
} }
SendWeixinRequestTools.updateQrUrlVIP(updateQrs); updateQrUrlVIP(updateQrs);
} }
} }
} }
...@@ -246,6 +250,9 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -246,6 +250,9 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
@ParamLog("新增二维码") @ParamLog("新增二维码")
@Override @Override
public void addQrcode(WeixinQrcodeVO weixinQrcodeVO, Long partyId) { public void addQrcode(WeixinQrcodeVO weixinQrcodeVO, Long partyId) {
if (null == weixinQrcodeVO.getGeneration()){
throw new BookBizException(BookBizException.ERROR, "请选择微信群版本!");
}
WeixinQrcode weixinQrcode = new WeixinQrcode(); WeixinQrcode weixinQrcode = new WeixinQrcode();
BeanUtils.copyProperties(weixinQrcodeVO, weixinQrcode); BeanUtils.copyProperties(weixinQrcodeVO, weixinQrcode);
weixinQrcode.setCreateUser(partyId); weixinQrcode.setCreateUser(partyId);
...@@ -273,6 +280,7 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -273,6 +280,7 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
throw new BookBizException(BookBizException.ERROR, "二维码无法识别,请重新上传!"); throw new BookBizException(BookBizException.ERROR, "二维码无法识别,请重新上传!");
} }
weixinQrcode.setQrcodeUrl(QrcodeTools.ossToFile(newUrl)); weixinQrcode.setQrcodeUrl(QrcodeTools.ossToFile(newUrl));
weixinQrcode.setGeneration(weixinQrcodeVO.getGeneration());
Long qrcodeId = weixinQrcodeDao.insert(weixinQrcode); Long qrcodeId = weixinQrcodeDao.insert(weixinQrcode);
//若需要同步微信群id 则同步微信群 //若需要同步微信群id 则同步微信群
if(StringUtil.isEmpty(weixinQrcodeVO.getWeixinGroupId())){ if(StringUtil.isEmpty(weixinQrcodeVO.getWeixinGroupId())){
...@@ -283,7 +291,9 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -283,7 +291,9 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
@Override @Override
@ParamLog("获取机器人二维码分配情况") @ParamLog("获取机器人二维码分配情况")
public Map<Long, WeixinQrcodeCountDTO> listWeixinQrcodeCountByRobot(List<Long> robotIds) { public Map<Long, WeixinQrcodeCountDTO> listWeixinQrcodeCountByRobot(List<Long> robotIds) {
if (ListUtils.isEmpty(robotIds)) return null; if (ListUtils.isEmpty(robotIds)) {
return null;
}
Map<Long, WeixinQrcodeCountDTO> robotQrCountMap = weixinQrcodeDao.listWeixinQrcodeCountByRobot(robotIds); Map<Long, WeixinQrcodeCountDTO> robotQrCountMap = weixinQrcodeDao.listWeixinQrcodeCountByRobot(robotIds);
return robotQrCountMap; return robotQrCountMap;
} }
...@@ -366,4 +376,47 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -366,4 +376,47 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
} }
} }
@Override
public Map<String, BookWxQrcodeDTO> getGroupVersion(List<String> wxGroupIds) {
if (ListUtils.isEmpty(wxGroupIds)) {
return new HashMap<>();
}
return weixinQrcodeDao.listByWxGroupIds(wxGroupIds) == null ? new HashMap<>() : weixinQrcodeDao.listByWxGroupIds(wxGroupIds);
}
private void updateQrUrlVIP(List<UpdateQrDTO> updateQrs) {
if (ListUtils.isEmpty(updateQrs)) {
return;
}
List<Integer> generations = updateQrs.stream().map(UpdateQrDTO::getGeneration).collect(Collectors.toList());
Map<Integer, List<QrcodeVO>> map = new HashMap<>();
generations.forEach(item -> map.put(item, new ArrayList<>()));
for (UpdateQrDTO updateQrDTO : updateQrs) {
QrcodeVO qrcodeVO = new QrcodeVO();
qrcodeVO.setPriority(2);
qrcodeVO.setId(updateQrDTO.getId());
qrcodeVO.setOperation(0);
qrcodeVO.setAltId(updateQrDTO.getRobotWxId());
String url = updateQrDTO.getUrl();
if (url.contains("https://oss")) {
url = url.replace("//oss", "//file");
}
qrcodeVO.setUrl(url);
qrcodeVO.setRequestUrl("/book/v1.0/weixinQrcodeService/updateQrUrl");
Integer generation = updateQrDTO.getGeneration();
List<QrcodeVO> list = map.get(generation);
list.add(qrcodeVO);
}
for (Map.Entry<Integer, List<QrcodeVO>> entry : map.entrySet()) {
Integer generation = entry.getKey();
List<QrcodeVO> qrcodeList = entry.getValue();
String virtualMachineIp = weixinQrcodeDao.getVirtualIp(generation);
try {
Kit.post("http://" + virtualMachineIp + ":8080/autoGroup", JSON.toJSONString(qrcodeList));
} catch (Exception e) {
LOGGER.error("更新二维码地址(7天过期更新VIP插队)失败", e);
}
}
}
} }
...@@ -151,4 +151,8 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> { ...@@ -151,4 +151,8 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
* @return * @return
*/ */
List<BookWxQrcodeDTO> listOver10AvailableGroupByPage(Map<String, Object> paramMap); List<BookWxQrcodeDTO> listOver10AvailableGroupByPage(Map<String, Object> paramMap);
Map<String, BookWxQrcodeDTO> listByWxGroupIds(List<String> wxGroupIds);
String getVirtualIp(Integer generation);
} }
...@@ -142,4 +142,16 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We ...@@ -142,4 +142,16 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We
public List<BookWxQrcodeDTO> listOver10AvailableGroupByPage(Map<String, Object> paramMap) { public List<BookWxQrcodeDTO> listOver10AvailableGroupByPage(Map<String, Object> paramMap) {
return this.getSqlSession().selectList(this.getStatement("listOver10AvailableGroupByPage"), paramMap); return this.getSqlSession().selectList(this.getStatement("listOver10AvailableGroupByPage"), paramMap);
} }
@Override
public Map<String, BookWxQrcodeDTO> listByWxGroupIds(List<String> wxGroupIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("wxGroupIds", wxGroupIds);
return this.getSessionTemplate().selectMap(getStatement("listByWxGroupIds"), paramMap, "weixinGroupId");
}
@Override
public String getVirtualIp(Integer generation) {
return this.getSessionTemplate().selectOne("getVirtualIp", generation);
}
} }
...@@ -74,6 +74,8 @@ public class WeixinQrcode extends BaseEntity { ...@@ -74,6 +74,8 @@ public class WeixinQrcode extends BaseEntity {
*/ */
private Long updateUser; private Long updateUser;
private Integer generation;
@Override @Override
public Long getId() { public Long getId() {
return id; return id;
...@@ -176,6 +178,14 @@ public class WeixinQrcode extends BaseEntity { ...@@ -176,6 +178,14 @@ public class WeixinQrcode extends BaseEntity {
this.robotWxId = robotWxId; this.robotWxId = robotWxId;
} }
public Integer getGeneration() {
return generation;
}
public void setGeneration(Integer generation) {
this.generation = generation;
}
@Override @Override
public String toString() { public String toString() {
return "WeixinQrcode{" + return "WeixinQrcode{" +
......
...@@ -17,9 +17,11 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -17,9 +17,11 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -109,4 +111,10 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService { ...@@ -109,4 +111,10 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService {
weixinQrcodeBiz.inviteNewRobot(wxUserId); weixinQrcodeBiz.inviteNewRobot(wxUserId);
} }
@Override
@RequestMapping(value = "getGroupVersionIp", method = RequestMethod.POST)
public ResponseEntity<ResponseDto<Map<String, BookWxQrcodeDTO>>> getGroupVersionIp(@RequestBody List<String> wxGroupIds) {
return ResponseHandleUtil.toResponse(weixinQrcodeBiz.getGroupVersion(wxGroupIds));
}
} }
...@@ -50,7 +50,7 @@ public class SendWeixinRequestTools { ...@@ -50,7 +50,7 @@ public class SendWeixinRequestTools {
@ParamLog("更新二维码地址(7天过期更新)") @ParamLog("更新二维码地址(7天过期更新)")
public static void updateQrUrl(List<UpdateQrDTO> updateQrs) { public static void updateQrUrl(List<UpdateQrDTO> updateQrs) {
if (ListUtils.isEmpty(updateQrs)) { /*if (ListUtils.isEmpty(updateQrs)) {
return; return;
} }
List<QrcodeVO> qrcodes = new ArrayList<>(); List<QrcodeVO> qrcodes = new ArrayList<>();
...@@ -60,39 +60,20 @@ public class SendWeixinRequestTools { ...@@ -60,39 +60,20 @@ public class SendWeixinRequestTools {
qrcodeVO.setOperation(0); qrcodeVO.setOperation(0);
qrcodeVO.setId(updateQrDTO.getId()); qrcodeVO.setId(updateQrDTO.getId());
qrcodeVO.setAltId(updateQrDTO.getRobotWxId()); qrcodeVO.setAltId(updateQrDTO.getRobotWxId());
qrcodeVO.setUrl(updateQrDTO.getUrl()); String url = updateQrDTO.getUrl();
qrcodeVO.setRequestUrl("/book/v1.0/weixinQrcodeService/updateQrUrl"); if (url.contains("https://oss")) {
qrcodes.add(qrcodeVO); url = url.replace("//oss", "//file");
} }
try { qrcodeVO.setUrl(url);
WxGroupSDK.refresh(qrcodes);
} catch (Exception e) {
LOGGER.error("更新二维码地址(7天过期更新)失败", e);
}
}
@ParamLog("更新二维码地址(7天过期更新VIP插队)")
public static void updateQrUrlVIP(List<UpdateQrDTO> updateQrs) {
if (ListUtils.isEmpty(updateQrs)) {
return;
}
List<QrcodeVO> qrcodes = new ArrayList<>();
for (UpdateQrDTO updateQrDTO : updateQrs) {
QrcodeVO qrcodeVO = new QrcodeVO();
qrcodeVO.setPriority(2);
qrcodeVO.setId(updateQrDTO.getId());
qrcodeVO.setOperation(0);
qrcodeVO.setAltId(updateQrDTO.getRobotWxId());
qrcodeVO.setUrl(updateQrDTO.getUrl());
qrcodeVO.setRequestUrl("/book/v1.0/weixinQrcodeService/updateQrUrl"); qrcodeVO.setRequestUrl("/book/v1.0/weixinQrcodeService/updateQrUrl");
qrcodes.add(qrcodeVO); qrcodes.add(qrcodeVO);
} }
try { try {
WxGroupSDK.refresh(qrcodes); // TODO 更新ip
Kit.post("http:/192.168.82.213:8080/autoGroup",JSON.toJSONString(qrcodeList));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("更新二维码地址(7天过期更新VIP插队)失败", e); log.error("更新二维码地址(7天过期更新)失败", e);
} }*/
} }
/** /**
...@@ -101,7 +82,7 @@ public class SendWeixinRequestTools { ...@@ -101,7 +82,7 @@ public class SendWeixinRequestTools {
* @Date:2019/4/15 15:36 * @Date:2019/4/15 15:36
*/ */
public static void syncOneWeixinGroupId(Long qrcodeId, String qrcodeUrl, String weixinRobotId) { public static void syncOneWeixinGroupId(Long qrcodeId, String qrcodeUrl, String weixinRobotId) {
List<QrcodeVO> qrcodeVOS = new ArrayList<>(); /*List<QrcodeVO> qrcodeVOS = new ArrayList<>();
QrcodeVO qrcodeVO = new QrcodeVO(); QrcodeVO qrcodeVO = new QrcodeVO();
qrcodeVO.setId(qrcodeId); qrcodeVO.setId(qrcodeId);
qrcodeVO.setUrl(qrcodeUrl); qrcodeVO.setUrl(qrcodeUrl);
...@@ -111,10 +92,11 @@ public class SendWeixinRequestTools { ...@@ -111,10 +92,11 @@ public class SendWeixinRequestTools {
qrcodeVO.setRequestUrl("/book/v1.0/weixinQrcodeService/syncWeixinGroupId"); qrcodeVO.setRequestUrl("/book/v1.0/weixinQrcodeService/syncWeixinGroupId");
qrcodeVOS.add(qrcodeVO); qrcodeVOS.add(qrcodeVO);
try { try {
WxGroupSDK.syncWeixinGroupId(qrcodeVOS); // TODO 更新ip
WxGroupSDK.syncWeixinGroupId(qrcodeVOS, null);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("发送同步微信id请求失败", e); log.error("发送同步微信id请求失败", e);
} }*/
} }
/** /**
...@@ -123,7 +105,7 @@ public class SendWeixinRequestTools { ...@@ -123,7 +105,7 @@ public class SendWeixinRequestTools {
* @Date:2019/4/26 17:50 * @Date:2019/4/26 17:50
*/ */
public static void syncWeixinGroupIds(List<SyncWeixinGroupIdRequestDTO> weixinGroupIdDTOS) { public static void syncWeixinGroupIds(List<SyncWeixinGroupIdRequestDTO> weixinGroupIdDTOS) {
if (ListUtils.isEmpty(weixinGroupIdDTOS)) { /*if (ListUtils.isEmpty(weixinGroupIdDTOS)) {
return; return;
} }
List<QrcodeVO> qrcodeVOS = new ArrayList<>(); List<QrcodeVO> qrcodeVOS = new ArrayList<>();
...@@ -138,10 +120,11 @@ public class SendWeixinRequestTools { ...@@ -138,10 +120,11 @@ public class SendWeixinRequestTools {
qrcodeVOS.add(qrcodeVO); qrcodeVOS.add(qrcodeVO);
} }
try { try {
WxGroupSDK.syncWeixinGroupId(qrcodeVOS); // TODO 更新ip
WxGroupSDK.syncWeixinGroupId(qrcodeVOS, null);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("批量同步微信群标识失败", e); log.error("批量同步微信群标识失败", e);
} }*/
} }
@ParamLog("修改微信群名称") @ParamLog("修改微信群名称")
......
...@@ -28,6 +28,9 @@ public class WeixinQrcodeVO implements Serializable { ...@@ -28,6 +28,9 @@ public class WeixinQrcodeVO implements Serializable {
@ApiModelProperty("微信群标识") @ApiModelProperty("微信群标识")
private String weixinGroupId; private String weixinGroupId;
@ApiModelProperty("微信群版本号")
private Integer generation;
public String getWeixinGroupId() { public String getWeixinGroupId() {
return weixinGroupId; return weixinGroupId;
} }
...@@ -60,6 +63,14 @@ public class WeixinQrcodeVO implements Serializable { ...@@ -60,6 +63,14 @@ public class WeixinQrcodeVO implements Serializable {
this.robotWxId = robotWxId; this.robotWxId = robotWxId;
} }
public Integer getGeneration() {
return generation;
}
public void setGeneration(Integer generation) {
this.generation = generation;
}
@Override @Override
public String toString() { public String toString() {
return "WeixinQrcodeVO{" + return "WeixinQrcodeVO{" +
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<result column="qrcode_url" property="qrcodeUrl" jdbcType="BIGINT"/> <result column="qrcode_url" property="qrcodeUrl" jdbcType="BIGINT"/>
<result column="use_state" property="useState" jdbcType="TINYINT"/> <result column="use_state" property="useState" jdbcType="TINYINT"/>
<result column="update_qr_time" property="updateQrTime" jdbcType="TIMESTAMP"/> <result column="update_qr_time" property="updateQrTime" jdbcType="TIMESTAMP"/>
<result column="generation" property="generation" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -27,8 +28,8 @@ ...@@ -27,8 +28,8 @@
<insert id="insert" parameterType = "weixinQrcode" useGeneratedKeys="true" <insert id="insert" parameterType = "weixinQrcode" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
INSERT INTO INSERT INTO
weixin_qrcode(qrcode_url, weixin_group_id, robot_id, robot_wx_id, update_state, create_user, create_time, update_qr_time) weixin_qrcode(qrcode_url, weixin_group_id, robot_id, robot_wx_id, update_state, create_user, create_time, update_qr_time, generation)
VALUES (#{qrcodeUrl,jdbcType=VARCHAR},#{weixinGroupId,jdbcType=VARCHAR}, #{robotId,jdbcType=BIGINT},#{robotWxId,jdbcType=VARCHAR},#{updateState},#{createUser}, NOW(),now()) VALUES (#{qrcodeUrl,jdbcType=VARCHAR},#{weixinGroupId,jdbcType=VARCHAR}, #{robotId,jdbcType=BIGINT},#{robotWxId,jdbcType=VARCHAR},#{updateState},#{createUser}, NOW(),now(), #{generation})
</insert> </insert>
<select id="getOneWechatGroup" resultType = "WeixinQrcodeDTO" > <select id="getOneWechatGroup" resultType = "WeixinQrcodeDTO" >
...@@ -73,7 +74,7 @@ ...@@ -73,7 +74,7 @@
<select id="getInitialQr" resultType="UpdateQrDTO" parameterType="map"> <select id="getInitialQr" resultType="UpdateQrDTO" parameterType="map">
select select
qrcode_url url, ID, robot_wx_id robotWxId qrcode_url url, ID, robot_wx_id robotWxId, generation
from from
weixin_qrcode weixin_qrcode
where where
...@@ -117,7 +118,7 @@ ...@@ -117,7 +118,7 @@
<select id="getQrOnHandle" resultType="UpdateQrDTO" parameterType="map"> <select id="getQrOnHandle" resultType="UpdateQrDTO" parameterType="map">
select select
qrcode_url url, ID, robot_wx_id robotWxId qrcode_url url, ID, robot_wx_id robotWxId, generation
from from
weixin_qrcode weixin_qrcode
where where
...@@ -253,4 +254,25 @@ ...@@ -253,4 +254,25 @@
LIMIT #{currentPage}, #{numPerPage} LIMIT #{currentPage}, #{numPerPage}
</select> </select>
<select id="listByWxGroupIds" parameterType="map" resultType="com.pcloud.book.group.dto.BookWxQrcodeDTO">
SELECT
weixin_group_id weixinGroupId,
robot_wx_id robotWxId,
a.generation,
b.wechat_group_ip wechatGroupIp
FROM
`weixin_qrcode` a left join weixin_qrcode_generation b
on a.generation = b.generation
WHERE
weixin_group_id IN
<foreach collection="wxGroupIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
<select id="getVirtualIp" parameterType="int" resultType="string">
SELECT virtual_machine_ip from weixin_qrcode_generation
where generation = #{_parameter}
</select>
</mapper> </mapper>
\ No newline at end of file
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