|
@@ -167,7 +167,9 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
|
|
|
private CompanyMoneyLogsMapper moneyLogsMapper;
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public int retryCourseRedPacketLog(Long[] logIds) {
|
|
|
+ public R retryCourseRedPacketLog(Long[] logIds) {
|
|
|
+ int suc=0;
|
|
|
+ int err=0;
|
|
|
for (int i = 0; i < logIds.length; i++) {
|
|
|
Long id = logIds[i];
|
|
|
FsCourseRedPacketLog param = fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogByLogId(id);
|
|
@@ -179,10 +181,8 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
|
|
|
BigDecimal money = company.getMoney();
|
|
|
BigDecimal subtract = money.subtract(amount);
|
|
|
if (subtract.compareTo(BigDecimal.ZERO)<0){
|
|
|
- return 0;
|
|
|
+ err++;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
WxSendRedPacketParam packetParam = new WxSendRedPacketParam();
|
|
|
FsUser user = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
|
packetParam.setOpenId(user.getMaOpenId());
|
|
@@ -206,10 +206,8 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
|
|
|
redPacketLog.setStatus(0);
|
|
|
fsCourseRedPacketLogMapper.updateFsCourseRedPacketLog(redPacketLog);
|
|
|
// 更新观看记录的奖励类型
|
|
|
-
|
|
|
company.setMoney(subtract);
|
|
|
companyMapper.updateCompany(company);
|
|
|
-
|
|
|
CompanyMoneyLogs logs=new CompanyMoneyLogs();
|
|
|
logs.setCompanyId(company.getCompanyId());
|
|
|
logs.setRemark("扣除红包金额");
|
|
@@ -218,11 +216,14 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
|
|
|
logs.setBalance(company.getMoney());
|
|
|
logs.setCreateTime(new Date());
|
|
|
moneyLogsMapper.insertCompanyMoneyLogs(logs);
|
|
|
+ suc++;
|
|
|
}
|
|
|
+ }else {
|
|
|
+ err=0;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- return 0;
|
|
|
+ return R.ok();
|
|
|
}
|
|
|
|
|
|
}
|