Bladeren bron

处理开票数值精度问题

anderx 6 jaren geleden
bovenliggende
commit
7d17dae90f

+ 2 - 2
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -1009,7 +1009,7 @@ from t_order_task a left join business_project b on a.commodity_id=b.id
     left join department h on e.order_dep=h.id
     left join (select task_id , sum(already_number) as alreadyNumber from task_progress group by task_id) i on a.id=i.task_id
     where e.delete_sign=0 
-    and x.task_receiver= #{aid,jdbcType=VARCHAR}
+    and (x.task_receiver= #{aid,jdbcType=VARCHAR} or x.task_allocator= #{aid,jdbcType=VARCHAR})
     <if test="orderNo != null">
   	and a.order_no= #{orderNo,jdbcType=VARCHAR}
   	</if>
@@ -1044,7 +1044,7 @@ from t_order_task a left join business_project b on a.commodity_id=b.id
     left join t_order_new e on a.order_no=e.order_no
     left join user f on e.buyer_id=f.id
     where e.delete_sign=0 
-    and x.task_receiver= #{aid,jdbcType=VARCHAR}
+    and (x.task_receiver= #{aid,jdbcType=VARCHAR} or x.task_allocator= #{aid,jdbcType=VARCHAR})
     <if test="orderNo != null">
   	and a.order_no= #{orderNo,jdbcType=VARCHAR}
   	</if>

+ 6 - 1
src/main/java/com/goafanti/order/service/impl/OrderInvoiceServiceImpl.java

@@ -8,6 +8,7 @@ import java.util.Map;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.xmlbeans.BindingConfig;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -50,13 +51,17 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		TOrderNew tn=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
 		
 			Double i=tOrderInvoiceMapper.checkApplyAmount(t.getOrderNo(),t.getId());//新建时直接查所有数据,修改时除掉修改订单
-		int	flag=t.getAmount().add(new BigDecimal(i)).compareTo(tn.getTotalAmount());
+			//处理精度问题
+		BigDecimal q=t.getAmount().add(new BigDecimal(i)).setScale(4, BigDecimal.ROUND_DOWN);;
+		BigDecimal w=tn.getTotalAmount();
+		int	flag=q.compareTo(w);
 		if (flag>0) {
 			return true;
 		}
 		return false;
 	}
 
+	
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<TOrderInvoiceBo> financeOrderInvoiceList(String orderDep, String orderNo, String name, Integer type,Integer pageNo,