|
@@ -38,6 +38,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.DigestUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
@@ -128,31 +129,43 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
- public void importExcel(List<ExcelDataReaderProperty<UserWithdrawalExport>> dataList) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void importExcel(List<ExcelDataReaderProperty<UserWithdrawalExport>> dataList, Long userId) {
|
|
|
List<ErrMsg> errMsgList = new ArrayList<>();
|
|
|
dataList.sort(Comparator.comparingInt(ExcelDataReaderProperty::getRowIndex));
|
|
|
List<UserWithdrawal> userWithdrawalList = new ArrayList<>();
|
|
|
for (ExcelDataReaderProperty<UserWithdrawalExport> dataReaderProperty : dataList) {
|
|
|
String errMsg = dataReaderProperty.getErrorMessage();
|
|
|
- if (StringUtil.isEmpty(errMsg)) {
|
|
|
+ if (!StringUtil.isEmpty(errMsg)) {
|
|
|
errMsgList.add(new ErrMsg(dataReaderProperty.getRowIndex(), errMsg));
|
|
|
continue;
|
|
|
}
|
|
|
UserWithdrawalExport data = dataReaderProperty.getClazz();
|
|
|
StringBuffer buffer = new StringBuffer(data.getId().toString());
|
|
|
buffer.append(data.getUserId());
|
|
|
- buffer.append(data.getAmount());
|
|
|
- buffer.append(data.getActualAmount());
|
|
|
+ buffer.append(data.getAmount().setScale(2));
|
|
|
+ buffer.append(data.getActualAmount().setScale(2));
|
|
|
String sign = DigestUtils.md5DigestAsHex(buffer.toString().getBytes());
|
|
|
if (!data.getSign().equals(sign)) {
|
|
|
errMsgList.add(new ErrMsg(dataReaderProperty.getRowIndex(), "验签失败"));
|
|
|
continue;
|
|
|
}
|
|
|
+ if(AuthStatusEnum.PASS.equals(data.getStatus()) && StringUtil.isEmpty(data.getBankFlowNo())){
|
|
|
+ errMsgList.add(new ErrMsg(dataReaderProperty.getRowIndex(), "审核通过时,转账流水号不能为空"));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(!AuthStatusEnum.DOING.equals(data.getStatus())
|
|
|
+ && StringUtil.isEmpty(data.getVerifyReason())){
|
|
|
+ errMsgList.add(new ErrMsg(dataReaderProperty.getRowIndex(), "审核理由不能为空"));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
UserWithdrawal userWithdrawal = new UserWithdrawal();
|
|
|
userWithdrawal.setId(data.getId());
|
|
|
userWithdrawal.setBankFlowNo(data.getBankFlowNo());
|
|
|
userWithdrawal.setStatus(data.getStatus());
|
|
|
+ userWithdrawal.setVerifyReason(data.getVerifyReason());
|
|
|
+ userWithdrawal.setVerifyUserId(userId);
|
|
|
+ userWithdrawal.setTransferTime(new Date());
|
|
|
userWithdrawalList.add(userWithdrawal);
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(errMsgList)) {
|
|
@@ -169,7 +182,11 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
|
|
|
*/
|
|
|
private void authWithdrawalBancth(List<UserWithdrawal> userWithdrawalList) {
|
|
|
for (UserWithdrawal userWithdrawal : userWithdrawalList) {
|
|
|
- baseMapper.updateById(userWithdrawal);
|
|
|
+ UserWithdrawal old = baseMapper.selectById(userWithdrawal.getId());
|
|
|
+ if(null != old && !AuthStatusEnum.PASS.equals(old.getStatus())
|
|
|
+ && !old.getStatus().equals(userWithdrawal.getStatus())){
|
|
|
+ baseMapper.updateById(userWithdrawal);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|