hulh пре 8 година
родитељ
комит
f1b80f17a9

+ 9 - 0
src/main/java/com/uas/platform/b2c/fa/settlement/dao/BillDao.java

@@ -36,6 +36,15 @@ public interface BillDao extends JpaSpecificationExecutor<Bill>, JpaRepository<B
      */
 	public List<Bill> getBillByUseruuAndDissociative(Long useruu, Integer dissociative);
 
+	/**
+	 * 根据个人UU号和是否个人用户获取指定类型发票
+	 * @param useruu
+	 * @param dissociative
+	 * @param kind
+	 * @return
+	 */
+	public List<Bill> getBillByUseruuAndDissociativeAndKind(Long useruu, Integer dissociative, Integer kind);
+
     /**
      * 根据个人UU号和企业UU号和发票类型(增值税专用 和 增值税普通)获取发票列表
      *

+ 22 - 0
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java

@@ -800,6 +800,28 @@ public class OrderServiceImpl implements OrderService {
                 throw new IllegalOperatorException("对应的店铺的信息不存在");
             }
             or.setStoreid(storeid);
+            if (sysConf.getStoreid().equals(storeid)){ //如果是寄售类型的订单
+                if (or.getInvoiceid() != null && or.getInvoicetype() == Type.Bill_NoDeduct.value()){ //发票为普票
+                    //将普票类型修改为专票
+                    List<Bill> billOne;
+                    if (SystemSession.getUser().getEnterprise() != null){
+                        billOne = billDao.getBillByUseruuAndEnuuAndKind(SystemSession.getUser().getUserUU(),
+                                SystemSession.getUser().getEnterprise().getUu(), Type.Bill_Deduct.value());
+                    }else {
+                        billOne = billDao.getBillByUseruuAndDissociativeAndKind(SystemSession.getUser().getUserUU(),
+                                Type.PERSONAL.value(), Type.Bill_Deduct.value());
+                    }
+                    if (CollectionUtils.isEmpty(billOne)){
+                        throw new IllegalOperatorException("对应专用发票信息不存在,请完善后重试");
+                    }else {
+                        Bill bill = billOne.get(0);
+                        or.setInvoicetype(Type.Bill_Deduct.value());
+                        or.setInvoiceid(bill.getId());
+                        or.setInvoicetitle(bill.getHead());
+                        or.setInvoiceAddress(FastjsonUtils.toJson(bill));
+                    }
+                }
+            }
             or.setStoreName(storeIn.getStoreName());
             or.setSellerenuu(storeIn.getEnUU());
             Enterprise enterprise = enterpriseDao.findByUu(storeIn.getEnUU());

+ 0 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js

@@ -702,7 +702,6 @@ define(['app/app'], function(app) {
 				if (data){
 					$scope.hideNormal = data.data;
 				}
-				// console.log(data);
 			})
 		};