|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.core.common.SnowflakeIdWorker; | 
|---|
|  |  |  | import com.zy.asrs.entity.ApiLog; | 
|---|
|  |  |  | import com.zy.asrs.mapper.ApiLogMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.ApiLogService; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.scheduling.annotation.Async; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Service("apiLogService") | 
|---|
|  |  |  | public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> implements ApiLogService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SnowflakeIdWorker snowflakeIdWorker; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Async | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void save(String namespace, String url, String appkey, String ip, String request, String response, boolean success) { | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); | 
|---|
|  |  |  | ApiLog apiLog = new ApiLog( | 
|---|
|  |  |  | String.valueOf(snowflakeIdWorker.nextId()),    // 日志编号 | 
|---|
|  |  |  | dateFormat.format(now),    // 日志编号 | 
|---|
|  |  |  | namespace,    // 名称空间 | 
|---|
|  |  |  | url,    // 接口地址 | 
|---|
|  |  |  | appkey,    // 平台密钥 | 
|---|
|  |  |  | "110",    // 平台密钥 | 
|---|
|  |  |  | String.valueOf(now.getTime()),    // 时间戳 | 
|---|
|  |  |  | ip,    // 客户端IP | 
|---|
|  |  |  | request,    // 请求内容 | 
|---|
|  |  |  | response, | 
|---|
|  |  |  | null,    // 异常内容 | 
|---|
|  |  |  | "0",    // 异常内容 | 
|---|
|  |  |  | success?1:0 ,    // 结果 | 
|---|
|  |  |  | 1,    // 状态 | 
|---|
|  |  |  | now,    // 添加时间 | 
|---|
|  |  |  | null,    // 修改时间 | 
|---|
|  |  |  | null    // 备注 | 
|---|
|  |  |  | now,    // 修改时间 | 
|---|
|  |  |  | "null"    // 备注 | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (!this.insert(apiLog)) { | 
|---|
|  |  |  | if (this.baseMapper.insert(apiLog) < 0) { | 
|---|
|  |  |  | log.error("接口调用日志保存失败!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | testMast.setChannel(locMast.getChannel()); | 
|---|
|  |  |  | testMast.setLocNo(wrkMast.getLocNo()); | 
|---|
|  |  |  | testMast.setModiTime(new Date()); | 
|---|
|  |  |  | testMast.setBarcode(locDetl.getMatnr()); | 
|---|
|  |  |  | if (!testMastService.update(testMast,new EntityWrapper<TestMast>() | 
|---|
|  |  |  | .eq("loc_no",sourceLoc.getLocNo()) | 
|---|
|  |  |  | .eq("user_id",locMast.getBarcode()) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.service.ApiLogService; | 
|---|
|  |  |  | import com.zy.asrs.service.impl.ApiLogServiceImpl; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | public class PostMesDataUtils extends AbstractHandler<String> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private ApiLogService apiLogService = new ApiLogServiceImpl(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public ReturnT<String> postMesData(String name,String URL,String mesPath, Object combParam){ | 
|---|
|  |  |  | //        if (true){ | 
|---|
|  |  |  | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // 保存接口日志 | 
|---|
|  |  |  | ApiLogService apiLogService = SpringUtils.getBean(ApiLogService.class); | 
|---|
|  |  |  | apiLogService.save( | 
|---|
|  |  |  | "上报"+name, | 
|---|
|  |  |  | URL +"/"+ mesPath, | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else if(wrkMast.getStaNo()==209){ | 
|---|
|  |  |  | testMast.setBarcode(wrkDetl.getMatnr()); | 
|---|
|  |  |  | testMast.setChannel(locMast.getChannel()); | 
|---|
|  |  |  | testMast.setLocNo(locMast.getLocNo()); | 
|---|
|  |  |  | testMast.setUserId(wrkMast.getBarcode());//托盘码 | 
|---|
|  |  |  | testMast.setAppeTime(now); | 
|---|
|  |  |  | 
|---|
|  |  |  | # 充放电测试通道 | 
|---|
|  |  |  | channel: | 
|---|
|  |  |  | # 最大通道数 | 
|---|
|  |  |  | channelMax: 24 | 
|---|
|  |  |  | channelMax: 48 | 
|---|
|  |  |  | # 充放电测试柜数量 | 
|---|
|  |  |  | equipmentCount: 6 | 
|---|
|  |  |  | # 测试库位所在排号 | 
|---|
|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="matnr" placeholder="商品编号"  autocomplete="off"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="matnr" placeholder="PACK码"  autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|