| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.activity.CouponClient; |
| | | import com.dsh.course.feignClient.activity.model.Coupon; |
| | | import com.dsh.course.feignClient.activity.model.CouponCity; |
| | | import com.dsh.course.feignClient.activity.model.CouponExamineListSearch; |
| | | import com.dsh.course.feignClient.activity.model.CouponListOfSearch; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.core.exception.GunsException; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | */ |
| | | @RequestMapping(value = "/couponOfDetail/{id}") |
| | | public String detailOfCoupon(@PathVariable Integer id, Model model){ |
| | | Map<String, Object> stringObjectMap = client.queryCouponExamineDetail(id); |
| | | model.addAttribute(stringObjectMap); |
| | | model.addAttribute("id",id); |
| | | Coupon coupon = client.queryCouponById(id); |
| | | Integer auditStatus1 = coupon.getAuditStatus(); |
| | | model.addAttribute("state",auditStatus1); |
| | | String content = coupon.getContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(content); |
| | | String one =""; |
| | | String two =""; |
| | | String three =""; |
| | | if(coupon.getType()==1){ |
| | | one = jsonObject.get("conditionalAmount").toString(); |
| | | two = jsonObject.get("deductionAmount").toString(); |
| | | } |
| | | if(coupon.getType()==2){ |
| | | one = jsonObject.get("conditionalAmount").toString(); |
| | | } |
| | | if(coupon.getType()==3){ |
| | | three = jsonObject.get("experienceName").toString(); |
| | | } |
| | | List<CouponCity> list = new ArrayList<>(); |
| | | List<Integer> list1=null; |
| | | List<TStore> list2=new ArrayList<>(); |
| | | if(coupon.getUseScope()==2){ |
| | | list = client.queryCity(coupon.getId()); |
| | | } |
| | | if(coupon.getUseScope()==3){ |
| | | // 门店ids |
| | | list1 = client.queryStore(coupon.getId()); |
| | | // 门店集合 |
| | | list2 = storeService.list(new LambdaQueryWrapper<TStore>().in(TStore::getId, list1)); |
| | | for (TStore tStore : list2) { |
| | | if (coupon.getPublisherType() == 1){ |
| | | // 获取运营商id |
| | | Integer operatorId = tStore.getOperatorId(); |
| | | TOperator operator = operatorService.getById(operatorId); |
| | | User user = userService.getById(operator.getUserId()); |
| | | if (ToolUtil.isNotEmpty(user)){ |
| | | tStore.setProvince(tStore.getProvince()+tStore.getCity()); |
| | | tStore.setPhone(user.getName()+"-"+user.getPhone()); |
| | | } |
| | | } |
| | | if (coupon.getPublisherType() == 2) { |
| | | User byId = userService.getById(tStore.getStoreStaffId()); |
| | | |
| | | tStore.setProvince(tStore.getProvince() + tStore.getCity()); |
| | | tStore.setPhone(byId.getName() + "-" + byId.getPhone()); |
| | | |
| | | } |
| | | } |
| | | } |
| | | model.addAttribute("city",list); |
| | | model.addAttribute("store",list2); |
| | | model.addAttribute("s",new SimpleDateFormat("yyyy-MM-dd").format(coupon.getStartTime())); |
| | | model.addAttribute("e",new SimpleDateFormat("yyyy-MM-dd").format(coupon.getEndTime())); |
| | | model.addAttribute("one",one); |
| | | model.addAttribute("two",two); |
| | | model.addAttribute("three",three); |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | String productImages = coupon.getProductImages(); |
| | | for (String s : productImages.split(",")) { |
| | | strings.add(s); |
| | | } |
| | | model.addAttribute("integral",coupon.getIntegral()); |
| | | model.addAttribute("cash",coupon.getCash()); |
| | | model.addAttribute("img",strings); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | System.out.println(objectType); |
| | | model.addAttribute("item",coupon); |
| | | model.addAttribute("objectType",objectType); |
| | | Integer auditStatus = coupon.getAuditStatus(); |
| | | switch (auditStatus){ |
| | | case 1: |
| | | model.addAttribute("state","待审核"); |
| | | break; |
| | | case 2: |
| | | model.addAttribute("state","已拒绝"); |
| | | break; |
| | | case 3: |
| | | model.addAttribute("state","未通过"); |
| | | break; |
| | | } |
| | | model.addAttribute("cover",coupon.getCover()); |
| | | model.addAttribute("productImages",coupon.getProductImages()); |
| | | return PREFIX + "TCouponExamineInfo.html"; |
| | | } |
| | | |