Commit 857f9129 by danmo

修复活码新增和扫描任务中存在的bug

1 parent 1d7c5644
......@@ -96,12 +96,12 @@ public class ChatMsgCheckListener implements MessageListener {
allSensitiveRules.forEach(weSensitive -> {
List<String> patternWords = Arrays.asList(weSensitive.getPatternWords().split(","));
List<String> users = weSensitiveService.getScopeUsers(weSensitive.getAuditUserScope());
log.info("handleSensitiveHit: >>>>>>>>>>>>>>>>>>>>>>finalContent:{}, patternWords:{},users:{},from:{}", finalContent, JSONObject.toJSONString(patternWords), JSONObject.toJSONString(users), fromId);
//log.info("handleSensitiveHit: >>>>>>>>>>>>>>>>>>>>>>finalContent:{}, patternWords:{},users:{},from:{}", finalContent, JSONObject.toJSONString(patternWords), JSONObject.toJSONString(users), fromId);
if (StringUtils.isNotBlank(finalContent)
&& !CollectionUtils.isEmpty(users)
&& users.stream().anyMatch(fromId::equals)) {
WeChatContactSensitiveMsg wccsm = hitSensitive(patternWords, fromId, finalContent);
log.info("handleSensitiveHit: >>>>>>>>>>>>>>>>>>>>>> wccsm:{}",JSONObject.toJSONString(wccsm));
//log.info("handleSensitiveHit: >>>>>>>>>>>>>>>>>>>>>> wccsm:{}",JSONObject.toJSONString(wccsm));
if (wccsm != null) {
wccsm.setMsgId(msgId);
wccsm.setFromId(fromId);
......@@ -119,7 +119,7 @@ public class ChatMsgCheckListener implements MessageListener {
private WeChatContactSensitiveMsg hitSensitive(List<String> patternWords, String user, String content) {
WeChatContactSensitiveMsg weChatContactSensitiveMsg = new WeChatContactSensitiveMsg();
String patternWordStr = patternWords.stream().filter(content.trim()::contains).collect(Collectors.joining(","));
log.info("hitSensitive: >>>>>>>>>>>>>>>>>>>>>> patternWordStr:{}",patternWordStr);
//log.info("hitSensitive: >>>>>>>>>>>>>>>>>>>>>> patternWordStr:{}",patternWordStr);
if (StringUtils.isNotEmpty(patternWordStr)) {
weChatContactSensitiveMsg.setContent(content);
weChatContactSensitiveMsg.setSendStatus(0);
......
......@@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -43,29 +44,30 @@ public class WeQrCodeUpdateTask {
private WeExternalContactClient externalContactClient;
public void qrCodeUpdateTask() {
Date date = new Date();
Week week = DateUtil.dayOfWeekEnum(date);
String formatTime = DateUtil.formatTime(date);
List<WeQrScopeVo> weQrScopeList = weQrScopeService.getWeQrScopeByTime(week.getValue(), formatTime);
List<WeQrScopeVo> weQrScopeList = weQrScopeService.getWeQrScopeByTime(DateUtil.formatDateTime(new Date()));
log.info("活码使用范围修改任务 weQrScopeList {}", JSONObject.toJSONString(weQrScopeList));
if (CollectionUtil.isNotEmpty(weQrScopeList)) {
List<WeQrScopeVo> weCustomizeQrScopeList = weQrScopeList.stream().filter(item -> ObjectUtil.equal(1, item.getType())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(weCustomizeQrScopeList)) {
weCustomizeQrScopeList.forEach(this::extracted);
} else {
WeQrScopeVo weDefaultQrScope = weQrScopeList.stream().filter(item -> ObjectUtil.equal(0, item.getType())).findFirst().orElse(null);
if (weDefaultQrScope != null) {
extracted(weDefaultQrScope);
Map<Long, List<WeQrScopeVo>> qrCodeMap = weQrScopeList.stream().collect(Collectors.groupingBy(WeQrScopeVo::getQrId));
qrCodeMap.forEach((qrId,scopeList) ->{
WeQrCode weQrCode = weQrCodeService.getById(qrId);
WeQrScopeVo weCustomizeQrScope = weQrScopeList.stream()
.filter(item -> ObjectUtil.equal(1, item.getType())).findFirst().orElse(null);
if(weCustomizeQrScope != null){
extracted(weCustomizeQrScope,weQrCode.getConfigId());
}else {
WeQrScopeVo weDefaultQrScope = weQrScopeList.stream()
.filter(item -> ObjectUtil.equal(0, item.getType())).findFirst().orElse(null);
extracted(weDefaultQrScope,weQrCode.getConfigId());
}
}
});
}
}
private void extracted(WeQrScopeVo weQrScope) {
WeQrCode weQrCode = weQrCodeService.getById(weQrScope.getQrId());
String configId = weQrCode.getConfigId();
WeContactWayDto contactWay = externalContactClient.getContactWay(configId);
private void extracted(WeQrScopeVo weQrScope, String configId) {
log.info("extracted ->>>>>>>>>>weQrScope:{}",JSONObject.toJSONString(weQrScope));
WeExternalContactDto query = new WeExternalContactDto();
query.setConfig_id(configId);
WeContactWayDto contactWay = externalContactClient.getContactWay(query);
if (contactWay != null && ObjectUtil.equal(0, contactWay.getErrcode())) {
String userIds = "";
String partys = "";
......
......@@ -27,5 +27,5 @@ public interface WeExternalContactClient {
WeExternalContactDto delContactWay(@JSONBody WeExternalContactDto query);
@Request(url = "/externalcontact/get_contact_way", type = "POST")
WeContactWayDto getContactWay(@Query("configId") String configId);
WeContactWayDto getContactWay(@JSONBody WeExternalContactDto query);
}
......@@ -24,6 +24,6 @@ public interface WeQrScopeMapper extends BaseMapper<WeQrScope> {
List<WeQrScopeVo> getWeQrScopeByQrIds(@Param("qrIds") List<Long> qrIds);
List<WeQrScopeVo> getWeQrScopeByTime(@Param("value") Integer value, @Param("formatTime") String formatTime);
List<WeQrScopeVo> getWeQrScopeByTime(@Param("formatTime") String formatTime);
}
......@@ -45,9 +45,7 @@ public interface IWeQrScopeService extends IService<WeQrScope> {
/**
* 查询当前时间使用范围活码数据
* @param value
* @param formatTime
* @return
*/
List<WeQrScopeVo> getWeQrScopeByTime(Integer value, String formatTime);
List<WeQrScopeVo> getWeQrScopeByTime(String formatTime);
}
......@@ -66,6 +66,7 @@ public class IWeQrScopeServiceImpl extends ServiceImpl<WeQrScopeMapper, WeQrScop
if(CollectionUtil.isNotEmpty(userInfo.getWorkCycle())){
weQrScope.setWorkCycle(userInfo.getWorkCycle().stream().map(String::valueOf).collect(Collectors.joining(",")));
}
weQrScope.setType(userInfo.getType());
weQrScope.setBeginTime(userInfo.getBeginTime());
weQrScope.setEndTime(userInfo.getEndTime());
return weQrScope;
......@@ -97,7 +98,7 @@ public class IWeQrScopeServiceImpl extends ServiceImpl<WeQrScopeMapper, WeQrScop
}
@Override
public List<WeQrScopeVo> getWeQrScopeByTime(Integer value, String formatTime) {
return this.baseMapper.getWeQrScopeByTime(value,formatTime);
public List<WeQrScopeVo> getWeQrScopeByTime(String formatTime) {
return this.baseMapper.getWeQrScopeByTime(formatTime);
}
}
......@@ -76,9 +76,9 @@
wqs.user_id,
wqs.party
from we_qr_scope wqs
where find_in_set(#{value},wqs.work_cycle)
and str_to_date(wqs.begin_time,'%H:%i:%S') &lt;= str_to_date(#{formatTime},'%H:%i:%S')
and str_to_date(wqs.end_time ,'%H:%i:%S') &gt;= str_to_date(#{formatTime},'%H:%i:%S')
where find_in_set(dayofweek(curdate())-1,wqs.work_cycle)
and date_format(concat(date_format(curdate(),'%Y-%m-%d '),wqs.begin_time), '%H:%i:%s') &lt;= date_format(#{formatTime},'%H:%i:%s')
and date_format(concat(date_format(curdate(),'%Y-%m-%d '),wqs.end_time), '%H:%i:%s') &gt;= date_format(#{formatTime},'%H:%i:%s')
and wqs.del_flag = 0
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!