|
|
@@ -1,11 +1,25 @@
|
|
|
package org.jeecg.modules.hlwinvoice.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.utils.CryptTool;
|
|
|
+import org.jeecg.common.utils.HttpsContants;
|
|
|
+import org.jeecg.common.utils.OauthApi;
|
|
|
+import org.jeecg.common.utils.OauthTokenUtils;
|
|
|
import org.jeecg.modules.hlwinvoice.entity.HlwInvoice;
|
|
|
import org.jeecg.modules.hlwinvoice.mapper.HlwInvoiceMapper;
|
|
|
import org.jeecg.modules.hlwinvoice.service.IHlwInvoiceService;
|
|
|
+import org.jeecg.modules.util.RoleDataUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
/**
|
|
|
* @Description: hlw_invoice
|
|
|
* @Author: jeecg-boot
|
|
|
@@ -13,6 +27,47 @@ import org.springframework.stereotype.Service;
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class HlwInvoiceServiceImpl extends ServiceImpl<HlwInvoiceMapper, HlwInvoice> implements IHlwInvoiceService {
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public Page<?> getPageList(Integer pageNo, Integer pageSize, HlwInvoice hlwInvoice, HttpServletRequest request) {
|
|
|
+ Page<Map<String, Object>> page = new Page<Map<String, Object>>();
|
|
|
+ //获取请求路由路径
|
|
|
+ String routeUrl = request.getServletPath();
|
|
|
+ //获取当前登录用户
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ List<String> companyCodeList = RoleDataUtils.findCompanyCodeList(sysUser.getUsername(), routeUrl, sysUser.getOrgCode());
|
|
|
+ if (companyCodeList.size() == 0) {
|
|
|
+ page.setRecords(Collections.emptyList());
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+ //慧盈查询开票申请列表
|
|
|
+ String accessToken = OauthTokenUtils.getDayAccessToken();
|
|
|
+ String requestUrl = OauthApi.INVOICE_LIST;
|
|
|
+ Map<String, Object> parameters = new HashMap<>();
|
|
|
+ parameters.put("pageNo", pageNo);
|
|
|
+ parameters.put("pageSize", pageSize);
|
|
|
+ parameters.put("paymentCode", hlwInvoice.getPaymentCode());
|
|
|
+ parameters.put("subcontractorName", hlwInvoice.getSubcontractorName());
|
|
|
+ parameters.put("invoiceStatus", hlwInvoice.getInvoiceStatus());
|
|
|
+ //数据加密
|
|
|
+ String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
|
|
|
+ JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, accessToken);
|
|
|
+ log.info("开票申请列表===={}", jsonObject);
|
|
|
+ if (jsonObject != null) {
|
|
|
+ if (jsonObject.getBoolean(HttpsContants.SUCCESS_FLAG)) {
|
|
|
+ log.info("开票申请列表===={}", jsonObject);
|
|
|
+ JSONObject jsonObject1 = jsonObject.getJSONObject("result");
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) jsonObject1.get("records");
|
|
|
+ log.info("开票申请列表==={}", list);
|
|
|
+ page.setRecords(list);
|
|
|
+ page.setTotal(jsonObject1.getLong("total"));
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("查询数据异常");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("查询数据异常");
|
|
|
+ }
|
|
|
+ return page;
|
|
|
+ }
|
|
|
}
|