Browse Source

合同变更BUG修改

anderx 6 years ago
parent
commit
d8844f0ec9

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

@@ -714,10 +714,10 @@ select
 	 and a.process_state in(5,9)  and a.status !=4
 	</if>
 	<if test="complete ==1 and processState == 7">
-	 and a.process_state = 7  and  a.status != 4
+	 and a.process_state = 7  and  a.status != 4 and a.status !=2 
 	</if>
 	<if test="complete ==1 and processState == 8">
-	 and a.process_state = #{processState}  and a.status != 4
+	 and a.process_state = #{processState}  and a.status != 4 and a.status !=2
 	</if>
 	<if test="complete ==2 and processState != 5 and processState != 7 and processState != 8">
 	 and a.process_state &gt; #{processState}  
@@ -726,10 +726,10 @@ select
 	 and (a.process_state &gt; 5 and a.process_state &lt; 9) or (a.process_state =9 and a.status=4) 
 	</if>
 	<if test="complete ==2 and processState == 7">
-	 and ((a.process_state = 7  and  a.status = 4)or a.process_state &gt; 7)
+	 and ((a.process_state = 7  and  (a.status = 4 or a.status = 2)or a.process_state &gt; 7)
 	</if>
 	<if test="complete ==2 and processState == 8">
-	 and a.process_state = 8  and  a.status = 4
+	 and a.process_state = 8  and   (a.status = 4 or a.status = 2)
 	</if>
 	order by a.create_time 
 	<if test="page_sql != null">
@@ -776,7 +776,7 @@ select
 	and d.name like concat('%',#{salesmanName},'%')
 	</if>
 	<if test="complete ==0 and processState != 8">
-	 and a.process_state &gt;= #{processState}
+	 and a.process_state &gt; = #{processState}
 	</if>
 	<if test="complete ==0 and processState == 8">
 	 and a.process_state &gt;= #{processState} and  a.process_state &lt; 9
@@ -788,22 +788,22 @@ select
 	 and a.process_state in(5,9)  and a.status !=4
 	</if>
 	<if test="complete ==1 and processState == 7">
-	 and a.process_state = 7  and  a.status != 4
+	 and a.process_state = 7  and  a.status != 4 and a.status !=2 
 	</if>
 	<if test="complete ==1 and processState == 8">
-	 and a.process_state = #{processState}  and a.status != 4
+	 and a.process_state = #{processState}  and a.status != 4 and a.status !=2
 	</if>
 	<if test="complete ==2 and processState != 5 and processState != 7 and processState != 8">
 	 and a.process_state &gt; #{processState}  
 	</if>
 	<if test="complete ==2 and processState == 5">
-	 and ((a.process_state &gt; 5 and  a.status != 4)or  (a.process_state in (5,9) and  a.status = 4))    
+	 and (a.process_state &gt; 5 and a.process_state &lt; 9) or (a.process_state =9 and a.status=4) 
 	</if>
 	<if test="complete ==2 and processState == 7">
-	 and ((a.process_state = 7  and  a.status = 4)or a.process_state &gt; 7)
+	 and ((a.process_state = 7  and  (a.status = 4 or a.status = 2)or a.process_state &gt; 7)
 	</if>
 	<if test="complete ==2 and processState == 8">
-	 and a.process_state = 8  and  a.status = 4
+	 and a.process_state = 8  and  (a.status = 4 or a.status = 2)
 	</if>
 	</select>
 	<update id="addRefundInvoice" >

+ 1 - 1
src/main/java/com/goafanti/common/mapper/TOrderBillNewMapper.xml

@@ -612,7 +612,7 @@
   	</if>
   	order by b.order_no, b.creater , b.financial_pay_time
  </select>
- <select id="conutAmountByOrderNo">
+ <select id="conutAmountByOrderNo" resultType="java.math.BigDecimal">
  select ifnull(sum(a.transaction_amount),0) amount from t_order_bill_new a
 where  a.order_no= #{orderNo,jdbcType=VARCHAR};
  </select>

+ 1 - 1
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -798,7 +798,7 @@
 	left join t_order_new b on a.order_no=b.order_no
     where id = #{id,jdbcType=INTEGER}
   </select>
-  <select id="conutAmountByOrderNo" >
+  <select id="conutAmountByOrderNo"  resultType="java.math.BigDecimal">
   select ifnull(sum(a.amount),0) amount from t_order_invoice a
 	where a.status=2 and a.order_no= #{orderNo,jdbcType=VARCHAR}
   </select>

+ 2 - 2
src/main/java/com/goafanti/order/controller/OrderChangeApiController.java

@@ -73,7 +73,7 @@ public class OrderChangeApiController extends CertifyApiController {
 	 * 变更修改
 	 */
 	@RequestMapping(value = "/updateOrderChange", method = RequestMethod.POST)
-	public Result orderChangeDetails(NewOrderChangeBo t ,Integer changeType){
+	public Result orderChangeDetails(NewOrderChangeBo t ,Integer changeType,String startRemarks){
 		Result res = new Result();
 		if(null==t.getId()){
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "订单变更id"));
@@ -83,7 +83,7 @@ public class OrderChangeApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "修改变更类型"));
 			return res;
 		}
-		res.setData(orderChangeService.updateOrderChange(t,changeType));
+		res.setData(orderChangeService.updateOrderChange(t,changeType,startRemarks));
 		return res;
 	}
 	/**

+ 1 - 1
src/main/java/com/goafanti/order/service/OrderChangeService.java

@@ -24,7 +24,7 @@ public interface OrderChangeService {
 	Pagination<NewOrderChangeBo> selectOrderChangeList(String userName,Integer  processState,Integer timeType,String startTime,String endTime,
 			String depId,String salesmanName,Integer complete,Integer pageSize, Integer pageNo);
 
-	int updateOrderChange(NewOrderChangeBo t, Integer changeType);
+	int updateOrderChange(NewOrderChangeBo t, Integer changeType,String startRemarks);
 
 	NewOrderChangeBo orderChangeDetailsById(Integer id);
 

+ 7 - 12
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -121,6 +121,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			if(nb.getType() !=null){
 				if (nb.getChangeAmount().compareTo(new BigDecimal("0.2"))<0) {//小于则总裁通过,大于则董事长
 					if(nb.getProcessState()==7) {//项目变更通过
+						nb.setStatus(2);
 						//changgeAdopt(nb); 取消订单变更完成
 						}else if(nb.getProcessState()==1){
 							nb.setProcessState(3);
@@ -129,7 +130,10 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 							}
 				}else {
 					if(nb.getProcessState()==8) {//项目变更通过
+						nb.setStatus(2);
 						//changgeAdopt(nb); 取消订单变更完成
+						}else if(nb.getProcessState()==1){
+							nb.setProcessState(3);
 						}else {
 							nb.setProcessState(nb.getProcessState()+1);
 							}
@@ -236,7 +240,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		return data;
 	}
 	@Override
-	public int updateOrderChange(NewOrderChangeBo t,Integer changeType) {
+	public int updateOrderChange(NewOrderChangeBo t,Integer changeType,String startRemarks) {
 		NewOrderChange  noc=new NewOrderChange();
 		noc.setId(t.getId());
 		if (changeType==0) {
@@ -253,28 +257,19 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			OrderChangeLog ocl=new OrderChangeLog();
 			ocl.setAuditor(TokenManager.getAdminId());
 			ocl.setOrderNo(t.getOrderNo());
-			ocl.setRemarks("重新发起了订单变更");
+			ocl.setRemarks(startRemarks);
 			ocl.setChangeId(noc.getId());
 			ocl.setStatus(0);
 			orderChangeLogMapper.insertSelective(ocl);
-			
-		}else if(changeType==1) {
-			noc.setProjectState(t.getProjectState());
-			noc.setZxsCost(t.getZxsCost());
-			noc.setZxsRemarks(t.getZxsRemarks());
-		}else if (changeType==2) {
+		}else  if (changeType==2) {
 			try {
 				noc.setPaymentTime(DateUtils.StringToDate(t.getPaymentTimes(), AFTConstants.YYYYMMDD));
 				noc.setInvoiceTime(DateUtils.StringToDate(t.getInvoiceTimes(), AFTConstants.YYYYMMDD));
 			} catch (ParseException e) {
 				e.printStackTrace();
 			}
-			noc.setPaymentAmount(t.getPaymentAmount());
-			noc.setInvoiceAmount(t.getInvoiceAmount());
-			noc.setInvoiceType(t.getInvoiceType());
 			noc.setCwCost(t.getCwCost());
 			noc.setRefundableAmount(t.getRefundableAmount());
-			noc.setCwRemarks(t.getCwRemarks());
 		}
 		return newOrderChangeMapper.updateByPrimaryKeySelective(noc);
 	}