| | |
| | | import cn.hutool.http.HttpResponse; |
| | | 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; |
| | | import com.dsh.other.entity.Site; |
| | | import com.dsh.other.entity.SiteBooking; |
| | | import com.dsh.other.entity.SiteType; |
| | | import com.dsh.other.entity.*; |
| | | import com.dsh.other.feignclient.account.CityManagerClient; |
| | | import com.dsh.other.feignclient.activity.UserCouponClient; |
| | | import com.dsh.other.feignclient.activity.model.QueryUserCouponByIdAndUserId; |
| | |
| | | import com.dsh.other.model.dto.siteDto.TSiteDTO; |
| | | import com.dsh.other.model.vo.siteVo.ExpireSiteSearchVO; |
| | | import com.dsh.other.model.vo.siteVo.SiteSearchVO; |
| | | import com.dsh.other.service.ISiteBookingService; |
| | | import com.dsh.other.service.ISiteService; |
| | | import com.dsh.other.service.ISiteTypeService; |
| | | import com.dsh.other.service.*; |
| | | import com.dsh.other.util.PayMoneyUtil; |
| | | import com.dsh.other.util.RedisUtil; |
| | | import com.dsh.other.util.ResultUtil; |
| | | import com.dsh.other.util.TokenUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import redis.clients.jedis.Jedis; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/site/addSite") |
| | | public Object addSite(@RequestBody Site site){ |
| | | public Integer addSite(@RequestBody Site site){ |
| | | if(site.getId()!= null ){ |
| | | |
| | | return siteService.updateById(site); |
| | | siteService.updateById(site); |
| | | return site.getId(); |
| | | }else { |
| | | return siteService.save(site); |
| | | boolean save = siteService.save(site); |
| | | return site.getId(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/querySiteTimes") |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "场地id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "日期(2023-01-01)", name = "day", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "半场名称", name = "halfName", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "选择场地的名称", name = "siteName", dataType = "string", required = false) |
| | | }) |
| | | public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day){ |
| | | public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day,String halfName,String siteName){ |
| | | try { |
| | | List<QuerySiteTimes> list = siteService.querySiteTimes(id, day); |
| | | List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | // public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day, String halfName, String siteName) throws Exception { |
| | | // |
| | | // if (redisUtil.acquireLock(day,day)) { |
| | | // try { |
| | | // List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName); |
| | | // return ResultUtil.success(list); |
| | | // } finally { |
| | | // redisUtil.releaseLock(day); |
| | | // } |
| | | // } else { |
| | | // return ResultUtil.error("系统繁忙,请稍后再试!"); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | // public ResultUtil<List<QuerySiteTimes>> querySiteTimes(Integer id, String day, String halfName, String siteName) throws Exception { |
| | | // |
| | | // if (redisUtil.acquireLock(day,day)) { |
| | | // try { |
| | | // List<QuerySiteTimes> list = siteService.querySiteTimes(id, day,halfName,siteName); |
| | | // return ResultUtil.success(list); |
| | | // } finally { |
| | | // redisUtil.releaseLock(day); |
| | | // } |
| | | // } else { |
| | | // return ResultUtil.error("系统繁忙,请稍后再试!"); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 购买课程微信支付回调 |
| | |
| | | try { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | SiteBooking byId = siteBookingService.getById(id); |
| | | Integer storeId = byId.getStoreId(); |
| | | Store byId1 = service.getById(storeId); |
| | | Site site = siteService.getById(byId.getSiteId()); |
| | | |
| | | map.put("siteName",byId1.getName()); |
| | | SiteType siteType = siteTypeService.getById(site.getSiteTypeId()); |
| | | map.put("siteType",siteType.getName()); |
| | | map.put("shopName",byId1.getName()); |
| | | map.put("shopAddress",byId1.getAddress()); |
| | | |
| | | |
| | | List<Integer> ids = getIds(byId.getSiteId()); |
| | | byId.setStorePhone(byId1.getPhone()); |
| | | |
| | | byId.setSid(Arrays.asList(storeId)); |
| | | List<Site> list = siteService.list(new LambdaQueryWrapper<Site>().eq(Site::getStoreId, storeId).eq(Site::getSign, 1)); |
| | | List<Integer> collect = list.stream().map(Site::getId).collect(Collectors.toList()); |
| | | byId.setRid(collect); |
| | | map.put("data",byId); |
| | | |
| | | |
| | | map.put("ids",ids); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private StoreService service; |
| | | |
| | | @Autowired |
| | | private IOperatorUserService operatorUserService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/game") |
| | | public List<Map<String, Object>> game(@RequestBody Integer appUserId){ |
| | | return service.game(appUserId); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/queryOperator") |
| | | public OperatorUser queryOperator(@RequestBody List<Integer> stores){ |
| | | |
| | | Store one = service.getOne(new QueryWrapper<Store>().in("id", stores)); |
| | | OperatorUser o = operatorUserService.getById(one.getOperatorId()); |
| | | |
| | | return o; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/site/getNewAddSiteList") |
| | | public List<SiteVo> getAppUserSiteList(){ |
| | | public List<SiteVo> getAppUserSiteList(@RequestBody Integer storeId){ |
| | | List<SiteVo> siteVos = new ArrayList<>(); |
| | | |
| | | List<Site> list = siteService.list(new QueryWrapper<Site>() |
| | | List<Site> list = siteService.list(new QueryWrapper<Site>().eq("state",1).eq("storeId",storeId) |
| | | .orderByDesc("insertTime")); |
| | | if (list.size() > 0 ){ |
| | | for (Site site : list) { |