Browse Source

合同变更流程BUG修改

anderx 6 years ago
parent
commit
08ce63cff2

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

@@ -610,9 +610,9 @@ from new_order_change a  where 1=1 and a.id= #{id}
 	where status != 4 and order_no= #{orderNo}
   </select>
   <select id="selectOrderChangeList" resultType="com.goafanti.order.bo.NewOderCahngeListBo">
-  	select a.id,a.order_no orderNo, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes,c.nickname,b.order_type orderType, 
-  date_format(b.create_time,'%Y-%m-%d %H:%i:%S')establishTimes, b.order_status orderStatus,b.total_amount totalAmount,
-  b.settlement_amount settlementAmount,(b.total_amount-b.settlement_amount) arrears,d.name salesmanName,e.name depName,a.`type` type,
+  select a.id,a.order_no orderNo, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes,c.nickname,b.order_type orderType, 
+  date_format(b.create_time,'%Y-%m-%d %H:%i:%S')establishTimes, b.order_status orderStatus,b.total_amount totalAmount,a.status ,
+  b.settlement_amount settlementAmount,(b.total_amount-b.settlement_amount) arrears,d.name salesmanName,e.name depName,a.`type`,
   a.process_state processState from new_order_change a left join t_order_new b on a.order_no=b.order_no 
   left join user c on b.buyer_id=c.id left join admin d on b.salesman_id=d.id left join department e on b.order_dep=e.id 
 	<if test="processState==2 or processState==3 "> 

+ 7 - 0
src/main/java/com/goafanti/order/bo/NewOderCahngeListBo.java

@@ -8,6 +8,7 @@ public class NewOderCahngeListBo {
 	private Integer orderType;
 	private String establishTimes;
 	private Integer type;
+	private Integer status;
 	private Integer orderStatus;
 	private String totalAmount;
 	private String settlementAmount;
@@ -99,6 +100,12 @@ public class NewOderCahngeListBo {
 	public void setType(Integer type) {
 		this.type = type;
 	}
+	public Integer getStatus() {
+		return status;
+	}
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
 	
 	
 }

+ 5 - 5
src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.bo.Error;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.dao.TOrderBackMapper;
@@ -101,9 +102,9 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		if(approval != ApprovalNewState.TG.getCode() && approval != ApprovalNewState.FTP.getCode()){//特批未通过 2 0
 			return -1;
 		}
-		checkDeleteSign(orderNo);
+		
+		TOrderNew torder=checkDeleteSign(orderNo);
 		TOrderNew onew = new TOrderNew();
-		TOrderNew torder=tOrderNewMapper.selectByPrimaryKey(orderNo);
 		onew.setOrderNo(orderNo);
 		onew.setDeleteSign(0);//正常
 		onew.setApproval(approval);//特批状态
@@ -131,7 +132,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 	
 	private TOrderNew checkDeleteSign(String orderNo) {
 		TOrderNew t=tOrderNewMapper.selectByPrimaryKey(orderNo);
-		if(t.getDeleteSign()==2)throw new BusinessException(new Error( "订单变更锁定中","订单变更锁定中"));
+		if(t.getDeleteSign()==2) throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_REVOKE, t.getOrderNo(),""));
 		return t;
 	}
 
@@ -210,8 +211,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		//判断有没有要加入的金额有没有超过总金额
 		BigDecimal bill = billNewMapper.getAmountByOid(billNew.getOrderNo());
 		//获得的单个订单金额数据(首付金额和总金额)
-		TOrderNew o = tOrderNewMapper.selectByPrimaryKey(billNew.getOrderNo());
-		
+		TOrderNew o = checkDeleteSign(billNew.getOrderNo());
 		if(null == o){
 			return -2;
 		}

+ 11 - 3
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -242,8 +242,16 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			t.setCreateTime(new Date());
 			tOrderBackMapper.updateByOrderNoAndBackStatus(t.getOrderNo());
 		}
-			
-		
+		// 0 相等
+		// -1 小于 
+		// 1 大于
+		//liquidation_status 清算状态 0-首付待付请,1-尾款待付清,2-已付请,3-部分退款,4-全部退款
+		//settlement_amount 已付  total_amount 总价格   first_amount首付
+		if(t2.getSettlementAmount().compareTo(t2.getTotalAmount()) == 0){//如果已付等于总价
+			t.setLiquidationStatus(LiquidationNewState.ALREADY_PAY.getCode());
+		}else if(t2.getSettlementAmount().compareTo(t2.getFirstAmount()) >= 0){//如果大于等于首付
+			t.setLiquidationStatus(LiquidationNewState.WAIT_PAY_LAST_BALANCE.getCode());
+		}
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
 	}
 
@@ -756,7 +764,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 	private TOrderNew checkDeleteSign(String orderNo) {
 		TOrderNew t=tOrderNewMapper.selectByPrimaryKey(orderNo);
-		if(t.getDeleteSign()==2)throw new BusinessException(new Error( "订单变更锁定中","订单变更锁定中"));
+		if(t.getDeleteSign()==2) throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_REVOKE, t.getOrderNo(),""));
 		return t;
 	}
 	

+ 8 - 1
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.dao.OrganizationContactBookMapper;
 import com.goafanti.common.dao.OrganizationIdentityMapper;
 import com.goafanti.common.dao.TOrderBonusMapper;
@@ -84,6 +85,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	@Override
 	public int updateProjectDistribution(Integer taskId, String taskReceiverId,Integer specially) {
 		TOrderTask t=tOrderTaskMapper.selectByPrimaryKey(taskId);
+		checkDeleteSign(t.getOrderNo());
 		t.setTaskStatus(TaskState.DISTRIBUTION.getCode());
 		t.setTaskAllocator(TokenManager.getAdminId());
 		t.setTaskReceiver(taskReceiverId);
@@ -100,6 +102,11 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		}
 		return 1;
 	}
+	private TOrderNew checkDeleteSign(String orderNo) {
+		TOrderNew t=tOrderNewMapper.selectByPrimaryKey(orderNo);
+		if(t.getDeleteSign()==2) throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_REVOKE, t.getOrderNo(),""));
+		return t;
+	}
 	public void addOrderLog(String orderNo, Integer code) {
 		TOrderLog tl=new TOrderLog();
 		tl.setOrderNo(orderNo);
@@ -165,6 +172,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	@Transactional
 	public int updateOrderTask(TOrderTaskDetailBo t) {
 		TOrderTask task=new TOrderTask();
+		TOrderNew tn=checkDeleteSign(t.getOrderNo());
 		task.setAttachmentUrl(t.getAttachmentUrl());
 		task.setId(Integer.valueOf(t.getId()));
 		task.setTaskStatus(t.getTaskStatus());
@@ -182,7 +190,6 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		task.setSetUpAmount(t.getSetUpAmount());
 		task.setOutsourceName(t.getOutsourceName());
 		if(StringUtils.isNotBlank(t.getOutsourcePrice()))task.setOutsourcePrice(new BigDecimal(t.getOutsourcePrice()));
-		TOrderNew tn=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
 		//根据修改的修改订单法人与联系人
 		if(StringUtils.isNotEmpty(t.getContacts()))tn.setContacts(t.getContacts());
 		if(StringUtils.isNotEmpty(t.getContactMobile()))	tn.setContactMobile(t.getContactMobile());

+ 1 - 1
src/main/resources/props/error.properties

@@ -118,7 +118,7 @@ ORDER_CAN_NOT_MODIFY = \u5F53\u524D\u8BA2\u5355\u4E0D\u80FD\u4FEE\u6539{0}
 
 ORDER_ALREADY_FREEZE = \u8BE5\u8BA2\u5355\u5DF2\u7ECF\u51BB\u7ED3{0}
 
-ORDER_ALREADY_REVOKE = \u8BE5\u8BA2\u5355\u5DF2\u7ECF\u5E9F\u9664{0}
+ORDER_ALREADY_REVOKE = \u8BA2\u5355{0}\u5DF2\u7ECF\u9501\u5b9a
 
 ORDER_NOT_EXIST = \u8BA2\u5355\u4E0D\u5B58\u5728{0}