44323
2024-03-08 db3e6f6d5a8f29a5dc576aba2eab76a8133ce03c
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
@@ -2,6 +2,7 @@
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -9,6 +10,8 @@
import com.dsh.course.feignClient.account.CityClient;
import com.dsh.course.feignClient.account.model.CityListQuery;
import com.dsh.course.feignClient.account.model.TCityManager;
import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupStore;
import com.dsh.course.feignClient.communityWorldCup.WorldCupStoreClient;
import com.dsh.course.feignClient.competition.CompetitionClient;
import com.dsh.course.feignClient.other.model.Site;
import com.dsh.course.mapper.UserMapper;
@@ -28,6 +31,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -85,6 +89,8 @@
    private ITSiteService siteService;
    @Autowired
    private IUserService userService;
    @Autowired
    private WorldCupStoreClient worldCupStoreClient;
    // 添加SUTU
@@ -168,12 +174,12 @@
        }
//        if (!roleid.equals("1")){
            TOperator operator1 = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("userId", UserExt.getUser().getId()));
            if(operator1!=null){
                model.addAttribute("operator",operator1.getId());
            }else {
                model.addAttribute("operator",0);
            }
        TOperator operator1 = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("userId", UserExt.getUser().getId()));
        if(operator1!=null){
            model.addAttribute("operator",operator1.getId());
        }else {
            model.addAttribute("operator",0);
        }
//        }
        model.addAttribute("yysList",list1);
@@ -216,7 +222,7 @@
        }else{
            List<TOperatorCity> list = operatorCityService.list(new QueryWrapper<TOperatorCity>()
                    .eq("operatorId", operatorId)
            .eq("pid",byId.getId()));
                    .eq("pid",byId.getId()));
            if (list.size() == 0){
                // 说明管理整个省
                TCity code = cityService.getOne(new QueryWrapper<TCity>().eq("code", byId.getCode()));
@@ -306,7 +312,7 @@
        model.addAttribute("list2",list2.getRecords());
        String roleid = UserExt.getUser().getRoleid();
            model.addAttribute("role",roleid);
        model.addAttribute("role",roleid);
        model.addAttribute("time",byId.getStartTime()+" - "+byId.getEndTime());
        User byId1 = userMapper.selectById(byId.getStoreStaffId());
        model.addAttribute("city",byId1);
@@ -421,11 +427,11 @@
        StoreConfig c8 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,8));
        model.addAttribute("c8",c8);
        model.addAttribute("id",id);
        StoreConfig c9 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,9));
        if (c9==null){
            model.addAttribute("c9",new StoreConfig());
        List<WorldCupStore> worldCupStores = worldCupStoreClient.getWorldCupStoreListByStoreId(id);
        if (CollectionUtils.isEmpty(worldCupStores)){
            model.addAttribute("worldCupStores",new ArrayList<>());
        }else{
            model.addAttribute("c9",c9);
            model.addAttribute("worldCupStores",worldCupStores);
        }
        return PREFIX + "TShop_imgAll.html";
    }
@@ -484,7 +490,7 @@
                if(list1.size()>0){
                    if (ToolUtil.isNotEmpty(tStore.getProvinceCode())) {
                        TOperatorCity byId = operatorCityService.getOne(new QueryWrapper<TOperatorCity>().eq("code",tStore.getProvinceCode())
                        .eq("operatorId",yyId));
                                .eq("operatorId",yyId));
                        TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId.getCode()));
                        tStore.setProvince(one.getName());
                        tStore.setProvinceCode(one.getCode());
@@ -549,13 +555,13 @@
            user.setStatus(1);
            userMapper.insert(user);
            tStore.setStoreStaffId(user.getId());
                tStore.setLon(lon);
                tStore.setLat(lat);
                if (yyId == null || yyId == 0){
                    tStore.setOperatorId(0);
                }else{
                    tStore.setOperatorId(yyId);
                }
            tStore.setLon(lon);
            tStore.setLat(lat);
            if (yyId == null || yyId == 0){
                tStore.setOperatorId(0);
            }else{
                tStore.setOperatorId(yyId);
            }
            if (UserExt.getUser().getObjectType()==2){
                tStore.setOperatorId(UserExt.getUser().getObjectId());
            }
@@ -716,9 +722,9 @@
    }
    @RequestMapping(value = "/saveImgAll")
    @ResponseBody
    public Object saveImgAll(Integer id,Integer px1,Integer px2,Integer px3,Integer px4,Integer px5,Integer px6,Integer px7,Integer px8,Integer px9,
                             String c1,String c2,String c3,String c4,String c5,String c6,String c7,String c8,String c9,
                             Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8,Integer r9) {
    public Object saveImgAll(Integer id,Integer px1,Integer px2,Integer px3,Integer px4,Integer px5,Integer px6,Integer px7,Integer px8,
                             String c1,String c2,String c3,String c4,String c5,String c6,String c7,String c8,
                             Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8,String str) {
        try {
            ArrayList<StoreConfig> storeConfigs = new ArrayList<>();
            StoreConfig collect1 = collect(id, px1, r1, c1, 1);
@@ -737,9 +743,27 @@
            storeConfigs.add(collect6);
            storeConfigs.add(collect7);
            storeConfigs.add(collect8);
            StoreConfig collect9 = collect(id, px9, r9, c9, 9);
            storeConfigs.add(collect9);
            storeConfigService.updateBatchById(storeConfigs);
            // 修改世界杯
            JSONArray jsonArray = JSONObject.parseArray(str);
            List<WorldCupStore> worldCupStores = new ArrayList<>();
            for (Object o : jsonArray) {
                String s = JSONObject.toJSONString(o);
                JSONObject jsonObject = JSONObject.parseObject(s);
                Integer id1 = jsonObject.getInteger("id");
                String backgroundImage = jsonObject.getString("backgroundImage");
                Integer isOpen = jsonObject.getInteger("isOpen");
                Integer sort = jsonObject.getInteger("sort");
                WorldCupStore worldCupStore = new WorldCupStore();
                worldCupStore.setSort(sort);
                worldCupStore.setId(id1);
                worldCupStore.setBackgroundImage(backgroundImage);
                worldCupStore.setIsOpen(isOpen);
                worldCupStores.add(worldCupStore);
            }
            worldCupStoreClient.updateWorldCupStoreListById(worldCupStores);
            return new SuccessTip<>();
        }catch (Exception e){
            e.printStackTrace();
@@ -1006,7 +1030,7 @@
    @ResponseBody
    public Object addConfigOne(String url,String name,Integer page,Integer type,String  turnId,Integer sort) {
        try {
             storeService.addConfigOne(url,name,page,type,turnId,sort);
            storeService.addConfigOne(url,name,page,type,turnId,sort);
            return SUCCESS_TIP;
        }catch (Exception e){
            e.printStackTrace();
@@ -1039,7 +1063,7 @@
            }
        return SUCCESS_TIP;
            return SUCCESS_TIP;
        }catch (Exception e){
            e.printStackTrace();
            return ERROR;
@@ -1055,7 +1079,7 @@
            storeOtherService.updateById(byId);
        return SUCCESS_TIP;
            return SUCCESS_TIP;
        }catch (Exception e){
            e.printStackTrace();
            return ERROR;
@@ -1117,9 +1141,9 @@
    @RequestMapping(value = "/addConfigOne9")
    @ResponseBody
    public Object addConfigOne9(String url,String name,Integer page,Integer type,String  turnId,Integer sort,Integer id) {
            try {
        try {
            TStoreOtherConfigTrue byId = new TStoreOtherConfigTrue();
                byId.setPid(id);
            byId.setPid(id);
            if(ToolUtil.isNotEmpty(url)){
                byId.setUrl(url);
            }