新购接口优化

This commit is contained in:
sxu 2024-11-05 17:31:32 +08:00
parent 27b36422fe
commit c2eb7afc08
3 changed files with 14 additions and 8 deletions

View File

@ -84,7 +84,7 @@ public class PurchaseCheckInfo extends BaseEntity {
* 采购不含税价格 * 采购不含税价格
*/ */
@ApiModelProperty(value = "采购不含税价格--外层Table字段") @ApiModelProperty(value = "采购不含税价格--外层Table字段")
private BigDecimal purchaseNoTaxPrice; private BigDecimal purchasePrice;
/** /**
* 税率 * 税率

View File

@ -105,7 +105,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
// 采购物资数量 // 采购物资数量
AtomicLong purchaseMaTotalNumber = new AtomicLong(0L); AtomicLong purchaseMaTotalNumber = new AtomicLong(0L);
// 采购物资不含税价格 // 采购物资不含税价格
AtomicReference<BigDecimal> purchaseMaTotalNoTaxPrice = new AtomicReference<>(BigDecimal.ZERO); AtomicReference<BigDecimal> purchaseMaTotalPrice = new AtomicReference<>(BigDecimal.ZERO);
// 执行for循环统计采购物资数量价格 // 执行for循环统计采购物资数量价格
for (PurchaseCheckDetails detail : purchaseCheckDetails) { for (PurchaseCheckDetails detail : purchaseCheckDetails) {
@ -119,17 +119,17 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
// 统计采购数量 // 统计采购数量
purchaseMaTotalNumber.addAndGet(detail.getPurchaseNum()); 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.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( purchaseCheckInfo.setPurchaseTaxPrice(
calculateTaxPrice(purchaseMaTotalNoTaxPrice.get(), new BigDecimal(purchaseCheckInfo.getTaxRate())) calculateTaxPrice(purchaseMaTotalPrice.get(), new BigDecimal(purchaseCheckInfo.getTaxRate()))
); );
} }
} }

View File

@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="purchaseTime" column="purchase_time" /> <result property="purchaseTime" column="purchase_time" />
<result property="arrivalTime" column="arrival_time" /> <result property="arrivalTime" column="arrival_time" />
<result property="purchaser" column="purchaser" /> <result property="purchaser" column="purchaser" />
<result property="taxRate" column="tax_rate" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createUserName" column="purchaser_name" /> <result property="createUserName" column="purchaser_name" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPurchaseCheckInfoBaseSQL"> <sql id="selectPurchaseCheckInfoBaseSQL">
select 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 create_time, update_by, update_time, remark, company_id
from from
purchase_check_info purchase_check_info
@ -36,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPurchaseCheckInfoJoinSQL"> <sql id="selectPurchaseCheckInfoJoinSQL">
select 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, 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 t.task_status, t.task_type, t.code, su.user_name as create_user_name
from from
@ -52,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="purchaseTime != null "> and purchase_time = #{purchaseTime}</if> <if test="purchaseTime != null "> and purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null "> and arrival_time = #{arrivalTime}</if> <if test="arrivalTime != null "> and arrival_time = #{arrivalTime}</if>
<if test="purchaser != null "> and purchaser = #{purchaser}</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> <if test="companyId != null "> and company_id = #{companyId}</if>
</where> </where>
</select> </select>
@ -68,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="purchaseTime != null">purchase_time,</if> <if test="purchaseTime != null">purchase_time,</if>
<if test="arrivalTime != null">arrival_time,</if> <if test="arrivalTime != null">arrival_time,</if>
<if test="purchaser != null">purchaser,</if> <if test="purchaser != null">purchaser,</if>
<if test="taxRate != null">tax_rate,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</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="purchaseTime != null">#{purchaseTime},</if>
<if test="arrivalTime != null">#{arrivalTime},</if> <if test="arrivalTime != null">#{arrivalTime},</if>
<if test="purchaser != null">#{purchaser},</if> <if test="purchaser != null">#{purchaser},</if>
<if test="taxRate != null">#{taxRate},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</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="purchaseTime != null">purchase_time = #{purchaseTime},</if>
<if test="arrivalTime != null">arrival_time = #{arrivalTime},</if> <if test="arrivalTime != null">arrival_time = #{arrivalTime},</if>
<if test="purchaser != null">purchaser = #{purchaser},</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="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</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="purchaseTime != null "> and pci.purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null "> and pci.arrival_time = #{arrivalTime}</if> <if test="arrivalTime != null "> and pci.arrival_time = #{arrivalTime}</if>
<if test="purchaser != null "> and pci.purchaser = #{purchaser}</if> <if test="purchaser != null "> and pci.purchaser = #{purchaser}</if>
<if test="taxRate != null "> and pci.tax_rate = #{taxRate}</if>
</where> </where>
</select> </select>