Bläddra i källkod

发票参数分页

wangli 4 år sedan
förälder
incheckning
5e813acd82

+ 16 - 1
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayInvoiceParamController.java

@@ -1,8 +1,10 @@
 package com.bz.smart_city.controller.pay;
 
 import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.dto.pay.PayBaseAccountWaterusedamountDto;
+import com.bz.smart_city.dto.pay.PayInvoiceDto;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayInvoiceParam;
 import com.bz.smart_city.service.pay.PayInvoiceParamService;
@@ -31,10 +33,23 @@ public class PayInvoiceParamController {
 
     @GetMapping("/findList")
     @ApiOperation(value="查询发票参数",notes="返回所有发票参数配置项")
-    public AjaxMessage<List<PayInvoiceParam>> findInvoiceList(@ApiParam(value = "查询字段", required = false) @RequestParam(required = false) String queryparam) {
+    public AjaxMessage<List<PayInvoiceParam>> findInvoiceList(
+            @ApiParam(value = "查询字段", required = false) @RequestParam(required = false) String queryparam) {
         List<PayInvoiceParam> payInvoiceParams = payInvoiceParamService.findList(queryparam);
         return new AjaxMessage<>(ResultStatus.OK, payInvoiceParams);
     }
+
+    @GetMapping("/findPage")
+    @ApiOperation("查询发票参数分页")
+    public AjaxMessage<Pagination<PayInvoiceParam>> getPrintInfoListPage(
+            @ApiParam(value = "查询字段", required = false) @RequestParam(required = false) String queryparam,
+            @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") int pageNum,
+            @ApiParam(value = "条数,非必传,默认10条", required = false, defaultValue = "10") @RequestParam(required = false, defaultValue = "10") int pageSize
+
+    ){
+        return new AjaxMessage<>(ResultStatus.OK,payInvoiceParamService.findPage(queryparam,pageNum,pageSize));
+    }
+
     @PutMapping("/updateinvoiceparam")
     @ApiOperation(value = "修改发票参数",notes = "修改发票参数")
     public AjaxMessage edit(@ApiParam(value = "发票参数",required = true) @RequestBody(required = true) @Validated PayInvoiceParam payInvoiceParam)

+ 66 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayInvoiceParamServiceImpl.java

@@ -1,6 +1,7 @@
 package com.bz.smart_city.service.impl.pay;
 
 import com.bz.smart_city.commom.exception.ServiceException;
+import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.dao.pay.PayBaseConfigMapper;
@@ -15,6 +16,7 @@ import com.bz.smart_city.entity.pay.PaySysDict;
 import com.bz.smart_city.service.pay.PayBaseConfigService;
 import com.bz.smart_city.service.pay.PayInvoiceParamService;
 import com.bz.smart_city.service.pay.PaySysDictService;
+import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -128,6 +130,70 @@ public class PayInvoiceParamServiceImpl implements PayInvoiceParamService {
         return payInvoiceParams;
     }
 
+    public Pagination<PayInvoiceParam> findPage(String queryparam, int pageNum, int pageSize){
+        LoginUser loginUser = UserUtil.getCurrentUser();
+
+
+        BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
+        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        //发票销售方设置参数
+        try {
+            PayBaseConfigDto payBaseConfig = new PayBaseConfigDto();
+            payBaseConfig.setCnname("销售方电话");
+            payBaseConfig.setName("PRINT_INVOICE_PHONE");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("身份认证");
+            payBaseConfig.setName("PRINT_INVOICE_IDENTITY ");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("复核人");
+            payBaseConfig.setName("PRINT_INVOICE_CHECKER ");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方纳税人识别号");
+            payBaseConfig.setName("PRINT_INVOICE_ADMINISTERNUM");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方名称");
+            payBaseConfig.setName("PRINT_INVOICE_ADMINISTERNAME");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方地址");
+            payBaseConfig.setName("PRINT_INVOICE_ADDRESS");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方银行账号");
+            payBaseConfig.setName("PRINT_INVOICE_ACCEPTERBANKNUM");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+
+            payBaseConfig.setCnname("销售方公共推送邮箱");
+            payBaseConfig.setName("PRINT_EMAIL");
+            payBaseConfig.setType("0");
+            payBaseConfigService.add(payBaseConfig);
+        } catch (Exception ex) {
+            //异常不处理,可手动添加
+        }
+
+        //发票参数
+        //分页
+        PageHelper.startPage(pageNum,pageSize);
+        List<PayInvoiceParam> payInvoiceParams = payInvoiceParamMapper.findList(queryparam, siteId, customerId);
+        if (payInvoiceParams.size() == 0) {
+            batchInsert();
+            payInvoiceParams = payInvoiceParamMapper.findList(queryparam, siteId, customerId);
+        }
+        return new Pagination<>(payInvoiceParams);
+    }
+
+
     @Override
     public List<PayInvoiceParam> findList(String queryparam, Integer siteId, Integer customerId) {
         //发票参数

+ 5 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayInvoiceParamService.java

@@ -1,5 +1,7 @@
 package com.bz.smart_city.service.pay;
 
+import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.dto.pay.PayInvoiceDto;
 import com.bz.smart_city.entity.pay.PayInvoiceParam;
 import org.apache.ibatis.annotations.Param;
 
@@ -20,5 +22,8 @@ public interface PayInvoiceParamService {
 
     List<PayInvoiceParam> findList(String queryparam);
 
+    Pagination<PayInvoiceParam> findPage(String queryparam,  int pageNum, int pageSize);
+
+
     List<PayInvoiceParam> findList(String queryparam, Integer siteId, Integer customerId);
 }