|
|
@@ -0,0 +1,58 @@
|
|
|
+package org.springblade.mocha.feign;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.core.secure.utils.SecureUtil;
|
|
|
+import org.springblade.core.tenant.annotation.NonDS;
|
|
|
+import org.springblade.mocha.entity.PriceBank;
|
|
|
+import org.springblade.mocha.mapper.PriceBankMapper;
|
|
|
+import org.springblade.mocha.service.IPriceBankService;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+@NonDS
|
|
|
+@ApiIgnore()
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+public class PriceBankClient implements IPriceBankClient{
|
|
|
+
|
|
|
+ private final PriceBankMapper priceBankMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新出口价格库价格
|
|
|
+ * @param itemId 商品id
|
|
|
+ * @param price 价格
|
|
|
+ * @param tenantId 租户id
|
|
|
+ * @param corpId 供应商
|
|
|
+ * @param specs 商品规格
|
|
|
+ * @param billType 价格类型 XS 销售价格 CG 采购价格
|
|
|
+ * @param tradeType 贸易类型 GN 国内 JK 进口 CK 出口
|
|
|
+ * @return
|
|
|
+ * 1.先根据商品id,商品规格,价格类型,租户id,供应商,贸易类型 查未删除的价格库数据
|
|
|
+ * 2.查到后先执行将历史价格依次更新操作 未查到暂不执行更新操作
|
|
|
+ * 3.查到将价格赋值到最新价格字段上 最新价格日期为当前时间 未查到暂不执行更新操作
|
|
|
+ * 4.修改价格库数据
|
|
|
+ */
|
|
|
+ @GetMapping(UPDATE_PRICE)
|
|
|
+ @Override
|
|
|
+ public int updatePrice(Long itemId, BigDecimal price, String tenantId, Long corpId,String specs, String billType, String tradeType) {
|
|
|
+ int flag = 0;
|
|
|
+ LambdaQueryWrapper<PriceBank> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ PriceBank priceBank = priceBankMapper.selectOne(lambdaQueryWrapper);
|
|
|
+ if (priceBank != null){
|
|
|
+ priceBankMapper.updatePrice(priceBank.getId());//更新历史价格
|
|
|
+ PriceBank bank = new PriceBank();
|
|
|
+ bank.setId(priceBank.getId());
|
|
|
+ bank.setPrice(price);
|
|
|
+ bank.setPriceTime(new Date());
|
|
|
+ bank.setUpdateUser(SecureUtil.getUserId());
|
|
|
+ bank.setUpdateTime(new Date());
|
|
|
+ flag = priceBankMapper.updateById(bank);
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+}
|