| package com.zy.asrs.controller; | 
|   | 
| import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
| import com.core.annotations.AppAuth; | 
| import com.core.common.BaseRes; | 
| import com.core.common.Cools; | 
| import com.core.common.R; | 
| import com.core.exception.CoolException; | 
| import com.zy.asrs.entity.WrkMast; | 
| import com.zy.asrs.entity.param.ArmPrecomputeParam; | 
| import com.zy.asrs.service.OpenService; | 
| import com.zy.common.web.BaseController; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.transaction.annotation.Transactional; | 
| import org.springframework.web.bind.annotation.*; | 
|   | 
| import javax.servlet.http.HttpServletRequest; | 
| import java.util.ArrayList; | 
| import java.util.Date; | 
| import java.util.List; | 
|   | 
| /** | 
|  * Created by vincent on 2024/10/16 | 
|  */ | 
| @Slf4j | 
| @RestController | 
| @RequestMapping("open/hd") | 
| public class OpenController extends BaseController { | 
|   | 
|     private static final boolean auth = true; | 
|     public static final ArrayList<String> APP_KEY_LIST = new ArrayList<String>() {{ | 
|         add("ea1f0459efc02a79f046f982767939ae"); | 
|     }}; | 
|   | 
|     @Autowired | 
|     private OpenService openService; | 
|   | 
|     /** | 
|      * 添加出库单 | 
|      */ | 
|     @PostMapping("/task/cs/down/default/v1") | 
|     @AppAuth(memo = "WCS任务下发") | 
|     public synchronized R wcsTaskDistribution(@RequestHeader(required = false) String appkey, | 
|                                               @RequestBody ArmPrecomputeParam param, | 
|                                               HttpServletRequest request) { | 
|         try{ | 
|             auth(appkey, param, request); | 
|         } catch (Exception e){ | 
|             return new R(403,e.getMessage()); | 
|         } | 
|         if (Cools.isEmpty(param)) { | 
|             return R.parse(BaseRes.PARAM); | 
|         } | 
| //        if (Cools.isEmpty(param.getTaskNo())) { | 
| //            return R.error("工作号[taskNo]不能为空"); | 
| //        } | 
| //        if (Cools.isEmpty(param.getStartSta()) || param.getStartSta$()==0) { | 
| //            return R.error("起点[startSta]不能为空"); | 
| //        } | 
| //        if (Cools.isEmpty(param.getEndSta())  || param.getEndSta$()==0) { | 
| //            return R.error("终点[endSta]不能为空"); | 
| //        } | 
|   | 
|         return R.ok().add(param); | 
|     } | 
|   | 
|   | 
|     private void auth(String appkey, Object obj, HttpServletRequest request) { | 
| //        log.info("{}接口被访问;appkey:{};请求数据:{}", "open/sensorType/list/auth/v1", appkey, JSON.toJSONString(obj)); | 
|         request.setAttribute("cache", obj); | 
|         if (!auth) { | 
|             return; | 
|         } | 
|         if (Cools.isEmpty(appkey)) { | 
|             throw new CoolException("认证失败,请确认appkey无误!"); | 
|         } | 
|         if (!APP_KEY_LIST.contains(appkey)) { | 
|             throw new CoolException("认证失败,请确认appkey无误!"); | 
|         } | 
|     } | 
|   | 
|   | 
| } |