| | |
| | | package com.dsh.activity.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.activity.entity.Coupon; |
| | | import com.dsh.activity.entity.UserCoupon; |
| | | import com.dsh.activity.feignclient.model.CouponExamineListSearch; |
| | | import com.dsh.activity.feignclient.model.CouponListOfSearch; |
| | | import com.dsh.activity.model.CouponListVo; |
| | | import com.dsh.activity.model.request.CommodityRequest; |
| | | import com.dsh.activity.model.request.CouponPackageReq; |
| | |
| | | import com.dsh.activity.util.GDMapGeocodingUtil; |
| | | import com.dsh.activity.util.ResultUtil; |
| | | import com.dsh.activity.util.TokenUtil; |
| | | import com.dsh.activity.util.ToolUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | .eq("couponId",id)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/coupon/insertToAppuserCoupon") |
| | | public void insertToAppuserCoupon(@RequestBody UserCoupon coupon){ |
| | | ucService.save(coupon); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coupon/queryCouponListSearch") |
| | | public List<Map<String,Object>> getCouponListOfSearch(@RequestBody CouponListOfSearch ofSearch){ |
| | | List<Map<String, Object>> mapList = couponService.queryCouponListOfSearch(ofSearch); |
| | | if (mapList.size() > 0){ |
| | | for (Map<String, Object> stringObjectMap : mapList) { |
| | | Integer o = (Integer) stringObjectMap.get("id"); |
| | | Object startTime = stringObjectMap.get("startTime"); |
| | | Object endTime = stringObjectMap.get("endTime"); |
| | | stringObjectMap.put("timeValue",startTime + "至"+endTime); |
| | | int count = ucService.count(new LambdaQueryWrapper<UserCoupon>() |
| | | .eq(UserCoupon::getCouponId, o)); |
| | | stringObjectMap.put("hasPickQty",count); |
| | | } |
| | | } |
| | | return mapList; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coupon/couponExamineListSearch") |
| | | public List<Map<String,Object>> getCouponExamineListOfSearch(@RequestBody CouponExamineListSearch ofSearch){ |
| | | List<Map<String, Object>> mapList = couponService.queryCouponExamineList(ofSearch); |
| | | if (mapList.size() > 0){ |
| | | for (Map<String, Object> stringObjectMap : mapList) { |
| | | Object startTime = stringObjectMap.get("startTime"); |
| | | Object endTime = stringObjectMap.get("endTime"); |
| | | stringObjectMap.put("timeValue",startTime + "至"+endTime); |
| | | } |
| | | } |
| | | return mapList; |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/coupon/couponExamineDetail") |
| | | Map<String, Object> queryCouponExamineDetail(@RequestBody Integer id){ |
| | | Map<String, Object> couponInfo = new HashMap<>(); |
| | | Coupon coupon = couponService.getById(id); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | if (ToolUtil.isNotEmpty(coupon)){ |
| | | couponInfo.put("",coupon.getId()); |
| | | couponInfo.put("",coupon.getName()); |
| | | couponInfo.put("",coupon.getAuditStatus()); |
| | | couponInfo.put("",coupon.getProvince()); |
| | | couponInfo.put("",coupon.getCity()); |
| | | couponInfo.put("",coupon.getType()); |
| | | couponInfo.put("",coupon.getContent()); |
| | | couponInfo.put("",coupon.getIllustrate()); |
| | | couponInfo.put("",coupon.getDistributionMethod()); |
| | | couponInfo.put("",coupon.getRedemptionMethod()); |
| | | couponInfo.put("integral",coupon.getIntegral()); |
| | | couponInfo.put("cash",coupon.getCash()); |
| | | couponInfo.put("userPopulation",coupon.getUserPopulation()); |
| | | couponInfo.put("quantityIssued",coupon.getQuantityIssued()); |
| | | couponInfo.put("pickUpQuantity",coupon.getPickUpQuantity()); |
| | | String startTime = simpleDateFormat.format(coupon.getStartTime()); |
| | | String endTime = simpleDateFormat.format(coupon.getEndTime()); |
| | | couponInfo.put("timeValue",startTime + "至"+endTime); |
| | | couponInfo.put("useScope",coupon.getUseScope()); |
| | | } |
| | | return couponInfo; |
| | | } |
| | | |
| | | } |