| | |
| | | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.OrderNumConstants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.system.domain.TDataGenerator; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.OrderMealGeneratorDTO; |
| | | import com.ruoyi.system.dto.OrderSaleGeneratorDTO; |
| | | import com.ruoyi.system.query.TDataGeneratorQuery; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final TOrderMealService orderMealService; |
| | | private final TDataGeneratorService dataGeneratorService; |
| | | private final TokenService tokenService; |
| | | private final RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | public TDataGeneratorController(TOrderMealService orderMealService, TDataGeneratorService dataGeneratorService) { |
| | | public TDataGeneratorController(TOrderMealService orderMealService, TDataGeneratorService dataGeneratorService, TokenService tokenService, RedisCache redisCache) { |
| | | this.orderMealService = orderMealService; |
| | | this.dataGeneratorService = dataGeneratorService; |
| | | this.tokenService = tokenService; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | @ApiOperation( value = "餐饮数据生成") |
| | | @PostMapping(value = "/mealDataGenerator") |
| | | public AjaxResult<String> mealDataGenerator(@RequestBody OrderMealGeneratorDTO dto) { |
| | | dto.setUserId(tokenService.getLoginUser().getUserId()); |
| | | dto.setNickName(tokenService.getLoginUser().getNickName()); |
| | | dataGeneratorService.mealDataGenerator(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | @ApiOperation( value = "销售数据生成") |
| | | @PostMapping(value = "/saleDataGenerator") |
| | | public AjaxResult<String> saleDataGenerator(@RequestBody OrderSaleGeneratorDTO dto) { |
| | | dto.setUserId(tokenService.getLoginUser().getUserId()); |
| | | dto.setNickName(tokenService.getLoginUser().getNickName()); |
| | | dataGeneratorService.saleDataGenerator(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation( value = "数据生成终止 shopId=店铺id type: 1=餐饮 2=进货") |
| | | @GetMapping(value = "/stopGenerator") |
| | | public AjaxResult<String> dataCoverage(@RequestParam(value = "shopId") Long shopId, |
| | | @RequestParam(value = "type") Integer type) { |
| | | if(type == 1){ |
| | | redisCache.setCacheObject(OrderNumConstants.MEAL+"_"+shopId,shopId); |
| | | }else { |
| | | redisCache.setCacheObject(OrderNumConstants.STOCK+"_"+shopId,shopId); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |