From 999224a0be72dc43ab7b970e83c72611bc64d6eb Mon Sep 17 00:00:00 2001 From: wangjiadong Date: Thu, 22 Dec 2022 17:33:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=BE=E5=AE=A2=E5=8F=91=E7=A5=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/CustomerInvoiceList.vue | 61 +++++++-- .../admin/modules/CustomerInvoiceForm.vue | 88 +++++++++--- .../controller/CustomerInvoiceController.java | 127 ++++++++++++------ .../entity/CustomerInvoice.java | 16 ++- .../mapper/CustomerInvoiceMapper.java | 2 +- .../mapper/xml/CustomerInvoiceMapper.xml | 2 +- .../service/ICustomerInvoiceService.java | 2 +- .../impl/CustomerInvoiceServiceImpl.java | 2 +- .../utils/UnifiedCreditCodeUtil.java | 62 +++++++++ 9 files changed, 277 insertions(+), 85 deletions(-) create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/utils/UnifiedCreditCodeUtil.java diff --git a/ant-design-vue-jeecg/src/views/customerinvoice/admin/CustomerInvoiceList.vue b/ant-design-vue-jeecg/src/views/customerinvoice/admin/CustomerInvoiceList.vue index 305c1b9b..1ffb21d9 100644 --- a/ant-design-vue-jeecg/src/views/customerinvoice/admin/CustomerInvoiceList.vue +++ b/ant-design-vue-jeecg/src/views/customerinvoice/admin/CustomerInvoiceList.vue @@ -4,6 +4,38 @@
+ + + + + + + + + + + + + + 查询 + 重置 + + {{ toggleSearchStatus ? '收起' : '展开' }} + + + +
@@ -122,11 +154,7 @@ return parseInt(index)+1; } }, - { - title:'创建日期', - align:"center", - dataIndex: 'createTime' - }, + { title:'用户', align:"center", @@ -143,7 +171,7 @@ dataIndex: 'invoiceType_dictText' }, { - title:'名称', + title:'名称/姓名', align:"center", dataIndex: 'name' }, @@ -152,25 +180,31 @@ align:"center", dataIndex: 'taxIdentificationNumber' }, - { + /* { title:'地址', align:"center", dataIndex: 'address' - }, + },*/ { title:'电话', align:"center", dataIndex: 'telephone' }, + { + title:'账号', + align:"center", + dataIndex: 'accountNumber' + }, { title:'开户行', align:"center", dataIndex: 'bankDeposit' }, + { - title:'账号', + title:'创建日期', align:"center", - dataIndex: 'accountNumber' + dataIndex: 'createTime' }, { title:'排序', @@ -193,7 +227,7 @@ deleteBatch: "/customerinvoice/customerInvoice/deleteBatch", exportXlsUrl: "/customerinvoice/customerInvoice/exportXls", importExcelUrl: "customerinvoice/customerInvoice/importExcel", - + }, dictOptions:{}, superFieldList:[], @@ -213,10 +247,11 @@ getSuperFieldList(){ let fieldList=[]; 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:'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:'address',text:'地址',dictCode:''}) fieldList.push({type:'string',value:'telephone',text:'电话',dictCode:''}) diff --git a/ant-design-vue-jeecg/src/views/customerinvoice/admin/modules/CustomerInvoiceForm.vue b/ant-design-vue-jeecg/src/views/customerinvoice/admin/modules/CustomerInvoiceForm.vue index b4cc1fdd..a26b9043 100644 --- a/ant-design-vue-jeecg/src/views/customerinvoice/admin/modules/CustomerInvoiceForm.vue +++ b/ant-design-vue-jeecg/src/views/customerinvoice/admin/modules/CustomerInvoiceForm.vue @@ -3,62 +3,97 @@ + - - - - - - - + + + + - + + + - + + + - - + + + + - + + + - + + + - + + + + - - + + + + + + - - + + + + + - + + + + + + + + + @@ -95,6 +130,18 @@ }, confirmLoading: false, validatorRules: { + username: [ + { required: true, message: '请输入用户!'}, + ], + customerType: [ + { required: true, message: '请输入客户类型!'}, + ], + invoiceType: [ + { required: true, message: '请输入发票类型!'}, + ], + name: [ + { required: true, message: '请输入名称/姓名!'}, + ], telephone: [ { required: false}, { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, @@ -153,6 +200,9 @@ }) }, + popupCallback(value,row){ + this.model = Object.assign(this.model, row); + }, } } \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/controller/CustomerInvoiceController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/controller/CustomerInvoiceController.java index d7a07dad..bade71cc 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/controller/CustomerInvoiceController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/controller/CustomerInvoiceController.java @@ -9,11 +9,8 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - -import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.demo.customerinvoice.entity.CustomerInvoice; 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 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.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -42,7 +41,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; /** * @Description: 客户发票信息 * @Author: jeecg-boot - * @Date: 2022-12-08 + * @Date: 2022-12-22 * @Version: V1.0 */ @Api(tags="客户发票信息") @@ -52,7 +51,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class CustomerInvoiceController extends JeecgController { @Autowired private ICustomerInvoiceService customerInvoiceService; - + /** * 分页列表查询 * @@ -74,35 +73,7 @@ public class CustomerInvoiceController extends JeecgController pageList = customerInvoiceService.page(page, queryWrapper); 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 queryWrapper = QueryGenerator.initQueryWrapper(customerInvoice, req.getParameterMap()); - queryWrapper.eq("createBy",sysUser.getUsername()); - Page page = new Page(pageNo, pageSize); - IPage pageList = customerInvoiceService.page(page, queryWrapper); - return Result.OK(pageList); - } - - - + /** * 添加 * @@ -113,10 +84,43 @@ public class CustomerInvoiceController extends JeecgController add(@RequestBody CustomerInvoice customerInvoice) { - customerInvoiceService.save(customerInvoice); - return Result.OK("添加成功!"); - } + 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); + return Result.OK("添加成功!"); + }else{ + return Result.error("请检查后保存"); + } + + + + + } + /** * 编辑 * @@ -127,10 +131,43 @@ public class CustomerInvoiceController extends JeecgController edit(@RequestBody CustomerInvoice customerInvoice) { - customerInvoiceService.updateById(customerInvoice); - return Result.OK("编辑成功!"); - } + + 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); + return Result.OK("编辑成功!"); + }else{ + return Result.error("请检查后保存"); + } + + + } + /** * 通过id删除 * @@ -144,7 +181,7 @@ public class CustomerInvoiceController extends JeecgController { diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/mapper/xml/CustomerInvoiceMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/mapper/xml/CustomerInvoiceMapper.xml index 9386c34b..81e17600 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/mapper/xml/CustomerInvoiceMapper.xml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/mapper/xml/CustomerInvoiceMapper.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/ICustomerInvoiceService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/ICustomerInvoiceService.java index 9c109fc2..c8ac60f7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/ICustomerInvoiceService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/ICustomerInvoiceService.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; /** * @Description: 客户发票信息 * @Author: jeecg-boot - * @Date: 2022-12-08 + * @Date: 2022-12-22 * @Version: V1.0 */ public interface ICustomerInvoiceService extends IService { diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/impl/CustomerInvoiceServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/impl/CustomerInvoiceServiceImpl.java index 5d588cc2..47804111 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/impl/CustomerInvoiceServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/impl/CustomerInvoiceServiceImpl.java @@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** * @Description: 客户发票信息 * @Author: jeecg-boot - * @Date: 2022-12-08 + * @Date: 2022-12-22 * @Version: V1.0 */ @Service diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/utils/UnifiedCreditCodeUtil.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/utils/UnifiedCreditCodeUtil.java new file mode 100644 index 00000000..05115eee --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/utils/UnifiedCreditCodeUtil.java @@ -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 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(); + } +}