| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | import java.math.BigDecimal; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.CityClient; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.StoreStaffClient; |
| | | import com.dsh.course.feignClient.account.model.CityListQuery; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.account.model.TCityManager; |
| | | import com.dsh.course.feignClient.competition.CompetitionClient; |
| | | import com.dsh.course.feignClient.other.SiteClient; |
| | | import com.dsh.course.feignClient.other.SiteLockClient; |
| | |
| | | import com.dsh.course.mapper.UserMapper; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | | import com.dsh.guns.core.base.tips.SuccessTip; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import com.dsh.guns.modular.system.model.ExpireSiteSearchVO; |
| | | import com.dsh.guns.modular.system.model.Region; |
| | | import com.dsh.guns.modular.system.model.SiteSearchVO; |
| | | import com.dsh.guns.modular.system.model.Store; |
| | | import com.dsh.guns.modular.system.model.TCity; |
| | | import com.dsh.guns.modular.system.model.TOperator; |
| | | import com.dsh.guns.modular.system.model.TOperatorCity; |
| | | import com.dsh.guns.modular.system.model.TSite; |
| | | import com.dsh.guns.modular.system.model.TSitePrice; |
| | | import com.dsh.guns.modular.system.model.TSiteType; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | 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.ITSitePriceService; |
| | | import com.dsh.guns.modular.system.service.ITSiteService; |
| | | import com.dsh.guns.modular.system.service.ITSiteTypeService; |
| | | import com.dsh.guns.modular.system.service.StoreConfigService; |
| | | import com.dsh.guns.modular.system.service.TOperatorCityService; |
| | | 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 groovyjarjarpicocli.CommandLine; |
| | | import net.bytebuddy.asm.Advice; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.aspectj.weaver.ast.Var; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpRequest; |
| | | 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.servlet.resource.HttpResource; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 车辆管理控制器 |
| | |
| | | private IRegionService regionService; |
| | | @Autowired |
| | | private SiteLockClient siteLockClient; |
| | | @Autowired |
| | | private ITSitePriceService sitePriceService; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RequestMapping("/lockSite/{id}") |
| | | public String lockSite(Model model,@PathVariable("id") Integer id) { |
| | | DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); |
| | | DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | List<TSiteLockDTO> listById = siteLockClient.getListById(id); |
| | | for (TSiteLockDTO tSiteLockDTO : listById) { |
| | | tSiteLockDTO.setSsTime(dateformat.format(tSiteLockDTO.getStartTime())); |
| | |
| | | site.setCityManagerId(cityManagerId); |
| | | site.setInsertTime(new Date()); |
| | | site.setState(1); |
| | | site.setOperatorId(store.getOperatorId()); |
| | | // site.setOperatorId(UserExt.getUser().getObjectId()); |
| | | |
| | | // 添加场地 |
| | |
| | | Integer integer1 = siteClient.addSite1(site); |
| | | // Integer integer = Integer.valueOf(spaceId); |
| | | |
| | | // 保存价格数据 |
| | | if (site.getPriceDTOS() != null && !site.getPriceDTOS().isEmpty()) { |
| | | saveSitePriceDetails(site.getId(), site.getPriceDTOS()); |
| | | } |
| | | |
| | | return ResultUtil.success("添加成功"); |
| | | } |
| | | |
| | | /** |
| | | * 保存场地价格详情到 t_site_price 表 |
| | | * @param siteId 场地ID |
| | | * @param priceDTOS 价格详情列表 |
| | | */ |
| | | private void saveSitePriceDetails(Integer siteId, List<Site.PriceDTO> priceDTOS) { |
| | | Date now = new Date(); |
| | | |
| | | // 批量保存价格数据 |
| | | List<TSitePrice> sitePrices = new ArrayList<>(); |
| | | for (Site.PriceDTO detail : priceDTOS) { |
| | | TSitePrice sitePrice = new TSitePrice(); |
| | | sitePrice.setSiteId(siteId); |
| | | sitePrice.setStartTime(detail.getStartTime()); |
| | | sitePrice.setEndTime(detail.getEndTime()); |
| | | sitePrice.setDayOfWeek(detail.getDayOfWeek()); |
| | | sitePrice.setTargetAudience(detail.getTargetAudience()); |
| | | sitePrice.setFieldType(detail.getFieldType()); |
| | | sitePrice.setCashPrice(detail.getCashPrice() != null ? BigDecimal.valueOf(detail.getCashPrice()) : BigDecimal.ZERO); |
| | | sitePrice.setCoinPrice(detail.getCoinPrice() != null ? BigDecimal.valueOf(detail.getCoinPrice()) : BigDecimal.ZERO); |
| | | sitePrice.setInsertTime(now); |
| | | sitePrice.setUpdateTime(now); |
| | | |
| | | sitePrices.add(sitePrice); |
| | | } |
| | | |
| | | // 批量插入 |
| | | if (!sitePrices.isEmpty()) { |
| | | sitePriceService.saveBatch(sitePrices); |
| | | } |
| | | } |
| | | /** |
| | | * 编辑场地管理 |
| | |
| | | if(site.getInsuranceImg().equals("")){ |
| | | site.setInsuranceImg(null); |
| | | } |
| | | |
| | | TSite byId = siteService.getById(site.getId()); |
| | | |
| | | Store store = storeClient.getStoreById(site.getStoreId()); |
| | | |
| | | String province = store.getProvince(); |
| | | String provinceCode = store.getProvinceCode(); |
| | | String city = store.getCity(); |
| | | String cityCode = store.getCityCode(); |
| | | Integer cityManagerId = store.getCityManagerId(); |
| | | |
| | | site.setOperatorId(store.getOperatorId()); |
| | | site.setProvince(province); |
| | | site.setProvinceCode(provinceCode); |
| | | site.setCity(city); |
| | | site.setCityCode(cityCode); |
| | | site.setCityManagerId(cityManagerId); |
| | | |
| | | site.setCityManagerId(store.getOperatorId()); |
| | | site.setInsertTime(new Date()); |
| | | site.setState(1); |
| | | siteClient.addSite(site); |
| | | |
| | | /** |
| | | * 取消闸机输入 新增模块闸机管理 |
| | | */ |
| | | // String ids = byId.getIds(); |
| | | // HashMap<String, String> map = new HashMap<>(); |
| | | // map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // if(StringUtils.hasLength(ids)) { |
| | | // for (String s : ids.split(",")) { |
| | | // String s1 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/deleteDevice/ids/" + s, map); |
| | | // System.out.println(s1); |
| | | // } |
| | | // } |
| | | // if(StringUtils.hasLength( site.getIds())) { |
| | | // for (String s : site.getIds().split(",")) { |
| | | // HashMap<String, String> map1 = new HashMap<>(); |
| | | // map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map1.put("space_id", store.getId() + ""); |
| | | // map1.put("device_id", s); |
| | | // map1.put("region_id", site.getId() + ""); |
| | | // // 添加门禁 |
| | | // String s1 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | // System.out.println(s1); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | // 保存价格数据 |
| | | if (site.getPriceDTOS() != null && !site.getPriceDTOS().isEmpty()) { |
| | | // 先删除原有价格数据 |
| | | sitePriceService.remove(new QueryWrapper<TSitePrice>().eq("siteId", site.getId())); |
| | | saveSitePriceDetails(site.getId(), site.getPriceDTOS()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | /** |
| | |
| | | Integer storeId = tSiteDTO.getStoreId(); |
| | | TStore byId = storeService.getById(storeId); |
| | | if (byId!=null){ |
| | | if (byId.getType()==1){ |
| | | if (byId.getOperatorId()==null || byId.getOperatorId()==0){ |
| | | tSiteDTO.setOperator("平台"); |
| | | }else{ |
| | | TOperator byId1 = tOperatorService.getById(tSiteDTO.getOperatorId()); |
| | | if (byId1!=null) |
| | | tSiteDTO.setOperator(byId1.getName()); |
| | | } |
| | | } |
| | | } |