|
@@ -19,6 +19,7 @@ import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -44,7 +45,7 @@ import java.util.*;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/${api.version}/amssaleorders")
|
|
|
-public class AmsSaleOrderController extends BaseRESTfulController {
|
|
|
+public class AmsSaleOrderController<RedisTemplate> extends BaseRESTfulController {
|
|
|
|
|
|
@Autowired
|
|
|
IAmsSaleOrderService amsSaleOrderService;
|
|
@@ -78,6 +79,8 @@ public class AmsSaleOrderController extends BaseRESTfulController {
|
|
|
|
|
|
private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
+ private List< List<Map<String,Object>> > retryQueen=new ArrayList<>();
|
|
|
+
|
|
|
@ApiOperation(value="查询未上报销售订单信息")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "apiId(98)", value = "表头", required = false, dataType = "Interger")
|
|
@@ -788,6 +791,12 @@ public class AmsSaleOrderController extends BaseRESTfulController {
|
|
|
System.out.println(json);
|
|
|
Map<String,Object> s = joinFeign.pushCarNumberToEas(totalMap);
|
|
|
if (s == null || s.size() == 0) {
|
|
|
+ try{
|
|
|
+ //失败,存入重试队列,准备重试
|
|
|
+ retryQueen.add(mapList);
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println("保存失败车牌失败");
|
|
|
+ }
|
|
|
throw new Exception("登录金蝶失败");
|
|
|
}
|
|
|
System.out.println(s);
|
|
@@ -814,6 +823,12 @@ public class AmsSaleOrderController extends BaseRESTfulController {
|
|
|
System.out.println(json);
|
|
|
Map<String,Object> s = joinFeign.pushCarNumberToEas(totalMap);
|
|
|
if (s == null || s.size() == 0) {
|
|
|
+ try{
|
|
|
+ //失败,存入重试队列,准备重试
|
|
|
+ retryQueen.add(mapList);
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println("保存失败车牌失败");
|
|
|
+ }
|
|
|
throw new Exception("登录金蝶失败");
|
|
|
}
|
|
|
System.out.println(s);
|
|
@@ -1605,4 +1620,33 @@ public class AmsSaleOrderController extends BaseRESTfulController {
|
|
|
return success(count);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 重试上传车牌号到金蝶
|
|
|
+ */
|
|
|
+ @Scheduled(cron = "* 5 * * * ?")
|
|
|
+ private void retryPushCarNumberToEas(){
|
|
|
+ List<List<Map<String,Object>>> newRetry=new ArrayList<>();
|
|
|
+ System.out.println("开始重传,目前失败数量:"+retryQueen.size());
|
|
|
+ for(List<Map<String,Object>> mapList:retryQueen){
|
|
|
+ // 调用EAS接口将车牌号传给金蝶
|
|
|
+ Map<String,Object> input = joinFeign.findCarNumberByOrderList(mapList);
|
|
|
+ Map<String, Object> totalMap = easCapacityTestUtil.getTotalMap();
|
|
|
+ totalMap.put("input",input);
|
|
|
+ System.out.println(totalMap);
|
|
|
+ String json = JSONUtils.toJSONString(totalMap);
|
|
|
+ System.out.println(json);
|
|
|
+ Map<String,Object> s = joinFeign.pushCarNumberToEas(totalMap);
|
|
|
+ if (s == null || s.size() == 0) {
|
|
|
+ //失败,存入新的重试队列,准备下一次重试
|
|
|
+ newRetry.add(mapList);
|
|
|
+ System.out.println("重试:登录金蝶失败");
|
|
|
+ }else{
|
|
|
+ System.out.println("重试:上传车牌成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //结束,替换掉旧的队列
|
|
|
+ retryQueen=newRetry;
|
|
|
+ System.out.println("重传结束,剩余失败数量:"+retryQueen.size());
|
|
|
+ }
|
|
|
+
|
|
|
}
|