Commit e391e734 by 唐功亮

【新增】 厂商实名认证 第一二步 兼容变更业务

parent 982e7701
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -12,8 +14,11 @@ import io.office.modules.app.annotation.Login; ...@@ -12,8 +14,11 @@ import io.office.modules.app.annotation.Login;
import io.office.modules.manage.dao.MemberDao; import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.entity.MemberEntity; import io.office.modules.manage.entity.MemberEntity;
import io.office.modules.manage.entity.ProductEntity; import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.entity.TycpdmFirmChangeEntity;
import io.office.modules.manage.service.TycpdmFirmChangeService;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity; import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -28,6 +33,8 @@ import io.office.common.utils.PageUtils; ...@@ -28,6 +33,8 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.R; import io.office.common.utils.R;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
/** /**
* ${comments} * ${comments}
...@@ -43,6 +50,8 @@ public class TycpdmFirmController extends AbstractController { ...@@ -43,6 +50,8 @@ public class TycpdmFirmController extends AbstractController {
private TycpdmFirmService tycpdmFirmService; private TycpdmFirmService tycpdmFirmService;
@Autowired @Autowired
private TycpdmFirmChangeService tycpdmFirmChangeService;
@Autowired
private MemberDao memberDao; private MemberDao memberDao;
/* *//** /* *//**
* 列表 * 列表
...@@ -88,22 +97,52 @@ public class TycpdmFirmController extends AbstractController { ...@@ -88,22 +97,52 @@ public class TycpdmFirmController extends AbstractController {
/** /**
* 保存(保存企业信息) * 保存(保存企业信息)
* @param
* @param status 申请状态 1.新增 2.修改
* @return
*/ */
@RequestMapping("/authApi/save") @RequestMapping("/authApi/save")
// @RequiresPermissions("manage:tycpdmfirm:save") // @RequiresPermissions("manage:tycpdmfirm:save")
public R save(@RequestBody TycpdmFirmEntity tycpdmFirm){ public R save(@RequestBody Map body,@RequestParam("status")int status ) throws InvocationTargetException, IllegalAccessException {
String baseUser = tycpdmFirm.getBaseUser(); TycpdmFirmEntity tycpdmFirm = new TycpdmFirmEntity();
if (baseUser==null){ TycpdmFirmChangeEntity tycpdmFirmChangeEntity = new TycpdmFirmChangeEntity();
throw new RRException("用户名不能为空");
Integer id=0;
if (status==1){
BeanUtils.populate(tycpdmFirm, body);
String baseUser = tycpdmFirm.getBaseUser();
if (baseUser==null){
throw new RRException("用户名不能为空");
}
//第一步不存储状态 第二部存储
//tycpdmFirm.setLogoutFlag(0); //审核状态 0待审核 1审核成功 2审核失败
tycpdmFirmService.save(tycpdmFirm);
id = tycpdmFirm.getFId();
}else if (status==2){
Integer fId = Integer.valueOf(String.valueOf(body.get("fId")));
BeanUtils.populate(tycpdmFirmChangeEntity, body);
String baseUser = tycpdmFirmChangeEntity.getBaseUser();
if (baseUser==null){
throw new RRException("用户名不能为空");
}
tycpdmFirmChangeEntity.setFId(fId);
tycpdmFirmChangeService.save(tycpdmFirmChangeEntity);
id = tycpdmFirmChangeEntity.getId();
}else {
return R.error("请选择业务类型");
} }
//第一步不存储状态 第二部存储
//tycpdmFirm.setLogoutFlag(0); //审核状态 0待审核 1审核成功 2审核失败
tycpdmFirmService.save(tycpdmFirm);
return R.ok(); return R.ok().put("data",id);
} }
public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
MemberEntity memberEntity = new MemberEntity();
Map<String, Object> body = new HashMap<>();
body.put("username","xiaoz");
BeanUtils.populate(memberEntity, body);
System.out.println(memberEntity.getUsername());
}
/** /**
* 根据用户名获取企业认证信息 * 根据用户名获取企业认证信息
*/ */
...@@ -161,10 +200,18 @@ public class TycpdmFirmController extends AbstractController { ...@@ -161,10 +200,18 @@ public class TycpdmFirmController extends AbstractController {
*/ */
@RequestMapping("/authApi/uploadFile") @RequestMapping("/authApi/uploadFile")
// @RequiresPermissions("manage:tycpdmfirm:delete") // @RequiresPermissions("manage:tycpdmfirm:delete")
public R uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("id") Integer id){ public R uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("id") Integer id,@RequestParam("status") Integer status){
try { try {
tycpdmFirmService.uploadFile(file,id); if (status==1){
return R.ok(); tycpdmFirmService.uploadFile(file,id);
return R.ok();
}else if (status==2){
tycpdmFirmChangeService.uploadFile(file,id);
return R.ok();
}else {
return R.error("请前端人员传递业务类型 变更过新增");
}
} catch (Exception e) { } catch (Exception e) {
return R.error(e.getLocalizedMessage()); return R.error(e.getLocalizedMessage());
} }
...@@ -184,4 +231,22 @@ public class TycpdmFirmController extends AbstractController { ...@@ -184,4 +231,22 @@ public class TycpdmFirmController extends AbstractController {
return R.error(e.getLocalizedMessage()); return R.error(e.getLocalizedMessage());
} }
} }
/**
* 审批
*/
@RequestMapping("/authApi/audit")
// @RequiresPermissions("manage:tycpdmfirm:delete")
public R audit(@RequestBody Map map){
try {
tycpdmFirmService.audit(map);
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return R.ok();
}
} }
...@@ -3,6 +3,8 @@ package io.office.modules.manage.dao; ...@@ -3,6 +3,8 @@ package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TycpdmFirmChangeEntity; import io.office.modules.manage.entity.TycpdmFirmChangeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.repository.query.Param;
/** /**
* ${comments} * ${comments}
...@@ -13,5 +15,9 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -13,5 +15,9 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface TycpdmFirmChangeDao extends BaseMapper<TycpdmFirmChangeEntity> { public interface TycpdmFirmChangeDao extends BaseMapper<TycpdmFirmChangeEntity> {
@Update("UPDATE tycpdm_firm_change SET firm_archivesFile = #{firm_archivesFile} , logout_flag=#{logout_flag} WHERE id = #{id}")
void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag);
@Update("UPDATE tycpdm_firm_change SET logout_flag = #{logout_flag} WHERE id = #{id}")
void updateBYIdLogoutFlag(@Param("logout_flag") String logout_flag, @Param("id") String id);
} }
...@@ -32,4 +32,7 @@ public interface TycpdmFirmDao extends BaseMapper<TycpdmFirmEntity> { ...@@ -32,4 +32,7 @@ public interface TycpdmFirmDao extends BaseMapper<TycpdmFirmEntity> {
void updateByIdfirmArchivesFile(@Param("firm_archivesFile")String firm_archivesFile, @Param("id") Integer id, @Param("logout_flag")int logout_flag); 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); List<TycpdmFirmEntity> selectTycpdmFirmList(@org.apache.ibatis.annotations.Param("params")Map<String, Object> params, Page page);
@Update("UPDATE tycpdm_firm SET logout_flag = #{logout_flag} WHERE f_id = #{id}")
void updateBYIdLogoutFlag(@Param("logout_flag") String logout_flag, @Param("id") String id);
} }
...@@ -3,6 +3,7 @@ package io.office.modules.manage.service; ...@@ -3,6 +3,7 @@ package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.TycpdmFirmChangeEntity; import io.office.modules.manage.entity.TycpdmFirmChangeEntity;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map; import java.util.Map;
...@@ -16,5 +17,7 @@ import java.util.Map; ...@@ -16,5 +17,7 @@ import java.util.Map;
public interface TycpdmFirmChangeService extends IService<TycpdmFirmChangeEntity> { public interface TycpdmFirmChangeService extends IService<TycpdmFirmChangeEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
void uploadFile(MultipartFile file, Integer id);
} }
...@@ -10,6 +10,7 @@ import io.office.modules.sys.entity.SysUserEntity; ...@@ -10,6 +10,7 @@ import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -34,5 +35,6 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> { ...@@ -34,5 +35,6 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> {
Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page); Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page);
void audit(Map map) throws InvocationTargetException, IllegalAccessException;
} }
package io.office.modules.manage.service.impl; package io.office.modules.manage.service.impl;
import io.office.common.exception.RRException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -11,11 +19,23 @@ import io.office.common.utils.Query; ...@@ -11,11 +19,23 @@ import io.office.common.utils.Query;
import io.office.modules.manage.dao.TycpdmFirmChangeDao; import io.office.modules.manage.dao.TycpdmFirmChangeDao;
import io.office.modules.manage.entity.TycpdmFirmChangeEntity; import io.office.modules.manage.entity.TycpdmFirmChangeEntity;
import io.office.modules.manage.service.TycpdmFirmChangeService; import io.office.modules.manage.service.TycpdmFirmChangeService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import sun.dc.pr.PRError;
@Service("tycpdmFirmChangeService") @Service("tycpdmFirmChangeService")
public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao, TycpdmFirmChangeEntity> implements TycpdmFirmChangeService { public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao, TycpdmFirmChangeEntity> implements TycpdmFirmChangeService {
@Autowired
private TycpdmFirmChangeDao tycpdmFirmChangeDao;
@Value("${uploadFileQY}")
String uploadFileQY;
@Value("${uploadFileQYOne}")
String uploadFileQYOne;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<TycpdmFirmChangeEntity> page = this.page( IPage<TycpdmFirmChangeEntity> page = this.page(
...@@ -26,4 +46,42 @@ public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao ...@@ -26,4 +46,42 @@ public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao
return new PageUtils(page); return new PageUtils(page);
} }
@Override
@Transactional
public void uploadFile(MultipartFile file, Integer id) {
//删除原来的文件
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
String firmArchivesfile = tycpdmFirmChangeEntity.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
tycpdmFirmChangeDao.updateByIdfirmArchivesFile(uploadFileQY + uuid+substring,id,0);
//删除原来的照片
if (firmArchivesfile!=null){
File file1 = new File(firmArchivesfile);
if (file1.exists()){
file1.delete();
}
}
return ;
} catch (IOException e) {
dir.delete();
e.printStackTrace();
throw new RRException("上传失败");
}
}
} }
\ No newline at end of file
...@@ -3,17 +3,20 @@ package io.office.modules.manage.service.impl; ...@@ -3,17 +3,20 @@ package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.exception.RRException; import io.office.common.exception.RRException;
import io.office.modules.manage.dao.MemberDao; import io.office.modules.manage.dao.MemberDao;
import io.office.modules.manage.dao.TycpdmFirmChangeDao;
import io.office.modules.manage.dao.TycpdmVipUserDao; import io.office.modules.manage.dao.TycpdmVipUserDao;
import io.office.modules.manage.entity.MemberEntity; import io.office.modules.manage.entity.*;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.manage.entity.TycpdmVipUserEntity;
import io.office.modules.sys.entity.SysUserEntity; import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Id;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -26,8 +29,8 @@ import io.office.common.utils.PageUtils; ...@@ -26,8 +29,8 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.Query; import io.office.common.utils.Query;
import io.office.modules.manage.dao.TycpdmFirmDao; import io.office.modules.manage.dao.TycpdmFirmDao;
import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.manage.service.TycpdmFirmService; import io.office.modules.manage.service.TycpdmFirmService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -39,6 +42,9 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -39,6 +42,9 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
private TycpdmFirmDao tycpdmFirmDao; private TycpdmFirmDao tycpdmFirmDao;
@Autowired @Autowired
private TycpdmFirmChangeDao tycpdmFirmChangeDao;
@Autowired
private TycpdmVipUserDao tycpdmVipUserDao; private TycpdmVipUserDao tycpdmVipUserDao;
@Autowired @Autowired
...@@ -95,6 +101,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -95,6 +101,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
} }
@Override @Override
@Transactional
public void uploadFile(MultipartFile file, Integer id) { public void uploadFile(MultipartFile file, Integer id) {
//要删除原来的文件 //要删除原来的文件
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id); TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
...@@ -132,7 +139,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -132,7 +139,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
} }
return ; return ;
} catch (Exception e) { } catch (IOException e) {
dir.delete(); dir.delete();
e.printStackTrace(); e.printStackTrace();
throw new RRException("上传失败"); throw new RRException("上传失败");
...@@ -171,4 +178,44 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -171,4 +178,44 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
return page; return page;
} }
@Override
@Transactional
public void audit(Map map) throws InvocationTargetException, IllegalAccessException {
Integer status= map.get("status")==null?0: Integer.valueOf(String.valueOf(map.get("status")));//1.新增(新增时id为fId) 2.变更(id为fId)
String id= map.get("id")==null?"": String.valueOf(map.get("id"));//id
String auditStatus= map.get("auditStatus")==null?"": String.valueOf(map.get("auditStatus"));//审核状态 1.通过 2.不通过
//logout_flag
if (status==1){
//新增
//直接修改tycpmFirm表 状态
tycpdmFirmDao.updateBYIdLogoutFlag(auditStatus,id);
//在tycpdm_vip_user表中记录
if ("1".equals(auditStatus)){
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser();
String firmname = tycpdmFirmEntity.getFirmname();
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser));
}
}else if (status==2){
//变更
tycpdmFirmChangeDao.updateBYIdLogoutFlag(auditStatus,id);
if ("1".equals(auditStatus)){
//通过将变更表的数据同步到tycpdmFirm表
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
Integer fId = tycpdmFirmChangeEntity.getFId();
TycpdmFirmEntity tycpdmFirmEntity = new TycpdmFirmEntity();
Map testMap = new BeanMap(tycpdmFirmChangeEntity);
BeanUtils.populate(tycpdmFirmEntity, testMap);
//数据更新到tycpdmFirm表
tycpdmFirmDao.updateById(tycpdmFirmEntity);
tycpdmFirmEntity = tycpdmFirmDao.selectById(fId);
String baseUser = tycpdmFirmEntity.getBaseUser();
String firmname = tycpdmFirmEntity.getFirmname();
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser));
}
}
}
} }
\ 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