| | |
| | | import com.dsh.guns.modular.system.service.TOperatorService; |
| | | import com.dsh.guns.modular.system.util.HttpRequestUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | |
| | | model.addAttribute("typeNames",strings3); |
| | | |
| | | String halfNames = site.getHalfName(); |
| | | ArrayList<String> strings2 = new ArrayList<>(); |
| | | String[] split = halfNames.split(","); |
| | | String halfName=null; |
| | | for (int i = 0; i < split.length; i++) { |
| | | if(i==0){ |
| | | halfName = split[0]; |
| | | }else { |
| | | strings2.add(split[i]); |
| | | } |
| | | if (StringUtils.isNotBlank(halfNames) && site.getIshalf().equals(1)) { |
| | | List<String> strings2 = Arrays.asList(halfNames.split(",")); |
| | | model.addAttribute("halfNames",strings2); |
| | | model.addAttribute("halfName",strings2.get(0)); |
| | | }else { |
| | | model.addAttribute("halfNames", Collections.emptyList()); |
| | | model.addAttribute("halfName", ""); |
| | | } |
| | | model.addAttribute("halfNames",strings2); |
| | | model.addAttribute("halfName",halfName); |
| | | |
| | | // 显式传递运营商ID和是否可预约字段,确保回显正确 |
| | | model.addAttribute("operatorId", site.getOperatorId()); |
| | | model.addAttribute("reservation", site.getReservation()); |
| | | // 添加价格配置相关字段 |
| | | TSite fullSite = siteService.getById(id); |
| | | model.addAttribute("targetAudience", fullSite.getTargetAudience()); |
| | |
| | | |
| | | |
| | | String halfNames = site.getHalfName(); |
| | | ArrayList<String> strings2 = new ArrayList<>(); |
| | | String[] split = halfNames.split(","); |
| | | String halfName=null; |
| | | for (int i = 0; i < split.length; i++) { |
| | | if(i==0){ |
| | | halfName = split[0]; |
| | | }else { |
| | | strings2.add(split[i]); |
| | | } |
| | | if (StringUtils.isNotBlank(halfNames) && site.getIshalf().equals(1)) { |
| | | List<String> strings2 = Arrays.asList(halfNames.split(",")); |
| | | model.addAttribute("halfNames",strings2); |
| | | model.addAttribute("halfName",strings2.get(0)); |
| | | }else { |
| | | model.addAttribute("halfNames", Collections.emptyList()); |
| | | model.addAttribute("halfName", ""); |
| | | } |
| | | model.addAttribute("halfNames",strings2); |
| | | model.addAttribute("halfName",halfName); |
| | | |
| | | List<CityManager> accounts = cityManagerClient.getAccount(site.getCity()); |
| | | model.addAttribute("list",site); |
| | |
| | | model.addAttribute("objectType",objectType); |
| | | model.addAttribute("objectId",objectId); |
| | | model.addAttribute("stores",stores); |
| | | // 显式传递运营商ID和是否可预约字段,确保回显正确 |
| | | model.addAttribute("operatorId", site.getOperatorId()); |
| | | model.addAttribute("reservation", site.getReservation()); |
| | | model.addAttribute("targetAudience", site.getTargetAudience()); |
| | | model.addAttribute("walkinCapacity", site.getWalkinCapacity()); |
| | | return PREFIX + "TSite_edit.html"; |
| | | } |
| | | /** |
| | |
| | | site.setInsertTime(new Date()); |
| | | site.setState(1); |
| | | site.setOperatorId(store.getOperatorId()); |
| | | |
| | | // site.setOperatorId(UserExt.getUser().getObjectId()); |
| | | |
| | | // 添加场地 |
| | |
| | | map.put("name",site.getName()); |
| | | map.put("space_id",store.getId().toString()); |
| | | String s = HttpRequestUtil.postRequest |
| | | ("https://port.daowepark.com/v7/user_api/general/addSpaceArea", map); |
| | | // ("https://port.daowepark.com/v7/user_api/general/addSpaceArea", map); |
| | | ("https://try.daowepark.com/v7/user_api/general/addSpaceArea", map); |
| | | JSONObject jsonObject = JSONObject.parseObject(s); |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | String area_id = data.getString("area_id"); |
| | | Integer integer = Integer.valueOf(area_id); |
| | | site.setId(integer); |
| | | if (site.getIshalf()==2){ |
| | | site.setHalfName(""); |
| | | } |
| | | Integer integer1 = siteClient.addSite1(site); |
| | | // Integer integer = Integer.valueOf(spaceId); |
| | | |
| | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/updateSite") |
| | | public ResultUtil updateSite(@RequestBody Site site) { |
| | | if(site.getInsuranceImg().equals("")){ |
| | | System.out.println(JSONObject.toJSONString(site)); |
| | | // 防止空指针异常:如果 insuranceImg 为 null 或空字符串,设置为 null |
| | | if(site.getInsuranceImg() == null || site.getInsuranceImg().equals("")){ |
| | | site.setInsuranceImg(null); |
| | | } |
| | | Store store = storeClient.getStoreById(site.getStoreId()); |
| | |
| | | site.setCityManagerId(store.getOperatorId()); |
| | | site.setInsertTime(new Date()); |
| | | site.setState(1); |
| | | if (site.getIshalf()==2){ |
| | | site.setHalfName(""); |
| | | } |
| | | siteClient.addSite(site); |
| | | // 保存价格数据 |
| | | if (site.getPriceDTOS() != null && !site.getPriceDTOS().isEmpty()) { |