44323
2023-11-14 ddbb38c54db9c3670e5ff53f4bf713525de1099d
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TGoodsController.java
@@ -158,7 +158,7 @@
                List<StoreVos> provinces = pointMercharsClient.getProvinces(id);
                model.addAttribute("city",provinces);
            }
            if (infoOneVo.getUseScope() == 2){
            if (infoOneVo.getUseScope() == 3){
                List<StoreVos> storeVos = pointMercharsClient.getStoreList(id);
                model.addAttribute("store",storeVos);
            }
@@ -245,10 +245,21 @@
     */
    @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
    public Object updateType(Long id) {
@@ -399,6 +410,7 @@
        stringObjectHashMap.put("cover",cover);
        stringObjectHashMap.put("productImages",productImages);
        stringObjectHashMap.put("sort",sort);
        stringObjectHashMap.put("type",UserExt.getUser().getObjectType());
        System.out.println(stringObjectHashMap);
        pointMercharsClient.updateGoodsDetail(stringObjectHashMap);
        return new SuccessTip<>();
@@ -470,9 +482,11 @@
        pointsMerchandise.setState(1);
        pointsMerchandise.setInsertTime(new Date());
        pointsMerchandise.setCoursePackageConfigId(coursePackageConfigId);
        if(UserExt.getUser().getObjectType()!=1){
            pointsMerchandise.setStatus(2);
        }
        // 代替storeId
        pointsMerchandise.setShelves(storeId);
        Integer id = pointMercharsClient.add(pointsMerchandise);
        pointsMerchandise.setShelves(1);
        if(typeAll!=2){
            if(useScope==2){
                ArrayList<Map<String,String>> objects = new ArrayList<>();
@@ -484,11 +498,27 @@
                    map.put("pCode",pCity.getCode());
                    map.put("cName",tCity.getName());
                    map.put("cCode",tCity.getCode());
                    map.put("id",id.toString());
                    map.put("id","0");
                    objects.add(map);
                }
                pointMercharsClient.addCitys(objects);
            }else if(useScope==3){
                if(UserExt.getUser().getObjectType()==3){
                    storeIds=UserExt.getUser().getObjectId().toString();
                }
                Integer oid=null;
                String[] split = storeIds.split(",");
                for (int i = 0; i < split.length; i++) {
                    if(i==0){
                        Integer operatorId = storeService.getById(split[0]).getOperatorId();
                        oid=operatorId;
                    }
                    Integer operatorId = storeService.getById(split[i]).getOperatorId();
                    if(oid!=operatorId){
                        return "5003";
                    }
                }
                Integer id = pointMercharsClient.add(pointsMerchandise);
                String pam = id+"_"+storeIds;
                // 添加多个城市 门店
                try{
@@ -497,7 +527,18 @@
                }catch (Exception e){
                    e.printStackTrace();
                }
            }else if(useScope==1){
                Integer id = pointMercharsClient.add(pointsMerchandise);
            }
        }else {
            // ?
            pointsMerchandise.setShelves(storeId);
            pointsMerchandise.setUseScope(3);
            Integer id = pointMercharsClient.add(pointsMerchandise);
        }
        return new SuccessTip<>();
@@ -527,7 +568,6 @@
    @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);
@@ -561,13 +601,21 @@
    public String tCityUpdate(@PathVariable Integer id, Model model) {
        System.out.println("id:"+id);
        PointMercharsVo pointMercharsVo = pointMercharsClient.queryPointMerchaseDetailOfId(id);
        System.out.println("pointMercharsVo:"+pointMercharsVo);
        String[] split = pointMercharsVo.getPics().split(",");
        List<String> list = Arrays.asList(split);
        StringBuilder concatenatedString = new StringBuilder();
        for (String element : split) {
            concatenatedString.append(element).append(",");
        }
        // 去除末尾的逗号
        if (concatenatedString.length() > 0) {
            concatenatedString.setLength(concatenatedString.length() - 1);
        }
        String result = concatenatedString.toString();
        model.addAttribute("id",id);
        model.addAttribute("item",pointMercharsVo);
        model.addAttribute("pictures",list);
        System.out.println(list);
        model.addAttribute("pictures",result);
        return PREFIX + "TGoods_edit.html";
    }
@@ -601,10 +649,21 @@
    public String payOfDetails(@PathVariable(value = "id") Integer id,Model model) {
        System.out.println(id);
        model.addAttribute("id",id);
        Coupon coupon = client.queryCouponById(id);
        model.addAttribute("type",coupon.getType());
        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";
    }
    /**
     * 获取 购买记录列表
     */
@@ -617,9 +676,18 @@
        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)){