|
|
@@ -24,6 +24,7 @@ import com.usoftchina.smartschool.wechat.api.WechatApi;
|
|
|
import com.usoftchina.smartschool.wechat.dto.MessageInfoDTO;
|
|
|
import com.usoftchina.smartschool.wechat.dto.TransferDTO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
@@ -49,6 +50,9 @@ public class NoticeServiceImpl implements NoticeService{
|
|
|
@Autowired
|
|
|
private SchoolTemplateMapper schoolTemplateMapper;
|
|
|
|
|
|
+ @Value("${smartschool.domain.wechat}")
|
|
|
+ private String baseWechatUrl;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public DocBaseDTO save(Notify formdata) {
|
|
|
@@ -137,17 +141,27 @@ public class NoticeServiceImpl implements NoticeService{
|
|
|
}
|
|
|
noticers.forEach(noticer -> {
|
|
|
MessageInfoDTO msg = new MessageInfoDTO();
|
|
|
- msg.setTitle(data.getNotify_title());
|
|
|
- msg.setKeyword1(school.getSchool_name());
|
|
|
- msg.setKeyword2("校办公室");
|
|
|
- msg.setKeyword3(DateUtils.format());
|
|
|
- msg.setKeyword4(data.getNotify_details());
|
|
|
- msg.setRemark(data.getNotify_remarks());
|
|
|
- msg.setTemplateId(template.getSt_templateid());
|
|
|
- msg.setTouser(noticer.getOpenid());
|
|
|
- msg.setAppId(school.getSchool_appid());
|
|
|
- msg.setSecret(school.getSchool_secret());
|
|
|
- msgs.add(msg);
|
|
|
+ String endUrl = null;
|
|
|
+ if (!StringUtils.isEmpty(noticer.getType()) || !StringUtils.isEmpty(noticer.getPersonId())) {
|
|
|
+ if ("1".equals(noticer.getType().split(",")[0])) {
|
|
|
+ endUrl = "/parent/" + id + "?stuId=" + noticer.getPersonId().split(",")[0];
|
|
|
+ } else {
|
|
|
+ endUrl = "/teacher/" + id + "?teacherId=" + noticer.getPersonId().split(",")[0];
|
|
|
+ }
|
|
|
+ String url = baseWechatUrl + "/notifyDetail" + endUrl;
|
|
|
+ msg.setUrl(url);
|
|
|
+ msg.setTitle(data.getNotify_title());
|
|
|
+ msg.setKeyword1(school.getSchool_name());
|
|
|
+ msg.setKeyword2("校办公室");
|
|
|
+ msg.setKeyword3(DateUtils.format());
|
|
|
+ msg.setKeyword4(data.getNotify_details());
|
|
|
+ msg.setRemark("谢谢使用!");
|
|
|
+ msg.setTemplateId(template.getSt_templateid());
|
|
|
+ msg.setTouser(noticer.getOpenid());
|
|
|
+ msg.setAppId(school.getSchool_appid());
|
|
|
+ msg.setSecret(school.getSchool_secret());
|
|
|
+ msgs.add(msg);
|
|
|
+ }
|
|
|
});
|
|
|
if (msgs.size() > 0) {
|
|
|
TransferDTO transferDTO = new TransferDTO();
|