|
@@ -17,6 +17,7 @@ import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyMoneyLogs;
|
|
import com.fs.company.domain.CompanyMoneyLogs;
|
|
|
import com.fs.company.mapper.CompanyMapper;
|
|
import com.fs.company.mapper.CompanyMapper;
|
|
|
import com.fs.company.mapper.CompanyMoneyLogsMapper;
|
|
import com.fs.company.mapper.CompanyMoneyLogsMapper;
|
|
|
|
|
+import com.fs.company.service.ICompanyConfigService;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.config.RedPacketConfig;
|
|
import com.fs.course.config.RedPacketConfig;
|
|
|
import com.fs.course.domain.FsCourseWatchLog;
|
|
import com.fs.course.domain.FsCourseWatchLog;
|
|
@@ -478,33 +479,8 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
|
|
|
company.getCompanyId(), moneyLog.getMoney());
|
|
company.getCompanyId(), moneyLog.getMoney());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public R transferBatchesBatchId(String batchId) {
|
|
|
|
|
- FsCourseRedPacketLog log = fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogByBatchId(batchId);
|
|
|
|
|
- if (log ==null){
|
|
|
|
|
- return R.error("未查询到红包记录!");
|
|
|
|
|
- }
|
|
|
|
|
- String json = configService.selectConfigByKey("redPacket.config");
|
|
|
|
|
- RedPacketConfig config = JSONUtil.toBean(json, RedPacketConfig.class);
|
|
|
|
|
- //创建微信订单
|
|
|
|
|
- WxPayConfig payConfig = new WxPayConfig();
|
|
|
|
|
- BeanUtils.copyProperties(config,payConfig);
|
|
|
|
|
- WxPayService wxPayService = new WxPayServiceImpl();
|
|
|
|
|
- wxPayService.setConfig(payConfig);
|
|
|
|
|
- TransferService transferService=wxPayService.getTransferService();
|
|
|
|
|
-
|
|
|
|
|
- QueryTransferBatchesRequest request = new QueryTransferBatchesRequest();
|
|
|
|
|
- request.setBatchId(batchId);
|
|
|
|
|
-
|
|
|
|
|
- try {
|
|
|
|
|
- QueryTransferBatchesResult queryTransferBatchesResult = transferService.transferBatchesBatchId(request);
|
|
|
|
|
- logger.info("FsCourseRedPacketLog-log_id:{},【红包处理】查询批次结果:{}",log.getLogId(),queryTransferBatchesResult);
|
|
|
|
|
- return R.ok(queryTransferBatchesResult.toString());
|
|
|
|
|
- } catch (WxPayException e) {
|
|
|
|
|
- logger.error(e.getMessage());
|
|
|
|
|
- return R.error(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ICompanyConfigService companyConfigService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public R getBillsByTransferBillNo(String batchId) {
|
|
public R getBillsByTransferBillNo(String batchId) {
|
|
@@ -512,8 +488,29 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
|
|
|
if (log ==null){
|
|
if (log ==null){
|
|
|
return R.error("未查询到红包记录!");
|
|
return R.error("未查询到红包记录!");
|
|
|
}
|
|
}
|
|
|
- String json = configService.selectConfigByKey("redPacket.config");
|
|
|
|
|
- RedPacketConfig config = JSONUtil.toBean(json, RedPacketConfig.class);
|
|
|
|
|
|
|
+ // 获取配置信息
|
|
|
|
|
+ CourseConfig courseConfig = JSONUtil.toBean(configService.selectConfigByKey("course.config"), CourseConfig.class);
|
|
|
|
|
+
|
|
|
|
|
+ String json;
|
|
|
|
|
+ RedPacketConfig config = new RedPacketConfig();
|
|
|
|
|
+ // 根据红包模式获取配置
|
|
|
|
|
+ switch (courseConfig.getRedPacketMode()){
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ json = configService.selectConfigByKey("redPacket.config");
|
|
|
|
|
+ config = JSONUtil.toBean(json, RedPacketConfig.class);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ json = companyConfigService.selectRedPacketConfigByKey(log.getCompanyId());
|
|
|
|
|
+ //如果分公司配置为空就走总后台的配置
|
|
|
|
|
+ if (StringUtils.isEmpty(json)){
|
|
|
|
|
+ json = configService.selectConfigByKey("redPacket.config");
|
|
|
|
|
+ }
|
|
|
|
|
+ config = JSONUtil.toBean(json, RedPacketConfig.class);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ throw new UnsupportedOperationException("当前红包模式不支持!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//创建微信订单
|
|
//创建微信订单
|
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
|
BeanUtils.copyProperties(config,payConfig);
|
|
BeanUtils.copyProperties(config,payConfig);
|
|
@@ -521,15 +518,28 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
|
|
|
wxPayService.setConfig(payConfig);
|
|
wxPayService.setConfig(payConfig);
|
|
|
TransferService transferService=wxPayService.getTransferService();
|
|
TransferService transferService=wxPayService.getTransferService();
|
|
|
|
|
|
|
|
- try {
|
|
|
|
|
- TransferBillsGetResult queryRedPacketResult = transferService.getBillsByTransferBillNo(batchId);
|
|
|
|
|
- logger.info("FsCourseRedPacketLog-log_id:{},【红包处理】查询批次结果:{}",log.getLogId(),queryRedPacketResult);
|
|
|
|
|
- return R.ok(queryRedPacketResult.toString());
|
|
|
|
|
- } catch (WxPayException e) {
|
|
|
|
|
- logger.error(e.getMessage());
|
|
|
|
|
- return R.error(e.getMessage());
|
|
|
|
|
|
|
+ if (config.getIsNew() != null && config.getIsNew() == 1) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ TransferBillsGetResult queryRedPacketResult = transferService.getBillsByTransferBillNo(batchId);
|
|
|
|
|
+ logger.info("FsCourseRedPacketLog-log_id:{},【红包处理】查询批次结果:{}",log.getLogId(),queryRedPacketResult);
|
|
|
|
|
+ return R.ok(queryRedPacketResult.toString());
|
|
|
|
|
+ } catch (WxPayException e) {
|
|
|
|
|
+ logger.error(e.getMessage());
|
|
|
|
|
+ return R.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ QueryTransferBatchesRequest request = new QueryTransferBatchesRequest();
|
|
|
|
|
+ request.setBatchId(batchId);
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ QueryTransferBatchesResult queryTransferBatchesResult = transferService.transferBatchesBatchId(request);
|
|
|
|
|
+ logger.info("FsCourseRedPacketLog-log_id:{},【红包处理】查询批次结果:{}",log.getLogId(),queryTransferBatchesResult);
|
|
|
|
|
+ return R.ok(queryTransferBatchesResult.toString());
|
|
|
|
|
+ } catch (WxPayException e) {
|
|
|
|
|
+ logger.error(e.getMessage());
|
|
|
|
|
+ return R.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|