Commit 6eeff808 authored by 陈明豪's avatar 陈明豪

bug修改

parent 81aa2c5c
......@@ -129,7 +129,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" +
sysUser.getBusinessId() + "的用户表信息");
return new CyPersistModel(1);
}
}}
/**
* 删除 用户表
......@@ -532,20 +532,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
sysUser.setIdentity("0");
//数据库需要插入的用户信息
//登录名
if (sysUser.getUsername() == null) {
throw new CyServiceException(500, "数据错误");
if (sysUser.getName() == null) {
throw new CyServiceException(500, "用户姓名不能为空");
}
//手机号
if (sysUser.getPhone() == null) {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "用户手机号码不能为空");
}
//人脸信息
if (sysUser.getFaceAddress() == null) {
throw new CyServiceException(500, "数据错误");
}
// if (sysUser.getFaceAddress() == null) {
// throw new CyServiceException(500, "数据错误");
// }
//所属园区
if (sysUser.getAddress() == null) {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "所属园区不能为空");
}
//性别
if (sysUser.getSex() != null) {
......@@ -554,30 +554,30 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
} else if (sysUser.getSex().equals("女")) {
sysUser.setSex("1");
} else {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "用户性别数据错误");
}
} else {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "用户性别不能为空");
}
//所属部门
SysDept sysDept = sysDeptRepositorys.querySysDeptByName(sysUser.getDeptId());
if (sysDept == null || sysDept.equals(' ')) {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "部门信息数据错误");
} else {
sysUser.setDeptId(sysDept.getBusinessId().toString());
}
//字典职位
SysDictData sysDictData1 = sysDictDataRepositorys.queryDataByDeptIdC(sysUser.getPosition());
if (sysDictData1 == null || sysDictData1.equals(' ')) {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "职位信息数据错误");
} else {
sysUser.setPosition(sysDictData1.getBusinessId().toString());
}
//字典班次
SysDictData sysDictData2 = sysDictDataRepositorys.queryDataByDeptIdC(sysUser.getNltBz());
if (sysDictData2 == null || sysDictData2.equals(' ')) {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "班次信息数据错误");
} else {
sysUser.setNltBz(sysDictData2.getBusinessId().toString());
}
......@@ -590,16 +590,17 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
} else if (sysUser.getFlag().equals("离职")) {
sysUser.setFlag("2");
} else {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "工作状态数据错误");
}
} else {
throw new CyServiceException(500, "数据错误");
throw new CyServiceException(500, "工作状态不能为空");
}
//用户类型
sysUser.setUserType("0");
//身份
sysUser.setIdentity("1");
sysUser.setUsername(sysUser.getPhone());
sysUserRepositorys.addSysUser(sysUser);
}
}
......
......@@ -3,6 +3,7 @@ package org.rcisoft.sys.visit.controller;
/*固定导入*/
import cn.hutool.poi.excel.ExcelUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
......@@ -12,6 +13,7 @@ import org.rcisoft.core.jwt.util.CyJwtUtil;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.sys.visit.dto.VisitInformationErrorDTO;
import org.rcisoft.sys.visit.entity.VisitInfoMation;
import org.rcisoft.sys.visit.service.VisitInfomationService;
import org.springframework.validation.BindingResult;
......@@ -171,8 +173,6 @@ public class VisitInfomationController extends CyPaginationController<VisitInfoM
visitInfomationServiceImpl.findAllWithUserIdByPagination(getPaginationUtility(), visitInfomation ,request);
return getGridModelResponse();
}
@CyOpeLogAnno(title = "system-邀访信息管理-查询邀访信息", businessType = CyLogTypeEnum.EXPORT)
@ApiOperation(value = "导出邀访信息信息", notes = "导出邀访信息信息")
@GetMapping(value = "/export")
......@@ -232,10 +232,12 @@ public class VisitInfomationController extends CyPaginationController<VisitInfoM
@ApiOperation(value = "导入邀访信息", notes = "导入邀访信息")
@PostMapping("/importExcel")
@CyEptSm4EnableAnno
public CyResult importSysUser(MultipartFile file) throws ParseException {
public CyResult importSysUser(MultipartFile file,HttpServletResponse response) throws ParseException {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
visitInfomationServiceImpl.importUserExcel(file));
visitInfomationServiceImpl.importUserExcel(file,response));
}
}
......@@ -17,22 +17,6 @@ public class ExportVisitInfoDto {
@Excel(name = "邀请人姓名", orderNum = "1", width = 20)
private String userName;
// /**
// * @desc 发起人所属部门
// * @column dept_name
// * @default
// */
// @Excel(name = "发起人所属部门", orderNum = "2", width = 20)
// private String deptName;
//
// /**
// * @desc 发起人职务
// * @column post_name
// * @default
// */
// @Excel(name = "发起人职务", orderNum = "3", width = 20)
// private String postName;
@Excel(name = "邀请人手机号",orderNum = "2",width = 20)
private String phone;
......
package org.rcisoft.sys.visit.dto;
import cn.afterturn.easypoi.excel.annotation.Excel;
import org.rcisoft.sys.visit.dto.ExportVisitInfoDto;
import org.rcisoft.sys.visit.entity.VisitInfoMation;
public class VisitInformationErrorDTO extends ExportVisitInfoDto {
@Excel(name = "错误提示", orderNum = "8", width = 40)
private String error;
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
}
......@@ -96,7 +96,7 @@ public interface VisitInfomationService {
int exportEmptyTemplate(HttpServletResponse response);
ImportVistInfoDTO importUserExcel(MultipartFile file) throws ParseException;
ImportVistInfoDTO importUserExcel(MultipartFile file,HttpServletResponse response) throws ParseException;
/**
* 根据访客信息查询邀访信息
......
package org.rcisoft.sys.visit.service.impl;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -24,13 +26,13 @@ import org.rcisoft.sys.visit.dao.VisitPersonRepositorys;
import org.rcisoft.sys.visit.dao.VisitUserRepository;
import org.rcisoft.sys.visit.dto.ExportVisitInfoDto;
import org.rcisoft.sys.visit.dto.ImportVistInfoDTO;
import org.rcisoft.sys.visit.dto.VisitInformationErrorDTO;
import org.rcisoft.sys.visit.entity.CyResSvcExcEnum;
import org.rcisoft.sys.visit.entity.VisitInfoMation;
import org.rcisoft.sys.visit.entity.VisitUser;
import org.rcisoft.sys.visit.service.VisitInfomationService;
import org.rcisoft.sys.wbac.user.dto.ErrorDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
......@@ -134,28 +136,35 @@ public class VisitInfomationServiceImpl extends ServiceImpl<VisitInfomationRepos
visitInfomation.getBusinessId() + "的邀访信息信息");
// 添加访客信息
visitInfomation.getUserList().forEach(u -> {
// 根据手机号判断用户是否已经存在
QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
sysUserQueryWrapper.eq("phone", u.getVisitPhone())
.eq("del_flag", 0);
SysUser sysUser = sysUserRepositorys.selectOne(sysUserQueryWrapper);
// 不存在,新增访客
if (ObjectUtils.isEmpty(sysUser)) {
// 判断当前访客(用户)是否已经存在
SysUser sysUser = new SysUser();
sysUser.setName(u.getUserName());
sysUser.setPhone(u.getVisitPhone());
sysUser.setUsername(u.getVisitPhone());
sysUser.setNormal();
List<SysUser> sysUserList = sysUserRepositorys.querySysUsers(sysUser);
// 不存在新增
if (CollectionUtils.isEmpty(sysUserList)) {
sysUser.setPersonId(UUID.randomUUID().toString());
sysUser.setUserType("1");
sysUser.setIdentity("3");
sysUserRepositorys.insert(sysUser);
u.setPersonId(sysUser.getPersonId());
u.setUserId(sysUser.getBusinessId());
} else {
// 存在员工
if (sysUser.getUserType().equals("0"))
throw new CyServiceException(500, sysUser.getPhone() + "已被员工绑定,不能成为访客。");
if (!u.getUserName().equals(sysUser.getName())) {
sysUser.setName(u.getUserName());
// 存在覆盖
if (sysUserList.get(0).getUserType().equals("0")){
throw new CyServiceException(500,"员工不能作为访客!");
}
if (sysUserList.get(0).getUserType().equals("1")){
if (sysUserList.get(0).getBlacklistFlag().toString().equals("1")){
throw new CyServiceException(500,"不能邀请黑名单内的访客!");
}
sysUser.setBusinessId(sysUserList.get(0).getBusinessId());
sysUserRepositorys.updateSysUser(sysUser);
u.setPersonId(sysUserList.get(0).getPersonId());
u.setUserId(sysUserList.get(0).getBusinessId());
}
}
u.setPersonId(sysUser.getPersonId());
u.setUserId(sysUser.getBusinessId());
u.setVisitId(visitInfomation.getBusinessId());
u.setNormal();
visitUserRepository.insert(u);
......@@ -178,14 +187,13 @@ public class VisitInfomationServiceImpl extends ServiceImpl<VisitInfomationRepos
visitInfomation.getBusinessId() + "的邀访信息信息");
return new CyPersistModel(line);
}
/**
* 禁用 邀访信息
*
* @param visitInfomation
* @return
*/
public CyPersistModel forbidden(VisitInfoMation visitInfomation) {
public CyPersistModel forbidden(VisitInfoMation visitInfomation){
visitInfomation.setVisitStatus("2");
// 禁用邀访信息
int line = baseMapper.updateById(visitInfomation);
......
......@@ -114,6 +114,9 @@
where del_flag = 0
and user_type = 0
and identity = 1
<if test="entity.phone !=null and entity.phone != '' ">
and phone = #{entity.phone}
</if>
</select>
<select id="querySysUsersPaged" resultMap="BaseResultMap">
......
......@@ -139,14 +139,14 @@
and date_format(su.last_date,'%Y-%m-%d') &lt;= date_format(#{entity.lastDateQueryEnd},'%Y-%m-%d')
</if>
<if test="entity.sort == '1'.toString() "><!-- 排序-->
order BY su.first_date,su.create_date desc
order BY su.first_date desc,su.create_date desc
</if>
<if test="entity.sort == '2'.toString() "><!-- 排序-->
-- order BY su.name desc
order BY F_GET_PYJM(su.name)
</if>
<if test="entity.sort == '3'.toString() "><!-- 排序-->
order BY su.last_date,su.create_date desc
order BY su.last_date desc,su.create_date desc
</if>
</select>
......
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