18 changed files with 708 additions and 26 deletions
@ -0,0 +1,74 @@ |
|||
package com.epmet.plugin.power.dto.hik; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 海康设备推送失败信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-23 |
|||
*/ |
|||
@Data |
|||
public class HikErrorInfoDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 删除标记 0:未删除,1:已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String idCard; |
|||
|
|||
/** |
|||
* 错误类型 0:token,1:人员,2权限 |
|||
*/ |
|||
private String errorType; |
|||
|
|||
/** |
|||
* 错误详情 |
|||
*/ |
|||
private String errorInfo; |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.plugin.power.dto.hik.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
/** |
|||
* 海康社区人员权限信息下放 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-20 |
|||
*/ |
|||
@Data |
|||
public class HikAuthorityFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
private String communityId; |
|||
|
|||
private String personId; |
|||
|
|||
private Integer personType; |
|||
|
|||
private String deviceId; |
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.plugin.power.modules.hik.controller; |
|||
|
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.plugin.power.dto.hik.HikErrorInfoDTO; |
|||
import com.epmet.plugin.power.modules.hik.excel.HikErrorInfoExcel; |
|||
import com.epmet.plugin.power.modules.hik.service.HikErrorInfoService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 海康设备推送失败信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-23 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("hikErrorInfo") |
|||
public class HikErrorInfoController { |
|||
|
|||
@Autowired |
|||
private HikErrorInfoService hikErrorInfoService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<HikErrorInfoDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<HikErrorInfoDTO> page = hikErrorInfoService.page(params); |
|||
return new Result<PageData<HikErrorInfoDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
|||
public Result<HikErrorInfoDTO> get(@PathVariable("id") String id){ |
|||
HikErrorInfoDTO data = hikErrorInfoService.get(id); |
|||
return new Result<HikErrorInfoDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody HikErrorInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
hikErrorInfoService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody HikErrorInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
hikErrorInfoService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
hikErrorInfoService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<HikErrorInfoDTO> list = hikErrorInfoService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, HikErrorInfoExcel.class); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.epmet.plugin.power.modules.hik.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.plugin.power.modules.hik.entity.HikErrorInfoEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 海康设备推送失败信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-23 |
|||
*/ |
|||
@Mapper |
|||
public interface HikErrorInfoDao extends BaseDao<HikErrorInfoEntity> { |
|||
|
|||
/** |
|||
* 物理删除 |
|||
* |
|||
* @param params |
|||
* @return void |
|||
* @author zhy |
|||
* @date 2022/4/24 14:08 |
|||
*/ |
|||
void deletePhysical(Map<String, Object> params); |
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.epmet.plugin.power.modules.hik.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 海康设备推送失败信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-23 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("pli_hik_error_info") |
|||
public class HikErrorInfoEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String idCard; |
|||
|
|||
/** |
|||
* 错误类型 0:token,1:人员,2权限 |
|||
*/ |
|||
private String errorType; |
|||
|
|||
/** |
|||
* 错误详情 |
|||
*/ |
|||
private String errorInfo; |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.plugin.power.modules.hik.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 海康设备推送失败信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-23 |
|||
*/ |
|||
@Data |
|||
public class HikErrorInfoExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "删除标记 0:未删除,1:已删除") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
@Excel(name = "客户ID") |
|||
private String customerId; |
|||
|
|||
@Excel(name = "身份证号") |
|||
private String idCard; |
|||
|
|||
@Excel(name = "错误类型 0:token,1:人员,2权限") |
|||
private String errorType; |
|||
|
|||
@Excel(name = "错误详情") |
|||
private String errorInfo; |
|||
|
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.plugin.power.modules.hik.redis; |
|||
|
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 海康设备推送失败信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-23 |
|||
*/ |
|||
@Component |
|||
public class HikErrorInfoRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,88 @@ |
|||
package com.epmet.plugin.power.modules.hik.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.plugin.power.dto.hik.HikErrorInfoDTO; |
|||
import com.epmet.plugin.power.modules.hik.entity.HikErrorInfoEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 海康设备推送失败信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-23 |
|||
*/ |
|||
public interface HikErrorInfoService extends BaseService<HikErrorInfoEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<HikErrorInfoDTO> |
|||
* @author generator |
|||
* @date 2022-05-23 |
|||
*/ |
|||
PageData<HikErrorInfoDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<HikErrorInfoDTO> |
|||
* @author generator |
|||
* @date 2022-05-23 |
|||
*/ |
|||
List<HikErrorInfoDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return HikErrorInfoDTO |
|||
* @author generator |
|||
* @date 2022-05-23 |
|||
*/ |
|||
HikErrorInfoDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-05-23 |
|||
*/ |
|||
void save(HikErrorInfoDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-05-23 |
|||
*/ |
|||
void update(HikErrorInfoDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2022-05-23 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 物理删除 |
|||
* |
|||
* @param params |
|||
* @return void |
|||
* @author zhy |
|||
* @date 2022/4/24 14:08 |
|||
*/ |
|||
void deletePhysical(Map<String, Object> params); |
|||
} |
@ -0,0 +1,95 @@ |
|||
package com.epmet.plugin.power.modules.hik.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.plugin.power.modules.hik.dao.HikErrorInfoDao; |
|||
import com.epmet.plugin.power.dto.hik.HikErrorInfoDTO; |
|||
import com.epmet.plugin.power.modules.hik.entity.HikErrorInfoEntity; |
|||
import com.epmet.plugin.power.modules.hik.redis.HikErrorInfoRedis; |
|||
import com.epmet.plugin.power.modules.hik.service.HikErrorInfoService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 海康设备推送失败信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-23 |
|||
*/ |
|||
@Service |
|||
public class HikErrorInfoServiceImpl extends BaseServiceImpl<HikErrorInfoDao, HikErrorInfoEntity> implements HikErrorInfoService { |
|||
|
|||
@Autowired |
|||
private HikErrorInfoRedis hikErrorInfoRedis; |
|||
|
|||
@Override |
|||
public PageData<HikErrorInfoDTO> page(Map<String, Object> params) { |
|||
IPage<HikErrorInfoEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, HikErrorInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<HikErrorInfoDTO> list(Map<String, Object> params) { |
|||
List<HikErrorInfoEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, HikErrorInfoDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<HikErrorInfoEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<HikErrorInfoEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public HikErrorInfoDTO get(String id) { |
|||
HikErrorInfoEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, HikErrorInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(HikErrorInfoDTO dto) { |
|||
HikErrorInfoEntity entity = ConvertUtils.sourceToTarget(dto, HikErrorInfoEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(HikErrorInfoDTO dto) { |
|||
HikErrorInfoEntity entity = ConvertUtils.sourceToTarget(dto, HikErrorInfoEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void deletePhysical(Map<String, Object> params) { |
|||
if (!params.isEmpty()) { |
|||
baseDao.deletePhysical(params); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.plugin.power.modules.hik.dao.HikErrorInfoDao"> |
|||
|
|||
<resultMap type="com.epmet.plugin.power.modules.hik.entity.HikErrorInfoEntity" id="hikErrorInfoMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="idCard" column="ID_CARD"/> |
|||
<result property="errorType" column="ERROR_TYPE"/> |
|||
<result property="errorInfo" column="ERROR_INFO"/> |
|||
</resultMap> |
|||
|
|||
<delete id="deletePhysical"> |
|||
DELETE |
|||
FROM |
|||
pli_hik_error_info |
|||
<where> |
|||
<if test="idCard != null and idCard != ''"> |
|||
AND ID_CARD = #{idCard} |
|||
</if> |
|||
</where> |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue