优化话费定时任务代码

dev-discount
袁野 2 years ago
parent ac8801bed3
commit f37389d938
  1. 12
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java

@ -6,6 +6,7 @@ import com.hai.common.QRCodeGenerator;
import com.hai.common.security.AESEncodeUtil; import com.hai.common.security.AESEncodeUtil;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator; import com.hai.common.utils.IDGenerator;
import com.hai.config.CommonSysConst;
import com.hai.config.WeChatQrcodeUtils; import com.hai.config.WeChatQrcodeUtils;
import com.hai.dao.HighDiscountAgentRelMapper; import com.hai.dao.HighDiscountAgentRelMapper;
import com.hai.entity.*; import com.hai.entity.*;
@ -57,17 +58,22 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
} }
HighDiscountAgentCode code; HighDiscountAgentCode code;
Map<String,Object> map = new HashMap<>();
map.put("type" , "DISCOUNT");
for (int i = 0;i < stockCount;i++) { for (int i = 0;i < stockCount;i++) {
code = new HighDiscountAgentCode(); code = new HighDiscountAgentCode();
code.setDiscountAgentId(highDiscountAgentRel.getId()); code.setDiscountAgentId(highDiscountAgentRel.getId());
code.setStatus(1); code.setStatus(1);
code.setCreateTime(new Date()); code.setCreateTime(new Date());
highDiscountAgentCodeService.insertCode(code); highDiscountAgentCodeService.insertCode(code);
// 二维码参数
map.put("id", code.getId());
// 生成二维码地址 // 生成二维码
code.setExt1(weChatQrcodeUtils.qrCodeImgUrl(WxQrCodeTypeEnum.type5.getType(), code.getId().toString() , "DISCOUNT")); String qrCodeUrl = CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000011&key=&code=" + Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(map)));
code.setExt1(qrCodeUrl);
code.setExt2("2"); code.setExt2("2");
// 生成二维码地址
highDiscountAgentCodeService.updateCode(code); highDiscountAgentCodeService.updateCode(code);
} }
} }

Loading…
Cancel
Save