顾客发票管理

zhc4dev
wangjiadong 2 years ago
parent eeab2f1c29
commit 999224a0be
  1. 59
      ant-design-vue-jeecg/src/views/customerinvoice/admin/CustomerInvoiceList.vue
  2. 88
      ant-design-vue-jeecg/src/views/customerinvoice/admin/modules/CustomerInvoiceForm.vue
  3. 107
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/controller/CustomerInvoiceController.java
  4. 16
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/entity/CustomerInvoice.java
  5. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/mapper/CustomerInvoiceMapper.java
  6. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/mapper/xml/CustomerInvoiceMapper.xml
  7. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/ICustomerInvoiceService.java
  8. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/impl/CustomerInvoiceServiceImpl.java
  9. 62
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/utils/UnifiedCreditCodeUtil.java

@ -4,6 +4,38 @@
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="用户">
<j-search-select-tag placeholder="请选择用户" v-model="queryParam.userId" dict="sys_user,realname,id"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="客户类型">
<j-dict-select-tag placeholder="请选择客户类型" v-model="queryParam.customerType" dictCode="khlx"/>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="发票类型">
<j-dict-select-tag placeholder="请选择发票类型" v-model="queryParam.invoiceType" dictCode="fplx"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="名称/姓名">
<a-input placeholder="请输入名称/姓名" v-model="queryParam.name"></a-input>
</a-form-item>
</a-col>
</template>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
</a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
@ -122,11 +154,7 @@
return parseInt(index)+1; return parseInt(index)+1;
} }
}, },
{
title:'创建日期',
align:"center",
dataIndex: 'createTime'
},
{ {
title:'用户', title:'用户',
align:"center", align:"center",
@ -143,7 +171,7 @@
dataIndex: 'invoiceType_dictText' dataIndex: 'invoiceType_dictText'
}, },
{ {
title:'名称', title:'名称/姓名',
align:"center", align:"center",
dataIndex: 'name' dataIndex: 'name'
}, },
@ -152,25 +180,31 @@
align:"center", align:"center",
dataIndex: 'taxIdentificationNumber' dataIndex: 'taxIdentificationNumber'
}, },
{ /* {
title:'地址', title:'地址',
align:"center", align:"center",
dataIndex: 'address' dataIndex: 'address'
}, },*/
{ {
title:'电话', title:'电话',
align:"center", align:"center",
dataIndex: 'telephone' dataIndex: 'telephone'
}, },
{
title:'账号',
align:"center",
dataIndex: 'accountNumber'
},
{ {
title:'开户行', title:'开户行',
align:"center", align:"center",
dataIndex: 'bankDeposit' dataIndex: 'bankDeposit'
}, },
{ {
title:'账号', title:'创建日期',
align:"center", align:"center",
dataIndex: 'accountNumber' dataIndex: 'createTime'
}, },
{ {
title:'排序', title:'排序',
@ -213,10 +247,11 @@
getSuperFieldList(){ getSuperFieldList(){
let fieldList=[]; let fieldList=[];
fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) fieldList.push({type:'datetime',value:'createTime',text:'创建日期'})
fieldList.push({type:'sel_user',value:'userId',text:'用户'}) fieldList.push({type:'sel_search',value:'userId',text:'用户',dictTable:'sys_user', dictText:'realname', dictCode:'id'})
fieldList.push({type:'popup',value:'username',text:'用户', popup:{code:'findcust',field:'id',orgFields:'id',destFields:'user_id'}})
fieldList.push({type:'string',value:'customerType',text:'客户类型',dictCode:'khlx'}) fieldList.push({type:'string',value:'customerType',text:'客户类型',dictCode:'khlx'})
fieldList.push({type:'string',value:'invoiceType',text:'发票类型',dictCode:'fplx'}) fieldList.push({type:'string',value:'invoiceType',text:'发票类型',dictCode:'fplx'})
fieldList.push({type:'string',value:'name',text:'名称',dictCode:''}) fieldList.push({type:'string',value:'name',text:'名称/姓名',dictCode:''})
fieldList.push({type:'string',value:'taxIdentificationNumber',text:'纳税人识别号',dictCode:''}) fieldList.push({type:'string',value:'taxIdentificationNumber',text:'纳税人识别号',dictCode:''})
fieldList.push({type:'string',value:'address',text:'地址',dictCode:''}) fieldList.push({type:'string',value:'address',text:'地址',dictCode:''})
fieldList.push({type:'string',value:'telephone',text:'电话',dictCode:''}) fieldList.push({type:'string',value:'telephone',text:'电话',dictCode:''})

@ -3,62 +3,97 @@
<j-form-container :disabled="formDisabled"> <j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="创建日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTime"> <a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="username">
<j-date placeholder="请选择创建日期" v-model="model.createTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> <j-popup
</a-form-model-item> style="max-width:none; width: 200%"
</a-col> v-model="model.username"
<a-col :span="24"> field="username"
<a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> org-fields="id,realname"
<j-select-user-by-dep v-model="model.userId" /> dest-fields="userId,username"
code="findcust"
:multi="true"
@input="popupCallback"
/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="客户类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="customerType"> <a-form-model-item label="客户类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="customerType">
<j-dict-select-tag type="list" v-model="model.customerType" dictCode="khlx" placeholder="请选择客户类型" /> <j-dict-select-tag type="radio" v-model="model.customerType" dictCode="khlx" placeholder="请选择客户类型" style="max-width:none; width: 200%"/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="发票类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="invoiceType"> <a-form-model-item label="发票类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="invoiceType">
<j-dict-select-tag type="list" v-model="model.invoiceType" dictCode="fplx" placeholder="请选择发票类型" /> <j-dict-select-tag type="radio" v-model="model.invoiceType" dictCode="fplx" placeholder="请选择发票类型" style="max-width:none; width: 200%"/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name"> <a-form-model-item label="名称/姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
<a-input v-model="model.name" placeholder="请输入名称" ></a-input> <a-input v-model="model.name" placeholder="请输入名称/姓名" style="max-width:none; width: 200%"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="纳税人识别号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taxIdentificationNumber"> <a-form-model-item label="纳税人识别号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taxIdentificationNumber">
<a-input v-model="model.taxIdentificationNumber" placeholder="请输入纳税人识别号" ></a-input> <a-input v-model="model.taxIdentificationNumber" placeholder="请输入纳税人识别号" style="max-width:none; width: 200%"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address"> <a-form-model-item label="地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address">
<a-input v-model="model.address" placeholder="请输入地址" ></a-input> <a-textarea v-model="model.address" rows="4" placeholder="请输入地址" style="max-width:none; width: 200%"/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="telephone"> <a-form-model-item label="电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="telephone">
<a-input v-model="model.telephone" placeholder="请输入电话" ></a-input> <a-input v-model="model.telephone" placeholder="请输入电话" style="max-width:none; width: 200%"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="开户行" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bankDeposit"> <a-form-model-item label="账号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="accountNumber">
<a-input v-model="model.bankDeposit" placeholder="请输入开户行" ></a-input> <a-input v-model="model.accountNumber" placeholder="请输入账号" style="max-width:none; width: 200%"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="账号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="accountNumber"> <a-form-model-item label="开户行" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bankDeposit">
<a-input v-model="model.accountNumber" placeholder="请输入账号" ></a-input> <a-input style="max-width:none; width: 200%" v-model="model.bankDeposit" placeholder="请输入开户行" disabled></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sort"> <a-form-model-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sort">
<a-input-number v-model="model.sort" placeholder="请输入排序" style="width: 100%" /> <a-input-number v-model="model.sort" placeholder="请输入排序" style="max-width:none; width: 200%" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row>
<a-col :span="24">
<a-form-model-item label="创建日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTime">
<j-date placeholder="请选择创建日期" v-model="model.createTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled/>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model> </a-form-model>
</j-form-container> </j-form-container>
</a-spin> </a-spin>
@ -95,6 +130,18 @@
}, },
confirmLoading: false, confirmLoading: false,
validatorRules: { validatorRules: {
username: [
{ required: true, message: '请输入用户!'},
],
customerType: [
{ required: true, message: '请输入客户类型!'},
],
invoiceType: [
{ required: true, message: '请输入发票类型!'},
],
name: [
{ required: true, message: '请输入名称/姓名!'},
],
telephone: [ telephone: [
{ required: false}, { required: false},
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
@ -153,6 +200,9 @@
}) })
}, },
popupCallback(value,row){
this.model = Object.assign(this.model, row);
},
} }
} }
</script> </script>

@ -9,11 +9,8 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.customerinvoice.entity.CustomerInvoice; import org.jeecg.modules.demo.customerinvoice.entity.CustomerInvoice;
import org.jeecg.modules.demo.customerinvoice.service.ICustomerInvoiceService; import org.jeecg.modules.demo.customerinvoice.service.ICustomerInvoiceService;
@ -23,6 +20,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.demo.customerinvoice.utils.UnifiedCreditCodeUtil;
import org.jeecg.modules.demo.customerpayment.utils.BankUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
@ -42,7 +41,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
/** /**
* @Description: 客户发票信息 * @Description: 客户发票信息
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2022-12-08 * @Date: 2022-12-22
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="客户发票信息") @Api(tags="客户发票信息")
@ -75,34 +74,6 @@ public class CustomerInvoiceController extends JeecgController<CustomerInvoice,
return Result.OK(pageList); return Result.OK(pageList);
} }
/**
* 分页列表查询
*
* @param customerInvoice
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "客户发票信息-分页列表查询")
@ApiOperation(value="客户发票信息-分页列表查询", notes="客户发票信息-分页列表查询")
@GetMapping(value = "/listcustom")
public Result<?> listcustom(CustomerInvoice customerInvoice,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<CustomerInvoice> queryWrapper = QueryGenerator.initQueryWrapper(customerInvoice, req.getParameterMap());
queryWrapper.eq("createBy",sysUser.getUsername());
Page<CustomerInvoice> page = new Page<CustomerInvoice>(pageNo, pageSize);
IPage<CustomerInvoice> pageList = customerInvoiceService.page(page, queryWrapper);
return Result.OK(pageList);
}
/** /**
* 添加 * 添加
* *
@ -113,8 +84,41 @@ public class CustomerInvoiceController extends JeecgController<CustomerInvoice,
@ApiOperation(value="客户发票信息-添加", notes="客户发票信息-添加") @ApiOperation(value="客户发票信息-添加", notes="客户发票信息-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody CustomerInvoice customerInvoice) { public Result<?> add(@RequestBody CustomerInvoice customerInvoice) {
int flag=0;
UnifiedCreditCodeUtil unifiedCreditCodeUtil = new UnifiedCreditCodeUtil();
BankUtil bankUtil = new BankUtil();
if (UnifiedCreditCodeUtil.checkUnifiedCreditCode(customerInvoice.getTaxIdentificationNumber())){
}else {
flag=1;
return Result.error("请输入正确纳税人识别号");
}
if (bankUtil.checkBankCard(customerInvoice.getAccountNumber())){
customerInvoice.setBankDeposit(bankUtil.getNameOfBank(customerInvoice.getAccountNumber()));
}else{
flag=1;
return Result.error("请输入正确银行卡号码");
}
if(customerInvoice.getSort()>0){
}else{
flag=1;
return Result.error("排序必须大于0");
}
if(flag==0){
customerInvoiceService.save(customerInvoice); customerInvoiceService.save(customerInvoice);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
}else{
return Result.error("请检查后保存");
}
} }
/** /**
@ -127,8 +131,41 @@ public class CustomerInvoiceController extends JeecgController<CustomerInvoice,
@ApiOperation(value="客户发票信息-编辑", notes="客户发票信息-编辑") @ApiOperation(value="客户发票信息-编辑", notes="客户发票信息-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@RequestBody CustomerInvoice customerInvoice) { public Result<?> edit(@RequestBody CustomerInvoice customerInvoice) {
int flag=0;
UnifiedCreditCodeUtil unifiedCreditCodeUtil = new UnifiedCreditCodeUtil();
BankUtil bankUtil = new BankUtil();
if (UnifiedCreditCodeUtil.checkUnifiedCreditCode(customerInvoice.getTaxIdentificationNumber())){
}else {
flag=1;
return Result.error("请输入正确纳税人识别号");
}
if (bankUtil.checkBankCard(customerInvoice.getAccountNumber())){
customerInvoice.setBankDeposit(bankUtil.getNameOfBank(customerInvoice.getAccountNumber()));
}else{
flag=1;
return Result.error("请输入正确银行卡号码");
}
if(customerInvoice.getSort()>0){
}else{
flag=1;
return Result.error("排序必须大于0");
}
if(flag==0){
customerInvoiceService.updateById(customerInvoice); customerInvoiceService.updateById(customerInvoice);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
}else{
return Result.error("请检查后保存");
}
} }
/** /**
@ -199,4 +236,8 @@ public class CustomerInvoiceController extends JeecgController<CustomerInvoice,
return super.importExcel(request, response, CustomerInvoice.class); return super.importExcel(request, response, CustomerInvoice.class);
} }
}
}

@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
/** /**
* @Description: 客户发票信息 * @Description: 客户发票信息
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2022-12-08 * @Date: 2022-12-22
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@ -55,10 +55,14 @@ public class CustomerInvoice implements Serializable {
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode; private java.lang.String sysOrgCode;
/**用户*/ /**用户*/
@Excel(name = "用户", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") @Excel(name = "用户", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "id")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id")
@ApiModelProperty(value = "用户") @ApiModelProperty(value = "用户")
private java.lang.String userId; private java.lang.String userId;
/**用户*/
@Excel(name = "用户", width = 15)
@ApiModelProperty(value = "用户")
private java.lang.String username;
/**客户类型*/ /**客户类型*/
@Excel(name = "客户类型", width = 15, dicCode = "khlx") @Excel(name = "客户类型", width = 15, dicCode = "khlx")
@Dict(dicCode = "khlx") @Dict(dicCode = "khlx")
@ -69,9 +73,9 @@ public class CustomerInvoice implements Serializable {
@Dict(dicCode = "fplx") @Dict(dicCode = "fplx")
@ApiModelProperty(value = "发票类型") @ApiModelProperty(value = "发票类型")
private java.lang.String invoiceType; private java.lang.String invoiceType;
/**名称*/ /**名称/姓名*/
@Excel(name = "名称", width = 15) @Excel(name = "名称/姓名", width = 15)
@ApiModelProperty(value = "名称") @ApiModelProperty(value = "名称/姓名")
private java.lang.String name; private java.lang.String name;
/**纳税人识别号*/ /**纳税人识别号*/
@Excel(name = "纳税人识别号", width = 15) @Excel(name = "纳税人识别号", width = 15)

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
* @Description: 客户发票信息 * @Description: 客户发票信息
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2022-12-08 * @Date: 2022-12-22
* @Version: V1.0 * @Version: V1.0
*/ */
public interface CustomerInvoiceMapper extends BaseMapper<CustomerInvoice> { public interface CustomerInvoiceMapper extends BaseMapper<CustomerInvoice> {

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.demo.customerinvoice.mapper.CustomerInvoiceMapper"> <mapper namespace=".customerinvoice.mapper.CustomerInvoiceMapper">
</mapper> </mapper>

@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
/** /**
* @Description: 客户发票信息 * @Description: 客户发票信息
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2022-12-08 * @Date: 2022-12-22
* @Version: V1.0 * @Version: V1.0
*/ */
public interface ICustomerInvoiceService extends IService<CustomerInvoice> { public interface ICustomerInvoiceService extends IService<CustomerInvoice> {

@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/** /**
* @Description: 客户发票信息 * @Description: 客户发票信息
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2022-12-08 * @Date: 2022-12-22
* @Version: V1.0 * @Version: V1.0
*/ */
@Service @Service

@ -0,0 +1,62 @@
package org.jeecg.modules.demo.customerinvoice.utils;
import org.apache.commons.lang.StringUtils;
import java.util.Arrays;
import java.util.List;
/**
* @Description统一信用代码的util
* @Author: lcj
* @Date: Created in 2020-06-30 10:42:26
*/
public class UnifiedCreditCodeUtil {
/**
* 最后一位编码
*/
private static final List<String> LAST_CODE = Arrays.asList(
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"A", "B", "C", "D", "E", "F", "G", "H", "J", "K",
"L", "M", "N", "P", "Q", "R", "T", "U", "W", "X", "Y"
);
/**
* 加权因子
*/
private static final Integer[] FACTOR = {1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28};
public static boolean checkUnifiedCreditCode(String unifiedCreditCode) {
unifiedCreditCode = trim(unifiedCreditCode);
// 校验身份证
if (StringUtils.isBlank(unifiedCreditCode) || unifiedCreditCode.length() != 18) {
return false;
}
final String upperCaseCode = unifiedCreditCode.toUpperCase();
// 统一社会信用代码由18位阿拉伯数字或英文大写字母表示(不包括I,O,Z,S,V以防止和阿拉伯字母混淆)-->V:???关我毛事?
if (upperCaseCode.contains("I") || upperCaseCode.contains("O") || upperCaseCode.contains("Z") || upperCaseCode.contains("S") || upperCaseCode.contains("V")) {
return false;
}
char[] chars = upperCaseCode.toCharArray();
int sumCode = 0;
for (int i = 0; i < 17; i++) {
String code = String.valueOf(chars[i]);
int lastCodeIndex = LAST_CODE.indexOf(code);
Integer factorNum = FACTOR[i];
sumCode += (lastCodeIndex * factorNum);
}
int modCode = 31 - sumCode % 31;
String lastCode = LAST_CODE.get(modCode % 31);
return lastCode.equals(String.valueOf(chars[17]));
}
/**
* 去空格
*
* @param str 处理字符串
* @return 结果字符串
*/
private static String trim(String str) {
return str.replaceAll("\n", "").replace(" ", "").trim();
}
}
Loading…
Cancel
Save