|
|
@@ -3,14 +3,17 @@ package com.usoftchina.smartschool.device.service.impl;
|
|
|
import com.usoftchina.smartschool.base.Result;
|
|
|
import com.usoftchina.smartschool.device.dto.AccessControlInfo;
|
|
|
import com.usoftchina.smartschool.device.mapper.AccessControlRecordMapper;
|
|
|
+import com.usoftchina.smartschool.device.mapper.SchoolTemplateMapper;
|
|
|
import com.usoftchina.smartschool.device.mapper.StudentInfoMapper;
|
|
|
import com.usoftchina.smartschool.device.po.AccessControlRecord;
|
|
|
+import com.usoftchina.smartschool.device.po.SchoolTemplate;
|
|
|
import com.usoftchina.smartschool.device.po.StudentInfo;
|
|
|
import com.usoftchina.smartschool.device.service.AccessControlService;
|
|
|
import com.usoftchina.smartschool.file.api.FileApi;
|
|
|
import com.usoftchina.smartschool.file.api.util.ByteArrayMultipartFile;
|
|
|
import com.usoftchina.smartschool.file.dto.FileInfoDTO;
|
|
|
import com.usoftchina.smartschool.file.dto.ImageFile;
|
|
|
+import com.usoftchina.smartschool.school.enums.NoticeTemplate;
|
|
|
import com.usoftchina.smartschool.utils.DateUtils;
|
|
|
import com.usoftchina.smartschool.utils.StringUtils;
|
|
|
import com.usoftchina.smartschool.wechat.api.WechatApi;
|
|
|
@@ -45,8 +48,12 @@ public class AccessControlServiceImpl implements AccessControlService{
|
|
|
@Autowired
|
|
|
private StudentInfoMapper studentInfoMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SchoolTemplateMapper schoolTemplateMapper;
|
|
|
+
|
|
|
private Logger logger = LoggerFactory.getLogger(AccessControlServiceImpl.class);
|
|
|
|
|
|
+
|
|
|
@Value("${wechat.template.accesscontrol}")
|
|
|
private String accessControlTemplateId;
|
|
|
|
|
|
@@ -104,12 +111,18 @@ public class AccessControlServiceImpl implements AccessControlService{
|
|
|
/**
|
|
|
* 3、推送消息到消息服务器(微信服务监听此消息发送微信消息)
|
|
|
*/
|
|
|
+ //拿到模板
|
|
|
+ SchoolTemplate schoolTemplate = schoolTemplateMapper.selectByCode(NoticeTemplate.INOUT_NOTICE.getCode(),studentInfo.getSchoolId());
|
|
|
+ if (StringUtils.isEmpty(schoolTemplate) || StringUtils.isEmpty(schoolTemplate.getSt_templateid())) {
|
|
|
+ logger.error("模板未配置");
|
|
|
+ return;
|
|
|
+ }
|
|
|
MessageInfoDTO msg = new MessageInfoDTO();
|
|
|
msg.setUrl(wechatBaseUrl + "/accessnoticedetail/" + record.getRecord_id());
|
|
|
msg.setAppId(studentInfo.getAppId());
|
|
|
msg.setSecret(studentInfo.getSecret());
|
|
|
msg.setTouser(studentInfo.getOpenId());
|
|
|
- msg.setTemplateId(accessControlTemplateId);
|
|
|
+ msg.setTemplateId(schoolTemplate.getSt_templateid());
|
|
|
msg.setTitle((type == 1 ? "入" : "出") + "校提醒");
|
|
|
msg.setKeyword1(studentInfo.getStuName());
|
|
|
msg.setKeyword2(DateUtils.format());
|