Commit 80884866 by 唐功亮

【修改】 个人中心BUG

parent ba384dc0
......@@ -34,6 +34,8 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
......@@ -107,43 +109,9 @@ public class TycpdmFirmController extends AbstractController {
@RequestMapping("/authApi/save")
// @RequiresPermissions("manage:tycpdmfirm:save")
public R save(@RequestBody Map body) throws InvocationTargetException, IllegalAccessException {
TycpdmFirmEntity tycpdmFirm = new TycpdmFirmEntity();
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = new TycpdmFirmChangeEntity();
Integer status = body.get("status")==null?0:Integer.valueOf(String.valueOf(body.get("status")));
Integer id=0;
if (status==1){
BeanUtils.populate(tycpdmFirm, body);
String baseUser = tycpdmFirm.getBaseUser();
if (baseUser==null){
throw new RRException("用户名不能为空");
}
String firmname = tycpdmFirm.getFirmname();
if (firmname==null||"".equals(tycpdmFirm)){
throw new RRException("企业名称不能为空");
}
int count=tycpdmFirmDao.selectByIdFirmName(firmname,1);
if (count>0){
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("请选择业务类型");
}
MemberEntity memberUser = getMemberUser();
Integer id= tycpdmFirmService.saveTycpdmFirmInfo(body,memberUser.getUsername());
return R.ok().put("data",id);
}
......@@ -161,10 +129,13 @@ public class TycpdmFirmController extends AbstractController {
@RequestMapping("/authApi/findUserName")
// @RequiresPermissions("manage:tycpdmfirm:save")
public R findUserName(@RequestParam("userName") String userName){
TycpdmFirmEntity tycpdmFirmEntity=tycpdmFirmService.findUserName(userName);
return R.ok().put("data",tycpdmFirmEntity);
//查询 业务类型 1.首次 2.变更
int logoutFlag=tycpdmFirmService.findLogoutFlag(userName);
JSONObject tycpdmFirmEntity=tycpdmFirmService.findUserName(logoutFlag,userName);
R ok = R.ok();
tycpdmFirmEntity.put("status",logoutFlag);
ok.put("data",tycpdmFirmEntity);
return ok;
}
/**
......@@ -251,8 +222,9 @@ public class TycpdmFirmController extends AbstractController {
@RequestMapping("/authApi/audit")
// @RequiresPermissions("manage:tycpdmfirm:delete")
public R audit(@RequestBody Map map){
Integer memberUserId = getMemberUserId();
try {
tycpdmFirmService.audit(map);
tycpdmFirmService.audit(map,memberUserId);
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
......@@ -261,4 +233,23 @@ public class TycpdmFirmController extends AbstractController {
return R.ok();
}
/**
* 根据文件地址返回文件
*/
@RequestMapping("/authApi/returnFile")
public R returnFile(@RequestBody Map<String, Object> params, HttpServletResponse response){
tycpdmFirmService.returnFile(params,response);
return R.ok();
}
/**
* 切换分中心管理员
*/
@RequestMapping("/authApi/updateSystem")
public R updateSystem(@RequestBody Map<String, Object> params){
tycpdmFirmService.updateSystem(params);
return R.ok();
}
}
......@@ -42,6 +42,9 @@ public interface MemberDao extends BaseMapper<MemberEntity> {
@Update("UPDATE member SET phone = #{phone} WHERE id = #{id}")
void updateByIDPhone(@Param("id") Integer id,@Param("phone") String phone);
@Update("UPDATE member SET Applystate = #{applystate} WHERE username = #{userName}")
void updateByIdApplystate(@Param("applystate") String applystate,@Param("userName")String userName);
/*@Select("select * from member where username=#{userName} or firmcode=#{userName}")
MemberEntity selectByNameAndSn(@Param("userName") String userName);*/
......
......@@ -31,7 +31,10 @@ public interface TycpdmFirmChangeDao extends BaseMapper<TycpdmFirmChangeEntity>
List<TycpdmFirmChangeEntity> selectTycpdmFirmList(Map<String, Object> params, Page page);
@Select("select * from tycpdm_firm_change where base_user=#{userName}")
TycpdmFirmChangeEntity findUserName(@Param("userName") String userName);
@Select("select * from tycpdm_firm_change where base_user=#{userName} ORDER BY id DESC")
List<TycpdmFirmChangeEntity> findUserName(@Param("userName") String userName);
@Update("UPDATE tycpdm_firm_change SET branchCode = #{branchCode} WHERE id = #{id}")
void updateByIdBranchCode(@Param("id") Integer id,@Param("branchCode") Integer branchCode);
}
......@@ -20,8 +20,8 @@ import java.util.Map;
*/
@Mapper
public interface TycpdmFirmDao extends BaseMapper<TycpdmFirmEntity> {
@Select("select * from tycpdm_firm where base_user=#{userName}")
TycpdmFirmEntity findUserName(@Param("userName") String userName);
@Select("select * from tycpdm_firm where base_user=#{userName} ")
TycpdmFirmEntity findUserName(@Param("userName") String userName);
Integer findTycpdmFirmLogoutFlagCountALL(@Param("levels")Integer levels,@Param("logout_flag")Integer logout_flag);
......@@ -38,4 +38,8 @@ public interface TycpdmFirmDao extends BaseMapper<TycpdmFirmEntity> {
@Select("select count(1) from tycpdm_firm where firmName=#{firmname} and logout_flag=#{logout_flag}")
int selectByIdFirmName(@Param("firmname")String firmname, @Param("logout_flag")int logout_flag);
@Update("UPDATE tycpdm_firm SET branchCode = #{branchCode} WHERE f_id = #{id}")
void updateByIdBranchCode(@Param("id") Integer id,@Param("branchCode") Integer branchCode);
}
package io.office.modules.manage.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
......@@ -9,6 +10,8 @@ import io.office.modules.manage.entity.TycpdmFirmEntity;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
......@@ -25,7 +28,7 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> {
PageUtils queryPage(Map<String, Object> params);
TycpdmFirmEntity findUserName(String userName);
JSONObject findUserName(Integer logoutFlag, String userName);
Map<String, Integer> findTycpdmFirmLogoutFlagCount(MemberEntity userEntity);
......@@ -35,6 +38,14 @@ public interface TycpdmFirmService extends IService<TycpdmFirmEntity> {
Page<TycpdmFirmEntity> findlist(Map<String, Object> params, Page page);
void audit(Map map) throws InvocationTargetException, IllegalAccessException;
void audit(Map map,Integer memberUserId) throws InvocationTargetException, IllegalAccessException;
int findLogoutFlag(String userName);
Integer saveTycpdmFirmInfo(Map body,String userName) throws InvocationTargetException, IllegalAccessException;
void returnFile(Map<String, Object> params, HttpServletResponse response) ;
void updateSystem(Map<String, Object> params);
}
......@@ -93,7 +93,7 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
if (levels==null){
if (userType==3){
//判断是否通过企业认证
if ("通过审核".equals(applystate)){
if ("通过审核".equals(applystate.substring(0,4))){
isQY=1;
}
//判断是否是系统成员
......
......@@ -96,7 +96,7 @@ public class TycpdmFirmChangeServiceImpl extends ServiceImpl<TycpdmFirmChangeDao
@Override
public TycpdmFirmChangeEntity findUserName(String userName) {
return tycpdmFirmChangeDao.findUserName(userName);
return tycpdmFirmChangeDao.findUserName(userName).get(0);
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.org.apache.xml.internal.security.Init;
import io.office.common.exception.RRException;
import io.office.common.utils.R;
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.entity.*;
import io.office.modules.manage.service.TycpdmFirmChangeService;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.beanutils.BeanUtils;
......@@ -15,6 +19,8 @@ import org.springframework.data.annotation.Id;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
......@@ -31,9 +37,12 @@ import io.office.common.utils.Query;
import io.office.modules.manage.dao.TycpdmFirmDao;
import io.office.modules.manage.service.TycpdmFirmService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@Service("tycpdmFirmService")
public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirmEntity> implements TycpdmFirmService {
......@@ -50,6 +59,9 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Autowired
private MemberDao memberDao;
@Autowired
private TycpdmFirmChangeService tycpdmFirmChangeService;
@Value("${uploadFileQY}")
String uploadFileQY;
......@@ -66,8 +78,38 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}
@Override
public TycpdmFirmEntity findUserName(String userName) {
return tycpdmFirmDao.findUserName(userName);
public JSONObject findUserName(Integer logoutFlag, String userName) {
JSONObject jsonObject = new JSONObject();
if (logoutFlag==1){
//首次
TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName);
jsonObject.put("data",tycpdmFirm);
}else if (logoutFlag==2){
//变更
List<TycpdmFirmChangeEntity> tycpdmFirmChange = tycpdmFirmChangeDao.findUserName(userName);
if (tycpdmFirmChange==null||tycpdmFirmChange.size()==0){
TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName);
jsonObject.put("data",tycpdmFirm);
return jsonObject;
}else{
Integer logoutFlag1 = tycpdmFirmChange.get(0).getLogoutFlag();
if (logoutFlag1==null){
jsonObject.put("data",tycpdmFirmChange.get(0));
return jsonObject;
}
if (tycpdmFirmChange.get(0).getLogoutFlag()==1){
TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName);
jsonObject.put("data",tycpdmFirm);
}else if (tycpdmFirmChange.get(0).getLogoutFlag()==0||tycpdmFirmChange.get(0).getLogoutFlag()==2){
jsonObject.put("data",tycpdmFirmChange.get(0));
}else {
throw new RRException("业务类型错误!");
}
}
}else {
throw new RRException("业务类型错误!");
}
return jsonObject;
}
@Override
......@@ -190,7 +232,7 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Override
@Transactional
public void audit(Map map) throws InvocationTargetException, IllegalAccessException {
public void audit(Map map,Integer memberUserId) 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.不通过
......@@ -206,6 +248,12 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
String firmname = tycpdmFirmEntity.getFirmname();
tycpdmVipUserDao.insert(new TycpdmVipUserEntity(null,id+"",firmname,baseUser));
}
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
String baseUser = tycpdmFirmEntity.getBaseUser();
if (auditStatus.equals("1")){
memberDao.updateByIdApplystate("通过审核",baseUser);
}
}else if (status==2){
//变更
......@@ -228,4 +276,172 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
}
@Override
public int findLogoutFlag(String userName) {
//查询tycpdm_firm表
int findLogoutFlag=0; //业务类型 1.首次 2.变更
TycpdmFirmEntity tycpdmFirm = tycpdmFirmDao.findUserName(userName);
if (tycpdmFirm==null){
findLogoutFlag=1;
return findLogoutFlag;
}else {
Integer logoutFlag = tycpdmFirm.getLogoutFlag();
if (logoutFlag==null){
findLogoutFlag=1;
}else if (logoutFlag==1){
findLogoutFlag=2;
}else {
findLogoutFlag=1;
}
}
return findLogoutFlag;
}
@Override
public Integer saveTycpdmFirmInfo(Map body,String userName) throws InvocationTargetException, IllegalAccessException {
TycpdmFirmEntity tycpdmFirm = new TycpdmFirmEntity();
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = new TycpdmFirmChangeEntity();
Integer status = body.get("status")==null?0:Integer.valueOf(String.valueOf(body.get("status")));
Integer id=0;
if (status==1){ //首次
BeanUtils.populate(tycpdmFirm, body);
String baseUser = tycpdmFirm.getBaseUser();
if (baseUser==null){
throw new RRException("用户名不能为空");
}
String firmname = tycpdmFirm.getFirmname();
if (firmname==null||"".equals(tycpdmFirm)){
throw new RRException("企业名称不能为空");
}
int count=tycpdmFirmDao.selectByIdFirmName(firmname,1);
if (count>0){
throw new RRException("企业名称已经存在");
}
Integer fid = body.get("fid")==null?0:Integer.valueOf(String.valueOf(body.get("fid")));
tycpdmFirm.setFId(fid);
Integer fId = tycpdmFirm.getFId();
if (fId==0){//新增数据
save(tycpdmFirm);
id = tycpdmFirm.getFId();
return id;
}else {//修改数据
//查询旧数据审核状态
TycpdmFirmEntity userName1 = tycpdmFirmDao.findUserName(userName);
Integer logoutFlag = userName1.getLogoutFlag();
if (logoutFlag==null){
updateById(tycpdmFirm);
id=fId;
}else if (logoutFlag==0){
throw new RRException("信息已提交,等待管理员审核!");
}else if (logoutFlag==1){
throw new RRException("审核状态异常");
}else if (logoutFlag==2){
updateById(tycpdmFirm);
id=fId;
}
return id;
}
}else if (status==2){ //变更
Integer fId =0;
Integer type=0; //1.新增 2.修改
if (body.get("fid")==null){//获取 主表的fId
TycpdmFirmEntity userName1 = tycpdmFirmDao.findUserName(userName);
fId=userName1.getFId();
type=1;
}else {
fId=Integer.valueOf(String.valueOf(body.get("fid")));
type=2;
}
BeanUtils.populate(tycpdmFirmChangeEntity, body);
String baseUser = tycpdmFirmChangeEntity.getBaseUser();
if (baseUser==null){
throw new RRException("用户名不能为空");
}
String firmname = tycpdmFirmChangeEntity.getFirmname();
if (firmname==null||"".equals(tycpdmFirm)){
throw new RRException("企业名称不能为空");
}
int count=tycpdmFirmDao.selectByIdFirmName(firmname,1);
if (count>0){
throw new RRException("企业名称已经存在");
}
tycpdmFirmChangeEntity.setFId(fId);
if (type==1){
tycpdmFirmChangeService.save(tycpdmFirmChangeEntity);
id = tycpdmFirmChangeEntity.getId();
}else if (type==2){
if (tycpdmFirmChangeEntity.getId()==null){
tycpdmFirmChangeService.save(tycpdmFirmChangeEntity);
id = tycpdmFirmChangeEntity.getId();
}
TycpdmFirmChangeEntity tycpdmFirmChangeEntity1 = tycpdmFirmChangeDao.selectById(tycpdmFirmChangeEntity.getId());
Integer logoutFlag = tycpdmFirmChangeEntity1.getLogoutFlag();
if (logoutFlag==null){
tycpdmFirmChangeService.updateById(tycpdmFirmChangeEntity);
id= tycpdmFirmChangeEntity.getId();
}else if (logoutFlag==0){
throw new RRException("信息已提交,等待管理员审核!");
}else if (logoutFlag==1){
tycpdmFirmChangeService.save(tycpdmFirmChangeEntity);
id = tycpdmFirmChangeEntity.getId();
}else if (logoutFlag==2){
tycpdmFirmChangeService.updateById(tycpdmFirmChangeEntity);
id= tycpdmFirmChangeEntity.getId();
}
}
}else {
throw new RRException("请选择业务类型");
}
return id;
}
@Override
public void returnFile(Map<String, Object> params, HttpServletResponse response){
Integer status =Integer.valueOf(String.valueOf(params.get("status"))); //1.首次 2.变更
Integer fileType = Integer.valueOf(String.valueOf(params.get("fileType")));//1.第一步文件 2.第二步文件
String id =String.valueOf(params.get("id"));//各个表的主键
String filePath="";
if (status==1){
TycpdmFirmEntity tycpdmFirmEntity = tycpdmFirmDao.selectById(id);
if (fileType==1){
filePath = tycpdmFirmEntity.getFirmbusinesslicensefile();
}else if (fileType==2){
filePath = tycpdmFirmEntity.getFirmArchivesfile();
}
}else if (status==2){
TycpdmFirmChangeEntity tycpdmFirmChangeEntity = tycpdmFirmChangeDao.selectById(id);
if (fileType==1){
filePath = tycpdmFirmChangeEntity.getFirmbusinesslicensefile();
}else if (fileType==2){
filePath = tycpdmFirmChangeEntity.getFirmArchivesfile();
}
}
File file = new File(filePath);
if (!file.exists()){
throw new RRException("文件不存在");
}
try {
FileCopyUtils.copy(new FileInputStream(filePath), response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void updateSystem(Map<String, Object> params) {
Integer id = Integer.valueOf(String.valueOf(params.get("id")));//id为 各个表得ID 变更表和主表
Integer status = Integer.valueOf(String.valueOf(params.get("status")));//申请状态 1.首次 2.变更
Integer branchCode = Integer.valueOf(String.valueOf(params.get("branchCode")));//分中心管理员编码
if (status==1){
tycpdmFirmDao.updateByIdBranchCode(id,branchCode);
}else if (status==2){
tycpdmFirmChangeDao.updateByIdBranchCode(id,branchCode);
}
}
}
\ 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