| | |
| | | package com.ycl.utils.common; |
| | | |
| | | /** |
| | | * redis缓存时间 |
| | | * 单位毫秒 |
| | | * redis缓存时间 |
| | | * 单位毫秒 |
| | | * |
| | | * @version 1.0 |
| | | * @date 2022/9/9 |
| | | */ |
| | | public enum LiveTimeMillisecond { |
| | | |
| | | s1(1000), |
| | | /** 5秒 */ |
| | | s5(5000), |
| | | |
| | | /** 10秒 */ |
| | | s10(10000), |
| | | |
| | | /** 1分钟 */ |
| | | s60(60000), |
| | | /** 2分钟 */ |
| | | |
| | | s120(120000), |
| | | /** 3分钟*/ |
| | | s180(180000), |
| | | |
| | | /** 5分钟*/ |
| | | s300(300000), |
| | | |
| | | /** 10分钟 */ |
| | | s600(600000), |
| | | |
| | | /** 30分钟 */ |
| | | s1800(1800000), |
| | | |
| | | /** 1小时 */ |
| | | s3600(3600000), |
| | | |
| | | /** 2小时 */ |
| | | s7200(7200000), |
| | | |
| | | /** 3小时 */ |
| | | s10800(10800000), |
| | | |
| | | /** 4小时 */ |
| | | s14400(14400000), |
| | | |
| | | /** 12小时 */ |
| | | s43200(43200000), |
| | | |
| | | /** 一天 */ |
| | | s86400(86400000), |
| | | /** 三天*/ |
| | | s259200000(259200000), |
| | | |
| | | /** 七天 */ |
| | | s604800(604800000), |
| | | |
| | | /** 30天*/ |
| | | s2592000(2592000000L), |
| | | |
| | | /** 60天*/ |
| | | s5184000(5184000000L), |
| | | /**180天*/ |
| | | s15552000(15552000000L); |
| | | s1(1000), |
| | | /** |
| | | * 5秒 |
| | | */ |
| | | s5(5000), |
| | | |
| | | /** |
| | | * 超时时间 单位秒 |
| | | * 10秒 |
| | | */ |
| | | s10(10000), |
| | | |
| | | /** |
| | | * 1分钟 |
| | | */ |
| | | s60(60000), |
| | | /** |
| | | * 2分钟 |
| | | */ |
| | | |
| | | s120(120000), |
| | | /** |
| | | * 3分钟 |
| | | */ |
| | | s180(180000), |
| | | |
| | | /** |
| | | * 5分钟 |
| | | */ |
| | | s300(300000), |
| | | |
| | | /** |
| | | * 10分钟 |
| | | */ |
| | | s600(600000), |
| | | |
| | | /** |
| | | * 30分钟 |
| | | */ |
| | | s1800(1800000), |
| | | |
| | | /** |
| | | * 1小时 |
| | | */ |
| | | s3600(3600000), |
| | | |
| | | /** |
| | | * 2小时 |
| | | */ |
| | | s7200(7200000), |
| | | |
| | | /** |
| | | * 3小时 |
| | | */ |
| | | s10800(10800000), |
| | | |
| | | /** |
| | | * 4小时 |
| | | */ |
| | | s14400(14400000), |
| | | |
| | | /** |
| | | * 12小时 |
| | | */ |
| | | s43200(43200000), |
| | | |
| | | /** |
| | | * 一天 |
| | | */ |
| | | s86400(86400000), |
| | | /** |
| | | * 三天 |
| | | */ |
| | | s259200000(259200000), |
| | | |
| | | /** |
| | | * 七天 |
| | | */ |
| | | s604800(604800000), |
| | | |
| | | /** |
| | | * 30天 |
| | | */ |
| | | s2592000(2592000000L), |
| | | |
| | | /** |
| | | * 60天 |
| | | */ |
| | | s5184000(5184000000L), |
| | | /** |
| | | * 180天 |
| | | */ |
| | | s15552000(15552000000L); |
| | | |
| | | /** |
| | | * 超时时间 单位秒 |
| | | */ |
| | | public long time; |
| | | |
| | |
| | | import com.ycl.api.CommonResult; |
| | | import com.ycl.controller.BaseController; |
| | | import com.ycl.entity.region.SccgRegion; |
| | | import com.ycl.service.redis.RedisService; |
| | | import com.ycl.service.region.ISccgRegionService; |
| | | import com.ycl.utils.redis.RedisKey; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | public class SccgRegionController extends BaseController { |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private ISccgRegionService iSccgRegionService; |
| | | |
| | | @ApiOperation("树结构") |
| | |
| | | @RequestMapping(value = "/addRegion", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CommonResult addRegion(@Validated @RequestBody SccgRegion sccgRegion) { |
| | | redisService.del(RedisKey.SCCG_REGION); |
| | | return CommonResult.success(iSccgRegionService.save(sccgRegion)); |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CommonResult update(@PathVariable Long id, @RequestBody SccgRegion sccgRegion) { |
| | | redisService.del(RedisKey.SCCG_REGION); |
| | | sccgRegion.setId(id); |
| | | boolean success = iSccgRegionService.updateById(sccgRegion); |
| | | if (success) { |
| | |
| | | @RequestMapping(value = "/delete", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CommonResult delete(@RequestParam("ids") List<Long> ids) { |
| | | redisService.del(RedisKey.SCCG_REGION); |
| | | boolean success = iSccgRegionService.removeBatchByIds(ids); |
| | | if (success) { |
| | | return CommonResult.success(null); |
| | |
| | | @ApiOperation("根据id获取门店信息") |
| | | @RequestMapping(value = "/{id}", method = RequestMethod.GET) |
| | | @ResponseBody |
| | | public CommonResult<StoreInfo> getItem(@PathVariable Long id) { |
| | | public CommonResult<StoreInfoVO> getItem(@PathVariable Long id) { |
| | | StoreInfo storeInfo = storeInfoService.getById(id); |
| | | StoreInfoVO vo = new StoreInfoVO(); |
| | | BeanUtils.copyProperties(storeInfo, vo); |
| | | vo.setVideoPoint(videoPointService.getById(storeInfo.getVideoId())); |
| | | return CommonResult.success(storeInfo); |
| | | return CommonResult.success(vo); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加门店信息") |
| | |
| | | return item; |
| | | }).collect(Collectors.toList()); |
| | | List<SccgRegion> treeData = getTreeData(collect); |
| | | redisService.set(RedisKey.SCCG_REGION, JSON.toJSONString(treeData), LiveTimeMillisecond.s5184000.time); |
| | | redisService.set(RedisKey.SCCG_REGION, JSON.toJSONString(treeData), LiveTimeMillisecond.s3600.time); |
| | | return treeData; |
| | | } |
| | | return JSON.parseArray(result, SccgRegion.class); |
| | |
| | | import com.ycl.enums.common.ResultCode; |
| | | import com.ycl.exception.ApiException; |
| | | import com.ycl.mapper.store.StoreInfoMapper; |
| | | import com.ycl.mapper.video.VideoPointMapper; |
| | | import com.ycl.service.store.StoreInfoService; |
| | | import com.ycl.utils.ExcelUtils; |
| | | import com.ycl.vo.store.StoreInfoExcelVo; |
| | |
| | | @Resource |
| | | StoreInfoMapper storeInfoMapper; |
| | | |
| | | @Resource |
| | | VideoPointMapper videoPointMapper; |
| | | |
| | | |
| | | @Override |
| | | public Page<StoreInfoVO> list(String keyword, Integer pageSize, Integer pageNum) { |
| | | Page<StoreInfo> storeInfoPage = new Page<>(); |
| | | storeInfoPage.setSize(pageSize); |
| | | storeInfoPage.setCurrent(pageNum); |
| | | return storeInfoMapper.selectStorePage(storeInfoPage,keyword); |
| | | Page<StoreInfoVO> page = storeInfoMapper.selectStorePage(storeInfoPage, keyword); |
| | | page.getRecords().forEach(x->x.setVideoPoint(videoPointMapper.selectById(x.getVideoId()))); |
| | | return page; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @TableField("description") |
| | | private String description; |
| | | |
| | | @ApiModelProperty("摄像头ID") |
| | | @TableField("video_id") |
| | | private String videoId; |
| | | |
| | | @ApiModelProperty("摄像头") |
| | | private VideoPoint videoPoint; |
| | | } |
| | |
| | | <select id="selectStorePage" resultType="com.ycl.vo.store.StoreInfoVO"> |
| | | SELECT |
| | | t1.*, |
| | | t2.`name` as typeName, |
| | | t3.* |
| | | t2.`name` as typeName |
| | | FROM |
| | | ums_store_store_info t1 |
| | | left JOIN ums_data_dictionary t2 ON t1.type = t2.id |
| | | left JOIN ums_video_point t3 ON t1.video_id = t3.id |
| | | <where> |
| | | <if test="keyword!=null and keyword!=''"> |
| | | t1.store_name LIKE CONCAT('%', #{keyword}, '%') |