|
@@ -1,10 +1,12 @@
|
|
|
package com.dk.oauth.service.wxapi.basic;
|
|
package com.dk.oauth.service.wxapi.basic;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.dk.common.exception.BaseBusinessException;
|
|
import com.dk.common.exception.BaseBusinessException;
|
|
|
import com.dk.common.infrastructure.constant.Constant;
|
|
import com.dk.common.infrastructure.constant.Constant;
|
|
|
import com.dk.common.infrastructure.enums.ErrorCodeEnum;
|
|
import com.dk.common.infrastructure.enums.ErrorCodeEnum;
|
|
|
import com.dk.common.infrastructure.xxl.XxlJobUtils;
|
|
import com.dk.common.infrastructure.xxl.XxlJobUtils;
|
|
|
|
|
+import com.dk.common.model.response.mst.StaffResponse;
|
|
|
import com.dk.common.response.ResponseCodeEnum;
|
|
import com.dk.common.response.ResponseCodeEnum;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
import com.dk.common.response.ResponseResultVO;
|
|
@@ -14,6 +16,7 @@ import com.dk.oauth.entity.Company;
|
|
|
import com.dk.oauth.entity.Trade;
|
|
import com.dk.oauth.entity.Trade;
|
|
|
import com.dk.oauth.entity.TradeResponse;
|
|
import com.dk.oauth.entity.TradeResponse;
|
|
|
import com.dk.oauth.entity.UserLogin;
|
|
import com.dk.oauth.entity.UserLogin;
|
|
|
|
|
+import com.dk.oauth.feign.service.StaffFeign;
|
|
|
import com.dk.oauth.mapper.CompanyMapper;
|
|
import com.dk.oauth.mapper.CompanyMapper;
|
|
|
import com.dk.oauth.mapper.TradeMapper;
|
|
import com.dk.oauth.mapper.TradeMapper;
|
|
|
import com.dk.oauth.mapper.UserMapper;
|
|
import com.dk.oauth.mapper.UserMapper;
|
|
@@ -29,12 +32,15 @@ import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
import com.github.binarywang.wxpay.service.WxPayService;
|
|
|
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
|
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
|
|
|
|
+import com.xxl.job.core.context.XxlJobHelper;
|
|
|
|
|
+import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
@@ -68,6 +74,8 @@ public class WechatPayService {
|
|
|
private CompanyMapper companyMapper;
|
|
private CompanyMapper companyMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private XxlJobUtils xxlJobUtils;
|
|
private XxlJobUtils xxlJobUtils;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ StaffFeign staffFeign;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 商户 下单选取旗舰版或专业版的订单
|
|
* 商户 下单选取旗舰版或专业版的订单
|
|
@@ -236,4 +244,62 @@ public class WechatPayService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @desc : 续费的公司提醒回调
|
|
|
|
|
+ * @author : 姜永辉
|
|
|
|
|
+ * @date : 2024-06-29 14:22
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
|
|
+ @XxlJob("renew-reminder")
|
|
|
|
|
+ public ResponseResultVO renewReminder() {
|
|
|
|
|
+ log.info("@XxlJob(\"renewReminder\")id: {}", XxlJobHelper.getJobParam());
|
|
|
|
|
+ try {
|
|
|
|
|
+// Integer cpid = 382;
|
|
|
|
|
+ Company company = companyMapper.selectById( XxlJobHelper.getJobParam());
|
|
|
|
|
+ // 解析license信息
|
|
|
|
|
+ String licenseStr = AESUtil.desEncrypt(company.getLicense());
|
|
|
|
|
+ log.error("续费的公司提醒回调-licenseStr:" + licenseStr);
|
|
|
|
|
+ if (licenseStr != null) {
|
|
|
|
|
+ Map<String, Object> licenseMap = JSON.parseObject(licenseStr, Map.class);
|
|
|
|
|
+ log.error("续费的公司提醒回调-re_new:" + licenseMap.get("re_new"));
|
|
|
|
|
+ if (licenseMap.get("re_new") != null) {
|
|
|
|
|
+ // 续费 返回的
|
|
|
|
|
+ Map<String, Object> renewM = (Map<String, Object>) licenseMap.get("re_new");
|
|
|
|
|
+ // 生成临时license授权
|
|
|
|
|
+ Map<String, Object> licenseMapNew = new HashMap<>();
|
|
|
|
|
+ licenseMapNew.put("grade_code", licenseMap.get("grade_code"));
|
|
|
|
|
+ licenseMapNew.put("end_date", LocalDate.parse(licenseMap.get("end_date") + ""));
|
|
|
|
|
+ // 续费 返回的
|
|
|
|
|
+ licenseMapNew.put("user_end_date", LocalDate.parse(renewM.get("user_end_date") + ""));
|
|
|
|
|
+ licenseMapNew.put("web_max_num", Integer.parseInt(licenseMap.get("web_max_num") + ""));
|
|
|
|
|
+ // // 续费 返回的
|
|
|
|
|
+ licenseMapNew.put("wx_max_num", Integer.parseInt(renewM.get("wx_max_num") + ""));
|
|
|
|
|
+ licenseMapNew.put("vip", licenseMap.get("vip"));
|
|
|
|
|
+ // 续费 返回的
|
|
|
|
|
+ licenseMapNew.put("fun_package", renewM.get("fun_package"));
|
|
|
|
|
+ // re_new 的值变为null
|
|
|
|
|
+// licenseMapNew.put("re_new", licenseMap.get("re_new"));
|
|
|
|
|
+ // 续费和升级
|
|
|
|
|
+ Company companynew = new Company();
|
|
|
|
|
+ companynew.setCpId(company.getCpId());
|
|
|
|
|
+ companynew.setLicense(AESUtil.aesEncrypt(JSON.toJSONString(licenseMapNew)));
|
|
|
|
|
+ companyMapper.updateCompanyNewLicense(companynew);
|
|
|
|
|
+ // 续费 返回的 取消授权的员工id 将员工的登录标识修改
|
|
|
|
|
+ if (renewM.get("del_staff_ids") != null) {
|
|
|
|
|
+ List<String> staffids = (List<String>) renewM.get("del_staff_ids");
|
|
|
|
|
+ // 更新员工的登录标识
|
|
|
|
|
+ ResponseResultVO responseResultVO = staffFeign.updateFeignStaffFlgCanLogin(staffids);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ log.error("续费的公司提醒回调----异常:{}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|