Ver código fonte

新增开票资料接口

LiFei 3 anos atrás
pai
commit
0205a363c6

+ 20 - 1
happy-cloud-auth/src/main/java/org/jeecg/modules/api/controller/HlwCompanyInvoiceInfoController.java

@@ -56,6 +56,25 @@ public class HlwCompanyInvoiceInfoController {
         return result;
     }
 
-
+    /**
+     * 新增开票资料
+     *
+     * @param json
+     * @return
+     */
+    @AutoLog(value = "新增开票资料")
+    @ApiOperation(value = "新增开票资料", notes = "新增开票资料")
+    @PostMapping(value = "/add")
+    public Result<?> applyInvocie(@RequestBody String json) {
+        log.info("json========{}", json);
+        //数据解密
+        json = CryptTool.decode(json);
+        JSONObject jsonObject = JSONObject.parseObject(json);
+        //获取应用信息
+        OauthApplication oauthApplication = authService.getApplication(SecurityUtils.getClient());
+        jsonObject.put("applicationId", oauthApplication.getApplicationId());
+        Result<?> result = hlwCompanyInvoiceInfoServiceClient.add(jsonObject);
+        return result;
+    }
 
 }

+ 9 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/feign/client/HlwCompanyInvoiceInfoServiceClient.java

@@ -29,4 +29,13 @@ public interface HlwCompanyInvoiceInfoServiceClient {
      */
     @PostMapping(value = "/wisdom/hlwCompanyInvoiceInfo/api/list")
     Result<?> list(JSONObject jsonObject);
+
+    /**
+     * 新增开票资料
+     *
+     * @param jsonObject
+     * @return
+     */
+    @PostMapping(value = "/wisdom/hlwCompanyInvoiceInfo/api/add")
+    Result<?> add(JSONObject jsonObject);
 }

+ 5 - 0
happy-cloud-auth/src/main/java/org/jeecg/modules/feign/client/fallback/HlwCompanyInvoiceInfoServiceClientFallbackImpl.java

@@ -23,4 +23,9 @@ public class HlwCompanyInvoiceInfoServiceClientFallbackImpl implements HlwCompan
     public Result<?> list(JSONObject jsonObject) {
         return Result.error("查询开票资料失败");
     }
+
+    @Override
+    public Result<?> add(JSONObject jsonObject) {
+        return Result.error("新增开票资料失败");
+    }
 }

+ 36 - 3
happy-cloud-wisdom/happy-cloud-wisdom-biz/src/main/java/org/jeecg/modules/api/controller/HlwCompanyInvoiceInformationApiController.java

@@ -12,8 +12,10 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.hlwaccount.entity.HlwCompany;
 import org.jeecg.modules.hlwaccount.entity.HlwCompanyInvoiceInformation;
 import org.jeecg.modules.hlwaccount.service.IHlwCompanyInvoiceInformationService;
+import org.jeecg.modules.hlwaccount.service.IHlwCompanyService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
@@ -37,15 +39,17 @@ import java.util.List;
 public class HlwCompanyInvoiceInformationApiController extends JeecgController<HlwCompanyInvoiceInformation, IHlwCompanyInvoiceInformationService> {
    @Autowired
    private IHlwCompanyInvoiceInformationService hlwCompanyInvoiceInformationService;
+    @Autowired
+    private IHlwCompanyService hlwCompanyService;
 
     /**
-     * 开票列表
+     * 开票资料列表
      *
      * @param jsonObject
      * @return
      */
-    @AutoLog(value = "开票列表")
-    @ApiOperation(value = "开票列表", notes = "开票列表")
+    @AutoLog(value = "开票资料列表")
+    @ApiOperation(value = "开票资料列表", notes = "开票资料列表")
     @PostMapping(value = "/list")
     public Result<?> list(@RequestBody JSONObject jsonObject) {
         Integer applicationId = jsonObject.getInteger("applicationId");
@@ -63,4 +67,33 @@ public class HlwCompanyInvoiceInformationApiController extends JeecgController<H
         return Result.ok(pageList);
     }
 
+    /**
+     * 新增开票资料
+     *
+     * @param jsonObject
+     * @return
+     */
+    @AutoLog(value = "新增开票资料")
+    @ApiOperation(value = "新增开票资料", notes = "新增开票资料")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody JSONObject jsonObject) {
+        Integer applicationId = jsonObject.getInteger("applicationId");
+        //获取请求参数
+        String companyCode = jsonObject.getString("companyCode");
+        QueryWrapper queryWrapper=new QueryWrapper();
+        queryWrapper.eq("company_code",companyCode);
+        HlwCompany hlwCompany=hlwCompanyService.getOne(queryWrapper);
+        QueryWrapper queryWrapper1=new QueryWrapper();
+        queryWrapper1.eq("company_id",hlwCompany.getId());
+        if(hlwCompanyInvoiceInformationService.getOne(queryWrapper1)!=null){
+            return Result.error("企业已存在开票资料");
+        }
+        HlwCompanyInvoiceInformation hlwCompanyInvoiceInformation=jsonObject.toJavaObject(HlwCompanyInvoiceInformation.class);
+        hlwCompanyInvoiceInformation.setUpdateBy(hlwCompanyInvoiceInformation.getCreateBy());
+        hlwCompanyInvoiceInformation.setCompanyId(hlwCompany.getId());
+        hlwCompanyInvoiceInformationService.save(hlwCompanyInvoiceInformation);
+        return Result.ok("新增开票资料成功");
+    }
+
+
 }