anderx 4 years ago
parent
commit
eb5e479ddc

+ 2 - 1
src/main/java/com/goafanti/common/dao/ThirdPartyCompanyMapper.java

@@ -3,6 +3,7 @@ package com.goafanti.common.dao;
 import com.goafanti.common.model.ThirdPartyCompany;
 import com.goafanti.common.model.ThirdPartyCompanyExample;
 import com.goafanti.organization.bo.OutThirdPartyCompany;
+import com.goafanti.organization.bo.ProjectTypePuls;
 
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
@@ -79,5 +80,5 @@ public interface ThirdPartyCompanyMapper {
 	List<OutThirdPartyCompany> selectByTid(Integer tid);
 
 
-	OutThirdPartyCompany selectByTidPuls(Integer tid);
+	ProjectTypePuls selectByTidPuls(Integer tid);
 }

+ 4 - 3
src/main/java/com/goafanti/common/mapper/ThirdPartyCompanyMapper.xml

@@ -527,9 +527,10 @@
 	from third_party_company a left join t_order_task b on a.tid=b.id  left join official_fee_price op on b.patent_type =op.patent_type  and a.patent_name_type =op.`type` 
  where tid= #{tid}
   </select>
-  <select id="selectByTidPuls" resultType="com.goafanti.organization.bo.OutThirdPartyCompany">
-select a.id,a.patent_type patentType,b.patent_name_type projectType,c.amount ,c.proportion85 from t_order_task a left join t_order_outsource b on a.id=b.tid
-left join official_fee_price c on a.patent_type =c.patent_type and b.patent_name_type =c.`type` 
+  <select id="selectByTidPuls" resultType="com.goafanti.organization.bo.ProjectTypePuls">
+ select a.id,a.official_cost officialCost,a.cost_reduction costReduction ,a.commodity_quantity quantity ,a.patent_type patentType,b.patent_name_type projectType,
+ c.amount officialAmount,c.proportion85 from t_order_task a left join t_order_outsource b on a.id=b.tid
+left join official_fee_price c on a.patent_type =c.patent_type and b.patent_name_type =c.`type`  
 where a.id= #{tid}
   </select>
   

+ 12 - 10
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -124,6 +124,7 @@ import com.goafanti.order.service.OrderService;
 import com.goafanti.organization.bo.OrganizationListOut;
 import com.goafanti.organization.bo.OutPaymentNode;
 import com.goafanti.organization.bo.OutThirdPartyCompany;
+import com.goafanti.organization.bo.ProjectTypePuls;
 
 @Service
 @EnableAsync
@@ -1322,16 +1323,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		BigDecimal tCount=new BigDecimal(0);
 		for (OutThirdPartyCompany op : list) {
 			tCount=tCount.add(new BigDecimal(op.getTotalAmount()));
-			if(op.getOfficialCost()==1 && startType==1 && actualOfficial==0) {
-				BigDecimal sum= new BigDecimal(0);
-				if (op.getCostReduction()==0) {
-					sum= new BigDecimal(op.getOfficialUnitPrice()).multiply(new BigDecimal(op.getQuantity()));
-					tCount=tCount.add(sum);
-				}else if (op.getCostReduction()==1) {
-					sum= new BigDecimal(op.getReductionAmount()).multiply(new BigDecimal(op.getQuantity()));
-					tCount=tCount.add(sum);
-				}
-			}
 		}
 		tTaskMidMapper.updateCostAmount(tid,tCount);
 		//计算订单成本
@@ -1340,6 +1331,17 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		for (TTaskMid tm : tlist) {
 			if (tm!=null&&tm.getCostAmount()!=null)oCount=oCount.add(tm.getCostAmount()==null?new BigDecimal(0):tm.getCostAmount());
 		}
+		//订单成本计算
+		ProjectTypePuls op= thirdPartyCompanyMapper.selectByTidPuls( tid);
+		if (op.getOfficialCost()==1) {
+			BigDecimal mCount=new BigDecimal(0);
+			if (op.getCostReduction()==0) {
+				mCount=op.getAmount().multiply(new BigDecimal(op.getQuantity()));
+			}else {
+				mCount=op.getProportion85().multiply(new BigDecimal(op.getQuantity()));
+			}
+			oCount=oCount.add(mCount);
+		}
 		tOrderMidMapper.updateCostAmount(tid,oCount);
 	}
 

+ 21 - 22
src/main/java/com/goafanti/organization/bo/OutThirdPartyCompany.java

@@ -14,7 +14,7 @@ public class OutThirdPartyCompany  {
 	
 	private Integer  patentType;
 
-	
+	private BigDecimal proportion85;
 	
 	
 	private Integer id;
@@ -85,7 +85,8 @@ public class OutThirdPartyCompany  {
 	
 	
 	
-	private BigDecimal officialAmount;
+	
+	
 
 	
 	private Integer startType;
@@ -327,26 +328,6 @@ public class OutThirdPartyCompany  {
 	public void setPatentNameType(Integer patentNameType) {
 		this.patentNameType = patentNameType;
 	}
-
-	
-	 
-	
-	
-	
-	public BigDecimal getOfficialAmount() {
-		return officialAmount;
-	}
-
-	
-	 
-	
-	
-	
-	public void setOfficialAmount(BigDecimal officialAmount) {
-		this.officialAmount = officialAmount;
-	}
-
-	
 	
 	public Integer getCostReduction() {
 		return costReduction;
@@ -432,6 +413,24 @@ public class OutThirdPartyCompany  {
 	public void setPatentType(Integer patentType) {
 		this.patentType = patentType;
 	}
+
+
+
+
+
+
+	public BigDecimal getProportion85() {
+		return proportion85;
+	}
+
+
+
+
+
+
+	public void setProportion85(BigDecimal proportion85) {
+		this.proportion85 = proportion85;
+	}
 	
 	
 

+ 25 - 1
src/main/java/com/goafanti/organization/bo/projectTypePuls.java

@@ -2,13 +2,19 @@ package com.goafanti.organization.bo;
 
 import java.math.BigDecimal;
 
-public class projectTypePuls {
+public class ProjectTypePuls {
 	
 	private Integer id;
 	private Integer patentType;
 	private Integer projectType;
 	private BigDecimal amount;
 	private BigDecimal proportion85;
+	private Integer costReduction;
+	private Integer quantity;
+	private Integer officialCost;
+	
+
+	
 	public Integer getId() {
 		return id;
 	}
@@ -39,6 +45,24 @@ public class projectTypePuls {
 	public void setProportion85(BigDecimal proportion85) {
 		this.proportion85 = proportion85;
 	}
+	public Integer getCostReduction() {
+		return costReduction;
+	}
+	public void setCostReduction(Integer costReduction) {
+		this.costReduction = costReduction;
+	}
+	public Integer getOfficialCost() {
+		return officialCost;
+	}
+	public void setOfficialCost(Integer officialCost) {
+		this.officialCost = officialCost;
+	}
+	public Integer getQuantity() {
+		return quantity;
+	}
+	public void setQuantity(Integer quantity) {
+		this.quantity = quantity;
+	}
 	
 	
 

+ 10 - 3
src/main/java/com/goafanti/organization/service/impl/ThirdPartyCompanyServiceImpl.java

@@ -65,6 +65,7 @@ import com.goafanti.organization.bo.NoticeInformationBo;
 import com.goafanti.organization.bo.OutPaymentLog;
 import com.goafanti.organization.bo.OutPaymentNode;
 import com.goafanti.organization.bo.OutThirdPartyCompany;
+import com.goafanti.organization.bo.ProjectTypePuls;
 import com.goafanti.organization.bo.outFinancialPayment;
 import com.goafanti.organization.bo.outNodeList;
 import com.goafanti.organization.bo.outPaymentList;
@@ -274,6 +275,12 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 		AdminListBo a =adminMapper.getDeptNameByAid(TokenManager.getAdminId());
 		p.setAid(a.getId());
 		p.setAname(a.getName());
+		if (p.getChooseType()==2) {
+			TOrderTask t=new TOrderTask();
+			t.setId(p.getTid());
+			t.setCheckStatus(3);
+			tOrderTaskMapper.updateByPrimaryKeySelective(t);
+		}
 		tOrderPaymentMapper.insertSelectiveGetId(p);
 		NoticeInformationBo ni=financialPaymentMapper.selectBypidGetNotice(p.getId());
 		addNoticAndSendEmail(ni,a,NoticeStatus.PAYMENT_NODE.getCode());
@@ -876,11 +883,11 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 				PaymentNode pn=paymentNodeMapper.selectByPrimaryKey(p.getNodeId());
 				count=pn.getUnitPrice().multiply(new BigDecimal(p.getQuantity()));
 			}else if (p.getChooseType()==2) {
-				OutThirdPartyCompany ot=thirdPartyCompanyMapper.selectByTidPuls(p.getTid());
+				ProjectTypePuls ot=thirdPartyCompanyMapper.selectByTidPuls(p.getTid());
 				if (ot.getCostReduction()==0) {
-					count=new BigDecimal(ot.getOfficialUnitPrice()).multiply(new BigDecimal(ot.getQuantity()));
+					count=ot.getAmount().multiply(new BigDecimal(ot.getQuantity()));
 				}else {
-					count=new BigDecimal(ot.getReductionAmount()).multiply(new BigDecimal(ot.getQuantity()));
+					count=ot.getProportion85().multiply(new BigDecimal(ot.getQuantity()));
 				}
 			}
 			p.setApplicationAmount(count);