44323
2023-11-17 e863d3485d077c90988c81a756b37ef21cf4962e
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TGoodsController.java
@@ -51,6 +51,7 @@
    private String PREFIX = "/system/tGoods/";
    private String PREFIX1 = "/system/tGoodsAudit/";
    @Resource
@@ -85,6 +86,11 @@
    public String index(Model model) {
        return PREFIX + "TGoods.html";
    }
    @RequestMapping("/audit")
    public String audit(Model model) {
        return PREFIX1 + "TGoodsAudit.html";
    }
    /**
@@ -132,7 +138,7 @@
            Integer coursePackageId = pointMercharsVo.getCoursePackageId();
            List<String> name = courseClient.queryPackageById(coursePackageId);
            Integer coursePackageId1 = pointMercharsVo.getCoursePackageId();
            String classHours = courseClient.getHours(coursePackageId1);
            List<Integer> classHours = courseClient.getHours(coursePackageId1);
            model.addAttribute("typeName",name.get(0));
            model.addAttribute("pageName",name.get(1));
            model.addAttribute("classHours",classHours);
@@ -153,7 +159,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);
            }
@@ -244,6 +250,8 @@
        model.addAttribute("list",provinceList);
        return PREFIX + "TStoreList.html";
    }
    /**
     * 跳转到门店管理列表页
     */
@@ -403,6 +411,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<>();
@@ -474,9 +483,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<>();
@@ -488,11 +499,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{
@@ -501,7 +528,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,6 +565,33 @@
        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;
    }
@@ -537,13 +602,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";
    }
@@ -577,6 +650,8 @@
    public String payOfDetails(@PathVariable(value = "id") Integer id,Model model) {
        System.out.println(id);
        model.addAttribute("id",id);
        PointsMerchandise byId = pointMercharsClient.getById(id);
        model.addAttribute("type",byId.getType());
        return PREFIX + "TGoods_pay.html";
    }
    /**