| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ISysCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.service.ITActivityGeneralizationService; |
| | | import com.stylefeng.guns.modular.system.service.IUserCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.util.GaoDeMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("startTime", sdf.format(data.getStartTime())); |
| | | model.addAttribute("endTime", sdf.format(data.getEndTime())); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | model.addAttribute("insertTime", sdf1.format(data.getInsertTime())); |
| | | model.addAttribute("item",data); |
| | | List<SysCouponRecord> siteList = sysCouponRecordService.selectList(new EntityWrapper<SysCouponRecord>() |
| | | .eq("id",data.getCouponId())); |
| | | |
| | | List<UserCouponRecord> userCouponRecords = userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("couponId", siteList.get(0).getId()).groupBy("userId")); |
| | | siteList.get(0).setReceive(userCouponRecords==null?0:userCouponRecords.size()); |
| | | |
| | | |
| | | model.addAttribute("siteList",siteList); |
| | | return PREFIX + "editHtml.html"; |
| | | } |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | @RequestMapping("/generalization_detail/{id}") |
| | | public String generalization_detail(Model model,@PathVariable("id") Integer id) { |
| | | TActivityGeneralization data = activityGeneralizationService.selectById(id); |
| | |
| | | model.addAttribute("item",data); |
| | | List<SysCouponRecord> siteList = sysCouponRecordService.selectList(new EntityWrapper<SysCouponRecord>() |
| | | .eq("id",data.getCouponId())); |
| | | List<UserCouponRecord> userCouponRecords = userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("couponId", siteList.get(0).getId()).groupBy("userId")); |
| | | siteList.get(0).setReceive(userCouponRecords==null?0:userCouponRecords.size()); |
| | | model.addAttribute("siteList",siteList); |
| | | |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | model.addAttribute("insertTime", sdf1.format(data.getInsertTime())); |
| | | return PREFIX + "generalization_detail.html"; |
| | | } |
| | | |
| | |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String, Object>> list = activityGeneralizationService.getList(page, beginTime, endTime, activityName, state); |
| | | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | LocalDate currentDate = LocalDate.now(); |
| | | for (Map<String, Object> item : list) { |
| | | String timeRangeStr = (String) item.get("time"); |
| | | if (timeRangeStr != null && !timeRangeStr.isEmpty()) { |
| | | String[] range = timeRangeStr.split(" — "); |
| | | LocalDate startDate = LocalDate.parse(range[0], formatter); |
| | | LocalDate endDate = LocalDate.parse(range[1], formatter); |
| | | |
| | | // 判断当前日期是否在范围内 |
| | | int newState; |
| | | if (currentDate.isBefore(startDate)) { |
| | | newState = 2; |
| | | } else if (currentDate.isAfter(endDate)) { |
| | | newState = 3; |
| | | } else { |
| | | newState = 1; |
| | | } |
| | | |
| | | // 更新状态 |
| | | item.put("state", newState); |
| | | } |
| | | } |
| | | // DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | // LocalDate currentDate = LocalDate.now(); |
| | | // for (Map<String, Object> item : list) { |
| | | // String timeRangeStr = (String) item.get("time"); |
| | | // if (timeRangeStr != null && !timeRangeStr.isEmpty()) { |
| | | // String[] range = timeRangeStr.split(" — "); |
| | | // LocalDate startDate = LocalDate.parse(range[0], formatter); |
| | | // LocalDate endDate = LocalDate.parse(range[1], formatter); |
| | | // |
| | | // // 判断当前日期是否在范围内 |
| | | // int newState; |
| | | // if (currentDate.isBefore(startDate)) { |
| | | // newState = 2; |
| | | // } else if (currentDate.isAfter(endDate)) { |
| | | // newState = 3; |
| | | // } else { |
| | | // newState = 1; |
| | | // } |
| | | // |
| | | // // 更新状态 |
| | | // item.put("state", newState); |
| | | // } |
| | | // } |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | } |