Commit 692f3051 by yanHeng

[修改] 异常数据状态

parent 9f234961
......@@ -174,10 +174,18 @@ public interface SalesRecordConstant {
//---- 删除
Integer DEL_METHOD = 1;
//未提交状态
Integer TO_NOT_SUBMITTED= 0;
//待审核状态
Integer TO_AUDIT = 0;
Integer TO_AUDIT = 1;
//审核通过状态
Integer APPROVED = 2;
//审核驳回
Integer APPROVE_BACK = 3;
/**
* 删除审批状态 点击删除时,同步当前条数据状态
*/
String APPROVE_STATE_DEL = "approveStateDel";
}
......@@ -133,10 +133,23 @@ public class SalesRecordDaoImpl implements SalesRecordDao, SalesRecordConstant {
public void deleteById(UUID id,String delReason) {
KObject staff = AminoContextHolder.getContext().getStaff();
KObject kobject = (KObject) template.load(ENTITY, id);
//审核状态
Integer approvalState = Integer.valueOf(kobject.getString(SalesRecordConstant.APPROVE_STATE));
kobject.set(BaseConstants.MODIFY_TIME, new Date());
kobject.set(SalesRecordConstant.DEL_REASON, delReason);
kobject.set(BaseConstants.DEL, true);
kobject.set(SalesRecordConstant.METHOD_TYPE, SalesRecordConstant.DEL_METHOD);
kobject.set(SalesRecordConstant.APPROVE_STATE, SalesRecordConstant.TO_AUDIT); //删除赋予状态为未审核
//赋值删除状态 为后续删除审核做判断
kobject.set(SalesRecordConstant.APPROVE_STATE_DEL,approvalState); //赋予状态为数据当时审核状态
if(SalesRecordConstant.TO_NOT_SUBMITTED.equals(approvalState)){
kobject.set(SalesRecordConstant.APPROVE_STATE, SalesRecordConstant.TO_NOT_SUBMITTED );
}else {
kobject.set(SalesRecordConstant.APPROVE_STATE, SalesRecordConstant.TO_AUDIT ); //删除赋予状态为未审核
}
if(SalesRecordConstant.DATA_SOURCE_DI_BANG.equals(kobject.getString(SalesRecordConstant.DATA_SOURCE))){
kobject.set(SalesRecordConstant.APPROVE_STATE_DEL,SalesRecordConstant.APPROVED); //如果是地磅数据 赋值为通过,地磅数据不需要审核
}
template.update(kobject);
}
......@@ -144,14 +157,17 @@ public class SalesRecordDaoImpl implements SalesRecordDao, SalesRecordConstant {
public void approval(KObject approObject) {
KObject kobject = (KObject) template.load(ENTITY, approObject.getUuid(BaseConstants.ID));
kobject.set(BaseConstants.MODIFY_TIME, new Date());
kobject.set(SalesRecordConstant.APPROVE_STATE, Integer.valueOf(approObject.getString(SalesRecordConstant.APPROVE_STATE)));
Integer approvalState = Integer.valueOf(approObject.getString(SalesRecordConstant.APPROVE_STATE));
kobject.set(SalesRecordConstant.APPROVE_STATE, approvalState);
//当前数据方法类型
Integer methodType = Integer.valueOf(approObject.getString(SalesRecordConstant.METHOD_TYPE));
if(SalesRecordConstant.DEL_METHOD.equals(methodType)){
//逻辑删除
kobject.set(BaseConstants.DEL, true);
kobject.set(BaseConstants.DISCARD, true);
if(SalesRecordConstant.APPROVE_BACK.equals(approvalState)){
//逻辑删除
kobject.set(BaseConstants.DEL, false);
}
}
template.update(kobject);
......
......@@ -512,14 +512,6 @@ public class SalesRecordServiceImpl implements SalesRecordService {
UUID contractId = salesRecordInfo.get("contract").getUuid("id");
UUID dinasTypeId = salesRecordInfo.get("dinasType").getUuid("id");
//查询合同余额,如果扣减后小于0则不允许交易
KObject kObject = contractService.queryContract(contractId);
BigDecimal advanceBalance = kObject.getBigDecimal("advanceBalance");
if (advanceBalance == null || advanceBalance.compareTo(new BigDecimal(kObject.getString(SalesRecordConstant.AMOUNT))) == -1) {
return ResponseObj.error(400,"合同名称为:"+salesRecordInfo.get("contract").getUuid("contractName") +"的预付款余额不足");
}
BigDecimal amount = BigDecimal.ZERO;
//当前数据方法类型
......@@ -527,12 +519,21 @@ public class SalesRecordServiceImpl implements SalesRecordService {
// 扣减合同的预付款金额= 异常数据的总价 扣减
if(SalesRecordConstant.ADD_METHOD.equals(methodType)){
//查询合同余额,如果扣减后小于0则不允许交易
KObject kObject = contractService.queryContract(contractId);
BigDecimal advanceBalance = kObject.getBigDecimal("advanceBalance");
if (advanceBalance == null || advanceBalance.compareTo(new BigDecimal(kObject.getString(SalesRecordConstant.AMOUNT))) == -1) {
return ResponseObj.error(400,"合同名称为:"+salesRecordInfo.get("contract").getUuid("contractName") +"的预付款余额不足");
}
//获取当前异常数据的总价
amount = BigDecimal.ZERO.subtract(BigDecimal.valueOf(salesRecordInfo.getDouble(SalesRecordConstant.AMOUNT)));
}else if(SalesRecordConstant.DEL_METHOD.equals(methodType)){
//逻辑删除 反还合同的预付款金额= 异常数据的总价 退还
amount = BigDecimal.ZERO.add(new BigDecimal(salesRecordInfo.getString(SalesRecordConstant.AMOUNT)));
//如果数据状态为新增后的审核通过,进行删除
if(SalesRecordConstant.APPROVED.equals(Integer.valueOf(salesRecordInfo.getString(SalesRecordConstant.APPROVE_STATE_DEL)))){
//逻辑删除 反还合同的预付款金额= 异常数据的总价 退还
amount = BigDecimal.ZERO.add(new BigDecimal(salesRecordInfo.getString(SalesRecordConstant.AMOUNT)));
}
}
......
......@@ -130,6 +130,11 @@
</annotation>
</attribute>
<attribute id='4cbbfe49-27b0-4439-b357-e6087c3c740b' name='approveStateDel' columnName='approve_state_del' title='删除审核状态 1:待审核 2:审核通过 3 驳回' type='int' default='' precision='' isArray='false'>
<annotation id='999a9b8c-80f4-4b9e-8cf6-2b6d841cb03f' attributeId='bd8184ee-3da7-4f72-a2c1-f44ab3094328' name='length' value='undefined'>
</annotation>
</attribute>
<hibernate>/xyst.dinas.sales/src/main/resources/config/SalesRecord.hbm.xml</hibernate>
</dataModel>
</content>
......
......@@ -325,6 +325,12 @@
<description></description>
</field>
<field title='删除审核状态'>
<name>approveStateDel</name>
<type>int</type>
<description></description>
</field>
<field title='删除'>
<name>del</name>
<type>boolean</type>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-sequence">
<specification>1.0</specification>
<id>51def093-e3b9-4121-8cc2-2aa74442d430</id>
<id>ff252764-684e-4a1c-8dc4-e8ae9be96221</id>
<name>com.xyst.dinas.sales.bill.CoefficientOrPrice$sequence</name>
<title>折方系数$sequence</title>
<description>折方系数</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-serial">
<specification>1.0</specification>
<id>0e4cf72c-5f9a-4a8f-ac1c-bdc409f3c67d</id>
<id>dc3641eb-3c2e-4b2a-809e-75918d8de485</id>
<name>com.xyst.dinas.sales.bill.CoefficientOrPrice$serial</name>
<title>折方系数$serial</title>
<description>折方系数</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-biztype">
<specification>1.0</specification>
<id>8bb674be-6520-4e53-8aec-ceb5324e3d08</id>
<id>042bb8a6-0510-4743-99a2-ee67849c0083</id>
<name>com.xyst.dinas.sales.bill.CoefficientOrPrice</name>
<title>折方系数</title>
<description>折方系数</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-sequence">
<specification>1.0</specification>
<id>9e32379c-6520-42b5-b5f1-d0be0612ef1f</id>
<id>301746c5-745d-444e-a137-06e6e89343d9</id>
<name>com.xyst.dinas.sales.bill.NeedPlan$sequence</name>
<title>需用计划$sequence</title>
<description>需用计划</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-serial">
<specification>1.0</specification>
<id>bb4d9dbc-7e5a-4af9-a927-157ac67bae6a</id>
<id>f54aea81-d428-45bb-83eb-ad3fd31aeb70</id>
<name>com.xyst.dinas.sales.bill.NeedPlan$serial</name>
<title>需用计划$serial</title>
<description>需用计划</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-biztype">
<specification>1.0</specification>
<id>4af6ee4f-1efe-496d-9873-bebee54f7b60</id>
<id>004d95cc-bf1f-4058-940f-2d6b36e1044b</id>
<name>com.xyst.dinas.sales.bill.NeedPlan</name>
<title>需用计划</title>
<description>需用计划</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-sequence">
<specification>1.0</specification>
<id>1232ebe3-2332-4a4e-b2fc-0c7ce5208264</id>
<id>a00450b4-1667-495b-93c4-d9bba2eb01d4</id>
<name>com.xyst.dinas.sales.bill.SalesPlan$sequence</name>
<title>销售计划$sequence</title>
<description>销售计划</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-serial">
<specification>1.0</specification>
<id>bb8d5d82-a778-4637-8853-42386e48b295</id>
<id>2986ba9a-f4b4-45df-ac73-facc6f39a161</id>
<name>com.xyst.dinas.sales.bill.SalesPlan$serial</name>
<title>销售计划$serial</title>
<description>销售计划</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-biztype">
<specification>1.0</specification>
<id>ae71c114-c0f3-423a-bd4e-54993231a96c</id>
<id>cffd3a4e-f920-4c4c-94e0-2834863b2764</id>
<name>com.xyst.dinas.sales.bill.SalesPlan</name>
<title>销售计划</title>
<description>销售计划</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-sequence">
<specification>1.0</specification>
<id>bbfd31d3-f010-4304-a7a8-25d00948360e</id>
<id>9ffc7bf0-cdfc-4bc7-bfd7-e348bd9fd045</id>
<name>com.xyst.dinas.sales.bill.SalesPlanTemp$sequence</name>
<title>临时销售计划$sequence</title>
<define>bcp.sequence</define>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-serial">
<specification>1.0</specification>
<id>c2304b4b-ec3a-4bd4-adc3-7221a84d9515</id>
<id>23a13afe-7da5-43f1-a134-96ea5a457508</id>
<name>com.xyst.dinas.sales.bill.SalesPlanTemp$serial</name>
<title>临时销售计划$serial</title>
<define>bcp.serial</define>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-biztype">
<specification>1.0</specification>
<id>274e1c1a-e5e2-4f41-8e46-b6d91eeda43a</id>
<id>581cc94c-1082-480e-8d0c-bda7a5256aa5</id>
<name>com.xyst.dinas.sales.bill.SalesPlanTemp</name>
<title>临时销售计划</title>
<define>bcp.biz.Biztype</define>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-sequence">
<specification>1.0</specification>
<id>b77e29a3-4adb-44b0-abd0-aff3fce97110</id>
<id>246c9383-3efa-40db-839a-fd19e0131d87</id>
<name>com.xyst.dinas.sales.bill.ShipQuantity$sequence</name>
<title>运船量方$sequence</title>
<description>运船量方</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-serial">
<specification>1.0</specification>
<id>a15e721b-043b-49f8-83b5-8591003b195d</id>
<id>a84a60f3-55d2-4995-b295-1e44cf0ad0f5</id>
<name>com.xyst.dinas.sales.bill.ShipQuantity$serial</name>
<title>运船量方$serial</title>
<description>运船量方</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-biztype">
<specification>1.0</specification>
<id>e97b46ec-daf5-4d26-b5b0-e9ef80af4975</id>
<id>7817b4fc-6cdc-4229-9a5e-00f2b26d2b22</id>
<name>com.xyst.dinas.sales.bill.ShipQuantity</name>
<title>运船量方</title>
<description>运船量方</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-sequence">
<specification>1.0</specification>
<id>c3553f15-3381-40b3-a961-1ff6db94d0ef</id>
<id>6a4de93b-77da-4e8a-82e2-cb59e61f5d30</id>
<name>com.xyst.dinas.sales.bill.VehicleAmountParty$sequence</name>
<title>车辆量方$sequence</title>
<description>车辆量方</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-serial">
<specification>1.0</specification>
<id>6e8a3733-bf3b-4010-9424-b014a38323a1</id>
<id>7cd00f77-5428-4cec-8074-3ef756cb3c44</id>
<name>com.xyst.dinas.sales.bill.VehicleAmountParty$serial</name>
<title>车辆量方$serial</title>
<description>车辆量方</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/bcp-biztype">
<specification>1.0</specification>
<id>69fb3580-a72e-4a5d-8758-f28d80ae7289</id>
<id>239717be-513e-4020-9f96-267d132880fa</id>
<name>com.xyst.dinas.sales.bill.VehicleAmountParty</name>
<title>车辆量方</title>
<description>车辆量方</description>
......
......@@ -792,6 +792,25 @@
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>approve_state_del</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>4cbbfe49-27b0-4439-b357-e6087c3c740b</m:id>
<m:name>approveStateDel</m:name>
<m:title>删除审核状态 1:待审核 2:审核通过 3 驳回</m:title>
<m:type>int</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
</m:attributes>
</m:class>
</content>
......
......@@ -440,6 +440,16 @@
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>approveStateDel</m:name>
<m:title>删除审核状态</m:title>
<m:type>int</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>del</m:name>
<m:title>删除</m:title>
<m:type>boolean</m:type>
......
......@@ -135,5 +135,11 @@
<comment>数据方法类型 0:新增 1:删除</comment>
</column>
</property>
<property name="approveStateDel" type="integer" not-null="false">
<column name="approve_state_del">
<comment>删除审核状态 1:待审核 2:审核通过 3 驳回</comment>
</column>
</property>
</class>
</hibernate-mapping>
\ No newline at end of file
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