Commit 74a602fa authored by mx's avatar mx

Merge remote-tracking branch 'origin/dev' into dev

parents b0301840 c4696883
package org.rcisoft.integration.jieLink.Controller;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
......@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/jieLinkInter")
public class JieLinkInterController {
......@@ -33,10 +35,16 @@ public class JieLinkInterController {
* 2、检查设备系统内是否存在,不存在返回错误信息
* 3、保存门禁记录信息,按照年划分
*/
JieLinkResultDto jieLinkResultDto = jieLinkService.saveDoorRecordInfo(recodeDto);
if(jieLinkResultDto!=null){
result = jieLinkResultDto;
}else{
try{
JieLinkResultDto jieLinkResultDto = jieLinkService.saveDoorRecordInfo(recodeDto);
if(jieLinkResultDto!=null){
result = jieLinkResultDto;
}else{
result.setCode("SYSTEM_ERROR");
result.setMsg("上传记录出现异常,请重新上传");
}
}catch (Exception ex){
log.error(ex.getMessage(),ex);
result.setCode("SYSTEM_ERROR");
result.setMsg("上传记录出现异常,请重新上传");
}
......
package org.rcisoft.integration.jieLink.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTimeUtils;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.integration.jieLink.common.SignUtils;
import org.rcisoft.integration.jieLink.dto.*;
import org.rcisoft.integration.jieLink.service.IJieLinkService;
import org.rcisoft.sys.sysuser.entity.DoorRecord;
import org.rcisoft.sys.sysuser.entity.SysUser;
import org.rcisoft.sys.sysuser.service.DoorRecordService;
import org.rcisoft.sys.sysuser.service.SysUserService;
import org.rcisoft.sys.visit.entity.VisitInfoMation;
import org.rcisoft.sys.visit.entity.VisitUser;
......@@ -54,7 +60,8 @@ public class JieLinkServiceImpl implements IJieLinkService {
@Autowired
private SysUserService sysUserService;
@Autowired
private DoorRecordService doorRecordService;
/**
......@@ -434,20 +441,83 @@ public class JieLinkServiceImpl implements IJieLinkService {
*/
JieLinkResultDto result = new JieLinkResultDto();
JieLinkPersonDto person = recordDto.getPerson();
SysUser sysUserData = null;
if(person!=null){//
String personId = person.getPersonId();
if(StringUtils.isNotBlank(personId)){
sysUserData = sysUserService.getUserDataByPersonId(personId);
if(sysUserData==null){
//将用户添加到SYS_USER表
sysUserData = new SysUser();
sysUserData.setPersonId(personId);//对应ID
sysUserData.setName(person.getPersonName());//名称
sysUserData.setUserType("1");//默认定义为游客用户
sysUserData.setEmail(person.getEmail());//邮箱
sysUserData.setPhone(person.getMobile());//手机号
sysUserData.setSex(person.getPersonGender()==0?"1":"0");//性别
//证件信息
if(StringUtils.equals(person.getCertificateType(),"GENERIDENT") || StringUtils.equals(person.getCertificateType(),"IDENTITY")){
sysUserData.setIdNumber(person.getIdentityNo());
}else{
log.error("添加的用户使用的是非身份证信息,暂时将其写入到身份证字段中");
sysUserData.setIdNumber(person.getCertificateType()+"_"+person.getIdentityNo());
}
//地址
sysUserData.setAddress(person.getAddress());//
//保存数据到用户表中
sysUserService.persist(sysUserData);
//此处还需要查询一次用户的ID
sysUserData = sysUserService.getUserDataByPersonId(personId);
}
}else{
//访客ID无了
result.setCode("ILLEGAL_ARGUMENT");
result.setMsg("人员信息丢失,请检查参数");
return result;
}
}else{
//访客记录为空了
result.setCode("ILLEGAL_ARGUMENT");
result.setMsg("人员信息丢失,请检查参数");
return result;
}
JieLinkDeviceDto device = recordDto.getDevice();
if(device!=null){
}else{
//设备无了
result.setCode("ILLEGAL_ARGUMENT");
result.setMsg("设备信息丢失,请检查参数");
return result;
}
return null;
DoorRecord record = new DoorRecord();
record.setRecordId(recordDto.getRecordId());
record.setUserId(sysUserData.getBusinessId());
record.setPersonId(sysUserData.getPersonId());
record.setMobile(sysUserData.getPhone());
record.setTenementType(sysUserData.getUserType());
record.setRemark(recordDto.getRemark());
record.setDeviceId("");//需要根据设备补全
record.setDeviceName("");//需要根据设备补全
record.setDeviceType("");//需要根据设备不全
record.setCardType(recordDto.getCardType()+"");
record.setCardNo(recordDto.getCardNo());
if(StringUtils.isNotBlank(recordDto.getCrossTime())){
//设备无了
result.setCode("ILLEGAL_ARGUMENT");
result.setMsg("闸机触发时间丢失,请检查参数");
return result;
}else{
DateTime crossTime = DateUtil.parse(recordDto.getCrossTime(), "yyyy-MM-dd HH:mm:ss");
record.setCrossTime(crossTime.toJdkDate());
}
record.setRecordType(recordDto.getRecordType()+"");
record.setEventType(recordDto.getEventType()+"");
record.setFlag("0");
record.setDelFlag("0");
record.setCreateBy(null);
doorRecordService.persist(record);
return result;
}
......
......@@ -128,6 +128,7 @@ public class SysUserController extends CyPaginationController<SysUser> {
@ApiOperation(value = "分页查询用户表集合", notes = "分页查询用户表集合")
@GetMapping(value = "/querySysUserByPagination")
public CyGridModel listByPagination(SysUser sysUser) {
sysUser.setUserType("0");
System.out.println(sysUser);
sysUserServiceImpl.findAllByPagination(getPaginationUtility(), sysUser);
return getGridModelResponse();
......
......@@ -51,6 +51,8 @@ public interface SysUserRepositorys extends CyBaseMapper<SysUser> {
public String getPersionIdByUserId(@Param("userId") Integer userId);
SysUser querySysUsersByPersonId(@Param("personId") String personId);
IPage<SysUser> querySysUsersByFenZhi2(CyPageInfo cyPageInfo, @Param("entity") SysUser sysUser);
}
......
......@@ -21,13 +21,9 @@ import org.springframework.data.annotation.Transient;
* Created with cy on 2022年11月24日 下午12:47:46.
*/
@Data
@TableName("door_record")
public class DoorRecord extends CyIdEntity<DoorRecord> {
/**
* 分表依据
*/
private String tabYear;
/**
* 开始时间
*/
......@@ -45,7 +41,10 @@ public class DoorRecord extends CyIdEntity<DoorRecord> {
private String deviceIoType;
//登记状态
@Transient
/**
* 闸机类型
* 1:进口 2出口
*/
private String deviceType;
//登记日期
......@@ -71,157 +70,45 @@ public class DoorRecord extends CyIdEntity<DoorRecord> {
private String recordId;
/**
* @desc 通行人唯一标识
* @column person_id
* @default
*/
@Excel(name = "通行人唯一标识", orderNum = "1", width = 20)
private String personId;
/**
* @desc 通行人人员编号
* @column person_no
* @default
*/
@Excel(name = "通行人人员编号", orderNum = "2", width = 20)
private String personNo;
/**
* @desc 通行人姓名
* @column person_name
* @default
*/
@Excel(name = "通行人姓名", orderNum = "3", width = 20)
private String personName;
/**
* @desc 通行人手机号
* @column person_phone
* @default
*/
@Excel(name = "通行人手机号", orderNum = "4", width = 20)
private String personPhone;
/**
* @desc 通行人性别(数据字典)
* @column person_gender
* @default
*/
@Excel(name = "通行人性别(数据字典)", orderNum = "5", width = 20)
private String personGender;
/**
* @desc 通行人组织唯一标识
* @column dept_id
* @default
*/
@Excel(name = "通行人组织唯一标识", orderNum = "6", width = 20)
private String deptId;
/**
* @desc 通行人组织名称
* @column dept_name
* @default
*/
@Excel(name = "通行人组织名称", orderNum = "7", width = 20)
private String deptName;
/**
* @desc 人员备注
* @column person_remark
* @default
*/
@Excel(name = "人员备注", orderNum = "8", width = 20)
private String personRemark;
/**
* @desc 人员图片url
* @column person_photo
* @default
*/
@Excel(name = "人员图片url", orderNum = "9", width = 20)
private String personPhoto;
/**
* @desc 证件类型(数据字典)
* @column certificate_type
* @desc 用户ID
* @column user_id
* @default
*/
@Excel(name = "证件类型(数据字典)", orderNum = "10", width = 20)
private String certificateType;
@Excel(name = "用户ID", orderNum = "1", width = 20)
private Integer userId;
/**
* @desc 证件号码
* @column identity_no
* @desc 通行人唯一标识
* @column person_id
* @default
*/
@Excel(name = "证件号码", orderNum = "11", width = 20)
private String identityNo;
@Excel(name = "通行人唯一标识", orderNum = "1", width = 20)
private String personId;
/**
* @desc 手机号码
* @desc 人员手机号
* @column mobile
* @default
*/
@Excel(name = "手机号码", orderNum = "12", width = 20)
@Excel(name = "人员手机号", orderNum = "1", width = 20)
private String mobile;
/**
* @desc 电话 1
* @column tel1
* @default
*/
@Excel(name = "电话 1", orderNum = "13", width = 20)
private String tel1;
/**
* @desc 电话 2
* @column tel2
* @default
*/
@Excel(name = "电话 2", orderNum = "14", width = 20)
private String tel2;
/**
* @desc 邮箱
* @column email
* @default
*/
@Excel(name = "邮箱", orderNum = "15", width = 20)
private String email;
/**
* @desc 房号
* @column room_no
* @default
*/
@Excel(name = "房号", orderNum = "16", width = 20)
private String roomNo;
/**
* @desc 地址
* @column address
* @desc 记录备注信息
* @column remark
* @default
*/
@Excel(name = "地址", orderNum = "17", width = 20)
private String address;
@Excel(name = "记录备注信息", orderNum = "19", width = 20)
private String remark;
/**
* @desc 住户类型(数据字典)
* @desc 人员身份 0: 内部员工 1 访客
* @column tenement_type
* @default
*/
@Excel(name = "住户类型(数据字典)", orderNum = "18", width = 20)
@Excel(name = "人员身份", orderNum = "19", width = 20)
private String tenementType;
/**
* @desc 记录备注信息
* @column remark
* @default
*/
@Excel(name = "记录备注信息", orderNum = "19", width = 20)
private String remark;
/**
* @desc 设备id
* @column device_id
......
......@@ -99,10 +99,10 @@ public class SysUser extends CyIdIncreEntity<SysUser> {
// @Excel(name = "登录名", orderNum = "0", width = 20)
private String username;
/**
* 捷顺用户ID
*/
private String personId;
// /**
// * 捷顺用户ID
// */
// private String personId;
/**
......
......@@ -103,4 +103,12 @@ public interface SysUserService {
* @return
*/
public String getPersionIdByUserId(Integer userId);
/**
* 根据捷顺系统的用户ID获取用户对象
* @param personId
* @return
*/
public SysUser getUserDataByPersonId(String personId);
}
......@@ -232,8 +232,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
@Override
public IPage<SysUser> findAllByPagination(CyPageInfo<SysUser> paginationUtility, SysUser sysUser) {
//管理员信息查询
if (sysUser.getFenZhi().equals("2")) {
IPage<SysUser> sysUserIPage = baseMapper.querySysUsersByFenZhi2(paginationUtility, sysUser);
if (sysUser.getFenZhi()!=null){
if (sysUser.getFenZhi().equals("2")) {
IPage<SysUser> sysUserIPage = baseMapper.querySysUsersByFenZhi2(paginationUtility, sysUser);
// //查询角色集合
// for (int i = 0; i < sysUserIPage.getRecords().size(); i++) {
// //角色
......@@ -241,8 +242,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
// List<Integer> roleIds = sysUserRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
// sysUserIPage.getRecords().get(i).setRoleList(roleIds);
// }
return sysUserIPage;
return sysUserIPage;
}
}
IPage<SysUser> sysUserIPage = baseMapper.querySysUsersPaged(paginationUtility, sysUser);
......@@ -578,6 +580,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
return sysUserRepositorys.getPersionIdByUserId(userId);
}
/**
* 根据捷顺的ID查询用户信息
* @param personId
* @return
*/
@Override
public SysUser getUserDataByPersonId(String personId) {
return sysUserRepositorys.querySysUsersByPersonId(personId);
}
/**
* 去除List中空数据
*
......
......@@ -29,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Created by cy on 2022年11月16日 下午3:19:19.
......@@ -51,6 +52,7 @@ public class VisitPersonController extends CyPaginationController<SysUser> {
public CyResult add(@RequestBody SysUser sysUser, BindingResult bindingResult) {
sysUser.setUserType("1");
sysUser.setIdentity("3");
sysUser.setPersonId(UUID.randomUUID().toString());
CyPersistModel data = sysUserServiceImpl.persist(sysUser);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
......
......@@ -111,10 +111,10 @@ public class VisitInfoMation extends CyIdIncreEntity<VisitInfoMation> {
@TableField(exist = false)
private String[] visitRegions;
/**
* 捷顺邀访记录ID
*/
private String itemId;
// /**
// * 捷顺邀访记录ID
// */
// private String itemId;
/**
* @desc 访问日期
* @column visit_date
......
......@@ -45,10 +45,10 @@ public class VisitUser extends CyIdIncreEntity<VisitUser> {
@Excel(name = "访客手机号", orderNum = "2", width = 20)
private String visitPhone;
/**
* 访客对应的捷顺ID
*/
private String personId;
// /**
// * 访客对应的捷顺ID
// */
// private String personId;
private VisitInfoMation visitInfo;
......
......@@ -190,6 +190,24 @@ public class VisitInfomationServiceImpl extends ServiceImpl<VisitInfomationRepos
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(VisitInfoMation visitInfomation) {
String regionCode = "";
String region = "";
for (String s : visitInfomation.getVisitRegionCodes()){
regionCode = regionCode +s+',';
}
if (regionCode.length()>0){
regionCode=regionCode.substring(0,regionCode.length()-1);
visitInfomation.setVisitRegionCode(regionCode);
}
for (String s : visitInfomation.getVisitRegions()){
region = region +s+',';
}
if (regionCode.length()>0){
region=region.substring(0,region.length()-1);
visitInfomation.setVisitRegion(region);
}
List<VisitUser> visitUsers = visitInfomation.getUserList();
if (visitUsers.size() > 0) {
......
......@@ -3,31 +3,17 @@
<mapper namespace="org.rcisoft.sys.sysuser.dao.DoorRecordRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.sys.sysuser.entity.DoorRecord">
<id column="record_id" jdbcType="VARCHAR" property="recordId"/>
<result column="user_id" jdbcType="INTEGER" property="userId"/>
<result column="person_id" jdbcType="VARCHAR" property="personId"/>
<result column="person_no" jdbcType="VARCHAR" property="personNo"/>
<result column="person_name" jdbcType="VARCHAR" property="personName"/>
<result column="person_phone" jdbcType="VARCHAR" property="personPhone"/>
<result column="person_gender" jdbcType="VARCHAR" property="personGender"/>
<result column="dept_id" jdbcType="VARCHAR" property="deptId"/>
<result column="dept_name" jdbcType="VARCHAR" property="deptName"/>
<result column="person_remark" jdbcType="VARCHAR" property="personRemark"/>
<result column="person_photo" jdbcType="VARCHAR" property="personPhoto"/>
<result column="certificate_type" jdbcType="VARCHAR" property="certificateType"/>
<result column="identity_no" jdbcType="VARCHAR" property="identityNo"/>
<result column="mobile" jdbcType="VARCHAR" property="mobile"/>
<result column="tel1" jdbcType="VARCHAR" property="tel1"/>
<result column="tel2" jdbcType="VARCHAR" property="tel2"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="room_no" jdbcType="VARCHAR" property="roomNo"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="tenement_type" jdbcType="VARCHAR" property="tenementType"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="device_id" jdbcType="VARCHAR" property="deviceId"/>
<result column="device_name" jdbcType="VARCHAR" property="deviceName"/>
<result column="device_type" jdbcType="VARCHAR" property="deviceType"/>
<result column="card_type" jdbcType="VARCHAR" property="cardType"/>
<result column="card_no" jdbcType="VARCHAR" property="cardNo"/>
<result column="cross_time" jdbcType="TIMESTAMP" property="crossTime"/>
<result column="picture_file" jdbcType="VARCHAR" property="pictureFile"/>
<result column="record_type" jdbcType="VARCHAR" property="recordType"/>
<result column="event_type" jdbcType="VARCHAR" property="eventType"/>
<result column="flag" jdbcType="CHAR" property="flag"/>
......@@ -40,7 +26,7 @@
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryDoorRecords" resultMap="BaseResultMap">
select * from door_record_${entity.tabYear}
select * from door_record
where 1=1
<if test="entity.delFlag !=null and entity.delFlag != '' ">
and del_flag = #{entity.delFlag}
......@@ -48,11 +34,12 @@
<if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag}
</if>
</select>
<select id="queryDoorRecordsPaged" resultMap="BaseResultMap">
SELECT su.user_type,d.device_type,d.deviceIo_type,dr.*
FROM door_record_${entity.tabYear} dr
FROM door_record dr
JOIN sys_user su ON dr.person_id = su.person_id
JOIN devices d ON dr.device_id = d.device_id
where dr.del_flag = 0
......
......@@ -258,6 +258,10 @@
SELECT person_id from sys_user where business_id = #{userId}
</select>
<select id="querySysUsersByPersonId" resultMap="BaseResultMap">
SELECT * FROM sys_user WHERE person_id = #{personId}
</select>
<select id="querySysUsersByFenZhi2" resultMap="BaseResultMap">
SELECT GROUP_CONCAT(sr.role_name SEPARATOR ',') role_name, su.*
......
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