Commit 423e8f6b by rongkailun

Merge remote-tracking branch 'origin/master'

parents aa16dea5 67fb45b7
......@@ -61,7 +61,7 @@ public class ShiroConfig {
filterMap.put("/captcha.jpg", "anon");
filterMap.put("/aaa.txt", "anon");
//不需要登录的接口
filterMap.put("/*/api/**", "anon");
filterMap.put("/api/login", "anon");
filterMap.put("/**", "oauth2");
shiroFilter.setFilterChainDefinitionMap(filterMap);
......
......@@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.Map;
import io.office.modules.app.annotation.Login;
import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -30,7 +31,7 @@ import javax.servlet.http.HttpServletResponse;
*/
@RestController
@RequestMapping("/member")
public class MemberController {
public class MemberController extends AbstractController {
@Autowired
private MemberService memberService;
......@@ -107,9 +108,11 @@ public class MemberController {
* 修改
*/
@RequestMapping("/api/update")
@Login
// @RequiresPermissions("manage:member:update")
public R update(@RequestBody MemberEntity member){
MemberEntity memberUser = getMemberUser();
System.out.println(memberUser);
memberService.updateById(member);
return R.ok();
......
......@@ -3,6 +3,7 @@ package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -43,6 +44,7 @@ public class PlanBranchController {
}
/**
* 信息
*/
......@@ -87,4 +89,18 @@ public class PlanBranchController {
return R.ok();
}
@RequestMapping("/api/getList")
// @RequiresPermissions("manage:planbranch:delete")
public R getList(@RequestBody PlanBranchEntity planBranch){
QueryWrapper<PlanBranchEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("classnum",planBranch.getClassnum());
queryWrapper.orderByDesc("id");
return R.ok().put("data",planBranchService.list(queryWrapper));
}
}
package io.office.modules.manage.controller;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.exception.RRException;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
......@@ -19,7 +26,7 @@ import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.manage.service.TycpdmFirmService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import org.springframework.web.multipart.MultipartFile;
/**
......@@ -35,15 +42,37 @@ public class TycpdmFirmController extends AbstractController {
@Autowired
private TycpdmFirmService tycpdmFirmService;
@Autowired
private MemberDao memberDao;
/**
* 列表
*/
@RequestMapping("/list")
@RequestMapping("/api/list")
// @RequiresPermissions("manage:tycpdmfirm:list")
public R list(@RequestParam Map<String, Object> params){
@Login
public R list(@RequestBody Map<String, Object> params){
Object firmName = params.get("firmName");
if (firmName!=null){
firmName="'%"+firmName+"%'";
}
params.put("firmName",firmName);
PageUtils page = tycpdmFirmService.queryPage(params);
return R.ok().put("page", page);
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/api/findlist")
@Login
public R findlist(@RequestBody Map<String, Object> params){
Page<TycpdmFirmEntity> findlist = tycpdmFirmService.findlist(params,
new Page(Integer.valueOf(params.get("page").toString()),
Integer.valueOf(params.get("limit").toString())));
PageUtils pageUtils = new PageUtils(findlist);
return R.ok().put("data", pageUtils);
}
......@@ -64,7 +93,7 @@ public class TycpdmFirmController extends AbstractController {
@RequestMapping("/api/save")
@Login
// @RequiresPermissions("manage:tycpdmfirm:save")
public R save(@RequestBody TycpdmFirmEntity tycpdmFirm){
public R save(@RequestBody TycpdmFirmEntity tycpdmFirm,@RequestParam("file")MultipartFile file){
String baseUser = tycpdmFirm.getBaseUser();
if (baseUser==null){
throw new RRException("用户名不能为空");
......@@ -118,13 +147,45 @@ public class TycpdmFirmController extends AbstractController {
*/
@RequestMapping("/api/findTycpdmFirmLogoutFlagCount")
// @RequiresPermissions("manage:tycpdmfirm:delete")
public R findTycpdmFirmLogoutFlagCount(){
Integer id=getUserId().intValue();
@Login
public R findTycpdmFirmLogoutFlagCount(@RequestParam("userId") Integer userId){
/*Integer id=getMemberUserId().intValue();
if(id==null){
return R.error("用户信息有误");
}
SysUserEntity user = getUser();
Map<String,Integer> map=tycpdmFirmService.findTycpdmFirmLogoutFlagCount(user);
MemberEntity userMember = getMemberUser();*/
MemberEntity memberEntity = memberDao.selectById(userId);
Map<String,Integer> map=tycpdmFirmService.findTycpdmFirmLogoutFlagCount(memberEntity);
return R.ok().put("data",map);
}
/**
* 上传文件(第二步)
*/
@RequestMapping("/api/uploadFile")
// @RequiresPermissions("manage:tycpdmfirm:delete")
@Login
public R uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("id") Integer id){
try {
tycpdmFirmService.uploadFile(file,id);
return R.ok();
} catch (Exception e) {
return R.error(e.getLocalizedMessage());
}
}
/**
* 上传文件(第一步)
*/
@RequestMapping("/api/uploadFileOne")
// @RequiresPermissions("manage:tycpdmfirm:delete")
@Login
public R uploadFileOne(@RequestParam("file") MultipartFile file){
try {
String filePath = tycpdmFirmService.uploadFileOne(file);
return R.ok().put("data",filePath);
} catch (Exception e) {
return R.error(e.getLocalizedMessage());
}
}
}
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.TycpdmVipUserEntity;
import io.office.modules.manage.service.TycpdmVipUserService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-13 16:44:40
*/
@RestController
@RequestMapping("/tycpdmvipuser")
public class TycpdmVipUserController {
@Autowired
private TycpdmVipUserService tycpdmVipUserService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:tycpdmvipuser:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = tycpdmVipUserService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:tycpdmvipuser:info")
public R info(@PathVariable("id") Integer id){
TycpdmVipUserEntity tycpdmVipUser = tycpdmVipUserService.getById(id);
return R.ok().put("tycpdmVipUser", tycpdmVipUser);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:tycpdmvipuser:save")
public R save(@RequestBody TycpdmVipUserEntity tycpdmVipUser){
tycpdmVipUserService.save(tycpdmVipUser);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:tycpdmvipuser:update")
public R update(@RequestBody TycpdmVipUserEntity tycpdmVipUser){
tycpdmVipUserService.updateById(tycpdmVipUser);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:tycpdmvipuser:delete")
public R delete(@RequestBody Integer[] ids){
tycpdmVipUserService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Map;
/**
* ${comments}
*
......@@ -18,5 +23,13 @@ public interface TycpdmFirmDao extends BaseMapper<TycpdmFirmEntity> {
@Select("select * from tycpdm_firm where base_user=#{userName}")
TycpdmFirmEntity findUserName(@Param("userName") String userName);
Integer findTycpdmFirmLogoutFlagCountALL(@Param("levels")Integer levels);
Integer findTycpdmFirmLogoutFlagCountALL(@Param("levels")Integer levels,@Param("logout_flag")Integer logout_flag);
/* @Update("UPDATE tycpdm_firm SET firmBusinessLicenseFile = #{firmBusinessLicenseFile} , logout_flag=#{logout_flag} WHERE f_id = #{id}")
void updateByIdFirmBusinessLicenseFile(@Param("firmBusinessLicenseFile")String firmBusinessLicenseFile,@Param("id") Integer id,@Param("logout_flag")int logout_flag );
*/
@Update("UPDATE tycpdm_firm SET firm_archivesFile = #{firm_archivesFile} , logout_flag=#{logout_flag} WHERE f_id = #{id}")
void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag);
List<TycpdmFirmEntity> selectTycpdmFirmList(@org.apache.ibatis.annotations.Param("params")Map<String, Object> params, Page page);
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TycpdmVipUserEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-13 16:44:40
*/
@Mapper
public interface TycpdmVipUserDao extends BaseMapper<TycpdmVipUserEntity> {
}
......@@ -24,7 +24,7 @@ public class TimescodeRegiEntity implements Serializable {
/**
* 手机号
*/
@TableId(type = IdType.NONE)
@TableId(type = IdType.INPUT)
private String phone;
/**
* 时间
......
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-13 16:44:40
*/
@Data
@TableName("tycpdm_vip_user")
public class TycpdmVipUserEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private String fId;
/**
* $column.comments
*/
private String firmName;
/**
* $column.comments
*/
private String userId;
public TycpdmVipUserEntity(Integer id, String fId, String firmName, String userId) {
this.id = id;
this.fId = fId;
this.firmName = firmName;
this.userId = userId;
}
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
......@@ -20,6 +26,13 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> {
TycpdmFirmEntity findUserName(String userName);
Map<String, Integer> findTycpdmFirmLogoutFlagCount(SysUserEntity userEntity);
Map<String, Integer> findTycpdmFirmLogoutFlagCount(MemberEntity userEntity);
void uploadFile(MultipartFile file,Integer id);
String uploadFileOne(MultipartFile file);
Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page);
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.TycpdmVipUserEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-13 16:44:40
*/
public interface TycpdmVipUserService extends IService<TycpdmVipUserEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.exception.RRException;
import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.dao.TycpdmVipUserDao;
import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.entity.TycpdmVipUserEntity;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -17,6 +28,8 @@ import io.office.common.utils.Query;
import io.office.modules.manage.dao.TycpdmFirmDao;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.manage.service.TycpdmFirmService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;
@Service("tycpdmFirmService")
......@@ -26,8 +39,16 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
private TycpdmFirmDao tycpdmFirmDao;
@Autowired
private TycpdmVipUserDao tycpdmVipUserDao;
@Autowired
private MemberDao memberDao;
@Value("${uploadFileQY}")
String uploadFileQY;
@Value("${uploadFileQYOne}")
String uploadFileQYOne;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<TycpdmFirmEntity> page = this.page(
......@@ -44,16 +65,16 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}
@Override
public Map<String, Integer> findTycpdmFirmLogoutFlagCount(SysUserEntity userEntity) {
public Map<String, Integer> findTycpdmFirmLogoutFlagCount(MemberEntity userEntity) {
HashMap map = new HashMap<>();
String username = userEntity.getUsername();
//获取管理员是 中心管理员还是分中心管理员
Integer levels =memberDao.selectCode_agen(username); //用户权限 空.代表普通用户 0.代表中心管理员,1.代表校验管理员 其他4位.代表分中心管理员
if (levels==0){
}else if (levels==null){
if (levels==null){
throw new RRException("无权访问");
}else if (levels==0){
}else if (levels==1){
throw new RRException("无权访问");
}else if (String.valueOf(levels).length()==4){
......@@ -61,9 +82,93 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}else {
throw new RRException("无权访问");
}
Integer countAll=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levels);//查询 申请总数
//审核状态 0待审核 1审核成功 2审核失败
Integer countAll=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levels,null);//查询 申请总数
Integer auditCount=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levels,0);//查询 等待审核 0
Integer throughCount=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levels,1);//查询 通过审核 1
Integer notThroughCount=tycpdmFirmDao.findTycpdmFirmLogoutFlagCountALL(levels,2);//查询 未通过审核 2
map.put("countAll",countAll);
map.put("auditCount",auditCount);
map.put("throughCount",throughCount);
map.put("notThroughCount",notThroughCount);
return map;
}
@Override
public void uploadFile(MultipartFile file, Integer id) {
//要删除原来的文件
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String firmArchivesfile = tycpdmFirmEntity.getFirmArchivesfile();
if (file.isEmpty()) {
throw new RRException("上传失败,请选择文件");
}
File dir = new File(uploadFileQY);
if (!dir.exists()){
boolean mkdirs = dir.mkdirs();
System.out.println(mkdirs);
}
String fileName = file.getOriginalFilename();
String substring = fileName.substring(fileName.lastIndexOf("."));//文件后缀
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
File dest = new File(uploadFileQY + uuid+substring);
try {
file.transferTo(dest);
//保存路径 firm_archivesFile
tycpdmFirmDao.updateByIdfirmArchivesFile(uploadFileQY + uuid+substring,id,0);
//tycpdm_vip_user表中新增数据
/*TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser();
String firmname = tycpdmFirmEntity.getFirmname();
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser));*/
//删除原来的照片
if (firmArchivesfile!=null){
File file1 = new File(firmArchivesfile);
if (file1.exists()){
file1.delete();
}
}
return ;
} catch (Exception e) {
dir.delete();
e.printStackTrace();
throw new RRException("上传失败");
}
}
@Override
public String uploadFileOne(MultipartFile file) {
if (file.isEmpty()) {
throw new RRException("上传失败,请选择文件");
}
File dir = new File(uploadFileQYOne);
if (!dir.exists()){
boolean mkdirs = dir.mkdirs();
System.out.println(mkdirs);
}
String fileName = file.getOriginalFilename();
String substring = fileName.substring(fileName.lastIndexOf("."));//文件后缀
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
File dest = new File(uploadFileQYOne + uuid+substring);
try {
file.transferTo(dest);
return uploadFileQYOne + uuid+substring;
} catch (Exception e) {
dir.delete();
e.printStackTrace();
throw new RRException("上传失败");
}
}
@Override
public Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page) {
List<TycpdmFirmEntity> list = tycpdmFirmDao.selectTycpdmFirmList(params,page);
page.setRecords(list);
return page;
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.TycpdmVipUserDao;
import io.office.modules.manage.entity.TycpdmVipUserEntity;
import io.office.modules.manage.service.TycpdmVipUserService;
@Service("tycpdmVipUserService")
public class TycpdmVipUserServiceImpl extends ServiceImpl<TycpdmVipUserDao, TycpdmVipUserEntity> implements TycpdmVipUserService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<TycpdmVipUserEntity> page = this.page(
new Query<TycpdmVipUserEntity>().getPage(params),
new QueryWrapper<TycpdmVipUserEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@
package io.office.modules.sys.controller;
import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
......@@ -28,4 +29,12 @@ public abstract class AbstractController {
protected Long getUserId() {
return getUser().getUserId();
}
protected MemberEntity getMemberUser() {
return (MemberEntity) SecurityUtils.getSubject().getPrincipal();
}
protected Integer getMemberUserId() {
return getMemberUser().getId();
}
}
......@@ -56,7 +56,6 @@ public class OAuth2Realm extends AuthorizingRealm {
info = new SimpleAuthorizationInfo();
info.setStringPermissions(permsSet);
} else{
}
return info;
......
......@@ -77,3 +77,6 @@ renren:
# token有效时长,7天,单位秒
expire: 60480000
header: token
uploadFileQY: C:\upload_img\firm_archives_file\ #/第二步,电子表格上传路径(企业认证)
uploadFileQYOne: C:\upload_img\firmBusinessLicenseFile\ #第一步,营业执照上传路径(企业认证)
\ No newline at end of file
......@@ -53,14 +53,32 @@
<result property="servicetype" column="serviceType"/>
</resultMap>
<select id="findTycpdmFirmLogoutFlagCountALL" parameterType="java.lang.Integer">
<select id="findTycpdmFirmLogoutFlagCountALL" parameterType="java.lang.Integer" resultType="java.lang.Integer">
select count(*) from tycpdm_firm a left join tycpdm_user_service b on a.f_id=b.f_id
where branchcode='5305'
where 1=1
<if test="levels ==-99">
and branchcode=#{levels}
</if>
and logout_flag &lt; &gt;-1;
<if test="logout_flag !=null">
and logout_flag=#{logout_flag}
</if>
and logout_flag &lt;&gt;-1;
</select>
<select id="selectTycpdmFirmList" resultMap="tycpdmFirmMap" parameterType="java.util.Map">
select * from tycpdm_firm where 1=1
<if test="params.firmName !='' and params.firmName !=null">
and firmName like concat('%',#{params.firmName},'%')
</if>
<if test="params.logout_flag !='' and params.logout_flag !=null">
and logout_flag =#{params.logout_flag}
</if>
<if test="params.branchCode !='' and params.branchCode !=null">
and branchCode =#{params.branchCode}
</if>
</select>
</mapper>
\ No newline at end of file
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