This commit is contained in:
lxj
2025-08-28 16:08:42 +08:00
80 changed files with 323 additions and 146 deletions

View File

@@ -4,6 +4,8 @@ package org.dromara.sis.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -17,6 +19,7 @@ import org.dromara.sis.service.ISisPersonLibImgService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
@@ -40,46 +43,38 @@ public class SisVisitorController {
* 查询人员通行记录
*/
@GetMapping("/list")
public TableDataInfo<AccessRecordFindRes> list(QueryDto dto) {
public TableDataInfo<AccessRecordFindRes> list(@RequestParam(required = false) String beginTime,
@RequestParam(required = false) String endTime,
@NotNull(message = "页码不能为空") @RequestParam Integer pageNum,
@NotNull(message = "页数不能为空") @RequestParam Integer pageSize,
@RequestParam(required = false) String personName,
@RequestParam(required = false) Integer recordType) {
AccessRecordFindReq req = new AccessRecordFindReq();
if (beginTime != null && !beginTime.isEmpty()) {
req.setStartTime(DateUtil.format(DateUtil.parse(beginTime), "yyyy-MM-dd 00:00:00"));
} else {
// 默认设置为7天前
req.setStartTime(DateUtil.format(DateUtil.offset(new Date(), DateField.DAY_OF_MONTH, -7), "yyyy-MM-dd 00:00:00"));
}
if (endTime != null && !endTime.isEmpty()) {
req.setEndTime(DateUtil.format(DateUtil.parse(endTime), "yyyy-MM-dd 23:59:59"));
} else {
// 默认设置为今天
req.setEndTime(DateUtil.format(new Date(), "yyyy-MM-dd 23:59:59"));
}
TableDataInfo tableDataInfo = new TableDataInfo();
List<AccessRecordFindRes> accessRecordFindResList = new ArrayList<>();
AccessRecordFindRes accessRecordFindRes = new AccessRecordFindRes();
accessRecordFindRes.setDeviceName("4#岗亭09");
accessRecordFindRes.setDoorName("4#岗亭09");
accessRecordFindRes.setDeviceType(1102);
accessRecordFindRes.setReaderName("");
accessRecordFindRes.setGatewayType(1);
accessRecordFindRes.setCustomerName("德隆吴鹏");
accessRecordFindRes.setOrganFullPath("主楼11楼");
accessRecordFindRes.setPictureUrl("https://bpic.588ku.com/back_list_pic/23/04/21/ef5e2a3dd5cfc336fdcf2fd000474f0f.jpg");
accessRecordFindRes.setCardType(34);
accessRecordFindRes.setRecordType(2);
accessRecordFindRes.setActionTime(new Date());
accessRecordFindResList.add(accessRecordFindRes);
tableDataInfo.setRows(accessRecordFindResList);
tableDataInfo.setTotal(1);
tableDataInfo.setCode(200);
return tableDataInfo;
//
// dto.setPageIndex(1);
// dto.setMaxResultCount(20);
//
// // 10秒内
// String starTime = DateUtil.format(DateUtil.offset(new Date(), DateField.SECOND, -10), "yyyy-MM-dd HH:mm:ss");
// String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
//
// AccessRecordFindReq lift = new AccessRecordFindReq();
// lift.setStartTime(starTime);
// lift.setEndTime(endTime);
// lift.setRecordType(2);
// // 9号电梯
// lift.setDeviceId(550757939925061L);
// dto.setQueryDto(lift);
//// TableDataInfo<AccessRecordFindRes> nineLiftList = e8PlatformApi.getPageAccessRecordList(dto);
// TableDataInfo<AccessRecordFindRes> pageAccessRecordList = new TableDataInfo();
//
// return e8PlatformApi.getPageAccessRecordList(dto);
//如果pageAccessRecordList报错就捕获并封装
if (personName != null && !personName.isEmpty()) {
req.setCustomerName(personName);
}
if (recordType != null) {
req.setRecordType(recordType);
}
QueryDto dto = new QueryDto();
dto.setQueryDto(req);
dto.setPageIndex(pageNum);
dto.setMaxResultCount(pageSize);
return e8PlatformApi.getPageAccessRecordList(dto);
}
}

View File

@@ -37,6 +37,7 @@ import org.dromara.sis.sdk.e8.domain.voucher.req.IssueVoucherReq;
import org.dromara.sis.sdk.e8.domain.voucher.req.OperateVoucherReq;
import org.dromara.sis.sdk.e8.domain.voucher.res.IssueVoucherRes;
import org.dromara.sis.sdk.e8.utils.E8ApiUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@@ -55,6 +56,11 @@ public class E8PlatformApiService implements E8PlatformApi {
private final E8ApiUtil e8ApiUtil;
@Value("${E8Plat.imgUrl}")
private String imgUrl;
private final static String URL = "http://192.168.24.8:50030";
//***************************************客户信息接口*******************************************
private final static String CUSTOMER_GET_PAGE_LIST = "/api/E8/customer/get-page-list";
private final static String CUSTOMER_GET_FIRST_OR_DEFAULT = "/api/E8/customer/get-first-or-default";
@@ -422,6 +428,18 @@ public class E8PlatformApiService implements E8PlatformApi {
tableData.setTotal(Long.parseLong(result.get("total").toString()));
// 从结果映射中获取项目列表,转换为访问记录信息列表后设置到分页对象中
tableData.setRows(JSONUtil.toList(JSONUtil.toJsonStr(result.get("item")), AccessRecordFindRes.class));
for (AccessRecordFindRes res : tableData.getRows()){
if (res.getVoucherUrl() != null && !res.getVoucherUrl().isEmpty()) {
res.setVoucherUrl(res.getVoucherUrl().replace(URL, imgUrl));
}
if (res.getPictureUrl() != null && !res.getPictureUrl().isEmpty()) {
res.setPictureUrl(res.getPictureUrl().replace(URL, imgUrl));
}
}
tableData.setCode(200);
tableData.setMsg("查询成功");
// 返回填充了数据的分页对象
return tableData;
}