Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -3,15 +3,18 @@ package org.dromara.property.controller;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.excel.core.ExcelResult;
|
||||
import org.dromara.property.domain.vo.ResidentPersonImportVo;
|
||||
import org.dromara.property.listener.ResidentPersonImportListener;
|
||||
import org.dromara.property.utils.UploadFaceUtil;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
@@ -34,8 +37,9 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
* 前端访问路由地址为:/property/person
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-06-19
|
||||
* @since 2025-06-19
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@@ -124,8 +128,18 @@ public class ResidentPersonController extends BaseController {
|
||||
@SaCheckPermission("property:person:import")
|
||||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport, Long unitId) throws Exception {
|
||||
ExcelResult<ResidentPersonImportVo> result = ExcelUtil.importExcel(file.getInputStream(), ResidentPersonImportVo.class, new ResidentPersonImportListener(updateSupport, unitId));
|
||||
return R.ok(result.getAnalysis());
|
||||
asyncImportExcel(StpUtil.getTokenValue(), file, updateSupport, unitId);
|
||||
return R.ok("文件上传成功,请等待处理!");
|
||||
}
|
||||
|
||||
@Async
|
||||
public void asyncImportExcel(String tokenValue, MultipartFile file, Boolean updateSupport, Long unitId) {
|
||||
try {
|
||||
StpUtil.setTokenValueToStorage(tokenValue);
|
||||
ExcelUtil.importExcel(file.getInputStream(), ResidentPersonImportVo.class, new ResidentPersonImportListener(updateSupport, unitId));
|
||||
} catch (Exception e) {
|
||||
log.info("处理导入入驻员工Excel文件时出错!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,12 +153,22 @@ public class ResidentPersonController extends BaseController {
|
||||
/**
|
||||
* 导入人脸数据
|
||||
*
|
||||
* @param file 导入文件
|
||||
* @param file 导入文件
|
||||
* @param unitId 单位ID
|
||||
*/
|
||||
@PostMapping(value = "/importFace", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Void> importFace(@RequestPart("file") MultipartFile file, Long unitId) {
|
||||
uploadFaceUtil.processFaceZip(file, unitId);
|
||||
return R.ok();
|
||||
asyncImportFace(StpUtil.getTokenValue(), file, unitId);
|
||||
return R.ok("文件上传成功,请等待处理!");
|
||||
}
|
||||
|
||||
@Async
|
||||
public void asyncImportFace(String tokenValue, MultipartFile file, Long unitId) {
|
||||
try {
|
||||
StpUtil.setTokenValueToStorage(tokenValue);
|
||||
uploadFaceUtil.processFaceZip(file, unitId);
|
||||
} catch (Exception e) {
|
||||
log.info("处理人脸压缩包时出错");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -56,7 +56,22 @@ public class CleanOrder extends TenantEntity {
|
||||
* 单价
|
||||
*/
|
||||
private Double prices;
|
||||
|
||||
/**
|
||||
* 保洁类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 评价
|
||||
*/
|
||||
private Integer serviceEvalua;
|
||||
/**
|
||||
* 评价文本
|
||||
*/
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
|
@@ -32,6 +32,16 @@ public class Meet extends TenantEntity {
|
||||
* 会议室名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 会议室类型(
|
||||
* 1标准会议室
|
||||
* 2培训会议室
|
||||
* 3治谈会议室
|
||||
* 4多媒体会议室
|
||||
* 5圆形会议室
|
||||
* 6贵宾会议室)
|
||||
*/
|
||||
private String meetingRoomType;
|
||||
|
||||
/**
|
||||
* 位置
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.domain;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@@ -38,7 +39,10 @@ public class ServiceWorkOrders extends TenantEntity {
|
||||
* 工单名称
|
||||
*/
|
||||
private String orderName;
|
||||
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
private String processingWeight;
|
||||
/**
|
||||
* 工单类型
|
||||
*/
|
||||
@@ -74,6 +78,7 @@ public class ServiceWorkOrders extends TenantEntity {
|
||||
*/
|
||||
private String location;
|
||||
|
||||
|
||||
/**
|
||||
* 计划完成时间
|
||||
*/
|
||||
@@ -88,6 +93,18 @@ public class ServiceWorkOrders extends TenantEntity {
|
||||
* 评价
|
||||
*/
|
||||
private Integer serviceEvalua;
|
||||
/**
|
||||
* 评价文本
|
||||
*/
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否超时
|
||||
|
@@ -84,6 +84,13 @@ public class TbRoom extends TenantEntity {
|
||||
* 状态('空置','已售','已租','自用')
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 是否重要(1非常重要、2重要、3一般)
|
||||
*/
|
||||
private String isMatter;
|
||||
|
||||
|
||||
/**
|
||||
* 是否重要(1非常重要、2重要、3一般)
|
||||
*/
|
||||
private String imgUrl;
|
||||
}
|
||||
|
@@ -44,7 +44,11 @@ public class CleanOrderBo extends BaseEntity {
|
||||
* 面积
|
||||
*/
|
||||
private Double area;
|
||||
|
||||
/**
|
||||
* 保洁类型
|
||||
*/
|
||||
@NotBlank(message = "保洁类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String type;
|
||||
/**
|
||||
* 保洁id
|
||||
*/
|
||||
@@ -91,6 +95,18 @@ public class CleanOrderBo extends BaseEntity {
|
||||
* 单位id
|
||||
*/
|
||||
@NotNull(message = "单位id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
/**
|
||||
* 评价
|
||||
*/
|
||||
private Integer serviceEvalua;
|
||||
/**
|
||||
* 评价文本
|
||||
*/
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
private Long unitId;
|
||||
|
||||
// /**
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.domain.bo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import org.dromara.property.domain.Meet;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
@@ -35,7 +36,17 @@ public class MeetBo extends BaseEntity {
|
||||
*/
|
||||
@NotBlank(message = "会议室名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 会议室类型(
|
||||
* 1标准会议室
|
||||
* 2培训会议室
|
||||
* 3治谈会议室
|
||||
* 4多媒体会议室
|
||||
* 5圆形会议室
|
||||
* 6贵宾会议室)
|
||||
*/
|
||||
@NotBlank(message = "会议室类型不能为空")
|
||||
private String meetingRoomType;
|
||||
/**
|
||||
* 位置
|
||||
*/
|
||||
|
@@ -37,7 +37,7 @@ public class ResidentPersonBo extends BaseEntity {
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@NotBlank(message = "联系电话不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "联系电话不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String phone;
|
||||
/**
|
||||
* 人员类型
|
||||
@@ -53,7 +53,7 @@ public class ResidentPersonBo extends BaseEntity {
|
||||
/**
|
||||
* 证件号
|
||||
*/
|
||||
@NotBlank(message = "证件号不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "证件号不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package org.dromara.property.domain.bo;
|
||||
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -38,7 +39,11 @@ public class ServiceWorkOrdersBo extends BaseEntity {
|
||||
*/
|
||||
@NotNull(message = "工单名称不能为空", groups = { EditGroup.class })
|
||||
private String orderName;
|
||||
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
@ExcelProperty(value = "权重")
|
||||
private String processingWeight;
|
||||
/**
|
||||
* 工单类型
|
||||
*/
|
||||
@@ -76,7 +81,7 @@ public class ServiceWorkOrdersBo extends BaseEntity {
|
||||
/**
|
||||
* 计划完成时间
|
||||
*/
|
||||
@NotNull(message = "计划完成时间不能为空", groups = { EditGroup.class })
|
||||
//@NotNull(message = "计划完成时间不能为空", groups = { EditGroup.class })
|
||||
private Date planCompleTime;
|
||||
|
||||
/**
|
||||
@@ -88,6 +93,18 @@ public class ServiceWorkOrdersBo extends BaseEntity {
|
||||
* 评价
|
||||
*/
|
||||
private Integer serviceEvalua;
|
||||
/**
|
||||
* 评价文本
|
||||
*/
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否超时
|
||||
|
@@ -71,5 +71,12 @@ public class TbRoomBo extends BaseEntity {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
/**
|
||||
* 是否重要(1非常重要、2重要、3一般)
|
||||
*/
|
||||
private String isMatter;
|
||||
/**
|
||||
* 是否重要(1非常重要、2重要、3一般)
|
||||
*/
|
||||
private String imgUrl;
|
||||
}
|
||||
|
@@ -51,7 +51,22 @@ public class CleanOrderVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "面积")
|
||||
private Long area;
|
||||
|
||||
/**
|
||||
* 保洁类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 评价
|
||||
*/
|
||||
private Integer serviceEvalua;
|
||||
/**
|
||||
* 评价文本
|
||||
*/
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
// /**
|
||||
// * 保洁id
|
||||
// */
|
||||
|
@@ -37,7 +37,17 @@ public class MeetVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "会议室名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 会议室类型(
|
||||
* 1标准会议室
|
||||
* 2培训会议室
|
||||
* 3治谈会议室
|
||||
* 4多媒体会议室
|
||||
* 5圆形会议室
|
||||
* 6贵宾会议室)
|
||||
*/
|
||||
@ExcelProperty(value = "会议室类型")
|
||||
private String meetingRoomType;
|
||||
/**
|
||||
* 会议室位置
|
||||
*/
|
||||
|
@@ -39,6 +39,20 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
this.orderCount = orderCount;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*获取不满意工单名称
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class DissatisfactionVo {
|
||||
private String orderName; // 工单名称
|
||||
private Long id; // 工单id
|
||||
public DissatisfactionVo(String orderName, Long id) {
|
||||
this.orderName = orderName;
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 满意度图表数据对象
|
||||
*/
|
||||
@@ -86,6 +100,7 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
private List<SatisfactionChartVo> satisfactionRateList;
|
||||
private List<PieChartVo> satisfactionChartList;
|
||||
private List<BarChartVo> recentSixMonthWorkOrders;
|
||||
private List<DissatisfactionVo> dissatisfactionVos;
|
||||
|
||||
// 私有构造函数,确保使用Builder模式构建对象
|
||||
private ServiceWorkOrderAnalysisVo() {}
|
||||
@@ -107,6 +122,7 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
private List<SatisfactionChartVo> satisfactionRateList;
|
||||
private List<PieChartVo> satisfactionChartList;
|
||||
private List<BarChartVo> recentSixMonthWorkOrders;
|
||||
private List<DissatisfactionVo> dissatisfactionVos;
|
||||
|
||||
public ServiceWorkOrderAnalysisVo build() {
|
||||
ServiceWorkOrderAnalysisVo vo = new ServiceWorkOrderAnalysisVo();
|
||||
@@ -123,6 +139,7 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
vo.satisfactionRateList = this.satisfactionRateList;
|
||||
vo.satisfactionChartList = this.satisfactionChartList;
|
||||
vo.recentSixMonthWorkOrders = this.recentSixMonthWorkOrders;
|
||||
vo.dissatisfactionVos = this.dissatisfactionVos;
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
@@ -37,6 +37,11 @@ public class ServiceWorkOrdersVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "工单编号")
|
||||
private String orderNo;
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
@ExcelProperty(value = "权重")
|
||||
private String processingWeight;
|
||||
|
||||
/**
|
||||
* 工单名称
|
||||
@@ -123,14 +128,20 @@ public class ServiceWorkOrdersVo implements Serializable {
|
||||
private String isTimeOut;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
* 评价文本
|
||||
*/
|
||||
@ExcelProperty(value = "搜索值")
|
||||
private String searchValue;
|
||||
private String serviceEvaluaText;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
}
|
||||
|
@@ -112,5 +112,12 @@ public class TbRoomVo implements Serializable {
|
||||
|
||||
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "status", other = "wy_fjzt")
|
||||
private String statusName;
|
||||
|
||||
/**
|
||||
* 是否重要(1非常重要、2重要、3一般)
|
||||
*/
|
||||
private String isMatter;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
}
|
||||
|
@@ -57,33 +57,31 @@ public class ResidentPersonImportListener extends AnalysisEventListener<Resident
|
||||
@Override
|
||||
public void invoke(ResidentPersonImportVo personVo, AnalysisContext context) {
|
||||
ResidentUnitVo unitVo = residentUnitService.queryById(unitId);
|
||||
List<ResidentPersonVo> list = new ArrayList<>();
|
||||
ResidentPersonVo person = new ResidentPersonVo();
|
||||
// 判断证件号是否为空
|
||||
if (StringUtils.isEmpty(personVo.getIdCard())) {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>").append(failureNum).append("、账号 ").append(personVo.getUserName()).append(" 证件号不能为空!");
|
||||
} else {
|
||||
ResidentPersonBo personBo = new ResidentPersonBo();
|
||||
personBo.setUnitId(unitId);
|
||||
personBo.setIdCard(personVo.getIdCard());
|
||||
list = residentPersonService.queryList(personBo);
|
||||
person = residentPersonService.queryByUnitIdAndName(unitId, person.getUserName());
|
||||
}
|
||||
try {
|
||||
if (list.isEmpty()) { // 判断当前单位是否已存在该用户
|
||||
if (person == null) { // 判断当前单位是否已存在该用户
|
||||
ResidentPersonBo bo = BeanUtil.toBean(personVo, ResidentPersonBo.class);
|
||||
ValidatorUtils.validate(bo);
|
||||
bo.setState(1L);
|
||||
bo.setUnitId(unitId);
|
||||
bo.setTime(new Date());
|
||||
bo.setUnitName(unitVo.getName());
|
||||
bo.setUnitName(unitVo.getName().trim());
|
||||
bo.setAuthGroupId(unitVo.getAuthGroupId());
|
||||
bo.setAuthBegDate(unitVo.getAuthBegDate());
|
||||
bo.setAuthEndDate(unitVo.getAuthEndDate());
|
||||
bo.setUserName(personVo.getUserName().replaceAll("[\\s\u3000]", ""));
|
||||
residentPersonService.insertByBo(bo);
|
||||
successNum++;
|
||||
successMsg.append("<br/>").append(successNum).append("、账号 ").append(bo.getUserName()).append(" 导入成功");
|
||||
} else if (isUpdateSupport) {
|
||||
Long id = list.get(0).getUserId();
|
||||
Long id = person.getUserId();
|
||||
ResidentPersonBo bo = BeanUtil.toBean(personVo, ResidentPersonBo.class);
|
||||
bo.setId(id);
|
||||
ValidatorUtils.validate(bo);
|
||||
@@ -93,7 +91,7 @@ public class ResidentPersonImportListener extends AnalysisEventListener<Resident
|
||||
successMsg.append("<br/>").append(successNum).append("、账号 ").append(bo.getUserName()).append(" 更新成功");
|
||||
} else {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>").append(failureNum).append("、账号 ").append(list.get(0).getUserName()).append(" 已存在");
|
||||
failureMsg.append("<br/>").append(failureNum).append("、账号 ").append(personVo.getUserName()).append(" 已存在");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@@ -69,7 +69,7 @@ public interface IResidentPersonService {
|
||||
/**
|
||||
* 获取单位人员数量
|
||||
*
|
||||
* @param unitId 单元id
|
||||
* @param unitId 单位id
|
||||
* @return Long
|
||||
*/
|
||||
Long queryPersonCount(Long unitId);
|
||||
@@ -80,4 +80,12 @@ public interface IResidentPersonService {
|
||||
* @return List<ResidentPersonVo>
|
||||
*/
|
||||
List<ResidentPersonVo> queryUnAuthPerson();
|
||||
|
||||
/**
|
||||
* 通过单位和姓名,查询人员信息
|
||||
*
|
||||
* @param unitId 单位id
|
||||
* @param name 姓名
|
||||
*/
|
||||
ResidentPersonVo queryByUnitIdAndName(Long unitId, String name);
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ public class MeetAttachServiceImpl implements IMeetAttachService {
|
||||
*/
|
||||
@Override
|
||||
public List<MeetAttachVo> queryList(MeetAttachBo bo) {
|
||||
bo.setState(0);
|
||||
bo.setState(1);
|
||||
LambdaQueryWrapper<MeetAttach> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
@@ -13,8 +13,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.service.IResidentUnitService;
|
||||
import org.dromara.sis.api.RemoteSisAuth;
|
||||
import org.dromara.sis.api.domain.RemotePersonAuth;
|
||||
import org.dromara.sis.api.RemoteSisAuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -30,7 +29,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 入驻员工Service业务层处理
|
||||
@@ -50,7 +48,7 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
private IResidentUnitService residentUnitService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteSisAuth remoteSisAuth;
|
||||
private RemoteSisAuthService remoteSisAuthService;
|
||||
|
||||
/**
|
||||
* 查询入驻员工
|
||||
@@ -126,30 +124,8 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
add.setAuthGroupId(ruVo.getAuthGroupId());
|
||||
add.setAuthBegDate(ruVo.getAuthBegDate());
|
||||
add.setAuthEndDate(ruVo.getAuthEndDate());
|
||||
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "员工入驻失败!");
|
||||
// 存在图片时,才同步授权
|
||||
if (flag && add.getImg() != null) {
|
||||
log.info("开始写入授权记录, {}", bo.getUserName());
|
||||
RemotePersonAuth personAuth = new RemotePersonAuth();
|
||||
personAuth.setId(add.getId());
|
||||
personAuth.setName(bo.getUserName());
|
||||
personAuth.setSex(bo.getGender().intValue());
|
||||
personAuth.setPhone(bo.getPhone());
|
||||
personAuth.setEmail(bo.getEmail());
|
||||
personAuth.setIdCardNumber(bo.getIdCard());
|
||||
personAuth.setOssId(bo.getImg());
|
||||
personAuth.setCarNumber(bo.getCarNumber());
|
||||
|
||||
// 使用公司权限组
|
||||
personAuth.setAuthBegDate(ruVo.getAuthBegDate());
|
||||
personAuth.setAuthEndDate(ruVo.getAuthEndDate());
|
||||
personAuth.setAuthGroupId(ruVo.getAuthGroupId());
|
||||
|
||||
Boolean auth = remoteSisAuth.personAuth(personAuth);
|
||||
Assert.isTrue(auth, "新增授权记录失败");
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -169,33 +145,19 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
if (update.getAuthGroupId() != null && update.getAuthEndDate() != null && update.getImg() != null) {
|
||||
ResidentPersonVo vo = queryById(update.getId());
|
||||
Long e8Id = vo.getEEightId();
|
||||
flag = baseMapper.updateById(update) > 0;
|
||||
baseMapper.updateById(update);
|
||||
|
||||
// 显式移除e8id
|
||||
LambdaUpdateWrapper<ResidentPerson> lqw = new LambdaUpdateWrapper<>();
|
||||
lqw.eq(ResidentPerson::getId, update.getId())
|
||||
.set(ResidentPerson::getEEightId, null);
|
||||
baseMapper.update(lqw);
|
||||
flag = baseMapper.update(lqw) > 0;
|
||||
|
||||
|
||||
if (flag) {
|
||||
if (flag && e8Id != null) {
|
||||
log.info("开始修改授权记录, {}", bo.getUserName());
|
||||
RemotePersonAuth personAuth = new RemotePersonAuth();
|
||||
personAuth.setId(update.getId());
|
||||
personAuth.setName(update.getUserName());
|
||||
personAuth.setSex(update.getGender().intValue());
|
||||
personAuth.setPhone(update.getPhone());
|
||||
personAuth.setEmail(update.getEmail());
|
||||
personAuth.setIdCardNumber(update.getIdCard());
|
||||
personAuth.setOssId(update.getImg());
|
||||
personAuth.setCarNumber(update.getCarNumber());
|
||||
personAuth.setE8Id(e8Id);
|
||||
|
||||
personAuth.setAuthGroupId(update.getAuthGroupId());
|
||||
personAuth.setAuthBegDate(update.getAuthBegDate());
|
||||
personAuth.setAuthEndDate(update.getAuthEndDate());
|
||||
|
||||
Boolean auth = remoteSisAuth.updatePersonAuth(personAuth);
|
||||
// 先删除,定时任务增加
|
||||
Boolean auth = remoteSisAuthService.deletePersonAuth(List.of(update.getId()), List.of(e8Id));
|
||||
Assert.isTrue(auth, "修改授权记录失败!");
|
||||
}
|
||||
|
||||
@@ -224,7 +186,7 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
private void validEntityBeforeSave(ResidentPerson entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
LambdaQueryWrapper<ResidentPerson> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(ResidentPerson::getIdCard, entity.getIdCard())
|
||||
lqw.eq(ResidentPerson::getIdCard, entity.getUserName())
|
||||
.eq(ResidentPerson::getUnitId, entity.getUnitId());
|
||||
boolean exists = baseMapper.exists(lqw);
|
||||
Assert.isTrue(!exists, "当前单位,{}已入驻!", entity.getUserName());
|
||||
@@ -252,8 +214,10 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
.map(ResidentPersonVo::getEEightId)
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
boolean auth = remoteSisAuth.deletePersonAuth(ids, e8Ids);
|
||||
Assert.isTrue(auth, "删除授权记录失败!");
|
||||
if (!e8Ids.isEmpty()) {
|
||||
boolean auth = remoteSisAuthService.deletePersonAuth(ids, e8Ids);
|
||||
Assert.isTrue(auth, "删除授权记录失败!");
|
||||
}
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
@@ -284,4 +248,19 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
.isNull(ResidentPerson::getEEightId);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过单位和姓名,查询人员信息
|
||||
*
|
||||
* @param unitId 单位id
|
||||
* @param name 姓名
|
||||
*/
|
||||
@Override
|
||||
public ResidentPersonVo queryByUnitIdAndName(Long unitId, String name) {
|
||||
LambdaQueryWrapper<ResidentPerson> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(ResidentPerson::getUnitId, unitId)
|
||||
.eq(ResidentPerson::getUserName, name);
|
||||
List<ResidentPersonVo> list = baseMapper.selectVoList(lqw);
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
}
|
||||
|
@@ -14,9 +14,8 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
@@ -39,7 +38,7 @@ public class UploadFaceUtil {
|
||||
// 安全配置参数(实际项目中可以从配置文件读取)
|
||||
private static final int MAX_TOTAL_SIZE = 50 * 1024 * 1024; // 50MB 最大解压总大小
|
||||
private static final int MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB 最大单个文件大小
|
||||
private static final int MAX_FILE_COUNT = 30; // 最大文件数量
|
||||
private static final int MAX_FILE_COUNT = 50; // 最大文件数量
|
||||
|
||||
private static final Map<String, String> CONTENT_TYPE_MAP = new HashMap<>();
|
||||
static {
|
||||
@@ -59,7 +58,7 @@ public class UploadFaceUtil {
|
||||
// 重置统计信息
|
||||
resetStats();
|
||||
|
||||
try (ZipInputStream zis = new ZipInputStream(zipFile.getInputStream())) {
|
||||
try (ZipInputStream zis = new ZipInputStream(zipFile.getInputStream(), Charset.forName("GBK"))) {
|
||||
ZipEntry entry;
|
||||
byte[] buffer = new byte[8192]; // 8KB缓冲区
|
||||
long totalExtractedSize = 0;
|
||||
@@ -126,19 +125,16 @@ public class UploadFaceUtil {
|
||||
bao.write(buffer, 0, len);
|
||||
}
|
||||
|
||||
ResidentPersonBo bo = new ResidentPersonBo();
|
||||
bo.setUnitId(unitId);
|
||||
bo.setUserName(name);
|
||||
List<ResidentPersonVo> personVos = residentPersonService.queryList(bo);
|
||||
ResidentPersonVo personVo = residentPersonService.queryByUnitIdAndName(unitId, name);
|
||||
// 判断当前姓名是否存在入驻单位
|
||||
if (personVos.isEmpty()) continue;
|
||||
if (personVo == null) continue;
|
||||
|
||||
byte[] imageData = bao.toByteArray();
|
||||
|
||||
RemoteFile remoteFile = remoteFileService.upload(name, name, contentType, imageData);
|
||||
RemoteFile remoteFile = remoteFileService.upload(name, entry.getName(), contentType, imageData);
|
||||
|
||||
personVos.get(0).setImg(remoteFile.getOssId().toString());
|
||||
ResidentPersonBo updateBo = BeanUtil.toBean(personVos.get(0), ResidentPersonBo.class);
|
||||
personVo.setImg(remoteFile.getOssId().toString());
|
||||
ResidentPersonBo updateBo = BeanUtil.toBean(personVo, ResidentPersonBo.class);
|
||||
residentPersonService.updateByBo(updateBo);
|
||||
|
||||
totalFiles++;
|
||||
|
Reference in New Issue
Block a user