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:
@@ -14,6 +14,7 @@
|
||||
<module>ruoyi-api-resource</module>
|
||||
<module>ruoyi-api-workflow</module>
|
||||
<module>property-api</module>
|
||||
<module>sis-api</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>ruoyi-api</artifactId>
|
||||
|
29
ruoyi-api/sis-api/pom.xml
Normal file
29
ruoyi-api/sis-api/pom.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>sis-api</artifactId>
|
||||
|
||||
<description>
|
||||
安防api模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- RuoYi Common Core-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@@ -0,0 +1,13 @@
|
||||
package org.dromara.sis.api;
|
||||
|
||||
import org.dromara.sis.api.domain.RemotePersonAuth;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote RemoteSisAuth
|
||||
* @since 2025/7/24
|
||||
*/
|
||||
public interface RemoteSisAuth {
|
||||
|
||||
Long personAuth(RemotePersonAuth personAuth);
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package org.dromara.sis.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote RemotePersonAuth
|
||||
* @since 2025/7/24
|
||||
*/
|
||||
@Data
|
||||
public class RemotePersonAuth implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer sex;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String email;
|
||||
|
||||
private Integer cardType = 1;
|
||||
|
||||
private String idCardNumber;
|
||||
|
||||
private String ossId;
|
||||
|
||||
private String carNumber;
|
||||
|
||||
private Long authGroupId;
|
||||
|
||||
private Date begDate;
|
||||
|
||||
private Date endDate;
|
||||
|
||||
}
|
@@ -115,6 +115,12 @@
|
||||
<artifactId>property-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>sis-api</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@@ -40,7 +40,7 @@ public class CustomerNoticesController extends BaseController {
|
||||
/**
|
||||
* 查询客户服务-通知公告列表
|
||||
*/
|
||||
@SaCheckPermission("domain:notices:list")
|
||||
//@SaCheckPermission("domain:notices:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CustomerNoticesVo> list(CustomerNoticesBo bo, PageQuery pageQuery) {
|
||||
return customerNoticesService.queryPageList(bo, pageQuery);
|
||||
@@ -62,7 +62,7 @@ public class CustomerNoticesController extends BaseController {
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("domain:notices:query")
|
||||
//@SaCheckPermission("domain:notices:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<CustomerNoticesVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
|
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -28,8 +29,8 @@ public class EnumFetcherController {
|
||||
*/
|
||||
|
||||
@GetMapping("/enum-values/{name}")
|
||||
public R<Map<Object, Object>> getEnumValues(@PathVariable("name") String name) {
|
||||
Map<Object, Object> map = enumFetcherService.getEnumValues(name);
|
||||
public R<List<Map<Object, Object>>> getEnumValues(@PathVariable("name") String name) {
|
||||
List<Map<Object, Object>> map = enumFetcherService.getEnumValues(name);
|
||||
return R.ok(map);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,51 @@
|
||||
package org.dromara.property.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 客户服务-应急预案审核记录对象 customer_contingen_plan_record
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("customer_contingen_plan_record")
|
||||
public class CustomerContingenPlanRecord extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工单id
|
||||
*/
|
||||
private Long contingenPlanId;
|
||||
|
||||
/**
|
||||
* 状态(0.待审核1.待进行2.已完成)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 责任人
|
||||
*/
|
||||
private Long dutyPersion;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
|
||||
}
|
@@ -4,6 +4,7 @@ import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.io.Serial;
|
||||
@@ -27,82 +28,78 @@ public class ResidentPerson extends TenantEntity {
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private Long gender;
|
||||
|
||||
/**
|
||||
* 人脸图片
|
||||
*/
|
||||
private String img;
|
||||
|
||||
/**
|
||||
* 所属单位id
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 所属单位名称
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 入驻位置
|
||||
*/
|
||||
private String locathon;
|
||||
|
||||
/**
|
||||
* 入驻时间
|
||||
*/
|
||||
private Date time;
|
||||
|
||||
/**
|
||||
* 车牌号码
|
||||
*/
|
||||
private String carNumber;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long state;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 权限组
|
||||
*/
|
||||
private Long authGroupId;
|
||||
|
||||
/**
|
||||
* e8平台id
|
||||
*/
|
||||
private Long eEightId;
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long createById;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
private Long updateById;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
|
@@ -0,0 +1,53 @@
|
||||
package org.dromara.property.domain.bo;
|
||||
|
||||
import org.dromara.property.domain.CustomerContingenPlanRecord;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 客户服务-应急预案审核记录业务对象 customer_contingen_plan_record
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = CustomerContingenPlanRecord.class, reverseConvertGenerate = false)
|
||||
public class CustomerContingenPlanRecordBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工单id
|
||||
*/
|
||||
@NotNull(message = "工单id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long contingenPlanId;
|
||||
|
||||
/**
|
||||
* 状态(0.待审核1.待进行2.已完成)
|
||||
*/
|
||||
@NotBlank(message = "状态(0.待审核1.待进行2.已完成)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 责任人
|
||||
*/
|
||||
@NotNull(message = "责任人不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long dutyPersion;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
|
||||
}
|
@@ -27,12 +27,6 @@ public class ResidentPersonBo extends BaseEntity {
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@@ -51,6 +45,38 @@ public class ResidentPersonBo extends BaseEntity {
|
||||
@NotNull(message = "性别不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long gender;
|
||||
|
||||
/**
|
||||
* 权限组
|
||||
*/
|
||||
@NotNull(message = "权限组不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long authGroupId;
|
||||
|
||||
/**
|
||||
* 证件号
|
||||
*/
|
||||
@NotBlank(message = "证件号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date begDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* e8平台id
|
||||
*/
|
||||
private Long eEightId;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 人脸图片
|
||||
*/
|
||||
@@ -84,15 +110,8 @@ public class ResidentPersonBo extends BaseEntity {
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
// @NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long state=1L;
|
||||
|
||||
/**
|
||||
* 权限组
|
||||
*/
|
||||
@NotNull(message = "权限组不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long authGroupId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
@@ -70,13 +70,13 @@ public class TbCommunityBo extends BaseEntity {
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@NotBlank(message = "经度不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "经度不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String lon;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
@NotBlank(message = "维度不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "维度不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,67 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
|
||||
import org.dromara.property.domain.CustomerContingenPlanRecord;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 客户服务-应急预案审核记录视图对象 customer_contingen_plan_record
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = CustomerContingenPlanRecord.class)
|
||||
public class CustomerContingenPlanRecordVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工单id
|
||||
*/
|
||||
@ExcelProperty(value = "工单id")
|
||||
private Long contingenPlanId;
|
||||
|
||||
/**
|
||||
* 状态(0.待审核1.待进行2.已完成)
|
||||
*/
|
||||
@ExcelProperty(value = "状态(0.待审核1.待进行2.已完成)")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 责任人
|
||||
*/
|
||||
@ExcelProperty(value = "责任人")
|
||||
private Long dutyPersion;
|
||||
/**
|
||||
* 责任人姓名
|
||||
*/
|
||||
@ExcelProperty(value = "责任人姓名")
|
||||
private String dutyPersionName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
@@ -9,7 +9,7 @@ import org.dromara.property.domain.CustomerContingenPlan;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -98,6 +98,9 @@ public class CustomerContingenPlanVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "最后更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 预案记录列表
|
||||
*/
|
||||
List<CustomerContingenPlanRecordVo> contingenPlanRecordVos;
|
||||
|
||||
}
|
||||
|
@@ -52,6 +52,11 @@ public class CustomerNoticesVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "通知人")
|
||||
private String noticePersion;
|
||||
/**
|
||||
* 通知人姓名
|
||||
*/
|
||||
@ExcelProperty(value = "通知人姓名")
|
||||
private String noticePersionName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -88,6 +93,11 @@ public class CustomerNoticesVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "发布人")
|
||||
private Long issuers;
|
||||
/**
|
||||
* 发布人姓名
|
||||
*/
|
||||
@ExcelProperty(value = "发布人姓名")
|
||||
private String issuersName;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
|
@@ -49,7 +49,10 @@ public class ResidentPersonVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "联系电话")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
|
@@ -5,9 +5,10 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ServiceWorkOrderAnalysisVo {
|
||||
|
||||
/**
|
||||
* 工单看板当前周折线图
|
||||
*/
|
||||
@@ -17,13 +18,32 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
private String date;
|
||||
private String dayOfWeek;
|
||||
private long count;
|
||||
private long weekCount;
|
||||
|
||||
public LineChartVo(String date, String dayOfWeek, long count) {
|
||||
public LineChartVo() {}
|
||||
|
||||
public LineChartVo(String date, String dayOfWeek, long count,long weekCount) {
|
||||
this.date = date;
|
||||
this.dayOfWeek = dayOfWeek;
|
||||
this.count = count;
|
||||
this.weekCount = weekCount;
|
||||
}
|
||||
|
||||
}
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class BarChartVo {
|
||||
private String month; // 月份,如 "2025-02"
|
||||
private int orderCount; // 工单数量
|
||||
}
|
||||
/**
|
||||
* 满意度图表数据对象
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class SatisfactionChartVo {
|
||||
private String name; // 满意度名称:如“满意”
|
||||
private Long value; // 数量
|
||||
private Double rate; // 占比(百分比)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,18 +53,30 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
@Accessors(chain = true)
|
||||
public static class PieChartVo {
|
||||
private String type; // 工单类型
|
||||
private Long quantity; // 工单类型
|
||||
private Long quantity; // 工单数量
|
||||
private double percentage; // 占比
|
||||
|
||||
public PieChartVo(String type, Long quantity, double percentage) {
|
||||
this.type = type;
|
||||
this.quantity = quantity;
|
||||
this.percentage = percentage;
|
||||
public PieChartVo(String string, Long count, double percentage) {
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
}
|
||||
|
||||
private int workOrdersTotal;
|
||||
private int notWorkOrdersTotal;
|
||||
private int novertimeOrdersTotal;
|
||||
private int inHandOrdersTotal;
|
||||
private double novertimeOrdersRate;
|
||||
private int monthOrdersTotal;
|
||||
private int outTimeOrdersTotal;
|
||||
private double monthoSatisfaction;
|
||||
private int satisfaction;
|
||||
private List<LineChartVo> recentWeekWorkOrders;
|
||||
private List<SatisfactionChartVo> satisfactionRateList;
|
||||
private List<PieChartVo> satisfactionChartList;
|
||||
private List<BarChartVo> recentSixMonthWorkOrders;
|
||||
|
||||
// 私有构造函数,确保使用Builder模式构建对象
|
||||
private ServiceWorkOrderAnalysisVo() {}
|
||||
|
||||
// Builder Pattern for ServiceWorkOrderAnalysisVo
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@@ -59,24 +91,9 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
private double monthoSatisfaction;
|
||||
private int satisfaction;
|
||||
private List<LineChartVo> recentWeekWorkOrders;
|
||||
private List<PieChartVo> workOrderTypeDistribution;
|
||||
|
||||
// Setters
|
||||
public ServiceWorkOrderCount setWorkOrdersTotal(int workOrdersTotal) {
|
||||
this.workOrdersTotal = workOrdersTotal;
|
||||
return this;
|
||||
}
|
||||
// ...其他Setter...
|
||||
|
||||
public ServiceWorkOrderCount setRecentWeekWorkOrders(List<LineChartVo> recentWeekWorkOrders) {
|
||||
this.recentWeekWorkOrders = recentWeekWorkOrders;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ServiceWorkOrderCount setWorkOrderTypeDistribution(List<PieChartVo> workOrderTypeDistribution) {
|
||||
this.workOrderTypeDistribution = workOrderTypeDistribution;
|
||||
return this;
|
||||
}
|
||||
private List<SatisfactionChartVo> satisfactionRateList;
|
||||
private List<PieChartVo> satisfactionChartList;
|
||||
private List<BarChartVo> recentSixMonthWorkOrders;
|
||||
|
||||
public ServiceWorkOrderAnalysisVo build() {
|
||||
ServiceWorkOrderAnalysisVo vo = new ServiceWorkOrderAnalysisVo();
|
||||
@@ -90,26 +107,10 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
vo.monthoSatisfaction = this.monthoSatisfaction;
|
||||
vo.satisfaction = this.satisfaction;
|
||||
vo.recentWeekWorkOrders = this.recentWeekWorkOrders;
|
||||
vo.workOrderTypeDistribution = this.workOrderTypeDistribution;
|
||||
vo.satisfactionRateList = this.satisfactionRateList;
|
||||
vo.satisfactionChartList = this.satisfactionChartList;
|
||||
vo.recentSixMonthWorkOrders = this.recentSixMonthWorkOrders;
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
private int workOrdersTotal;
|
||||
private int notWorkOrdersTotal;
|
||||
private int novertimeOrdersTotal;
|
||||
private int inHandOrdersTotal;
|
||||
private double novertimeOrdersRate;
|
||||
private int monthOrdersTotal;
|
||||
private int outTimeOrdersTotal;
|
||||
private double monthoSatisfaction;
|
||||
private int satisfaction;
|
||||
private List<LineChartVo> recentWeekWorkOrders;
|
||||
private List<PieChartVo> workOrderTypeDistribution;
|
||||
|
||||
// Constructor is private to enforce use of builder pattern
|
||||
public ServiceWorkOrderAnalysisVo() {
|
||||
}
|
||||
|
||||
// Getters...
|
||||
}
|
||||
|
@@ -0,0 +1,17 @@
|
||||
package org.dromara.property.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.property.domain.CustomerContingenPlanRecord;
|
||||
import org.dromara.property.domain.vo.CustomerContingenPlanRecordVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 客户服务-应急预案审核记录Mapper接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Mapper
|
||||
public interface CustomerContingenPlanRecordMapper extends BaseMapperPlus<CustomerContingenPlanRecord, CustomerContingenPlanRecordVo> {
|
||||
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -13,5 +14,5 @@ public interface EnumFetcherService {
|
||||
* @param type 大驼峰格式
|
||||
* @return
|
||||
*/
|
||||
Map<Object, Object>getEnumValues(String type);
|
||||
List<Map<Object, Object>> getEnumValues(String type);
|
||||
}
|
||||
|
@@ -65,4 +65,5 @@ public interface ICustomerContingenPlanService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
}
|
||||
|
@@ -72,5 +72,5 @@ public interface IMeetAttachService {
|
||||
* 获取下拉接口数据
|
||||
* @param type
|
||||
*/
|
||||
Map<Object, Object> getMeetAttachSelectDate(String type);
|
||||
List<Map<Object, Object>> getMeetAttachSelectDate(String type);
|
||||
}
|
||||
|
@@ -84,6 +84,6 @@ public interface IMeetBookingService {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
Map<Object, Object> getMeetBooking(String type);
|
||||
List<Map<Object, Object>> getMeetBooking(String type);
|
||||
|
||||
}
|
||||
|
@@ -72,5 +72,5 @@ public interface IMeetService {
|
||||
* 获取下拉接口数据
|
||||
* @param type
|
||||
*/
|
||||
Map<Object,Object> getMeetSelectDate(String type);
|
||||
List<Map<Object, Object>> getMeetSelectDate(String type);
|
||||
}
|
||||
|
@@ -171,6 +171,7 @@ public class CostCarChargeServiceImpl implements ICostCarChargeService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CostCarChargeBo bo) {
|
||||
CostCarCharge update = MapstructUtils.convert(bo, CostCarCharge.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -192,6 +193,7 @@ public class CostCarChargeServiceImpl implements ICostCarChargeService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -211,7 +211,6 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -16,6 +16,7 @@ import org.dromara.property.domain.vo.CostItemsVo;
|
||||
import org.dromara.property.domain.CostItems;
|
||||
import org.dromara.property.mapper.CostItemsMapper;
|
||||
import org.dromara.property.service.ICostItemsService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -98,6 +99,7 @@ public class CostItemsServiceImpl implements ICostItemsService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CostItemsBo bo) {
|
||||
CostItems add = MapstructUtils.convert(bo, CostItems.class);
|
||||
add.setChargeNo( RandomUtil.randomNumbers(11));
|
||||
@@ -116,6 +118,7 @@ public class CostItemsServiceImpl implements ICostItemsService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CostItemsBo bo) {
|
||||
CostItems update = MapstructUtils.convert(bo, CostItems.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -137,6 +140,7 @@ public class CostItemsServiceImpl implements ICostItemsService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.CostMeterTypeVo;
|
||||
import org.dromara.property.domain.CostMeterType;
|
||||
import org.dromara.property.mapper.CostMeterTypeMapper;
|
||||
import org.dromara.property.service.ICostMeterTypeService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -87,6 +88,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CostMeterTypeBo bo) {
|
||||
CostMeterType add = MapstructUtils.convert(bo, CostMeterType.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -104,6 +106,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CostMeterTypeBo bo) {
|
||||
CostMeterType update = MapstructUtils.convert(bo, CostMeterType.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -125,6 +128,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -16,6 +16,7 @@ import org.dromara.property.domain.vo.CostMeterWaterVo;
|
||||
import org.dromara.property.domain.CostMeterWater;
|
||||
import org.dromara.property.mapper.CostMeterWaterMapper;
|
||||
import org.dromara.property.service.ICostMeterWaterService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -94,6 +95,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CostMeterWaterBo bo) {
|
||||
CostMeterWater add = MapstructUtils.convert(bo, CostMeterWater.class);
|
||||
add.setCurReadingTime(new Date());
|
||||
@@ -112,6 +114,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CostMeterWaterBo bo) {
|
||||
CostMeterWater update = MapstructUtils.convert(bo, CostMeterWater.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -133,6 +136,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -21,6 +21,7 @@ import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.property.service.ICostPayFeeAuditService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -135,6 +136,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CostPayFeeAuditBo bo) {
|
||||
CostPayFeeAudit add = MapstructUtils.convert(bo, CostPayFeeAudit.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -152,6 +154,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CostPayFeeAuditBo bo) {
|
||||
CostPayFeeAudit update = MapstructUtils.convert(bo, CostPayFeeAudit.class);
|
||||
validEntityBeforeUpdate(update);
|
||||
@@ -204,6 +207,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -20,6 +20,7 @@ import org.dromara.property.mapper.CostHouseChargeMapper;
|
||||
import org.dromara.property.mapper.CostReturnPayFeeMapper;
|
||||
import org.dromara.property.service.ICostReturnPayFeeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -100,6 +101,7 @@ public class CostReturnPayFeeServiceImpl implements ICostReturnPayFeeService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CostReturnPayFeeBo bo) {
|
||||
CostReturnPayFee add = MapstructUtils.convert(bo, CostReturnPayFee.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -117,6 +119,7 @@ public class CostReturnPayFeeServiceImpl implements ICostReturnPayFeeService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CostReturnPayFeeBo bo) {
|
||||
CostReturnPayFee update = MapstructUtils.convert(bo, CostReturnPayFee.class);
|
||||
validEntityBeforeUpdate(update);
|
||||
|
@@ -11,15 +11,20 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.property.domain.CustomerContingenPlan;
|
||||
import org.dromara.property.domain.CustomerContingenPlanRecord;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
import org.dromara.property.domain.bo.CustomerContingenPlanBo;
|
||||
import org.dromara.property.domain.vo.CustomerContingenPlanRecordVo;
|
||||
import org.dromara.property.domain.vo.CustomerContingenPlanVo;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.mapper.CustomerContingenPlanMapper;
|
||||
import org.dromara.property.mapper.CustomerContingenPlanRecordMapper;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
import org.dromara.property.service.ICustomerContingenPlanService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -38,6 +43,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
|
||||
private final CustomerContingenPlanMapper baseMapper;
|
||||
private final ResidentPersonMapper residentPersonMapper;
|
||||
private final CustomerContingenPlanRecordMapper customerContingenPlanRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询客户服务-应急预案
|
||||
@@ -49,9 +55,18 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
public CustomerContingenPlanVo queryById(Long id) {
|
||||
CustomerContingenPlanVo customerContingenPlanVo = baseMapper.selectVoById(id);
|
||||
ResidentPerson residentPerson = residentPersonMapper.selectById(customerContingenPlanVo.getInitiat());
|
||||
customerContingenPlanVo.setInitiatName(ObjectUtil.isNotEmpty(residentPerson)?residentPerson.getUserName():null);
|
||||
customerContingenPlanVo.setInitiatName(ObjectUtil.isNotEmpty(residentPerson) ? residentPerson.getUserName() : null);
|
||||
ResidentPerson dutyPerson = residentPersonMapper.selectById(customerContingenPlanVo.getDutyPersion());
|
||||
customerContingenPlanVo.setDutyPersionName(ObjectUtil.isNotEmpty(residentPerson)?dutyPerson.getUserName():null);
|
||||
customerContingenPlanVo.setDutyPersionName(ObjectUtil.isNotEmpty(residentPerson) ? dutyPerson.getUserName() : null);
|
||||
LambdaQueryWrapper<CustomerContingenPlanRecord> recordQueryWrapper = new LambdaQueryWrapper<>();
|
||||
recordQueryWrapper.eq(CustomerContingenPlanRecord::getContingenPlanId, id);
|
||||
List<CustomerContingenPlanRecordVo> contingenPlanRecordVos = customerContingenPlanRecordMapper.selectVoList(recordQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(contingenPlanRecordVos)) {
|
||||
contingenPlanRecordVos.stream().forEach(s -> {
|
||||
s.setDutyPersionName(customerContingenPlanVo.getDutyPersionName());
|
||||
});
|
||||
customerContingenPlanVo.setContingenPlanRecordVos(contingenPlanRecordVos);
|
||||
}
|
||||
return customerContingenPlanVo;
|
||||
}
|
||||
|
||||
@@ -71,10 +86,10 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
result.getRecords().stream().forEach(s -> {
|
||||
ResidentPerson residentInitiatVo = residentPeoplelist.stream()
|
||||
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getInitiat())).findFirst().orElse(null);
|
||||
s.setInitiatName(ObjectUtil.isNotEmpty(residentInitiatVo)?residentInitiatVo.getUserName():null);
|
||||
s.setInitiatName(ObjectUtil.isNotEmpty(residentInitiatVo) ? residentInitiatVo.getUserName() : null);
|
||||
ResidentPerson residentDutyVo = residentPeoplelist.stream()
|
||||
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getDutyPersion())).findFirst().orElse(null);
|
||||
s.setDutyPersionName(ObjectUtil.isNotEmpty(residentDutyVo)?residentDutyVo.getUserName():null);
|
||||
s.setDutyPersionName(ObjectUtil.isNotEmpty(residentDutyVo) ? residentDutyVo.getUserName() : null);
|
||||
});
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
@@ -97,6 +112,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
LambdaQueryWrapper<CustomerContingenPlan> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(CustomerContingenPlan::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContingenPlanType()), CustomerContingenPlan::getContingenPlanType, bo.getContingenPlanType());
|
||||
lqw.eq(ObjectUtil.isNotEmpty(bo.getDutyPersion()), CustomerContingenPlan::getDutyPersion, bo.getDutyPersion());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getContingenPlanName()), CustomerContingenPlan::getContingenPlanName, bo.getContingenPlanName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContingenPlanContent()), CustomerContingenPlan::getContingenPlanContent, bo.getContingenPlanContent());
|
||||
lqw.eq(ObjectUtil.isNotEmpty(bo.getInitiat()), CustomerContingenPlan::getInitiat, bo.getInitiat());
|
||||
@@ -112,6 +128,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CustomerContingenPlanBo bo) {
|
||||
CustomerContingenPlan add = MapstructUtils.convert(bo, CustomerContingenPlan.class);
|
||||
add.setStatus("0");
|
||||
@@ -119,6 +136,11 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
CustomerContingenPlanRecord customerContingenPlanRecord = new CustomerContingenPlanRecord();
|
||||
customerContingenPlanRecord.setStatus(add.getStatus());
|
||||
customerContingenPlanRecord.setContingenPlanId(add.getId());
|
||||
customerContingenPlanRecord.setDutyPersion(add.getDutyPersion());
|
||||
customerContingenPlanRecordMapper.insert(customerContingenPlanRecord);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@@ -130,9 +152,10 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CustomerContingenPlanBo bo) {
|
||||
CustomerContingenPlan update = MapstructUtils.convert(bo, CustomerContingenPlan.class);
|
||||
validEntityBeforeSave(update);
|
||||
validEntityBeforeUpdate(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
@@ -143,6 +166,23 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeUpdate(CustomerContingenPlan entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
boolean exists = customerContingenPlanRecordMapper.exists(new LambdaQueryWrapper<CustomerContingenPlanRecord>()
|
||||
.eq(CustomerContingenPlanRecord::getContingenPlanId, entity.getId())
|
||||
.eq(CustomerContingenPlanRecord::getStatus, entity.getStatus()));
|
||||
if (!exists) {
|
||||
CustomerContingenPlanRecord customerContingenPlanRecord = new CustomerContingenPlanRecord();
|
||||
customerContingenPlanRecord.setStatus(entity.getStatus());
|
||||
customerContingenPlanRecord.setContingenPlanId(entity.getId());
|
||||
customerContingenPlanRecord.setDutyPersion(entity.getDutyPersion());
|
||||
customerContingenPlanRecordMapper.insert(customerContingenPlanRecord);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除客户服务-应急预案信息
|
||||
*
|
||||
@@ -151,6 +191,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.CustomerFeedbacksVo;
|
||||
import org.dromara.property.mapper.CustomerFeedbacksMapper;
|
||||
import org.dromara.property.service.ICustomerFeedbacksService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -94,6 +95,7 @@ public class CustomerFeedbacksServiceImpl implements ICustomerFeedbacksService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CustomerFeedbacksBo bo) {
|
||||
CustomerFeedbacks add = MapstructUtils.convert(bo, CustomerFeedbacks.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -111,6 +113,7 @@ public class CustomerFeedbacksServiceImpl implements ICustomerFeedbacksService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CustomerFeedbacksBo bo) {
|
||||
CustomerFeedbacks update = MapstructUtils.convert(bo, CustomerFeedbacks.class);
|
||||
validEntityBeforeSave(update);
|
||||
|
@@ -1,7 +1,11 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import jodd.util.StringUtil;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -11,14 +15,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
import org.dromara.property.domain.vo.ResidentUnitVo;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
import org.dromara.resource.api.RemoteMessageService;
|
||||
import org.dromara.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.CustomerNoticesBo;
|
||||
import org.dromara.property.domain.vo.CustomerNoticesVo;
|
||||
import org.dromara.property.domain.CustomerNotices;
|
||||
import org.dromara.property.mapper.CustomerNoticesMapper;
|
||||
import org.dromara.property.service.ICustomerNoticesService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -49,8 +58,25 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
|
||||
* @return 客户服务-通知公告
|
||||
*/
|
||||
@Override
|
||||
public CustomerNoticesVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
public CustomerNoticesVo queryById(Long id) {
|
||||
List<ResidentPerson> residentPeople = residentPersonMapper.selectList();
|
||||
CustomerNoticesVo customerNoticesVo = baseMapper.selectVoById(id);
|
||||
if (CollUtil.isNotEmpty(residentPeople)) {
|
||||
ResidentPerson residentPerson = residentPeople.stream()
|
||||
.filter(vo -> vo.getId() != null && vo.getId().equals(customerNoticesVo.getIssuers())).findFirst().orElse(null);
|
||||
customerNoticesVo.setIssuersName(residentPerson.getUserName());
|
||||
if (ObjectUtil.isNotEmpty(customerNoticesVo.getNoticePersion())) {
|
||||
List<String> list = Arrays.asList(customerNoticesVo.getNoticePersion().split(","));
|
||||
List<ResidentPerson> filteredList = residentPeople.stream()
|
||||
.filter(person -> list.contains(person.getId().toString()))
|
||||
.collect(Collectors.toList());
|
||||
String usernames = filteredList.stream()
|
||||
.map(ResidentPerson::getUserName) // 假设ResidentPerson类有一个getUserName方法
|
||||
.collect(Collectors.joining(","));
|
||||
customerNoticesVo.setNoticePersionName(StringUtils.isNotBlank(usernames)?usernames:null);
|
||||
}
|
||||
}
|
||||
return customerNoticesVo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,6 +90,28 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
|
||||
public TableDataInfo<CustomerNoticesVo> queryPageList(CustomerNoticesBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<CustomerNotices> lqw = buildQueryWrapper(bo);
|
||||
Page<CustomerNoticesVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
if (CollUtil.isNotEmpty(result.getRecords())) {
|
||||
List<ResidentPerson> residentPeople = residentPersonMapper.selectList();
|
||||
if (CollUtil.isNotEmpty(residentPeople)) {
|
||||
result.getRecords().stream().forEach(s -> {
|
||||
ResidentPerson residentPerson = residentPeople.stream()
|
||||
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getIssuers())).findFirst().orElse(null);
|
||||
s.setIssuersName(residentPerson.getUserName());
|
||||
if (ObjectUtil.isNotEmpty(s.getNoticePersion())) {
|
||||
List<String> list = Arrays.asList(s.getNoticePersion().split(","));
|
||||
List<ResidentPerson> filteredList = residentPeople.stream()
|
||||
.filter(person -> list.contains(person.getId().toString()))
|
||||
.collect(Collectors.toList());
|
||||
String usernames = filteredList.stream()
|
||||
.map(ResidentPerson::getUserName) // 假设ResidentPerson类有一个getUserName方法
|
||||
.collect(Collectors.joining(","));
|
||||
s.setIssuersName(usernames);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -100,21 +148,22 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CustomerNoticesBo bo) {
|
||||
CustomerNotices add = MapstructUtils.convert(bo, CustomerNotices.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
if(bo.getIsAll().equals("0")){
|
||||
if (bo.getIsAll().equals("0")) {
|
||||
remoteMessageService.publishAll(bo.getTitle());
|
||||
}
|
||||
if(bo.getIsAll().equals("1") && ObjectUtil.isNotEmpty(bo.getNoticePersion())){
|
||||
if (bo.getIsAll().equals("1") && ObjectUtil.isNotEmpty(bo.getNoticePersion())) {
|
||||
String[] noticePersion = bo.getNoticePersion().split(",");
|
||||
List<Long> userIdList = Arrays.stream(noticePersion)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
remoteMessageService.publishMessage(userIdList,bo.getTitle());
|
||||
remoteMessageService.publishMessage(userIdList, bo.getTitle());
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
@@ -127,6 +176,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(CustomerNoticesBo bo) {
|
||||
CustomerNotices update = MapstructUtils.convert(bo, CustomerNotices.class);
|
||||
validEntityBeforeUpdate(update);
|
||||
@@ -136,15 +186,22 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(CustomerNotices entity){
|
||||
private void validEntityBeforeSave(CustomerNotices entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
LoginUser user = LoginHelper.getLoginUser();
|
||||
ResidentPerson residentPerson = residentPersonMapper.selectOne(new LambdaQueryWrapper<ResidentPerson>()
|
||||
.eq(ResidentPerson::getUserId, user.getUserId()));
|
||||
Assert.isTrue(ObjectUtil.isNotEmpty(residentPerson), "该发布人未入住");
|
||||
entity.setIssuers(residentPerson.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeUpdate(CustomerNotices entity){
|
||||
private void validEntityBeforeUpdate(CustomerNotices entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除客户服务-通知公告信息
|
||||
*
|
||||
@@ -154,7 +211,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
|
@@ -12,6 +12,9 @@ import org.dromara.property.service.IMeetService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -31,7 +34,7 @@ public class EnumFetcherServiceImpl implements EnumFetcherService {
|
||||
private IMeetBookingService meetBookingService;
|
||||
|
||||
@Override
|
||||
public Map<Object, Object> getEnumValues(String type) {
|
||||
public List<Map<Object, Object>> getEnumValues(String type) {
|
||||
switch (type) {
|
||||
case "getMeetName":
|
||||
return meetService.getMeetSelectDate(type);
|
||||
@@ -56,23 +59,48 @@ public class EnumFetcherServiceImpl implements EnumFetcherService {
|
||||
}
|
||||
}
|
||||
|
||||
Map<Object, Object> getMeetStatus() {
|
||||
return java.util.Arrays.stream(MeetStatusEnum.values())
|
||||
.collect(Collectors.toMap(MeetStatusEnum::getValue, MeetStatusEnum::getName));
|
||||
List<Map<Object, Object>> getMeetStatus() {
|
||||
return Arrays.stream(MeetStatusEnum.values())
|
||||
.map(e -> {
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("value", e.getValue());
|
||||
map.put("name", e.getName());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
Map<Object, Object> getMeetAttachStatus() {
|
||||
return java.util.Arrays.stream(MeetAttachStatusEnum.values())
|
||||
.collect(Collectors.toMap(MeetAttachStatusEnum::getValue, MeetAttachStatusEnum::getName));
|
||||
List<Map<Object, Object>> getMeetAttachStatus() {
|
||||
return Arrays.stream(MeetAttachStatusEnum.values())
|
||||
.map(e -> {
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("value", e.getValue());
|
||||
map.put("name", e.getName());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<Object, Object> getMeetBookingPayStatus() {
|
||||
return java.util.Arrays.stream(BookingPayStatusEnum.values())
|
||||
.collect(Collectors.toMap(BookingPayStatusEnum::getValue, BookingPayStatusEnum::getName));
|
||||
List<Map<Object, Object>> getMeetBookingPayStatus() {
|
||||
return Arrays.stream(BookingPayStatusEnum.values())
|
||||
.map(e -> {
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("value", e.getValue());
|
||||
map.put("name", e.getName());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
Map<Object, Object> getMeetBookingStatus() {
|
||||
return java.util.Arrays.stream(BookingStatusEnum.values())
|
||||
.collect(Collectors.toMap(BookingStatusEnum::getValue, BookingStatusEnum::getName));
|
||||
|
||||
List<Map<Object, Object>> getMeetBookingStatus() {
|
||||
return Arrays.stream(BookingStatusEnum.values())
|
||||
.map(e -> {
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("value", e.getValue());
|
||||
map.put("name", e.getName());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionItemVo;
|
||||
import org.dromara.property.mapper.InspectionItemMapper;
|
||||
import org.dromara.property.service.IInspectionItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -86,6 +87,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(InspectionItemBo bo) {
|
||||
InspectionItem add = MapstructUtils.convert(bo, InspectionItem.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -103,6 +105,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionItemBo bo) {
|
||||
InspectionItem update = MapstructUtils.convert(bo, InspectionItem.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -124,6 +127,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -161,6 +161,7 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionPlanBo bo) {
|
||||
InspectionPlan update = MapstructUtils.convert(bo, InspectionPlan.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -182,6 +183,7 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionPlanStaffVo;
|
||||
import org.dromara.property.mapper.InspectionPlanStaffMapper;
|
||||
import org.dromara.property.service.IInspectionPlanStaffService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -89,6 +90,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(InspectionPlanStaffBo bo) {
|
||||
InspectionPlanStaff add = MapstructUtils.convert(bo, InspectionPlanStaff.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -106,6 +108,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionPlanStaffBo bo) {
|
||||
InspectionPlanStaff update = MapstructUtils.convert(bo, InspectionPlanStaff.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -127,6 +130,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -18,6 +18,7 @@ import org.dromara.property.mapper.InspectionPlanMapper;
|
||||
import org.dromara.property.mapper.InspectionPointMapper;
|
||||
import org.dromara.property.service.IInspectionPointService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -104,6 +105,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(InspectionPointBo bo) {
|
||||
InspectionPoint add = MapstructUtils.convert(bo, InspectionPoint.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -121,6 +123,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionPointBo bo) {
|
||||
InspectionPoint update = MapstructUtils.convert(bo, InspectionPoint.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -142,6 +145,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionRouteVo;
|
||||
import org.dromara.property.mapper.InspectionRouteMapper;
|
||||
import org.dromara.property.service.IInspectionRouteService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -86,6 +87,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(InspectionRouteBo bo) {
|
||||
InspectionRoute add = MapstructUtils.convert(bo, InspectionRoute.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -103,6 +105,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionRouteBo bo) {
|
||||
InspectionRoute update = MapstructUtils.convert(bo, InspectionRoute.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -124,6 +127,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionStaffVo;
|
||||
import org.dromara.property.mapper.InspectionStaffMapper;
|
||||
import org.dromara.property.service.IInspectionStaffService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -89,6 +90,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(InspectionStaffBo bo) {
|
||||
InspectionStaff add = MapstructUtils.convert(bo, InspectionStaff.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -106,6 +108,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionStaffBo bo) {
|
||||
InspectionStaff update = MapstructUtils.convert(bo, InspectionStaff.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -127,6 +130,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionTaskDetailVo;
|
||||
import org.dromara.property.mapper.InspectionTaskDetailMapper;
|
||||
import org.dromara.property.service.IInspectionTaskDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -95,6 +96,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(InspectionTaskDetailBo bo) {
|
||||
InspectionTaskDetail add = MapstructUtils.convert(bo, InspectionTaskDetail.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -112,6 +114,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionTaskDetailBo bo) {
|
||||
InspectionTaskDetail update = MapstructUtils.convert(bo, InspectionTaskDetail.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -133,6 +136,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -19,6 +19,7 @@ import org.dromara.property.mapper.InspectionTaskMapper;
|
||||
import org.dromara.property.service.IInspectionTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -116,6 +117,7 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(InspectionTaskBo bo) {
|
||||
InspectionTask add = MapstructUtils.convert(bo, InspectionTask.class);
|
||||
validEntityBeforeSave(add);
|
||||
@@ -133,6 +135,7 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(InspectionTaskBo bo) {
|
||||
InspectionTask update = MapstructUtils.convert(bo, InspectionTask.class);
|
||||
validEntityBeforeSave(update);
|
||||
@@ -154,6 +157,8 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -147,7 +148,7 @@ public class MachineTypeServiceImpl implements IMachineTypeService {
|
||||
if (CollUtil.isEmpty(machineTypeVoList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<MachineTypeTreeVo> machineTypeTreeVoList = MapstructUtils.convert(machineTypeVoList, MachineTypeTreeVo.class);
|
||||
List<MachineTypeTreeVo> machineTypeTreeVoList = BeanUtil.copyToList(machineTypeVoList, MachineTypeTreeVo.class);
|
||||
// 2. 构建树结构
|
||||
return buildMachineTypeTree(machineTypeTreeVoList);
|
||||
|
||||
|
@@ -145,18 +145,17 @@ public class MeetAttachServiceImpl implements IMeetAttachService {
|
||||
* 下拉接口数据
|
||||
*/
|
||||
@Override
|
||||
public Map<Object, Object> getMeetAttachSelectDate(String type){
|
||||
|
||||
public List<Map<Object, Object>> getMeetAttachSelectDate(String type){
|
||||
switch (type) {
|
||||
case "getMeetAttachName":
|
||||
return getList().stream()
|
||||
return (List<Map<Object, Object>>) getList().stream()
|
||||
.collect(Collectors.toMap(
|
||||
MeetAttach::getProjectName,
|
||||
MeetAttach::getProjectName,
|
||||
(oldValue, newValue) -> oldValue
|
||||
));
|
||||
case "getMeetAttachType":
|
||||
return getList().stream()
|
||||
return (List<Map<Object, Object>>) getList().stream()
|
||||
.collect(Collectors.toMap(
|
||||
MeetAttach::getType,
|
||||
MeetAttach::getType,
|
||||
|
@@ -62,7 +62,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
|
||||
meetBookingDetailVo.setLocationName(ObjectUtil.isNotEmpty(locationName)?locationName:null);
|
||||
ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(Long.valueOf(meetBookingVo.getPerson()));
|
||||
meetBookingDetailVo.setPersonName(ObjectUtil.isNotEmpty(residentPersonVo)?residentPersonVo.getUserName():null);
|
||||
meetBookingDetailVo.setPhone(residentPersonVo.getPhone());
|
||||
meetBookingDetailVo.setPhone(ObjectUtil.isNotEmpty(residentPersonVo)?residentPersonVo.getPhone():null);
|
||||
ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(Long.valueOf(meetBookingVo.getUnit()));
|
||||
meetBookingDetailVo.setUnitName(ObjectUtil.isNotEmpty(residentPersonVo)?residentUnitVo.getName():null);
|
||||
return meetBookingDetailVo;
|
||||
@@ -119,7 +119,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
|
||||
if (CollectionUtil.isEmpty(meetBookings)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<MeetBookingAppointmentVo> meetBookingAppointmentVoList = MapstructUtils.convert(meetBookings, MeetBookingAppointmentVo.class);
|
||||
List<MeetBookingAppointmentVo> meetBookingAppointmentVoList = BeanUtil.copyToList(meetBookings, MeetBookingAppointmentVo.class);
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH");
|
||||
List<ResidentUnitVo> residentUnitVolist = residentUnitMapper.selectVoList();
|
||||
List<ResidentPersonVo> residentPersonsVolist = residentPersonMapper.selectVoList();
|
||||
@@ -176,7 +176,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
|
||||
if (CollectionUtil.isEmpty(meetBookingVoList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<MeetBookingWeekVo> meetBookingWeekVoList = MapstructUtils.convert(meetBookingVoList, MeetBookingWeekVo.class);
|
||||
List<MeetBookingWeekVo> meetBookingWeekVoList = BeanUtil.copyToList(meetBookingVoList, MeetBookingWeekVo.class);
|
||||
String[] weekStr = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
|
||||
List<MeetBookingWeekVo> meetBookingWeekList = new ArrayList<>();
|
||||
SimpleDateFormat df = new SimpleDateFormat("HH");
|
||||
@@ -283,18 +283,22 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Object, Object> getMeetBooking(String type) {
|
||||
switch (type) {
|
||||
case "getMeetBookingPerson()":
|
||||
return getList().stream()
|
||||
.collect(Collectors.toMap(
|
||||
MeetBooking::getPerson,
|
||||
MeetBooking::getPerson,
|
||||
(oldValue, newValue) -> oldValue
|
||||
));
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown type: " + type);
|
||||
}
|
||||
public List<Map<Object, Object>> getMeetBooking(String type) {
|
||||
return switch (type) {
|
||||
case "getMeetBookingPerson" -> getList().stream()
|
||||
.map(MeetBooking::getPerson)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.map(person -> {
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("value", person);
|
||||
map.put("name", person);
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
default -> throw new IllegalArgumentException("Unknown type: " + type);
|
||||
};
|
||||
}
|
||||
|
||||
public List<MeetBooking> getList() {
|
||||
|
@@ -212,23 +212,29 @@ public class MeetServiceImpl implements IMeetService {
|
||||
* 下拉接口数据
|
||||
*/
|
||||
@Override
|
||||
public Map<Object, Object> getMeetSelectDate(String type){
|
||||
public List<Map<Object, Object>> getMeetSelectDate(String type){
|
||||
switch (type) {
|
||||
case "getMeetName":
|
||||
Map<Object, Object> meetMap = new HashMap<>();
|
||||
List<Map<Object, Object>> result = new ArrayList<>();
|
||||
for (Meet meet : getList()) {
|
||||
// 如果键不存在,则直接放入;如果存在,则保留第一个遇到的值
|
||||
meetMap.putIfAbsent("value", meet.getId());
|
||||
meetMap.putIfAbsent("name", meet.getName());
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("value", meet.getId());
|
||||
map.put("name", meet.getName());
|
||||
result.add(map);
|
||||
}
|
||||
return meetMap;
|
||||
return result;
|
||||
case "getMeetPrincipals":
|
||||
// 提取所有不同的 principals,并包装成 List<Map<String, Object>>
|
||||
return getList().stream()
|
||||
.collect(Collectors.toMap(
|
||||
Meet::getPrincipals,
|
||||
Meet::getPrincipals,
|
||||
(oldValue, newValue) -> oldValue
|
||||
));
|
||||
.map(Meet::getPrincipals)
|
||||
.distinct()
|
||||
.map(principal -> {
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("value", principal);
|
||||
map.put("name", principal);
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown type: " + type);
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -11,12 +12,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sis.api.RemoteSisAuth;
|
||||
import org.dromara.sis.api.domain.RemotePersonAuth;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.property.domain.bo.ResidentPersonBo;
|
||||
import org.dromara.property.domain.vo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.ResidentPerson;
|
||||
import org.dromara.property.mapper.ResidentPersonMapper;
|
||||
import org.dromara.property.service.IResidentPersonService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -35,6 +39,9 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
|
||||
private final ResidentPersonMapper baseMapper;
|
||||
|
||||
@DubboReference
|
||||
private RemoteSisAuth remoteSisAuth;
|
||||
|
||||
/**
|
||||
* 查询入驻员工
|
||||
*
|
||||
@@ -42,7 +49,7 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
* @return 入驻员工
|
||||
*/
|
||||
@Override
|
||||
public ResidentPersonVo queryById(Long id){
|
||||
public ResidentPersonVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -76,7 +83,6 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<ResidentPerson> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(ResidentPerson::getId);
|
||||
lqw.eq(bo.getUserId() != null, ResidentPerson::getUserId, bo.getUserId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getUserName()), ResidentPerson::getUserName, bo.getUserName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPhone()), ResidentPerson::getPhone, bo.getPhone());
|
||||
lqw.eq(bo.getGender() != null, ResidentPerson::getGender, bo.getGender());
|
||||
@@ -97,12 +103,34 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(ResidentPersonBo bo) {
|
||||
ResidentPerson add = MapstructUtils.convert(bo, ResidentPerson.class);
|
||||
Assert.notNull(add, "数据处理失败");
|
||||
// 唯一性校验
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "员工入驻失败!");
|
||||
if (flag) {
|
||||
log.info("开始写入授权记录, {}", bo.getUserName());
|
||||
RemotePersonAuth personAuth = new RemotePersonAuth();
|
||||
personAuth.setId(add.getId());
|
||||
personAuth.setName(bo.getUserName());
|
||||
personAuth.setSex(bo.getGender() != 1L ? 0 : 1);
|
||||
personAuth.setPhone(bo.getPhone());
|
||||
personAuth.setEmail(bo.getEmail());
|
||||
personAuth.setIdCardNumber(bo.getIdCard());
|
||||
personAuth.setOssId(bo.getImg());
|
||||
personAuth.setCarNumber(bo.getCarNumber());
|
||||
personAuth.setBegDate(bo.getBegDate());
|
||||
personAuth.setEndDate(bo.getEndDate());
|
||||
personAuth.setAuthGroupId(bo.getAuthGroupId());
|
||||
|
||||
Long personId = remoteSisAuth.personAuth(personAuth);
|
||||
Assert.notNull(personId, "新增授权记录失败");
|
||||
bo.setId(add.getId());
|
||||
bo.setEEightId(personId);
|
||||
this.updateByBo(bo);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@@ -123,16 +151,20 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeUpdate(ResidentPerson entity){
|
||||
private void validEntityBeforeUpdate(ResidentPerson entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ResidentPerson entity){
|
||||
private void validEntityBeforeSave(ResidentPerson entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
boolean exists = baseMapper.exists(new LambdaQueryWrapper<ResidentPerson>().eq(ResidentPerson::getUserId, entity.getUserId()));
|
||||
Assert.isTrue(!exists,"该用户已入住!");
|
||||
LambdaQueryWrapper<ResidentPerson> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(ResidentPerson::getIdCard, entity.getIdCard())
|
||||
.eq(ResidentPerson::getUnitId, entity.getUnitId());
|
||||
boolean exists = baseMapper.exists(lqw);
|
||||
Assert.isTrue(!exists, "当前单位,{}已入驻!", entity.getUserName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +176,7 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
@@ -152,6 +184,7 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
||||
|
||||
/**
|
||||
* 获取单位人员数量
|
||||
*
|
||||
* @param unitId
|
||||
* @return
|
||||
*/
|
||||
|
@@ -255,7 +255,10 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
public ServiceWorkOrderAnalysisVo counts() {
|
||||
List<ServiceWorkOrders> serviceWorkOrdersList = baseMapper.selectList(new QueryWrapper<>());
|
||||
|
||||
// 原有逻辑不变...
|
||||
// 当前时间
|
||||
LocalDate today = LocalDate.now();
|
||||
String currentMonth = today.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||
|
||||
// 总工单数
|
||||
int workOrdersTotal = serviceWorkOrdersList.size();
|
||||
|
||||
@@ -263,6 +266,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
int notWorkOrdersTotal = (int) serviceWorkOrdersList.stream()
|
||||
.filter(order -> "0".equals(order.getStatus()))
|
||||
.count();
|
||||
|
||||
// 未闭环且超时的工单(status ≠ "4" 且 isTimeOut = "1")
|
||||
int novertimeOrdersTotal = (int) serviceWorkOrdersList.stream()
|
||||
.filter(order -> !"4".equals(order.getStatus()) && "1".equals(order.getIsTimeOut()))
|
||||
@@ -273,9 +277,6 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
.filter(order -> "3".equals(order.getStatus()))
|
||||
.count();
|
||||
|
||||
// 当前月份(格式:2025-07)
|
||||
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||
|
||||
// 当月工单数(创建时间在当月)
|
||||
int monthOrdersTotal = (int) serviceWorkOrdersList.stream()
|
||||
.filter(order -> currentMonth.equals(order.getCreateTime()))
|
||||
@@ -286,13 +287,13 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
.filter(order -> "1".equals(order.getIsTimeOut()) && currentMonth.equals(order.getCreateTime()))
|
||||
.count();
|
||||
|
||||
// 计算当月工单超时率(保留两位小数)
|
||||
// 当月工单超时率(保留两位小数)
|
||||
double novertimeOrdersRate = monthOrdersTotal == 0 ? 0.0 :
|
||||
(double) outTimeOrdersTotal / monthOrdersTotal * 100;
|
||||
Math.round(((double) outTimeOrdersTotal / monthOrdersTotal) * 10000) / 100.0;
|
||||
|
||||
// 满意数(假设 satisfactionLevel >= 4 表示满意)
|
||||
// 满意数(serviceEvalua >= 4)
|
||||
int satisfaction = (int) serviceWorkOrdersList.stream()
|
||||
.filter(order -> order.getServiceEvalua() != null && order.getServiceEvalua()>= 4)
|
||||
.filter(order -> order.getServiceEvalua() != null && order.getServiceEvalua() >= 4)
|
||||
.count();
|
||||
|
||||
// 当月满意度(当月工单中满意的占比)
|
||||
@@ -303,14 +304,19 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
.count();
|
||||
|
||||
double monthoSatisfaction = monthOrdersTotal == 0 ? 0.0 :
|
||||
(double) monthSatisfactionCount / monthOrdersTotal * 100;
|
||||
ServiceWorkOrderAnalysisVo serviceWorkOrderAnalysisVo =new ServiceWorkOrderAnalysisVo();
|
||||
Math.round(((double) monthSatisfactionCount / monthOrdersTotal) * 10000) / 100.0;
|
||||
|
||||
// 获取近一周的工单统计
|
||||
List<ServiceWorkOrderAnalysisVo.LineChartVo> recentWeekData = getRecentWeekWorkOrders(serviceWorkOrdersList);
|
||||
List<ServiceWorkOrderAnalysisVo.LineChartVo> recentWeekWorkOrders = getRecentWeekWorkOrders(serviceWorkOrdersList);
|
||||
|
||||
// 计算工单类型分布
|
||||
List<ServiceWorkOrderAnalysisVo.PieChartVo> workOrderTypeDistribution = calculateWorkOrderTypeDistribution(serviceWorkOrdersList);
|
||||
// 获取工单类型分布
|
||||
List<ServiceWorkOrderAnalysisVo.PieChartVo> satisfactionChartList = calculateWorkOrderTypeDistribution(serviceWorkOrdersList);
|
||||
|
||||
// 获取满意度分布
|
||||
List<ServiceWorkOrderAnalysisVo.SatisfactionChartVo> satisfactionRateList = calculateSatisfactionRate(serviceWorkOrdersList);
|
||||
// 获取近半年工单柱状图数据
|
||||
List<ServiceWorkOrderAnalysisVo.BarChartVo> recentSixMonthWorkOrders = getRecentSixMonthsWorkOrders(serviceWorkOrdersList);
|
||||
// 构建 VO 并返回
|
||||
return new ServiceWorkOrderAnalysisVo.ServiceWorkOrderCount()
|
||||
.setWorkOrdersTotal(workOrdersTotal)
|
||||
.setNotWorkOrdersTotal(notWorkOrdersTotal)
|
||||
@@ -321,11 +327,50 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
.setOutTimeOrdersTotal(outTimeOrdersTotal)
|
||||
.setMonthoSatisfaction(monthoSatisfaction)
|
||||
.setSatisfaction(satisfaction)
|
||||
.setRecentWeekWorkOrders(recentWeekData)
|
||||
.setWorkOrderTypeDistribution(workOrderTypeDistribution)
|
||||
.setRecentWeekWorkOrders(recentWeekWorkOrders)
|
||||
.setSatisfactionRateList(satisfactionRateList)
|
||||
.setSatisfactionChartList(satisfactionChartList)
|
||||
.setRecentSixMonthWorkOrders(recentSixMonthWorkOrders)
|
||||
.build();
|
||||
}
|
||||
} /**
|
||||
* 计算满意度指数占比
|
||||
*
|
||||
* @return 满意度比例列表
|
||||
*/
|
||||
private List<ServiceWorkOrderAnalysisVo.SatisfactionChartVo> calculateSatisfactionRate(List<ServiceWorkOrders> ordersList) {
|
||||
List<ServiceWorkOrders> evaluatedOrders = ordersList.stream()
|
||||
.filter(order -> order.getServiceEvalua() != null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
int totalSatisfactionCount = evaluatedOrders.size();
|
||||
|
||||
Map<Integer, Long> satisfactionCounts = evaluatedOrders.stream()
|
||||
.collect(Collectors.groupingBy(ServiceWorkOrders::getServiceEvalua, Collectors.counting()));
|
||||
|
||||
List<ServiceWorkOrderAnalysisVo.SatisfactionChartVo> satisfactionRateList = new ArrayList<>();
|
||||
|
||||
for (int level = 1; level <= 5; level++) {
|
||||
long count = satisfactionCounts.getOrDefault(level, 0L);
|
||||
double rate = totalSatisfactionCount == 0 ? 0.0 :
|
||||
Math.round(((double) count / totalSatisfactionCount) * 10000) / 100.0;
|
||||
|
||||
String name = switch (level) {
|
||||
case 1 -> "非常不满意";
|
||||
case 2 -> "不满意";
|
||||
case 3 -> "一般";
|
||||
case 4 -> "满意";
|
||||
case 5 -> "非常满意";
|
||||
default -> "未知";
|
||||
};
|
||||
|
||||
satisfactionRateList.add(new ServiceWorkOrderAnalysisVo.SatisfactionChartVo()
|
||||
.setName(name)
|
||||
.setValue((long) count)
|
||||
.setRate(rate));
|
||||
}
|
||||
|
||||
return satisfactionRateList;
|
||||
}
|
||||
// 近一周工单统计方法
|
||||
private List<ServiceWorkOrderAnalysisVo.LineChartVo> getRecentWeekWorkOrders(List<ServiceWorkOrders> serviceWorkOrdersList) {
|
||||
LocalDate today = LocalDate.now();
|
||||
@@ -334,33 +379,52 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
dateList.add(today.minusDays(i));
|
||||
}
|
||||
|
||||
Map<String, Long> workOrdersByDate = serviceWorkOrdersList.stream()
|
||||
.filter(order -> {
|
||||
try {
|
||||
LocalDate createTime = LocalDate.parse((CharSequence) order.getCreateTime());
|
||||
return !createTime.isBefore(today.minusDays(7));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.collect(Collectors.groupingBy(
|
||||
order -> LocalDate.parse((CharSequence) order.getCreateTime()).format(DateTimeFormatter.ISO_LOCAL_DATE),
|
||||
Collectors.counting()
|
||||
));
|
||||
// 按日期分组:统计总数量 和 已处理数量
|
||||
Map<String, Long> totalWorkOrdersByDate = new HashMap<>();
|
||||
Map<String, Long> processedWorkOrdersByDate = new HashMap<>();
|
||||
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
|
||||
|
||||
for (ServiceWorkOrders order : serviceWorkOrdersList) {
|
||||
try {
|
||||
LocalDate createTime = LocalDate.parse((CharSequence) order.getCreateTime());
|
||||
if (createTime.isBefore(today.minusDays(7))) {
|
||||
continue; // 跳过超过7天的数据
|
||||
}
|
||||
|
||||
String dateStr = createTime.format(dateFormatter);
|
||||
|
||||
// 总数 +1
|
||||
totalWorkOrdersByDate.put(dateStr, totalWorkOrdersByDate.getOrDefault(dateStr, 0L) + 1);
|
||||
|
||||
// 如果已处理,processed +1
|
||||
if (isProcessed(order)) {
|
||||
processedWorkOrdersByDate.put(dateStr, processedWorkOrdersByDate.getOrDefault(dateStr, 0L) + 1);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 忽略格式错误的日期
|
||||
}
|
||||
}
|
||||
|
||||
DateTimeFormatter dateFormatterFull = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter dayOfWeekFormatter = DateTimeFormatter.ofPattern("E");
|
||||
|
||||
List<ServiceWorkOrderAnalysisVo.LineChartVo> result = new ArrayList<>();
|
||||
for (LocalDate date : dateList) {
|
||||
String dateStr = date.format(dateFormatter);
|
||||
String dateStr = date.format(dateFormatterFull);
|
||||
String dayOfWeek = date.format(dayOfWeekFormatter);
|
||||
result.add(new ServiceWorkOrderAnalysisVo.LineChartVo(dateStr, dayOfWeek, workOrdersByDate.getOrDefault(dateStr, 0L)));
|
||||
long total = totalWorkOrdersByDate.getOrDefault(dateStr, 0L);
|
||||
long processed = processedWorkOrdersByDate.getOrDefault(dateStr, 0L);
|
||||
result.add(new ServiceWorkOrderAnalysisVo.LineChartVo(dateStr, dayOfWeek, total, processed));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isProcessed(ServiceWorkOrders order) {
|
||||
// 假设有一个字段 status 表示状态,"COMPLETED" 表示已处理
|
||||
return "4".equalsIgnoreCase(order.getStatus());
|
||||
}
|
||||
// 计算工单类型分布
|
||||
private List<ServiceWorkOrderAnalysisVo.PieChartVo> calculateWorkOrderTypeDistribution(List<ServiceWorkOrders> serviceWorkOrdersList) {
|
||||
// 按 typeId 分组统计数量
|
||||
@@ -378,8 +442,31 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
String typeName = serviceWorkOrdersType != null ? serviceWorkOrdersType.getOrderTypeName() : "未知类型";
|
||||
// 计算占比(保留两位小数)
|
||||
double percentage = Math.round(((double) count / total) * 10000) / 100.0;
|
||||
result.add(new ServiceWorkOrderAnalysisVo.PieChartVo(typeName, count, percentage));
|
||||
result.add(new ServiceWorkOrderAnalysisVo.PieChartVo(typeName.toString(), count, percentage));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private List<ServiceWorkOrderAnalysisVo.BarChartVo> getRecentSixMonthsWorkOrders(List<ServiceWorkOrders> ordersList) {
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
// 获取近6个月的日期范围(含当月)
|
||||
List<String> months = new ArrayList<>();
|
||||
for (int i = 5; i >= 0; i--) {
|
||||
months.add(today.minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")));
|
||||
}
|
||||
Map<Date, Long> orderCountMap = ordersList.stream()
|
||||
.filter(order -> order.getCreateTime() != null)
|
||||
.collect(Collectors.groupingBy(
|
||||
ServiceWorkOrders::getCreateTime,
|
||||
Collectors.counting()
|
||||
));
|
||||
|
||||
// 构建柱状图数据
|
||||
return months.stream()
|
||||
.map(month -> new ServiceWorkOrderAnalysisVo.BarChartVo()
|
||||
.setMonth(month)
|
||||
.setOrderCount(Math.toIntExact(orderCountMap.getOrDefault(month, 0L)))
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.property.mapper.CustomerContingenPlanRecordMapper">
|
||||
|
||||
</mapper>
|
@@ -106,11 +106,18 @@
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-api-workflow</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>property-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>sis-api</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.hik</groupId>
|
||||
<artifactId>examples</artifactId>
|
||||
|
@@ -74,13 +74,13 @@ public class SisAuthRecordController extends BaseController {
|
||||
/**
|
||||
* 新增授权记录
|
||||
*/
|
||||
@SaCheckPermission("sis:authRecord:add")
|
||||
@Log(title = "人员库授权", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SisAuthRecordBo bo) {
|
||||
return toAjax(sisAuthRecordService.insertByBo(bo));
|
||||
}
|
||||
// @SaCheckPermission("sis:authRecord:add")
|
||||
// @Log(title = "人员库授权", businessType = BusinessType.INSERT)
|
||||
// @RepeatSubmit()
|
||||
// @PostMapping()
|
||||
// public R<Void> add(@Validated(AddGroup.class) @RequestBody SisAuthRecordBo bo) {
|
||||
// return toAjax(sisAuthRecordService.insertByBo(bo));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 修改授权记录
|
||||
@@ -111,18 +111,18 @@ public class SisAuthRecordController extends BaseController {
|
||||
*
|
||||
* @param libId 人像库id
|
||||
*/
|
||||
@GetMapping("/authDevice/{libId}")
|
||||
public R<List<SisAuthRecord>> queryAuthDevice(@PathVariable("libId") String libId) {
|
||||
return R.ok(sisAuthRecordService.queryAuthDevice(libId));
|
||||
}
|
||||
// @GetMapping("/authDevice/{libId}")
|
||||
// public R<List<SisAuthRecord>> queryAuthDevice(@PathVariable("libId") String libId) {
|
||||
// return R.ok(sisAuthRecordService.queryAuthDevice(libId));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 查询所有可授权设备
|
||||
*
|
||||
* @return List<TreeNode < Long>>
|
||||
*/
|
||||
@GetMapping("/authDevice/tree")
|
||||
public R<List<TreeNode<Long>>> tree() {
|
||||
return R.ok(sisAuthRecordService.authDeviceTree());
|
||||
}
|
||||
// @GetMapping("/authDevice/tree")
|
||||
// public R<List<TreeNode<Long>>> tree() {
|
||||
// return R.ok(sisAuthRecordService.authDeviceTree());
|
||||
// }
|
||||
}
|
||||
|
@@ -128,6 +128,6 @@ public class SisElevatorInfoController extends BaseController {
|
||||
@GetMapping("/ref/{id}")
|
||||
public R<List<SisElevatorFloorRefVo>> queryRef(@NotNull(message = "电梯id不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(sisElevatorFloorRefService.queryByElevatorId(id));
|
||||
return R.ok(sisElevatorFloorRefService.queryByAuthGroupId(id));
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ import java.io.Serial;
|
||||
* 授权组对象 sis_auth_group
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-07-23
|
||||
* @since 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -41,6 +41,4 @@ public class SisAuthGroup extends TenantEntity {
|
||||
* 是否启用(0:禁用,1启用)
|
||||
*/
|
||||
private Boolean isEnable;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,8 @@ import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@@ -11,7 +13,7 @@ import java.io.Serial;
|
||||
* 授权记录对象 sis_auth_record
|
||||
*
|
||||
* @author lsm
|
||||
* @since 2025-07-14
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -28,19 +30,29 @@ public class SisAuthRecord extends TenantEntity {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 图像库id
|
||||
* 授权对象Id
|
||||
*/
|
||||
private Long libId;
|
||||
private Long targetId;
|
||||
|
||||
/**
|
||||
* 设备id(门禁/电梯)
|
||||
* 对象类型:1-单位 2-人
|
||||
*/
|
||||
private Long deviceId;
|
||||
private Long targetType;
|
||||
|
||||
/**
|
||||
* 设备类型:1-门禁 2-电梯
|
||||
* 权限组id
|
||||
*/
|
||||
private Integer deviceType;
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date begDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -33,9 +33,14 @@ public class SisElevatorFloorRef extends TenantEntity {
|
||||
private Long elevatorId;
|
||||
|
||||
/**
|
||||
* 楼层层数
|
||||
* 楼层id
|
||||
*/
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 授权组id
|
||||
*/
|
||||
private Long authGroupId;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -9,11 +9,13 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 授权组业务对象 sis_auth_group
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-07-23
|
||||
* @since 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -23,25 +25,34 @@ public class SisAuthGroupBo extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
@NotNull(message = "主键id不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
@NotBlank(message = "权限名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "权限名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 面向对象(1-单位、2-个人)
|
||||
*/
|
||||
@NotNull(message = "面向对象(1-单位、2-个人)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "面向对象不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long groupType;
|
||||
|
||||
/**
|
||||
* 是否启用(0:禁用,1启用)
|
||||
* 门禁id
|
||||
*/
|
||||
private Boolean isEnable;
|
||||
private Collection<Long> acIds;
|
||||
|
||||
/**
|
||||
* 电梯
|
||||
*/
|
||||
private Collection<Long> eleIds;
|
||||
|
||||
/**
|
||||
* 门禁id
|
||||
*/
|
||||
private Collection<Long> floorIds;
|
||||
|
||||
}
|
||||
|
@@ -8,14 +8,14 @@ import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 授权记录业务对象 sis_auth_record
|
||||
*
|
||||
* @author lsm
|
||||
* @since 2025-07-14
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -25,18 +25,38 @@ public class SisAuthRecordBo extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = {EditGroup.class})
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 图像库id
|
||||
* 授权对象Id
|
||||
*/
|
||||
@NotNull(message = "图像库id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long libId;
|
||||
@NotNull(message = "授权对象Id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long targetId;
|
||||
|
||||
/**
|
||||
* 授权设备idList
|
||||
* 对象类型:1-单位 2-人
|
||||
*/
|
||||
@NotEmpty(message = "授权设备idList不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private List<List<Long>> deviceIds;
|
||||
@NotNull(message = "对象类型:1-单位 2-人不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long targetType;
|
||||
|
||||
/**
|
||||
* 权限组id
|
||||
*/
|
||||
@NotNull(message = "权限组id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@NotNull(message = "开始时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date begDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@NotNull(message = "结束时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date endDate;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -35,11 +35,17 @@ public class SisElevatorFloorRefBo extends BaseEntity {
|
||||
private Long elevatorId;
|
||||
|
||||
/**
|
||||
* 楼层层数
|
||||
* 楼层id
|
||||
*/
|
||||
@NotEmpty(message = "楼层层数不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotEmpty(message = "楼层id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Collection<Long> floorIds;
|
||||
|
||||
/**
|
||||
* 授权组id
|
||||
*/
|
||||
@NotNull(message = "授权组id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long authGroupId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package org.dromara.sis.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.sis.domain.SisAuthRecord;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
@@ -10,13 +12,15 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 授权记录视图对象 sis_auth_record
|
||||
*
|
||||
* @author lsm
|
||||
* @since 2025-07-14
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@@ -33,23 +37,34 @@ public class SisAuthRecordVo implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 图像库id
|
||||
* 授权对象Id
|
||||
*/
|
||||
@ExcelProperty(value = "图像库id")
|
||||
private Long libId;
|
||||
@ExcelProperty(value = "授权对象Id")
|
||||
private Long targetId;
|
||||
|
||||
/**
|
||||
* 设备id(门禁/电梯)
|
||||
* 对象类型:1-单位 2-人
|
||||
*/
|
||||
@ExcelProperty(value = "设备id", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "门禁/电梯")
|
||||
private Long deviceId;
|
||||
@ExcelProperty(value = "对象类型:1-单位 2-人")
|
||||
private Long targetType;
|
||||
|
||||
/**
|
||||
* 设备类型:1-门禁 2-电梯
|
||||
* 权限组id
|
||||
*/
|
||||
@ExcelProperty(value = "设备类型:1-门禁 2-电梯")
|
||||
private Integer deviceType;
|
||||
@ExcelProperty(value = "权限组id")
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@ExcelProperty(value = "开始时间")
|
||||
private Date begDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@ExcelProperty(value = "结束时间")
|
||||
private Date endDate;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -43,5 +43,11 @@ public class SisElevatorFloorRefVo implements Serializable {
|
||||
@ExcelProperty(value = "楼层id")
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
* 授权组id
|
||||
*/
|
||||
@ExcelProperty(value = "授权组id")
|
||||
private Long authGroupId;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,26 @@
|
||||
package org.dromara.sis.dubbo;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.dromara.sis.api.RemoteSisAuth;
|
||||
import org.dromara.sis.api.domain.RemotePersonAuth;
|
||||
import org.dromara.sis.service.ISisAuthRecordService;
|
||||
|
||||
/**
|
||||
* @author lsm
|
||||
* @apiNote RemoteSisAuthImpl
|
||||
* @since 2025/7/24
|
||||
*/
|
||||
@Slf4j
|
||||
@DubboService
|
||||
@RequiredArgsConstructor
|
||||
public class RemoteSisAuthImpl implements RemoteSisAuth {
|
||||
|
||||
private final ISisAuthRecordService sisAuthRecordService;
|
||||
|
||||
@Override
|
||||
public Long personAuth(RemotePersonAuth personAuth) {
|
||||
return sisAuthRecordService.insertByPerson(personAuth);
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.sis.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.sis.domain.SisAuthGroup;
|
||||
import org.dromara.sis.domain.vo.SisAuthGroupVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
@@ -8,8 +9,9 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
* 授权组Mapper接口
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-07-23
|
||||
* @since 2025-07-23
|
||||
*/
|
||||
@Mapper
|
||||
public interface SisAuthGroupMapper extends BaseMapperPlus<SisAuthGroup, SisAuthGroupVo> {
|
||||
|
||||
}
|
||||
|
@@ -14,12 +14,12 @@ public class CustomerAuthAddReq {
|
||||
/**
|
||||
* 门禁授权类型 0:人员
|
||||
*/
|
||||
private Integer authType;
|
||||
private Integer authType = 0;
|
||||
|
||||
/**
|
||||
* 时区ID
|
||||
*/
|
||||
private Long scheduleId;
|
||||
private Long scheduleId = 1L;
|
||||
|
||||
/**
|
||||
* 人员ID集合
|
||||
@@ -46,6 +46,13 @@ public class CustomerAuthAddReq {
|
||||
*/
|
||||
private Integer dateType;
|
||||
|
||||
// 默认全覆盖
|
||||
private Integer accessAuthModel = 2;
|
||||
|
||||
// 默认全覆盖
|
||||
private Integer elevatorAuthModel = 2;
|
||||
|
||||
|
||||
@Data
|
||||
public static class AuthGroupData {
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package org.dromara.sis.sdk.e8.domain.custom.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -110,7 +111,7 @@ public class CustomAddReq {
|
||||
/**
|
||||
* 客户明细
|
||||
*/
|
||||
private CustomerDetail detail;
|
||||
private CustomerDetail detail = new CustomerDetail();
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
@@ -135,17 +136,17 @@ public class CustomAddReq {
|
||||
/**
|
||||
* 绑定车辆信息
|
||||
*/
|
||||
private List<Vehicle> vehicleInfos;
|
||||
private List<Vehicle> vehicleInfos = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 相关联区域
|
||||
*/
|
||||
private List<RelatedArea> relAreas;
|
||||
private List<RelatedArea> relAreas = new ArrayList<>() ;
|
||||
|
||||
/**
|
||||
* 是否特殊车牌
|
||||
*/
|
||||
private Boolean isSpecialPlate;
|
||||
private Boolean isSpecialPlate = false;
|
||||
|
||||
/**
|
||||
* 车辆信息·
|
||||
|
@@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class E8ApiUtil {
|
||||
|
||||
private static final String BASE_URL = "http://47.109.37.87:4000";
|
||||
private static final String BASE_URL = "http://192.168.24.8:50014";
|
||||
private static final String SECRET_KEY = "ZG4ocLq1";
|
||||
private static final String KEY = "b97c7090379f490bb4b2ead0f57fd1bf";
|
||||
|
||||
|
@@ -322,57 +322,57 @@ public class HikAlarmCallBack implements HCNetSDK.FMSGCallBack_V31 {
|
||||
log.info("人脸比对完成,personId={}", person);
|
||||
|
||||
// 授权记录
|
||||
List<SisAuthRecordVo> authVoList = authRecordService.checkAuth(person);
|
||||
// List<SisAuthRecordVo> authVoList = authRecordService.checkAuth(person);
|
||||
// 获取门禁id
|
||||
Collection<Long> acIds = authVoList.stream().filter(vo -> vo.getDeviceType() == 1).map(SisAuthRecordVo::getDeviceId).toList();
|
||||
if (CollUtil.isNotEmpty(acIds)) {
|
||||
acIds.forEach(id -> {
|
||||
Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id)).findFirst().map(SisDeviceBindRefVo::getDeviceId).orElse(null);
|
||||
SisAccessControlVo ac = accessControlService.queryById(deviceId);
|
||||
if (ac != null) {
|
||||
log.info("调用门禁服务远程开门,doorName:{}", ac.getAccessName());
|
||||
RemoteOpenDoorReq req = new RemoteOpenDoorReq();
|
||||
req.setType(0);
|
||||
RemoteOpenDoorReq.ControlData data = new RemoteOpenDoorReq.ControlData();
|
||||
data.setDeviceId(Long.parseLong(ac.getOutCode()));
|
||||
data.setDoorId(Long.parseLong(ac.getOutCode()));
|
||||
req.setControlList(List.of(data));
|
||||
Boolean flag = e8PlatformApi.remoteOpenDoor(req);
|
||||
log.info("远程开门结果,result={}", flag);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Collection<Long> acIds = authVoList.stream().filter(vo -> vo.getDeviceType() == 1).map(SisAuthRecordVo::getDeviceId).toList();
|
||||
// if (CollUtil.isNotEmpty(acIds)) {
|
||||
// acIds.forEach(id -> {
|
||||
// Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id)).findFirst().map(SisDeviceBindRefVo::getDeviceId).orElse(null);
|
||||
// SisAccessControlVo ac = accessControlService.queryById(deviceId);
|
||||
// if (ac != null) {
|
||||
// log.info("调用门禁服务远程开门,doorName:{}", ac.getAccessName());
|
||||
// RemoteOpenDoorReq req = new RemoteOpenDoorReq();
|
||||
// req.setType(0);
|
||||
// RemoteOpenDoorReq.ControlData data = new RemoteOpenDoorReq.ControlData();
|
||||
// data.setDeviceId(Long.parseLong(ac.getOutCode()));
|
||||
// data.setDoorId(Long.parseLong(ac.getOutCode()));
|
||||
// req.setControlList(List.of(data));
|
||||
// Boolean flag = e8PlatformApi.remoteOpenDoor(req);
|
||||
// log.info("远程开门结果,result={}", flag);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
// 获取电梯ids
|
||||
Collection<Long> eleIds = authVoList.stream().filter(vo -> vo.getDeviceType() == 2).map(SisAuthRecordVo::getDeviceId).toList();
|
||||
if (CollUtil.isNotEmpty(eleIds)) {
|
||||
eleIds.forEach(id -> {
|
||||
Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id)).findFirst().map(SisDeviceBindRefVo::getDeviceId).orElse(null);
|
||||
SisElevatorInfoVo ele = elevatorInfoService.queryById(deviceId);
|
||||
if (ele != null) {
|
||||
log.info("下发电梯权限");
|
||||
// 根据单元ID获取楼层信息
|
||||
List<RemoteFloorVo> floorInfo = remoteFloorService.queryByUnitId(ele.getUnitId());
|
||||
// 获取电梯⇄楼层关联信息
|
||||
List<SisElevatorFloorRefVo> floorRefList = elevatorFloorRefService.queryByElevatorId(deviceId);
|
||||
// 获取楼层数组
|
||||
List<Long> layerArray = floorInfo.stream().map(RemoteFloorVo::getId).sorted().toList();
|
||||
|
||||
layerArray.forEach(layer -> {
|
||||
SisElevatorFloorRefVo floorRef = floorRefList.stream()
|
||||
.filter(vo -> Objects.equals(vo.getFloorId(), layer)) // 直接使用 layer
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (floorRef == null) {
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 3);
|
||||
} else {
|
||||
HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// Collection<Long> eleIds = authVoList.stream().filter(vo -> vo.getDeviceType() == 2).map(SisAuthRecordVo::getDeviceId).toList();
|
||||
// if (CollUtil.isNotEmpty(eleIds)) {
|
||||
// eleIds.forEach(id -> {
|
||||
// Long deviceId = bindRefList.stream().filter(vo -> vo.getBindId().equals(id)).findFirst().map(SisDeviceBindRefVo::getDeviceId).orElse(null);
|
||||
// SisElevatorInfoVo ele = elevatorInfoService.queryById(deviceId);
|
||||
// if (ele != null) {
|
||||
// log.info("下发电梯权限");
|
||||
// // 根据单元ID获取楼层信息
|
||||
// List<RemoteFloorVo> floorInfo = remoteFloorService.queryByUnitId(ele.getUnitId());
|
||||
// // 获取电梯⇄楼层关联信息
|
||||
// List<SisElevatorFloorRefVo> floorRefList = elevatorFloorRefService.queryByAuthGroupId(deviceId);
|
||||
// // 获取楼层数组
|
||||
// List<Long> layerArray = floorInfo.stream().map(RemoteFloorVo::getId).sorted().toList();
|
||||
//
|
||||
// layerArray.forEach(layer -> {
|
||||
// SisElevatorFloorRefVo floorRef = floorRefList.stream()
|
||||
// .filter(vo -> Objects.equals(vo.getFloorId(), layer)) // 直接使用 layer
|
||||
// .findFirst()
|
||||
// .orElse(null);
|
||||
// if (floorRef == null) {
|
||||
// HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 3);
|
||||
// } else {
|
||||
// HikApiService.getInstance().controlGateway(ele.getControlIp(), layer.intValue(), 2);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
log.info("权限下发执行完成,耗时:{}", System.currentTimeMillis() - s);
|
||||
// todo 做延时队列,关闭梯控授权
|
||||
|
||||
|
@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
|
||||
@Component
|
||||
public class HuaWeiHttp {
|
||||
|
||||
private static final String BASE_URL = "https://47.109.37.87:18000";
|
||||
private static final String BASE_URL = "https://192.168.24.100:18531";
|
||||
private static final String USERNAME = "huawei";
|
||||
private static final String PASSWORD = "qweasd123";
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package org.dromara.sis.service;
|
||||
|
||||
import org.dromara.sis.domain.SisAuthGroupRef;
|
||||
import org.dromara.sis.domain.vo.SisAuthGroupRefVo;
|
||||
import org.dromara.sis.domain.bo.SisAuthGroupRefBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -13,7 +12,7 @@ import java.util.List;
|
||||
* 权限组⇄设备关联Service接口
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-07-23
|
||||
* @since 2025-07-23
|
||||
*/
|
||||
public interface ISisAuthGroupRefService {
|
||||
|
||||
@@ -66,4 +65,13 @@ public interface ISisAuthGroupRefService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过权限组id,查询授权设备列表
|
||||
*
|
||||
* @param groupId 权限id
|
||||
*/
|
||||
List<SisAuthGroupRefVo> queryListByGroupId(Long groupId);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package org.dromara.sis.service;
|
||||
|
||||
import org.dromara.common.core.domain.TreeNode;
|
||||
import org.dromara.sis.api.domain.RemotePersonAuth;
|
||||
import org.dromara.sis.domain.SisAuthRecord;
|
||||
import org.dromara.sis.domain.vo.SisAuthRecordVo;
|
||||
import org.dromara.sis.domain.bo.SisAuthRecordBo;
|
||||
@@ -44,12 +45,12 @@ public interface ISisAuthRecordService {
|
||||
List<SisAuthRecordVo> queryList(SisAuthRecordBo bo);
|
||||
|
||||
/**
|
||||
* 新增授权记录
|
||||
* 新增个人授权记录(单个)
|
||||
*
|
||||
* @param bo 授权记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SisAuthRecordBo bo);
|
||||
Long insertByPerson(RemotePersonAuth bo);
|
||||
|
||||
/**
|
||||
* 修改授权记录
|
||||
@@ -74,26 +75,26 @@ public interface ISisAuthRecordService {
|
||||
* @param libId 人像库id
|
||||
* @return List<SisAuthRecord>
|
||||
*/
|
||||
List<SisAuthRecord> queryAuthDevice(String libId);
|
||||
// List<SisAuthRecord> queryAuthDevice(String libId);
|
||||
|
||||
/**
|
||||
* 根据人像库id删除授权记录
|
||||
*
|
||||
* @param libId 人像库id
|
||||
*/
|
||||
Boolean deleteByLibId(Long libId);
|
||||
// Boolean deleteByLibId(Long libId);
|
||||
|
||||
/**
|
||||
* 查询所有可授权设备树
|
||||
*
|
||||
* @return List<TreeNode<Long>>
|
||||
*/
|
||||
List<TreeNode<Long>> authDeviceTree();
|
||||
// List<TreeNode<Long>> authDeviceTree();
|
||||
|
||||
/**
|
||||
* 根据人脸比对ID,返回授权记录
|
||||
*
|
||||
* @param personId 人脸比对ID
|
||||
*/
|
||||
List<SisAuthRecordVo> checkAuth(Long personId);
|
||||
// List<SisAuthRecordVo> checkAuth(Long personId);
|
||||
}
|
||||
|
@@ -67,9 +67,9 @@ public interface ISisElevatorFloorRefService {
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 根据电梯id,获取电梯⇄楼层关联信息
|
||||
* 根据权限组id,获取电梯⇄楼层关联信息
|
||||
*
|
||||
* @param elevatorId 电梯id
|
||||
* @param authGroupId 电梯id
|
||||
*/
|
||||
List<SisElevatorFloorRefVo> queryByElevatorId(Long elevatorId);
|
||||
List<SisElevatorFloorRefVo> queryByAuthGroupId(Long authGroupId);
|
||||
}
|
||||
|
@@ -131,4 +131,16 @@ public class SisAuthGroupRefServiceImpl implements ISisAuthGroupRefService {
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过权限组id,查询授权设备列表
|
||||
*
|
||||
* @param groupId 权限id
|
||||
*/
|
||||
@Override
|
||||
public List<SisAuthGroupRefVo> queryListByGroupId(Long groupId){
|
||||
LambdaQueryWrapper<SisAuthGroupRef> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisAuthGroupRef::getGroupId, groupId);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
package org.dromara.sis.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@@ -9,12 +12,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.api.RemoteFloorService;
|
||||
import org.dromara.property.api.domain.vo.RemoteFloorVo;
|
||||
import org.dromara.sis.domain.bo.SisAuthGroupRefBo;
|
||||
import org.dromara.sis.domain.bo.SisElevatorFloorRefBo;
|
||||
import org.dromara.sis.domain.vo.SisAccessControlVo;
|
||||
import org.dromara.sis.domain.vo.SisElevatorInfoVo;
|
||||
import org.dromara.sis.service.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.sis.domain.bo.SisAuthGroupBo;
|
||||
import org.dromara.sis.domain.vo.SisAuthGroupVo;
|
||||
import org.dromara.sis.domain.SisAuthGroup;
|
||||
import org.dromara.sis.mapper.SisAuthGroupMapper;
|
||||
import org.dromara.sis.service.ISisAuthGroupService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -24,7 +34,7 @@ import java.util.Collection;
|
||||
* 授权组Service业务层处理
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-07-23
|
||||
* @since 2025-07-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@@ -33,6 +43,13 @@ public class SisAuthGroupServiceImpl implements ISisAuthGroupService {
|
||||
|
||||
private final SisAuthGroupMapper baseMapper;
|
||||
|
||||
private final ISisElevatorInfoService elevatorInfoService;
|
||||
private final ISisAccessControlService accessControlService;
|
||||
private final ISisAuthGroupRefService sisAuthGroupRefService;
|
||||
private final ISisElevatorFloorRefService sisElevatorFloorRefService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFloorService remoteFloorService;
|
||||
/**
|
||||
* 查询授权组
|
||||
*
|
||||
@@ -76,7 +93,6 @@ public class SisAuthGroupServiceImpl implements ISisAuthGroupService {
|
||||
lqw.orderByAsc(SisAuthGroup::getId);
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), SisAuthGroup::getName, bo.getName());
|
||||
lqw.eq(bo.getGroupType() != null, SisAuthGroup::getGroupType, bo.getGroupType());
|
||||
lqw.eq(bo.getIsEnable() != null, SisAuthGroup::getIsEnable, bo.getIsEnable());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -87,12 +103,57 @@ public class SisAuthGroupServiceImpl implements ISisAuthGroupService {
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(SisAuthGroupBo bo) {
|
||||
SisAuthGroup add = MapstructUtils.convert(bo, SisAuthGroup.class);
|
||||
validEntityBeforeSave(add);
|
||||
SisAuthGroup add = new SisAuthGroup();
|
||||
add.setName(bo.getName());
|
||||
add.setGroupType(bo.getGroupType());
|
||||
|
||||
// 电梯设备
|
||||
List<SisElevatorInfoVo> eleVoList = elevatorInfoService.queryListByIds(bo.getEleIds());
|
||||
if (CollUtil.isEmpty(eleVoList)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "新增授权组失败");
|
||||
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
log.info("开始写入授权组门禁,acIds:{}", bo.getAcIds());
|
||||
boolean check;
|
||||
for(Long ac : bo.getAcIds()){
|
||||
SisAuthGroupRefBo groupRef = new SisAuthGroupRefBo();
|
||||
groupRef.setGroupId(add.getId());
|
||||
groupRef.setDeviceType(1L);
|
||||
groupRef.setDeviceId(ac);
|
||||
check = sisAuthGroupRefService.insertByBo(groupRef);
|
||||
Assert.isTrue(check, "写入授权组门禁失败!");
|
||||
}
|
||||
log.info("写入授权组门禁完成");
|
||||
|
||||
log.info("开始写入授权组电梯,eleIds:{}", bo.getEleIds());
|
||||
for (SisElevatorInfoVo ele : eleVoList) {
|
||||
SisAuthGroupRefBo groupRef = new SisAuthGroupRefBo();
|
||||
groupRef.setGroupId(add.getId());
|
||||
groupRef.setDeviceType(2L);
|
||||
groupRef.setDeviceId(ele.getElevatorId());
|
||||
check = sisAuthGroupRefService.insertByBo(groupRef);
|
||||
Assert.isTrue(check, "写入授权组电梯失败!");
|
||||
|
||||
log.info("开始写入授权组电梯楼层,floorIds:{}", bo.getFloorIds());
|
||||
// 获取该电梯所在单元的楼层信息
|
||||
List<RemoteFloorVo> floorVoList = remoteFloorService.queryByUnitId(ele.getUnitId());
|
||||
// 该单元所有楼层id
|
||||
List<Long> allFloors = floorVoList.stream().map(RemoteFloorVo::getId).toList();
|
||||
// 对比找出授权楼层id
|
||||
List<Long> authFloors = bo.getFloorIds().stream().filter(allFloors::contains).toList();
|
||||
SisElevatorFloorRefBo refBo = new SisElevatorFloorRefBo();
|
||||
refBo.setAuthGroupId(add.getId());
|
||||
refBo.setElevatorId(ele.getElevatorId());
|
||||
refBo.setFloorIds(authFloors);
|
||||
sisElevatorFloorRefService.insertByBo(refBo);
|
||||
}
|
||||
log.info("写入授权组电梯完成");
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
@@ -2,8 +2,9 @@ package org.dromara.sis.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.TreeNode;
|
||||
import org.dromara.common.core.constant.CodePrefixConstants;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
@@ -12,16 +13,20 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.property.api.RemoteFloorService;
|
||||
import org.dromara.property.api.domain.vo.RemoteFloorVo;
|
||||
import org.dromara.sis.domain.bo.SisAccessControlBo;
|
||||
import org.dromara.sis.domain.bo.SisElevatorFloorRefBo;
|
||||
import org.dromara.sis.domain.bo.SisElevatorInfoBo;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.sis.api.domain.RemotePersonAuth;
|
||||
import org.dromara.sis.domain.bo.SisPersonLibImgBo;
|
||||
import org.dromara.sis.domain.vo.SisAccessControlVo;
|
||||
import org.dromara.sis.domain.vo.SisElevatorInfoVo;
|
||||
import org.dromara.sis.domain.vo.SisAuthGroupRefVo;
|
||||
import org.dromara.sis.sdk.e8.E8PlatformApi;
|
||||
import org.dromara.sis.sdk.e8.domain.accessControl.req.CustomerAuthAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.custom.req.CustomAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.voucher.req.IssueVoucherReq;
|
||||
import org.dromara.sis.sdk.huawei.HuaWeiBoxApi;
|
||||
import org.dromara.sis.sdk.huawei.domain.AddHWPersonReq;
|
||||
import org.dromara.sis.service.ISisAccessControlService;
|
||||
import org.dromara.sis.service.ISisElevatorFloorRefService;
|
||||
import org.dromara.sis.service.ISisElevatorInfoService;
|
||||
import org.dromara.sis.service.ISisAuthGroupRefService;
|
||||
import org.dromara.sis.service.ISisPersonLibImgService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.sis.domain.bo.SisAuthRecordBo;
|
||||
import org.dromara.sis.domain.vo.SisAuthRecordVo;
|
||||
@@ -30,30 +35,28 @@ import org.dromara.sis.mapper.SisAuthRecordMapper;
|
||||
import org.dromara.sis.service.ISisAuthRecordService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 授权记录Service业务层处理
|
||||
*
|
||||
* @author lsm
|
||||
* @since 2025-07-14
|
||||
* @since 2025-07-24
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
|
||||
|
||||
private final HuaWeiBoxApi huaWeiBoxApi;
|
||||
private final E8PlatformApi e8PlatformApi;
|
||||
private final SisAuthRecordMapper baseMapper;
|
||||
|
||||
private final ISisElevatorFloorRefService elevatorFloorRefService;
|
||||
private final ISisAccessControlService accessControlService;
|
||||
private final ISisElevatorInfoService elevatorInfoService;
|
||||
private final ISisAuthGroupRefService sisAuthGroupRefService;
|
||||
private final ISisPersonLibImgService sisPersonLibImgService;
|
||||
private final ISisAccessControlService sisAccessControlService;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFloorService remoteFloorService;
|
||||
private final RemoteFileService remoteFileService;
|
||||
|
||||
/**
|
||||
* 查询授权记录
|
||||
@@ -96,81 +99,145 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SisAuthRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisAuthRecord::getId);
|
||||
lqw.eq(bo.getLibId() != null, SisAuthRecord::getLibId, bo.getLibId());
|
||||
lqw.eq(bo.getTargetId() != null, SisAuthRecord::getTargetId, bo.getTargetId());
|
||||
lqw.eq(bo.getTargetType() != null, SisAuthRecord::getTargetType, bo.getTargetType());
|
||||
lqw.eq(bo.getGroupId() != null, SisAuthRecord::getGroupId, bo.getGroupId());
|
||||
lqw.eq(bo.getBegDate() != null, SisAuthRecord::getBegDate, bo.getBegDate());
|
||||
lqw.eq(bo.getEndDate() != null, SisAuthRecord::getEndDate, bo.getEndDate());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增授权记录
|
||||
* 新增个人授权记录(单个)
|
||||
*
|
||||
* @param bo 授权记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(SisAuthRecordBo bo) {
|
||||
if (CollUtil.isEmpty(bo.getDeviceIds())) {
|
||||
return false;
|
||||
public Long insertByPerson(RemotePersonAuth bo) {
|
||||
SisAuthRecord add = new SisAuthRecord();
|
||||
add.setTargetType(2L);
|
||||
add.setTargetId(bo.getId());
|
||||
add.setGroupId(bo.getAuthGroupId());
|
||||
add.setBegDate(bo.getBegDate());
|
||||
add.setEndDate(bo.getEndDate());
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "新增授权记录失败");
|
||||
|
||||
|
||||
Long e8Id = null;
|
||||
try {
|
||||
byte[] imageByte = remoteFileService.downloadToByteArray(Long.parseLong(bo.getOssId()));
|
||||
|
||||
// 写入华为平台
|
||||
Long huaweiBoxId = syncHuaweiBox(bo, imageByte);
|
||||
|
||||
// 写入安防人像信息
|
||||
this.syncPersonImg(bo, huaweiBoxId);
|
||||
|
||||
// 写入E8平台
|
||||
e8Id = syncE8Plat(bo, imageByte);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
// 每次授权先删除上一次授权信息
|
||||
deleteByLibId(bo.getLibId());
|
||||
return e8Id;
|
||||
}
|
||||
|
||||
//取出需要授权的门禁id、电梯id、楼层id
|
||||
List<Long> acIds = bo.getDeviceIds().get(0);
|
||||
List<Long> eleIds = bo.getDeviceIds().get(1);
|
||||
List<Long> floorIds = bo.getDeviceIds().get(2);
|
||||
private void syncPersonImg(RemotePersonAuth bo, Long huaweiBoxId){
|
||||
log.info("开始写入安防人像信息");
|
||||
SisPersonLibImgBo personLibImg = new SisPersonLibImgBo();
|
||||
personLibImg.setImgOssId(Long.parseLong(bo.getOssId()));
|
||||
personLibImg.setImgName(bo.getName());
|
||||
personLibImg.setSex(bo.getSex());
|
||||
personLibImg.setEmail(bo.getEmail());
|
||||
personLibImg.setTel(bo.getPhone());
|
||||
personLibImg.setCertificateType(bo.getCardType());
|
||||
personLibImg.setCertificateNo(bo.getIdCardNumber());
|
||||
personLibImg.setRemoteImgId(huaweiBoxId);
|
||||
sisPersonLibImgService.insertByBo(personLibImg);
|
||||
log.info("写入安防人像信息完成");
|
||||
}
|
||||
|
||||
// 过滤不是设备的节点数据
|
||||
// 门禁设备
|
||||
List<SisAccessControlVo> acVoList = accessControlService.queryListByIds(acIds);
|
||||
// 电梯设备
|
||||
List<SisElevatorInfoVo> eleVoList = elevatorInfoService.queryListByIds(eleIds);
|
||||
// 楼层信息
|
||||
private Long syncHuaweiBox(RemotePersonAuth bo, byte[] imgByte) {
|
||||
log.info("开始写入华为平台");
|
||||
AddHWPersonReq req = new AddHWPersonReq();
|
||||
req.setIndex(CodePrefixConstants.PERSON_LIB_IMAGE_CODE_PREFIX + IdUtil.getSnowflakeNextIdStr());
|
||||
req.setName(bo.getName());
|
||||
req.setGender(bo.getSex() == 1 ? "0" : bo.getSex() == 2 ? "1" : "-1");
|
||||
req.setCredentialType("0");
|
||||
req.setCredentialNumber(bo.getIdCardNumber());
|
||||
|
||||
if (CollUtil.isEmpty(acVoList) || CollUtil.isEmpty(eleVoList)) {
|
||||
return false;
|
||||
ArrayList<String> pictures = new ArrayList<>();
|
||||
pictures.add(Base64.getEncoder().encodeToString(imgByte));
|
||||
req.setPictures(pictures);
|
||||
|
||||
Long pId = huaWeiBoxApi.addPerson(List.of(req));
|
||||
Assert.notNull(pId, "调用华为盒子新增图片失败");
|
||||
log.info("写入华为盒子完成,pId={}", pId);
|
||||
return pId;
|
||||
}
|
||||
|
||||
private Long syncE8Plat(RemotePersonAuth bo, byte[] imgByte) {
|
||||
|
||||
log.info("e8平台上传照片");
|
||||
String e8ImgUrl = e8PlatformApi.uploadFace(imgByte);
|
||||
Assert.notNull(e8ImgUrl, "图片上传E8平台失败");
|
||||
log.info("e8平台上传照片完成");
|
||||
|
||||
log.info("e8同步新建人员");
|
||||
CustomAddReq req = new CustomAddReq();
|
||||
req.setName(bo.getName());
|
||||
req.setGender(bo.getSex());
|
||||
req.setMobile(bo.getPhone());
|
||||
req.setEmail(bo.getEmail());
|
||||
req.setIdentityType(0);
|
||||
req.setIdentityNo(bo.getIdCardNumber());
|
||||
Long e8Id = e8PlatformApi.addCustomer(req).getId();
|
||||
Assert.notNull(e8Id, "e8同步新建人员失败");
|
||||
log.info("e8同步新建人员完成");
|
||||
|
||||
|
||||
log.info("e8平台开始发行凭证");
|
||||
IssueVoucherReq voucherReq = new IssueVoucherReq();
|
||||
voucherReq.setVoucherType(70);
|
||||
voucherReq.setPersonID(e8Id);
|
||||
voucherReq.setTxtData(e8ImgUrl);
|
||||
voucherReq.setStartTime(bo.getBegDate().toString());
|
||||
voucherReq.setEndTime(bo.getEndDate().toString());
|
||||
Long voucherId = e8PlatformApi.issueVoucher(voucherReq);
|
||||
Assert.notNull(voucherId, "e8平台发行凭证失败");
|
||||
log.info("e8平台发行凭证成功");
|
||||
|
||||
// 获取门禁
|
||||
List<SisAuthGroupRefVo> refVos = sisAuthGroupRefService.queryListByGroupId(bo.getAuthGroupId());
|
||||
Collection<Long> deviceIds = refVos.stream().filter(ref -> ref.getDeviceType() == 1).map(SisAuthGroupRefVo::getDeviceId).toList();
|
||||
if(CollUtil.isNotEmpty(deviceIds)){
|
||||
// 初始化赋值
|
||||
CustomerAuthAddReq authReq = new CustomerAuthAddReq();
|
||||
authReq.setPersonIds(List.of(e8Id));
|
||||
authReq.setStartTime(bo.getBegDate().toString());
|
||||
authReq.setEndTime(bo.getEndDate().toString());
|
||||
List<CustomerAuthAddReq.AuthGroupData> list = new ArrayList<>();
|
||||
SisAccessControlVo accessControlVo;
|
||||
for(Long deviceId : deviceIds){
|
||||
accessControlVo = sisAccessControlService.queryById(deviceId);
|
||||
CustomerAuthAddReq.AuthGroupData authData = new CustomerAuthAddReq.AuthGroupData();
|
||||
authData.setId(Long.parseLong(accessControlVo.getOutDoorCode()));
|
||||
authData.setType(1);
|
||||
list.add(authData);
|
||||
}
|
||||
authReq.setAuthData(list);
|
||||
|
||||
log.info("e8平台开始授权");
|
||||
Boolean flag = e8PlatformApi.addCustomerAuth(authReq);
|
||||
Assert.isTrue(flag, "E8平台授权失败!");
|
||||
log.info("E8平台授权完成!");
|
||||
}
|
||||
|
||||
// 批量写入授权数据
|
||||
boolean flag = false;
|
||||
log.info("开始写入门禁授权记录,acIds:{}", acVoList);
|
||||
for (SisAccessControlVo ac : acVoList) {
|
||||
SisAuthRecord authRecord = new SisAuthRecord();
|
||||
|
||||
authRecord.setDeviceType(1);
|
||||
authRecord.setDeviceId(ac.getId());
|
||||
authRecord.setLibId(bo.getLibId());
|
||||
flag = baseMapper.insert(authRecord) > 0;
|
||||
Assert.isTrue(flag, "写入门禁授权记录失败!");
|
||||
}
|
||||
log.info("写入门禁授权记录完成");
|
||||
|
||||
log.info("开始写入电梯授权记录,eleIds:{}", eleVoList);
|
||||
for (SisElevatorInfoVo ele : eleVoList) {
|
||||
SisAuthRecord authRecord = new SisAuthRecord();
|
||||
SisElevatorFloorRefBo refBo = new SisElevatorFloorRefBo();
|
||||
|
||||
authRecord.setDeviceType(2);
|
||||
authRecord.setLibId(bo.getLibId());
|
||||
authRecord.setDeviceId(ele.getElevatorId());
|
||||
flag = baseMapper.insert(authRecord) > 0;
|
||||
Assert.isTrue(flag, "写入电梯授权记录失败!");
|
||||
|
||||
log.info("开始写入电梯⇄楼层关联关系");
|
||||
// 获取该电梯所在单元的楼层信息
|
||||
List<RemoteFloorVo> floorVoList = remoteFloorService.queryByUnitId(ele.getUnitId());
|
||||
// 该单元所有楼层id
|
||||
List<Long> allFloors = floorVoList.stream().map(RemoteFloorVo::getId).toList();
|
||||
// 对比找出授权楼层id
|
||||
List<Long> authFloors = floorIds.stream().filter(allFloors::contains).toList();
|
||||
refBo.setElevatorId(ele.getElevatorId());
|
||||
refBo.setFloorIds(authFloors);
|
||||
elevatorFloorRefService.insertByBo(refBo);
|
||||
}
|
||||
log.info("写入电梯授权记录完成");
|
||||
|
||||
return flag;
|
||||
return e8PlatformApi.addCustomer(req).getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,120 +274,4 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库id授权的设备
|
||||
*
|
||||
* @param libId 人像库id
|
||||
* @return List<SisAuthRecord>
|
||||
*/
|
||||
@Override
|
||||
public List<SisAuthRecord> queryAuthDevice(String libId) {
|
||||
LambdaQueryWrapper<SisAuthRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisAuthRecord::getLibId, libId);
|
||||
return baseMapper.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据人像库id删除授权记录
|
||||
*
|
||||
* @param libId 人像库id
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteByLibId(Long libId) {
|
||||
LambdaQueryWrapper<SisAuthRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisAuthRecord::getLibId, libId);
|
||||
return baseMapper.delete(lqw) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有可授权设备树
|
||||
*
|
||||
* @return List<TreeNode < Long>>
|
||||
*/
|
||||
@Override
|
||||
public List<TreeNode<Long>> authDeviceTree() {
|
||||
// 暂时将所有数据放入写死的根节点中
|
||||
TreeNode<Long> root = new TreeNode<>();
|
||||
root.setLevel(0);
|
||||
root.setCode(0L);
|
||||
root.setParentCode(-1L);
|
||||
root.setTitle("授权设备");
|
||||
|
||||
// 创建门禁设备父节点
|
||||
TreeNode<Long> accessNode = new TreeNode<>();
|
||||
accessNode.setLevel(1);
|
||||
accessNode.setCode(1L);
|
||||
accessNode.setParentCode(0L);
|
||||
accessNode.setTitle("门禁设备");
|
||||
|
||||
// 创建电梯父节点
|
||||
TreeNode<Long> elevatorNode = new TreeNode<>();
|
||||
elevatorNode.setLevel(1);
|
||||
elevatorNode.setCode(2L);
|
||||
elevatorNode.setParentCode(0L);
|
||||
elevatorNode.setTitle("电梯设备");
|
||||
|
||||
|
||||
List<SisAccessControlVo> acVoList = accessControlService.queryList(new SisAccessControlBo());
|
||||
List<SisElevatorInfoVo> eleVoList = elevatorInfoService.queryList(new SisElevatorInfoBo());
|
||||
|
||||
|
||||
List<TreeNode<Long>> acChildrenList = acVoList.stream().map(item -> {
|
||||
TreeNode<Long> node = new TreeNode<>();
|
||||
node.setLevel(2);
|
||||
node.setCode(item.getId());
|
||||
node.setParentCode(1L);
|
||||
node.setLabel("accessControl");
|
||||
node.setTitle(item.getAccessName());
|
||||
return node;
|
||||
}).toList();
|
||||
|
||||
List<TreeNode<Long>> eleChildrenList = new ArrayList<>();
|
||||
eleVoList.forEach(item -> {
|
||||
// 电梯子节点
|
||||
TreeNode<Long> eleNode = new TreeNode<>();
|
||||
eleNode.setLevel(2);
|
||||
eleNode.setParentCode(2L);
|
||||
eleNode.setLabel("elevator");
|
||||
eleNode.setCode(item.getElevatorId());
|
||||
eleNode.setTitle(item.getElevatorName());
|
||||
|
||||
// 楼层节点
|
||||
List<TreeNode<Long>> floorTree = new ArrayList<>();
|
||||
// 获取楼层
|
||||
List<RemoteFloorVo> floorInfoList = remoteFloorService.queryByUnitId(item.getUnitId());
|
||||
floorInfoList.forEach(floor -> {
|
||||
TreeNode<Long> floorNode = new TreeNode<>();
|
||||
floorNode.setLevel(3);
|
||||
floorNode.setLabel("floor");
|
||||
floorNode.setCode(floor.getId());
|
||||
floorNode.setTitle(floor.getFloorName());
|
||||
floorNode.setParentCode(item.getElevatorId());
|
||||
floorTree.add(floorNode);
|
||||
});
|
||||
eleNode.setChildren(floorTree);
|
||||
eleChildrenList.add(eleNode);
|
||||
});
|
||||
|
||||
// 将子节点列表分别添加到对应的父节点
|
||||
accessNode.setChildren(acChildrenList);
|
||||
elevatorNode.setChildren(eleChildrenList);
|
||||
|
||||
|
||||
// 最后将两个父节点添加到根节点
|
||||
root.setChildren(List.of(accessNode, elevatorNode));
|
||||
return List.of(root);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据人脸比对ID,返回授权记录
|
||||
*
|
||||
* @param personId 人脸比对ID
|
||||
*/
|
||||
@Override
|
||||
public List<SisAuthRecordVo> checkAuth(Long personId) {
|
||||
return baseMapper.checkAuth(personId);
|
||||
}
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@ public class SisElevatorFloorRefServiceImpl implements ISisElevatorFloorRefServi
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(SisElevatorFloorRefBo bo) {
|
||||
// 清除已有权限
|
||||
List<SisElevatorFloorRefVo> list = this.queryByElevatorId(bo.getElevatorId());
|
||||
List<SisElevatorFloorRefVo> list = this.queryByAuthGroupId(bo.getAuthGroupId());
|
||||
Collection<Long> ids = list.stream().map(SisElevatorFloorRefVo::getId).toList();
|
||||
baseMapper.deleteByIds(ids);
|
||||
|
||||
@@ -97,10 +97,11 @@ public class SisElevatorFloorRefServiceImpl implements ISisElevatorFloorRefServi
|
||||
for (Long num : bo.getFloorIds()){
|
||||
SisElevatorFloorRef add = new SisElevatorFloorRef();
|
||||
add.setFloorId(num);
|
||||
add.setAuthGroupId(bo.getAuthGroupId());
|
||||
add.setElevatorId(bo.getElevatorId());
|
||||
flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "新增电梯⇄楼层关联关系失败");
|
||||
}
|
||||
Assert.isTrue(flag, "新增电梯⇄楼层关联关系失败");
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -142,12 +143,12 @@ public class SisElevatorFloorRefServiceImpl implements ISisElevatorFloorRefServi
|
||||
/**
|
||||
* 根据电梯id,获取电梯⇄楼层关联信息
|
||||
*
|
||||
* @param elevatorId 电梯id
|
||||
* @param authGroupId 电梯id
|
||||
*/
|
||||
@Override
|
||||
public List<SisElevatorFloorRefVo> queryByElevatorId(Long elevatorId) {
|
||||
public List<SisElevatorFloorRefVo> queryByAuthGroupId(Long authGroupId) {
|
||||
LambdaQueryWrapper<SisElevatorFloorRef> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SisElevatorFloorRef::getElevatorId, elevatorId);
|
||||
lqw.eq(SisElevatorFloorRef::getElevatorId, authGroupId);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
}
|
||||
|
@@ -119,46 +119,8 @@ public class SisPersonLibImgServiceImpl implements ISisPersonLibImgService {
|
||||
public Boolean insertByBo(SisPersonLibImgBo bo) {
|
||||
SisPersonLibImg add = MapstructUtils.convert(bo, SisPersonLibImg.class);
|
||||
Assert.notNull(add, "数据处理失败");
|
||||
boolean flag;
|
||||
try {
|
||||
log.info("准备写入华为盒子,imgName={}", bo.getImgName());
|
||||
AddHWPersonReq req = new AddHWPersonReq();
|
||||
req.setIndex(CodePrefixConstants.PERSON_LIB_IMAGE_CODE_PREFIX + IdUtil.getSnowflakeNextIdStr());
|
||||
req.setName(bo.getImgName());
|
||||
req.setGender(bo.getSex() == 1 ? "0" : bo.getSex() == 2 ? "1" : "-1");
|
||||
req.setBornTime(bo.getBirthDate());
|
||||
req.setCredentialType("0");
|
||||
req.setCredentialNumber(bo.getCertificateNo());
|
||||
|
||||
byte[] imageByte = remoteFileService.downloadToByteArray(bo.getImgOssId());
|
||||
ArrayList<String> pictures = new ArrayList<>();
|
||||
pictures.add(Base64.getEncoder().encodeToString(imageByte));
|
||||
req.setPictures(pictures);
|
||||
|
||||
Long pId = huaWeiBoxApi.addPerson(List.of(req));
|
||||
Assert.notNull(pId, "调用华为盒子新增图片失败");
|
||||
log.info("写入华为盒子完成,pId={}", pId);
|
||||
|
||||
add.setRemoteImgId(pId);
|
||||
flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "新增人像失败");
|
||||
|
||||
log.info("开始写入人像⇄人像库关联表");
|
||||
List<SisLibImgRef> refs = new ArrayList<>();
|
||||
for (Long libId : bo.getLibIds()) {
|
||||
SisLibImgRef ref = new SisLibImgRef();
|
||||
ref.setLibId(libId);
|
||||
ref.setImgId(add.getId());
|
||||
refs.add(ref);
|
||||
}
|
||||
Boolean refFlag = sisLibImgRefService.addBatch(refs);
|
||||
Assert.isTrue(refFlag, "写入人像⇄人像库关联表失败!");
|
||||
log.info("写入人像⇄人像库关联表完成");
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
Assert.isTrue(flag, "新增数据失败");
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
<module>ruoyi-resource</module>
|
||||
<module>ruoyi-workflow</module>
|
||||
<module>Property</module>
|
||||
<!-- <module>Sis</module>-->
|
||||
<module>Sis</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
|
@@ -0,0 +1,106 @@
|
||||
package org.dromara.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.system.domain.vo.AppFunListVo;
|
||||
import org.dromara.system.domain.bo.AppFunListBo;
|
||||
import org.dromara.system.service.IAppFunListService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* APP功能列表
|
||||
* 前端访问路由地址为:/system/funList
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/funList")
|
||||
public class AppFunListController extends BaseController {
|
||||
|
||||
private final IAppFunListService appFunListService;
|
||||
|
||||
/**
|
||||
* 查询APP功能列表列表
|
||||
*/
|
||||
@SaCheckPermission("system:funList:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<AppFunListVo> list(AppFunListBo bo, PageQuery pageQuery) {
|
||||
return appFunListService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出APP功能列表列表
|
||||
*/
|
||||
@SaCheckPermission("system:funList:export")
|
||||
@Log(title = "APP功能列表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(AppFunListBo bo, HttpServletResponse response) {
|
||||
List<AppFunListVo> list = appFunListService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "APP功能列表", AppFunListVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取APP功能列表详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:funList:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<AppFunListVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(appFunListService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP功能列表
|
||||
*/
|
||||
@SaCheckPermission("system:funList:add")
|
||||
@Log(title = "APP功能列表", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody AppFunListBo bo) {
|
||||
return toAjax(appFunListService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP功能列表
|
||||
*/
|
||||
@SaCheckPermission("system:funList:edit")
|
||||
@Log(title = "APP功能列表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AppFunListBo bo) {
|
||||
return toAjax(appFunListService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除APP功能列表
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:funList:remove")
|
||||
@Log(title = "APP功能列表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(appFunListService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
package org.dromara.system.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* APP功能列表对象 app_fun_list
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("app_fun_list")
|
||||
public class AppFunList extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Long roleid;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* icon
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long createById;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
private Long updateById;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
package org.dromara.system.domain.bo;
|
||||
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* APP功能列表业务对象 app_fun_list
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = AppFunList.class, reverseConvertGenerate = false)
|
||||
public class AppFunListBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Long roleid;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* icon
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
package org.dromara.system.domain.vo;
|
||||
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* APP功能列表视图对象 app_fun_list
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = AppFunList.class)
|
||||
public class AppFunListVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
@ExcelProperty(value = "角色id")
|
||||
private Long roleid;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
@ExcelProperty(value = "角色id")
|
||||
private String roleName;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ExcelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* icon
|
||||
*/
|
||||
@Translation(type = TransConstant.OSS_ID_TO_URL)
|
||||
@ExcelProperty(value = "icon")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
@ExcelProperty(value = "url")
|
||||
private String url;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package org.dromara.system.mapper;
|
||||
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import org.dromara.system.domain.vo.AppFunListVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* APP功能列表Mapper接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
public interface AppFunListMapper extends BaseMapperPlus<AppFunList, AppFunListVo> {
|
||||
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
package org.dromara.system.service;
|
||||
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import org.dromara.system.domain.vo.AppFunListVo;
|
||||
import org.dromara.system.domain.bo.AppFunListBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP功能列表Service接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
public interface IAppFunListService {
|
||||
|
||||
/**
|
||||
* 查询APP功能列表
|
||||
*
|
||||
* @param id 主键
|
||||
* @return APP功能列表
|
||||
*/
|
||||
AppFunListVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询APP功能列表列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return APP功能列表分页列表
|
||||
*/
|
||||
TableDataInfo<AppFunListVo> queryPageList(AppFunListBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的APP功能列表列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return APP功能列表列表
|
||||
*/
|
||||
List<AppFunListVo> queryList(AppFunListBo bo);
|
||||
|
||||
/**
|
||||
* 新增APP功能列表
|
||||
*
|
||||
* @param bo APP功能列表
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(AppFunListBo bo);
|
||||
|
||||
/**
|
||||
* 修改APP功能列表
|
||||
*
|
||||
* @param bo APP功能列表
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(AppFunListBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除APP功能列表信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
package org.dromara.system.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.system.mapper.SysRoleMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.system.domain.bo.AppFunListBo;
|
||||
import org.dromara.system.domain.vo.AppFunListVo;
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import org.dromara.system.mapper.AppFunListMapper;
|
||||
import org.dromara.system.service.IAppFunListService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* APP功能列表Service业务层处理
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class AppFunListServiceImpl implements IAppFunListService {
|
||||
|
||||
private final AppFunListMapper baseMapper;
|
||||
private final SysRoleMapper sysRoleMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询APP功能列表
|
||||
*
|
||||
* @param id 主键
|
||||
* @return APP功能列表
|
||||
*/
|
||||
@Override
|
||||
public AppFunListVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询APP功能列表列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return APP功能列表分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<AppFunListVo> queryPageList(AppFunListBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<AppFunList> lqw = buildQueryWrapper(bo);
|
||||
Page<AppFunListVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
result.getRecords().forEach(r -> r.setRoleName(sysRoleMapper.selectVoById(r.getRoleid()).getRoleName()));
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的APP功能列表列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return APP功能列表列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppFunListVo> queryList(AppFunListBo bo) {
|
||||
LambdaQueryWrapper<AppFunList> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AppFunList> buildQueryWrapper(AppFunListBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<AppFunList> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(AppFunList::getId);
|
||||
lqw.eq(bo.getRoleid() != null, AppFunList::getRoleid, bo.getRoleid());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), AppFunList::getName, bo.getName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getIcon()), AppFunList::getIcon, bo.getIcon());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUrl()), AppFunList::getUrl, bo.getUrl());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP功能列表
|
||||
*
|
||||
* @param bo APP功能列表
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(AppFunListBo bo) {
|
||||
AppFunList add = MapstructUtils.convert(bo, AppFunList.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP功能列表
|
||||
*
|
||||
* @param bo APP功能列表
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(AppFunListBo bo) {
|
||||
AppFunList update = MapstructUtils.convert(bo, AppFunList.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(AppFunList entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除APP功能列表信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.system.mapper.AppFunListMapper">
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user