Commit 56d4700b authored by hanfeng's avatar hanfeng

Merge branch 'master-invoice-modular' into dev

parents dbb93607 3d99ed2f
......@@ -43,4 +43,7 @@ public class QueryOrderDTO extends PageParam {
* 开票状态,0未开票,1已开票
*/
private Integer invoiceStatus;
private String orderIds;
}
\ No newline at end of file
......@@ -28,6 +28,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -51,6 +52,10 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
@Autowired
ThirdFeign thirdFeign;
@Autowired
OrderAccountBiz orderAccountBiz;
/**
* 添加发票记录
* @return
......@@ -86,7 +91,11 @@ public class OrderInvoiceBiz extends BaseBiz<OrderInvoiceMapper, OrderInvoice> {
if (baseOrder.getType() == OrderTypeEnum.MEMBER.getCode()) {
orderData.setOrderName(OrderTypeEnum.MEMBER.getDesc());
}
orderData.setPrice(baseOrder.getRealAmount());
BigDecimal cost = orderAccountBiz.getAllOrderCost(baseOrder.getId());
log.info("{}退款费用总计:{}",baseOrder.getNo(), cost);
log.info("{}订单实际金额:{}", baseOrder.getNo(), baseOrder.getRealAmount());
orderData.setPrice(baseOrder.getRealAmount().multiply(cost));
log.info("{}用户实际支付金额: {}", baseOrder.getNo(), orderData.getPrice());
list.add(orderData);
continue;
} else {//已开票
......
......@@ -101,6 +101,14 @@
</foreach>
)
</if>
<if test="orderIds != null and orderIds != ''">
and
(
<foreach collection="orderIds.split(',')" index="sIndex" item="orderId" separator=" or ">
id = #{orderId}
</foreach>
)
</if>
<if test="multiTypes != null">
and
(
......
......@@ -64,7 +64,7 @@ public class InvoiceController extends BaseController<InvoiceBiz, Invoice> {
try {
String invoicing = baseBiz.Invoicing(invoiceVo);
return ObjectRestResponse.succ(invoicing);
} catch (JSONException e) {
} catch (BaseException e) {
log.error("开票错误信息={}", e);
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, e.getMessage());
} catch (Exception e) {
......
......@@ -178,15 +178,16 @@ public class InvoiceDaoImpl implements InvoiceDao {
//调用第三方接口
String result = sdk.sendPostSyncRequest(invoiceUrl, senid, appKey2, appSecret2, token, taxnum2, method, jsonString);
//把字符串json数据转换为map
JSONObject jsonObject = JSON.parseObject(result);
try {
JSONObject jsonObject = JSON.parseObject(result);
Map<String, String> data = (Map<String, String>) jsonObject.get("result");
String invoiceSerialNum = data.get("invoiceSerialNum");
return invoiceSerialNum;
} catch (JSONException e) {
} catch (Exception e) {
log.error("失败原因={}", result);
throw new JSONException(result);
throw new BaseException(result);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment