|
@@ -8,6 +8,7 @@ import com.usoftchina.smartschool.device.po.Transaction;
|
|
|
import com.usoftchina.smartschool.device.service.IcCardService;
|
|
|
import com.usoftchina.smartschool.school.dto.SysSchoolDTO;
|
|
|
import com.usoftchina.smartschool.school.enums.NoticeTemplate;
|
|
|
+import com.usoftchina.smartschool.utils.CollectionUtils;
|
|
|
import com.usoftchina.smartschool.utils.ObjectUtils;
|
|
|
import com.usoftchina.smartschool.utils.http.HmacUtils;
|
|
|
import com.usoftchina.smartschool.wechat.api.WechatApi;
|
|
@@ -61,36 +62,39 @@ public class IcCardServiceImpl implements IcCardService {
|
|
|
String oldType = accTransDetail.getAccTransType();
|
|
|
accTransDetail.setAccTransType(Transaction.getName(accTransDetail.getAccTransType()));
|
|
|
|
|
|
- String openId = icCardMapper.SelectParentOpenId(accTransDetail.getEmpNo(), schoolId);
|
|
|
- if(StringUtils.hasText(openId)){
|
|
|
- MessageInfoDTO messageInfo = new MessageInfoDTO();
|
|
|
- messageInfo.setMsgId(accTransDetail.getGuid());
|
|
|
- sb.append(accTransDetail.getGuid() + ",");
|
|
|
- messageInfo.setTouser(openId);
|
|
|
- messageInfo.setAppId(appId);
|
|
|
- messageInfo.setSecret(secret);
|
|
|
- messageInfo.setTemplateId(templateId);
|
|
|
- String accNo = accTransDetail.getAccNo();
|
|
|
- String cardNo = StringUtils.isEmpty(accNo) ? null : accNo.substring(accTransDetail.getAccNo().length() - 4);
|
|
|
- String header = "您好,您的小孩" + accTransDetail.getEmpName() + "在校的校园卡(卡号:*** " + cardNo + ")发生如下交易";
|
|
|
- messageInfo.setTitle(header);
|
|
|
- Date accTransDay = accTransDetail.getAccTransDay();
|
|
|
- if (null != accTransDay) {
|
|
|
- messageInfo.setKeyword1(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(accTransDetail.getAccTransDay()));
|
|
|
- }
|
|
|
- if (Integer.parseInt(oldType) > 15) {
|
|
|
- messageInfo.setKeyword2(String.format("%.2f", accTransDetail.getoMoneyValue()));
|
|
|
- } else {
|
|
|
- messageInfo.setKeyword2(String.format("%.2f", accTransDetail.getiMoneyValue()));
|
|
|
- }
|
|
|
- messageInfo.setKeyword3(accTransDetail.getAccTransType());
|
|
|
- messageInfo.setKeyword4(String.format("%.2f", accTransDetail.getCardMoneyValue()));
|
|
|
- messageInfo.setRemark("感谢您使用!");
|
|
|
- messageInfoList.add(messageInfo);
|
|
|
- }else {
|
|
|
- logger.info("GUID={}未找到对应的推送人", accTransDetail.getGuid());
|
|
|
+ List<String> openIds = icCardMapper.SelectParentOpenId(accTransDetail.getEmpNo(), schoolId);
|
|
|
+ if (!CollectionUtils.isEmpty(openIds)) {
|
|
|
+ openIds.forEach(openId -> {
|
|
|
+ if (StringUtils.hasText(openId)) {
|
|
|
+ MessageInfoDTO messageInfo = new MessageInfoDTO();
|
|
|
+ messageInfo.setMsgId(accTransDetail.getGuid());
|
|
|
+ sb.append(accTransDetail.getGuid() + ",");
|
|
|
+ messageInfo.setTouser(openId);
|
|
|
+ messageInfo.setAppId(appId);
|
|
|
+ messageInfo.setSecret(secret);
|
|
|
+ messageInfo.setTemplateId(templateId);
|
|
|
+ String accNo = accTransDetail.getAccNo();
|
|
|
+ String cardNo = StringUtils.isEmpty(accNo) ? null : accNo.substring(accTransDetail.getAccNo().length() - 4);
|
|
|
+ String header = "您好,您孩子" + accTransDetail.getEmpName() + "的校园卡(卡号:*** " + cardNo + ")发生如下交易";
|
|
|
+ messageInfo.setTitle(header);
|
|
|
+ Date accTransDay = accTransDetail.getAccTransDay();
|
|
|
+ if (null != accTransDay) {
|
|
|
+ messageInfo.setKeyword1(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(accTransDetail.getAccTransDay()));
|
|
|
+ }
|
|
|
+ if (Integer.parseInt(oldType) > 15) {
|
|
|
+ messageInfo.setKeyword2(String.format("%.2f", accTransDetail.getoMoneyValue()));
|
|
|
+ } else {
|
|
|
+ messageInfo.setKeyword2(String.format("%.2f", accTransDetail.getiMoneyValue()));
|
|
|
+ }
|
|
|
+ messageInfo.setKeyword3(accTransDetail.getAccTransType());
|
|
|
+ messageInfo.setKeyword4(String.format("%.2f", accTransDetail.getCardMoneyValue()));
|
|
|
+ messageInfo.setRemark("谢谢使用!");
|
|
|
+ messageInfoList.add(messageInfo);
|
|
|
+ } else {
|
|
|
+ logger.info("GUID={}未找到对应的推送人", accTransDetail.getGuid());
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
|
|
|
Result result = wechatApi.sendOutMessages(JSON.toJSONString(messageInfoList));
|