staging
This commit is contained in:
parent
8221ea32a5
commit
7beaad5d14
|
|
@ -69,7 +69,7 @@ public class ProductLimitController {
|
|||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:product-limit:query')")
|
||||
public CommonResult<ProductLimitRespVO> getProductLimit(@RequestParam("id") Long id) {
|
||||
ProductLimitDO productLimit = productLimitService.getProductLimit(id);
|
||||
ProductLimitRespVO productLimit = productLimitService.getProductLimit(id);
|
||||
return success(BeanUtils.toBean(productLimit, ProductLimitRespVO.class));
|
||||
}
|
||||
|
||||
|
|
@ -114,4 +114,4 @@ public class ProductLimitController {
|
|||
return success(productLimitService.getProductLimitCardListByHaokaProductLimitId(haokaProductLimitId));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class ProductLimitAreaPageReqVO extends PageParam {
|
|||
private Long haokaProductLimitId;
|
||||
|
||||
@Schema(description = "地区")
|
||||
private Integer addressCode;
|
||||
private String addressCode;
|
||||
|
||||
@Schema(description = "地区", example = "张三")
|
||||
private String addressName;
|
||||
|
|
@ -31,4 +31,4 @@ public class ProductLimitAreaPageReqVO extends PageParam {
|
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class ProductLimitAreaRespVO {
|
|||
|
||||
@Schema(description = "地区", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("地区")
|
||||
private Integer addressCode;
|
||||
private String addressCode;
|
||||
|
||||
@Schema(description = "地区", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("地区")
|
||||
|
|
@ -39,4 +39,4 @@ public class ProductLimitAreaRespVO {
|
|||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class ProductLimitAreaSaveReqVO {
|
|||
|
||||
@Schema(description = "地区", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "地区不能为空")
|
||||
private Integer addressCode;
|
||||
private String addressCode;
|
||||
|
||||
@Schema(description = "地区", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "地区不能为空")
|
||||
|
|
@ -27,4 +27,4 @@ public class ProductLimitAreaSaveReqVO {
|
|||
@Schema(description = "是否允许")
|
||||
private Boolean allowed;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,4 +57,6 @@ public class ProductLimitRespVO {
|
|||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
private List<ProductLimitAreaRespVO> productLimitAreaVos;
|
||||
private List<ProductLimitCardRespVO> productLimitCardRespVO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class ProductLimitAreaDO extends BaseDO {
|
|||
/**
|
||||
* 地区
|
||||
*/
|
||||
private Integer addressCode;
|
||||
private String addressCode;
|
||||
/**
|
||||
* 地区
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -70,4 +70,5 @@ public class ProductLimitDO extends BaseDO {
|
|||
*/
|
||||
private Long deptId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,11 @@ import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
|||
import cn.iocoder.yudao.module.haoka.controller.admin.orders.vo.OrdersPageReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.ApiDealStrategyService;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.models.ApiDealResp;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiQueryResp;
|
||||
import cn.iocoder.yudao.module.haoka.service.orders.OrdersService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.Lists;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -48,6 +51,10 @@ public class HaokaUpdateOrderSchedule {
|
|||
pageNo += 1;
|
||||
pageReqVO.setPageNo(pageNo);
|
||||
pageReqVO.setPageSize(pageSize);
|
||||
|
||||
// 需要更新的订单过滤 todo
|
||||
// pageReqVO.setStatus(Lists.asList(1));
|
||||
|
||||
PageResult<OrdersDO> ordersPage = ordersService.getOrdersPage(pageReqVO);
|
||||
total = ordersPage.getTotal();
|
||||
for (OrdersDO ordersDO : ordersPage.getList()) {
|
||||
|
|
@ -61,7 +68,8 @@ public class HaokaUpdateOrderSchedule {
|
|||
|
||||
private void updateOrderInfo(final OrdersDO ordersDO) {
|
||||
log.info("更新前--:{}", JSON.toJSONString(ordersDO));
|
||||
apiDealStrategyService.updateOrderInfo(ordersDO);
|
||||
ApiDealResp<OrderApiQueryResp> updateOrderInfo = apiDealStrategyService.getUpdateOrderInfo(ordersDO);
|
||||
// todo 上游更新
|
||||
ordersService.updateById(ordersDO);
|
||||
log.info("更新后--:{}", JSON.toJSONString(ordersDO));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,56 +122,61 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
public void updateOrderInfo(final OrdersDO ordersDO) {
|
||||
public ApiDealResp<OrderApiQueryResp> getUpdateOrderInfo(final OrdersDO ordersDO) {
|
||||
OrderApiQueryParam param = new OrderApiQueryParam();
|
||||
|
||||
// 幂等 orderId,上游状态,上游备注
|
||||
|
||||
//
|
||||
|
||||
param.setId(ordersDO.getId());
|
||||
param.setSupplierOrderId(ordersDO.getId().toString());
|
||||
param.setProductId(ordersDO.getProductId());
|
||||
param.setPlanMobileProduced(ordersDO.getPlanMobileProduced());
|
||||
|
||||
ApiDealResp<OrderApiQueryResp> resp = this.queryOrder(new SuperiorApiLogSaveReqVO(),param);
|
||||
return this.queryOrder(new SuperiorApiLogSaveReqVO(),param);
|
||||
|
||||
// 上游接口不支持根据订单ID查询
|
||||
if (!resp.getIsSupport()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询接口是否调用成功
|
||||
if (!resp.getSuccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 是否被上游拉黑
|
||||
if (resp.getIsBlack()) {
|
||||
|
||||
}
|
||||
|
||||
OrderApiQueryResp data = resp.getData();
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 上游对订单状态的描述
|
||||
String orderStatusDesc = data.getSupplierOrderStatusDesc();
|
||||
if (StringUtils.isNotEmpty(orderStatusDesc)) {
|
||||
ordersDO.setUpStatus(orderStatusDesc);
|
||||
}
|
||||
// 对应好卡的订单状态:Todo
|
||||
String orderStatusCode = data.getOrderStatusCode();
|
||||
if (StringUtils.isNotEmpty(orderStatusCode)) {
|
||||
// 对应好卡的订单状态:Todo
|
||||
}
|
||||
// 物流信息 头都
|
||||
String trackingNumber = data.getTrackingNumber();
|
||||
if (StringUtils.isNotEmpty(trackingNumber)) {
|
||||
ordersDO.setTrackingNumber(trackingNumber);
|
||||
}
|
||||
String trackingCompany = data.getTrackingCompany();
|
||||
if (StringUtils.isNotEmpty(trackingCompany)) {
|
||||
ordersDO.setTrackingCompany(trackingCompany);
|
||||
}
|
||||
// // 上游接口不支持根据订单ID查询
|
||||
// if (!resp.getIsSupport()) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 查询接口是否调用成功
|
||||
// if (!resp.getSuccess()) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 是否被上游拉黑
|
||||
// if (resp.getIsBlack()) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// OrderApiQueryResp data = resp.getData();
|
||||
// if (data == null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 上游对订单状态的描述
|
||||
// String orderStatusDesc = data.getSupplierOrderStatusDesc();
|
||||
// if (StringUtils.isNotEmpty(orderStatusDesc)) {
|
||||
// ordersDO.setUpStatus(orderStatusDesc);
|
||||
// }
|
||||
// // 对应好卡的订单状态:Todo
|
||||
// String orderStatusCode = data.getOrderStatusCode();
|
||||
// if (StringUtils.isNotEmpty(orderStatusCode)) {
|
||||
// // 对应好卡的订单状态:Todo
|
||||
// }
|
||||
// // 物流信息 头都
|
||||
// String trackingNumber = data.getTrackingNumber();
|
||||
// if (StringUtils.isNotEmpty(trackingNumber)) {
|
||||
// ordersDO.setTrackingNumber(trackingNumber);
|
||||
// }
|
||||
// String trackingCompany = data.getTrackingCompany();
|
||||
// if (StringUtils.isNotEmpty(trackingCompany)) {
|
||||
// ordersDO.setTrackingCompany(trackingCompany);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public interface ApiDealStrategy {
|
|||
ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO,
|
||||
OrderApiQueryParam param) throws Exception;
|
||||
|
||||
default void updateOrderInfo(final OrdersDO ordersDO) {
|
||||
|
||||
default ApiDealResp<OrderApiQueryResp> getUpdateOrderInfo(final OrdersDO ordersDO) {
|
||||
return ApiDealResp.failed("未处理");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public class ApiDealResp<T> {
|
|||
private T data;
|
||||
private Boolean isBlack =false;
|
||||
|
||||
private ApiDealResp(Boolean success, String msg, Boolean isSupport, T data) {
|
||||
public ApiDealResp(Boolean success, String msg, Boolean isSupport, T data) {
|
||||
this.success = success;
|
||||
this.msg = msg;
|
||||
this.isSupport = isSupport;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@ import java.time.LocalDateTime;
|
|||
@AllArgsConstructor
|
||||
public class OrderApiCreateParam {
|
||||
|
||||
private String jsonParam;
|
||||
|
||||
private String outerOrderId;
|
||||
private String orderCreateParam;
|
||||
|
||||
/**
|
||||
* 订单ID AAA
|
||||
|
|
@ -29,7 +27,7 @@ public class OrderApiCreateParam {
|
|||
private Long id;
|
||||
|
||||
/**
|
||||
* 产品ID AAA
|
||||
* 产品ID SKU AAA
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
|
|
@ -39,6 +37,9 @@ public class OrderApiCreateParam {
|
|||
*/
|
||||
private String planMobile;
|
||||
|
||||
/**
|
||||
* 收获地址
|
||||
*/
|
||||
private String addressMobile;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class OrderApiCreateResp extends BaseDO {
|
|||
/**
|
||||
* 接口数据对象
|
||||
*/
|
||||
private Object data;
|
||||
private String orderCreateResponse;
|
||||
|
||||
/**
|
||||
* 上游订单ID
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
|||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setSupplierOrderId(supplierOrderId);
|
||||
orderApiCreateResp.setData(supplierOrderId);
|
||||
orderApiCreateResp.setOrderCreateResponse(supplierOrderId);
|
||||
|
||||
return ApiDealResp.ok(orderApiCreateResp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
}
|
||||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setData(responseInfo);
|
||||
orderApiCreateResp.setOrderCreateResponse(JSON.toJSONString(responseInfo));
|
||||
return ApiDealResp.ok(orderApiCreateResp);
|
||||
} catch (UnirestException e) {
|
||||
return ApiDealResp.failed(e.getMessage());
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
orderParam.setServiceOrderReceiverDistrictCode(addressDistrict.getName());
|
||||
orderParam.setServiceOrderReceiverAddress(param.getAddress());
|
||||
|
||||
if (StringUtils.isNotEmpty(param.getJsonParam())) {
|
||||
JSONObject objectParam = JSON.parseObject(param.getJsonParam());
|
||||
if (StringUtils.isNotEmpty(param.getOrderCreateParam())) {
|
||||
JSONObject objectParam = JSON.parseObject(param.getOrderCreateParam());
|
||||
possessParam.setNumberId(objectParam.getString("numberId"));
|
||||
possessParam.setPoolId(objectParam.getString("poolId"));
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
|
||||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setData(responseInfo);
|
||||
orderApiCreateResp.setOrderCreateResponse(JSON.toJSONString(responseInfo));
|
||||
orderApiCreateResp.setSupplierOrderId(param.getId().toString());
|
||||
return ApiDealResp.ok(orderApiCreateResp);
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
}
|
||||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setData(response);
|
||||
orderApiCreateResp.setOrderCreateResponse(JSON.toJSONString(response));
|
||||
return ApiDealResp.ok(orderApiCreateResp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,11 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper,OrdersDO> implem
|
|||
@Qualifier(ApiFrom.ApiDealStrategyImpl)
|
||||
private ApiDealStrategyService apiDealStrategyService;
|
||||
|
||||
// 19547688 -> 电信 19547688 湖南电信,:号码+号码ID
|
||||
@Override
|
||||
public Long createOrders(OrdersSaveReqVO createReqVO) {
|
||||
// orderCreateParam='{号码ID:1666666}'
|
||||
// createReqVO.getOrderCreateParam();
|
||||
// 插入
|
||||
OrdersDO orders = BeanUtils.toBean(createReqVO, OrdersDO.class);
|
||||
orders.setId(SnowflakeId.generate());
|
||||
|
|
@ -82,7 +85,22 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper,OrdersDO> implem
|
|||
ApiDealResp<OrderApiCreateResp> order = apiDealStrategyService.createOrder(null);
|
||||
OrderApiCreateParam param = new OrderApiCreateParam();
|
||||
BeanUtils.copyProperties(ordersDO,param);
|
||||
apiDealStrategyService.createOrder(param);
|
||||
ApiDealResp<OrderApiCreateResp> orderResponse = apiDealStrategyService.createOrder(param);
|
||||
// 是否是是上游黑名单 如果是 存本地黑名单
|
||||
Boolean isBlack = orderResponse.getIsBlack();
|
||||
// 上游是否支持这个接口
|
||||
// Boolean isSupport = orderResponse.getIsSupport(); 都支持创建订单的 查询不一定
|
||||
// 成功?
|
||||
Boolean success = orderResponse.getSuccess();
|
||||
// 响应信息
|
||||
String msg = orderResponse.getMsg();
|
||||
// 订单创结果
|
||||
OrderApiCreateResp orderData = orderResponse.getData();
|
||||
// 上游订单ID
|
||||
orderData.getSupplierOrderId();
|
||||
|
||||
// ordersDO 记录 create param 和 响应信息
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public interface ProductLimitService {
|
|||
* @param id 编号
|
||||
* @return 产品限制条件
|
||||
*/
|
||||
ProductLimitDO getProductLimit(Long id);
|
||||
ProductLimitRespVO getProductLimit(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品限制条件分页
|
||||
|
|
@ -74,4 +74,4 @@ public interface ProductLimitService {
|
|||
*/
|
||||
List<ProductLimitCardDO> getProductLimitCardListByHaokaProductLimitId(Long haokaProductLimitId);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.*;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.ProductLimitDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.ProductLimitAreaDO;
|
||||
|
|
@ -85,8 +87,26 @@ public class ProductLimitServiceImpl implements ProductLimitService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProductLimitDO getProductLimit(Long id) {
|
||||
return productLimitMapper.selectById(id);
|
||||
public ProductLimitRespVO getProductLimit(Long id) {
|
||||
ProductLimitDO productLimitDO = productLimitMapper.selectById(id);
|
||||
|
||||
if (productLimitDO == null) {
|
||||
return null;
|
||||
}
|
||||
ProductLimitRespVO bean = BeanUtils.toBean(productLimitDO, ProductLimitRespVO.class);
|
||||
List<ProductLimitAreaDO> productLimitAreaDOS = productLimitAreaMapper.selectList(new LambdaQueryWrapperX<ProductLimitAreaDO>()
|
||||
.eqIfPresent(ProductLimitAreaDO::getHaokaProductLimitId, id)
|
||||
);
|
||||
bean.setProductLimitAreaVos(BeanUtils.toBean(productLimitAreaDOS,ProductLimitAreaRespVO.class));
|
||||
|
||||
|
||||
List<ProductLimitCardDO> productLimitCard = productLimitCardMapper.selectList(new LambdaQueryWrapperX<ProductLimitCardDO>()
|
||||
.eqIfPresent(ProductLimitCardDO::getHaokaProductLimitId, id)
|
||||
);
|
||||
bean.setProductLimitCardRespVO(BeanUtils.toBean(productLimitCard,ProductLimitCardRespVO.class));
|
||||
|
||||
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -108,7 +128,7 @@ public class ProductLimitServiceImpl implements ProductLimitService {
|
|||
|
||||
private void updateProductLimitAreaList(Long haokaProductLimitId, List<ProductLimitAreaDO> list) {
|
||||
deleteProductLimitAreaByHaokaProductLimitId(haokaProductLimitId);
|
||||
list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
|
||||
list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
|
||||
createProductLimitAreaList(haokaProductLimitId, list);
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +150,7 @@ public class ProductLimitServiceImpl implements ProductLimitService {
|
|||
|
||||
private void updateProductLimitCardList(Long haokaProductLimitId, List<ProductLimitCardDO> list) {
|
||||
deleteProductLimitCardByHaokaProductLimitId(haokaProductLimitId);
|
||||
list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
|
||||
list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新
|
||||
createProductLimitCardList(haokaProductLimitId, list);
|
||||
}
|
||||
|
||||
|
|
@ -138,4 +158,4 @@ public class ProductLimitServiceImpl implements ProductLimitService {
|
|||
productLimitCardMapper.deleteByHaokaProductLimitId(haokaProductLimitId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
ALTER TABLE `haoka_dev`.`haoka_product`
|
||||
ALTER TABLE `haoka_product`
|
||||
MODIFY COLUMN `belong_area_code` varchar(64) NOT NULL COMMENT '归属地' AFTER `haoka_product_type_id`;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `haoka_product_limit_area`
|
||||
MODIFY COLUMN `address_code` varchar(128) NOT NULL COMMENT '地区' AFTER `haoka_product_limit_id`;
|
||||
Loading…
Reference in New Issue