店铺供应商同步
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.product.dto.ShopVendorBillPayDTO;
|
import com.czg.product.dto.ShopVendorBillPayDTO;
|
||||||
import com.czg.product.dto.ShopVendorDTO;
|
import com.czg.product.dto.ShopVendorDTO;
|
||||||
|
import com.czg.product.service.ShopSyncService;
|
||||||
import com.czg.product.service.ShopVendorService;
|
import com.czg.product.service.ShopVendorService;
|
||||||
import com.czg.product.vo.ShopVendorBillPayRecordVO;
|
import com.czg.product.vo.ShopVendorBillPayRecordVO;
|
||||||
import com.czg.product.vo.ShopVendorBillRecordVO;
|
import com.czg.product.vo.ShopVendorBillRecordVO;
|
||||||
@@ -15,6 +17,7 @@ import com.czg.validator.group.DefaultGroup;
|
|||||||
import com.czg.validator.group.InsertGroup;
|
import com.czg.validator.group.InsertGroup;
|
||||||
import com.czg.validator.group.UpdateGroup;
|
import com.czg.validator.group.UpdateGroup;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -33,6 +36,8 @@ import java.util.List;
|
|||||||
@RequestMapping("/admin/product/vendor")
|
@RequestMapping("/admin/product/vendor")
|
||||||
public class ShopVendorController {
|
public class ShopVendorController {
|
||||||
private final ShopVendorService shopVendorService;
|
private final ShopVendorService shopVendorService;
|
||||||
|
@Resource
|
||||||
|
private ShopSyncService shopSyncService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
@@ -77,6 +82,7 @@ public class ShopVendorController {
|
|||||||
//@SaAdminCheckPermission("shopVendor:add")
|
//@SaAdminCheckPermission("shopVendor:add")
|
||||||
public CzgResult<Void> addShopVendor(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopVendorDTO dto) {
|
public CzgResult<Void> addShopVendor(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopVendorDTO dto) {
|
||||||
shopVendorService.addShopVendor(dto);
|
shopVendorService.addShopVendor(dto);
|
||||||
|
asyncToBranchShop(dto.getId());
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,11 +94,13 @@ public class ShopVendorController {
|
|||||||
//@SaAdminCheckPermission("shopVendor:update")
|
//@SaAdminCheckPermission("shopVendor:update")
|
||||||
public CzgResult<Void> updateShopVendor(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopVendorDTO dto) {
|
public CzgResult<Void> updateShopVendor(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopVendorDTO dto) {
|
||||||
shopVendorService.updateShopVendor(dto);
|
shopVendorService.updateShopVendor(dto);
|
||||||
|
asyncToBranchShop(dto.getId());
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
|
*
|
||||||
* @param id 供应商id
|
* @param id 供应商id
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("{id}")
|
@DeleteMapping("{id}")
|
||||||
@@ -102,11 +110,13 @@ public class ShopVendorController {
|
|||||||
//效验数据
|
//效验数据
|
||||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||||
shopVendorService.deleteShopVendor(id);
|
shopVendorService.deleteShopVendor(id);
|
||||||
|
asyncToBranchShop(id);
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 供应商账单统计
|
* 供应商账单统计
|
||||||
|
*
|
||||||
* @return 统计信息
|
* @return 统计信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("summary")
|
@GetMapping("summary")
|
||||||
@@ -117,6 +127,7 @@ public class ShopVendorController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 账单列表
|
* 账单列表
|
||||||
|
*
|
||||||
* @return 账单列表
|
* @return 账单列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/bill")
|
@GetMapping("/bill")
|
||||||
@@ -127,6 +138,7 @@ public class ShopVendorController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 账单记录
|
* 账单记录
|
||||||
|
*
|
||||||
* @return 记录list
|
* @return 记录list
|
||||||
*/
|
*/
|
||||||
@GetMapping("/bill/record")
|
@GetMapping("/bill/record")
|
||||||
@@ -138,6 +150,7 @@ public class ShopVendorController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 账单支付
|
* 账单支付
|
||||||
|
*
|
||||||
* @return 记录list
|
* @return 记录list
|
||||||
*/
|
*/
|
||||||
@PostMapping("/bill/pay")
|
@PostMapping("/bill/pay")
|
||||||
@@ -149,6 +162,7 @@ public class ShopVendorController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 账单支付记录
|
* 账单支付记录
|
||||||
|
*
|
||||||
* @return 记录list
|
* @return 记录list
|
||||||
*/
|
*/
|
||||||
@GetMapping("/bill/pay/record")
|
@GetMapping("/bill/pay/record")
|
||||||
@@ -157,4 +171,12 @@ public class ShopVendorController {
|
|||||||
return CzgResult.success(shopVendorService.payRecord(StpKit.USER.getShopId(), flowId));
|
return CzgResult.success(shopVendorService.payRecord(StpKit.USER.getShopId(), flowId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void asyncToBranchShop(Long id) {
|
||||||
|
long shopId = StpKit.USER.getShopId(0L);
|
||||||
|
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||||
|
ThreadUtil.execAsync(() -> {
|
||||||
|
shopSyncService.syncVendorBySourceShop(shopId, id, sysUserId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
|
|||||||
entity.setIsDel(DeleteEnum.NORMAL.value());
|
entity.setIsDel(DeleteEnum.NORMAL.value());
|
||||||
entity.setShopId(shopId);
|
entity.setShopId(shopId);
|
||||||
super.save(entity);
|
super.save(entity);
|
||||||
|
dto.setId(entity.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user