无关风月
2024-09-24 61bbd595ee2bc3c67b40878894dcc07174c6eea6
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TGoodsController.java
@@ -27,10 +27,12 @@
import com.dsh.guns.modular.system.service.ICityService;
import com.dsh.guns.modular.system.service.IRegionService;
import com.dsh.guns.modular.system.service.IStoreService;
import com.dsh.guns.modular.system.service.ITSiteService;
import com.dsh.guns.modular.system.util.OBSUploadUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -59,7 +61,8 @@
    @Resource
    private IRegionService regiService;
    @Autowired
    private ITSiteService siteService;
    @Resource
    private IStoreService storeService;
@@ -168,25 +171,24 @@
                List<StoreVos> storeVos = pointMercharsClient.getStoreList(id);
                model.addAttribute("store",storeVos);
            }
            // 门票选的指定场地
            if (infoOneVo.getUseScope() == 4){
                List<StoreVos> storeVos = pointMercharsClient.getStoreList(id);
                model.addAttribute("sites",storeVos);
            }
            model.addAttribute("pictures",list);
            model.addAttribute("exchangeMethod",infoOneVo.getExchangeMethod());
            return PREFIX + "TGoods_detail_one.html";
        }
    }
    @RequestMapping("/coupon_record/{id}")
    public String memberCouponAdd(@PathVariable Integer id,Model model) {
        Coupon coupon = client.queryCouponById(id);
        model.addAttribute("id",id);
        model.addAttribute("type",coupon.getType());
        return PREFIX + "TCouponRecord.html";
    }
    @RequestMapping("/coupon_detail/{id}")
    public String memberCouponDetail(@PathVariable Integer id,Model model) {
@@ -265,6 +267,13 @@
        List<TCity> provinceList = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
        model.addAttribute("list",provinceList);
        return PREFIX + "TStoreListOne.html";
    }
    // 场地列表
    @RequestMapping("/siteList1")
    public String storePage2(Model model) {
        List<TCity> provinceList = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
        model.addAttribute("list",provinceList);
        return PREFIX + "TSiteListOne.html";
    }
    @RequestMapping("/updateType")
    @ResponseBody
@@ -449,7 +458,7 @@
    @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
                       String startTime,String text,Integer sort,String name,Integer useScope,String cityIds,String storeIds,String sites,Integer cardType
    ) throws ParseException {
        // 判断当前选择的课包 是不是假期课 然后判断选择的有效期是否在假期课有效期内
        if (coursePackageId!=null){
@@ -472,6 +481,8 @@
            }
        }
        PointsMerchandise pointsMerchandise = new PointsMerchandise();
        pointsMerchandise.setAddUserId(UserExt.getUser().getObjectId());
        pointsMerchandise.setAddType(UserExt.getUser().getObjectType());
        pointsMerchandise.setType(typeAll);
        pointsMerchandise.setName(name);
        pointsMerchandise.setCoursePackageId(coursePackageId);
@@ -492,7 +503,19 @@
        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 (UserExt.getUser().getObjectType()==3){
            if (StringUtils.hasLength(sites)){
                useScope = 4;
                storeIds="";
                pointsMerchandise.setUseScope(4);
            }else{
                useScope = 3;
                pointsMerchandise.setUseScope(3);
            }
        }else{
            pointsMerchandise.setUseScope(useScope);
        }
        if(ToolUtil.isNotEmpty(provinceCode)){
            TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, provinceCode));
            pointsMerchandise.setProvinceCode(provinceCode);
@@ -528,10 +551,17 @@
                    objects.add(map);
                }
                pointMercharsClient.addCitys(objects);
            }else if(useScope==3){
            }else if(useScope==3||useScope==4){
                if(UserExt.getUser().getObjectType()==3){
                    storeIds=UserExt.getUser().getObjectId().toString();
                }
                if (useScope==4){
                    storeIds ="";
                }
                if (useScope==3){
                    sites ="";
                }
                if (StringUtils.hasLength(storeIds)){
                Integer oid=null;
                String[] split = storeIds.split(",");
                for (int i = 0; i < split.length; i++) {
@@ -544,12 +574,12 @@
                        return "5003";
                    }
                }
                }
                Integer id = pointMercharsClient.add(pointsMerchandise);
                String pam = id+"_"+storeIds;
                // 添加多个城市 门店
                String pam = id+"_"+storeIds+"_"+sites;
                // 添加多个城市 门店 场地
                try{
                    pointMercharsClient.addOther(pam);
                }catch (Exception e){
                    e.printStackTrace();
                }
@@ -557,10 +587,8 @@
                Integer id = pointMercharsClient.add(pointsMerchandise);
            }
        }else {
            // ?
            pointsMerchandise.setShelves(storeId);
            pointsMerchandise.setUseScope(3);
            Integer id = pointMercharsClient.add(pointsMerchandise);
        }
        return new SuccessTip<>();