| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | if (!StringUtil.isNullOrEmpty(search.getEnd_date())) { |
| | | query.maxCreateTime = new Date(TimeUtil.convertToTimeTemp(search.getEnd_date(), "yyyy-MM-dd") + 1000 * 60 * 60 * 24L); |
| | | } |
| | | query.sortList = Arrays.asList(new String[]{"_create_time desc"}); |
| | | query.sortList = Arrays.asList(new String[]{"create_time desc"}); |
| | | query.start = (long) (page - 1) * limit; |
| | | query.count = limit; |
| | | |
| | |
| | | int successCount = 0; |
| | | int failCount = 0; |
| | | JSONArray idsArray = JSONArray.fromObject(ids); |
| | | List<String> errorMsgList=new ArrayList<>(); |
| | | for (int i = 0; i < idsArray.size(); i++) { |
| | | long id = idsArray.optLong(i); |
| | | try { |
| | | userCreditExchangeManager.approveExchange(id); |
| | | successCount += 1; |
| | | } catch (UserCreditExchangeException e) { |
| | | errorMsgList.add(e.getMessage()); |
| | | failCount += 1; |
| | | userCreditExchangeRecordService.updateExchangeRecord(CreditExchangeRecord.builder() |
| | | .id(id) |
| | | .exchangeStatusDescription(e.getMessage()) |
| | | .updateTime(new Date()) |
| | | .build()); |
| | | } |
| | | } |
| | | return JsonUtil.loadFalseResult(String.format("成功通过 %d 条记录 通过异常 %d 条记录", successCount, failCount)); |
| | | if(idsArray.size()>1) { |
| | | return JsonUtil.loadFalseResult(String.format("成功通过 %d 条记录 通过异常 %d 条记录", successCount, failCount)); |
| | | }else{ |
| | | if(!errorMsgList.isEmpty()) { |
| | | return JsonUtil.loadFalseResult(errorMsgList.get(0)); |
| | | }else{ |
| | | return JsonUtil.loadTrueResult("通过成功"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |