客商委托方数据同步

This commit is contained in:
秦鸿展
2026-06-08 15:05:34 +08:00
parent 734be2b825
commit c59fa363ee
23 changed files with 959 additions and 17 deletions
@@ -191,6 +191,9 @@ public class UserShipperDTO extends UserDTO {
@ApiModelProperty(name = "备注信息")
private String remark;
@ApiModelProperty(name = "数据来源:1-接口同步 2-人工新增")
private Integer dataSource;
@ApiModelProperty("客户nc编码")
private String customerNcCode;
@@ -16,8 +16,11 @@ import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.common.security.annotation.RepeatSubmit;
import com.mhd.common.security.service.TokenService;
import com.mhd.user.application.service.UserShipperMasterDataSyncService;
import com.mhd.user.interfaces.dto.updateDTO.SettlementInfoUpdateDTO;
import com.mhd.user.interfaces.vo.SettlementInfoQueryVo;
import com.mhd.user.interfaces.vo.ShipperMasterDataSyncResultVo;
import com.mhd.user.interfaces.vo.ShipperMasterDataSyncTimeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -37,6 +40,8 @@ public class UserShipperAPI extends BaseController {
@Resource
private UserShipperApplicationService userShipperApplicationService;
@Resource
private UserShipperMasterDataSyncService userShipperMasterDataSyncService;
@Resource
private UserApplicationService userApplicationService;
@Resource
private UserShipperAssember userShipperAssember;
@@ -277,6 +282,31 @@ public class UserShipperAPI extends BaseController {
return getDataTable(list);
}
@Log(title = "托运人管理-同步主数据", description = "从MDM同步客商主数据到委托方列表", businessType = BusinessType.UPDATE)
@ApiOperation("同步主数据-客商(权限码:user:shipper:syncMasterData")
@PostMapping("/syncMasterData")
public AjaxResult syncMasterData() {
try {
ShipperMasterDataSyncResultVo result = userShipperMasterDataSyncService.syncMasterData();
return AjaxResult.success("同步完成", result);
} catch (Exception e) {
log.error("同步主数据失败", e);
return AjaxResult.error("同步主数据失败:" + e.getMessage());
}
}
@ApiOperation("查询主数据上次同步时间")
@GetMapping("/getMasterDataLastSyncTime")
public AjaxResult getMasterDataLastSyncTime() {
try {
ShipperMasterDataSyncTimeVo result = userShipperMasterDataSyncService.getLastSyncTime();
return AjaxResult.success(result);
} catch (Exception e) {
log.error("查询主数据同步时间失败", e);
return AjaxResult.error("查询失败:" + e.getMessage());
}
}
@PostMapping("/getCustomerNcCodeBatch")
public AjaxResult getCustomerNcCodeBatch(@RequestBody List<Long> shipperIdList){
Map<Long, String> resultMap = new HashMap<>();
@@ -0,0 +1,34 @@
package com.mhd.user.interfaces.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Data
public class ShipperMasterDataSyncResultVo {
@ApiModelProperty("新增条数")
private int addCount;
@ApiModelProperty("更新条数")
private int updateCount;
@ApiModelProperty("跳过条数")
private int skipCount;
@ApiModelProperty("失败条数")
private int failCount;
@ApiModelProperty("本次同步时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastSyncTime;
@ApiModelProperty("失败明细")
private List<String> errorMessages = new ArrayList<>();
}
@@ -0,0 +1,20 @@
package com.mhd.user.interfaces.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class ShipperMasterDataSyncTimeVo {
@ApiModelProperty("上次同步时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastSyncTime;
@ApiModelProperty("MDM增量水位时间")
private String lastModifyRecordTime;
}