Commit 46f30bf6 by yukang

结算单管理-增加收款付款剩余金额

parent e7fbac6b
...@@ -42,6 +42,7 @@ public class HGCW008 extends DaoEPBase { ...@@ -42,6 +42,7 @@ public class HGCW008 extends DaoEPBase {
public static final String FIELD_CUMULATIVE_SETTLEMENT_AMOUNT = "cumulativeSettlementAmount"; /* 累计结算金额*/ public static final String FIELD_CUMULATIVE_SETTLEMENT_AMOUNT = "cumulativeSettlementAmount"; /* 累计结算金额*/
public static final String FIELD_CUMULATIVE_SETTLEMENT_TAX = "cumulativeSettlementTax"; /* 累计结算税金*/ public static final String FIELD_CUMULATIVE_SETTLEMENT_TAX = "cumulativeSettlementTax"; /* 累计结算税金*/
public static final String FIELD_CUMULATIVE_PRICE_TAX = "cumulativePriceTax"; /* 累计结算价税合计金额*/ public static final String FIELD_CUMULATIVE_PRICE_TAX = "cumulativePriceTax"; /* 累计结算价税合计金额*/
public static final String FIELD_REMAINING_AMOUNT = "remainingAmount"; /* 累计结算价税合计金额*/
public static final String FIELD_REVIEW_STATUS = "reviewStatus"; /* 审核状态*/ public static final String FIELD_REVIEW_STATUS = "reviewStatus"; /* 审核状态*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/ public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 记录创建名称*/ public static final String FIELD_CREATED_NAME = "createdName"; /* 记录创建名称*/
...@@ -71,6 +72,9 @@ public class HGCW008 extends DaoEPBase { ...@@ -71,6 +72,9 @@ public class HGCW008 extends DaoEPBase {
public static final String COL_CUMULATIVE_SETTLEMENT_AMOUNT = "CUMULATIVE_SETTLEMENT_AMOUNT"; /* 累计结算金额*/ public static final String COL_CUMULATIVE_SETTLEMENT_AMOUNT = "CUMULATIVE_SETTLEMENT_AMOUNT"; /* 累计结算金额*/
public static final String COL_CUMULATIVE_SETTLEMENT_TAX = "CUMULATIVE_SETTLEMENT_TAX"; /* 累计结算税金*/ public static final String COL_CUMULATIVE_SETTLEMENT_TAX = "CUMULATIVE_SETTLEMENT_TAX"; /* 累计结算税金*/
public static final String COL_CUMULATIVE_PRICE_TAX = "CUMULATIVE_PRICE_TAX"; /* 累计结算价税合计金额*/ public static final String COL_CUMULATIVE_PRICE_TAX = "CUMULATIVE_PRICE_TAX"; /* 累计结算价税合计金额*/
public static final String COL_REMAINING_AMOUNT = "REMAINING_AMOUNT"; /* 累计结算价税合计金额*/
public static final String COL_REVIEW_STATUS = "REVIEW_STATUS"; /* 审核状态*/ public static final String COL_REVIEW_STATUS = "REVIEW_STATUS"; /* 审核状态*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 记录创建者*/ public static final String COL_CREATED_BY = "CREATED_BY"; /* 记录创建者*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 记录创建名称*/ public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 记录创建名称*/
...@@ -106,6 +110,7 @@ public class HGCW008 extends DaoEPBase { ...@@ -106,6 +110,7 @@ public class HGCW008 extends DaoEPBase {
private BigDecimal cumulativeSettlementAmount = new BigDecimal("0"); /* 累计结算金额*/ private BigDecimal cumulativeSettlementAmount = new BigDecimal("0"); /* 累计结算金额*/
private BigDecimal cumulativeSettlementTax = new BigDecimal("0"); /* 累计结算税金*/ private BigDecimal cumulativeSettlementTax = new BigDecimal("0"); /* 累计结算税金*/
private BigDecimal cumulativePriceTax = new BigDecimal("0"); /* 累计结算价税合计金额*/ private BigDecimal cumulativePriceTax = new BigDecimal("0"); /* 累计结算价税合计金额*/
private BigDecimal remainingAmount = new BigDecimal("0"); /* 累计结算价税合计金额*/
private Integer reviewStatus; /* 审核状态*/ private Integer reviewStatus; /* 审核状态*/
private String createdBy = " "; /* 记录创建者*/ private String createdBy = " "; /* 记录创建者*/
private String createdName = " "; /* 记录创建名称*/ private String createdName = " "; /* 记录创建名称*/
...@@ -223,6 +228,13 @@ public class HGCW008 extends DaoEPBase { ...@@ -223,6 +228,13 @@ public class HGCW008 extends DaoEPBase {
eiColumn.setDescName("累计结算价税合计金额"); eiColumn.setDescName("累计结算价税合计金额");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMAINING_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("剩余开票/收票金额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REVIEW_STATUS); eiColumn = new EiColumn(FIELD_REVIEW_STATUS);
eiColumn.setDescName("审核状态"); eiColumn.setDescName("审核状态");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -713,6 +725,14 @@ public class HGCW008 extends DaoEPBase { ...@@ -713,6 +725,14 @@ public class HGCW008 extends DaoEPBase {
public void setDepCode(String depCode) { public void setDepCode(String depCode) {
this.depCode = depCode; this.depCode = depCode;
} }
public BigDecimal getRemainingAmount() {
return remainingAmount;
}
public void setRemainingAmount(BigDecimal remainingAmount) {
this.remainingAmount = remainingAmount;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -741,6 +761,7 @@ public class HGCW008 extends DaoEPBase { ...@@ -741,6 +761,7 @@ public class HGCW008 extends DaoEPBase {
setCumulativeSettlementAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_CUMULATIVE_SETTLEMENT_AMOUNT)), cumulativeSettlementAmount)); setCumulativeSettlementAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_CUMULATIVE_SETTLEMENT_AMOUNT)), cumulativeSettlementAmount));
setCumulativeSettlementTax(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_CUMULATIVE_SETTLEMENT_TAX)), cumulativeSettlementTax)); setCumulativeSettlementTax(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_CUMULATIVE_SETTLEMENT_TAX)), cumulativeSettlementTax));
setCumulativePriceTax(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_CUMULATIVE_PRICE_TAX)), cumulativePriceTax)); setCumulativePriceTax(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_CUMULATIVE_PRICE_TAX)), cumulativePriceTax));
setRemainingAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_REMAINING_AMOUNT)), remainingAmount));
setReviewStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REVIEW_STATUS)), reviewStatus)); setReviewStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_REVIEW_STATUS)), reviewStatus));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy)); setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName)); setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
...@@ -778,6 +799,7 @@ public class HGCW008 extends DaoEPBase { ...@@ -778,6 +799,7 @@ public class HGCW008 extends DaoEPBase {
map.put(FIELD_CUMULATIVE_SETTLEMENT_AMOUNT, StringUtils.toString(cumulativeSettlementAmount, eiMetadata.getMeta(FIELD_CUMULATIVE_SETTLEMENT_AMOUNT))); map.put(FIELD_CUMULATIVE_SETTLEMENT_AMOUNT, StringUtils.toString(cumulativeSettlementAmount, eiMetadata.getMeta(FIELD_CUMULATIVE_SETTLEMENT_AMOUNT)));
map.put(FIELD_CUMULATIVE_SETTLEMENT_TAX, StringUtils.toString(cumulativeSettlementTax, eiMetadata.getMeta(FIELD_CUMULATIVE_SETTLEMENT_TAX))); map.put(FIELD_CUMULATIVE_SETTLEMENT_TAX, StringUtils.toString(cumulativeSettlementTax, eiMetadata.getMeta(FIELD_CUMULATIVE_SETTLEMENT_TAX)));
map.put(FIELD_CUMULATIVE_PRICE_TAX, StringUtils.toString(cumulativePriceTax, eiMetadata.getMeta(FIELD_CUMULATIVE_PRICE_TAX))); map.put(FIELD_CUMULATIVE_PRICE_TAX, StringUtils.toString(cumulativePriceTax, eiMetadata.getMeta(FIELD_CUMULATIVE_PRICE_TAX)));
map.put(FIELD_REMAINING_AMOUNT, StringUtils.toString(remainingAmount, eiMetadata.getMeta(FIELD_REMAINING_AMOUNT)));
map.put(FIELD_REVIEW_STATUS, StringUtils.toString(reviewStatus, eiMetadata.getMeta(FIELD_REVIEW_STATUS))); map.put(FIELD_REVIEW_STATUS, StringUtils.toString(reviewStatus, eiMetadata.getMeta(FIELD_REVIEW_STATUS)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY))); map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME))); map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
...@@ -789,4 +811,6 @@ public class HGCW008 extends DaoEPBase { ...@@ -789,4 +811,6 @@ public class HGCW008 extends DaoEPBase {
return map; return map;
} }
} }
...@@ -88,6 +88,7 @@ public class ServiceHGCW008 extends ServiceBase { ...@@ -88,6 +88,7 @@ public class ServiceHGCW008 extends ServiceBase {
HGCW008.setSettlementNumber(settlementNumber); HGCW008.setSettlementNumber(settlementNumber);
HGCW008.setReviewStatus(0); HGCW008.setReviewStatus(0);
HGCW008.setContractDate(DateUtils.formatShort(HGCW008.getContractDate())); HGCW008.setContractDate(DateUtils.formatShort(HGCW008.getContractDate()));
HGCW008.setRemainingAmount(HGCW008.getThisPriceTax());
this.add(HGCW008); this.add(HGCW008);
// 写入其他数据 // 写入其他数据
HGCWTools.HgCw009.save(detail1Rows,settlementNumber,userVO); HGCWTools.HgCw009.save(detail1Rows,settlementNumber,userVO);
......
...@@ -152,6 +152,7 @@ ...@@ -152,6 +152,7 @@
CUMULATIVE_SETTLEMENT_AMOUNT as "cumulativeSettlementAmount", <!-- 累计结算金额 --> CUMULATIVE_SETTLEMENT_AMOUNT as "cumulativeSettlementAmount", <!-- 累计结算金额 -->
CUMULATIVE_SETTLEMENT_TAX as "cumulativeSettlementTax", <!-- 累计结算税金 --> CUMULATIVE_SETTLEMENT_TAX as "cumulativeSettlementTax", <!-- 累计结算税金 -->
CUMULATIVE_PRICE_TAX as "cumulativePriceTax", <!-- 累计结算价税合计金额 --> CUMULATIVE_PRICE_TAX as "cumulativePriceTax", <!-- 累计结算价税合计金额 -->
REMAINING_AMOUNT as "remainingAmount", <!-- 累计结算价税合计金额 -->
REVIEW_STATUS as "reviewStatus", <!-- 审核状态 --> REVIEW_STATUS as "reviewStatus", <!-- 审核状态 -->
CREATED_BY as "createdBy", <!-- 记录创建者 --> CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 --> CREATED_NAME as "createdName", <!-- 记录创建名称 -->
...@@ -286,6 +287,7 @@ ...@@ -286,6 +287,7 @@
CUMULATIVE_SETTLEMENT_AMOUNT, <!-- 累计结算金额 --> CUMULATIVE_SETTLEMENT_AMOUNT, <!-- 累计结算金额 -->
CUMULATIVE_SETTLEMENT_TAX, <!-- 累计结算税金 --> CUMULATIVE_SETTLEMENT_TAX, <!-- 累计结算税金 -->
CUMULATIVE_PRICE_TAX, <!-- 累计结算价税合计金额 --> CUMULATIVE_PRICE_TAX, <!-- 累计结算价税合计金额 -->
REMAINING_AMOUNT, <!-- 累计结算价税合计金额 -->
REVIEW_STATUS, <!-- 审核状态 --> REVIEW_STATUS, <!-- 审核状态 -->
CREATED_BY, <!-- 记录创建者 --> CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 --> CREATED_NAME, <!-- 记录创建名称 -->
...@@ -295,7 +297,7 @@ ...@@ -295,7 +297,7 @@
UPDATED_TIME, <!-- 记录修改时间 --> UPDATED_TIME, <!-- 记录修改时间 -->
DEP_CODE <!-- 部门编码 --> DEP_CODE <!-- 部门编码 -->
) )
VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #projCode#, #projName#, #contractNumber#, #contractName#, #settlementNumber#, #settlementType#, #contractDate#, #taxPoints#, #priceTaxSeparation#, #thisSettlementAmount#, #thisSettlementTax#, #thisPriceTax#, #totalContractPrice#, #cumulativeSettlementAmount#, #cumulativeSettlementTax#, #cumulativePriceTax#, #reviewStatus#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#) VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #projCode#, #projName#, #contractNumber#, #contractName#, #settlementNumber#, #settlementType#, #contractDate#, #taxPoints#, #priceTaxSeparation#, #thisSettlementAmount#, #thisSettlementTax#, #thisPriceTax#, #totalContractPrice#, #cumulativeSettlementAmount#, #cumulativeSettlementTax#, #cumulativePriceTax#,#remainingAmount#, #reviewStatus#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#)
<selectKey resultClass="long" keyProperty="id"> <selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW008 SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW008
</selectKey> </selectKey>
...@@ -351,4 +353,16 @@ ...@@ -351,4 +353,16 @@
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
<update id="updateDeductionAmount">
UPDATE ${hggpSchema}.HGCW008
SET
REMAINING_AMOUNT = #remainingAmount#, <!-- 审核状态 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
WHERE
ID = #id#
</update>
</sqlMap> </sqlMap>
...@@ -13,6 +13,7 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -13,6 +13,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -142,6 +143,28 @@ public class HGCWTools { ...@@ -142,6 +143,28 @@ public class HGCWTools {
}); });
return results.get(0); return results.get(0);
} }
public static void deductionAmount(String settlementNumber, BigDecimal deductionAmount) {
AssertUtils.isNull(settlementNumber, "结算单不能为空!");
if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
throw new PlatException("扣款金额不能小于等于0!");
}
List<HGCW008> results = DaoBase.getInstance().query(HGCW008.QUERY,new HashMap<String,Object>(){
{put("settlementNumber",settlementNumber);}
});
if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的结算单!");
}
DecimalFormat decimalFormat = new DecimalFormat("#.000");
HGCW008 hgcw008 = results.get(0);
BigDecimal remainingAmount = new BigDecimal(decimalFormat.format(hgcw008.getRemainingAmount().subtract(deductionAmount)));
if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) {
throw new PlatException("扣款金额不能大于结算单剩余金额!");
}
hgcw008.setRemainingAmount(remainingAmount);
DaoUtils.update("HGCW008.updateDeductionAmount", hgcw008);
}
} }
public static class HgCw009 { public static class HgCw009 {
......
...@@ -385,7 +385,7 @@ ...@@ -385,7 +385,7 @@
SELECT distinct SELECT distinct
proj_code as "projCode", <!-- 项目编码 --> proj_code as "projCode", <!-- 项目编码 -->
CONCAT(proj_code,"-",proj_name) as "projName" <!-- 项目名称 --> CONCAT(proj_code,"-",proj_name) as "projName" <!-- 项目名称 -->
FROM ${hggpSchema}.HGSC001 WHERE approval_status = 2 FROM ${hggpSchema}.HGSC001 WHERE approval_status = 2 and proj_status = 0
<include refid="condition" /> <include refid="condition" />
</select> </select>
</sqlMap> </sqlMap>
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
<sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW008.xml"/> <sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW008.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW009.xml"/> <sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW009.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW014.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW015.xml"/>
<!--配置--> <!--配置-->
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005A.xml"/> <sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005A.xml"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment