Commit 785023c2 by 周晓航

Merge branch 'feature-20210426/xxl-job上报订单微信数据-周晓航' into develop

# Conflicts:
#	assortment-ordercenter-sdk/pom.xml
#	order-application-service/pom.xml
#	order-application-service/src/main/java/cn/freemud/controller/OrderController.java
parents cb73dfc8 80cd12d2
......@@ -40,6 +40,7 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<artifactId>structure-center-sdk</artifactId>
......@@ -58,7 +59,7 @@
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<artifactId>productcenter-sdk</artifactId>
<version>4.0.2.SNAPSHOT</version>
<version>4.0.3.RELEASE</version>
</dependency>
<dependency>
<artifactId>membercenter-sdk</artifactId>
......@@ -78,7 +79,7 @@
<dependency>
<groupId>com.freemud.sdk.api.assortment</groupId>
<artifactId>assortment-messagepush-sdk</artifactId>
<version>2.6.3.RELEASE</version>
<version>2.7.2.RELEASE</version>
<exclusions>
<exclusion>
<groupId>cn.freemud.commons</groupId>
......
......@@ -16,10 +16,10 @@ import org.springframework.context.annotation.Configuration;
@Log4j2
public class XxlJobConfig {
@Value("${xxl.job.admin.addresses:http://xxl-job-admin-dev.api-ingress.sandload.cn/xxl-job-admin}")
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.executor.appname:xxl-job-executor-report-orders-wechat}")
@Value("${xxl.job.executor.appname}")
private String appName;
//@Value("${xxl.job.executor.ip}")
......
......@@ -23,21 +23,24 @@ import cn.freemud.service.MCCafeOrderService;
import cn.freemud.service.OrderAdapterService;
import cn.freemud.service.Orderservice;
import cn.freemud.service.impl.MallOrderServiceImpl;
import cn.freemud.utils.LogUtil;
import cn.freemud.utils.ResponseUtil;
import cn.freemud.xxljob.OrderCountJobHandler;
import com.freemud.application.sdk.api.log.ApiAnnotation;
import com.freemud.application.sdk.api.log.LogParams;
import com.freemud.application.sdk.api.ordercenter.request.OrderCountReqs;
import com.freemud.application.sdk.api.ordercenter.response.OrderCountResp;
import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.List;
@Slf4j
@RequestMapping("/order")
@RestController
@Validated
......@@ -458,4 +461,23 @@ public class OrderController {
public BaseResponse scoreRecord(@Validated @LogParams @RequestBody QueryOrderVo queryOrderVo) {
return orderservice.scoreRecord(queryOrderVo);
}
@Autowired
private OrderCountJobHandler orderCountJobHandler;
/**
* 订单统计 上报数据
* @param
* @return
*/
@ApiAnnotation(logMessage = "reportSendOrderCount")
@PostMapping("/reportSendOrderCount")
public BaseResponse reportSendOrderCount() throws Exception {
LogUtil.info("触发订单上报",null,null);
orderCountJobHandler.execute(null);
return ResponseUtil.success();
}
}
......@@ -4490,6 +4490,7 @@ public class OrderServiceImpl implements Orderservice {
BeanUtil.convertBean(orderCountRequestVo, orderCountReqs);
com.freemud.application.sdk.api.ordercenter.response.BaseResponse<List<OrderCountResp>> result = orderSdkService.countOrdersByPartnerIds(orderCountReqs, trackingNo);
LogUtil.info("remote /order/v2/orderCount resp :",orderCountReqs, result);
if (Objects.isNull(result)) {
return new BaseResponse(ResponseResultEnum.SYSTEM_ERROR.getCode(), ResponseResultEnum.SYSTEM_ERROR.getMessage(), "", null);
}
......
......@@ -8,12 +8,11 @@ import cn.freemud.entities.vo.SendOrderCountsMsg;
import cn.freemud.service.Orderservice;
import cn.freemud.service.thirdparty.MicroOpenplatformClient;
import cn.freemud.utils.LogUtil;
import com.alibaba.fastjson.JSON;
import com.freemud.application.sdk.api.constant.ResponseResultEnum;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.ordercenter.request.OrderCountReqs;
import com.freemud.application.sdk.api.ordercenter.response.OrderCountResp;
import com.freemud.application.sdk.api.ordercenter.response.OrderGetPartnerRequest;
import com.freemud.sdk.api.assortment.order.domain.ResponseCodeConstant;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
......@@ -59,10 +58,11 @@ public class OrderCountJobHandler extends IJobHandler {
String trackingNo = LogThreadLocal.getTrackingNo();
log.info("begin xxl-job by send report msg -------- trackingNo:{}", trackingNo);
OrderGetPartnerRequest build1 = OrderGetPartnerRequest.builder().type(3).build();
// 获取需要 上报的商户号
BaseResponse<GetFilterPartnerResponse> filterPartner = microOpenplatformClient.getFilterPartner(OrderGetPartnerRequest.builder().type(2).build());
LogUtil.info("orderCountJobHandler getFilterPartner", null, filterPartner);
BaseResponse<GetFilterPartnerResponse> filterPartner = microOpenplatformClient.getFilterPartner(build1);
if (filterPartner == null || filterPartner.getResult() == null) {
LogUtil.info("上报商户号没有数据", build1, filterPartner == null ? null : JSON.toJSONString(filterPartner));
return ReturnT.SUCCESS;
}
OrderCountRequestVo orderCountRequestVo = new OrderCountRequestVo();
......@@ -71,7 +71,7 @@ public class OrderCountJobHandler extends IJobHandler {
// 时间设置 前一天
setBeginAndEndTime(orderCountRequestVo);
BaseResponse<List<OrderCountResp>> result = orderservice.selectCountOrdersByPartnerIds(orderCountRequestVo, trackingNo);
LogUtil.info("orderCountJobHandler send report order count msg ", orderCountRequestVo, result);
LogUtil.info("orderCountJobHandlersendreportordercountmsg", orderCountRequestVo, result == null ? null : JSON.toJSONString(result));
if (!ResponseResultEnum.SUCCESS.getCode().equalsIgnoreCase(result.getCode()) || Objects.isNull(result.getResult())) {
return ReturnT.SUCCESS;
}
......@@ -79,8 +79,7 @@ public class OrderCountJobHandler extends IJobHandler {
List<OrderCountResp> orderCounts = result.getResult();
SendOrderCountsMsg build = SendOrderCountsMsg.builder().orders(orderCounts).build();
BaseResponse baseResponse = microOpenplatformClient.addOrderSum(build);
LogUtil.info("orderCountJobHandler send report order end ", null, baseResponse);
log.info("end xxl-job by send report msg -------- trackingNo:{}", trackingNo);
LogUtil.info("orderCountJobHandlersendreportorderend", null, JSON.toJSONString(baseResponse));
return ReturnT.SUCCESS;
}
......
......@@ -7,11 +7,12 @@ import lombok.Data;
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/4/27 下午2:49
* @description :
* @description : 订单业务 写死type=3
* 其他type 问 蔡浩伟
*/
@Data
@Builder
public class OrderGetPartnerRequest {
//1,活动招商;2,腾讯有数
//1,活动招商;2,知不道是什么,订单业务写死3 3,腾讯有数
private Integer type;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment