Commit 9b59bc53 by zhaoliang.huang

Merge branch '2021年9月15日-开票历史列表接口+详情接口+发票所含订单接口-黄兆良'

# Conflicts:
#	order-application-service/src/main/java/cn/freemud/controller/OrderController.java
#	order-application-service/src/main/java/cn/freemud/service/Orderservice.java
#	order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
parents 497bd9bd 0f4c3a3f
......@@ -449,6 +449,16 @@ public class OrderController {
}
/**
* 2021年9月15日-开票历史列表接口+详情接口+发票所含订单接口-黄兆良
* 查询开票历史列表
*/
@PostMapping("/queryInvoiceList")
@ApiAnnotation(logMessage = "queryInvoiceList")
public BaseResponse queryInvoiceList(@Validated @LogParams @RequestBody QueryInvoiceReq queryInvoiceReq) {
return orderservice.queryInvoiceList(queryInvoiceReq);
}
/**
* 开订单发票,对接百望
* @param
* @return
......
package cn.freemud.entities.dto;
import cn.freemud.entities.vo.QueryInvoiceItemRep;
import lombok.Data;
@Data
public class QueryInvoiceRepDto {
private String code;
private String message;
private String ver;
private QueryInvoiceItemRep result;
}
package cn.freemud.entities.vo;
import lombok.Data;
import java.util.List;
@Data
public class QueryInvoiceItemRep {
private Integer pageNum;//查第几页
private Integer pageSize;//每页数量
private Integer total;//总记录数
private List<QueryInvoiceRep> itemList;
}
package cn.freemud.entities.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class QueryInvoiceRep {
//C端
private Date createTime;//开票日期
private Integer invoiceType;//发票类型,004:增值税专用发票;007:增值税普通发票;026:增 值税电子发票;025:增值税卷式发票;028:增值税专用电子发票(万象)
private Integer amount;//发票金额,单位是分(聚合:所有订单实付金额)
private Integer orderQuantity;//订单数量
//补充
private String invoiceNo;//开票流水号(聚合:流水号有意义)
private BigDecimal taxRate;//税率(统一写死:6%)
private String taxNo;//销方机构税号(万象)
private String goodsLineNo;//明细行号(按百望要求的规则:01)
private String goodsName;//商品名称(统一写死:餐饮服务)
private String goodsCode;//税收分类编码(统一写死:3070401000000000000)
//百望返回
private String invoiceUrl;//前端重定向,发票URL地址
private String randomCode;//提取码
private String invoiceId;//发票id
private Date endingDate;//开票截至时间
}
/**
* 2021年9月15日-开票历史列表接口+详情接口+发票所含订单接口-黄兆良
* 查询开票历史列表
*/
package cn.freemud.entities.vo;
import lombok.Data;
import java.util.Date;
@Data
public class QueryInvoiceReq {
private String userId;//用户ID
private String partnerId;//商户号
private String selectMonth;//选中月份 YYYY-MM ,如果前端传null,聚合往前2个月~当前时间
private Date startTime;//开始时间(日期类型)
private Date endTime;//结束时间(日期类型)
private Integer pageNum;//查第几页
private Integer pageSize;//每页数量
}
......@@ -286,6 +286,11 @@ public enum ResponseResult {
USER_BUY_PRODUCT_MORE_THAN_THE_NUMBER("80102", "虚拟商品限制购买数量超过最大购买数",""),
USER_BUY_PRODUCT_ALREADY("80103", "只能购买一次哦,您已经购买过了",""),
/**
* 2021年9月15日-开票历史列表接口+详情接口+发票所含订单接口-黄兆良
*/
QUERY_INVOICE_ERR("23124", "查询开票历史记录失败",""),
;
......
......@@ -2,7 +2,6 @@ package cn.freemud.service;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.entities.dto.ConfirmOrderDto;
import cn.freemud.entities.dto.QueryOrdersResponseDto;
import cn.freemud.entities.vo.*;
import cn.freemud.entities.vo.order.CreateOrderInvoiceRequest;
import cn.freemud.entities.vo.order.OrderAppealVo;
......@@ -188,6 +187,12 @@ public interface Orderservice {
BaseResponse queryOrderAppeal(OrderAppealVo orderAppealVo);
/**
* 2021年9月15日-开票历史列表接口+详情接口+发票所含订单接口-黄兆良
* 查询开票历史列表
*/
BaseResponse queryInvoiceList(QueryInvoiceReq queryInvoiceReq);
BaseResponse createAndGetOrderInvoice(CreateOrderInvoiceRequest request);
}
......@@ -81,6 +81,7 @@ import com.freemud.api.assortment.datamanager.meal.MealCacheManager;
import com.freemud.application.sdk.api.constant.ResponseConstant;
import com.freemud.application.sdk.api.constant.ResponseResultEnum;
import com.freemud.application.sdk.api.couponcenter.offline.service.OfflineCouponSdkService;
import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.ordercenter.common.OrderAndShoppingCommonRedisKey;
......@@ -334,6 +335,9 @@ public class OrderServiceImpl implements Orderservice {
@Autowired
OrderInvoiceAdapter orderInvoiceAdapter;
@Autowired
private OrderClient orderClient;
@Override
public BaseResponse checkBeforeCreateOrder(CheckBeforeCreateOrderRequestVo requestVo) {
......@@ -4385,6 +4389,36 @@ public class OrderServiceImpl implements Orderservice {
}
@Override
public BaseResponse queryInvoiceList(QueryInvoiceReq queryInvoiceReq) {
ApiLog.printLog("queryInvoiceListqueryInvoiceReq1",JSON.toJSONString(queryInvoiceReq),null,null);
if(queryInvoiceReq.getSelectMonth() == null){
queryInvoiceReq.setStartTime(DateUtil.addMonths(new Date(),-2));//如果前端传null,聚合往前2个月
queryInvoiceReq.setEndTime(new Date());//如果前端传null,聚合当前时间
}else{
queryInvoiceReq.setStartTime(DateUtil.convert2Date(queryInvoiceReq.getSelectMonth()+"-01",DateUtil.FORMAT_YMD));//yyyy-MM拼接-01
queryInvoiceReq.setEndTime((DateUtil.addMonths(DateUtil.convert2Date(queryInvoiceReq.getSelectMonth()+"-01",DateUtil.FORMAT_YMD),1)));////yyyy-(MM+1)拼接下月-01
}
ApiLog.printLog("queryInvoiceListqueryInvoiceReq2",JSON.toJSONString(queryInvoiceReq),null,null);
QueryInvoiceRepDto queryInvoiceRepDto = orderClient.queryInvoiceList(queryInvoiceReq);
ApiLog.printLog("queryInvoiceListqueryInvoiceRepDto",JSON.toJSONString(queryInvoiceRepDto),null,null);
if(queryInvoiceRepDto == null || !Objects.equals(ResponseCodeConstant.RESPONSE_SUCCESS_STR, queryInvoiceRepDto.getCode())){
return ResponseUtil.error(ResponseResult.QUERY_INVOICE_ERR);
}
if(queryInvoiceRepDto.getResult() != null){
for (QueryInvoiceRep queryInvoiceRep : queryInvoiceRepDto.getResult().getItemList()) {
String scanUrl = queryInvoiceRep.getInvoiceUrl();
if(scanUrl.startsWith("<![CDATA[")){
scanUrl = scanUrl.substring(9,scanUrl.length());
}
if(scanUrl.endsWith("]]>")){
scanUrl = scanUrl.substring(0,scanUrl.length()-3);
}
queryInvoiceRep.setInvoiceUrl(scanUrl);
}
}
return ResponseUtil.success(queryInvoiceRepDto.getResult());
}
@Override
public BaseResponse<InvoiceCreateResponseVo> createAndGetOrderInvoice(CreateOrderInvoiceRequest request){
AssortmentCustomerInfoVo userLoginInfoDto = customerInfoManager.getCustomerInfoByObject(request.getSessionId());
if (userLoginInfoDto == null || StringUtils.isEmpty(userLoginInfoDto.getMemberId())) {
......
package cn.freemud.service.thirdparty;
import cn.freemud.annotations.LogIgnoreFeign;
import cn.freemud.entities.dto.QueryInvoiceRepDto;
import cn.freemud.entities.vo.QueryInvoiceReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient(name = "ORDER-SERVICE")
@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface OrderClient {
/**
* 2021年9月15日-开票历史列表接口+详情接口+发票所含订单接口-黄兆良
* 开票历史列表接口
*/
@PostMapping(value = "/order/v2/invoice/list/forUser")
@LogIgnoreFeign(logMessage="queryInvoiceList")
QueryInvoiceRepDto queryInvoiceList(@RequestBody QueryInvoiceReq queryInvoiceReq);
}
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