新购接口优化
This commit is contained in:
parent
27b36422fe
commit
c2eb7afc08
|
|
@ -84,7 +84,7 @@ public class PurchaseCheckInfo extends BaseEntity {
|
|||
* 采购不含税价格
|
||||
*/
|
||||
@ApiModelProperty(value = "采购不含税价格--外层Table字段")
|
||||
private BigDecimal purchaseNoTaxPrice;
|
||||
private BigDecimal purchasePrice;
|
||||
|
||||
/**
|
||||
* 税率
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
// 采购物资数量
|
||||
AtomicLong purchaseMaTotalNumber = new AtomicLong(0L);
|
||||
// 采购物资不含税价格
|
||||
AtomicReference<BigDecimal> purchaseMaTotalNoTaxPrice = new AtomicReference<>(BigDecimal.ZERO);
|
||||
AtomicReference<BigDecimal> purchaseMaTotalPrice = new AtomicReference<>(BigDecimal.ZERO);
|
||||
|
||||
// 执行for循环统计采购物资数量、价格
|
||||
for (PurchaseCheckDetails detail : purchaseCheckDetails) {
|
||||
|
|
@ -119,17 +119,17 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
// 统计采购数量
|
||||
purchaseMaTotalNumber.addAndGet(detail.getPurchaseNum());
|
||||
// 采购物资数量乘以采购不含税价格
|
||||
purchaseMaTotalNoTaxPrice.updateAndGet(v -> v.add(new BigDecimal(detail.getPurchaseNum()).multiply(detail.getPurchasePrice())));
|
||||
purchaseMaTotalPrice.updateAndGet(v -> v.add(new BigDecimal(detail.getPurchaseNum()).multiply(detail.getPurchasePrice())));
|
||||
}
|
||||
|
||||
// 赋值统计出来的采购物资数量、不含税价格
|
||||
purchaseCheckInfo.setPurchaseMaNumber(purchaseMaTotalNumber.get());
|
||||
purchaseCheckInfo.setPurchaseNoTaxPrice(purchaseMaTotalNoTaxPrice.get());
|
||||
purchaseCheckInfo.setPurchasePrice(purchaseMaTotalPrice.get());
|
||||
|
||||
// 通过不含税价格及税率,计算出含税价格并赋值
|
||||
if (purchaseCheckInfo.getTaxRate() != null && purchaseCheckInfo.getPurchaseNoTaxPrice() != null) {
|
||||
if (purchaseCheckInfo.getTaxRate() != null && purchaseCheckInfo.getPurchasePrice() != null) {
|
||||
purchaseCheckInfo.setPurchaseTaxPrice(
|
||||
calculateTaxPrice(purchaseMaTotalNoTaxPrice.get(), new BigDecimal(purchaseCheckInfo.getTaxRate()))
|
||||
calculateTaxPrice(purchaseMaTotalPrice.get(), new BigDecimal(purchaseCheckInfo.getTaxRate()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="purchaseTime" column="purchase_time" />
|
||||
<result property="arrivalTime" column="arrival_time" />
|
||||
<result property="purchaser" column="purchaser" />
|
||||
<result property="taxRate" column="tax_rate" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createUserName" column="purchaser_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
|
|
@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="selectPurchaseCheckInfoBaseSQL">
|
||||
select
|
||||
id, task_id, purchase_time, arrival_time, purchaser, create_by,
|
||||
id, task_id, purchase_time, arrival_time, purchaser, tax_rate, reate_by,
|
||||
create_time, update_by, update_time, remark, company_id
|
||||
from
|
||||
purchase_check_info
|
||||
|
|
@ -36,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="selectPurchaseCheckInfoJoinSQL">
|
||||
select
|
||||
pci.id, pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.create_by,
|
||||
pci.id, pci.task_id, pci.purchase_time, pci.arrival_time, pci.purchaser, pci.tax_rate, pci.create_by,
|
||||
pci.create_time, pci.update_by, pci.update_time, pci.remark, pci.company_id,
|
||||
t.task_status, t.task_type, t.code, su.user_name as create_user_name
|
||||
from
|
||||
|
|
@ -52,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="purchaseTime != null "> and purchase_time = #{purchaseTime}</if>
|
||||
<if test="arrivalTime != null "> and arrival_time = #{arrivalTime}</if>
|
||||
<if test="purchaser != null "> and purchaser = #{purchaser}</if>
|
||||
<if test="taxRate != null "> and tax_rate = #{taxRate}</if>
|
||||
<if test="companyId != null "> and company_id = #{companyId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
@ -68,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="purchaseTime != null">purchase_time,</if>
|
||||
<if test="arrivalTime != null">arrival_time,</if>
|
||||
<if test="purchaser != null">purchaser,</if>
|
||||
<if test="taxRate != null">tax_rate,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
|
|
@ -80,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="purchaseTime != null">#{purchaseTime},</if>
|
||||
<if test="arrivalTime != null">#{arrivalTime},</if>
|
||||
<if test="purchaser != null">#{purchaser},</if>
|
||||
<if test="taxRate != null">#{taxRate},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
|
|
@ -96,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="purchaseTime != null">purchase_time = #{purchaseTime},</if>
|
||||
<if test="arrivalTime != null">arrival_time = #{arrivalTime},</if>
|
||||
<if test="purchaser != null">purchaser = #{purchaser},</if>
|
||||
<if test="taxRate != null">tax_rate = #{taxRate},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
|
|
@ -124,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="purchaseTime != null "> and pci.purchase_time = #{purchaseTime}</if>
|
||||
<if test="arrivalTime != null "> and pci.arrival_time = #{arrivalTime}</if>
|
||||
<if test="purchaser != null "> and pci.purchaser = #{purchaser}</if>
|
||||
<if test="taxRate != null "> and pci.tax_rate = #{taxRate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue