| | |
| | | |
| | | @RequestMapping("/base/pointMerchars/writeOff") |
| | | public Object writeOff(@RequestBody WriteOffDTO dto) { |
| | | UserPointsMerchandise byId = userPointsMerchandiseService.getById(dto.getId()); |
| | | byId.setStoreId(dto.getVerifiStoreId()); |
| | | byId.setStatus(2); |
| | | byId.setVerificationTime(new Date()); |
| | | byId.setUserId(null); |
| | | byId.setVerificationUserId(dto.getVerificationUserId()); |
| | | return userPointsMerchandiseService.updateById(byId); |
| | | if (dto == null || dto.getId() == null) { |
| | | throw new IllegalArgumentException("门票记录不能为空"); |
| | | } |
| | | if (!Integer.valueOf(1).equals(dto.getGoType()) && !Integer.valueOf(2).equals(dto.getGoType())) { |
| | | throw new IllegalArgumentException("入园方式参数不正确"); |
| | | } |
| | | |
| | | UserPointsMerchandise ticket = userPointsMerchandiseService.getById(dto.getId()); |
| | | if (ticket == null) { |
| | | throw new IllegalArgumentException("门票记录不存在"); |
| | | } |
| | | if (!Integer.valueOf(1).equals(ticket.getStatus())) { |
| | | throw new IllegalStateException("该门票已核销"); |
| | | } |
| | | |
| | | // 以待核销状态作为更新条件,避免并发请求重复核销同一张门票。 |
| | | UserPointsMerchandise updatedTicket = new UserPointsMerchandise(); |
| | | updatedTicket.setId(ticket.getId()); |
| | | updatedTicket.setVerifiStoreId(dto.getVerifiStoreId()); |
| | | updatedTicket.setStatus(2); |
| | | updatedTicket.setVerificationTime(new Date()); |
| | | updatedTicket.setVerificationUserId(dto.getVerificationUserId()); |
| | | updatedTicket.setGoType(dto.getGoType()); |
| | | boolean updated = userPointsMerchandiseService.update(updatedTicket, |
| | | new LambdaQueryWrapper<UserPointsMerchandise>() |
| | | .eq(UserPointsMerchandise::getId, ticket.getId()) |
| | | .eq(UserPointsMerchandise::getStatus, 1)); |
| | | if (!updated) { |
| | | throw new IllegalStateException("该门票已核销"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Autowired |
| | |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/base/pointMerchars/getAmount") |
| | | public List<PointMerchandiseIncomeVo> getAmount() { |
| | | return userPointsMerchandiseService.getAmount(); |
| | | public List<PointMerchandiseIncomeVo> getAmount(@RequestBody List<Integer> storeIds) { |
| | | return userPointsMerchandiseService.getAmount(storeIds); |
| | | } |
| | | |
| | | |
| | |
| | | if (now.after(end)&&detailsResponse.getUseStatus()==2) { |
| | | detailsResponse.setUseStatus(3); |
| | | } |
| | | // if (detailsResponse.getUseStatus()!=3){ |
| | | // if (detailsResponse.getUseStatus()==1 &&now.after(end)){ |
| | | // detailsResponse.setUseStatus(2); |
| | | // }else{ |
| | | // detailsResponse.setUseStatus(2); |
| | | // } |
| | | // } |
| | | |
| | | } else if (merchandise.getCardType() == 3) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | if (now.after(end)&&detailsResponse.getUseStatus()==2) { |
| | | detailsResponse.setUseStatus(3); |
| | | } |
| | | // if (detailsResponse.getUseStatus()!=3){ |
| | | // if (detailsResponse.getUseStatus()==1 &&now.after(end)){ |
| | | // detailsResponse.setUseStatus(2); |
| | | // }else{ |
| | | // detailsResponse.setUseStatus(2); |
| | | // } |
| | | // } |
| | | |
| | | } else if (merchandise.getCardType() == 4) { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | if (now.after(end)&&detailsResponse.getUseStatus()==2) { |
| | | detailsResponse.setUseStatus(3); |
| | | } |
| | | // if (detailsResponse.getUseStatus()!=3){ |
| | | // if (detailsResponse.getUseStatus()==1 &&now.after(end)){ |
| | | // detailsResponse.setUseStatus(2); |
| | | // }else{ |
| | | // detailsResponse.setUseStatus(2); |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | map.put("id", pointsMerchandise.getId()); |
| | | map.put("userId", pointsMerchandise.getUserId()); |
| | | map.put("status", pointsMerchandise.getStatus()); |
| | | map.put("goType", pointsMerchandise.getGoType()); |
| | | map.put("payTime", sdf.format(pointsMerchandise.getPaymentTime())); |
| | | map.put("orderNumber", pointsMerchandise.getOrderNumber()); |
| | | mapList.add(map); |
| | | } |
| | | } |