| | |
| | | import com.dsh.activity.feignclient.other.model.Store; |
| | | import com.dsh.activity.model.CouponListVo; |
| | | import com.dsh.activity.model.request.CommodityRequest; |
| | | import com.dsh.activity.model.request.CouponDataVo; |
| | | import com.dsh.activity.model.request.CouponPackageReq; |
| | | import com.dsh.activity.model.response.CouponPackageResp; |
| | | import com.dsh.activity.service.CouponCityService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coupon/insertIntoCouponData") |
| | | public boolean saveCouponData(@RequestBody CouponDataVo dataVo){ |
| | | try { |
| | | System.out.println(dataVo); |
| | | Coupon coupon = new Coupon(); |
| | | coupon.setName(dataVo.getCouponName()); |
| | | coupon.setType(dataVo.getPrescription()); |
| | | // coupon.setContent(dataVo.getIllustrate()); |
| | | coupon.setIllustrate(dataVo.getIllustrate()); |
| | | coupon.setDistributionMethod(dataVo.getDistributionMethod()); |
| | | coupon.setRedemptionMethod(dataVo.getExchangeMethod()); |
| | | coupon.setCash(dataVo.getRequiredCash()); |
| | | coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints())); |
| | | coupon.setQuantityIssued(dataVo.getQuantityIssued()); |
| | | coupon.setPickUpQuantity(dataVo.getPickUpQuantity()); |
| | | coupon.setUseScope(dataVo.getCompany()); |
| | | coupon.setAuditStatus(1); |
| | | coupon.setStatus(1); |
| | | coupon.setInsertTime(new Date()); |
| | | coupon.setCover(dataVo.getGoodImg()); |
| | | List<String> goodImgs = dataVo.getGoodImgs(); |
| | | StringBuilder builder = new StringBuilder(); |
| | | if (goodImgs.size() > 0){ |
| | | if (goodImgs.size() == 1){ |
| | | coupon.setProductImages(goodImgs.get(0)); |
| | | }else { |
| | | for (String goodImg : goodImgs) { |
| | | builder.append(goodImg).append(","); |
| | | } |
| | | builder.deleteCharAt(builder.lastIndexOf(",")); |
| | | coupon.setProductImages(builder.toString()); |
| | | } |
| | | } |
| | | coupon.setPublisherType(dataVo.getUserType()); |
| | | if (dataVo.getUserType() == 1){ |
| | | coupon.setCityManagerId(dataVo.getCityManagerId()); |
| | | } |
| | | return couponService.save(coupon); |
| | | }catch (Exception e){ |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |