| | |
| | | import com.dsh.course.feignClient.activity.CouponClient; |
| | | import com.dsh.course.feignClient.activity.PointMercharsClient; |
| | | import com.dsh.course.feignClient.activity.model.*; |
| | | import com.dsh.course.feignClient.course.CourseClient; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.base.tips.ErrorTip; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | |
| | | private String PREFIX = "/system/tGoods/"; |
| | | private String PREFIX1 = "/system/tGoodsAudit/"; |
| | | |
| | | |
| | | @Resource |
| | |
| | | @Autowired |
| | | private ICityService cityService; |
| | | |
| | | @Autowired |
| | | private CourseClient courseClient; |
| | | |
| | | @Resource |
| | | private PointMercharsClient pointMercharsClient; |
| | | |
| | |
| | | |
| | | return PREFIX + "TGoods.html"; |
| | | } |
| | | @RequestMapping("/audit") |
| | | public String audit(Model model) { |
| | | return PREFIX1 + "TGoodsAudit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | |
| | | model.addAttribute("userType",objectType); |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | List<Map<String,Object>> listOne = courseClient.getPageageType(); |
| | | model.addAttribute("courseType",listOne); |
| | | |
| | | |
| | | return PREFIX + "TGoods_add.html"; |
| | | } |
| | | |
| | |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | return PREFIX + "TGoods_detail_one.html"; |
| | | } |
| | | |
| | | @RequestMapping("/goods_info/{id}") |
| | | public String memberCouponInfo(@PathVariable Integer id, Model model) { |
| | | PointsMerchandise pointMercharsVo = pointMercharsClient.queryPointMerchaseById(id); |
| | | model.addAttribute("item",pointMercharsVo); |
| | | if(pointMercharsVo.getType()==2){ |
| | | Date startTime = pointMercharsVo.getStartTime(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("sTime",format.format(startTime)); |
| | | model.addAttribute("eTime",format.format(pointMercharsVo.getEndTime())); |
| | | Integer shopId = pointMercharsClient.getshopName(id); |
| | | TStore byId = storeService.getById(shopId); |
| | | model.addAttribute("shopName",byId.getName()); |
| | | Integer coursePackageId = pointMercharsVo.getCoursePackageId(); |
| | | List<String> name = courseClient.queryPackageById(coursePackageId); |
| | | Integer coursePackageId1 = pointMercharsVo.getCoursePackageId(); |
| | | String classHours = courseClient.getHours(coursePackageId1); |
| | | model.addAttribute("typeName",name.get(0)); |
| | | model.addAttribute("pageName",name.get(1)); |
| | | model.addAttribute("classHours",classHours); |
| | | String productImages = pointMercharsVo.getProductImages(); |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | for (String s : productImages.split(",")) { |
| | | strings.add(s); |
| | | } |
| | | model.addAttribute("pictures",strings); |
| | | return PREFIX + "TGoods_detail_two.html"; |
| | | }else { |
| | | GoodsInfoOneVo infoOneVo = pointMercharsClient.queryDetailsOfGoods(id); |
| | | System.out.println("pointMercharsVo:"+infoOneVo); |
| | | model.addAttribute("item",infoOneVo); |
| | | String[] split = infoOneVo.getPics().split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | if (infoOneVo.getUseScope() == 2){ |
| | | List<StoreVos> provinces = pointMercharsClient.getProvinces(id); |
| | | model.addAttribute("city",provinces); |
| | | } |
| | | if (infoOneVo.getUseScope() == 2){ |
| | | List<StoreVos> storeVos = pointMercharsClient.getStoreList(id); |
| | | model.addAttribute("store",storeVos); |
| | | } |
| | | model.addAttribute("pictures",list); |
| | | model.addAttribute("exchangeMethod",infoOneVo.getExchangeMethod()); |
| | | return PREFIX + "TGoods_detail_one.html"; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/storeList") |
| | | public String storePage(Model model) { |
| | | List<TCity> provinceList = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",provinceList); |
| | | return PREFIX + "TStoreList.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到门店管理列表页 |
| | | */ |
| | | @RequestMapping("/storeList1") |
| | | public String storePage1(Model model) { |
| | | List<TCity> provinceList = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",provinceList); |
| | | return PREFIX + "TStoreListOne.html"; |
| | | } |
| | | @RequestMapping("/updateType") |
| | | @ResponseBody |
| | |
| | | pointMercharsClient.updateGoodsDetail(stringObjectHashMap); |
| | | return new SuccessTip<>(); |
| | | } |
| | | /* |
| | | ajax.set("typeAll",typeAll); |
| | | ajax.set("provinceCode",pCode); |
| | | ajax.set("cityCode",cCode); |
| | | ajax.set("storeId",storeId); |
| | | ajax.set("coursePackageTypeId",coursePackageTypeId); |
| | | ajax.set("coursePackageId",coursePackageId); |
| | | ajax.set("coursePackageConfigId",coursePackageConfigId); |
| | | ajax.set("price",price); |
| | | ajax.set("type",type); |
| | | ajax.set("integral",integral); |
| | | ajax.set("cash",cash); |
| | | ajax.set("cover",cover1); |
| | | ajax.set("imgOne",imgOne); |
| | | ajax.set("userPopulation",userPopulation); |
| | | ajax.set("quantityIssued",quantityIssued); |
| | | ajax.set("pickUpQuantity",pickUpQuantity); |
| | | ajax.set("startTime",startTime); |
| | | ajax.set("text",text); |
| | | ajax.set("sort",sort); |
| | | ajax.set("useScope",company); |
| | | ajax.set("cityIds",cts); |
| | | ajax.set("storeIds",stores); |
| | | */ |
| | | @PostMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add( Integer typeAll,String provinceCode,String cityCode,Integer storeId,Integer coursePackageTypeId,Integer coursePackageId,Integer coursePackageConfigId, |
| | | Double price,Integer type,Integer integral,Double cash,String cover,String imgOne,Integer userPopulation,Integer quantityIssued,Integer pickUpQuantity, |
| | | String startTime,String text,Integer sort,String name,Integer useScope,String cityIds,String storeIds,Integer cardType |
| | | ) throws ParseException { |
| | | PointsMerchandise pointsMerchandise = new PointsMerchandise(); |
| | | pointsMerchandise.setType(typeAll); |
| | | pointsMerchandise.setName(name); |
| | | pointsMerchandise.setCoursePackageId(coursePackageId); |
| | | pointsMerchandise.setPrice(new BigDecimal(price)); |
| | | pointsMerchandise.setRedemptionMethod(type); |
| | | if(type==2 || type==3){ |
| | | pointsMerchandise.setCash(new BigDecimal(cash)); |
| | | } |
| | | if(type==1 || type==2){ |
| | | pointsMerchandise.setIntegral(integral); |
| | | } |
| | | pointsMerchandise.setCover(cover); |
| | | pointsMerchandise.setProductImages(imgOne); |
| | | pointsMerchandise.setUserPopulation(userPopulation); |
| | | pointsMerchandise.setCardType(cardType); |
| | | pointsMerchandise.setQuantityIssued(quantityIssued); |
| | | pointsMerchandise.setPickUpQuantity(pickUpQuantity); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | pointsMerchandise.setStartTime(format.parse(startTime.split(" - ")[0])); |
| | | pointsMerchandise.setEndTime(format.parse(startTime.split(" - ")[1])); |
| | | pointsMerchandise.setUseScope(useScope); |
| | | if(ToolUtil.isNotEmpty(provinceCode)){ |
| | | TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, provinceCode)); |
| | | pointsMerchandise.setProvinceCode(provinceCode); |
| | | pointsMerchandise.setProvince(one.getName()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(cityCode)){ |
| | | TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, cityCode)); |
| | | pointsMerchandise.setCityCode(cityCode); |
| | | pointsMerchandise.setCity(one.getName()); |
| | | } |
| | | pointsMerchandise.setRedemptionInstructions(text); |
| | | pointsMerchandise.setSort(sort); |
| | | pointsMerchandise.setState(1); |
| | | pointsMerchandise.setInsertTime(new Date()); |
| | | pointsMerchandise.setCoursePackageConfigId(coursePackageConfigId); |
| | | // 代替storeId |
| | | pointsMerchandise.setShelves(1); |
| | | Integer id = pointMercharsClient.add(pointsMerchandise); |
| | | if(typeAll!=2){ |
| | | if(useScope==2){ |
| | | ArrayList<Map<String,String>> objects = new ArrayList<>(); |
| | | for (String s : cityIds.split(",")) { |
| | | TCity tCity = cityService.getById(Integer.valueOf(s)); |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | TCity pCity = cityService.getById(tCity.getParentId()); |
| | | map.put("pName",pCity.getName()); |
| | | map.put("pCode",pCity.getCode()); |
| | | map.put("cName",tCity.getName()); |
| | | map.put("cCode",tCity.getCode()); |
| | | map.put("id",id.toString()); |
| | | objects.add(map); |
| | | } |
| | | pointMercharsClient.addCitys(objects); |
| | | }else if(useScope==3){ |
| | | String pam = id+"_"+storeIds; |
| | | // 添加多个城市 门店 |
| | | try{ |
| | | pointMercharsClient.addOther(pam); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return new SuccessTip<>(); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | ofSearch.setState(state); |
| | | System.out.println(ofSearch); |
| | | return pointMercharsClient.getIntegralGoodsListOfSearch(ofSearch); |
| | | } |
| | | @RequestMapping(value = "/listAudit") |
| | | @ResponseBody |
| | | public Object listOfIntegralGoodsAudit(String name, Integer type, Integer redemptionMethod , Integer userPopulation, Integer activeStatus) { |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | IntegralGoodsOfSearch ofSearch = new IntegralGoodsOfSearch(); |
| | | ofSearch.setPage(page); |
| | | ofSearch.setName(name); |
| | | ofSearch.setType(type); |
| | | ofSearch.setRedemptionMethod(redemptionMethod); |
| | | ofSearch.setUserPopulation(userPopulation); |
| | | ofSearch.setActiveStatus(activeStatus); |
| | | return pointMercharsClient.getIntegralGoodsListOfSearchAudit(ofSearch); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/updateTypeOne") |
| | | @ResponseBody |
| | | public Object updateTypeOne(Integer id, Integer type, String remark) { |
| | | Object o = pointMercharsClient.updateType(id + "_" + type + "_" + remark); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "TGoods_pay.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 购买详情 |
| | | * @param id 商品id |
| | | * @return |
| | | */ |
| | | @RequestMapping("/tPay_detail1/{id}") |
| | | public String payOfDetailsOne(@PathVariable(value = "id") Integer id,Model model) { |
| | | System.out.println(id); |
| | | model.addAttribute("id",id); |
| | | return PREFIX + "TGoods_payOne.html"; |
| | | } |
| | | /** |
| | | * 获取 购买记录列表 |
| | | */ |
| | |
| | | payedVo.setPhone(phone); |
| | | payedVo.setStatus(status); |
| | | List<Map<String,Object>> points = pointMercharsClient.queryUserPayedGoodsList(payedVo); |
| | | System.out.println(points); |
| | | System.out.println(points); |
| | | if (points.size() > 0 ){ |
| | | |
| | | for (Map<String, Object> point : points) { |
| | | Object id1 = point.get("id"); |
| | | String idAsString = String.valueOf(id1); |
| | | |
| | | // 移除原始的 "id" 键 |
| | | point.remove("id"); |
| | | |
| | | // 将字符串类型的 "id" 放回 Map 对象中 |
| | | point.put("id", idAsString); |
| | | Integer userId = (Integer) point.get("userId"); |
| | | TAppUser tAppUser = appUserClient.queryById(userId); |
| | | if (ToolUtil.isNotEmpty(tAppUser)){ |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到修改商品详情 |
| | | */ |
| | | @RequestMapping("/goods_info/{id}") |
| | | public String goodsInfo(@PathVariable Integer id, Model model) { |
| | | System.out.println("id:"+id); |
| | | GoodsInfoOneVo infoOneVo = pointMercharsClient.queryDetailsOfGoods(id); |
| | | System.out.println("pointMercharsVo:"+infoOneVo); |
| | | model.addAttribute("item",infoOneVo); |
| | | String[] split = infoOneVo.getPics().split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | if (infoOneVo.getUseScope() == 2){ |
| | | List<StoreVos> provinces = pointMercharsClient.getProvinces(id); |
| | | model.addAttribute("city",provinces); |
| | | } |
| | | if (infoOneVo.getUseScope() == 2){ |
| | | List<StoreVos> storeVos = pointMercharsClient.getStoreList(id); |
| | | model.addAttribute("store",storeVos); |
| | | } |
| | | model.addAttribute("pictures",list); |
| | | model.addAttribute("exchangeMethod",infoOneVo.getExchangeMethod()); |
| | | return PREFIX + "TGoods_detail_one.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | } |