Commit 961bf223 authored by zhangyanduan's avatar zhangyanduan

Merge branch 'import' of http://gitlab.91isoft.com:90/wangcong/entrance_api- into import

parents 1f6156e4 225c1615
......@@ -2,6 +2,7 @@ package org.rcisoft.sys.doordeviceinfo.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
......@@ -20,6 +21,7 @@ import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
......@@ -30,8 +32,8 @@ import org.rcisoft.sys.doordeviceinfo.service.DoorDeviceInfoService;
import java.util.List;
/**
* Created by cy on 2022年12月23日 下午2:04:50.
*/
* Created by cy on 2022年12月23日 下午2:04:50.
*/
@RestController
@RequestMapping("/doordeviceinfo")
public class DoorDeviceInfoController extends CyPaginationController<DoorDeviceInfo> {
......@@ -42,69 +44,70 @@ public class DoorDeviceInfoController extends CyPaginationController<DoorDeviceI
//@PreAuthorize("@cyPerm.hasPerm('sys:rDeviceInfo:add')")
@CyOpeLogAnno(title = "system-门磁设备记录表管理-新增门磁设备记录表", businessType = CyLogTypeEnum.INSERT)
@ApiOperation(value="添加门磁设备记录表", notes="添加门磁设备记录表")
@ApiOperation(value = "添加门磁设备记录表", notes = "添加门磁设备记录表")
@PostMapping(value = "/add")
public CyResult add(@Valid DoorDeviceInfo doorDeviceInfo, BindingResult bindingResult) {
CyPersistModel data = doorDeviceInfoServiceImpl.persist(doorDeviceInfo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfo);
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfo);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:rDeviceInfo:delete')")
@CyOpeLogAnno(title = "system-门磁设备记录表管理-删除门磁设备记录表", businessType = CyLogTypeEnum.DELETE)
@ApiOperation(value="删除门磁设备记录表", notes="删除门磁设备记录表")
@ApiOperation(value = "删除门磁设备记录表", notes = "删除门磁设备记录表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable int businessId,DoorDeviceInfo doorDeviceInfo) {
public CyResult delete(@PathVariable int businessId, DoorDeviceInfo doorDeviceInfo) {
doorDeviceInfo.setBusinessId(businessId);
CyPersistModel data = doorDeviceInfoServiceImpl.remove(doorDeviceInfo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:rDeviceInfo:update')")
@CyOpeLogAnno(title = "system-门磁设备记录表管理-修改门磁设备记录表", businessType = CyLogTypeEnum.UPDATE)
@ApiOperation(value="修改门磁设备记录表", notes="修改门磁设备记录表")
@ApiOperation(value = "修改门磁设备记录表", notes = "修改门磁设备记录表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable int businessId, @Valid DoorDeviceInfo doorDeviceInfo, BindingResult bindingResult) {
doorDeviceInfo.setBusinessId(businessId);
@PutMapping("/update")
public CyResult update(@RequestBody DoorDeviceInfo doorDeviceInfo, BindingResult bindingResult) {
// doorDeviceInfo.setBusinessId(businessId);
CyPersistModel data = doorDeviceInfoServiceImpl.merge(doorDeviceInfo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfo);
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfo);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:rDeviceInfo:query')")
@CyOpeLogAnno(title = "system-门磁设备记录表管理-查询门磁设备记录表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询单一门磁设备记录表", notes="查询单一门磁设备记录表")
@ApiOperation(value = "查询单一门磁设备记录表", notes = "查询单一门磁设备记录表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable int businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfoServiceImpl.findById(businessId));
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfoServiceImpl.findById(businessId));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:rDeviceInfo:list')")
@CyOpeLogAnno(title = "system-门磁设备记录表管理-查询门磁设备记录表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询门磁设备记录表集合", notes="查询门磁设备记录表集合")
@ApiOperation(value = "查询门磁设备记录表集合", notes = "查询门磁设备记录表集合")
@GetMapping(value = "/queryDoorDeviceInfos")
public CyResult queryDoorDeviceInfos(DoorDeviceInfo doorDeviceInfo) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfoServiceImpl.findAll(doorDeviceInfo));
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfoServiceImpl.findAll(doorDeviceInfo));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:rDeviceInfo:list')")
@CyOpeLogAnno(title = "system-门磁设备记录表管理-查询门磁设备记录表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="分页查询门磁设备记录表集合", notes="分页查询门磁设备记录表集合")
@ApiOperation(value = "分页查询门磁设备记录表集合", notes = "分页查询门磁设备记录表集合")
@GetMapping(value = "/queryDoorDeviceInfoByPagination")
public CyGridModel listByPagination(DoorDeviceInfo doorDeviceInfo) {
doorDeviceInfoServiceImpl.findAllByPagination(getPaginationUtility(), doorDeviceInfo);
......@@ -114,18 +117,24 @@ public class DoorDeviceInfoController extends CyPaginationController<DoorDeviceI
@CyOpeLogAnno(title = "system-门磁设备记录表管理-查询门磁设备记录表", businessType = CyLogTypeEnum.EXPORT)
@ApiOperation(value = "导出门磁设备记录表信息", notes = "导出门磁设备记录表信息")
@GetMapping(value = "/export")
public CyResult outDoorDeviceInfo(HttpServletResponse response,DoorDeviceInfo doorDeviceInfo,@PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName="";
switch(excelId){
case "0": excelName="门磁设备记录表信息.xls";break;
case "1": excelName="门磁设备记录表信息.xlsx";break;
case "2": excelName="门磁设备记录表信息.csv";break;
public CyResult outDoorDeviceInfo(HttpServletResponse response, DoorDeviceInfo doorDeviceInfo, @PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName = "";
switch (excelId) {
case "0":
excelName = "门磁设备记录表信息.xls";
break;
case "1":
excelName = "门磁设备记录表信息.xlsx";
break;
case "2":
excelName = "门磁设备记录表信息.csv";
break;
}
List<DoorDeviceInfo> doorDeviceInfoList = doorDeviceInfoServiceImpl.export(doorDeviceInfo);
CyEpExcelUtil.exportExcel(doorDeviceInfoList, "门磁设备记录表信息", "门磁设备记录表信息", DoorDeviceInfo.class, excelName, response);
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfoList);
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
doorDeviceInfoList);
}
}
package org.rcisoft.sys.doordeviceinfo.dao;
import org.apache.ibatis.annotations.Mapper;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.sys.doordeviceinfo.entity.DoorDeviceInfo;
import org.apache.ibatis.annotations.ResultMap;
......@@ -12,18 +13,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* Created with cy on 2022年12月23日 下午2:04:50.
*/
* Created with cy on 2022年12月23日 下午2:04:50.
*/
@Mapper
public interface DoorDeviceInfoRepository extends CyBaseMapper<DoorDeviceInfo> {
List<DoorDeviceInfo> queryDoorDeviceInfos(@Param("entity") DoorDeviceInfo doorDeviceInfo);
/**
* 分页查询 doorDeviceInfo
*
*/
IPage<DoorDeviceInfo> queryDoorDeviceInfosPaged(CyPageInfo cyPageInfo,@Param("entity") DoorDeviceInfo doorDeviceInfo);
* 分页查询 doorDeviceInfo
*/
IPage<DoorDeviceInfo> queryDoorDeviceInfosPaged(CyPageInfo cyPageInfo, @Param("entity") DoorDeviceInfo doorDeviceInfo);
DoorDeviceInfo queryDoorDeviceInfosById(Integer business_id);
public int updateDoorDeviceInfos(@Param("entity") DoorDeviceInfo doorDeviceInfo);
}
......@@ -2,48 +2,88 @@ package org.rcisoft.sys.doordeviceinfo.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.rcisoft.core.entity.CyIdIncreEntity;
import org.rcisoft.core.entity.CyIdNotDataEntity;
import org.springframework.data.annotation.Transient;
/**
* Created with cy on 2022年12月23日 下午2:04:50.
*/
* Created with cy on 2022年12月23日 下午2:04:50.
*/
@Data
@TableName("door_device_info")
public class DoorDeviceInfo extends CyIdIncreEntity<DoorDeviceInfo> {
public class DoorDeviceInfo extends CyIdIncreEntity<DoorDeviceInfo> {
//id
private Integer id;
/**
//设备所在地址中文
private String deviceAddressLabel;
//排序
@Transient
private String px;
@Transient
//标记异常(0 异常 1非异常)
private String abnormal;
@Transient
/**
* @desc 设备上报数据类型
* open:开门
* close:关门
* warn:警告
* up:设备上线
* down:设备下线
* @column data_type
* @default
*/
private String dataType;
/**
* 开始时间
*/
@Transient
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String beginTime;
//结束时间
@Transient
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String endTime;
/**
* @desc 设备imei码
* @column device_imei
* @default
*/
private String deviceImei;
/**
private String deviceImei;
/**
* @desc 设备名称
* @column device_name
* @default
*/
private String deviceName;
/**
private String deviceName;
/**
* @desc 设备所在地址
* @column device_address
* @default
*/
private String deviceAddress;
/**
private String deviceAddress;
/**
* @desc 设备所在区域
* @column device_area
* @default
*/
private String deviceArea;
/**
private String deviceArea;
/**
* @desc 设备所在点位
* @column device_point
* @default
*/
private String devicePoint;
private String devicePoint;
}
......@@ -22,94 +22,105 @@ import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by cy on 2022年12月23日 下午2:04:50.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class DoorDeviceInfoServiceImpl extends ServiceImpl<DoorDeviceInfoRepository,DoorDeviceInfo> implements DoorDeviceInfoService {
public class DoorDeviceInfoServiceImpl extends ServiceImpl<DoorDeviceInfoRepository, DoorDeviceInfo> implements DoorDeviceInfoService {
@Autowired
DoorDeviceInfoRepository doorDeviceInfoRepository;
/**
* 保存 门磁设备记录表
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
* 保存 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(DoorDeviceInfo doorDeviceInfo){
public CyPersistModel persist(DoorDeviceInfo doorDeviceInfo) {
//增加操作
int line = baseMapper.insert(doorDeviceInfo);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
doorDeviceInfo.getBusinessId()+"的门磁设备记录表信息");
log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" +
doorDeviceInfo.getBusinessId() + "的门磁设备记录表信息");
return new CyPersistModel(line);
}
/**
* 删除 门磁设备记录表
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
* 删除 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(DoorDeviceInfo doorDeviceInfo){
public CyPersistModel remove(DoorDeviceInfo doorDeviceInfo) {
int line = baseMapper.realDelete(doorDeviceInfo);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+
doorDeviceInfo.getBusinessId()+"的门磁设备记录表信息");
log.debug(CyUserUtil.getAuthenUsername() + "删除了ID为" +
doorDeviceInfo.getBusinessId() + "的门磁设备记录表信息");
return new CyPersistModel(line);
}
/**
* 修改 门磁设备记录表
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
* 修改 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(DoorDeviceInfo doorDeviceInfo){
int line = baseMapper.updateById(doorDeviceInfo);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ doorDeviceInfo.getBusinessId()+"的门磁设备记录表信息");
public CyPersistModel merge(DoorDeviceInfo doorDeviceInfo) {
int line = doorDeviceInfoRepository.updateDoorDeviceInfos(doorDeviceInfo);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + doorDeviceInfo.getBusinessId() + "的门磁设备记录表信息");
return new CyPersistModel(line);
}
/**
* 根据id查询 门磁设备记录表
* @param id
* @return
*/
* 根据id查询 门磁设备记录表
*
* @param id
* @return
*/
@Override
public DoorDeviceInfo findById(int id){
return baseMapper.selectById(id);
public DoorDeviceInfo findById(int id) {
return doorDeviceInfoRepository.queryDoorDeviceInfosById(id);
}
/**
* 分页查询 门磁设备记录表
* @param doorDeviceInfo
* @return
*/
* 分页查询 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Override
public IPage<DoorDeviceInfo> findAllByPagination(CyPageInfo<DoorDeviceInfo> paginationUtility,
DoorDeviceInfo doorDeviceInfo){
return baseMapper.queryDoorDeviceInfosPaged(paginationUtility,doorDeviceInfo);
DoorDeviceInfo doorDeviceInfo) {
return baseMapper.queryDoorDeviceInfosPaged(paginationUtility, doorDeviceInfo);
}
/**
* 查询list 门磁设备记录表
* @param doorDeviceInfo
* @return
*/
* 查询list 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Override
public List<DoorDeviceInfo> findAll(DoorDeviceInfo doorDeviceInfo){
public List<DoorDeviceInfo> findAll(DoorDeviceInfo doorDeviceInfo) {
return baseMapper.queryDoorDeviceInfos(doorDeviceInfo);
}
/**
* 导出门磁设备记录表
* @return
*/
* 导出门磁设备记录表
*
* @return
*/
@Override
public List<DoorDeviceInfo> export(DoorDeviceInfo doorDeviceInfo) {
List<DoorDeviceInfo> doorDeviceInfoList = baseMapper.queryDoorDeviceInfos(doorDeviceInfo);
......@@ -124,12 +135,12 @@ public class DoorDeviceInfoServiceImpl extends ServiceImpl<DoorDeviceInfoReposit
@Override
public DoorDeviceInfo getDeviceInfoByIMEICode(String deviceImei) {
QueryWrapper<DoorDeviceInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("device_imei",deviceImei);
queryWrapper.eq("del_flag","0");
queryWrapper.eq("device_imei", deviceImei);
queryWrapper.eq("del_flag", "0");
List<DoorDeviceInfo> doorDeviceInfos = baseMapper.selectList(queryWrapper);
if(doorDeviceInfos!=null && !doorDeviceInfos.isEmpty()){
if (doorDeviceInfos != null && !doorDeviceInfos.isEmpty()) {
return doorDeviceInfos.get(0);
}else{
} else {
return null;
}
}
......
......@@ -166,7 +166,7 @@ public class VisitInfomationServiceImpl extends ServiceImpl<VisitInfomationRepos
sysUserList.get(0).setName(u.getUserName());
sysUserRepositorys.updateSysUser(sysUserList.get(0));
}
u.setPersonId(sysUserList.get(0).getPersonId());
u.setPersonId(UUID.randomUUID().toString());
u.setUserId(sysUserList.get(0).getBusinessId());
}
}
......
......@@ -15,12 +15,57 @@
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryDoorDeviceInfos" resultMap="BaseResultMap">
select * from door_device_info
where 1=1
select *
from door_device_info
where 1 = 1
</select>
<select id="queryDoorDeviceInfosPaged" resultMap="BaseResultMap">
select * from door_device_info
where 1=1
SELECT drd.business_id AS id,ddi.*,drd.*
FROM door_device_info ddi
LEFT JOIN door_report_data drd ON ddi.business_id = drd.device_id
LEFT JOIN sys_dict_data sdd ON ddi.device_address = sdd.dict_value
WHERE ddi.del_flag = 0
<if test="entity.flag !=null and entity.flag != '' ">
and ddi.flag = #{entity.flag}
</if>
<if test="entity.beginTime != null and entity.beginTime !='' "><!-- 开始时间检索 -->
and date_format(ddi.create_date,'%Y-%m-%d') &gt;= date_format(#{entity.beginTime},'%Y-%m-%d')
</if>
<if test="entity.endTime != null and entity.endTime !='' "><!-- 结束时间检索 -->
and date_format(ddi.create_date,'%Y-%m-%d') &lt;= date_format(#{entity.endTime},'%Y-%m-%d')
</if>
<if test="entity.deviceAddress !=null and entity.deviceAddress != '' ">
and ddi.device_address = #{entity.deviceAddress}
</if>
<if test="entity.dataType !=null and entity.dataType != '' ">
and ddi.data_type = #{entity.dataType}
</if>
<if test="entity.abnormal !=null and entity.abnormal != '' ">
and ddi.abnormal = #{entity.abnormal}
</if>
<if test="entity.px == '1'.toString() "><!-- 排序-->
order BY ddi.create_date desc
</if>
<if test="entity.px == '2'.toString() "><!-- 排序-->
ORDER BY sdd.dict_sort desc
</if>
</select>
<select id="queryDoorDeviceInfosById" resultMap="BaseResultMap">
SELECT drd.business_id AS id, ddi.*, drd.*
FROM door_device_info ddi
LEFT JOIN door_report_data drd ON ddi.business_id = drd.device_id
WHERE ddi.del_flag = 0
AND drd.business_id = #{id}
</select>
<update id="updateDoorDeviceInfos" parameterType="org.rcisoft.sys.doordeviceinfo.entity.DoorDeviceInfo">
update door_report_data
<trim prefix="SET" suffixOverrides=",">
<if test="entity.abnormal != null">abnormal = #{entity.abnormal},</if>
</trim>
where business_id = #{entity.businessId}
</update>
</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