Browse Source

订单开票新增按订单编号查询

Signed-off-by: anderx <312518615@qq.com>
anderx 6 years ago
parent
commit
c96f3b0f3e

+ 2 - 0
src/main/java/com/goafanti/common/dao/TOrderInvoiceMapper.java

@@ -84,4 +84,6 @@ public interface TOrderInvoiceMapper {
 	 BigDecimal conutAmountByOrderNo(String orderNo);
 
 	List<InvoiceBo> selectByOrderNo(String orderNo);
+
+	TOrderInvoiceDetails getInvoiceDetails(String orderNo);
 }

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

@@ -806,6 +806,18 @@
 	left join t_order_new b on a.order_no=b.order_no
     where id = #{id,jdbcType=INTEGER}
   </select>
+  
+  <select id="getInvoiceDetails" parameterType="java.lang.String"  resultType="com.goafanti.order.bo.TOrderInvoiceDetails">
+    	select a.id ,a.order_no as orderNo,a.`type`,a.status,a.reject_reason as rejectReason,a.remarks,a.invoice_type as invoiceType,
+	a.unit_name as unitName,a.tax_number as taxNumber,a.amount,a.banks,a.content,a.unit_address as unitAddress,
+	a.invoice_remarks as invoiceRemarks,a.unit_mobile as unitMobile,a.voucher_url as voucherUrl ,a.post,a.addressee,
+	a.addressee_area as addresseeArea,a.addressee_city as addresseeCity,a.addressee_province as addresseeProvince,
+	a.addressee_mobile as addresseeMobile,a.recipient_address as recipientAddress,a.create_time,a.update_time,a.approval,
+	a.already_amount as alreadyAmount,b.contract_no as contractNo from t_order_invoice a 
+	left join t_order_new b on a.order_no=b.order_no
+    where a.order_no= #{orderNo,jdbcType=VARCHAR}
+    and a.create_time=(select max(create_time) from t_order_invoice where order_no= #{orderNo,jdbcType=VARCHAR}) 
+  </select>
   <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}

+ 1 - 1
src/main/java/com/goafanti/common/task/OrderDunTask.java

@@ -121,7 +121,7 @@ public class OrderDunTask {
 		o.setStartTime(new Date());
 		newOrderDunService.updateDun(o);
 		TOrderNew t2=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
-		orderNewService.addTimingTaskNewDunNoticAndSendEmail(t2, t);;
+		orderNewService.addTimingTaskNewDunNoticAndSendEmail(t2, t);
 	}
 	
 	/**

+ 17 - 0
src/main/java/com/goafanti/order/controller/OrderInvoiceApiController.java

@@ -69,6 +69,23 @@ public class OrderInvoiceApiController extends CertifyApiController {
 		return res;
 	}
 	/**
+	 * 获取最新开票详情
+	 * @param uid
+	 * @param orderType
+	 * @return
+	 */
+	@RequestMapping(value = "/getInvoiceDetails",method = RequestMethod.GET)
+	public Result getInvoiceDetails(String orderNo){
+		Result res = new Result();
+		if(StringUtils.isBlank(orderNo)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单编号"));
+			return res;
+		}
+		
+		res.data(orderInvoiceService.getInvoiceDetails(orderNo));
+		return res;
+	}
+	/**
 	 * 修改发票申请
 	 * @param uid
 	 * @param orderType

+ 2 - 0
src/main/java/com/goafanti/order/service/OrderInvoiceService.java

@@ -41,6 +41,8 @@ public interface OrderInvoiceService {
 
 	int updateapprovalExamine(Integer id, Integer examine, String reason);
 
+	TOrderInvoiceDetails getInvoiceDetails(String orderNo);
+
 	
 	
 	

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

@@ -129,6 +129,12 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 	public TOrderInvoiceDetails selectByIdOrderInvoice(Integer id) {
 		return tOrderInvoiceMapper.selectByInvoiceDitails(id);
 	}
+	
+	@Override
+	public TOrderInvoiceDetails getInvoiceDetails(String orderNo) {
+		return tOrderInvoiceMapper.getInvoiceDetails(orderNo);
+	}
+	
 
 	@SuppressWarnings("unchecked")
 	@Override

+ 0 - 1
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -246,7 +246,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				t.setDeclareUser("****");
 				t.setDeclarePwd("****");
 				t.setCertificateNumber("****");
-				t.setCommodityPrice(new BigDecimal(0));
 			}
 		}
 		return list;