doum
2026-01-06 5464bf2beb3f07a6f3843f88df887f95cbe983af
server/meeting/meeting_service/src/main/java/com/doumee/core/wx/WxPlatNotice.java
@@ -9,6 +9,7 @@
import com.doumee.dao.business.dao.SmsEmailMapper;
import com.doumee.dao.business.model.Bookings;
import com.doumee.dao.business.model.SmsEmail;
import com.doumee.dao.system.model.SystemDictData;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -27,6 +28,12 @@
@Component
public class WxPlatNotice {
    public String  getAccessToken(String appid,String secret) {
        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appid+"&secret="+secret;
        String response = HttpsUtil.get(url,false);
        JSONObject json = JSONObject.parseObject(response);
        return json.getString("access_token");
    }
    public void  testSendNotice(List<String> openIds,String token){
        if(CollectionUtils.isNotEmpty(openIds)){
            String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
@@ -120,8 +127,6 @@
    }
    public void createBeginWxNotice(SystemDictDataBiz systemDictDataBiz, SmsEmailMapper smsEmailMapper, Bookings bookings, String openId){
        Map<String,Object> map = new HashMap<>();
        //整体参数map
        Map<String, Object> paramMap = new HashMap<String, Object>();
        //消息主题显示相关map
@@ -169,13 +174,12 @@
        smsEmail.setCreateDate(new Date());
        smsEmail.setTitle("会议即将开始提醒");
        smsEmail.setInfo(DateUtil.getFomartDate(DateUtil.getXMinuteAfterDate(bookings.getStartTime(),-earlyMin),"yyyy-MM-dd HH:mm:ss"));
        smsEmail.setContent(JSONObject.toJSONString(map));
        smsEmail.setContent(JSONObject.toJSONString(paramMap));
        smsEmailMapper.insert(smsEmail);
    }
    public void createEndWxNotice(SystemDictDataBiz systemDictDataBiz, SmsEmailMapper smsEmailMapper, Bookings bookings,  String openId){
        Map<String,Object> map = new HashMap<>();
        //整体参数map
        Map<String, Object> paramMap = new HashMap<String, Object>();
        //消息主题显示相关map
@@ -203,12 +207,6 @@
        paramMap.put("touser", openId);
        paramMap.put("data", dataMap);
        smsEmailMapper.delete(new QueryWrapper<SmsEmail>().lambda()
                .eq(SmsEmail::getObjType,Constants.FIVE.toString())
                .eq(SmsEmail::getStatus,Constants.TWO)
                .eq(SmsEmail::getType,Constants.TWO)
                .eq(SmsEmail::getObjId,bookings.getId())
        );
        SmsEmail smsEmail = new SmsEmail();
        smsEmail.setPhone(openId);
@@ -222,7 +220,11 @@
        smsEmail.setTitle("会议即将开始提醒");
        Integer endMin= Integer.valueOf(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.OVER_NOTICE_WX).getCode());
        smsEmail.setInfo(DateUtil.getFomartDate(DateUtil.getXMinuteAfterDate(bookings.getEndTime(),-endMin),"yyyy-MM-dd HH:mm:ss"));
        smsEmail.setContent(JSONObject.toJSONString(map));
        smsEmail.setContent(JSONObject.toJSONString(paramMap));
        smsEmailMapper.insert(smsEmail);
    }