53 changed files with 398 additions and 347 deletions
@ -0,0 +1,111 @@ |
|||||||
|
package com.logpm.factory.comfac.controller; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.logpm.factory.comfac.service.IOrderStatusLogService; |
||||||
|
import com.logpm.factory.comfac.dto.OrderInfoDTO; |
||||||
|
import com.logpm.factory.comfac.dto.OrderStatusDTO; |
||||||
|
import com.logpm.factory.snm.entity.OrderStatusLog; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.log4j.Log4j2; |
||||||
|
import org.springblade.common.constant.RabbitConstant; |
||||||
|
import org.springblade.common.exception.CustomerException; |
||||||
|
import org.springblade.common.utils.CommonUtil; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData; |
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
||||||
|
import org.springframework.validation.annotation.Validated; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Log4j2 |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/factory/common") |
||||||
|
@Api(value = "工厂通用数据", tags = "工厂通用接口") |
||||||
|
public class FactoryCommonController { |
||||||
|
|
||||||
|
private final RabbitTemplate rabbitTemplate; |
||||||
|
private final IOrderStatusLogService orderStatusLogService; |
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@PostMapping("/sendOrders") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "订单数据推送", notes = "传入orderInfoDTO") |
||||||
|
public R sendOrders(@Validated @RequestBody OrderInfoDTO orderInfoDTO) { |
||||||
|
log.info("############sendOrders: 请求参数{}",orderInfoDTO); |
||||||
|
try{ |
||||||
|
|
||||||
|
//先保存原始请求数据
|
||||||
|
OrderStatusLog orderStatusLog = new OrderStatusLog(); |
||||||
|
orderStatusLog.setArgs(JSONObject.toJSONString(orderInfoDTO)); |
||||||
|
orderStatusLog.setStatus(1); |
||||||
|
orderStatusLog.setType(1); |
||||||
|
orderStatusLogService.save(orderStatusLog); |
||||||
|
|
||||||
|
Map<String,Object> map=new HashMap<>(); |
||||||
|
map.put("messageId", CommonUtil.getUUID()); |
||||||
|
map.put("logId", orderStatusLog.getId()); |
||||||
|
map.put("messageData",orderInfoDTO); |
||||||
|
map.put("createTime",new Date().getTime()); |
||||||
|
//将消息携带绑定键值
|
||||||
|
rabbitTemplate.convertAndSend(RabbitConstant.OPEN_ORDER_EXCHANGE, RabbitConstant.OPEN_ORDER_ROUTING, map,new CorrelationData(String.valueOf(orderStatusLog.getId()))); |
||||||
|
|
||||||
|
// R r = factoryDataService.handleData(orderInfoDTO);
|
||||||
|
return R.success("调用成功"); |
||||||
|
}catch (CustomerException e){ |
||||||
|
log.error(e.message,e); |
||||||
|
return R.fail(e.code,e.message); |
||||||
|
}catch (Exception e){ |
||||||
|
log.error("############sendOrders: 系统异常",e); |
||||||
|
return R.fail(500,"############sendOrders: 系统异常"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@PostMapping("/sendOrderStatus") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "订单状态推送", notes = "传入orderInfoDTO") |
||||||
|
public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) { |
||||||
|
log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO); |
||||||
|
try{ |
||||||
|
|
||||||
|
//先保存原始请求数据
|
||||||
|
OrderStatusLog orderStatusLog = new OrderStatusLog(); |
||||||
|
orderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO)); |
||||||
|
orderStatusLog.setStatus(1); |
||||||
|
orderStatusLog.setType(2); |
||||||
|
orderStatusLogService.save(orderStatusLog); |
||||||
|
|
||||||
|
Map<String,Object> map=new HashMap<>(); |
||||||
|
map.put("messageId", CommonUtil.getUUID()); |
||||||
|
map.put("logId", orderStatusLog.getId()); |
||||||
|
map.put("type", "Push"); |
||||||
|
map.put("messageData",orderStatusDTO); |
||||||
|
map.put("createTime",new Date().getTime()); |
||||||
|
//将消息携带绑定键值
|
||||||
|
rabbitTemplate.convertAndSend(RabbitConstant.ORDER_STATUS_EXCHANGE, RabbitConstant.ORDER_STATUS_ROUTING, map); |
||||||
|
map.put("type", "DealWith"); |
||||||
|
rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING,map); |
||||||
|
|
||||||
|
|
||||||
|
// R r = factoryDataService.handleStatusData(orderStatusDTO);
|
||||||
|
return R.success("调用成功"); |
||||||
|
}catch (CustomerException e){ |
||||||
|
log.error(e.message,e); |
||||||
|
return R.fail(e.code,e.message); |
||||||
|
}catch (Exception e){ |
||||||
|
log.error("############sendOrderStatus: 系统异常",e); |
||||||
|
return R.fail(500,"############sendOrderStatus: 系统异常"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.dto; |
package com.logpm.factory.comfac.dto; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.FactoryAccount; |
import com.logpm.factory.snm.entity.FactoryAccount; |
||||||
import lombok.Data; |
import lombok.Data; |
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.logpm.factory.snm.mapper.FactoryAccountMapper"> |
<mapper namespace="com.logpm.factory.comfac.mapper.FactoryAccountMapper"> |
||||||
|
|
||||||
<!-- 通用查询映射结果 --> |
<!-- 通用查询映射结果 --> |
||||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.logpm.factory.snm.mapper.FactoryTokenMapper"> |
<mapper namespace="com.logpm.factory.comfac.mapper.FactoryTokenMapper"> |
||||||
|
|
||||||
<!-- 通用查询映射结果 --> |
<!-- 通用查询映射结果 --> |
||||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.logpm.factory.snm.mapper.OrderStatusLogMapper"> |
<mapper namespace="com.logpm.factory.comfac.mapper.OrderStatusLogMapper"> |
||||||
|
|
||||||
<!-- 通用查询映射结果 --> |
<!-- 通用查询映射结果 --> |
||||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.comfac.service; |
||||||
|
|
||||||
public interface IAsyncDataService { |
public interface IAsyncDataService { |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.comfac.service; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.FactoryAccount; |
import com.logpm.factory.snm.entity.FactoryAccount; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.comfac.service; |
||||||
|
|
||||||
import com.logpm.factory.snm.vo.FactoryTokenVO; |
import com.logpm.factory.snm.vo.FactoryTokenVO; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.comfac.service; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.FactoryToken; |
import com.logpm.factory.snm.entity.FactoryToken; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.comfac.service; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.OrderStatusLog; |
import com.logpm.factory.snm.entity.OrderStatusLog; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,8 +1,8 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.comfac.service.impl; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.FactoryAccount; |
import com.logpm.factory.snm.entity.FactoryAccount; |
||||||
import com.logpm.factory.snm.mapper.FactoryAccountMapper; |
import com.logpm.factory.comfac.mapper.FactoryAccountMapper; |
||||||
import com.logpm.factory.snm.service.IFactoryAccountService; |
import com.logpm.factory.comfac.service.IFactoryAccountService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import org.slf4j.Logger; |
import org.slf4j.Logger; |
||||||
import org.slf4j.LoggerFactory; |
import org.slf4j.LoggerFactory; |
@ -1,12 +1,12 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.comfac.service.impl; |
||||||
|
|
||||||
import com.alibaba.nacos.common.utils.MD5Utils; |
import com.alibaba.nacos.common.utils.MD5Utils; |
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
import com.logpm.factory.snm.entity.FactoryAccount; |
import com.logpm.factory.snm.entity.FactoryAccount; |
||||||
import com.logpm.factory.snm.entity.FactoryToken; |
import com.logpm.factory.snm.entity.FactoryToken; |
||||||
import com.logpm.factory.snm.service.IFactoryAccountService; |
import com.logpm.factory.comfac.service.IFactoryAccountService; |
||||||
import com.logpm.factory.snm.service.IFactoryAuthService; |
import com.logpm.factory.comfac.service.IFactoryAuthService; |
||||||
import com.logpm.factory.snm.service.IFactoryTokenService; |
import com.logpm.factory.comfac.service.IFactoryTokenService; |
||||||
import com.logpm.factory.snm.vo.FactoryTokenVO; |
import com.logpm.factory.snm.vo.FactoryTokenVO; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import org.slf4j.Logger; |
import org.slf4j.Logger; |
@ -1,10 +1,10 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.comfac.service.impl; |
||||||
|
|
||||||
import com.alibaba.nacos.common.utils.MD5Utils; |
import com.alibaba.nacos.common.utils.MD5Utils; |
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
import com.logpm.factory.snm.entity.FactoryToken; |
import com.logpm.factory.snm.entity.FactoryToken; |
||||||
import com.logpm.factory.snm.mapper.FactoryTokenMapper; |
import com.logpm.factory.comfac.mapper.FactoryTokenMapper; |
||||||
import com.logpm.factory.snm.service.IFactoryTokenService; |
import com.logpm.factory.comfac.service.IFactoryTokenService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import org.slf4j.Logger; |
import org.slf4j.Logger; |
||||||
import org.slf4j.LoggerFactory; |
import org.slf4j.LoggerFactory; |
@ -1,8 +1,8 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.comfac.service.impl; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.OrderStatusLog; |
import com.logpm.factory.snm.entity.OrderStatusLog; |
||||||
import com.logpm.factory.snm.mapper.OrderStatusLogMapper; |
import com.logpm.factory.comfac.mapper.OrderStatusLogMapper; |
||||||
import com.logpm.factory.snm.service.IOrderStatusLogService; |
import com.logpm.factory.comfac.service.IOrderStatusLogService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import org.slf4j.Logger; |
import org.slf4j.Logger; |
||||||
import org.slf4j.LoggerFactory; |
import org.slf4j.LoggerFactory; |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.mapper; |
package com.logpm.factory.mt.mapper; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
@ -0,0 +1,20 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.logpm.factory.mt.mapper.MtFactoryOrderMainMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
||||||
|
<!-- <result column="id" property="id"/>--> |
||||||
|
<!-- <result column="req_args" property="reqArgs"/>--> |
||||||
|
<!-- <result column="res_body" property="resBody"/>--> |
||||||
|
<!-- <result column="type" property="type"/>--> |
||||||
|
<!-- <result column="create_user" property="createUser"/>--> |
||||||
|
<!-- <result column="create_time" property="createTime"/>--> |
||||||
|
<!-- <result column="update_user" property="updateUser"/>--> |
||||||
|
<!-- <result column="update_time" property="updateTime"/>--> |
||||||
|
<!-- <result column="status" property="status"/>--> |
||||||
|
<!-- <result column="is_deleted" property="isDeleted"/>--> |
||||||
|
<!-- <result column="create_dept" property="createDept"/>--> |
||||||
|
<!-- </resultMap>--> |
||||||
|
|
||||||
|
</mapper> |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.mt.service; |
||||||
|
|
||||||
import com.logpm.factory.mt.dto.MtFactoryDataDTO; |
import com.logpm.factory.mt.dto.MtFactoryDataDTO; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.mt.service; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,10 +1,10 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.mt.service.impl; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
import com.logpm.factory.mt.dto.MtFactoryDataDTO; |
import com.logpm.factory.mt.dto.MtFactoryDataDTO; |
||||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
||||||
import com.logpm.factory.snm.service.IMtFactoryDataService; |
import com.logpm.factory.mt.service.IMtFactoryDataService; |
||||||
import com.logpm.factory.snm.service.IMtFactoryOrderMainService; |
import com.logpm.factory.mt.service.IMtFactoryOrderMainService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import lombok.extern.slf4j.Slf4j; |
import lombok.extern.slf4j.Slf4j; |
||||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
@ -1,8 +1,8 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.mt.service.impl; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
import com.logpm.factory.snm.entity.MtFactoryOrderMain; |
||||||
import com.logpm.factory.snm.mapper.MtFactoryOrderMainMapper; |
import com.logpm.factory.mt.mapper.MtFactoryOrderMainMapper; |
||||||
import com.logpm.factory.snm.service.IMtFactoryOrderMainService; |
import com.logpm.factory.mt.service.IMtFactoryOrderMainService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import org.springblade.core.mp.base.BaseServiceImpl; |
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
@ -0,0 +1,143 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the dreamlu.net developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: Chill 庄骞 (smallchill@163.com) |
||||||
|
*/ |
||||||
|
package com.logpm.factory.pan.controller; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.logpm.factory.comfac.service.IAsyncDataService; |
||||||
|
import com.logpm.factory.comfac.service.IOrderStatusLogService; |
||||||
|
import com.logpm.factory.pan.dto.PanFactoryOrderDTO; |
||||||
|
import com.logpm.factory.pan.service.IPanFactoryDataService; |
||||||
|
import com.logpm.factory.pan.service.IPanFactoryOrderService; |
||||||
|
import com.logpm.factory.pan.service.IPanPackageInfoService; |
||||||
|
import com.logpm.factory.pan.service.IPanPackageListService; |
||||||
|
import com.logpm.factory.snm.bean.Resp; |
||||||
|
import com.logpm.factory.snm.entity.OrderStatusLog; |
||||||
|
import com.logpm.factory.snm.entity.PanFactoryOrder; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.log4j.Log4j2; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
||||||
|
import org.springframework.validation.annotation.Validated; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* 皮阿诺数据 控制器 |
||||||
|
* |
||||||
|
* @author zhy |
||||||
|
* @since 2023-06-06 |
||||||
|
*/ |
||||||
|
@Log4j2 |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/factory/pan") |
||||||
|
@Api(value = "工厂数据", tags = "工厂数据接口") |
||||||
|
public class PanFactoryDataController extends BladeController { |
||||||
|
|
||||||
|
private final IPanFactoryOrderService factoryOrderService; |
||||||
|
private final IPanPackageInfoService packageInfoService; |
||||||
|
private final IPanPackageListService packageListService; |
||||||
|
private final IPanFactoryDataService panFactoryDataService; |
||||||
|
private final IAsyncDataService syncDataService; |
||||||
|
private RabbitTemplate rabbitTemplate; |
||||||
|
private final IOrderStatusLogService panOrderStatusLogService; |
||||||
|
|
||||||
|
// @ResponseBody
|
||||||
|
// @PostMapping("/token")
|
||||||
|
// @ApiOperationSupport(order = 1)
|
||||||
|
// @ApiOperation(value = "获取token推送", notes = "传入factoryAccountDTO")
|
||||||
|
// public R token(@Validated @RequestBody FactoryAccountDTO factoryAccountDTO, HttpServletResponse response) {
|
||||||
|
// log.info("############token: 获取账号token");
|
||||||
|
// //通过企业id 应用id 秘钥 获取对应的token
|
||||||
|
// String corpid = factoryAccountDTO.getCorpid();//企业id
|
||||||
|
// String appkey = factoryAccountDTO.getAppkey();//应用id
|
||||||
|
// String appsecret = factoryAccountDTO.getAppsecret();//秘钥
|
||||||
|
//
|
||||||
|
// try{
|
||||||
|
// FactoryTokenVO factoryTokenVO = factoryDataService.getToken(corpid,appkey,appsecret);
|
||||||
|
// String token = factoryTokenVO.getToken();
|
||||||
|
// //把token放入头
|
||||||
|
// response.setHeader("Authorization",token);
|
||||||
|
// return R.data(factoryTokenVO);
|
||||||
|
// }catch (CustomerException e){
|
||||||
|
// log.error(e.getMessage(),e);
|
||||||
|
// return R.fail(e.code,e.message);
|
||||||
|
// }catch (Exception e){
|
||||||
|
// log.error(e.getMessage(),e);
|
||||||
|
// return R.fail(400,e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 工厂数据推送接口 |
||||||
|
*/ |
||||||
|
@ResponseBody |
||||||
|
@PostMapping("/data") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "通常数据推送", notes = "传入factoryOrderDTO") |
||||||
|
public Resp data(@Validated @RequestBody PanFactoryOrderDTO factoryOrderDTO, HttpServletRequest request) { |
||||||
|
log.info("############data: "); |
||||||
|
String corpId = request.getHeader("corpId"); |
||||||
|
factoryOrderDTO.setCorpid(corpId); |
||||||
|
|
||||||
|
//先保存原始请求数据
|
||||||
|
OrderStatusLog panOrderStatusLog = new OrderStatusLog(); |
||||||
|
panOrderStatusLog.setArgs(JSONObject.toJSONString(factoryOrderDTO)); |
||||||
|
panOrderStatusLog.setStatus(1); |
||||||
|
panOrderStatusLog.setType(3); |
||||||
|
panOrderStatusLog.setBrand("皮阿诺"); |
||||||
|
panOrderStatusLogService.save(panOrderStatusLog); |
||||||
|
|
||||||
|
//判断数据是否已存入
|
||||||
|
String orderNo = factoryOrderDTO.getOrderNo(); |
||||||
|
QueryWrapper<PanFactoryOrder> queryWrapper = new QueryWrapper<>(); |
||||||
|
queryWrapper.eq("order_no",orderNo); |
||||||
|
PanFactoryOrder one = factoryOrderService.getOne(queryWrapper); |
||||||
|
if(!Objects.isNull(one)){ |
||||||
|
log.warn("############data: 订单数据已存在 orderNo={}",orderNo); |
||||||
|
return Resp.fail(400,"订单数据已存在"); |
||||||
|
} |
||||||
|
|
||||||
|
try{ |
||||||
|
panFactoryDataService.saveData(factoryOrderDTO); |
||||||
|
panOrderStatusLog.setStatus(0); |
||||||
|
}catch (Exception e){ |
||||||
|
log.warn("############data: 保存数据失败 orderNo={}",orderNo); |
||||||
|
//修改保存数据的状态
|
||||||
|
panOrderStatusLog.setStatus(2); |
||||||
|
} |
||||||
|
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); |
||||||
|
|
||||||
|
//开启异步线程处理数据
|
||||||
|
syncDataService.handlerPanDataToHt(); |
||||||
|
|
||||||
|
return Resp.successOrderNo(factoryOrderDTO.getOrderNo(),factoryOrderDTO.getDeliveryNumber(),"SUCCESS"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.dto; |
package com.logpm.factory.pan.dto; |
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty; |
import com.fasterxml.jackson.annotation.JsonProperty; |
||||||
import com.logpm.factory.snm.entity.PanFactoryOrder; |
import com.logpm.factory.snm.entity.PanFactoryOrder; |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.dto; |
package com.logpm.factory.pan.dto; |
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty; |
import com.fasterxml.jackson.annotation.JsonProperty; |
||||||
import com.logpm.factory.snm.entity.PanPackageInfo; |
import com.logpm.factory.snm.entity.PanPackageInfo; |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.dto; |
package com.logpm.factory.pan.dto; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.PanPackageList; |
import com.logpm.factory.snm.entity.PanPackageList; |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.logpm.factory.snm.mapper.PanFactoryOrderMapper"> |
<mapper namespace="com.logpm.factory.pan.mapper.PanFactoryOrderMapper"> |
||||||
|
|
||||||
<!-- 通用查询映射结果 --> |
<!-- 通用查询映射结果 --> |
||||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.logpm.factory.snm.mapper.PanPackageInfoMapper"> |
<mapper namespace="com.logpm.factory.pan.mapper.PanPackageInfoMapper"> |
||||||
|
|
||||||
<!-- 通用查询映射结果 --> |
<!-- 通用查询映射结果 --> |
||||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.logpm.factory.snm.mapper.PanPackageListMapper"> |
<mapper namespace="com.logpm.factory.pan.mapper.PanPackageListMapper"> |
||||||
|
|
||||||
<!-- 通用查询映射结果 --> |
<!-- 通用查询映射结果 --> |
||||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.pan.service; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.PanFactoryOrder; |
import com.logpm.factory.snm.entity.PanFactoryOrder; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.pan.service; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.PanPackageInfo; |
import com.logpm.factory.snm.entity.PanPackageInfo; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@ |
|||||||
package com.logpm.factory.snm.service; |
package com.logpm.factory.pan.service; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.PanPackageList; |
import com.logpm.factory.snm.entity.PanPackageList; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,8 +1,8 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.pan.service.impl; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.PanFactoryOrder; |
import com.logpm.factory.snm.entity.PanFactoryOrder; |
||||||
import com.logpm.factory.snm.mapper.PanFactoryOrderMapper; |
import com.logpm.factory.pan.mapper.PanFactoryOrderMapper; |
||||||
import com.logpm.factory.snm.service.IPanFactoryOrderService; |
import com.logpm.factory.pan.service.IPanFactoryOrderService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import org.slf4j.Logger; |
import org.slf4j.Logger; |
||||||
import org.slf4j.LoggerFactory; |
import org.slf4j.LoggerFactory; |
@ -1,8 +1,8 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.pan.service.impl; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.PanPackageInfo; |
import com.logpm.factory.snm.entity.PanPackageInfo; |
||||||
import com.logpm.factory.snm.mapper.PanPackageInfoMapper; |
import com.logpm.factory.pan.mapper.PanPackageInfoMapper; |
||||||
import com.logpm.factory.snm.service.IPanPackageInfoService; |
import com.logpm.factory.pan.service.IPanPackageInfoService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import org.slf4j.Logger; |
import org.slf4j.Logger; |
||||||
import org.slf4j.LoggerFactory; |
import org.slf4j.LoggerFactory; |
@ -1,8 +1,8 @@ |
|||||||
package com.logpm.factory.snm.service.impl; |
package com.logpm.factory.pan.service.impl; |
||||||
|
|
||||||
import com.logpm.factory.snm.entity.PanPackageList; |
import com.logpm.factory.snm.entity.PanPackageList; |
||||||
import com.logpm.factory.snm.mapper.PanPackageListMapper; |
import com.logpm.factory.pan.mapper.PanPackageListMapper; |
||||||
import com.logpm.factory.snm.service.IPanPackageListService; |
import com.logpm.factory.pan.service.IPanPackageListService; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import org.slf4j.Logger; |
import org.slf4j.Logger; |
||||||
import org.slf4j.LoggerFactory; |
import org.slf4j.LoggerFactory; |
@ -1,240 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are met: |
|
||||||
* |
|
||||||
* Redistributions of source code must retain the above copyright notice, |
|
||||||
* this list of conditions and the following disclaimer. |
|
||||||
* Redistributions in binary form must reproduce the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer in the |
|
||||||
* documentation and/or other materials provided with the distribution. |
|
||||||
* Neither the name of the dreamlu.net developer nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* Author: Chill 庄骞 (smallchill@163.com) |
|
||||||
*/ |
|
||||||
package com.logpm.factory.snm.controller; |
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil; |
|
||||||
import com.alibaba.fastjson.JSONObject; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
||||||
import com.logpm.factory.snm.bean.Resp; |
|
||||||
import com.logpm.factory.snm.dto.*; |
|
||||||
import com.logpm.factory.snm.entity.PanFactoryOrder; |
|
||||||
import com.logpm.factory.snm.entity.OrderStatusLog; |
|
||||||
import com.logpm.factory.snm.entity.PanPackageInfo; |
|
||||||
import com.logpm.factory.snm.entity.PanPackageList; |
|
||||||
import com.logpm.factory.snm.service.*; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import lombok.extern.log4j.Log4j2; |
|
||||||
import org.springblade.common.constant.RabbitConstant; |
|
||||||
import org.springblade.common.exception.CustomerException; |
|
||||||
import org.springblade.common.utils.CommonUtil; |
|
||||||
import org.springblade.core.boot.ctrl.BladeController; |
|
||||||
import org.springblade.core.tool.api.R; |
|
||||||
import org.springframework.amqp.rabbit.connection.CorrelationData; |
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate; |
|
||||||
import org.springframework.validation.annotation.Validated; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Objects; |
|
||||||
import java.util.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* 皮阿诺数据 控制器 |
|
||||||
* |
|
||||||
* @author zhy |
|
||||||
* @since 2023-06-06 |
|
||||||
*/ |
|
||||||
@Log4j2 |
|
||||||
@RestController |
|
||||||
@AllArgsConstructor |
|
||||||
@RequestMapping("/factory/pan") |
|
||||||
@Api(value = "工厂数据", tags = "工厂数据接口") |
|
||||||
public class PanFactoryDataController extends BladeController { |
|
||||||
|
|
||||||
private final IPanFactoryOrderService factoryOrderService; |
|
||||||
private final IPanPackageInfoService packageInfoService; |
|
||||||
private final IPanPackageListService packageListService; |
|
||||||
private final IPanFactoryDataService factoryDataService; |
|
||||||
private final IAsyncDataService syncDataService; |
|
||||||
private RabbitTemplate rabbitTemplate; |
|
||||||
private final IOrderStatusLogService panOrderStatusLogService; |
|
||||||
|
|
||||||
// @ResponseBody
|
|
||||||
// @PostMapping("/token")
|
|
||||||
// @ApiOperationSupport(order = 1)
|
|
||||||
// @ApiOperation(value = "获取token推送", notes = "传入factoryAccountDTO")
|
|
||||||
// public R token(@Validated @RequestBody FactoryAccountDTO factoryAccountDTO, HttpServletResponse response) {
|
|
||||||
// log.info("############token: 获取账号token");
|
|
||||||
// //通过企业id 应用id 秘钥 获取对应的token
|
|
||||||
// String corpid = factoryAccountDTO.getCorpid();//企业id
|
|
||||||
// String appkey = factoryAccountDTO.getAppkey();//应用id
|
|
||||||
// String appsecret = factoryAccountDTO.getAppsecret();//秘钥
|
|
||||||
//
|
|
||||||
// try{
|
|
||||||
// FactoryTokenVO factoryTokenVO = factoryDataService.getToken(corpid,appkey,appsecret);
|
|
||||||
// String token = factoryTokenVO.getToken();
|
|
||||||
// //把token放入头
|
|
||||||
// response.setHeader("Authorization",token);
|
|
||||||
// return R.data(factoryTokenVO);
|
|
||||||
// }catch (CustomerException e){
|
|
||||||
// log.error(e.getMessage(),e);
|
|
||||||
// return R.fail(e.code,e.message);
|
|
||||||
// }catch (Exception e){
|
|
||||||
// log.error(e.getMessage(),e);
|
|
||||||
// return R.fail(400,e.getMessage());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 工厂数据推送接口 |
|
||||||
*/ |
|
||||||
@ResponseBody |
|
||||||
@PostMapping("/data") |
|
||||||
@ApiOperationSupport(order = 1) |
|
||||||
@ApiOperation(value = "通常数据推送", notes = "传入factoryOrderDTO") |
|
||||||
public Resp data(@Validated @RequestBody PanFactoryOrderDTO factoryOrderDTO, HttpServletRequest request) { |
|
||||||
log.info("############data: "); |
|
||||||
String corpId = request.getHeader("corpId"); |
|
||||||
|
|
||||||
//先保存原始请求数据
|
|
||||||
OrderStatusLog panOrderStatusLog = new OrderStatusLog(); |
|
||||||
panOrderStatusLog.setArgs(JSONObject.toJSONString(factoryOrderDTO)); |
|
||||||
panOrderStatusLog.setStatus(1); |
|
||||||
panOrderStatusLog.setType(3); |
|
||||||
panOrderStatusLogService.save(panOrderStatusLog); |
|
||||||
|
|
||||||
//判断数据是否已存入
|
|
||||||
String orderNo = factoryOrderDTO.getOrderNo(); |
|
||||||
QueryWrapper<PanFactoryOrder> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("order_no",orderNo); |
|
||||||
PanFactoryOrder one = factoryOrderService.getOne(queryWrapper); |
|
||||||
if(!Objects.isNull(one)){ |
|
||||||
log.warn("############data: 订单数据已存在 orderNo={}",orderNo); |
|
||||||
return Resp.fail(400,"订单数据已存在"); |
|
||||||
} |
|
||||||
|
|
||||||
PanFactoryOrder factoryOrder = new PanFactoryOrder(); |
|
||||||
BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); |
|
||||||
factoryOrder.setCorpid(corpId); |
|
||||||
//保存订单数据
|
|
||||||
factoryOrderService.save(factoryOrder); |
|
||||||
|
|
||||||
List<PanPackageInfoDTO> packageInfos = factoryOrderDTO.getORDER_ATTRIBUTES(); |
|
||||||
|
|
||||||
for (PanPackageInfoDTO dto:packageInfos){ |
|
||||||
PanPackageInfo packageInfo = new PanPackageInfo(); |
|
||||||
BeanUtil.copyProperties(dto,packageInfo); |
|
||||||
packageInfo.setOrderId(factoryOrder.getId()); |
|
||||||
//保存包件信息数据
|
|
||||||
//因为需要先保存包件明细需要包件的id
|
|
||||||
packageInfoService.save(packageInfo); |
|
||||||
|
|
||||||
//再存入包件明细
|
|
||||||
List<PanPackageList> PanPackagelist = new ArrayList<>(); |
|
||||||
List<PanPackageListDTO> order_attributes_line = dto.getORDER_ATTRIBUTES_LINE(); |
|
||||||
for (PanPackageListDTO panPackageListDTO:order_attributes_line){ |
|
||||||
PanPackageList panPackageList = new PanPackageList(); |
|
||||||
BeanUtil.copyProperties(panPackageListDTO,panPackageList); |
|
||||||
panPackageList.setPackageId(packageInfo.getId()); |
|
||||||
PanPackagelist.add(panPackageList); |
|
||||||
} |
|
||||||
packageListService.saveBatch(PanPackagelist); |
|
||||||
} |
|
||||||
|
|
||||||
//修改保存数据的状态
|
|
||||||
panOrderStatusLog.setStatus(0); |
|
||||||
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); |
|
||||||
|
|
||||||
//开启异步线程处理数据
|
|
||||||
syncDataService.handlerPanDataToHt(); |
|
||||||
|
|
||||||
return Resp.successOrderNo(factoryOrder.getOrderNo(),factoryOrder.getDeliveryNumber(),"SUCCESS"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ResponseBody |
|
||||||
@PostMapping("/sendOrders") |
|
||||||
@ApiOperationSupport(order = 1) |
|
||||||
@ApiOperation(value = "订单数据推送", notes = "传入orderInfoDTO") |
|
||||||
public R sendOrders(@Validated @RequestBody OrderInfoDTO orderInfoDTO) { |
|
||||||
log.info("############sendOrders: 请求参数{}",orderInfoDTO); |
|
||||||
try{ |
|
||||||
|
|
||||||
//先保存原始请求数据
|
|
||||||
OrderStatusLog panOrderStatusLog = new OrderStatusLog(); |
|
||||||
panOrderStatusLog.setArgs(JSONObject.toJSONString(orderInfoDTO)); |
|
||||||
panOrderStatusLog.setStatus(1); |
|
||||||
panOrderStatusLog.setType(1); |
|
||||||
panOrderStatusLogService.save(panOrderStatusLog); |
|
||||||
|
|
||||||
Map<String,Object> map=new HashMap<>(); |
|
||||||
map.put("messageId", CommonUtil.getUUID()); |
|
||||||
map.put("logId", panOrderStatusLog.getId()); |
|
||||||
map.put("messageData",orderInfoDTO); |
|
||||||
map.put("createTime",new Date().getTime()); |
|
||||||
//将消息携带绑定键值
|
|
||||||
rabbitTemplate.convertAndSend(RabbitConstant.OPEN_ORDER_EXCHANGE, RabbitConstant.OPEN_ORDER_ROUTING, map,new CorrelationData(String.valueOf(panOrderStatusLog.getId()))); |
|
||||||
|
|
||||||
// R r = factoryDataService.handleData(orderInfoDTO);
|
|
||||||
return R.success("调用成功"); |
|
||||||
}catch (CustomerException e){ |
|
||||||
log.error(e.message,e); |
|
||||||
return R.fail(e.code,e.message); |
|
||||||
}catch (Exception e){ |
|
||||||
log.error("############sendOrders: 系统异常",e); |
|
||||||
return R.fail(500,"############sendOrders: 系统异常"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ResponseBody |
|
||||||
@PostMapping("/sendOrderStatus") |
|
||||||
@ApiOperationSupport(order = 1) |
|
||||||
@ApiOperation(value = "订单状态推送", notes = "传入orderInfoDTO") |
|
||||||
public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) { |
|
||||||
log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO); |
|
||||||
try{ |
|
||||||
|
|
||||||
//先保存原始请求数据
|
|
||||||
OrderStatusLog panOrderStatusLog = new OrderStatusLog(); |
|
||||||
panOrderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO)); |
|
||||||
panOrderStatusLog.setStatus(1); |
|
||||||
panOrderStatusLog.setType(2); |
|
||||||
panOrderStatusLogService.save(panOrderStatusLog); |
|
||||||
|
|
||||||
Map<String,Object> map=new HashMap<>(); |
|
||||||
map.put("messageId", CommonUtil.getUUID()); |
|
||||||
map.put("logId", panOrderStatusLog.getId()); |
|
||||||
map.put("type", "Push"); |
|
||||||
map.put("messageData",orderStatusDTO); |
|
||||||
map.put("createTime",new Date().getTime()); |
|
||||||
//将消息携带绑定键值
|
|
||||||
rabbitTemplate.convertAndSend(RabbitConstant.ORDER_STATUS_EXCHANGE, RabbitConstant.ORDER_STATUS_ROUTING, map); |
|
||||||
map.put("type", "DealWith"); |
|
||||||
rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING,map); |
|
||||||
|
|
||||||
|
|
||||||
// R r = factoryDataService.handleStatusData(orderStatusDTO);
|
|
||||||
return R.success("调用成功"); |
|
||||||
}catch (CustomerException e){ |
|
||||||
log.error(e.message,e); |
|
||||||
return R.fail(e.code,e.message); |
|
||||||
}catch (Exception e){ |
|
||||||
log.error("############sendOrderStatus: 系统异常",e); |
|
||||||
return R.fail(500,"############sendOrderStatus: 系统异常"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,20 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||||
<mapper namespace="com.logpm.factory.snm.mapper.MtFactoryOrderMainMapper"> |
|
||||||
|
|
||||||
<!-- 通用查询映射结果 --> |
|
||||||
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> |
|
||||||
<!-- <result column="id" property="id"/>--> |
|
||||||
<!-- <result column="req_args" property="reqArgs"/>--> |
|
||||||
<!-- <result column="res_body" property="resBody"/>--> |
|
||||||
<!-- <result column="type" property="type"/>--> |
|
||||||
<!-- <result column="create_user" property="createUser"/>--> |
|
||||||
<!-- <result column="create_time" property="createTime"/>--> |
|
||||||
<!-- <result column="update_user" property="updateUser"/>--> |
|
||||||
<!-- <result column="update_time" property="updateTime"/>--> |
|
||||||
<!-- <result column="status" property="status"/>--> |
|
||||||
<!-- <result column="is_deleted" property="isDeleted"/>--> |
|
||||||
<!-- <result column="create_dept" property="createDept"/>--> |
|
||||||
<!-- </resultMap>--> |
|
||||||
|
|
||||||
</mapper> |
|
Loading…
Reference in new issue