瀏覽代碼

发票接口 更新

jz.kai 5 年之前
父節點
當前提交
c788842bfa

+ 51 - 4
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/controller/CompanyInvoiceController.java

@@ -11,6 +11,8 @@ import com.jpsoft.picc.modules.common.dto.MessageResult;
 import com.jpsoft.picc.modules.base.entity.CompanyInvoice;
 import com.jpsoft.picc.modules.base.entity.CompanyInvoice;
 import com.jpsoft.picc.modules.base.service.CompanyInvoiceService;
 import com.jpsoft.picc.modules.base.service.CompanyInvoiceService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.jasig.cas.client.authentication.AttributePrincipal;
 import org.jasig.cas.client.authentication.AttributePrincipal;
@@ -24,7 +26,7 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
 
 
 @RestController
 @RestController
-@RequestMapping("/companyInvoice")
+@RequestMapping("/auth/companyInvoice")
 @Api(description = "companyInvoice")
 @Api(description = "companyInvoice")
 public class CompanyInvoiceController {
 public class CompanyInvoiceController {
     private Logger logger = LoggerFactory.getLogger(getClass());
     private Logger logger = LoggerFactory.getLogger(getClass());
@@ -64,27 +66,72 @@ public class CompanyInvoiceController {
 
 
     @PostMapping(value="save")
     @PostMapping(value="save")
     @ApiOperation(value = "保存发票信息")
     @ApiOperation(value = "保存发票信息")
-    public MessageResult<String> save(CompanyInvoice companyInvoice,HttpServletRequest request){
-        MessageResult<String> messageResult = new MessageResult<>();
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type",value = "发票类型", paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "title",value = "发票抬头", paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "identifier",value = "税号", paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "bank",value = "开户银行", paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "companyAccount",value = "企业账号", paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "bankAccount",value = "联行号", paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "address",value = "企业地址", paramType = "form",dataType = "String"),
+            @ApiImplicitParam(name = "telephone",value = "联系电话", paramType = "form",dataType = "String")
+    })
+    public MessageResult<CompanyInvoice> save(
+                                      @RequestParam(value="type",defaultValue="") String type,
+                                      @RequestParam(value="title",defaultValue="null") String title,
+                                      @RequestParam(value="identifier",defaultValue="null") String identifier,
+                                      @RequestParam(value="bank",defaultValue="null") String bank,
+                                      @RequestParam(value="companyAccount",defaultValue="null") String companyAccount,
+                                      @RequestParam(value="bankAccount",defaultValue="null") String bankAccount,
+                                      @RequestParam(value="address",defaultValue="null") String address,
+                                      @RequestParam(value="telephone",defaultValue="null") String telephone,
+                                      HttpServletRequest request){
+        MessageResult<CompanyInvoice> messageResult = new MessageResult<>();
 
 
         try {
         try {
             //todo
             //todo
             AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
             AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
             CompanyUser companyUser = companyUserService.findByUserName(principal.getName());
             CompanyUser companyUser = companyUserService.findByUserName(principal.getName());
 
 
-            if(StringUtils.isNotEmpty(companyInvoice.getId())){
+            CompanyInvoice companyInvoice = companyInvoiceService.getByCompanyId(companyUser.getCompanyId());
+
+            if(companyInvoice != null){
                 companyInvoice.setUpdateBy(principal.getName());
                 companyInvoice.setUpdateBy(principal.getName());
                 companyInvoice.setUpdateTime(new Date());
                 companyInvoice.setUpdateTime(new Date());
+
+                companyInvoice.setType(type);
+                companyInvoice.setTitle(title);
+                companyInvoice.setIdentifier(identifier);
+                companyInvoice.setBank(bank);
+                companyInvoice.setCompanyAccount(companyAccount);
+                companyInvoice.setBankAccount(bankAccount);
+                companyInvoice.setAddress(address);
+                companyInvoice.setTelephone(telephone);
+
                 companyInvoiceService.update(companyInvoice);
                 companyInvoiceService.update(companyInvoice);
             }else{
             }else{
+                companyInvoice = new CompanyInvoice();
+
+                companyInvoice.setId(UUID.randomUUID().toString());
                 companyInvoice.setCompanyId(companyUser.getCompanyId());
                 companyInvoice.setCompanyId(companyUser.getCompanyId());
                 companyInvoice.setDelFlag(false);
                 companyInvoice.setDelFlag(false);
                 companyInvoice.setCreateBy(principal.getName());
                 companyInvoice.setCreateBy(principal.getName());
                 companyInvoice.setCreateTime(new Date());
                 companyInvoice.setCreateTime(new Date());
+
+                companyInvoice.setType(type);
+                companyInvoice.setTitle(title);
+                companyInvoice.setIdentifier(identifier);
+                companyInvoice.setBank(bank);
+                companyInvoice.setCompanyAccount(companyAccount);
+                companyInvoice.setBankAccount(bankAccount);
+                companyInvoice.setAddress(address);
+                companyInvoice.setTelephone(telephone);
+
                 companyInvoiceService.insert(companyInvoice);
                 companyInvoiceService.insert(companyInvoice);
             }
             }
 
 
             messageResult.setResult(true);
             messageResult.setResult(true);
+            messageResult.setData(companyInvoice);
         }
         }
         catch (Exception ex){
         catch (Exception ex){
             messageResult.setResult(false);
             messageResult.setResult(false);

+ 0 - 1
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/controller/CompanyMemberController.java

@@ -163,7 +163,6 @@ public class CompanyMemberController {
     @ApiOperation(value="添加企业人员")
     @ApiOperation(value="添加企业人员")
     @PostMapping("add")
     @PostMapping("add")
     @ApiImplicitParams({
     @ApiImplicitParams({
-//            @ApiImplicitParam(name = "companyId",value = "企业ID", required = true, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "name",value = "姓名", required = true, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "name",value = "姓名", required = true, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "cardType",value = "证件类型", required = true, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "cardType",value = "证件类型", required = true, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "cardNo",value = "证件编号", required = true, paramType = "form",dataType = "String"),
             @ApiImplicitParam(name = "cardNo",value = "证件编号", required = true, paramType = "form",dataType = "String"),

+ 1 - 1
picc-enterprise-server/src/main/java/com/jpsoft/picc/modules/auth/controller/InsurancePolicyController.java

@@ -217,7 +217,7 @@ public class InsurancePolicyController {
                 map.put("definitionName",policy.getDefinitionName());
                 map.put("definitionName",policy.getDefinitionName());
                 //电子投保单下载地址
                 //电子投保单下载地址
                 map.put("insurancePolicyFile", policy.getInsurancePolicyFile());
                 map.put("insurancePolicyFile", policy.getInsurancePolicyFile());
-
+                map.put("electronicInvoiceFile", policy.getElectronicInvoiceFile());
                 map.put("policyNo",policy.getPolicyNo());
                 map.put("policyNo",policy.getPolicyNo());
                 map.put("createTime", sdf2.format(policy.getCreateTime()));
                 map.put("createTime", sdf2.format(policy.getCreateTime()));