LiFei 3 lat temu
rodzic
commit
dcb7408570

+ 10 - 4
happy-boot-module-flexjob/src/main/java/org/jeecg/modules/hlwinvoice/controller/HlwInvoiceController.java

@@ -9,12 +9,10 @@ import org.jeecg.common.aspect.annotation.PermissionData;
 import org.jeecg.modules.hlwinvoice.entity.HlwInvoice;
 import org.jeecg.modules.hlwinvoice.service.IHlwInvoiceService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
 
 /**
  * @Description: hlw_invoice
@@ -51,4 +49,12 @@ public class HlwInvoiceController {
         return result;
     }
 
+
+
+    @PutMapping(value = "/invoicePayment")
+    public Result<?> invoicePayment(@RequestBody HlwInvoice hlwInvoice, HttpServletRequest req) {
+        int i=1;
+        Map<String,Object> map =hlwInvoiceService.invoicePayment(hlwInvoice,req);
+        return Result.ok(map);
+    }
 }

+ 3 - 0
happy-boot-module-flexjob/src/main/java/org/jeecg/modules/hlwinvoice/service/IHlwInvoiceService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.hlwinvoice.entity.HlwInvoice;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
 
 /**
  * @Description: hlw_invoice
@@ -15,4 +16,6 @@ import javax.servlet.http.HttpServletRequest;
 public interface IHlwInvoiceService extends IService<HlwInvoice> {
 
     Page<?> getPageList(Integer pageNo, Integer pageSize, HlwInvoice hlwInvoice, HttpServletRequest req);
+
+    Map<String,Object> invoicePayment(HlwInvoice hlwInvoice,HttpServletRequest request);
 }

+ 24 - 9
happy-boot-module-flexjob/src/main/java/org/jeecg/modules/hlwinvoice/service/impl/HlwInvoiceServiceImpl.java

@@ -32,15 +32,6 @@ public class HlwInvoiceServiceImpl extends ServiceImpl<HlwInvoiceMapper, HlwInvo
     @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;
@@ -70,4 +61,28 @@ public class HlwInvoiceServiceImpl extends ServiceImpl<HlwInvoiceMapper, HlwInvo
         }
         return page;
     }
+
+    @Override
+    public Map<String, Object> invoicePayment(HlwInvoice hlwInvoice, HttpServletRequest request) {
+        //慧盈查询开票申请列表
+        String accessToken = OauthTokenUtils.getDayAccessToken();
+        String requestUrl = OauthApi.INVOICE_CHECK_APPLY;
+        Map<String, Object> parameters = new HashMap<>();
+        parameters.put("idsList", hlwInvoice.getIdsList());
+        //数据加密
+        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");
+                return jsonObject1;
+            } else {
+                throw new JeecgBootException("查询数据异常");
+            }
+        } else {
+            throw new JeecgBootException("查询数据异常");
+        }
+    }
 }