Commit 84d6c851 by tianxinping

新增市场主体

parent bc78b961
......@@ -3,6 +3,7 @@ package com.hdw.api.base.enforcement.service;
import com.hdw.api.base.enforcement.entity.DaiyTasks;
import com.hdw.common.core.service.IBaseService;
/**
* Created by Administrator on 2020/12/3.
*/
......
package com.hdw.api.base.system.dto;
import com.hdw.common.core.vo.ExcelColumn;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* Created by Administrator on 2020/12/7.
*/
@Data
public class SysUserExcelDto {
private Long id;
/**
* 用户名
*/
@ExcelColumn(value = "姓名", col = 1)
@ApiModelProperty(value = "用户名")
private String name;
/**
* 性别(0:男,1:女)
*/
@ExcelColumn(value = "性别", col = 2)
@ApiModelProperty(value = "性别(0:男,1:女)")
private Integer sex;
/**
* 所属企业
*/
@ApiModelProperty(value = "所属企业")
private Long enterpriseName;
private Long enterpriseId;
/**
* 所属部门
*/
@ExcelColumn(value = "部门(所属科室)", col = 3)
@ApiModelProperty(value = "所属部门")
private String departmentName;
private Long departmentId;
/**
* 用户职务
*/
@ExcelColumn(value = "职务", col = 4)
@ApiModelProperty(value = "用户职务")
private String jobName;
private Long jobId;
@ApiModelProperty(value = "执法证号")
@ExcelColumn(value = "企业名称", col = 5)
private Integer marshalsNo;
@ApiModelProperty(value = "身份证号")
@ExcelColumn(value = "企业名称", col = 6)
private Integer cardNo;
/**
* 手机号
*/
@ApiModelProperty(value = "手机号")
@ExcelColumn(value = "企业名称", col = 7)
private String phone;
}
......@@ -126,6 +126,14 @@ public class SysUser implements Serializable {
@TableField("is_leader")
private Integer isLeader;
@ApiModelProperty(value = "执法证号")
@TableField("marshals_no")
private Integer marshalsNo;
@ApiModelProperty(value = "身份证号")
@TableField("card_no")
private Integer cardNo;
@ApiModelProperty(value = "是否执法人员(0-是,1-否)")
@TableField("is_agents")
......@@ -163,6 +171,9 @@ public class SysUser implements Serializable {
@TableField(exist = false)
private List<Long> enterpriseIdList;
public SysUser() {
}
/**
* 获取:主键id
......@@ -438,4 +449,20 @@ public class SysUser implements Serializable {
public Integer getIsAgents() {
return isAgents;
}
public Integer getMarshalsNo() {
return marshalsNo;
}
public void setMarshalsNo(Integer marshalsNo) {
this.marshalsNo = marshalsNo;
}
public Integer getCardNo() {
return cardNo;
}
public void setCardNo(Integer cardNo) {
this.cardNo = cardNo;
}
}
......@@ -89,6 +89,10 @@ public class UserVo implements Serializable {
@ApiModelProperty(value = "是否执法人员(0-是,1-否)")
private Integer isAgents;
@ApiModelProperty(value = "执法证号")
private Integer marshalsNo;
@ApiModelProperty(value = "身份证号")
private Integer cardNo;
/**
* 创建时间
*/
......
package com.hdw.server.base.enforcement.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hdw.api.base.enforcement.entity.DaiyTasks;
import com.hdw.common.core.dto.CommonDto;
import com.hdw.common.core.mapper.SuperMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.formula.functions.T;
/**
* @Description 日常检查任务
......@@ -10,6 +15,6 @@ import com.hdw.common.core.mapper.SuperMapper;
* @Date 2020-12-03 15:12:41
*/
public interface DaiyTasksMapper extends SuperMapper<DaiyTasks> {
IPage<T> queryList(Page<T> page, @Param("ew") CommonDto commonDto);
}
......@@ -4,6 +4,81 @@
<mapper namespace="com.hdw.server.base.enforcement.mapper.DaiyTasksMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hdw.api.base.enforcement.entity.DaiyTasks" >
<result column="id" property="id" />
<result column="party_name" property="partyName" />
<result column="party_address" property="partyAddress" />
<result column="business_address" property="businessAddress" />
<result column="market_type" property="marketType" />
<result column="licence_type" property="licenceType" />
<result column="licence_num" property="licenceNum" />
<result column="org_code" property="orgCode" />
<result column="legal_name" property="legalName" />
<result column="legal_sex" property="legalSex" />
<result column="card_type" property="cardType" />
<result column="card_num" property="cardNum" />
<result column="telphone" property="telphone" />
<result column="director_name" property="directorName" />
<result column="director_post" property="directorPost" />
<result column="director_phone" property="directorPhone" />
<result column="check_area" property="checkArea" />
<result column="check_address" property="checkAddress" />
<result column="checker" property="checker" />
<result column="check_time" property="checkTime" />
</resultMap>
<!-- 自定义分页 -->
<select id="pageList" resultMap="BaseResultMap">
select
t.id ,
t.party_name ,
t.party_address ,
t.business_address ,
t.market_type ,
t.licence_type ,
t.licence_num ,
t.org_code ,
t.legal_name ,
t.legal_sex ,
t.card_type ,
t.card_num ,
t.telphone ,
t.director_name ,
t.director_post ,
t.director_phone ,
t.check_area ,
t.check_address ,
t.checker ,
t.check_time
from daiy_tasks t
</select>
<!-- 多表信息查询 -->
<select id="queryList" resultMap="BaseResultMap">
select
t.id ,
t.party_name ,
t.party_address ,
t.business_address ,
t.market_type ,
t.licence_type ,
t.licence_num ,
t.org_code ,
t.legal_name ,
t.legal_sex ,
t.card_type ,
t.card_num ,
t.telphone ,
t.director_name ,
t.director_post ,
t.director_phone ,
t.check_area ,
t.check_address ,
t.checker ,
t.check_time
from daiy_tasks t
</select>
</mapper>
\ No newline at end of file
package com.hdw.server.base.enforcement.service;
import com.hdw.api.base.enforcement.entity.DaiyTasks;
import com.hdw.common.core.service.IBaseService;
/**
* 日常检查任务
*
* @Author JacksonTu
* @Date 2020-12-03 15:12:41
*/
public interface IDaiyTasksService extends IBaseService<DaiyTasks> {
}
package com.hdw.server.base.enforcement.service.impl;
import com.hdw.api.base.enforcement.entity.DaiyTasks;
import com.hdw.api.base.enforcement.service.IDaiyTasksService;
import com.hdw.common.core.service.impl.BaseServiceImpl;
import com.hdw.server.base.enforcement.mapper.DaiyTasksMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.transaction.annotation.Transactional;
import com.hdw.api.base.enforcement.service.IDaiyTasksService;
/**
* 日常检查任务
*
......
package com.hdw.server.base.market.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hdw.api.base.market.entity.Market;
import com.hdw.common.core.dto.CommonDto;
import com.hdw.common.core.mapper.SuperMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.formula.functions.T;
/**
* @Description market
......@@ -9,6 +14,6 @@ import com.hdw.common.core.mapper.SuperMapper;
* @Date 2020-12-02 16:29:49
*/
public interface MarketMapper extends SuperMapper<Market> {
IPage<T> queryList(Page<T> page, @Param("ew") CommonDto commonDto);
}
<?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="com.hdw.server.base.job.mapper.MarketMapper">
<mapper namespace="com.hdw.server.base.market.mapper.MarketMapper">
<resultMap id="BaseResultMap" type="com.hdw.api.base.market.entity.Market" >
<result column="id" property="id" />
<result column="name" property="name" />
<result column="code" property="code" />
<result column="address" property="address" />
<result column="legal_person" property="legalPerson" />
<result column="encompass" property="encompass" />
<result column="industry" property="industry" />
<result column="type" property="type" />
<result column="create_time" property="createTime" />
</resultMap>
<!-- 自定义分页 -->
<select id="pageList" resultMap="BaseResultMap">
select
t.id ,
t.name ,
t.code ,
t.address ,
t.legal_person ,
t.encompass ,
t.industry ,
t.type ,
t.create_time
from t_market t
</select>
<select id="queryList" resultMap="BaseResultMap">
select
t.id ,
t.name ,
t.code ,
t.address ,
t.legal_person ,
t.encompass ,
t.industry ,
t.type ,
t.create_time
from t_market t
</select>
</mapper>
\ No newline at end of file
......@@ -16,9 +16,10 @@ import org.springframework.transaction.annotation.Transactional;
* @Date 2020-12-02 16:29:49
*/
@Slf4j
@DubboService
@DubboService(interfaceName = "IMarketService")
@Transactional(rollbackFor = Exception.class)
public class MarketServiceImpl extends BaseServiceImpl<MarketMapper, Market> implements IMarketService {
}
......@@ -15,7 +15,6 @@ import java.util.List;
public interface SysUserMapper extends SuperMapper<SysUser> {
SysUser selectByLoginName(@Param("loginName") String loginName);
/**
* 查询用户的所有菜单ID
*
......
......@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Arrays;
import java.util.List;
/**
......@@ -44,7 +44,15 @@ public class DaiyTasksController {
@ApiOperation(value = "日常检查任务分页列表", notes = "日常检查任务分页列表")
@GetMapping("/list")
@RequiresPermissions("daiyTasks/list")
public CommonResult<PageVo<DaiyTasks>> treeGrid(CommonDto commonDto) {
public CommonResult<List<DaiyTasks>> treeGrid(CommonDto commonDto) {
List<DaiyTasks> page = daiyTasksService.list();
return CommonResult.success(page);
}
@GetMapping("/query")
public CommonResult<PageVo<DaiyTasks>> query(CommonDto commonDto) {
PageVo<DaiyTasks> page = daiyTasksService.pageList(commonDto);
return CommonResult.success(page);
}
......
......@@ -97,7 +97,7 @@ public class EnterpriseController extends UpLoadController {
enterprise.setCreateTime(new Date());
enterprise.setCreateUser(ShiroUtil.getUser().getLoginName());
boolean b = enterpriseService.save(enterprise);
saveFile(enterprise.getId().toString());
//saveFile(enterprise.getId().toString());
if (b) {
return CommonResult.success("添加成功");
} else {
......
......@@ -6,10 +6,12 @@ import com.hdw.api.base.market.entity.Market;
import com.hdw.api.base.market.service.IMarketService;
import com.hdw.common.core.annotation.AutoLog;
import com.hdw.common.core.api.CommonResult;
import com.hdw.common.core.constant.CommonConstant;
import com.hdw.common.core.dto.CommonDto;
import com.hdw.common.core.exception.BaseException;
import com.hdw.common.core.utils.ExcelUtils;
import com.hdw.common.core.vo.PageVo;
import com.hdw.web.base.shiro.ShiroUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
......@@ -34,7 +36,7 @@ import java.util.List;
@Slf4j
@Api(value = "市场主体接口", tags = {"市场主体接口"})
@RestController
@RequestMapping("sys/market")
@RequestMapping("/market")
public class MarketController {
@DubboReference
private IMarketService tMarketService;
......@@ -48,8 +50,13 @@ public class MarketController {
@AutoLog(value = "market-分页列表查询")
@ApiOperation(value = "market分页列表", notes = "market分页列表")
@GetMapping("/list")
@RequiresPermissions("sys/market/list")
@RequiresPermissions("market/market/list")
public CommonResult<PageVo<Market>> treeGrid(CommonDto commonDto) {
Long currUserId = ShiroUtil.getUser().getId();
if (currUserId != CommonConstant.SUPER_ADMIN) {
//非管理员查看自己和自己创建的账号
}
PageVo<Market> page = tMarketService.pageList(commonDto);
return CommonResult.success(page);
}
......@@ -57,11 +64,10 @@ public class MarketController {
/**
* 获取market信息
*/
@AutoLog(value = "market-获取market信息")
@ApiOperation(value = "获取market信息", notes = "获取market信息")
@ApiImplicitParam(paramType = "path", name = "id", value = "主键ID", dataType = "Integer", required = true)
@GetMapping("/info/{id}")
@RequiresPermissions("sys/market/info")
@RequiresPermissions("market/market/info")
public CommonResult<Market> info(@PathVariable("id") Integer id){
Market tMarket = tMarketService.getById(id);
return CommonResult.success(tMarket);
......@@ -73,7 +79,7 @@ public class MarketController {
@AutoLog(value = "market-保存market信息")
@ApiOperation(value = "保存market信息", notes = "保存market信息")
@PostMapping("/save")
/*@RequiresPermissions("sys/market/save")*/
@RequiresPermissions("market/market/save")
public CommonResult save(@Valid @RequestBody Market tMarket) {
try {
tMarket.setCreateTime(new Date());
......@@ -91,7 +97,7 @@ public class MarketController {
@AutoLog(value = "market-修改market信息")
@ApiOperation(value = "修改market信息", notes = "修改market信息")
@PostMapping("/update")
@RequiresPermissions("sys/market/update")
@RequiresPermissions("market/market/update")
public CommonResult update(@Valid @RequestBody Market tMarket) {
try {
......@@ -110,7 +116,7 @@ public class MarketController {
@ApiOperation(value = "删除market信息", notes = "删除market信息")
@ApiImplicitParam(paramType = "query", name = "ids", value = "ID数组", dataType = "Integer", required = true, allowMultiple = true)
@PostMapping("/delete")
@RequiresPermissions("sys/market/delete")
@RequiresPermissions("market/market/delete")
public CommonResult delete(@RequestBody Integer[]ids) {
try {
tMarketService.removeByIds(Arrays.asList(ids));
......@@ -125,18 +131,36 @@ public class MarketController {
*
* @param file
*/
@AutoLog(value = "market-导入market信息")
@ApiOperation(value = "导入market信息", notes = "导入market信息")
@RequestMapping(value = "/readExcel", method = RequestMethod.POST)
@ApiImplicitParam(paramType = "formData", dataType="file", name = "file",
value = "材料文件啊", required = false)
public void readExcel(@RequestParam(value="file", required = false) MultipartFile file){
public void readExcel(@RequestParam(value="file", required = false) MultipartFile[] file){
long t1 = System.currentTimeMillis();
List<MarketDto> list = ExcelUtils.readExcel("", MarketDto.class, file);
long t2 = System.currentTimeMillis();
System.out.println(String.format("read over! cost:%sms", (t2 - t1)));
List<MarketDto> list = null;
for (int i= 0;i < file.length;i++){
list = ExcelUtils.readExcel("", MarketDto.class, file[i]);
list.forEach(
b -> System.out.println(JSON.toJSONString(b))
b -> {
Market tMarket = new Market();
tMarket.setCreateTime(new Date());
tMarket.setAddress(b.getAddress());
tMarket.setCode(b.getCode());
tMarket.setEncompass(b.getEncompass());
tMarket.setIndustry(b.getIndustry());
tMarket.setLegalPerson(b.getLegalPerson());
tMarket.setName(b.getName());
tMarket.setType(b.getType());
tMarketService.save(tMarket);
System.out.println(JSON.toJSONString(b));
}
);
}
long t2 = System.currentTimeMillis();
System.out.println(String.format("read over! cost:%sms", (t2 - t1)));
}
}
......@@ -64,6 +64,7 @@ public class JwtRealm extends AuthorizingRealm {
//TODO: 设置用户拥有的权限集合
Set<String> permissionSet = userService.selectUserPermissions(userId);
info.addStringPermissions(permissionSet);
log.info("===============权限认证开始============ [ roles、permissions]==========");
log.info("===============Shiro权限认证成功==============");
return info;
}
......@@ -78,7 +79,7 @@ public class JwtRealm extends AuthorizingRealm {
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
log.info("===============Shiro登录认证开始============");
log.info("===============登录认证开始============");
//TODO: 校验token
String token = (String) authenticationToken.getCredentials();
if (StringUtils.isEmpty(token)) {
......@@ -103,7 +104,7 @@ public class JwtRealm extends AuthorizingRealm {
if (!jwtTokenUtil.validateToken(token, username)) {
throw new AuthenticationException("Token失效,请重新登录!");
}
log.info("===============Shiro登录认证成功============");
log.info("===============登录认证成功============");
return new SimpleAuthenticationInfo(loginUserVoVo, token, getName());
}
......
......@@ -47,10 +47,7 @@ public class ShiroJwtConfig {
@Value("${spring.application.name}")
private String cacheKeyPrefix;
@Bean
public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
/**
* Filter Chain定义说明
......@@ -133,9 +130,10 @@ public class ShiroJwtConfig {
public DefaultWebSecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setCacheManager(shiroRedisCacheManager());
securityManager.setRealm(jwtRealm());
securityManager.setSubjectDAO(subjectDAO());
securityManager.setSessionManager(sessionManager());
securityManager.setRealm(jwtRealm());
return securityManager;
}
......@@ -238,5 +236,9 @@ public class ShiroJwtConfig {
return advisor;
}
@Bean
public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
}
......@@ -55,7 +55,7 @@ public class JwtFilter extends AuthenticatingFilter {
HttpServletRequest httpRequest = (HttpServletRequest) request;
//获取请求token,如果token不存在,直接返回401
String token = getRequestToken((HttpServletRequest) request);
log.info("过滤");
log.info("===============token: {}============", token);
if (StringUtils.isBlank(token)) {
HttpServletResponse httpResponse = (HttpServletResponse) response;
......
package com.hdw.web.base.system.controller;
import com.alibaba.fastjson.JSON;
import com.hdw.api.base.enterprise.service.IEnterpriseDepartmentService;
import com.hdw.api.base.enterprise.service.IEnterpriseJobService;
import com.hdw.api.base.system.dto.SysUserExcelDto;
import com.hdw.api.base.system.dto.UserDto;
import com.hdw.api.base.system.entity.SysUser;
import com.hdw.api.base.system.service.ISysUserEnterpriseService;
......@@ -9,6 +13,7 @@ import com.hdw.api.base.system.vo.UserVo;
import com.hdw.common.core.api.CommonResult;
import com.hdw.common.core.constant.CommonConstant;
import com.hdw.common.core.exception.BaseException;
import com.hdw.common.core.utils.ExcelUtils;
import com.hdw.common.core.validator.group.CreateGroup;
import com.hdw.common.core.validator.group.UpdateGroup;
import com.hdw.common.core.vo.LoginUserVo;
......@@ -27,6 +32,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Date;
......@@ -50,6 +56,12 @@ public class SysUserController {
@DubboReference
private ISysUserEnterpriseService sysUserEnterpriseService;
@DubboReference
private IEnterpriseJobService enterpriseJobService;
@DubboReference
private IEnterpriseDepartmentService enterpriseDepartmentService;
/**
* 所有用户列表
......@@ -210,4 +222,25 @@ public class SysUserController {
throw new BaseException("运行异常,请联系管理员");
}
}
@ApiOperation(value = "导入user信息", notes = "导入user信息")
@RequestMapping(value = "/readExcel", method = RequestMethod.POST)
@ApiImplicitParam(paramType = "formData", dataType="file", name = "file",
value = "文件", required = false)
public void readExcel(@RequestParam(value="file", required = false) MultipartFile[] file){
long t1 = System.currentTimeMillis();
List<SysUserExcelDto> list = null;
for (int i= 0;i < file.length;i++){
list = ExcelUtils.readExcel("", SysUserExcelDto.class, file[i]);
list.forEach(
b -> {
// enterpriseDepartmentService.selectEnterpriseDepartmentList()
System.out.println(JSON.toJSONString(b));
}
);
}
long t2 = System.currentTimeMillis();
System.out.println(String.format("read over! cost:%sms", (t2 - t1)));
}
}
server:
port: 8190
servlet:
context-path: /
context-path: /byzf
tomcat:
uri-encoding: UTF-8
max-connections: 1000
......@@ -62,7 +62,7 @@ hdw:
tokenHeader: Authorization #JWT存储的请求头
tokenHead: Bearer #JWT负载中拿到开头
secret: sb-security #JWT加解密使用的密钥
expiration: 604800 #JWT的超期限时间(60*60*24*7)
expiration: 3600 #JWT的超期限时间(60*60*24*7)
# swagger配置
swagger2:
enabled: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment