feat(SaOrderSync): 全网商品管理-同步失败订单列表
This commit is contained in:
parent
2a6fd29be8
commit
f29a0cead0
|
@ -0,0 +1,69 @@
|
|||
package com.hzs.sale.order.controller.manager;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.hzs.common.core.annotation.AccessPermissions;
|
||||
import com.hzs.common.core.annotation.Log;
|
||||
import com.hzs.common.core.enums.EOperationMethod;
|
||||
import com.hzs.common.core.enums.EOperationModule;
|
||||
import com.hzs.common.core.enums.ESaOrderSyncStatus;
|
||||
import com.hzs.common.core.utils.poi.ExcelUtil;
|
||||
import com.hzs.common.core.web.controller.BaseController;
|
||||
import com.hzs.common.core.web.domain.AjaxResult;
|
||||
import com.hzs.common.core.web.page.TableDataInfo;
|
||||
import com.hzs.common.security.utils.SecurityUtils;
|
||||
import com.hzs.sale.order.dto.SaOrderSyncBodyDetailDTO;
|
||||
import com.hzs.sale.order.param.SaOrderSyncParam;
|
||||
import com.hzs.sale.order.service.ISaOrderSyncService;
|
||||
import com.hzs.sale.order.vo.SaOrderSyncVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单同步记录控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/order-sync")
|
||||
public class SaOrderSyncController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISaOrderSyncService orderSyncService;
|
||||
|
||||
/**
|
||||
* 同步订单列表
|
||||
*/
|
||||
@AccessPermissions("orderSyncList")
|
||||
@Log(module = EOperationModule.ORDER_SYNC, method = EOperationMethod.SELECT)
|
||||
@GetMapping("list")
|
||||
public TableDataInfo list(SaOrderSyncParam param) {
|
||||
startPage();
|
||||
List<SaOrderSyncVO> list = orderSyncService.queryList(param, SecurityUtils.getPkCountry());
|
||||
for (SaOrderSyncVO saOrderSyncVO : list) {
|
||||
saOrderSyncVO.setStatusVal(ESaOrderSyncStatus.getLabelByValue(saOrderSyncVO.getStatus()));
|
||||
saOrderSyncVO.setOrderProductDetail(JSONUtil.toList(saOrderSyncVO.getBodyDetail(), SaOrderSyncBodyDetailDTO.class));
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新同步状态
|
||||
*/
|
||||
@AccessPermissions("orderSyncUpdate")
|
||||
@Log(module = EOperationModule.ORDER_SYNC, method = EOperationMethod.UPDATE)
|
||||
@PostMapping("updateStatus")
|
||||
public AjaxResult updateStatus(@RequestBody SaOrderSyncParam param) {
|
||||
if (param.getPkId() == null) {
|
||||
return AjaxResult.error("主键ID不能为空");
|
||||
}
|
||||
if (param.getStatus() == null) {
|
||||
return AjaxResult.error("状态不能为空");
|
||||
}
|
||||
|
||||
return toAjax(orderSyncService.updateStatus(param.getPkId(), param.getStatus(),
|
||||
SecurityUtils.getUserId(), SecurityUtils.getPkCountry()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.hzs.sale.order.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SaOrderSyncBodyDetailDTO {
|
||||
/**
|
||||
* 仓储编号
|
||||
*/
|
||||
private String wmsCode;
|
||||
|
||||
/**
|
||||
* 变动数量
|
||||
*/
|
||||
private Integer changeNum;
|
||||
}
|
|
@ -2,10 +2,23 @@ package com.hzs.sale.order.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hzs.common.domain.sale.order.SaOrderSync;
|
||||
import com.hzs.sale.order.param.SaOrderSyncParam;
|
||||
import com.hzs.sale.order.vo.SaOrderSyncVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单产品同步记录 Mapper 接口
|
||||
* 订单同步记录Mapper接口
|
||||
*/
|
||||
public interface SaOrderSyncMapper extends BaseMapper<SaOrderSync> {
|
||||
|
||||
/**
|
||||
* 查询订单同步记录列表
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @param pkCountry 国家主键
|
||||
* @return 同步记录列表
|
||||
*/
|
||||
List<SaOrderSyncVO> queryList(@Param("param") SaOrderSyncParam param, @Param("pkCountry") Integer pkCountry);
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.hzs.sale.order.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 同步失败订单列表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SaOrderSyncParam {
|
||||
/**
|
||||
* 同步失败主键
|
||||
*/
|
||||
private Long pkId;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 开始日期(yyyy-MM-dd)
|
||||
*/
|
||||
private String startDate;
|
||||
|
||||
/**
|
||||
* 结束日期(yyyy-MM-dd)
|
||||
*/
|
||||
private String endDate;
|
||||
|
||||
/**
|
||||
* 同步状态 1=失败
|
||||
*/
|
||||
private Integer status;
|
||||
private String statusVal;
|
||||
}
|
|
@ -2,10 +2,33 @@ package com.hzs.sale.order.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.hzs.common.domain.sale.order.SaOrderSync;
|
||||
import com.hzs.sale.order.param.SaOrderSyncParam;
|
||||
import com.hzs.sale.order.vo.SaOrderSyncVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单产品同步记录 服务类
|
||||
* 订单同步记录服务接口
|
||||
*/
|
||||
public interface ISaOrderSyncService extends IService<SaOrderSync> {
|
||||
|
||||
/**
|
||||
* 查询订单同步记录列表
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @param pkCountry 国家主键
|
||||
* @return 同步记录列表
|
||||
*/
|
||||
List<SaOrderSyncVO> queryList(SaOrderSyncParam param, Integer pkCountry);
|
||||
|
||||
/**
|
||||
* 更新同步状态
|
||||
*
|
||||
* @param pkId 主键ID
|
||||
* @param status 状态
|
||||
* @param userId 用户ID
|
||||
* @param pkCountry 国家主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean updateStatus(Long pkId, Integer status, Long userId, Integer pkCountry);
|
||||
}
|
|
@ -1,15 +1,36 @@
|
|||
package com.hzs.sale.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.hzs.common.domain.sale.order.SaOrderSync;
|
||||
import com.hzs.sale.order.mapper.SaOrderSyncMapper;
|
||||
import com.hzs.sale.order.param.SaOrderSyncParam;
|
||||
import com.hzs.sale.order.service.ISaOrderSyncService;
|
||||
import com.hzs.sale.order.vo.SaOrderSyncVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单产品同步记录 服务实现类
|
||||
* 订单同步记录服务实现
|
||||
*/
|
||||
@Service
|
||||
public class SaOrderSyncServiceImpl extends ServiceImpl<SaOrderSyncMapper, SaOrderSync> implements ISaOrderSyncService {
|
||||
|
||||
@Override
|
||||
public List<SaOrderSyncVO> queryList(SaOrderSyncParam param, Integer pkCountry) {
|
||||
return baseMapper.queryList(param, pkCountry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateStatus(
|
||||
Long pkId, Integer status, Long userId, Integer pkCountry
|
||||
) {
|
||||
LambdaUpdateWrapper<SaOrderSync> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(SaOrderSync::getPkId, pkId);
|
||||
updateWrapper.set(SaOrderSync::getStatus, status);
|
||||
|
||||
return this.update(updateWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.hzs.sale.order.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.hzs.common.core.annotation.Excel;
|
||||
import com.hzs.sale.order.dto.SaOrderSyncBodyDetailDTO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单同步记录VO
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SaOrderSyncVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long pkId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@Excel(name = "订单编号")
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 产品明细列表
|
||||
*/
|
||||
private String bodyDetail;
|
||||
private List<SaOrderSyncBodyDetailDTO> orderProductDetail;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
|
||||
/**
|
||||
* 同步状态(1=失败)
|
||||
*/
|
||||
@Excel(name = "同步状态", readConverterExp = "1=失败,0=成功")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 同步状态描述
|
||||
*/
|
||||
private String statusVal;
|
||||
|
||||
}
|
|
@ -2,4 +2,33 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzs.sale.order.mapper.SaOrderSyncMapper">
|
||||
|
||||
<!-- 查询订单同步记录列表 -->
|
||||
<select id="queryList" resultType="com.hzs.sale.order.vo.SaOrderSyncVO">
|
||||
select
|
||||
sos.pk_id,
|
||||
sos.order_code,
|
||||
sos.body_detail,
|
||||
sos.creation_time,
|
||||
sos.status
|
||||
from sa_order_sync sos
|
||||
<where>
|
||||
<if test="param.pkId != null">
|
||||
and sos.pk_id = #{param.pkId}
|
||||
</if>
|
||||
<if test="param.orderCode != null and param.orderCode != ''">
|
||||
and sos.order_code like #{param.orderCode} || '%'
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
and sos.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
and sos.creation_time >= to_date(#{param.startDate}, 'yyyy-mm-dd')
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
and sos.creation_time < to_date(#{param.endDate}, 'yyyy-mm-dd') + 1
|
||||
</if>
|
||||
</where>
|
||||
order by sos.creation_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -400,7 +400,7 @@ public enum EOperationModule {
|
|||
STATISTIC_ANALYSIS("统计分析"),
|
||||
|
||||
MEMBER_RISK_CONTROL("K值风控设置"),
|
||||
|
||||
ORDER_SYNC("同步失败订单"),
|
||||
;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.hzs.common.core.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ESaOrderSyncStatus {
|
||||
FAIL(1, "失败"),
|
||||
Handled(0, "已处理")
|
||||
;
|
||||
|
||||
/**
|
||||
* 实际值
|
||||
*/
|
||||
private final int value;
|
||||
/**
|
||||
* 显示标签
|
||||
*/
|
||||
private final String label;
|
||||
|
||||
/**
|
||||
* 根据枚举值获取枚举
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String getLabelByValue(Integer value) {
|
||||
if (null == value) {
|
||||
return "";
|
||||
}
|
||||
for (ESaOrderSyncStatus enums : ESaOrderSyncStatus.values()) {
|
||||
if (enums.getValue() == value) {
|
||||
return enums.getLabel();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue