提交
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package co.yixiang.yshop.module.express.kdniao.model.dto;
|
||||
|
||||
import lombok.*;
|
||||
import org.omg.PortableInterceptor.INACTIVE;
|
||||
|
||||
/**
|
||||
* 电子面单 DTO
|
||||
|
@ -17,7 +17,6 @@ import java.util.List;
|
||||
* 快递鸟-物流-响应参数
|
||||
* </p>
|
||||
* @author hupeng
|
||||
* @date 2023/7/21
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@ -114,7 +113,7 @@ public class KdniaoApiVO {
|
||||
this.statusName = KdniaoLogisticsStatusEnum.getEnum(this.State).getDesc();
|
||||
this.statusExName = KdniaoLogisticsStatusEnum.getEnum(this.StateEx).getDesc();
|
||||
if (CollectionUtils.isEmpty(this.Traces)) {
|
||||
this.Traces = new ArrayList();
|
||||
this.Traces = new ArrayList<>();
|
||||
}
|
||||
this.Traces.forEach(item -> item.actionName = KdniaoLogisticsStatusEnum.getEnum(item.Action).getDesc());
|
||||
}
|
||||
|
@ -17,10 +17,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
@ -44,7 +41,7 @@ public class KdniaoUtil {
|
||||
*/
|
||||
public static KdniaoApiVO getLogisticInfo(KdniaoApiDTO queryDTO){
|
||||
KdniaoApiVO kdniaoApiVO = new KdniaoUtil().getLogisticBase(queryDTO);
|
||||
if (kdniaoApiVO.getSuccess() == "false"){
|
||||
if (Objects.equals(kdniaoApiVO.getSuccess(), "false")){
|
||||
throw ServiceExceptionUtil.exception(new ErrorCode(999999,kdniaoApiVO.getReason()));
|
||||
}
|
||||
|
||||
@ -85,14 +82,14 @@ public class KdniaoUtil {
|
||||
|
||||
// 组装应用级参数
|
||||
Map<String, String> requestParamMap = new HashMap<>();
|
||||
requestParamMap.put("shipperCode", shipperCode);
|
||||
requestParamMap.put("ShipperCode", shipperCode);
|
||||
requestParamMap.put("LogisticCode", logisticCode);
|
||||
String RequestData = JSON.toJSONString(requestParamMap);
|
||||
// 组装系统级参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("RequestData", this.urlEncoder(RequestData, "UTF-8"));
|
||||
params.put("EBusinessID", EBusinessID);
|
||||
params.put("RequestType", "1002");//免费1002 收费8001
|
||||
params.put("RequestType", "8001");//免费1002 收费8001
|
||||
String dataSign = this.encrypt(RequestData, ApiKey, "UTF-8");
|
||||
params.put("DataSign", this.urlEncoder(dataSign, "UTF-8"));
|
||||
params.put("DataType", "2");
|
||||
|
@ -0,0 +1,37 @@
|
||||
package co.yixiang.yshop.module.express.controller.app.express;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.module.express.controller.admin.express.vo.ExpressRespVO;
|
||||
import co.yixiang.yshop.module.express.convert.express.ExpressConvert;
|
||||
import co.yixiang.yshop.module.express.dal.dataobject.express.ExpressDO;
|
||||
import co.yixiang.yshop.module.express.service.express.ExpressService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "用户 APP - 物流")
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@RequestMapping("/order/express")
|
||||
public class AppExpressController {
|
||||
|
||||
@Resource
|
||||
private ExpressService expressService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得快递公司列表")
|
||||
public CommonResult<List<ExpressRespVO>> getExpressList() {
|
||||
List<ExpressDO> list = expressService.getExpressList();
|
||||
return success(ExpressConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.express.controller.app.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 快递公司 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class ExpressBaseVO {
|
||||
|
||||
@Schema(description = "快递公司简称", required = true)
|
||||
@NotNull(message = "快递公司简称不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "快递公司全称", required = true, example = "yshop")
|
||||
@NotNull(message = "快递公司全称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "排序", required = true)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.yshop.module.express.controller.app.express.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressRespVO extends ExpressBaseVO {
|
||||
|
||||
@Schema(description = "快递公司id", required = true, example = "27172")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "添加时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
Reference in New Issue
Block a user