2f9b7006 wangzhiliang

菠萝派接口分库分表

1 个父辈 a4fca648
正在显示 22 个修改的文件 包含 446 行增加107 行删除
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:META-INF/conf/dubbo.properties</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" />
<!-- 远程服务代理接口 -->
<dubbo:annotation package="com.sibu.mall.order" />
<!-- 关闭提供者的检索 -->
<dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/>
<!-- 消费者名称 -->
<dubbo:application name="${dubbo.applicationName}" />
</beans>
\ No newline at end of file
##################### dubbo begin #############################
dubbo.registryAddress = zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181
dubbo.applicationName = mall-third-consumer
dubbo.connectTimeOut = 20000
dubbo.connectRetries= 0
dubbo.consumer.group= dev.sso.qiujw
dubbo.consumerVersion= 1.0
##################### dubbo end #############################
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:META-INF/conf/dubbo.properties</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" />
<!-- 远程服务代理接口 -->
<dubbo:annotation package="com.sibu.mall.order" />
<!-- 关闭提供者的检索 -->
<dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/>
<!-- 消费者名称 -->
<dubbo:application name="${dubbo.applicationName}" />
</beans>
\ No newline at end of file
##################### dubbo begin #############################
dubbo.registryAddress = zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181
dubbo.applicationName = mall-third-consumer
dubbo.connectTimeOut = 20000
dubbo.connectRetries= 0
dubbo.consumer.group= dev.sso.qiujw
dubbo.consumerVersion= 1.0
##################### dubbo end #############################
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:META-INF/conf/dubbo.properties</value>
</list>
</property>
</bean>
<!-- zookeeper注册中心 -->
<dubbo:registry protocol="zookeeper" address="${dubbo.registryAddress}" />
<!-- 远程服务代理接口 -->
<dubbo:annotation package="com.sibu.mall.order" />
<!-- 关闭提供者的检索 -->
<dubbo:consumer check="false" group="${dubbo.consumer.group}" version="${dubbo.consumerVersion}"/>
<!-- 服务调用超时,超时重试-->
<dubbo:provider delay="-1" timeout="${dubbo.connectTimeOut}" retries="${dubbo.connectRetries}"/>
<!-- 消费者名称 -->
<dubbo:application name="${dubbo.applicationName}" />
</beans>
\ No newline at end of file
##################### dubbo begin #############################
dubbo.registryAddress = zookeeper://111.230.133.155:2181?backup=111.231.243.221:2181,118.89.51.164:2181
dubbo.applicationName = mall-third-consumer
dubbo.connectTimeOut = 20000
dubbo.connectRetries= 0
dubbo.consumer.group= dev.sso.qiujw
dubbo.consumerVersion= wangzhiliang2
##################### dubbo end #############################
......@@ -7,18 +7,18 @@ jdbc.url=jdbc:mysql://120.76.137.184/sibu_wesale_base?useUnicode=true&characterE
jdbc.imtegralurl=jdbc:mysql://120.76.137.184/sibu_integralmall_base?useUnicode=true&characterEncoding=utf8
sqlserverjdbc.url=jdbc\:jtds\:sqlserver\://120.25.75.53\:1433;databaseName\=sibu_wesale_base_read_03
mall.write.url=jdbc:mysql://39.108.19.165:3306/ejavashop
mall.write.url=jdbc:mysql://118.89.51.164:3306/ejavashop
mall.write.username=sibu_wesale
mall.write.password=sibu123..
mall.read.url=jdbc:mysql://120.77.6.187:3306/ejavashop
mall.write.password=6SvbL5+JhXQSpf+ASsQ0Rg==
mall.read.url=jdbc:mysql://111.231.243.221:3306/ejavashop
mall.read.username=sibu_wesale
mall.read.password=sibu123..
mall.analysis.write.url=jdbc:mysql://39.108.19.165:3306/ejavashop
mall.read.password=6SvbL5+JhXQSpf+ASsQ0Rg==
mall.analysis.write.url=jdbc:mysql://118.89.51.164:3306/analysis
mall.analysis.write.username=sibu_wesale
mall.analysis.write.password=sibu123..
mall.analysis.read.url=jdbc:mysql://120.77.6.187:3306/ejavashop
mall.analysis.write.password=6SvbL5+JhXQSpf+ASsQ0Rg==
mall.analysis.read.url=jdbc:mysql://111.231.243.221:3306/analysis
mall.analysis.read.username=sibu_wesale
mall.analysis.read.password=sibu123..
mall.analysis.read.password=6SvbL5+JhXQSpf+ASsQ0Rg==
#数据库用户名
jdbc.username=root
......
......@@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter
}
private Charset getContentTypeCharset(MediaType contentType) {
if (contentType != null && contentType.getCharSet() != null) {
return contentType.getCharSet();
if (contentType != null && contentType.getCharset() != null) {
return contentType.getCharset();
}
else {
return DEFAULT_CHARSET;
......
......@@ -84,8 +84,8 @@ public class UTF8StringHttpMessageConverter extends AbstractHttpMessageConverter
}
private Charset getContentTypeCharset(MediaType contentType) {
if (contentType != null && contentType.getCharSet() != null) {
return contentType.getCharSet();
if (contentType != null && contentType.getCharset() != null) {
return contentType.getCharset();
}
else {
return DEFAULT_CHARSET;
......
......@@ -99,6 +99,13 @@ public interface MemberReadDao {
*/
Regions getRegionsById(@Param("id") Integer id);
/**
* 根据id查询省市级信息
* @param regionIdList
* @return
*/
List<Regions> getRegionsByIds(@Param("list") List regionIdList);
/**
* 根据条件查询物流公司
......@@ -148,4 +155,11 @@ public interface MemberReadDao {
* @return
*/
int countOrderProductNum(@Param("id") String orderProductId);
/**
* 根据旧订单号获取新订单号
* @param orderSn
* @return
*/
String getNewOrderSnByOldOrderSn(@Param("orderSn") String orderSn);
}
......
......@@ -18,6 +18,20 @@
<groupId>com.sibu.orderHelper.service</groupId>
<artifactId>com.sibu.orderHelper.service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>spring-context</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
......@@ -30,6 +44,7 @@
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>com.sibu.orderHelper.integralMall</finalName>
......
......@@ -28,6 +28,9 @@
<!--加载mq配置-->
<import resource="classpath:META-INF/conf/service-spring-mq.xml"></import>
<!--dubbo配置-->
<import resource="classpath:META-INF/conf/dubbo-consumer-config.xml"></import>
<!-- 开启注解配置
<context:annotation-config />-->
......
......@@ -281,6 +281,17 @@
where `id` = #{id}
</select>
<!-- 根据id查询省市级信息-->
<select id="getRegionsByIds" resultMap="regionsResult">
select
*
from `regions`
where `id` in
<foreach collection="list" item="regionId" open="(" close=")" separator=",">
#{regionId}
</foreach>
</select>
<!-- 物流公司实体-->
<resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany">
<result property="id" column="id" />
......@@ -467,6 +478,7 @@
<result column="member_back_code" property="refundno"/>
<result column="order_sn" property="platorderno"/>
<result column="order_product_id" property="subplatorderno"/>
<result column="orders_product_uid" property="ordersproductuid"/>
<result column="back_money" property="refundamount"/>
<result column="create_time" property="createtime"/>
<result column="member_name" property="buyernick"/>
......@@ -485,9 +497,8 @@
<select id="getGetRefundBean" parameterType="java.util.Map" resultMap="GetRefundBeanMap">
SELECT b.member_back_code,b.order_sn,b.order_product_id,b.back_money,b.create_time,b.member_name,
b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name,
o.money_order,o.order_state,o.remark
FROM member_product_back b LEFT JOIN orders o ON b.order_id = o.id
b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name,b.orders_product_uid
FROM member_product_back b
WHERE b.seller_id = #{supplierId}
<if test="beginTime!=null">
AND b.create_time >= #{beginTime}
......@@ -520,4 +531,8 @@
SELECT number FROM orders_product where id = #{id}
</select>
<select id="getNewOrderSnByOldOrderSn" parameterType="java.lang.String" resultType="java.lang.String">
SELECT order_sn FROM orders WHERE order_sn_back= #{orderSn}
</select>
</mapper>
\ No newline at end of file
......
......@@ -20,6 +20,8 @@ public class GetRefundBean implements Serializable{
//平台子订单号
private String subplatorderno;
private String ordersproductuid;
//订单总金额
private BigDecimal totalamount;
......@@ -296,4 +298,12 @@ public class GetRefundBean implements Serializable{
public void setStateMoney(Integer stateMoney) {
this.stateMoney = stateMoney;
}
public String getOrdersproductuid() {
return ordersproductuid;
}
public void setOrdersproductuid(String ordersproductuid) {
this.ordersproductuid = ordersproductuid;
}
}
......
......@@ -42,5 +42,12 @@
<artifactId>fastdfs-client-java</artifactId>
<version>5.0.4</version>
</dependency>
<dependency>
<groupId>com.sibu.sibu-mall-order</groupId>
<artifactId>sibu-mall-order-service-api</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.util.BeanCopyUtils;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.*;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.CheckRefundStatusBean;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
import com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
......@@ -22,7 +21,6 @@ import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
......@@ -33,13 +31,28 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
@Resource
private MemberReadDao memberReadDao;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Override
public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception {
CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse();
Map<String,Object> params = new HashMap<>();
params.put("orderSn",callRequest.getBizModel().getOrderID());
params.put("sellerId",callRequest.getSupplier().getId());
Orders orders = memberReadDao.getOrdersByMap(params);
//旧订单号处理
if(!callRequest.getBizModel().getOrderID().startsWith("B")){
callRequest.getBizModel().setOrderID(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getOrderID()));
}
ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getOrderID());
thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
Orders orders = null;
CommonResponse<ApiOrdersResponse> commonResponse = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
if(commonResponse.isSuccess()){
orders = BeanCopyUtils.copyProperties(Orders.class, commonResponse.getResult());
}else {
throw new BizException(commonResponse.getErrorMsg());
}
if(StringUtil.isNull(orders)){
log.error(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
throw new BizException(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.common.response.PageResult;
import com.sibu.mall.order.request.api.ApiOrdersSnRequest;
import com.sibu.mall.order.request.third.ThirdPageQueryOrderListRequest;
import com.sibu.mall.order.response.api.ApiOrdersProductResponse;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ApiOrdersProductService;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.util.BeanCopyUtils;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.integral.dao.IMDoingOrderDao;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.model.IMProductBean;
import com.sibu.orderHelper.integral.model.IMSupplier;
import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst;
import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct;
import com.sibu.orderHelper.integral.pineapple.model.Regions;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.pineapple.request.GetOrderRequest;
import com.sibu.orderHelper.integral.pineapple.response.BaseResponse;
import com.sibu.orderHelper.integral.pineapple.response.GetOrderResponse;
import com.sibu.orderHelper.integral.pineapple.response.OrderGoodResponse;
import com.sibu.orderHelper.integral.pineapple.response.OrderResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrder1DetailResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
import com.sibu.orderHelper.integral.service.IIMDoingOrderService;
import com.sibu.orderHelper.integral.service.impl.IMDoingOrderService;
import com.sibu.orderHelper.integral.service.pineapple.converter.PlatformOrderToPineAppleOrderConverter;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import com.sibu.orderHelper.service.redis.RedisProductSkuService;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.xml.bind.ValidationException;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -61,30 +53,78 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
@Resource
private MemberReadDao memberReadDao;
@Reference
private ApiOrdersProductService apiOrdersProductService;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Override
public BaseResponse call(CallRequest<GetOrderRequest> callRequest) {
Map<String,Object> params = new HashMap<>();
ThirdPageQueryOrderListRequest thirdPageQueryOrderListRequest = new ThirdPageQueryOrderListRequest();
if(!StringUtil.isNull(callRequest.getBizModel().getPlatOrderNo())){
params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
//旧订单号处理
if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
}
thirdPageQueryOrderListRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
}
if(!StringUtil.isNull(callRequest.getBizModel().getOrderStatus())){
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolve(callRequest.getBizModel().getOrderStatus());
params.put("orderState",orderStatusEnum.getMallOrderStatus());
thirdPageQueryOrderListRequest.setOrderState(orderStatusEnum.getMallOrderStatus());
}
params.put("sellerId",callRequest.getSupplier().getId());
thirdPageQueryOrderListRequest.setSellerId(callRequest.getSupplier().getId());
if(!StringUtil.isNull(callRequest.getBizModel().getStartTime())){
params.put("startTime",callRequest.getBizModel().getStartTime());
thirdPageQueryOrderListRequest.setStartTime(callRequest.getBizModel().getStartTime());
}
if(!StringUtil.isNull(callRequest.getBizModel().getEndTime())){
params.put("endTime",callRequest.getBizModel().getEndTime());
thirdPageQueryOrderListRequest.setEndTime(callRequest.getBizModel().getEndTime());
}
params.put("PageIndex",(callRequest.getBizModel().getPageIndex() - 1) * callRequest.getBizModel().getPageSize());
params.put("PageSize",callRequest.getBizModel().getPageSize());
List<Orders> ordersList = memberReadDao.getOrdersList(params);
thirdPageQueryOrderListRequest.setPageNow(callRequest.getBizModel().getPageIndex());
thirdPageQueryOrderListRequest.setPageSize(callRequest.getBizModel().getPageSize());
CommonResponse<PageResult<ApiOrdersResponse>> thirdResponse = thirdApiOrderService.pageOrder(thirdPageQueryOrderListRequest);
GetOrderResponse response = new GetOrderResponse();
response.setNumTotalOrder(memberReadDao.countgetOrdersList(params));
response.setOrders(findOrders(ordersList));
response.setNumTotalOrder(0);
response.setOrders(new ArrayList<>());
response.setCode(PineAppleConst.SUCCESS_CODE);
if(thirdResponse.isSuccess()){
List<Orders> ordersList = BeanCopyUtils.copyList(Orders.class,thirdResponse.getResult().getDatas());
List<Integer> provinceIdList = ordersList.stream().map(o->o.getProvinceId()).collect(Collectors.toList());
List<Regions> provinceList = memberReadDao.getRegionsByIds(provinceIdList);
List<Integer> cityIdList = ordersList.stream().map(o->o.getCityId()).collect(Collectors.toList());
List<Regions> cityList = memberReadDao.getRegionsByIds(cityIdList);
List<Integer> areaIdList = ordersList.stream().map(o->o.getAreaId()).collect(Collectors.toList());
List<Regions> areaList = memberReadDao.getRegionsByIds(areaIdList);
ordersList.stream().forEach(i->{
Optional<Regions> province = provinceList.stream().filter(p->p.getId().intValue() == i.getProvinceId()).findFirst();
province.ifPresent(e->{
i.setRegionName1(e.getRegionName());
});
Optional<Regions> city = cityList.stream().filter(p->p.getId().intValue() == i.getCityId()).findFirst();
city.ifPresent(e->{
i.setRegionName2(e.getRegionName());
});
Optional<Regions> area = areaList.stream().filter(p->p.getId().intValue() == i.getAreaId()).findFirst();
area.ifPresent(e->{
i.setRegionName3(e.getRegionName());
});
});
response.setNumTotalOrder(thirdResponse.getResult().getTotalRecord());
response.setOrders(findOrders(ordersList));
}else {
throw new BizException(thirdResponse.getErrorMsg());
}
return response;
}
......@@ -94,7 +134,12 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
ordersList.stream().forEach(o ->{
OrderResponse orderResponse = this.getOrderResponse(o);
try {
List<OrdersProduct> ordersProductList = memberReadDao.getOrdersProductList(o.getOrderSn());
List<OrdersProduct> ordersProductList = null;
CommonResponse<List<ApiOrdersProductResponse>> commonResponse = apiOrdersProductService.getOrdersProductByOrderSn(new ApiOrdersSnRequest(o.getOrderSn()));
if(commonResponse.isSuccess()){
ordersProductList = BeanCopyUtils.copyList(OrdersProduct.class, commonResponse.getResult());
}
if(StringUtil.isNull(ordersProductList)){
throw new BizException(String.format("获取子订单数据业务异常[%s]",(o.getOrderSn())));
}
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.order.request.api.ApiOrdersSnRequest;
import com.sibu.mall.order.request.third.ThirdOrdersProductIdRequest;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ApiOrdersService;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
......@@ -36,6 +43,12 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
@Resource
private MemberReadDao memberReadDao;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Reference
private ApiOrdersService apiOrdersService;
@Override
public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception {
GetRefundResponse getRefundResponse =new GetRefundResponse();
......@@ -49,8 +62,23 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
List<GetRefundBean> refundBeanList = memberReadDao.getGetRefundBean(params);
if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){
for(GetRefundBean getRefundBean:refundBeanList){
int productNum = memberReadDao.countOrderProductNum(getRefundBean.getSubplatorderno());
getRefundBean.setProductnum(productNum);
String orderSn = getRefundBean.getPlatorderno();
//旧订单号处理
if(!orderSn.startsWith("B")){
orderSn = memberReadDao.getNewOrderSnByOldOrderSn(orderSn);
}
CommonResponse<ApiOrdersResponse> orderResponse = apiOrdersService.getOrdersByOrderSn(new ApiOrdersSnRequest(orderSn));
if(orderResponse.isSuccess()){
getRefundBean.setTotalamount(orderResponse.getResult().getMoneyOrder());
getRefundBean.setPayamount(orderResponse.getResult().getMoneyOrder());
getRefundBean.setOrderstatus(String.valueOf(orderResponse.getResult().getOrderState()));
}else {
throw new BizException(orderResponse.getErrorMsg());
}
CommonResponse<Integer> response = thirdApiOrderService.countOrderProductNum(new ThirdOrdersProductIdRequest(getRefundBean.getOrdersproductuid(),orderSn));
getRefundBean.setProductnum(response.getResult());
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(Integer.valueOf(getRefundBean.getOrderstatus()));
if(orderStatusEnum.getCode().equals(OrderStatusEnum.UNKNOWN.getCode())){
throw new BizException(String.format("菠萝派退款单下载,枚举查询订单状态报错,订单状态【{0}】转换失败",getRefundBean.getOrderstatus()));
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
import com.sibu.mall.order.request.third.ThirdUpdateOrderRequest;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.util.BeanCopyUtils;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.PayOrderStatus;
import com.sibu.orderHelper.enums.PineappleEnum;
import com.sibu.orderHelper.enums.PineappleMethodsEnum;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.CourierCompany;
......@@ -21,7 +22,6 @@ import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import com.sibu.orderHelper.mall.member.write.MemberWriteDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
......@@ -34,14 +34,32 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
@Resource
private MemberWriteDao memberWriteDao;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Override
public BaseResponse call(CallRequest<PineappleSendRequest> callRequest) throws Exception {
BaseResponse baseResponse =new BaseResponse();
Map<String,Object> params = new HashMap<>();
params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
params.put("sellerId",callRequest.getSupplier().getId());
ThirdUpdateOrderRequest thirdUpdateOrderRequest = new ThirdUpdateOrderRequest();
//旧订单号处理
if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
}
thirdUpdateOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
thirdUpdateOrderRequest.setSellerId(callRequest.getSupplier().getId());
Orders orders = memberWriteDao.getOrdersByMap(params);
ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
Orders orders = null;
CommonResponse<ApiOrdersResponse> commonResponse = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
if(commonResponse.isSuccess()){
orders = BeanCopyUtils.copyProperties(Orders.class, commonResponse.getResult());
}else {
throw new BizException(commonResponse.getErrorMsg());
}
if(StringUtil.isNull(orders)){
log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
......@@ -52,14 +70,14 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
if( orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){
//订单状态
params.put("orderState",EJavaShopOrderStateEnum.HasReceived.getCode());
thirdUpdateOrderRequest.setOrderState(EJavaShopOrderStateEnum.HasReceived.getCode());
//收货人名字
if(!StringUtil.isNull(callRequest.getBizModel().getSenderName())){
params.put("name",callRequest.getBizModel().getSenderName());
thirdUpdateOrderRequest.setName(callRequest.getBizModel().getSenderName());
}
//电话
if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){
params.put("mobile",callRequest.getBizModel().getSenderTel());
thirdUpdateOrderRequest.setMobile(callRequest.getBizModel().getSenderTel());
}
//地址、快递信息 建议去除
//this.gainInfo(params,callRequest,orders);
......@@ -68,16 +86,18 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
//判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
Map<String,Object> checkMap = new HashMap<>();
/* Map<String,Object> checkMap = new HashMap<>();
checkMap.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
checkMap.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
checkMap.put("sellerId",callRequest.getSupplier().getId());
int num = memberWriteDao.checkLogisticsNumber(checkMap);
if(num == 0){
int num = memberWriteDao.checkLogisticsNumber(checkMap);*/
thirdQueryOrderRequest.setLogisticsNumber(callRequest.getBizModel().getLogisticNo());
CommonResponse<Boolean> response = thirdApiOrderService.checkLogisticsNumber(thirdQueryOrderRequest);
if(response.isSuccess() && !response.getResult()){
if(StringUtil.isNull(orders.getLogisticsNumber())){
params.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
thirdUpdateOrderRequest.setLogisticsNumber(callRequest.getBizModel().getLogisticNo());
}else{
params.put("logisticsNumber",orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo());
thirdUpdateOrderRequest.setLogisticsNumber(orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo());
}
}
}
......@@ -87,7 +107,7 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
throw new BizException(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
}
//修改订单信息
memberWriteDao.updateOrdersState(params);
thirdApiOrderService.updateOrders(thirdUpdateOrderRequest);
baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
baseResponse.setCode(PineappleEnum.SUCCESS.getCode());
return baseResponse;
......
package com.sibu.orderHelper.integral.service.pineapple.impl;
import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.database.DBContextHolder;
import com.sibu.orderHelper.common.strategy.DbUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.doubo.common.model.response.CommonResponse;
import com.sibu.mall.order.request.third.ThirdQueryOrderRequest;
import com.sibu.mall.order.request.third.ThirdUpdateOrderRequest;
import com.sibu.mall.order.response.api.ApiOrdersResponse;
import com.sibu.mall.order.service.ThirdApiOrderService;
import com.sibu.orderHelper.common.util.BeanCopyUtils;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.PineappleEnum;
import com.sibu.orderHelper.enums.PineappleMethodsEnum;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.UpdateSellerMemoResponse;
import com.sibu.orderHelper.integral.request.UpdateSellerMemoRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import com.sibu.orderHelper.mall.member.write.MemberWriteDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Service
public class UpdateSellerMemoBizServiceImpl extends AbstractBizService<UpdateSellerMemoRequest> {
private static Logger log = Logger.getLogger(UpdateSellerMemoBizServiceImpl.class);
@Resource
private MemberWriteDao memberWriteDao;
private MemberReadDao memberReadDao;
@Reference
private ThirdApiOrderService thirdApiOrderService;
@Override
public UpdateSellerMemoResponse call(CallRequest<UpdateSellerMemoRequest> callRequest) throws Exception {
UpdateSellerMemoResponse UpdateSellerMemoResponse =new UpdateSellerMemoResponse();
Map<String,Object> params = new HashMap<>();
params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
params.put("remark",callRequest.getBizModel().getSellerMemo());
params.put("sellerId",callRequest.getSupplier().getId());
Orders orders = memberWriteDao.getOrdersByMap(params);
ThirdQueryOrderRequest thirdQueryOrderRequest = new ThirdQueryOrderRequest();
//旧订单号处理
if(!callRequest.getBizModel().getPlatOrderNo().startsWith("B")){
callRequest.getBizModel().setPlatOrderNo(memberReadDao.getNewOrderSnByOldOrderSn(callRequest.getBizModel().getPlatOrderNo()));
}
thirdQueryOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
thirdQueryOrderRequest.setSellerId(callRequest.getSupplier().getId());
ThirdUpdateOrderRequest thirdUpdateOrderRequest = new ThirdUpdateOrderRequest();
thirdUpdateOrderRequest.setOrderSn(callRequest.getBizModel().getPlatOrderNo());
thirdUpdateOrderRequest.setSellerId(callRequest.getSupplier().getId());
thirdUpdateOrderRequest.setRemark(callRequest.getBizModel().getSellerMemo());
Orders orders = null;
CommonResponse<ApiOrdersResponse> response = thirdApiOrderService.getOrdersByMap(thirdQueryOrderRequest);
if(response.isSuccess()){
orders = BeanCopyUtils.copyProperties(Orders.class,response.getResult());
}else {
throw new BizException(response.getErrorMsg());
}
if(StringUtil.isNull(orders)){
log.error(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
throw new BizException(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
}
if(memberWriteDao.updateOdersRemark(params) != 1){
CommonResponse<Boolean> updateResponse = thirdApiOrderService.updateOrders(thirdUpdateOrderRequest);
if(!updateResponse.isSuccess()){
log.error(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
throw new BizException(String.format("修改订单备注,修改失败,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo()));
}
......
......@@ -25,12 +25,12 @@
</modules>
<properties>
<!-- spring版本 -->
<spring.version>4.0.0.RELEASE</spring.version>
<spring.version>4.3.16.RELEASE</spring.version>
<!-- mybatis版本 -->
<mybatis.version>3.2.4</mybatis.version>
<!-- log4j日志文件管理包版 -->
<slf4j.version>1.6.6</slf4j.version>
<log4j.version>1.2.13</log4j.version>
<slf4j.version>1.7.25</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<!-- mysql驱动的版 -->
<mysql.version>5.1.35</mysql.version>
<!-- <mysql.version>3.1.14</mysql.version> -->
......@@ -47,6 +47,10 @@
<doubo-parent.version>2.0.0</doubo-parent.version>
<dubbo.version>2.6.3</dubbo.version>
<curator.version>2.12.0</curator.version>
</properties>
<dependencies>
<dependency>
......@@ -406,6 +410,32 @@
<artifactId>protobuf-java</artifactId>
<version>2.6.1</version>
</dependency>
<!-- dubbo begin -->
<!-- https://mvnrepository.com/artifact/com.alibaba/dubbo -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
<exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>${curator.version}</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>${curator.version}</version>
</dependency>
<!-- dubbo begin -->
<!-- taobao sms start -->
<dependency>
<groupId>com.taobao</groupId>
......@@ -426,12 +456,6 @@
<version>${doubo-parent.version}</version>
</dependency>
<!--阿里mq-->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
......