Browse Source

登陆注册铝价接口

master
cgx 7 months ago
parent
commit
c77ce47a7c
36 changed files with 2431 additions and 11 deletions
  1. +3
    -1
      jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/jeecg-system-cloud-api.iml
  2. +3
    -1
      jeecg-boot-base/jeecg-boot-base-api/jeecg-system-local-api/jeecg-system-local-api.iml
  3. +3
    -1
      jeecg-boot-base/jeecg-boot-base-core/jeecg-boot-base-core.iml
  4. +7
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java
  5. +2
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java
  6. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  7. +3
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroRealm.java
  8. +156
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/controller/TbUserRoleController.java
  9. +107
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/entity/TbUserRole.java
  10. +14
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/mapper/TbUserRoleMapper.java
  11. +5
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/mapper/xml/TbUserRoleMapper.xml
  12. +14
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/service/ITbUserRoleService.java
  13. +19
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/service/impl/TbUserRoleServiceImpl.java
  14. +278
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue/TbUserRoleList.vue
  15. +159
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue/modules/TbUserRoleForm.vue
  16. +84
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue/modules/TbUserRoleModal.Style#Drawer.vue
  17. +60
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue/modules/TbUserRoleModal.vue
  18. +61
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue3/TbUserRole.api.ts
  19. +184
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue3/TbUserRole.data.ts
  20. +162
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue3/TbUserRoleList.vue
  21. +58
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue3/components/TbUserRoleModal.vue
  22. +3
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/webTeam/controller/WebTeamController.java
  23. +3
    -1
      jeecg-boot-module-system/jeecg-boot-module-system.iml
  24. +43
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/controller/IndexController.java
  25. +130
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/controller/UserLoginController.java
  26. +25
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/service/UserService.java
  27. +204
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/service/impl/UserServiceImpl.java
  28. +1
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java
  29. +1
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiController.java
  30. +1
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiTokenController.java
  31. +83
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/postBean/ReqUserRole.java
  32. +29
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/postBean/UserLoginModel.java
  33. +140
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/HttpUtil.java
  34. +0
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/SmsClient.java
  35. +381
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/ValidateTool.java
  36. +4
    -0
      jeecg-boot-module-system/src/main/resources/application-dev.yml

+ 3
- 1
jeecg-boot-base/jeecg-boot-base-api/jeecg-system-cloud-api/jeecg-system-cloud-api.iml View File

@ -10,7 +10,9 @@
<configuration>
<setting name="validation-enabled" value="true" />
<setting name="provider-name" value="Hibernate" />
<datasource-mapping />
<datasource-mapping>
<factory-entry name="jeecg-system-cloud-api" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>


+ 3
- 1
jeecg-boot-base/jeecg-boot-base-api/jeecg-system-local-api/jeecg-system-local-api.iml View File

@ -10,7 +10,9 @@
<configuration>
<setting name="validation-enabled" value="true" />
<setting name="provider-name" value="Hibernate" />
<datasource-mapping />
<datasource-mapping>
<factory-entry name="jeecg-system-local-api" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>


+ 3
- 1
jeecg-boot-base/jeecg-boot-base-core/jeecg-boot-base-core.iml View File

@ -10,7 +10,9 @@
<configuration>
<setting name="validation-enabled" value="true" />
<setting name="provider-name" value="Hibernate" />
<datasource-mapping />
<datasource-mapping>
<factory-entry name="jeecg-boot-base-core" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>


+ 7
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java View File

@ -6,7 +6,13 @@ package org.jeecg.common.constant;
*/
public interface CommonConstant {
/**
public static final String PHONE_CODE="phone_code:";
public static final String PHONE_SMS="phone_sms:";
/**
* 正常状态
*/
public static final Integer STATUS_NORMAL = 0;


+ 2
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java View File

@ -68,7 +68,8 @@ public class Swagger2Config implements WebMvcConfigurer {
.apiInfo(apiInfo())
.select()
//此包路径下的类才生成接口文档
.apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.api"))
// .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.api"))
.apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.alUser"))
//加了ApiOperation注解的类才生成接口文档
.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))


+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java View File

@ -74,7 +74,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/web/**", "anon"); //官网接口开放验证
filterChainDefinitionMap.put("/city/**", "anon");
filterChainDefinitionMap.put("/alUser/**", "anon");
filterChainDefinitionMap.put("/sys/oss/file/upload", "anon"); //图片上传验证放开
filterChainDefinitionMap.put("/sys/common/upload", "anon"); //图片上传验证放开


+ 3
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroRealm.java View File

@ -1,5 +1,6 @@
package org.jeecg.config.shiro;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
@ -160,6 +161,8 @@ public class ShiroRealm extends AuthorizingRealm {
/**
* 校验token的有效性
*


+ 156
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/controller/TbUserRoleController.java View File

@ -0,0 +1,156 @@
package org.jeecg.modules.userRole.controller;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.userRole.entity.TbUserRole;
import org.jeecg.modules.userRole.service.ITbUserRoleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 角色表
* @Author: jeecg-boot
* @Date: 2024-10-16
* @Version: V1.0
*/
@Api(tags="角色表")
@RestController
@RequestMapping("/userRole/tbUserRole")
@Slf4j
public class TbUserRoleController extends JeecgController<TbUserRole, ITbUserRoleService> {
@Autowired
private ITbUserRoleService tbUserRoleService;
/**
* 分页列表查询
*
* @param tbUserRole
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "角色表-分页列表查询")
@ApiOperation(value="角色表-分页列表查询", notes="角色表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<TbUserRole>> queryPageList(TbUserRole tbUserRole,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<TbUserRole> queryWrapper = QueryGenerator.initQueryWrapper(tbUserRole, req.getParameterMap());
Page<TbUserRole> page = new Page<TbUserRole>(pageNo, pageSize);
IPage<TbUserRole> pageList = tbUserRoleService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param tbUserRole
* @return
*/
@AutoLog(value = "角色表-添加")
@ApiOperation(value="角色表-添加", notes="角色表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody TbUserRole tbUserRole) {
tbUserRoleService.save(tbUserRole);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param tbUserRole
* @return
*/
@AutoLog(value = "角色表-编辑")
@ApiOperation(value="角色表-编辑", notes="角色表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody TbUserRole tbUserRole) {
tbUserRoleService.updateById(tbUserRole);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "角色表-通过id删除")
@ApiOperation(value="角色表-通过id删除", notes="角色表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
tbUserRoleService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "角色表-批量删除")
@ApiOperation(value="角色表-批量删除", notes="角色表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.tbUserRoleService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "角色表-通过id查询")
@ApiOperation(value="角色表-通过id查询", notes="角色表-通过id查询")
@GetMapping(value = "/queryById")
public Result<TbUserRole> queryById(@RequestParam(name="id",required=true) String id) {
TbUserRole tbUserRole = tbUserRoleService.getById(id);
if(tbUserRole==null) {
return Result.error("未找到对应数据");
}
return Result.OK(tbUserRole);
}
/**
* 导出excel
*
* @param request
* @param tbUserRole
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, TbUserRole tbUserRole) {
return super.exportXls(request, tbUserRole, TbUserRole.class, "角色表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, TbUserRole.class);
}
}

+ 107
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/entity/TbUserRole.java View File

@ -0,0 +1,107 @@
package org.jeecg.modules.userRole.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 角色表
* @Author: jeecg-boot
* @Date: 2024-10-16
* @Version: V1.0
*/
@Data
@TableName("tb_user_role")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="tb_user_role对象", description="角色表")
public class TbUserRole implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**用户id*/
@Excel(name = "用户id", width = 15)
@ApiModelProperty(value = "用户id")
private java.lang.String userId;
/**角色信息 1供应商 0采购商*/
@Excel(name = "角色信息 1供应商 0采购商", width = 15, dicCode = "user_role")
@Dict(dicCode = "user_role")
@ApiModelProperty(value = "角色信息 1供应商 0采购商")
private java.lang.Integer role;
/**用户名*/
@Excel(name = "用户名", width = 15)
@ApiModelProperty(value = "用户名")
private java.lang.String userName;
/**公司名称*/
@Excel(name = "公司名称", width = 15)
@ApiModelProperty(value = "公司名称")
private java.lang.String companyName;
/**税收编码*/
@Excel(name = "税收编码", width = 15)
@ApiModelProperty(value = "税收编码")
private java.lang.String taxCode;
/**公司地址*/
@Excel(name = "公司地址", width = 15)
@ApiModelProperty(value = "公司地址")
private java.lang.String address;
/**公司账号*/
@Excel(name = "公司账号", width = 15)
@ApiModelProperty(value = "公司账号")
private java.lang.String bankAccount;
/**电话*/
@Excel(name = "电话", width = 15)
@ApiModelProperty(value = "电话")
private java.lang.String phone;
/**开户行*/
@Excel(name = "开户行", width = 15)
@ApiModelProperty(value = "开户行")
private java.lang.String bankNama;
/**营业执照上传*/
@Excel(name = "营业执照上传", width = 15)
@ApiModelProperty(value = "营业执照上传")
private java.lang.String businessLicense;
/**基本户信息照片上传*/
@Excel(name = "基本户信息照片上传", width = 15)
@ApiModelProperty(value = "基本户信息照片上传")
private java.lang.String basicAccount;
/**收款银行照片上传*/
@Excel(name = "收款银行照片上传", width = 15)
@ApiModelProperty(value = "收款银行照片上传")
private java.lang.String bankInfo;
/**审核状态 0审核中 1 审核通过 2审核未通过*/
@Excel(name = "审核状态 0审核中 1 审核通过 2审核未通过", width = 15, dicCode = "audit_status")
@Dict(dicCode = "audit_status")
@ApiModelProperty(value = "审核状态 0审核中 1 审核通过 2审核未通过")
private java.lang.Integer auditStatus;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
}

+ 14
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/mapper/TbUserRoleMapper.java View File

@ -0,0 +1,14 @@
package org.jeecg.modules.userRole.mapper;
import org.jeecg.modules.userRole.entity.TbUserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 角色表
* @Author: jeecg-boot
* @Date: 2024-10-16
* @Version: V1.0
*/
public interface TbUserRoleMapper extends BaseMapper<TbUserRole> {
}

+ 5
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/mapper/xml/TbUserRoleMapper.xml View File

@ -0,0 +1,5 @@
<?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">
<mapper namespace="org.jeecg.modules.userRole.mapper.TbUserRoleMapper">
</mapper>

+ 14
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/service/ITbUserRoleService.java View File

@ -0,0 +1,14 @@
package org.jeecg.modules.userRole.service;
import org.jeecg.modules.userRole.entity.TbUserRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 角色表
* @Author: jeecg-boot
* @Date: 2024-10-16
* @Version: V1.0
*/
public interface ITbUserRoleService extends IService<TbUserRole> {
}

+ 19
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/service/impl/TbUserRoleServiceImpl.java View File

@ -0,0 +1,19 @@
package org.jeecg.modules.userRole.service.impl;
import org.jeecg.modules.userRole.entity.TbUserRole;
import org.jeecg.modules.userRole.mapper.TbUserRoleMapper;
import org.jeecg.modules.userRole.service.ITbUserRoleService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 角色表
* @Author: jeecg-boot
* @Date: 2024-10-16
* @Version: V1.0
*/
@Service
public class TbUserRoleServiceImpl extends ServiceImpl<TbUserRoleMapper, TbUserRole> implements ITbUserRoleService {
}

+ 278
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue/TbUserRoleList.vue View File

@ -0,0 +1,278 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="角色信息 1供应商 2采购商">
<j-dict-select-tag placeholder="请选择角色信息 1供应商 2采购商" v-model="queryParam.role" dictCode="user_role"/>
</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.userName"></a-input>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="公司名称">
<a-input placeholder="请输入公司名称" v-model="queryParam.companyName"></a-input>
</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.phone"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="审核状态 0审核中 1 审核通过 2审核未通过">
<j-dict-select-tag placeholder="请选择审核状态 0审核中 1 审核通过 2审核未通过" v-model="queryParam.auditStatus" dictCode="audit_status"/>
</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-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('角色表')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text,record">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<tb-user-role-modal ref="modalForm" @ok="modalFormOk"></tb-user-role-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import TbUserRoleModal from './modules/TbUserRoleModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
export default {
name: 'TbUserRoleList',
mixins:[JeecgListMixin, mixinDevice],
components: {
TbUserRoleModal
},
data () {
return {
description: '角色表管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'角色信息 1供应商 2采购商',
align:"center",
dataIndex: 'role_dictText'
},
{
title:'用户名',
align:"center",
dataIndex: 'userName'
},
{
title:'公司名称',
align:"center",
dataIndex: 'companyName'
},
{
title:'税收编码',
align:"center",
dataIndex: 'taxCode'
},
{
title:'公司地址',
align:"center",
dataIndex: 'address'
},
{
title:'公司账号',
align:"center",
dataIndex: 'bankAccount'
},
{
title:'电话',
align:"center",
dataIndex: 'phone'
},
{
title:'开户行',
align:"center",
dataIndex: 'bankNama'
},
{
title:'营业执照上传',
align:"center",
dataIndex: 'businessLicense',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'基本户信息照片上传',
align:"center",
dataIndex: 'basicAccount',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'收款银行照片上传',
align:"center",
dataIndex: 'bankInfo',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'审核状态 0审核中 1 审核通过 2审核未通过',
align:"center",
dataIndex: 'auditStatus_dictText'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/userRole/tbUserRole/list",
delete: "/userRole/tbUserRole/delete",
deleteBatch: "/userRole/tbUserRole/deleteBatch",
exportXlsUrl: "/userRole/tbUserRole/exportXls",
importExcelUrl: "userRole/tbUserRole/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'int',value:'role',text:'角色信息 1供应商 2采购商',dictCode:'user_role'})
fieldList.push({type:'string',value:'userName',text:'用户名',dictCode:''})
fieldList.push({type:'string',value:'companyName',text:'公司名称',dictCode:''})
fieldList.push({type:'string',value:'taxCode',text:'税收编码',dictCode:''})
fieldList.push({type:'string',value:'address',text:'公司地址',dictCode:''})
fieldList.push({type:'string',value:'bankAccount',text:'公司账号',dictCode:''})
fieldList.push({type:'string',value:'phone',text:'电话',dictCode:''})
fieldList.push({type:'string',value:'bankNama',text:'开户行',dictCode:''})
fieldList.push({type:'Text',value:'businessLicense',text:'营业执照上传',dictCode:''})
fieldList.push({type:'Text',value:'basicAccount',text:'基本户信息照片上传',dictCode:''})
fieldList.push({type:'Text',value:'bankInfo',text:'收款银行照片上传',dictCode:''})
fieldList.push({type:'int',value:'auditStatus',text:'审核状态 0审核中 1 审核通过 2审核未通过',dictCode:'audit_status'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

+ 159
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue/modules/TbUserRoleForm.vue View File

@ -0,0 +1,159 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="角色信息 1供应商 2采购商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="role">
<j-dict-select-tag type="list" v-model="model.role" dictCode="user_role" placeholder="请选择角色信息 1供应商 2采购商" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userName">
<a-input v-model="model.userName" placeholder="请输入用户名" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="公司名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyName">
<a-input v-model="model.companyName" placeholder="请输入公司名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="税收编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taxCode">
<a-input v-model="model.taxCode" placeholder="请输入税收编码" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="公司地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address">
<a-input v-model="model.address" placeholder="请输入公司地址" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="公司账号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bankAccount">
<a-input v-model="model.bankAccount" placeholder="请输入公司账号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="phone">
<a-input v-model="model.phone" placeholder="请输入电话" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="开户行" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bankNama">
<a-input v-model="model.bankNama" placeholder="请输入开户行" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="营业执照上传" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="businessLicense">
<j-image-upload isMultiple v-model="model.businessLicense" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="基本户信息照片上传" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="basicAccount">
<j-image-upload isMultiple v-model="model.basicAccount" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="收款银行照片上传" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bankInfo">
<j-image-upload isMultiple v-model="model.bankInfo" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="审核状态 0审核中 1 审核通过 2审核未通过" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="auditStatus">
<j-dict-select-tag type="list" v-model="model.auditStatus" dictCode="audit_status" placeholder="请选择审核状态 0审核中 1 审核通过 2审核未通过" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'TbUserRoleForm',
components: {
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/userRole/tbUserRole/add",
edit: "/userRole/tbUserRole/edit",
queryById: "/userRole/tbUserRole/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>

+ 84
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue/modules/TbUserRoleModal.Style#Drawer.vue View File

@ -0,0 +1,84 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<tb-user-role-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></tb-user-role-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import TbUserRoleForm from './TbUserRoleForm'
export default {
name: 'TbUserRoleModal',
components: {
TbUserRoleForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

+ 60
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue/modules/TbUserRoleModal.vue View File

@ -0,0 +1,60 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<tb-user-role-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></tb-user-role-form>
</j-modal>
</template>
<script>
import TbUserRoleForm from './TbUserRoleForm'
export default {
name: 'TbUserRoleModal',
components: {
TbUserRoleForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>

+ 61
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue3/TbUserRole.api.ts View File

@ -0,0 +1,61 @@
import {defHttp} from '/@/utils/http/axios';
import {Modal} from 'ant-design-vue';
enum Api {
list = '/userRole/tbUserRole/list',
save='/userRole/tbUserRole/add',
edit='/userRole/tbUserRole/edit',
deleteOne = '/userRole/tbUserRole/delete',
deleteBatch = '/userRole/tbUserRole/deleteBatch',
importExcel = '/userRole/tbUserRole/importExcel',
exportXls = '/userRole/tbUserRole/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/**
*
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params});
}

+ 184
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue3/TbUserRole.data.ts View File

@ -0,0 +1,184 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '角色信息 1供应商 2采购商',
align:"center",
dataIndex: 'role_dictText'
},
{
title: '用户名',
align:"center",
dataIndex: 'userName'
},
{
title: '公司名称',
align:"center",
dataIndex: 'companyName'
},
{
title: '税收编码',
align:"center",
dataIndex: 'taxCode'
},
{
title: '公司地址',
align:"center",
dataIndex: 'address'
},
{
title: '公司账号',
align:"center",
dataIndex: 'bankAccount'
},
{
title: '电话',
align:"center",
dataIndex: 'phone'
},
{
title: '开户行',
align:"center",
dataIndex: 'bankNama'
},
{
title: '营业执照上传',
align:"center",
dataIndex: 'businessLicense',
customRender:render.renderAvatar,
},
{
title: '基本户信息照片上传',
align:"center",
dataIndex: 'basicAccount',
customRender:render.renderAvatar,
},
{
title: '收款银行照片上传',
align:"center",
dataIndex: 'bankInfo',
customRender:render.renderAvatar,
},
{
title: '审核状态 0审核中 1 审核通过 2审核未通过',
align:"center",
dataIndex: 'auditStatus_dictText'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: "角色信息 1供应商 2采购商",
field: "role",
component: 'JDictSelectTag',
componentProps:{
dictCode:"user_role"
},
colProps: {span: 6},
},
{
label: "用户名",
field: "userName",
component: 'Input',
colProps: {span: 6},
},
{
label: "公司名称",
field: "companyName",
component: 'Input',
colProps: {span: 6},
},
{
label: "电话",
field: "phone",
component: 'Input',
colProps: {span: 6},
},
{
label: "审核状态 0审核中 1 审核通过 2审核未通过",
field: "auditStatus",
component: 'JDictSelectTag',
componentProps:{
dictCode:"audit_status"
},
colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '角色信息 1供应商 2采购商',
field: 'role',
component: 'JDictSelectTag',
componentProps:{
dictCode:"user_role"
},
},
{
label: '用户名',
field: 'userName',
component: 'Input',
},
{
label: '公司名称',
field: 'companyName',
component: 'Input',
},
{
label: '税收编码',
field: 'taxCode',
component: 'Input',
},
{
label: '公司地址',
field: 'address',
component: 'Input',
},
{
label: '公司账号',
field: 'bankAccount',
component: 'Input',
},
{
label: '电话',
field: 'phone',
component: 'Input',
},
{
label: '开户行',
field: 'bankNama',
component: 'Input',
},
{
label: '营业执照上传',
field: 'businessLicense',
component: 'JImageUpload',
componentProps:{
},
},
{
label: '基本户信息照片上传',
field: 'basicAccount',
component: 'JImageUpload',
componentProps:{
},
},
{
label: '收款银行照片上传',
field: 'bankInfo',
component: 'JImageUpload',
componentProps:{
},
},
{
label: '审核状态 0审核中 1 审核通过 2审核未通过',
field: 'auditStatus',
component: 'JDictSelectTag',
componentProps:{
dictCode:"audit_status"
},
},
];

+ 162
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue3/TbUserRoleList.vue View File

@ -0,0 +1,162 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<TbUserRoleModal @register="registerModal" @success="handleSuccess"></TbUserRoleModal>
</div>
</template>
<script lang="ts" name="userRole-tbUserRole" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import TbUserRoleModal from './components/TbUserRoleModal.vue'
import {columns, searchFormSchema} from './tbUserRole.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './tbUserRole.api';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '角色表',
api: list,
columns,
canResize:false,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
},
},
exportConfig: {
name:"角色表",
url: getExportUrl,
},
importConfig: {
url: getImportUrl
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, reload);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
}
/**
* 成功回调
*/
function handleSuccess() {
reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

+ 58
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/userRole/vue3/components/TbUserRoleModal.vue View File

@ -0,0 +1,58 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../tbUserRole.data';
import {saveOrUpdate} from '../tbUserRole.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
//
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
</style>

+ 3
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/webTeam/controller/WebTeamController.java View File

@ -9,6 +9,9 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.xkcoding.http.HttpUtil;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;


+ 3
- 1
jeecg-boot-module-system/jeecg-boot-module-system.iml View File

@ -14,7 +14,9 @@
<configuration>
<setting name="validation-enabled" value="true" />
<setting name="provider-name" value="Hibernate" />
<datasource-mapping />
<datasource-mapping>
<factory-entry name="jeecg-boot-module-system" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>


+ 43
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/controller/IndexController.java View File

@ -0,0 +1,43 @@
package org.jeecg.modules.alUser.controller;
import com.alibaba.fastjson.JSONObject;
import com.xkcoding.http.HttpUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.alUser.service.UserService;
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author scott
* @since 2018-12-17
*/
@RestController
@RequestMapping("/index")
@Api(tags = "首页等展示接口")
@Slf4j
public class IndexController {
@Autowired
private IHanHaiMemberService iHanHaiMemberService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private UserService userService;
@ApiOperation(value = "铝价接口")
@RequestMapping(value = "/alprice", method = RequestMethod.POST)
public Result<JSONObject> alprice() {
String s = HttpUtil.get("https://www.alphavantage.co/query?function=ALUMINUM&interval=monthly&apikey=AH6NDLVPBHJ8K7OM");
JSONObject jsonObject = JSONObject.parseObject(s);
return Result.ok(jsonObject);
}
}

+ 130
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/controller/UserLoginController.java View File

@ -0,0 +1,130 @@
package org.jeecg.modules.alUser.controller;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.alUser.service.UserService;
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService;
import org.jeecg.modules.postBean.ReqUserRole;
import org.jeecg.modules.postBean.UserLoginModel;
import org.jeecg.modules.utils.SmsClient;
import org.jeecg.modules.utils.ValidateTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Author scott
* @since 2018-12-17
*/
@RestController
@RequestMapping("/alUser")
@Api(tags = "用户登陆注册")
@Slf4j
public class UserLoginController {
@Autowired
private IHanHaiMemberService iHanHaiMemberService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private UserService userService;
@ApiOperation(value = "用户登陆")
@RequestMapping(value = "/login", method = RequestMethod.POST)
public Result<JSONObject> login(@RequestBody UserLoginModel userLoginModel) {
if (ValidateTool.isNull(userLoginModel)) {
return Result.error("参数错误");
}
if (ValidateTool.isNull(userLoginModel.getUsername())) {
return Result.error("请填写用户名");
}
if (ValidateTool.isNull(userLoginModel.getPassword())) {
return Result.error("请填写密码");
}
return userService.login(userLoginModel);
}
@ApiOperation(value = "用户注册")
@RequestMapping(value = "/regUesr", method = RequestMethod.POST)
public Result<JSONObject> regUesr(@RequestBody UserLoginModel userLoginModel) {
if (ValidateTool.isNull(userLoginModel)) {
return Result.error("参数错误");
}
if (ValidateTool.isNull(userLoginModel.getUsername())) {
return Result.error("请填写用户名");
}
if (ValidateTool.isNull(userLoginModel.getPassword())) {
return Result.error("请填写密码");
}
return userService.reg(userLoginModel);
}
@ApiOperation(value = "选择身份")
@RequestMapping(value = "/role", method = RequestMethod.POST)
public Result<JSONObject> role(@RequestBody ReqUserRole reqUserRole) {
if (ValidateTool.isNull(reqUserRole)) {
return Result.error("参数错误");
}
if (ValidateTool.isNull(reqUserRole.getUserName())) {
return Result.error("请填写用户名");
}
if (ValidateTool.isNull(reqUserRole.getPassword())) {
return Result.error("请填写密码");
}
return userService.role(reqUserRole);
}
/**
* 发送短信接口
*
* @param
* @return
*/
@ApiOperation(value = "发送短信接口")
@PostMapping(value = "/sendSms")
public Result<String> sendSms(@RequestBody UserLoginModel userLoginModel) {
Result<String> result = new Result<String>();
String mobile = userLoginModel.getUsername();
log.info(mobile);
if (oConvertUtils.isEmpty(mobile)) {
result.setMessage("手机号不允许为空!");
result.setSuccess(false);
return result;
}
Object object = redisUtil.get(CommonConstant.PHONE_CODE + mobile);
if (object != null) {
result.setMessage("验证码3分钟内,仍然有效!");
result.setSuccess(false);
return result;
}
//随机数
String captcha = RandomUtil.randomNumbers(6);
LambdaQueryWrapper<HanHaiMember> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HanHaiMember::getAccount, mobile);
HanHaiMember one = iHanHaiMemberService.getOne(queryWrapper);
if (ValidateTool.isNull(one)) {
result.error500("请先注册账号");
return result;
}
String send = SmsClient.send(mobile, captcha);
log.info("短信发送结果{}", send);
//验证码三分钟过期
redisUtil.set(CommonConstant.PHONE_CODE + mobile, captcha, 180);
//todo 刷短信接口限制
return Result.ok();
}
}

+ 25
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/service/UserService.java View File

@ -0,0 +1,25 @@
package org.jeecg.modules.alUser.service;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.postBean.ReqUserRole;
import org.jeecg.modules.postBean.UserLoginModel;
import org.springframework.web.bind.annotation.RequestBody;
public interface UserService {
//获取首页基础信息
Result<?> getIndexInfo();
Result<JSONObject> login(UserLoginModel userLoginModel);
Result<JSONObject> reg(UserLoginModel userLoginModel);
Result<JSONObject> role(ReqUserRole reqUserRole);
}

+ 204
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/alUser/service/impl/UserServiceImpl.java View File

@ -0,0 +1,204 @@
package org.jeecg.modules.alUser.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.util.PasswordUtil;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.alUser.service.UserService;
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService;
import org.jeecg.modules.postBean.ReqUserRole;
import org.jeecg.modules.postBean.UserLoginModel;
import org.jeecg.modules.userRole.entity.TbUserRole;
import org.jeecg.modules.userRole.service.ITbUserRoleService;
import org.jeecg.modules.utils.ValidateTool;
import org.jeecg.modules.webBanner.entity.WebBanner;
import org.jeecg.modules.webBanner.service.IWebBannerService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class UserServiceImpl implements UserService {
@Resource
private IWebBannerService webBannerService;
@Autowired
private IHanHaiMemberService iHanHaiMemberService;
@Autowired
private RedisUtil redisUtil;
@Resource
private ITbUserRoleService tbUserRoleService;
@Transactional(rollbackFor = Exception.class)
@Override
public Result<JSONObject> login(UserLoginModel userLoginModel) {
Result<JSONObject> result = new Result<JSONObject>();
String username = userLoginModel.getUsername();
String password = userLoginModel.getPassword();
//1. 校验用户是否有效
LambdaQueryWrapper<HanHaiMember> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HanHaiMember::getAccount, username);
HanHaiMember one = iHanHaiMemberService.getOne(queryWrapper);
if (ValidateTool.isNull(one)) {
result.error500("用户不存在");
}
if (userLoginModel.getLoginModel() == 0) {
// 账号密码登陆
//2. 校验用户名或密码是否正确
String userpassword = PasswordUtil.encrypt(username, password, one.getPasswordSalt());
String syspassword = one.getPassword();
if (!syspassword.equals(userpassword)) {
result.error500("用户名或密码错误");
return result;
}
} else {
if (ValidateTool.isNull(userLoginModel.getCaptcha())) {
return Result.error("请填写验证码");
}
String smscode = userLoginModel.getCaptcha();
//手机验证码登陆
Object code = redisUtil.get(CommonConstant.PHONE_CODE + username);
if (ValidateTool.isNull(code)) {
result.error500("手机验证码错误");
}
if (!smscode.equals(code)) {
result.setMessage("手机验证码错误");
return result;
}
redisUtil.del(CommonConstant.PHONE_CODE + username);
}
//用户登录信息
// 生成token
String token = JwtUtil.sign(username, one.getPassword());
//不返回关键信息
one.setPasswordSalt(null);
one.setPassword(null);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
JSONObject obj = new JSONObject();
obj.put("token", token);
obj.put("userInfo", one);
result.setResult(obj);
result.success("登录成功");
return result;
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<JSONObject> reg(UserLoginModel userLoginModel) {
Result<JSONObject> result = new Result<JSONObject>();
LambdaQueryWrapper<HanHaiMember> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HanHaiMember::getAccount, userLoginModel.getUsername());
HanHaiMember user = iHanHaiMemberService.getOne(queryWrapper);
if (ValidateTool.isNotNull(user)) {
return result.error500("用户已注册");
}
HanHaiMember newUser = new HanHaiMember();
newUser.setAccount(userLoginModel.getUsername());
newUser.setPhone(userLoginModel.getUsername());
String salt = oConvertUtils.randomGen(8);
newUser.setPasswordSalt(salt);
String passwordEncode = PasswordUtil.encrypt(newUser.getAccount(), userLoginModel.getPassword(), salt);
newUser.setPassword(passwordEncode);
iHanHaiMemberService.save(newUser);
//用户登录信息
// 生成token
String token = JwtUtil.sign(userLoginModel.getUsername(), passwordEncode);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
JSONObject obj = new JSONObject();
obj.put("token", token);
obj.put("userInfo", newUser);
result.setResult(obj);
return result;
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result<JSONObject> role(ReqUserRole reqUserRole) {
Result<JSONObject> result = new Result<JSONObject>();
//1. 校验用户是否有效
LambdaQueryWrapper<HanHaiMember> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HanHaiMember::getAccount, reqUserRole.getUserName());
HanHaiMember one = iHanHaiMemberService.getOne(queryWrapper);
if (ValidateTool.isNull(one)) {
result.error500("用户不存在");
}
//2. 校验用户名或密码是否正确
String userpassword = PasswordUtil.encrypt(reqUserRole.getUserName(), reqUserRole.getPassword(), one.getPasswordSalt());
String syspassword = one.getPassword();
if (!syspassword.equals(userpassword)) {
result.error500("用户名或密码错误");
return result;
}
LambdaQueryWrapper<TbUserRole> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
objectLambdaQueryWrapper.eq(TbUserRole::getUserName,reqUserRole.getUserName()).
eq(TbUserRole::getRole,reqUserRole.getRole()).in(TbUserRole::getAuditStatus,1,0);
TbUserRole one1 = tbUserRoleService.getOne(objectLambdaQueryWrapper);
if (ValidateTool.isNotNull(one1) && one1.getAuditStatus()==0){
result.error500("已提交审核,请耐心等候或联系管理员");
}
if (ValidateTool.isNotNull(one1) && one1.getAuditStatus()==0){
result.error500("已提交审核,请勿重复提交");
}
TbUserRole tbUserRole = new TbUserRole();
BeanUtils.copyProperties(reqUserRole, tbUserRole);
tbUserRole.setUserId(one1.getUserId()).getId();
tbUserRole.setAuditStatus(0);
tbUserRoleService.save(tbUserRole);
return result;
}
//获取首页基础信息
@Override
public Result<?> getIndexInfo(){
Map<String,Object> map=new HashMap<>();
map.put("title","高端网站定制");
List list=new ArrayList();
list.add("企业官网");
list.add("电商官网");
list.add("H5官网");
list.add("小程序");
map.put("list",list);
map.put("details","网站定制介绍");
//获取banner
List<WebBanner> bannerList = webBannerService.list();
map.put("bannerList",bannerList);
return Result.OK(map);
}
}

+ 1
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java View File

@ -113,7 +113,7 @@ public class YaoDuApiServiceImpl implements YaoDuApiService {
public Result<?> getIndexHeaderInfo(){
Map<String,Object> map=new HashMap<>();
map.put("headImage","https://dianpin-img.xzaiyp.top/upload/bg_1728634973432.png");
map.put("name","瑶都万能墙");
map.put("name","铝材交易");
map.put("userNum","16888");
map.put("num","1888");
return Result.OK(map);


+ 1
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiController.java View File

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api(tags="瑶都万能墙接口 - 不需要token")
@Api(tags="铝材交易接口 - 不需要token")
@RestController
@RequestMapping("/city")
@Slf4j


+ 1
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiTokenController.java View File

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api(tags="瑶都万能墙接口 - 带token")
@Api(tags="铝材交易接口 - 带token")
@RestController
@RequestMapping("/token")
@Slf4j


+ 83
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/postBean/ReqUserRole.java View File

@ -0,0 +1,83 @@
package org.jeecg.modules.postBean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
import java.util.Date;
/**
* @Description: 角色表
* @Author: jeecg-boot
* @Date: 2024-10-16
* @Version: V1.0
*/
@Data
@ApiModel(value="选择身份对象", description="选择身份对象")
public class ReqUserRole implements Serializable {
private static final long serialVersionUID = 1L;
/**角色信息 1供应商 0采购商*/
@Excel(name = "角色信息 1供应商 0采购商", width = 15, dicCode = "user_role")
@Dict(dicCode = "user_role")
@ApiModelProperty(value = "角色信息 1供应商 0采购商")
private Integer role;
/**用户名*/
@Excel(name = "用户名", width = 15)
@ApiModelProperty(value = "用户名")
private String userName;
@ApiModelProperty(value = "密码")
private String password;
/**公司名称*/
@Excel(name = "公司名称", width = 15)
@ApiModelProperty(value = "公司名称")
private String companyName;
/**税收编码*/
@Excel(name = "税收编码", width = 15)
@ApiModelProperty(value = "税收编码")
private String taxCode;
/**公司地址*/
@Excel(name = "公司地址", width = 15)
@ApiModelProperty(value = "公司地址")
private String address;
/**公司账号*/
@Excel(name = "公司账号", width = 15)
@ApiModelProperty(value = "公司账号")
private String bankAccount;
/**电话*/
@Excel(name = "电话", width = 15)
@ApiModelProperty(value = "电话")
private String phone;
/**开户行*/
@Excel(name = "开户行", width = 15)
@ApiModelProperty(value = "开户行")
private String bankNama;
/**营业执照上传*/
@Excel(name = "营业执照上传", width = 15)
@ApiModelProperty(value = "营业执照上传")
private String businessLicense;
/**基本户信息照片上传*/
@Excel(name = "基本户信息照片上传", width = 15)
@ApiModelProperty(value = "基本户信息照片上传")
private String basicAccount;
/**收款银行照片上传*/
@Excel(name = "收款银行照片上传", width = 15)
@ApiModelProperty(value = "收款银行照片上传")
private String bankInfo;
/**审核状态 0审核中 1 审核通过 2审核未通过*/
@Excel(name = "审核状态 0审核中 1 审核通过 2审核未通过", width = 15, dicCode = "audit_status")
@Dict(dicCode = "audit_status")
@ApiModelProperty(value = "审核状态 0审核中 1 审核通过 2审核未通过")
private Integer auditStatus;
}

+ 29
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/postBean/UserLoginModel.java View File

@ -0,0 +1,29 @@
package org.jeecg.modules.postBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 登录表单
*
* @Author scott
* @since 2019-01-18
*/
@Data
@ApiModel(value="登录对象", description="登录对象")
public class UserLoginModel {
@ApiModelProperty(value = "账号")
private String username;
@ApiModelProperty(value = "密码")
private String password;
@ApiModelProperty(value = "验证码")
private String captcha;
@ApiModelProperty(value = "登陆模式 0账号密码登陆 1验证码登陆")
private Integer loginModel;
}

+ 140
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/HttpUtil.java View File

@ -0,0 +1,140 @@
package org.jeecg.modules.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpUtil {
private static final CloseableHttpClient httpclient = HttpClients.createDefault();
/**
* 发送HttpGet请求
* @param url
* @return
*/
public static String sendGet(String url) {
HttpGet httpget = new HttpGet(url);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpget);
} catch (IOException e1) {
e1.printStackTrace();
}
String result = null;
try {
HttpEntity entity = response.getEntity();
if (entity != null) {
result = EntityUtils.toString(entity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
/**
* 发送HttpPost请求参数为map
* @param url
* @param map
* @return
*/
public static String sendPost(String url, Map<String, String> map) {
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
for (Map.Entry<String, String> entry : map.entrySet()) {
formparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
HttpPost httppost = new HttpPost(url);
httppost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httppost);
} catch (IOException e) {
e.printStackTrace();
}
HttpEntity entity1 = response.getEntity();
String result = null;
try {
result = EntityUtils.toString(entity1);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 发送不带参数的HttpPost请求
* @param url
* @return
*/
public static String sendPost(String url) {
HttpPost httppost = new HttpPost(url);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httppost);
} catch (IOException e) {
e.printStackTrace();
}
HttpEntity entity = response.getEntity();
String result = null;
try {
result = EntityUtils.toString(entity);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public static String doPost2(String url, JSONObject param) {
System.out.println("请求地址"+url);
HttpPost httpPost = null;
String result = null;
try {
HttpClient client = new DefaultHttpClient();
httpPost = new HttpPost(url);
if (param != null) {
StringEntity se = new StringEntity(param.toString(), "utf-8");
httpPost.setEntity(se); // post方法中加入json数据
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Authorization", param.getString("authorization"));
}
HttpResponse response = client.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, "utf-8");
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
}

+ 0
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/SmsClient.java View File

@ -23,7 +23,6 @@ public class SmsClient {
String response = client.sendSms("tairoudj", Arrays.asList(
new Message(phone, "【泰柔到家】您的验证码为:"+code)
), System.currentTimeMillis(), "evXRctaIoX22");
System.out.println(response);
return response;
}


+ 381
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/ValidateTool.java View File

@ -0,0 +1,381 @@
package org.jeecg.modules.utils;
import org.jeecg.common.exception.JeecgBootException;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ValidateTool {
public static boolean isEmpty(Collection coll) {
return coll == null || coll.isEmpty();
}
public static boolean isEmpty(CharSequence cs) {
return cs == null || cs.length() == 0;
}
public static boolean isNotEmpty(Collection coll) {
return !isEmpty(coll);
}
public static boolean isNotEmpty(CharSequence cs) {
return !isEmpty(cs);
}
/**
* 是否为空白字符串 字符串仅为空格回车换行制表符空字符串... 返回false
* @param cs
* @return
*/
public static boolean isBlank(CharSequence cs) {
int strLen = length(cs);
if (strLen == 0) {
return true;
} else {
for(int i = 0; i < strLen; ++i) {
if (!Character.isWhitespace(cs.charAt(i))) {
return false;
}
}
return true;
}
}
public static boolean isNotBlank(CharSequence cs) {
return !isBlank(cs);
}
public static int length(CharSequence cs) {
return cs == null ? 0 : cs.length();
}
/**
* 验证参数是否为空
*
* @param obj
* @return 不为?:true,为空false
* @throws
*/
public static boolean checkIsNull(Object obj) {
if (obj == null) {
return false;
}
if (obj instanceof String) {
if (((String) obj).trim().equals("")) {
return false;
}
}
return true;
}
public static boolean isNull(Object obj) {
if (obj == null) {
return true;
}
if (obj instanceof String) {
if (((String) obj).trim().equals("")) {
return true;
}
}
return false;
}
public static boolean isNotNull(Object obj) {
if (obj == null) {
return false;
}
if (obj instanceof String) {
if (((String) obj).trim().equals("")) {
return false;
}
}
return true;
}
// String regName = "^[A-Za-z0-9]{6,40}$";
// if (!userCustomerModel.getUsername().matches(regName)) {
// throw new JeecgBootException(MessageUtil.getMessage("COMMON_CHEECKNAME_ERROR_CODE"), MessageUtil.getMessage("COMMON_CHEECKNAME_ERROR"));
// }
public static boolean checkIsWX(String str){
//微信号码
// 微信号规则微信账号仅支持6-20个字母数字下划线或减号以字母开头解释一下只要是字母开头可以是纯字母hjqzHJQZhongjiqiezi或字母数字混合
String pattern = "^[a-zA-Z]{1}[-_a-zA-Z0-9]{5,19}+$";
boolean isMatch = Pattern.matches(pattern, str);
if (isMatch==false) {
throw new JeecgBootException("微信号不合法");
}
return true;
};
public static boolean checkIsQQ(String str){
//数字范围5-14个之间
String pattern = "[1-9][0-9]{4,14}";
boolean isMatch = Pattern.matches(pattern, str);
if (isMatch==false) {
throw new JeecgBootException("QQ号不合法");
}
return true;
}
//
//^[a-zA-Z][a-zA-Z0-9_]{4,15}$
public static boolean checkIsName(String str){
Pattern p = Pattern.compile("[\\u4e00-\\u9fa5]");
Matcher m = p.matcher(str);
if (m.matches()) {
return true;
} else {
throw new JeecgBootException("用户名不合法");
}
}
/**
* 验证参数长度
*
* @param code 参数名称
* @param obj
* @param begin
* @param end
* @return boolean
* @throws
*/
public static boolean checkParamLength(String code, Object obj, int begin, int end) {
if (!checkIsNull(obj)) {
throw new JeecgBootException(format("{0}不能为空,请确认", code));
}
if (obj instanceof String) {
if (!checkLength((String) obj, begin, end)) {
throw new JeecgBootException(format("验证码错误", code));
}
}
return true;
}
/**
* @description 验证参数是否为空以及参数长度是否符合要求
* @param code, obj, begin, end
* @return boolean
* @date 2019/6/24/024
*/
public static boolean checkParam(String code, Object obj, int begin, int end) {
if (!checkIsNull(obj)) {
throw new JeecgBootException(format("{0}不能为空,请确认", code));
}
if (obj instanceof String) {
if (!checkLength((String) obj, begin, end)) {
throw new JeecgBootException(format("{0}长度不符合格式", code));
}
}
return true;
}
public static String format(String message, Object... arg) {
MessageFormat formatter = new MessageFormat(message);
String output = formatter.format(arg);
return output;
}
public static int totalLength(String content) {
String regex = "[\u4e00-\u9fa5]";
int length = content.length();
int chineseLength = content.length() - content.replaceAll(regex, "").length();
return length+chineseLength;
}
/**
* @description 判断字符串是不是汉字
* @param: con
* @param: ignore 是否忽略 · 这个符号
* @return boolean
* @date 2019/9/20/020
*/
public static boolean isChinese(String con,boolean ignore) {
for (int i = 0; i < con.length(); i = i + 1) {
if (ignore){
if (!Pattern.compile("[\u4e00-\u9fa5]").matcher(
String.valueOf(con.charAt(i))).find() && !"·".equals(String.valueOf(con.charAt(i)))) {
return false;
}
}else {
if (!Pattern.compile("[\u4e00-\u9fa5]").matcher(
String.valueOf(con.charAt(i))).find()) {
return false;
}
}
}
return true;
}
/**
* @description 判断是不是中文或英文字母
* @param: con
* @return boolean
* @date 2019/9/20/020
*/
public static boolean conValidate(String con) {
if (null != con && !"".equals(con)) {
if ((isChinese(con,true) || con.matches("^[A-Za-z]+$"))) {
return true;
}
}
return false;
}
/**
* 验证参数长度
*
* @param code 参数名称
* @param obj
* @return boolean
* @throws
*/
public static boolean checkParamIsNull(String code, Object obj) {
if (!checkIsNull(obj)) {
throw new JeecgBootException(format("{0}不能为空,请确认", code));
}
return true;
}
public static boolean checkLength(String str, int begin, int end) {
if (str == null) {
return false;
}
if (str.length() <= end && str.length() >= begin) {
return true;
}
return false;
}
/**
* 验证是否为手机号?
*
* @throws JeecgBootException
*/
public static boolean checkParamIsMobile(String mobile) {
if (mobile == null || mobile == "") {
throw new JeecgBootException( "请填写手机号");
}
if (!isMobileNO(mobile)) {
throw new JeecgBootException( "手机号错误");
}
return true;
}
//验证手机号码格式
public static boolean isMobileNO(String mobiles) {
// if (mobiles == null ) {
// return false;
// }
// else {
// return true;
// }
if (!checkIsNull(mobiles)) {
return false;
}
String pattern = "(0|86)?(13[0-9]|14[0-9]|15[0-9]|16[012345689]|17[2-9]|18[0-9]|19[0-9])[0-9]{8}";
//手机号码
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(mobiles);
if (m.matches()) {
return true;
} else {
return false;
}
}
/**
* 验证输入的邮箱格式是否符合
*
* @param email
* @return 是否合法
*/
public static boolean emailFormat(String email) {
boolean tag = true;
final String pattern1 = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
final Pattern pattern = Pattern.compile(pattern1);
final Matcher mat = pattern.matcher(email);
if (!mat.find()) {
tag = false;
}
return tag;
}
public static boolean isNum(String code, String value) {
if (value == null) {
throw new JeecgBootException(format("{0}不能为空,请确认", code));
}
String pattern = "^[0-9]+$";
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(value);
if (!m.matches()) {
throw new JeecgBootException(format("{0}数据不符合格式", code));
}
return true;
}
public static boolean isBankCard(String value) {
if (isNull(value)) {
throw new JeecgBootException("银行卡号不能为空,请确认");
}
String pattern = "^[0-9]+$";
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(value);
if (!m.matches()) {
throw new JeecgBootException("银行卡号格式错误");
}
if (value.length()<16 || value.length()>19) {
throw new JeecgBootException("银行卡号格式错误");
}
return true;
}
public static boolean isDecimalValid(String code, String str, int start, int end) {
checkParamIsNull(code, str);
int s = 0;
try {
s = Integer.parseInt(str);
} catch (Exception e) {
throw new JeecgBootException(format("{0}数据不符合格式", code));
}
if (end == start) {
if (end == s) {
return true;
} else {
throw new JeecgBootException(format("{0}数据不符合格式", code));
}
} else {
if (s <= end && s >= start) {
return true;
}
}
throw new JeecgBootException(format("{0}数据不符合格式", code));
}
}

+ 4
- 0
jeecg-boot-module-system/src/main/resources/application-dev.yml View File

@ -12,6 +12,10 @@ server:
enabled: true
min-response-size: 1024
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
# 清除npm缓存
# npm cache clean --force
# 取消ssl验证:
# npm config set strict-ssl false
management:
endpoints:


Loading…
Cancel
Save