| | |
| | | import com.zy.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.entity.result.TokenVo; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.common.model.DetlDto; |
| | |
| | | @Autowired |
| | | private OpenService openService; |
| | | |
| | | @PostMapping("/order/matSync/default/v2") |
| | | @PostMapping("/getToken") |
| | | public synchronized R getToken(@RequestBody(required = true) TokenParam param, |
| | | HttpServletRequest request){ |
| | | authNew(param, param, request); |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | TokenVo tokenVo = new TokenVo(); |
| | | String token = Cools.enToken(System.currentTimeMillis() + param.getAppId(), param.getAppSecret()); |
| | | tokenVo.setToken(token); |
| | | tokenVo.setValidTime(30); |
| | | return R.ok().add(tokenVo); |
| | | } |
| | | |
| | | @PostMapping("/erp/mat/sync") |
| | | // @AppAuth(memo = "商品信息同步接口") |
| | | public synchronized R syncMatInfoV2(@RequestHeader(required = false) String appkey, |
| | | @RequestBody(required = false) MatSyncParam.MatParam param, |
| | |
| | | } |
| | | } |
| | | |
| | | private void authNew(TokenParam param, Object obj, HttpServletRequest request) { |
| | | log.info("{}接口被访问;appSecret:{};请求数据:{}", "open/sensorType/list/auth/v1", param.getAppSecret(), JSON.toJSONString(obj)); |
| | | request.setAttribute("cache", obj); |
| | | if (!auth) { |
| | | return; |
| | | } |
| | | if (Cools.isEmpty(param.getAppId()) || Cools.isEmpty(param.getAppSecret())) { |
| | | throw new CoolException("认证失败,请确认appId和appSecret无误!"); |
| | | } |
| | | if (!param.getAppId().contains("FNWMS")){ |
| | | throw new CoolException("认证失败,请确认appId无误!"); |
| | | } |
| | | if (!APP_KEY_LIST.contains(param.getAppSecret())) { |
| | | throw new CoolException("认证失败,请确认appSecret无误!"); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // 1 |
| | | System.out.println("======================================"); |