6 changed files with 174 additions and 0 deletions
@ -0,0 +1,35 @@
|
||||
package com.logpm.patch.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.patch.dto.SyncInventoryDTO; |
||||
import com.logpm.patch.entity.SyncInventoryEntity; |
||||
import com.logpm.patch.service.ISyncServiceTypeService; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
/* |
||||
* logisticsplatform-service |
||||
* @Author Diss |
||||
* @Create 2024/1/15 12:30 |
||||
*/ |
||||
@Slf4j |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/syncServiceType") |
||||
@Api(value = "同步订单信息控制器", tags = "同步订单信息接口") |
||||
public class SyncServiceTypeController { |
||||
private final ISyncServiceTypeService syncServiceTypeService; |
||||
@ResponseBody |
||||
@PostMapping("/change") |
||||
@ApiOperation(value = "分页", notes = "传入运单号,仓库名称,商店名称") |
||||
public R change(@RequestParam String id, @RequestParam String warehouseName, @RequestParam String mallName) { |
||||
syncServiceTypeService.syncServiceType(id, warehouseName, mallName); |
||||
return R.success("修改成功"); |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.logpm.patch.mapper; |
||||
|
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
/* |
||||
* logisticsplatform-service |
||||
* @Author Diss |
||||
* @Create 2024/1/15 14:46 |
||||
*/ |
||||
@Mapper |
||||
public interface SyncServiceTypeMapper { |
||||
void syncServiceTypeByMallName(@Param("stockArticleId")Long stockArticleId, @Param("mallName")String mallName); |
||||
|
||||
void syncServiceTypeByWarehouseName(@Param("stockArticleId")Long stockArticleId, @Param("warehouseName") String warehouseName); |
||||
} |
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.logpm.patch.mapper.SyncServiceTypeMapper"> |
||||
|
||||
|
||||
<update id="syncServiceTypeByMallName"> |
||||
UPDATE logpm_distribution_stock_article ldsa |
||||
LEFT JOIN logpm_basicdata_client lbc ON lbc.client_name = #{mallName} AND lbc.is_deleted = 0 |
||||
LEFT JOIN logpm_basicdata_store_business lbsb ON lbsb.client_id = lbc.id |
||||
SET ldsa.mall_id = COALESCE(lbc.id, ldsa.mall_id), |
||||
ldsa.mall_code = COALESCE(lbc.client_code, ldsa.mall_code), |
||||
ldsa.mall_name = COALESCE(lbc.client_name, ldsa.mall_name), |
||||
ldsa.type_service = COALESCE(lbsb.type_service, ldsa.type_service), |
||||
ldsa.consignee_unit = #{mallName} |
||||
WHERE ldsa.id = #{stockArticleId}; |
||||
</update> |
||||
|
||||
<update id="syncServiceTypeByWarehouseName"> |
||||
|
||||
</update> |
||||
</mapper> |
@ -0,0 +1,14 @@
|
||||
package com.logpm.patch.service; |
||||
/* |
||||
* logisticsplatform-service |
||||
* @Author Diss |
||||
* @Create 2024/1/15 13:57 |
||||
*/ |
||||
|
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
public interface ISyncServiceTypeService { |
||||
|
||||
void syncServiceType( String id, String warehouseName, String shopName) ; |
||||
|
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.logpm.patch.service.impl; |
||||
/* |
||||
* logisticsplatform-service |
||||
* @Author Diss |
||||
* @Create 2024/1/15 14:04 |
||||
*/ |
||||
|
||||
import com.logpm.distribution.entity.DistributionParcelListEntity; |
||||
import com.logpm.distribution.feign.IDistributionParcelListClient; |
||||
import com.logpm.patch.controller.SyncServiceTypeController; |
||||
import com.logpm.patch.mapper.SyncServiceTypeMapper; |
||||
import com.logpm.patch.service.ISyncServiceTypeService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.log4j.Log4j2; |
||||
import org.springblade.core.log.exception.ServiceException; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Log4j2 |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class SyncServiceTypeServiceImpl implements ISyncServiceTypeService { |
||||
private final IDistributionParcelListClient distributionParcelListClient; |
||||
private final SyncServiceTypeMapper syncServiceTypeMapper; |
||||
|
||||
@Override |
||||
public void syncServiceType(String id, String warehouseName, String mallName) { |
||||
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByOrderPackageCodeAndStatus(id); |
||||
if (distributionParcelListEntity==null){ |
||||
throw new ServiceException("订单号不存在"); |
||||
} |
||||
Long stockArticleId = distributionParcelListEntity.getStockArticleId(); |
||||
//判断那个是仓库名称和商店名称谁是null
|
||||
if (Objects.isNull(warehouseName) || warehouseName.isEmpty()){ |
||||
//用订单和商店名称来操作 //修改商场名称 id code 服务类型 收货单位
|
||||
|
||||
syncServiceTypeMapper.syncServiceTypeByMallName(stockArticleId,mallName); |
||||
|
||||
}else if(Objects.isNull(mallName) || mallName.isEmpty()){ |
||||
//用订单号和仓库名称来操作
|
||||
syncServiceTypeMapper.syncServiceTypeByWarehouseName(stockArticleId,warehouseName); |
||||
}else { |
||||
throw new ServiceException("请传入仓库名称或商店名称"); |
||||
} |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue