新疆后端项目
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?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>
|
||||
<artifactId>jeecg-system-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-system-cloud-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- feign -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<!-- 控制openfeign中bcpkix依赖的版本 -->
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk18on</artifactId>
|
||||
</dependency>
|
||||
<!-- 阿里语音 -->
|
||||
<!-- async-http-client -->
|
||||
<dependency>
|
||||
<groupId>org.asynchttpclient</groupId>
|
||||
<artifactId>async-http-client</artifactId>
|
||||
<version>2.12.3</version>
|
||||
</dependency>
|
||||
<!-- nls-sdk-common -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nls</groupId>
|
||||
<artifactId>nls-sdk-common</artifactId>
|
||||
<version>2.2.10</version>
|
||||
</dependency>
|
||||
<!-- jsoup替换文字含html标签 -->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.16.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>2.2.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package org.jeecg.bean.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecg.bean.enums.UserDataSourceEnum;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author feng
|
||||
* @Date: 2025-01-09
|
||||
* @Description: 用户三围记录表
|
||||
*/
|
||||
@Schema(description = "用户数据记录表三围记录")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "user_data_record_bwh")
|
||||
public class UserDataRecordBWH implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键ID")
|
||||
private String id;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID")
|
||||
private String userId;
|
||||
/**
|
||||
* 胸围(cm)
|
||||
*/
|
||||
@Schema(description = "胸围")
|
||||
private Double bust;
|
||||
/**
|
||||
* 腰围(cm)
|
||||
*/
|
||||
@Schema(description = "腰围(cm)")
|
||||
private Double waist;
|
||||
/**
|
||||
* 臀围(cm)
|
||||
*/
|
||||
@Schema(description = "臀围(cm)")
|
||||
private Double hip;
|
||||
/**
|
||||
* 腰臀比
|
||||
*/
|
||||
@Schema(description = "腰臀比")
|
||||
private Double waistHipRatio;
|
||||
/**
|
||||
* 数据来源(字典 data_source_dict)
|
||||
* @see UserDataSourceEnum 同枚举类
|
||||
*/
|
||||
@TableField(value = "data_source")
|
||||
@Schema(description = "数据来源(字典 data_source_dict)")
|
||||
@Dict(dicCode = "data_source_dict")
|
||||
private String dataSource;
|
||||
/**
|
||||
*创建人
|
||||
*/
|
||||
@Schema(title = "创建人")
|
||||
private String createBy;
|
||||
/**
|
||||
*创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(title = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private long secondDiffer;
|
||||
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
package org.jeecg.bean.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.bean.enums.UserDataSourceEnum;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jiang Shunzhi
|
||||
* 用户数据记录表BMI
|
||||
*/
|
||||
@Schema(description = "用户数据记录表BMI")
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "user_data_record_bmi")
|
||||
public class UserDataRecordBmi implements Serializable {
|
||||
public static final String COL_ID = "id";
|
||||
public static final String COL_USER_ID = "user_id";
|
||||
public static final String COL_HEIGHT = "height";
|
||||
public static final String COL_WEIGHT = "weight";
|
||||
public static final String COL_BMI = "bmi";
|
||||
public static final String COL_DATA_SOURCE = "data_source";
|
||||
public static final String COL_DATA_DATE = "data_date";
|
||||
public static final String COL_CREATE_TIME = "create_time";
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键ID")
|
||||
private String id;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
@Schema(description = "用户ID")
|
||||
private String userId;
|
||||
/**
|
||||
* 身高(cm)
|
||||
*/
|
||||
@TableField(value = "height")
|
||||
@Schema(description = "身高(cm)")
|
||||
private BigDecimal height;
|
||||
/**
|
||||
* 体重(kg)
|
||||
*/
|
||||
@TableField(value = "weight")
|
||||
@Schema(description = "体重(kg)")
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* BMI
|
||||
*/
|
||||
@TableField(value = "bmi")
|
||||
@Schema(description = "BMI")
|
||||
private BigDecimal bmi;
|
||||
/**
|
||||
* 体脂肪率(%)
|
||||
*/
|
||||
@TableField(value = "fat_rate")
|
||||
@Schema(description = "体脂肪率(%)")
|
||||
private BigDecimal fatRate;
|
||||
/**
|
||||
* 数据来源(字典 data_source_dict)
|
||||
* @see UserDataSourceEnum 同枚举类
|
||||
*/
|
||||
@TableField(value = "data_source")
|
||||
@Schema(description = "数据来源(字典 data_source_dict)")
|
||||
@Dict(dicCode = "data_source_dict")
|
||||
private String dataSource;
|
||||
/**
|
||||
* 数据日期
|
||||
*/
|
||||
@TableField(value = "data_date")
|
||||
@Schema(description = "数据日期")
|
||||
private Date dataDate;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> dataChannels;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Double waist;
|
||||
|
||||
public UserDataRecordBmi(String userId, UserDataSourceEnum sourceEnum) {
|
||||
this.userId = userId;
|
||||
this.dataSource = sourceEnum.source;
|
||||
this.createTime = new Date();
|
||||
}
|
||||
|
||||
public UserDataRecordBmi(String userId, Double height, Double weight, UserDataSourceEnum sourceEnum) {
|
||||
this.userId = userId;
|
||||
this.height = BigDecimal.valueOf(height);
|
||||
this.weight = BigDecimal.valueOf(weight);
|
||||
this.dataSource = sourceEnum.source;
|
||||
this.createTime = new Date();
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package org.jeecg.bean.enums;
|
||||
|
||||
/**
|
||||
* 用户体征数据来源枚举类
|
||||
*/
|
||||
public enum UserDataSourceEnum {
|
||||
MEDICAL("1", "体检报告"),
|
||||
SELF_MANUAL("2", "员工自行维护"),
|
||||
ADMIN_MANUAL("3", "管理员后台维护"),
|
||||
WEIGHING("4", "体重秤测量结果"),
|
||||
WATCH("5", "手表监测数据"),
|
||||
BLUETOOTH("6", "蓝牙秤测量结果"),
|
||||
BODY_FAT_ANALYZER("7", "体脂仪");
|
||||
|
||||
/**
|
||||
*数据来源
|
||||
*/
|
||||
public String source;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public String desc;
|
||||
|
||||
UserDataSourceEnum(String source, String desc) {
|
||||
this.source = source;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-06-02 14:57
|
||||
*/
|
||||
@Data
|
||||
public class ChangeDepartBatch {
|
||||
@NotEmpty(message = "数据为空")
|
||||
private List<String> ids;
|
||||
@NotBlank(message = "审核状态为空")
|
||||
private String status;
|
||||
/**
|
||||
* 审核批文
|
||||
*/
|
||||
private String reason;
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @author lianlonggang
|
||||
* @date 2021/5/19 15:40
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
public class EmpExcelVo {
|
||||
/**
|
||||
* 员工主键
|
||||
*/
|
||||
@Excel(name = "序号")
|
||||
private String rowIndex;
|
||||
@Excel(name = "姓名")
|
||||
private String name;
|
||||
@Excel(name = "工号")
|
||||
private String empSysNo;
|
||||
@Excel(name = "身份证号")
|
||||
private String idCard;
|
||||
@Excel(name = "手机号")
|
||||
private String mobile;
|
||||
@Excel(name = "二级单位")
|
||||
private String secondDepart;
|
||||
@Excel(name = "三级单位")
|
||||
private String thirdDepart;
|
||||
@Excel(name = "民族", dicCode = "nation")
|
||||
private String nation;
|
||||
@Excel(name = "合同类型", width = 15, dicCode = "contract")
|
||||
private String empType;
|
||||
@Excel(name = "职务级别", dicCode = "e_job")
|
||||
private String empJob;
|
||||
@Excel(name = "职业工种", dicCode = "work_type")
|
||||
private String getEmpWorkType;
|
||||
@Excel(name = "婚姻状况", width = 15, dicCode = "mr_state")
|
||||
private String empMarriage;
|
||||
@Excel(name = "家庭住址")
|
||||
private String liveSpace;
|
||||
@Excel(name = "邮箱")
|
||||
private String email;
|
||||
@Excel(name = "入职日期")
|
||||
private String empWorkTime;
|
||||
@Excel(name = "学历", width = 15, dicCode = "emp_education")
|
||||
private String empDegree;
|
||||
@Excel(name = "职称", width = 15, dicCode = "e_title")
|
||||
private String empTitle;
|
||||
@Excel(name = "test", width = 15)
|
||||
private String test;
|
||||
|
||||
public boolean check() {
|
||||
return StrUtil.isBlank(name)
|
||||
|| StrUtil.isBlank(empSysNo)
|
||||
|| StrUtil.isBlank(idCard)
|
||||
|| StrUtil.isBlank(mobile)
|
||||
|| StrUtil.isBlank(secondDepart)
|
||||
|| StrUtil.isBlank(thirdDepart)
|
||||
|| StrUtil.isBlank(nation)
|
||||
|| StrUtil.isBlank(empType)
|
||||
|| StrUtil.isBlank(empJob)
|
||||
|| StrUtil.isBlank(getEmpWorkType)
|
||||
|| StrUtil.isBlank(empMarriage);
|
||||
}
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HealthMealsWeightQueryVO {
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名")
|
||||
private String realName;
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
@Schema(description = "工号")
|
||||
private String workNo;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@Schema(description = "性别")
|
||||
private Integer sex;
|
||||
/**
|
||||
* 单位部门
|
||||
*/
|
||||
@Schema(description = "单位部门")
|
||||
private String orgCode;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@Schema(description = "身份证号")
|
||||
private String idCard;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@Schema(description = "年龄")
|
||||
private Integer age;
|
||||
private Integer currentYear;
|
||||
private Integer targetYear;
|
||||
/**
|
||||
* 年龄范围条件:'>', '<', '>=', '<=', '<>', '=', '!='
|
||||
*/
|
||||
@Schema(description = "年龄范围条件:'>', '<', '>=', '<=', '<>', '=', '!='")
|
||||
private String ageCondition;
|
||||
/**
|
||||
* 年龄范围参数b (当选择范围时使用)
|
||||
*/
|
||||
@Schema(description = "年龄范围参数b (当选择范围时使用)")
|
||||
private Integer ageB;
|
||||
/**
|
||||
* 体重
|
||||
*/
|
||||
@Schema(description = "体重")
|
||||
private Double weight;
|
||||
/**
|
||||
* 体重范围条件:'>', '<', '>=', '<=', '<>', '=', '!='
|
||||
*/
|
||||
@Schema(description = "体重范围条件:'>', '<', '>=', '<=', '<>', '=', '!='")
|
||||
private String weightCondition;
|
||||
/**
|
||||
* 体重范围参数b (当选择范围时使用)
|
||||
*/
|
||||
@Schema(description = "体重范围参数b (当选择范围时使用)")
|
||||
private Double weightB;
|
||||
/**
|
||||
* 身高
|
||||
*/
|
||||
@Schema(description = "身高")
|
||||
private Double height;
|
||||
/**
|
||||
* 身高范围条件:'>', '<', '>=', '<=', '<>', '=', '!='
|
||||
*/
|
||||
@Schema(description = "身高范围条件:'>', '<', '>=', '<=', '<>', '=', '!='")
|
||||
private String heightCondition;
|
||||
/**
|
||||
* 身高范围参数b (当选择范围时使用)
|
||||
*/
|
||||
@Schema(description = "身高范围参数b (当选择范围时使用)")
|
||||
private Double heightB;
|
||||
/**
|
||||
* bmi
|
||||
*/
|
||||
@Schema(description = "bmi")
|
||||
private Double bmi;
|
||||
/**
|
||||
* bmi范围条件:'>', '<', '>=', '<=', '<>', '=', '!='
|
||||
*/
|
||||
@Schema(description = "bmi范围条件:'>', '<', '>=', '<=', '<>', '=', '!='")
|
||||
private String bmiCondition;
|
||||
/**
|
||||
* bmi范围参数b (当选择范围时使用)
|
||||
*/
|
||||
@Schema(description = "bmi范围参数b (当选择范围时使用)")
|
||||
private Double bmiB;
|
||||
/**
|
||||
* 系统评价
|
||||
*/
|
||||
@Schema(title = "系统评价(0.偏瘦1.正常2.偏胖3.肥胖)")
|
||||
private Integer systemId;
|
||||
|
||||
|
||||
/**
|
||||
* 部门范围
|
||||
*/
|
||||
private List<String> orgCodeList;
|
||||
/**
|
||||
* 用户范围
|
||||
*/
|
||||
private List<String> userIdList;
|
||||
/**
|
||||
* 排除用户
|
||||
*/
|
||||
private List<String> excludedUserList;
|
||||
|
||||
private Integer pageNo;
|
||||
private Integer pageSize;
|
||||
|
||||
private Boolean isNotJoin=false;
|
||||
// 是否查询员工 默认查询员工
|
||||
private Boolean isSelectPersonType=true;
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-04-27 09:46
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ListUser {
|
||||
private List<String> userIds;
|
||||
|
||||
public ListUser(List<String> userIds) {
|
||||
this.userIds = userIds;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 心理评估 人员管理 请求参数
|
||||
*/
|
||||
@Data
|
||||
public class PeoplePsyAssessPlanVO {
|
||||
/**
|
||||
* 部门范围
|
||||
*/
|
||||
private List<String> orgCodeList;
|
||||
/**
|
||||
* 用户范围
|
||||
*/
|
||||
private List<String> userIdList;
|
||||
/**
|
||||
* 排除用户
|
||||
*/
|
||||
private List<String> excludedUserList;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String realName;
|
||||
/**
|
||||
* 单位部门code
|
||||
*/
|
||||
private String orgCode;
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
private String workNo;
|
||||
/**
|
||||
* 页码
|
||||
*/
|
||||
private Integer pageNo;
|
||||
/**
|
||||
* 每页条数
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author feng
|
||||
* @date 2024-06-26
|
||||
* @Description: 活动人数统计请求参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PeopleStatisticVO {
|
||||
/**
|
||||
* 活动ID 必传参数
|
||||
*/
|
||||
private Long activityId;
|
||||
|
||||
/**
|
||||
* 活动限制的单位或部门code 可选参数 (单位下全员可参与需传当前单位的code)
|
||||
*
|
||||
* ps: orgCodeList 和 userIdList 不能同时为空
|
||||
*/
|
||||
private List<String> orgCodeList;
|
||||
|
||||
/**
|
||||
* 活动限制的用户ID 可选参数
|
||||
*
|
||||
* ps: orgCodeList 和 userIdList 不能同时为空
|
||||
*/
|
||||
private List<String> userIdList;
|
||||
|
||||
public List<String> getOrgCodeList() {
|
||||
if(null == orgCodeList){
|
||||
orgCodeList = new ArrayList<>();
|
||||
}
|
||||
return orgCodeList;
|
||||
}
|
||||
|
||||
public List<String> getUserIdList() {
|
||||
if(null == userIdList){
|
||||
userIdList = new ArrayList<>();
|
||||
}
|
||||
return userIdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
PeopleStatisticVO that = (PeopleStatisticVO) o;
|
||||
return Objects.equals(activityId, that.activityId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(activityId);
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author feng
|
||||
* @date 2025-02-26
|
||||
* @Description: 查询用户当日打卡信息请求参数
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "查询用户当日打卡信息请求参数")
|
||||
public class QueryWeightSignUserParam {
|
||||
/**
|
||||
* PS: 传参建议 -- 若需查询的员工数量在 5000以下 可直接传参查指定用户,5000以上查所有然后在业务中筛选
|
||||
*/
|
||||
@Schema(title = "用户ID(不传则查近七天所有打卡用户)")
|
||||
private Set<String> userIds;
|
||||
|
||||
@Schema(title = "查询日期(yyyy-mm-dd),不传默认当天")
|
||||
private String dateStr;
|
||||
|
||||
@Schema(title = "是否需要查询最新身高体重数据")
|
||||
@Deprecated
|
||||
private boolean needLatestData;
|
||||
|
||||
public QueryWeightSignUserParam(Set<String> userIds, String dateStr, boolean needLatestData) {
|
||||
this.userIds = userIds;
|
||||
this.dateStr = dateStr;
|
||||
this.needLatestData = needLatestData;
|
||||
}
|
||||
|
||||
public QueryWeightSignUserParam(){}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author stan
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserBodyInfoDto {
|
||||
// 用户id
|
||||
private String userId;
|
||||
// 身高 (cm)
|
||||
private BigDecimal height;
|
||||
// 体重 (kg)
|
||||
private BigDecimal weight;
|
||||
// 腰围 (cm)
|
||||
private Double waist;
|
||||
// 臀围 (cm)
|
||||
private Double hip;
|
||||
// 胸围 (cm)
|
||||
private Double bust;
|
||||
// 体脂
|
||||
private BigDecimal fatRate;
|
||||
//还应减 仅适用于蚁熊版本的体重打卡业务
|
||||
private Double needLossValue;
|
||||
//已减 仅适用于蚁熊版本的体重打卡业务
|
||||
private Double lostValue;
|
||||
//业务类型 1-移动端档案 ,2-后台档案,3-体重打卡,4-体脂打卡,5-腰围打卡
|
||||
private Integer type = 3;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @since 2024-05-23 14:48
|
||||
*/
|
||||
@Data
|
||||
public class UserClient {
|
||||
// 用户id
|
||||
private String userId;
|
||||
// 是否青海员工
|
||||
private boolean qh;
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author Shunzhi Jiang
|
||||
* @since 2023/5/22
|
||||
*/
|
||||
@Data
|
||||
public class UserFilter {
|
||||
|
||||
private String username;
|
||||
|
||||
private String realname;
|
||||
|
||||
private String empNo;
|
||||
|
||||
private String idCord;
|
||||
|
||||
private String orgCode;
|
||||
|
||||
private String threeOrgCode;
|
||||
|
||||
private List<String> idList;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String workNo;
|
||||
|
||||
private Boolean selectFamily;
|
||||
|
||||
private List<String> orgCodes;
|
||||
|
||||
private List<String> workNoList;
|
||||
|
||||
/**
|
||||
* 需要过滤掉的userId集合
|
||||
*
|
||||
* PS: 部分业务需要加载员工列表,但同时需要排除掉部分的用户
|
||||
*/
|
||||
private List<String> excludeUserIds;
|
||||
|
||||
private Integer pageNo;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
public Integer getPageNo() {
|
||||
if(ObjectUtil.isEmpty(pageNo)){
|
||||
return 1;
|
||||
}
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
if(ObjectUtil.isEmpty(pageSize)){
|
||||
return 10;
|
||||
}
|
||||
return pageSize;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package org.jeecg.bean.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author TianZi
|
||||
* @date 2023/11/22 13:48
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class WatchUser {
|
||||
private String secondOrgCode;
|
||||
private String thirdOrgCode;
|
||||
private String orgCode;
|
||||
private String workNo;
|
||||
private String realName;
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.common.desensitization.annotation.SensitiveField;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
@Schema(title = "员工基本信息", description = "员工基本信息(供其他业务服务补全员工信息使用)")
|
||||
public class BaseEmployeeInfo {
|
||||
@Schema(title = "员工ID")
|
||||
private String userId;
|
||||
|
||||
@Schema(title = "用户名")
|
||||
private String userName;
|
||||
|
||||
@Schema(title = "员工姓名")
|
||||
private String realName;
|
||||
|
||||
@Schema(title = "员工编号")
|
||||
private String workNo;
|
||||
|
||||
@Schema(title = "身份证号")
|
||||
private String idCard;
|
||||
|
||||
@Schema(title = "头像")
|
||||
private String avatar;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(title = "生日")
|
||||
private Date birthday;
|
||||
|
||||
@SensitiveField
|
||||
@Schema(title = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(title = "电话")
|
||||
private String phone;
|
||||
|
||||
@Schema(title = "年龄")
|
||||
private Integer age;
|
||||
|
||||
@Schema(title = "性别")
|
||||
@Dict(dicCode = "sex2")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(title = "身高")
|
||||
private String height;
|
||||
|
||||
@Schema(title = "体重")
|
||||
private String weight;
|
||||
|
||||
@Schema(title = "BMI")
|
||||
private Double bmi;
|
||||
|
||||
@Schema(title = "员工民族")
|
||||
private String empNation;
|
||||
|
||||
@Schema(title = "员工政治面貌")
|
||||
private String empPolitical;
|
||||
|
||||
@Schema(title = "岗位层级")
|
||||
private String jobLevel;
|
||||
|
||||
@Schema(title = "婚姻状况")
|
||||
private String empMarriage;
|
||||
|
||||
@Schema(title = "用户人群分类")
|
||||
private String userGroup;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*以下6个部门信息都有值, 业务中根据需要自取
|
||||
*/
|
||||
@Schema(title = "二级部门Code(单位)")
|
||||
private String secondDeptCode;
|
||||
|
||||
@Schema(title = "二级部门名称(单位)")
|
||||
private String secondDeptName;
|
||||
|
||||
@Schema(title = "三级部门Code(部门)")
|
||||
private String thirdDeptCode;
|
||||
|
||||
@Schema(title = "三级部门名称(部门)")
|
||||
private String thirdDeptName;
|
||||
|
||||
@Schema(title = "当前部门Code(用户所属部门)")
|
||||
private String thisDeptCode;
|
||||
|
||||
@Schema(title = "当前部门名称(用户所属部门)")
|
||||
private String thisDeptName;
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-07-12 10:40
|
||||
*/
|
||||
@Data
|
||||
public class BaseUser {
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String realName;
|
||||
private String workNo;
|
||||
private String idCard;
|
||||
private String personType;
|
||||
private String secondDepart;
|
||||
private String orgCode;
|
||||
private String orgName;
|
||||
private String departId;
|
||||
private String departCode;
|
||||
private String departName;
|
||||
private String depart;
|
||||
private String status;
|
||||
private Integer age;
|
||||
private void setIdCard(String idCard) {
|
||||
if (StrUtil.isEmpty(idCard)) {
|
||||
return;
|
||||
}
|
||||
// 去除身份证号中的空格
|
||||
idCard = idCard.replace(" ", "");
|
||||
this.idCard = idCard;
|
||||
this.age = IdcardUtil.getAgeByIdCard(idCard);
|
||||
}
|
||||
private Integer sex;
|
||||
private String height;
|
||||
private String weight;
|
||||
private Double bmi;
|
||||
|
||||
public void calculateBmi(Double bmi) {
|
||||
if (bmi == null) {
|
||||
if (StrUtil.isBlank(this.height) || StrUtil.isBlank(this.weight)){
|
||||
return;
|
||||
}
|
||||
// 将身高从厘米转换为米
|
||||
double height = Double.parseDouble(this.height) / 100.0;
|
||||
double weight = Double.parseDouble(this.weight);
|
||||
bmi = weight / (height * height);
|
||||
}
|
||||
this.bmi = new BigDecimal(bmi).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2024-03-01 13:47
|
||||
*/
|
||||
@Data
|
||||
public class CheckExistUserRes {
|
||||
private String account;
|
||||
private Integer count;
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(title = "员工身高体重(前期只同步体重, 后期又加了其他的体征信息,不要在意类名的定义)")
|
||||
public class EmployeeHeightWeight {
|
||||
@Schema(title = "用户标识(ID或身份证号)")
|
||||
private String userFlag;
|
||||
|
||||
@Schema(title = "身高")
|
||||
private String height;
|
||||
|
||||
@Schema(title = "体重")
|
||||
private String weight;
|
||||
|
||||
@Schema(title = "体脂率")
|
||||
private String fatRate;
|
||||
|
||||
@Schema(description = "最新体重的数据来源(字典 data_source_dict)")
|
||||
@Dict(dicCode = "data_source_dict")
|
||||
private String dataSource;
|
||||
|
||||
@Schema(title = "最新体检体重")
|
||||
private String weightCheckLatest;
|
||||
|
||||
/**
|
||||
* 该字段只在部分查询接口使用, 若要使用自行赋值
|
||||
*/
|
||||
@Schema(title = "BMI")
|
||||
private String bmi;
|
||||
|
||||
@Schema(description = "舒张压")
|
||||
private String dbp;
|
||||
|
||||
@Schema(description = "收缩压")
|
||||
private String sbp;
|
||||
|
||||
@Schema(description = "血型")
|
||||
private String blood;
|
||||
|
||||
@Schema(description = "腰围(cm)")
|
||||
private String waist;
|
||||
|
||||
@Schema(description = "臀围(cm)")
|
||||
private String hip;
|
||||
|
||||
@Schema(description = "日期")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date dataDate;
|
||||
|
||||
public EmployeeHeightWeight(String userFlag) {
|
||||
this.userFlag = userFlag;
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.global.GlobalUtils;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(title="用户家庭成员", description="用户家庭成员")
|
||||
public class FamilyMembersVO {
|
||||
@Schema(title = "主键")
|
||||
private String id;
|
||||
|
||||
@Schema(title = "用户ID")
|
||||
private String userId;
|
||||
|
||||
@Schema(title = "是否为本单位员工(0-否,1-是)")
|
||||
private Integer orgUserFlag;
|
||||
|
||||
@Schema(title = "家庭成员用户ID")
|
||||
private String familyMembersId;
|
||||
|
||||
@Schema(title = "成员关系")
|
||||
private String relation;
|
||||
|
||||
@Schema(title = "姓名")
|
||||
private String realName;
|
||||
|
||||
@Schema(title = "头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(title = "身份证号")
|
||||
private String idCard;
|
||||
|
||||
@Schema(title = "年龄")
|
||||
private Integer age = 0;
|
||||
|
||||
@Dict(dicCode = "sex2")
|
||||
@Schema(title = "性别")
|
||||
private Integer sex;
|
||||
|
||||
@Schema(title = "电话")
|
||||
private String phone;
|
||||
|
||||
@Schema(title = "工号")
|
||||
private String workNo;
|
||||
|
||||
@Schema(title = "员工账号")
|
||||
private String userName;
|
||||
|
||||
@Schema(title = "所属单位")
|
||||
private String orgCode;
|
||||
|
||||
@Schema(title = "所属单位code")
|
||||
private String orgName;
|
||||
|
||||
@Schema(title = "所属部门code")
|
||||
private String deptCode;
|
||||
|
||||
@Schema(title = "所属部门")
|
||||
private String deptName;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(title = "创建时间")
|
||||
private Date createDate;
|
||||
|
||||
@Schema(title = "家庭成员数量")
|
||||
private Integer familyMembersNum = 1;
|
||||
|
||||
@Schema(title = "是否本人")
|
||||
private Boolean isSelf = false;
|
||||
|
||||
public Integer getAge() {
|
||||
if(StrUtil.isNotEmpty(idCard)){
|
||||
return GlobalUtils.getAgeByIdCard(idCard);
|
||||
}
|
||||
return age;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-04-24 16:50
|
||||
*/
|
||||
@Data
|
||||
public class KeyList<T, R> {
|
||||
private T key;
|
||||
private List<R> list;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@Data
|
||||
public class ResponseVo {
|
||||
|
||||
private Integer stateCode;
|
||||
|
||||
private InputStream in;
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 职务表VO(结构完全等同于于 sys_position表对应的实体类SysPosition) 只为迁移23年干预中的接口至四合一
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "SysPositionVO", description = "职务表VO")
|
||||
public class SysPositionVO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Schema(title = "id")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long id;
|
||||
/**
|
||||
* 职务编码
|
||||
*/
|
||||
@Schema(title = "职务编码")
|
||||
private String code;
|
||||
/**
|
||||
* 职务名称
|
||||
*/
|
||||
@Schema(title = "职务名称")
|
||||
private String name;
|
||||
/**
|
||||
* 职级
|
||||
*/
|
||||
@Schema(title = "职级")
|
||||
@Dict(dicCode = "position_rank")
|
||||
private String postRank;
|
||||
/**
|
||||
* 公司id
|
||||
*/
|
||||
@Schema(title = "公司id")
|
||||
private String companyId;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(title = "创建人")
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(title = "创建时间")
|
||||
private java.util.Date createTime;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Schema(title = "修改人")
|
||||
private String updateBy;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(title = "修改时间")
|
||||
private java.util.Date updateTime;
|
||||
/**
|
||||
* 组织机构编码
|
||||
*/
|
||||
@Schema(title = "组织机构编码")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(title = "租户ID")
|
||||
private Integer tenantId;
|
||||
/**
|
||||
* 岗位类别
|
||||
*/
|
||||
@Dict(dicCode = "post_type")
|
||||
private Integer postType;
|
||||
|
||||
/**
|
||||
* 单位类别
|
||||
*/
|
||||
@Dict(dicCode = "org_type")
|
||||
private Integer orgType;
|
||||
|
||||
/**
|
||||
* 岗位简介
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecg.bean.entity.UserDataRecordBmi;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author feng
|
||||
* @date 2025-03-05
|
||||
* @Description: 用户每天的最新体重
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(title = "用户每天的最新体重")
|
||||
public class WeightHeightDayVO {
|
||||
@Schema(title = "用户ID")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "日期(yyyy-MM-dd)")
|
||||
private String dateStr;
|
||||
|
||||
@Schema(title = "当天最新体重")
|
||||
private BigDecimal weight;
|
||||
|
||||
@Schema(title = "当天最新身高")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(title = "当天最新BMI")
|
||||
private BigDecimal bmi;
|
||||
|
||||
@Schema(title = "体脂率")
|
||||
private BigDecimal fatRate;
|
||||
|
||||
@Schema(title = "腰围")
|
||||
private Double waist;
|
||||
|
||||
@Schema(title = "体重数据来源")
|
||||
@Dict(dicCode = "data_source_dict")
|
||||
private String dataSource;
|
||||
|
||||
@Schema(title = "当天体重数据所有来源")
|
||||
private List<String> dataChannels;
|
||||
|
||||
public WeightHeightDayVO(UserDataRecordBmi userDataRecordBmi) {
|
||||
this.userId = userDataRecordBmi.getUserId();
|
||||
this.dateStr = DateUtil.formatDate(userDataRecordBmi.getDataDate());
|
||||
this.weight = userDataRecordBmi.getWeight();
|
||||
this.height = userDataRecordBmi.getHeight();
|
||||
this.bmi = userDataRecordBmi.getBmi();
|
||||
this.fatRate = userDataRecordBmi.getFatRate();
|
||||
this.dataChannels = userDataRecordBmi.getDataChannels();
|
||||
this.dataSource = userDataRecordBmi.getDataSource();
|
||||
}
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecg.bean.entity.UserDataRecordBmi;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.common.util.HealthUtil;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author feng
|
||||
* @date 2025-02-26
|
||||
* @Description: 用户当日打卡信息
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(title = "用户当日打卡信息")
|
||||
public class WeightSignUserVO {
|
||||
@Schema(title = "用户ID")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* PS: 判断是否体重打卡以改字段为准
|
||||
*/
|
||||
@Schema(title = "是否体重打卡(七天内有打卡数据则认为是当日已打卡)")
|
||||
private Boolean signFlag = false;
|
||||
|
||||
/** 以下四个字段 当signFlag=true时有值 代表传入日期当天最新的打卡数据 */
|
||||
@Schema(description = "最新打卡时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date dataDate;
|
||||
|
||||
@Schema(title = "最新体重")
|
||||
private String weight;
|
||||
|
||||
@Schema(title = "最新身高")
|
||||
private String height;
|
||||
|
||||
@Schema(title = "最新BMI")
|
||||
private String bmi;
|
||||
|
||||
@Schema(title = "体脂率")
|
||||
private String fatRate;
|
||||
|
||||
@Schema(title = "腰围")
|
||||
private String waist;
|
||||
|
||||
@Schema(title = "最新体重的数据来源")
|
||||
@Dict(dicCode = "data_source_dict")
|
||||
private String dataSource;
|
||||
/**
|
||||
* 当天存在的所有体重的数据来源
|
||||
*/
|
||||
@Schema(title = "当天所有的数据来源(字典data_source_dict值使用,分割)")
|
||||
private String weightDataSource;
|
||||
|
||||
private Long signCount = 0L;
|
||||
|
||||
public Boolean getSignFlag() {
|
||||
return signCount > 0;
|
||||
}
|
||||
|
||||
public Boolean isSignFlag() {
|
||||
return signCount > 0;
|
||||
}
|
||||
|
||||
public WeightSignUserVO(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public void completionWeightInfo(UserDataRecordBmi userDataRecordBmi) {
|
||||
if(null != userDataRecordBmi){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public WeightSignUserVO(List<UserDataRecordBmi> bmiList,EmployeeHeightWeight bwh) {
|
||||
bmiList.sort(Comparator.comparing(UserDataRecordBmi::getDataDate).reversed());
|
||||
UserDataRecordBmi userDataRecordBmi = bmiList.get(0);
|
||||
if(null != userDataRecordBmi.getWeight()){
|
||||
this.weight = String.valueOf(userDataRecordBmi.getWeight());
|
||||
}
|
||||
if(null != userDataRecordBmi.getHeight()){
|
||||
this.height = String.valueOf(userDataRecordBmi.getHeight());
|
||||
}
|
||||
if(null != userDataRecordBmi.getBmi()){
|
||||
this.bmi = String.valueOf(userDataRecordBmi.getBmi());
|
||||
}
|
||||
bmiList.stream()
|
||||
.filter(bmi -> null != bmi.getFatRate())
|
||||
.findFirst()
|
||||
.ifPresent(bmi -> this.fatRate = String.valueOf(bmi.getFatRate()));
|
||||
this.dataSource = userDataRecordBmi.getDataSource();
|
||||
this.dataDate = userDataRecordBmi.getDataDate();
|
||||
this.userId = userDataRecordBmi.getUserId();
|
||||
this.weightDataSource = bmiList.stream().map(UserDataRecordBmi::getDataSource).distinct().collect(Collectors.joining(","));
|
||||
this.signCount = (long) bmiList.size();
|
||||
if(null != bwh){
|
||||
this.waist = bwh.getWaist();
|
||||
}
|
||||
}
|
||||
|
||||
public WeightSignUserVO(List<UserDataRecordBmi> bmiList, String waist) {
|
||||
UserDataRecordBmi weightRecord = bmiList.stream()
|
||||
.filter(f -> f.getWeight() != null)
|
||||
.sorted(Comparator.comparing(UserDataRecordBmi::getWeight))
|
||||
.limit(1)
|
||||
.findFirst()
|
||||
.orElse(new UserDataRecordBmi());
|
||||
this.weight = String.valueOf(weightRecord.getWeight());
|
||||
|
||||
UserDataRecordBmi heightRecord = bmiList.stream()
|
||||
.filter(f -> f.getHeight() != null)
|
||||
.sorted(Comparator.comparing(UserDataRecordBmi::getHeight))
|
||||
.limit(1)
|
||||
.findFirst()
|
||||
.orElse(new UserDataRecordBmi());
|
||||
this.height = String.valueOf(heightRecord.getHeight());
|
||||
|
||||
UserDataRecordBmi fatRecord = bmiList.stream()
|
||||
.filter(f -> f.getFatRate() != null)
|
||||
.sorted(Comparator.comparing(UserDataRecordBmi::getFatRate))
|
||||
.limit(1)
|
||||
.findFirst()
|
||||
.orElse(new UserDataRecordBmi());
|
||||
this.fatRate = String.valueOf(fatRecord.getFatRate());
|
||||
|
||||
if (weightRecord.getWeight() != null && heightRecord.getHeight() != null) {
|
||||
Double result = HealthUtil.computeBmi(new BigDecimal(height), new BigDecimal(weight));
|
||||
if (result != null) {
|
||||
this.bmi = result.toString();
|
||||
}
|
||||
}
|
||||
this.dataSource = weightRecord.getDataSource();
|
||||
this.dataDate = weightRecord.getDataDate();
|
||||
this.userId = weightRecord.getUserId();
|
||||
this.weightDataSource = bmiList.stream().map(UserDataRecordBmi::getDataSource).distinct().collect(Collectors.joining(","));
|
||||
this.signCount = (long) bmiList.size();
|
||||
this.waist = waist;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package org.jeecg.bean.response;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WeightStatisticsVO {
|
||||
@Schema(title = "姓名")
|
||||
private String realName;
|
||||
|
||||
@Schema(title = "性别")
|
||||
private String sex;
|
||||
|
||||
@Schema(title = "女性数量")
|
||||
private Integer womanCount;
|
||||
|
||||
@Schema(title = "男性性数量")
|
||||
private Integer manCount;
|
||||
|
||||
@Schema(title = "年龄")
|
||||
private Double age;
|
||||
|
||||
@Schema(title = "工号")
|
||||
private String workNo;
|
||||
|
||||
@Schema(title = "人均bmi")
|
||||
private Double bmiAvg;
|
||||
|
||||
@Schema(title = "所属单位")
|
||||
private String departName;
|
||||
|
||||
@Schema(title = "所属部门")
|
||||
private String orgName;
|
||||
|
||||
@Schema(title = "身高(cm)")
|
||||
private Double height;
|
||||
public void setHeight(Double height) {
|
||||
this.height = height == null? null : Math.round(height * 100) / 100.0;
|
||||
}
|
||||
|
||||
@Schema(title = "体重(kg)")
|
||||
private Double weight;
|
||||
public void setWeight(Double weight) {
|
||||
this.weight = weight == null? null : Math.round(weight * 100) / 100.0;
|
||||
}
|
||||
|
||||
@Schema(title = "bmi")
|
||||
private Double bmi;
|
||||
public void setBmi(Double bmi) {
|
||||
this.bmi = bmi == null? null : Math.round(bmi * 100) / 100.0;
|
||||
}
|
||||
}
|
||||
+1346
File diff suppressed because it is too large
Load Diff
+21
@@ -0,0 +1,21 @@
|
||||
package org.jeecg.common.system.api.factory;
|
||||
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.api.fallback.SysBaseAPIFallback;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Description: SysBaseAPIFallbackFactory
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@Component
|
||||
public class SysBaseAPIFallbackFactory implements FallbackFactory<ISysBaseAPI> {
|
||||
|
||||
@Override
|
||||
public ISysBaseAPI create(Throwable throwable) {
|
||||
SysBaseAPIFallback fallback = new SysBaseAPIFallback();
|
||||
fallback.setCause(throwable);
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package org.jeecg.common.system.api.fallback;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.modules.imports.entity.CommonImports;
|
||||
import org.jeecg.modules.imports.entity.CommonImportsDetail;
|
||||
import org.jeecg.modules.imports.service.CommonImportsOption;
|
||||
import org.jeecg.modules.imports.service.ICommonImportsDetailService;
|
||||
import org.jeecg.modules.imports.service.ICommonImportsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service("commonImportsOptionCloud")
|
||||
@Primary
|
||||
public class CommonImportsOptionImpl implements CommonImportsOption {
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Override
|
||||
public void save(CommonImports commonImports) {
|
||||
CommonImports comm = sysBaseAPI.updateImportsInfo(commonImports);
|
||||
commonImports.setId(comm.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(CommonImports commonImports) {
|
||||
sysBaseAPI.updateImportsInfo(commonImports);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDetailBatch(List<CommonImportsDetail> detailList) {
|
||||
if(!CollectionUtils.isEmpty(detailList)){
|
||||
for(CommonImportsDetail detail:detailList){
|
||||
sysBaseAPI.editImportsDetail(detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDetail(CommonImportsDetail detail) {
|
||||
sysBaseAPI.editImportsDetail(detail);
|
||||
}
|
||||
}
|
||||
+895
@@ -0,0 +1,895 @@
|
||||
package org.jeecg.common.system.api.fallback;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.bean.entity.UserDataRecordBmi;
|
||||
import org.jeecg.bean.request.*;
|
||||
import org.jeecg.bean.response.*;
|
||||
import org.jeecg.common.api.dto.DataLogDTO;
|
||||
import org.jeecg.common.api.dto.OnlineAuthDTO;
|
||||
import org.jeecg.common.api.dto.message.*;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.bean.request.SendSmsReq;
|
||||
import org.jeecg.common.bean.response.BaseUserGroup;
|
||||
import org.jeecg.common.bean.response.NotSignType;
|
||||
import org.jeecg.common.bean.transfer.GroupCount;
|
||||
import org.jeecg.common.bean.transfer.UserWeightSign;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.vo.*;
|
||||
import org.jeecg.modules.exports.entity.CommonExportsInfo;
|
||||
import org.jeecg.modules.imports.entity.CommonImports;
|
||||
import org.jeecg.modules.imports.entity.CommonImportsDetail;
|
||||
import org.jeecg.modules.imports.entity.CommonImportsInfo;
|
||||
import org.jeecg.modules.system.bean.UserEmployee;
|
||||
import org.jeecg.modules.system.entity.HealthUserEmployeeEx;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.entity.SysUserEmergencyContact;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 进入fallback的方法 检查是否token未设置
|
||||
*
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@Slf4j
|
||||
public class SysBaseAPIFallback implements ISysBaseAPI {
|
||||
|
||||
@Setter
|
||||
private Throwable cause;
|
||||
|
||||
//@Override
|
||||
//public List<SysDepartModel> listDepart(List<String> stringList,String type) {
|
||||
// return Collections.emptyList();
|
||||
//}
|
||||
|
||||
@Override
|
||||
public Boolean saveInfoList(List<CommonImportsInfo> list) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRoleIdsByUserId(String userId) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findSysUserIds(SysUser user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PostMapping("/sys/common/commonExportsInfo/editInfo")
|
||||
@Override
|
||||
public CommonExportsInfo updateExportsInfo(CommonExportsInfo info) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonExportsInfo getExportsInfoById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getFinishFlagByCode(String code, String exportStatus) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getFinishFlagByCodeInAll(String code, String exportStatus) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonImports updateImportsInfo(CommonImports info) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonImports getImportsInfoById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getImportsFinishFlagByCode(String code, String importStatus) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editImportsDetail(CommonImportsDetail detail) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveImportsDetailList(List<CommonImportsDetail> detailList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonImportsDetail getImportsDetailById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonImportsDetail> getImportsDetailListByInfoId(String infoId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoginUserNew> listUserByIds(ListUser listUser) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoginUser> listUserByIdsNew(List<String> userIds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseEmployeeInfo> queryBaseEmployeeInfo(Set<String> ids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseEmployeeInfo> queryBaseEmployeeInfoByCondition(HealthUserEmployeeEx healthUserEmployeeEx) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseEmployeeInfo> queryBaseEmployeeInfoSimple(Set<String> ids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoginUserNew> listUserByIdsClient(List<UserClient> list) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoginUser> listUserByIdCards(List<String> idCards) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoginUser> listUserByIdCardsPost(List<String> idCards) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HealthUserEmployeeEx> listEmployeeUserByIds(ListUser listUser) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHoliday(Integer year, Integer month, Integer day) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KeyList<Integer, Integer>> holidayList(Integer year, Integer month) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSysAnnouncement(MessageDTO message) {
|
||||
log.error("发送消息失败 {}", cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBusAnnouncement(BusMessageDTO message) {
|
||||
log.error("发送消息失败 {}", cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTemplateAnnouncement(TemplateMessageDTO message) {
|
||||
log.error("发送消息失败 {}", cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBusTemplateAnnouncement(BusTemplateMessageDTO message) {
|
||||
log.error("发送消息失败 {}", cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parseTemplateByCode(TemplateDTO templateDTO) {
|
||||
log.error("通过模板获取消息内容失败 {}", cause);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginUser getUserById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRolesByUsername(String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDepartIdsByUsername(String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDepartNamesByUsername(String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryDictItemsByCode(String code) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryEnableDictItemsByCode(String code) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryAllDict() {
|
||||
log.error("fegin接口queryAllDict失败:" + cause.getMessage(), cause);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysCategoryModel> queryAllSysCategory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryTableDictItemsByCode(String table, String text, String code) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryAllDepartBackDictModel() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSysAnnounReadFlag(String busType, String busId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> queryFilterTableDictInfo(String table, String text, String code, String filterSql) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray) {
|
||||
log.error("queryTableDictByKeys查询失败 {}", cause);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComboModel> queryAllUserBackCombo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryAllUser(String userIds, Integer pageNo, int pageSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComboModel> queryAllRole(String[] roleIds) {
|
||||
log.error("获取角色信息失败 {}", cause);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRoleIdsByUsername(String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDepartIdsByOrgCode(String orgCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysDepartModel> getAllSysDepart() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictModel getParentDepartId(String departId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDeptHeadByDepId(String deptId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendWebSocketMsg(String[] userIds, String cmd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoginUser> queryAllUserByIds(String[] userIds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void meetingSignWebsocket(String userId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoginUser> queryUserByNames(String[] userNames) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getUserRoleSet(String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getUserPermissionSet(String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOnlineAuth(OnlineAuthDTO onlineAuthDTO) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysDepartModel selectAllById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> queryDeptUsersByUserId(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> queryUserRoles(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> queryUserAuths(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicDataSourceModel getDynamicDbSourceById(String dbSourceId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicDataSourceModel getDynamicDbSourceByCode(String dbSourceCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginUser getUserByName(String username) {
|
||||
log.error("jeecg-system服务节点不通,导致获取登录用户信息失败: " + cause.getMessage(), cause);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String translateDictFromTable(String table, String text, String code, String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String translateDict(String code, String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysPermissionDataRuleModel> queryPermissionDataRule(String component, String requestPath, String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserCacheInfo getCacheUser(String id) {
|
||||
log.error("获取用户信息失败 {}", cause);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryUsersByUsernames(String usernames) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryUsersByIds(String ids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryDepartsByOrgcodes(String orgCodes) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> queryDepartNameByOrgCodes(Set<String> orgCodeSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryDepartsByIds(String ids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTemplateMessage(MessageDTO message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBusSms(BusTemplateMessageDTO message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateContent(String code) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDataLog(DataLogDTO dataLogDto) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendEmailMsg(String email, String title, String content) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getDeptUserByOrgCode(String orgCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<JSONObject> queryDepartsByOrgIds(String ids) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<String> loadCategoryDictItem(String ids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> loadDictItem(String dictCode, String keys) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> getDictItems(String dictCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<DictModel>> getManyDictItems(List<String> dictCodeList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictModel> loadDictItemByKeyword(String dictCode, String keyword, Integer pageSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addSysFiles(SysFilesModel sysFilesModel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileUrl(String fileId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAvatar(LoginUser loginUser) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendAppChatSocket(String userId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> updatePassword(JSONObject json) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> loginDoctor(JSONObject json) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping("/sys/api/selectEmergencyContactByUserId")
|
||||
@Override
|
||||
public List<SysUserEmergencyContact> selectEmergencyContactByUserId(String userId) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/sys/api/station/selectStationHospitalList")
|
||||
@Override
|
||||
public List<String> selectStationHospitalList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserEmployee selectEmployeeUser(String userId) {
|
||||
return new UserEmployee();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> userListByPhone(String phone) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser queryUserByCardId(String cardId) {
|
||||
return new SysUser();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser addMedicalStaff(SysUserModel sysUser) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateUserInfo(SysUserModel user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delUser(List<String> userIds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer chageUserPersonType(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUserIdsByDepartAndUsername(String departCode, String username, String idCard, String workNo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Object> getUserNumByOrgCode(String orgCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Map<String, Integer>> getUserNumByOrgCodeList(List<String> orgCodeList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, Long> activityPeopleNumber(Set<PeopleStatisticVO> peopleStatisticVOS) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<String>> getUserIdsByOrgCodeList(List<String> orgCodeList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> getUserByIdCardList(ListUser listUser) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<SysDepartTreeModel>> queryDepartTreeSync(String parentId, String ids, String primaryKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> selectOrgCodeById(String userIds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<SysDepartModel>> allSecondaryDeparts() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<SysDepartModel>> getThirdDepartListBySecondDepartId(String secondDepartId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysDepartModel> selectSecondThirdDepart() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysDepart> selectDepartByDepartIds(String departId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectUserTotal() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> checkExistUser(String existUserId, String userName, String mobile, String idCard) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SysUser> pageUser(SysUser user, Integer pageNo, Integer pageSize, List<String> managerCodes) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Page<UserEmployee>> feignQueryPageList(String realname, String idCord, String orgCode, String threeOrgCode, Integer sex, String workNo, Integer pageNo, Integer pageSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Page<UserEmployee>> getUserListByOrgCodeList(String realname,String orgCode,String workNo,List<String> orgCodeList,List<String> userIdList, Integer pageNo, Integer pageSize) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Map<String, String> queryUserIdByCardNo(Set<String> cardNoSet) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Map<String,String> queryCardNoByUserIds(@RequestBody Set<String> userIds){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectUserExistByUserName(String id, String userName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> userIdsByGroup(List<String> groups) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> allThirdDepartCodes() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping("/sys/api/addUserToEx")
|
||||
public String addUserToEx(SysUserModel sysUserModel) {
|
||||
return new String();
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping("/sys/api/updateUserToEx")
|
||||
public String updateUserToEx(SysUserModel sysUserModel) {
|
||||
return new String();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteUserById(String userId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectUserIdNoById(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SysDepartGps selectDepartGpsByDepartId(String departId) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Result<List<SysPositionVO>> queryPositionList(List<Long> ids) {
|
||||
return new Result<>();
|
||||
}
|
||||
@Override
|
||||
public List<SysPositionVO> getAllPosition(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> addUserTogether(SysUserModel sysUserModel) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> updateUserInfoTogether(SysUserModel sysUserModel) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<SysUser>> selectUserByRoleCode(String roleCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser queryById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysPositionVO getPositionByUserId(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysPositionVO> getPositionByUnitsId(Integer unitsId, Integer postId, String postName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<BaseUser>> queryAdminByOrgCode(String orgCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Page<UserEmployee>> listUserBackByFeign(UserFilter userFilter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Page<BaseUser>> peoplePsyAssessPlanUser(PeoplePsyAssessPlanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Long> peoplePsyAssessPlanUserNum(PeoplePsyAssessPlanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<SysUser>> getUserByPhoneList(List<String> phoneList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<String>> getPhonesByNameOrOrgCode(String realName, String orgCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<String>> getPhonesByNameOrOrgCodeOrSex(String realName, String orgCode,Integer sex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Map<String, Long>> getGroupByOrgCodeList(List<String> orgCodeList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Void> updateUserHeightWeight(List<EmployeeHeightWeight> employeeHeightWeights) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Map<String, Double>> getBmiByUserList(List<String> userIds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Page<BaseUser>> getUsersByMealsWeight(HealthMealsWeightQueryVO queryVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<WeightStatisticsVO> getStatisticsByMealsWeight(HealthMealsWeightQueryVO queryVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Boolean> updateUserGroup(SysUserModel model) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<GroupCount>> specificGroupUser() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<BaseUserGroup> userGroupInfo(String userId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<EmployeeHeightWeight> appUserFindUserHeightWeight(String userFlag) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<WeightSignUserVO>> queryWeightSignUser(QueryWeightSignUserParam signUserParam) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> updateUserBodyInfo(UserBodyInfoDto data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> updateEx(UserDataRecordBmi recordBmi) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<EmployeeHeightWeight>> userBodyInfo(List<String> userIds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<WeightHeightDayVO>> weightByDay(String userId, String startTime, String endTime) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> sendSmsByUserIds(SendSmsReq req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSmsNotSign(List<NotSignType> notSignTypes) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<WeightHeightDayVO>> userBodyInfoLatest(SendSmsReq req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSmsNotSignV2(List<UserWeightSign> usersSign) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<Object>> weightRecord(String userId, Date startTime, Date endTime, Integer pageNo, Integer pageSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRoleByIdList(String roleCode, List<String> userIdList) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> addHouseManager(LoginUser loginUser) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<FamilyMembersVO>> userFamilyMembersList(@RequestParam(name = "userId", required = false) String userId){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+290
@@ -0,0 +1,290 @@
|
||||
package org.jeecg.untils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nls.client.AccessToken;
|
||||
import io.netty.handler.codec.http.HttpHeaders;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.output.ByteArrayOutputStream;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.asynchttpclient.*;
|
||||
import org.jeecg.bean.response.ResponseVo;
|
||||
import org.jeecg.common.util.MyUploadUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.UUIDGenerator;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SpeechUntil {
|
||||
|
||||
@Value("${speech.domain:}")
|
||||
private String domain;
|
||||
@Value("${speech.path:}")
|
||||
private String path;
|
||||
@Value("${speech.appKey:}")
|
||||
private String appKey;
|
||||
@Value("${speech.accessKeyId:}")
|
||||
private String accessKeyId;
|
||||
@Value("${speech.accessKeySecret:}")
|
||||
private String accessKeySecret;
|
||||
@Value("${speech.format:}")
|
||||
private String format;
|
||||
@Value("${speech.sampleRate:}")
|
||||
private String sampleRate;
|
||||
@Value("${speech.voice:}")
|
||||
private String voice;
|
||||
@Value("${speech.pitchRate:}")
|
||||
private String pitchRate;
|
||||
@Value("${speech.speechRate:}")
|
||||
private String speechRate;
|
||||
@Value("${speech.volume:}")
|
||||
private String volume;
|
||||
@Value("${speech.chunked:}")
|
||||
private String chunked;
|
||||
@Value("${speech.splitNumber:}")
|
||||
private Integer splitNumber;
|
||||
@Value("${speech.redis.effectiveTime:}")
|
||||
private Integer effectiveTime;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
private static final String REDIS_ALI_TTS_TOKEN = "REDIS_ALI_TTS_TOKEN";
|
||||
private String getToken() {
|
||||
String token = null;
|
||||
try {
|
||||
AccessToken accessToken = new AccessToken( accessKeyId, accessKeySecret,
|
||||
domain, "cn-shanghai", "2019-02-28");
|
||||
accessToken.apply();
|
||||
token = accessToken.getToken();
|
||||
log.info(token);
|
||||
}catch (IOException e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private ResponseVo processGETRequest(String text, ByteArrayOutputStream out, String token) {
|
||||
ResponseVo vo = new ResponseVo();
|
||||
String url = path;
|
||||
url = url + "?appkey=" + appKey;
|
||||
url = url + "&token=" + token;
|
||||
url = url + "&text=" + text;
|
||||
url = url + "&format=" + format;
|
||||
url = url + "&voice=" + voice;
|
||||
url = url + "&sample_rate=" + sampleRate;
|
||||
url = url + "&volume=" + volume;
|
||||
url = url + "&speech_rate=" + speechRate;
|
||||
url = url + "&pitch_rate=" + pitchRate;
|
||||
url = url + "&chunk=" + chunked;
|
||||
try {
|
||||
AsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder()
|
||||
// 链接超时和请求超时等跟官方例子保持一致,最好不要修改
|
||||
.setConnectTimeout(5000)
|
||||
.setKeepAlive(true)
|
||||
.setReadTimeout(10000)
|
||||
.setRequestTimeout(50000)
|
||||
.setMaxConnections(1000)
|
||||
.setMaxConnectionsPerHost(200)
|
||||
.setPooledConnectionIdleTimeout(-1)
|
||||
.build();
|
||||
AsyncHttpClient httpClient = new DefaultAsyncHttpClient(config);
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
AsyncHandler<Response> handler = new AsyncHandler<org.asynchttpclient.Response>() {
|
||||
boolean firstRevBinary = true;
|
||||
int httpCode = 200;
|
||||
@Override
|
||||
public State onStatusReceived(HttpResponseStatus httpResponseStatus) {
|
||||
log.info("onStatusReceived status {}", httpResponseStatus);
|
||||
httpCode = httpResponseStatus.getStatusCode();
|
||||
if (httpResponseStatus.getStatusCode() != 200) {
|
||||
vo.setStateCode(httpResponseStatus.getStatusCode());
|
||||
log.error("request error " + httpResponseStatus.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public State onHeadersReceived(HttpHeaders httpHeaders){
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public State onBodyPartReceived(HttpResponseBodyPart httpResponseBodyPart) throws Exception {
|
||||
//重要提示:此处一旦接收到数据流,即可向用户播放或者用于其他处理,以提升响应速度
|
||||
//重要提示:请不要在此回调接口中执行耗时操作,可以以异步或者队列形式将二进制TTS语音流推送到另一线程中
|
||||
if(httpCode != 200) {
|
||||
vo.setStateCode(httpCode);
|
||||
out.write((httpResponseBodyPart.getBodyPartBytes()));
|
||||
return State.ABORT;
|
||||
}
|
||||
|
||||
if (firstRevBinary) {
|
||||
firstRevBinary = false;
|
||||
//统计第一包数据的接收延迟,实际上接收到第一包数据后就可以进行业务处理了,比如播放或者发送给调用方,注意:这里的首包延迟也包括了网络建立链接的时间
|
||||
}
|
||||
//重要提示:此处仅为举例,将语音流保存到文件中
|
||||
out.write(httpResponseBodyPart.getBodyPartBytes());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onThrowable(Throwable throwable) {
|
||||
log.error("throwable:" + throwable);
|
||||
latch.countDown();
|
||||
}
|
||||
@Override
|
||||
public org.asynchttpclient.Response onCompleted() {
|
||||
latch.countDown();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
httpClient.prepareGet(url).execute(handler);
|
||||
// 等待合成完成
|
||||
latch.await();
|
||||
httpClient.close();
|
||||
vo.setIn(new ByteArrayInputStream(out.toByteArray()));
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将长文本切分为每句字数不大于size数目的短句
|
||||
* @param text
|
||||
* @param size
|
||||
* @return
|
||||
*/
|
||||
private List<String> splitText(String text, int size) {
|
||||
//先按标点符号切分
|
||||
String[] texts = text.split("[、,。;?!,!\\?]");
|
||||
StringBuilder textPart = new StringBuilder();
|
||||
List<String> result = new ArrayList<String>();
|
||||
int len = 0;
|
||||
//再按size merge,避免标点符号切分出来的太短
|
||||
for (String s : texts) {
|
||||
if (textPart.length() + s.length() + 1 > size) {
|
||||
result.add(textPart.toString());
|
||||
textPart.delete(0, textPart.length());
|
||||
|
||||
}
|
||||
textPart.append(s);
|
||||
len += s.length();
|
||||
if (len < text.length()) {
|
||||
textPart.append(text.charAt(len));
|
||||
len += 1;
|
||||
}
|
||||
}
|
||||
if (textPart.length() > 0) {
|
||||
result.add(textPart.toString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private ResponseVo process(String longText, String token) {
|
||||
ResponseVo vo = new ResponseVo();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
List<String> textArr = splitText(longText, splitNumber);
|
||||
try {
|
||||
for (String textUrlEncode : textArr) {
|
||||
//设置用于语音合成的文本
|
||||
// 采用RFC 3986规范进行urlEncode编码
|
||||
try {
|
||||
textUrlEncode = URLEncoder.encode(textUrlEncode, "UTF-8")
|
||||
.replace("+", "%20")
|
||||
.replace("*", "%2A")
|
||||
.replace("%7E", "~");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
vo = processGETRequest(textUrlEncode, out, token);
|
||||
if (vo.getStateCode() == null) {
|
||||
vo.setStateCode(200);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成语音并且上传至文件服务器(对外暴露)
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public String generateVoice(String text){
|
||||
String url = null;
|
||||
//将文字所有html标签删除
|
||||
String substance = Jsoup.parse(text).text();
|
||||
//将文字符号转换成汉语(常用,后面继续补充)
|
||||
String content =
|
||||
substance.replace("<", "小于").replace("=", "等于")
|
||||
.replace(">", "大于") .replace("/", "分之")
|
||||
.replace("%", "百分比").replace("+", "加");
|
||||
//阿里语音设置有效23小时
|
||||
//设置redisKey
|
||||
// String token = (String) redisUtil.get(REDIS_ALI_TTS_TOKEN);
|
||||
// //若token不存在,则生成token,设置有效期为23小时
|
||||
// if (StringUtils.isEmpty(token)){
|
||||
String token = getToken();
|
||||
System.out.println(token);
|
||||
redisUtil.set(REDIS_ALI_TTS_TOKEN, token, effectiveTime);
|
||||
// }
|
||||
ResponseVo vo = process(content,token);
|
||||
//判断语音是否生成成功
|
||||
if (HttpStatus.SC_OK != vo.getStateCode()){
|
||||
String read = readInputStream(vo.getIn());
|
||||
//input stream是否有参数
|
||||
if (read != null){
|
||||
log.info(read);
|
||||
int startIndex = read.indexOf("{");
|
||||
int endIndex = read.indexOf("}", startIndex) + 1;
|
||||
String arr = read.substring(startIndex, endIndex);
|
||||
JSONObject jsonObject = JSON.parseObject(arr);
|
||||
//token失效
|
||||
if("40000001".equals(jsonObject.getString("status"))){
|
||||
//token失效,重新生成语音,先删除key
|
||||
redisUtil.del(REDIS_ALI_TTS_TOKEN);
|
||||
url = generateVoice(text);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
//上送服务器
|
||||
String suffix = "." + format;
|
||||
String fileName = UUIDGenerator.generate()+suffix;
|
||||
String bizType = "ttsVoice";
|
||||
try {
|
||||
url = MyUploadUtil.upload(vo.getIn(), bizType, fileName);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
//读取input stream
|
||||
private String readInputStream(InputStream inputStream) {
|
||||
try {
|
||||
StringBuilder content = new StringBuilder();
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
content.append(line);
|
||||
}
|
||||
}
|
||||
return content.toString();
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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>
|
||||
<artifactId>jeecg-system-api</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeecg-system-local-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-system-cloud-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+559
@@ -0,0 +1,559 @@
|
||||
package org.jeecg.common.system.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.bean.request.ListUser;
|
||||
import org.jeecg.bean.request.UserClient;
|
||||
import org.jeecg.bean.response.EmployeeHeightWeight;
|
||||
import org.jeecg.bean.response.SysPositionVO;
|
||||
import org.jeecg.bean.response.WeightHeightDayVO;
|
||||
import org.jeecg.common.api.CommonAPI;
|
||||
import org.jeecg.common.api.dto.DataLogDTO;
|
||||
import org.jeecg.common.api.dto.OnlineAuthDTO;
|
||||
import org.jeecg.common.api.dto.message.*;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.bean.request.SendSmsReq;
|
||||
import org.jeecg.common.bean.response.BaseUserGroup;
|
||||
import org.jeecg.common.bean.response.NotSignType;
|
||||
import org.jeecg.common.bean.transfer.GroupCount;
|
||||
import org.jeecg.common.bean.transfer.UserWeightSign;
|
||||
import org.jeecg.common.system.vo.*;
|
||||
import org.jeecg.modules.system.bean.UserEmployee;
|
||||
import org.jeecg.modules.system.entity.HealthUserEmployeeEx;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.entity.SysUserEmergencyContact;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Description 底层共通业务API,提供其他独立模块调用
|
||||
* @Author scott
|
||||
* @Date 2019-4-20
|
||||
* @Version V1.0
|
||||
*/
|
||||
public interface ISysBaseAPI extends CommonAPI {
|
||||
|
||||
String addHouseManager(@RequestBody LoginUser loginUser);
|
||||
List<String> getUserIdsByDepartAndUsername(String departCode, String username, String idCard, String workNo);
|
||||
|
||||
// 添加医护人员
|
||||
SysUser addMedicalStaff(SysUserModel sysUser);
|
||||
/**
|
||||
* 获取用户扩展信息
|
||||
* @param userIds 用户ids
|
||||
* @return list
|
||||
*/
|
||||
List<HealthUserEmployeeEx> listEmployeeUserByIds(ListUser userIds);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户信息,部门信息以及部门父级部门树(至多只查询到二级部门)
|
||||
*
|
||||
* @param userIds 用户id
|
||||
* @return 登录用户信息
|
||||
*/
|
||||
List<LoginUserNew> listUserByIds(ListUser userIds);
|
||||
|
||||
List<LoginUser> listUserByIdsNew(List<String> userIds);
|
||||
|
||||
/**
|
||||
* @param list 用户id
|
||||
* @return 用户信息
|
||||
*/
|
||||
List<LoginUserNew> listUserByIdsClient(List<UserClient> list);
|
||||
|
||||
|
||||
/**
|
||||
* 1发送系统消息
|
||||
*
|
||||
* @param message 使用构造器赋值参数 如果不设置category(消息类型)则默认为2 发送系统消息
|
||||
*/
|
||||
void sendSysAnnouncement(MessageDTO message);
|
||||
|
||||
/**
|
||||
* 2发送消息 附带业务参数
|
||||
*
|
||||
* @param message 使用构造器赋值参数
|
||||
*/
|
||||
void sendBusAnnouncement(BusMessageDTO message);
|
||||
|
||||
/**
|
||||
* 3通过模板发送消息
|
||||
*
|
||||
* @param message 使用构造器赋值参数
|
||||
*/
|
||||
void sendTemplateAnnouncement(TemplateMessageDTO message);
|
||||
|
||||
/**
|
||||
* 4通过模板发送消息 附带业务参数
|
||||
*
|
||||
* @param message 使用构造器赋值参数
|
||||
*/
|
||||
void sendBusTemplateAnnouncement(BusTemplateMessageDTO message);
|
||||
|
||||
/**
|
||||
* 5通过消息中心模板,生成推送内容
|
||||
*
|
||||
* @param templateDTO 使用构造器赋值参数
|
||||
* @return
|
||||
*/
|
||||
String parseTemplateByCode(TemplateDTO templateDTO);
|
||||
|
||||
//update-begin---author:taoyan ---date:20220705 for:支持自定义推送类型,邮件、钉钉、企业微信、系统消息-----------
|
||||
|
||||
/**
|
||||
* 发送模板消息【新,支持自定义推送类型】
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
void sendTemplateMessage(MessageDTO message);
|
||||
|
||||
/**
|
||||
* 根据模板编码获取模板内容【新,支持自定义推送类型】
|
||||
*
|
||||
* @param templateCode
|
||||
* @return
|
||||
*/
|
||||
String getTemplateContent(String templateCode);
|
||||
//update-begin---author:taoyan ---date:20220705 for:支持自定义推送类型,邮件、钉钉、企业微信、系统消息-----------
|
||||
|
||||
/**
|
||||
* 6根据用户id查询用户信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
LoginUser getUserById(String id);
|
||||
|
||||
/**
|
||||
* 7通过用户账号查询角色集合
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<String> getRolesByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 8通过用户账号查询部门集合
|
||||
*
|
||||
* @param userId
|
||||
* @return 部门 id
|
||||
*/
|
||||
List<String> getDepartIdsByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 9通过用户账号查询部门 name
|
||||
*
|
||||
* @param userId
|
||||
* @return 部门 name
|
||||
*/
|
||||
List<String> getDepartNamesByUserId(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 11查询所有的父级字典,按照create_time排序
|
||||
*
|
||||
* @return List<DictModel> 字典集合
|
||||
*/
|
||||
public List<DictModel> queryAllDict();
|
||||
|
||||
/**
|
||||
* 12查询所有分类字典
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<SysCategoryModel> queryAllSysCategory();
|
||||
|
||||
|
||||
/**
|
||||
* 14查询所有部门 作为字典信息 id -->value,departName -->text
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<DictModel> queryAllDepartBackDictModel();
|
||||
|
||||
/**
|
||||
* 15根据业务类型及业务id修改消息已读
|
||||
*
|
||||
* @param busType
|
||||
* @param busId
|
||||
*/
|
||||
public void updateSysAnnounReadFlag(String busType, String busId);
|
||||
|
||||
/**
|
||||
* 16查询表字典 支持过滤数据
|
||||
*
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
* @param filterSql
|
||||
* @return
|
||||
*/
|
||||
public List<DictModel> queryFilterTableDictInfo(String table, String text, String code, String filterSql);
|
||||
|
||||
/**
|
||||
* 17查询指定table的 text code 获取字典,包含text和value
|
||||
*
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
* @param keyArray
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray);
|
||||
|
||||
/**
|
||||
* 18查询所有用户 返回ComboModel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<ComboModel> queryAllUserBackCombo();
|
||||
|
||||
/**
|
||||
* 19分页查询用户 返回JSONObject
|
||||
*
|
||||
* @param userIds 多个用户id
|
||||
* @param pageNo 当前页数
|
||||
* @param pageSize 每页显示条数
|
||||
* @return
|
||||
*/
|
||||
public JSONObject queryAllUser(String userIds, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 20获取所有角色
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<ComboModel> queryAllRole();
|
||||
|
||||
/**
|
||||
* 21获取所有角色 带参
|
||||
*
|
||||
* @param roleIds 默认选中角色
|
||||
* @return
|
||||
*/
|
||||
public List<ComboModel> queryAllRole(String[] roleIds);
|
||||
|
||||
/**
|
||||
* 22通过用户账号查询角色Id集合
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<String> getRoleIdsByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 23通过部门编号查询部门id
|
||||
*
|
||||
* @param orgCode
|
||||
* @return
|
||||
*/
|
||||
public String getDepartIdsByOrgCode(String orgCode);
|
||||
|
||||
/**
|
||||
* 24查询所有部门
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<SysDepartModel> getAllSysDepart();
|
||||
|
||||
/**
|
||||
* 25查找父级部门
|
||||
*
|
||||
* @param departId
|
||||
* @return
|
||||
*/
|
||||
DictModel getParentDepartId(String departId);
|
||||
|
||||
/**
|
||||
* 26根据部门Id获取部门负责人
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
public List<String> getDeptHeadByDepId(String deptId);
|
||||
|
||||
/**
|
||||
* 27给指定用户发消息
|
||||
*
|
||||
* @param userIds
|
||||
* @param cmd
|
||||
*/
|
||||
public void sendWebSocketMsg(String[] userIds, String cmd);
|
||||
|
||||
/**
|
||||
* 28根据id获取所有参与用户
|
||||
*
|
||||
* @param userIds 多个用户id
|
||||
* @return
|
||||
*/
|
||||
public List<LoginUser> queryAllUserByIds(String[] userIds);
|
||||
|
||||
/**
|
||||
* 29将会议签到信息推动到预览
|
||||
* userIds
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
void meetingSignWebsocket(String userId);
|
||||
|
||||
/**
|
||||
* 30根据name获取所有参与用户
|
||||
*
|
||||
* @param userNames 多个用户账户
|
||||
* @return
|
||||
*/
|
||||
List<LoginUser> queryUserByNames(String[] userNames);
|
||||
|
||||
|
||||
/**
|
||||
* 31获取用户的角色集合
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Set<String> getUserRoleSet(String userId);
|
||||
|
||||
/**
|
||||
* 32获取用户的权限集合
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Set<String> getUserPermissionSet(String userId);
|
||||
|
||||
/**
|
||||
* 33判断是否有online访问的权限
|
||||
*
|
||||
* @param onlineAuthDTO
|
||||
* @return
|
||||
*/
|
||||
boolean hasOnlineAuth(OnlineAuthDTO onlineAuthDTO);
|
||||
|
||||
/**
|
||||
* 34通过部门id获取部门全部信息
|
||||
*
|
||||
* @param id 部门id
|
||||
* @return SysDepartModel对象
|
||||
*/
|
||||
SysDepartModel selectAllById(String id);
|
||||
|
||||
/**
|
||||
* 35根据用户id查询用户所属公司下所有用户ids
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<String> queryDeptUsersByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 36根据多个用户账号(逗号分隔),查询返回多个用户信息
|
||||
*
|
||||
* @param usernames
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> queryUsersByUsernames(String usernames);
|
||||
|
||||
/**
|
||||
* 37根据多个用户ID(逗号分隔),查询返回多个用户信息
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> queryUsersByIds(String ids);
|
||||
|
||||
/**
|
||||
* 38根据多个部门编码(逗号分隔),查询返回多个部门信息
|
||||
*
|
||||
* @param orgCodes
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> queryDepartsByOrgcodes(String orgCodes);
|
||||
|
||||
/**
|
||||
* 39根据多个部门id(逗号分隔),查询返回多个部门信息
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> queryDepartsByIds(String ids);
|
||||
|
||||
/**
|
||||
* 40发送邮件消息
|
||||
*
|
||||
* @param email
|
||||
* @param title
|
||||
* @param content
|
||||
*/
|
||||
void sendEmailMsg(String email, String title, String content);
|
||||
|
||||
/**
|
||||
* 41 获取公司下级部门和公司下所有用户信息
|
||||
*
|
||||
* @param orgCode
|
||||
* @return List<Map>
|
||||
*/
|
||||
List<Map> getDeptUserByOrgCode(String orgCode);
|
||||
|
||||
/**
|
||||
* 查询分类字典翻译
|
||||
*
|
||||
* @param ids 多个分类字典id
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> loadCategoryDictItem(String ids);
|
||||
|
||||
/**
|
||||
* 根据字典code加载字典text
|
||||
*
|
||||
* @param dictCode 顺序:tableName,text,code
|
||||
* @param keys 要查询的key
|
||||
* @return
|
||||
*/
|
||||
List<String> loadDictItem(String dictCode, String keys);
|
||||
|
||||
/**
|
||||
* 根据字典code查询字典项
|
||||
*
|
||||
* @param dictCode 顺序:tableName,text,code
|
||||
* @param dictCode 要查询的key
|
||||
* @return
|
||||
*/
|
||||
List<DictModel> getDictItems(String dictCode);
|
||||
|
||||
/**
|
||||
* 根据多个字典code查询多个字典项
|
||||
*
|
||||
* @param dictCodeList
|
||||
* @return key = dictCode ; value=对应的字典项
|
||||
*/
|
||||
Map<String, List<DictModel>> getManyDictItems(List<String> dictCodeList);
|
||||
|
||||
/**
|
||||
* 【JSearchSelectTag下拉搜索组件专用接口】
|
||||
* 大数据量的字典表 走异步加载 即前端输入内容过滤数据
|
||||
*
|
||||
* @param dictCode 字典code格式:table,text,code
|
||||
* @param keyword 过滤关键字
|
||||
* @param pageSize 分页条数
|
||||
* @return
|
||||
*/
|
||||
List<DictModel> loadDictItemByKeyword(String dictCode, String keyword, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 新增数据日志
|
||||
*
|
||||
* @param dataLogDto
|
||||
*/
|
||||
void saveDataLog(DataLogDTO dataLogDto);
|
||||
|
||||
/**
|
||||
* 添加文件到知识库
|
||||
*
|
||||
* @param sysFilesModel
|
||||
*/
|
||||
void addSysFiles(SysFilesModel sysFilesModel);
|
||||
|
||||
/**
|
||||
* 通过文件路径获取文件id
|
||||
*
|
||||
* @param fileId
|
||||
*/
|
||||
String getFileUrl(String fileId);
|
||||
|
||||
/**
|
||||
* 更新头像
|
||||
*
|
||||
* @param loginUser
|
||||
*/
|
||||
void updateAvatar(LoginUser loginUser);
|
||||
|
||||
/**
|
||||
* 向app端 websocket推送聊天刷新消息
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void sendAppChatSocket(String userId);
|
||||
|
||||
String addUserToEx(SysUserModel sysUserModel);
|
||||
|
||||
|
||||
String updateUserToEx(SysUserModel sysUserModel);
|
||||
|
||||
Integer deleteUserById(String userId);
|
||||
|
||||
String selectUserIdNoById(String userId);
|
||||
|
||||
List<SysUserEmergencyContact> selectEmergencyContactByUserId(String userId);
|
||||
|
||||
UserEmployee selectEmployeeUser(String userId);
|
||||
|
||||
List<SysUser> userListByPhone(@RequestParam String phone);
|
||||
|
||||
boolean updateUserInfo(SysUserModel sysUser);
|
||||
|
||||
boolean delUser(List<String> ids);
|
||||
|
||||
Integer chageUserPersonType(String userId);
|
||||
|
||||
List<SysUser> getUserByIdCardList(ListUser listUser);
|
||||
|
||||
Result<Object> getUserNumByOrgCode(String orgCode);
|
||||
|
||||
Result<Map<String, Integer>> getUserNumByOrgCodeList(List<String> orgCodeList);
|
||||
|
||||
void sendBusSms(BusTemplateMessageDTO message);
|
||||
|
||||
List<LoginUser> listUserByIdCards(List<String> idCards);
|
||||
|
||||
List<String> userIdsByGroup(List<String> groups);
|
||||
|
||||
List<String> allThirdDepartCodes();
|
||||
|
||||
void updateUserGroup(SysUserModel model);
|
||||
|
||||
List<String> checkExistUser(String existUserId, String userName, String mobile, String idCard);
|
||||
|
||||
Page<SysUser> pageUser(SysUser user, Integer pageNo, Integer pageSize, List<String> managerCodes);
|
||||
// List<String> checkExistUser(String existUserId,String userName, String mobile, String idCard);
|
||||
|
||||
Result<List<String>> getUserIdsByOrgCodeList(List<String> orgCodeList);
|
||||
|
||||
String selectUserExistByUserName(String id, String userName);
|
||||
/**根据用户id获取所在部门信息*/
|
||||
SysPositionVO getPositionByUserId(String userId);
|
||||
|
||||
/**根据单位字典id获取岗位列表*/
|
||||
List<SysPositionVO> getPositionByUnitsId(Integer unitsId, Integer postNum, String postName);
|
||||
|
||||
/**
|
||||
* 查询所有岗位信息
|
||||
* @return
|
||||
*/
|
||||
List<SysPositionVO> getAllPosition();
|
||||
|
||||
List<String> findSysUserIds(SysUser user);
|
||||
|
||||
List<GroupCount> specificGroupUser();
|
||||
|
||||
BaseUserGroup userGroupInfo(String userId);
|
||||
|
||||
List<EmployeeHeightWeight> userBodyInfo(List<String> userIds);
|
||||
|
||||
/**
|
||||
* 发送超重管理短信提醒数据
|
||||
*/
|
||||
void sendSmsByUserIds(SendSmsReq req);
|
||||
|
||||
void sendSmsNotSign(List<NotSignType> notSignTypes);
|
||||
|
||||
void sendSmsNotSignV2(List<UserWeightSign> usersSign);
|
||||
|
||||
List<WeightHeightDayVO> userBodyInfoLatest(SendSmsReq req);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.common.system.bean.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-07-11 14:50
|
||||
*/
|
||||
@Data
|
||||
public class NoticeRead {
|
||||
@NotBlank(message = "公告id为空")
|
||||
private String noticeId;
|
||||
private String agree;
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package org.jeecg.common.system.bean.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-05-30 14:56
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ResetPassword extends SimpleUser {
|
||||
/**
|
||||
* 旧密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 新密码
|
||||
*/
|
||||
@NotBlank(message = "新密码为空")
|
||||
private String newPassword;
|
||||
/**
|
||||
* 确认密码
|
||||
*/
|
||||
@NotBlank(message = "确认密码为空")
|
||||
private String newPasswordConfirm;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
private String randCode;
|
||||
/**
|
||||
* 验证码rediskey
|
||||
*/
|
||||
private String randCodeKey;
|
||||
|
||||
// 用户检验code
|
||||
private String resetCode;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package org.jeecg.common.system.bean.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-05-30 14:57
|
||||
*/
|
||||
@Data
|
||||
public class SimpleUser {
|
||||
@NotBlank(message = "用户id为空")
|
||||
private String userId;
|
||||
private String userName;
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private String depart;
|
||||
/**
|
||||
* 状态(1-正常,2-冻结)
|
||||
*/
|
||||
private String status;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package org.jeecg.common.system.bean.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class SysMessageRemindDO implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "主键id")
|
||||
private String id;
|
||||
|
||||
@Schema(title = "标题")
|
||||
private String title;
|
||||
|
||||
@Schema(title = "内容")
|
||||
private String content;
|
||||
|
||||
@Schema(title = "类型 1用户消息 2消息公告")
|
||||
private String type;
|
||||
|
||||
@Schema(title = "0未读 1已读")
|
||||
private String state;
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package org.jeecg.common.system.bean.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class SysMessageRemindSendDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "标题")
|
||||
private String title;
|
||||
|
||||
@Schema(title = "内容")
|
||||
private String content;
|
||||
|
||||
@Schema(title = "类型")
|
||||
private String userId;
|
||||
|
||||
@Schema(title = "透传消息参数")
|
||||
private Map<String, String> param;
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package org.jeecg.common.system.bean.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: sys_user_emergency_contact
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-07-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class SysUserEmergencyContactDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "主键id")
|
||||
private String id;
|
||||
|
||||
@NotBlank(message = "不能为空")
|
||||
@Schema(title = "紧急联系人姓名")
|
||||
private java.lang.String name;
|
||||
|
||||
@NotBlank(message = "不能为空")
|
||||
@Schema(title = "紧急联系人电话")
|
||||
private java.lang.String phone;
|
||||
|
||||
|
||||
@Schema(title = "紧急联系人身份证号")
|
||||
private java.lang.String idCard;
|
||||
|
||||
@NotBlank(message = "不能为空")
|
||||
@Schema(title = "家庭关系")
|
||||
@Dict(dicCode = "family_member_relation")
|
||||
private java.lang.String familyRelation;
|
||||
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package org.jeecg.common.system.bean.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
@Data
|
||||
public class SysUserInfoDO {
|
||||
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(title = "姓名")
|
||||
private String realname;
|
||||
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
@Schema(title = "工号")
|
||||
private String workNo;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(title = "手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
@Schema(title = "身份证")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 性别 翻译好是带Value那个
|
||||
*/
|
||||
@Schema(title = "性别")
|
||||
@Dict(dicCode = "sex2")
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 人员类型 翻译好是带Value那个
|
||||
*/
|
||||
@Schema(title = "人员类型")
|
||||
@Dict(dicCode = "p_type")
|
||||
private String personType;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
@Schema(title = "部门")
|
||||
private String orgCode;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Schema(title = "头像")
|
||||
private String avatar;
|
||||
|
||||
@Dict(dicCode = "blood_type")
|
||||
@Schema(title = "血型")
|
||||
private String bloodType;
|
||||
|
||||
@Dict(dicCode = "health_type")
|
||||
@Schema(title = "健康类型")
|
||||
private String healthType;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package org.jeecg.common.system.bean.response;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-07-12 10:40
|
||||
*/
|
||||
@Data
|
||||
public class BaseUser {
|
||||
private String userId;
|
||||
private String userName;
|
||||
@Excel(name = "姓名",orderNum = "2")
|
||||
private String realName;
|
||||
private String workNo;
|
||||
@Excel(name = "身份证号",orderNum = "3",width = 30)
|
||||
private String idCard;
|
||||
@Dict(dicCode = "p_type")
|
||||
private String personType;
|
||||
@Excel(name = "单位",orderNum = "0",width = 30)
|
||||
private String secondDepart;
|
||||
private String orgCode;
|
||||
private String departId;
|
||||
@Excel(name = "部门",orderNum = "1",width = 30)
|
||||
private String depart;
|
||||
@Dict(dicCode = "user_status")
|
||||
private String status;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package org.jeecg.common.system.bean.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2024-01-02 16:41
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GroupUser extends BaseUser{
|
||||
@Dict(dicCode = "user_group")
|
||||
@Excel(name = "健康分类",dicCode = "user_group",orderNum = "4")
|
||||
private String userGroup;
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "更新时间",format = "yyyy-MM-dd HH:mm:ss",width = 30,orderNum = "5")
|
||||
private Date userGroupUpdateTime;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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>
|
||||
<artifactId>jeecg-system</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-system-api</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>jeecg-system-local-api</module>
|
||||
<module>jeecg-system-cloud-api</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,4 @@
|
||||
*.js linguist-language=Java
|
||||
*.css linguist-language=Java
|
||||
*.html linguist-language=Java
|
||||
*.vue linguist-language=Java
|
||||
@@ -0,0 +1,86 @@
|
||||
<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.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-system</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-system-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--微信相关-->
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-miniapp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.renkang</groupId>
|
||||
<artifactId>health-consultation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-system-local-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>hibernate-re</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.jpush.api</groupId>
|
||||
<artifactId>jpush-client</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk15on</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.jpush.api</groupId>
|
||||
<artifactId>jiguang-common</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk15on</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk18on</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.renkang</groupId>
|
||||
<artifactId>health-watch-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package org.jeecg.config.init;
|
||||
|
||||
import com.xkcoding.justauth.AuthRequestFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-03-30 11:14
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class AuthRequestConfig {
|
||||
|
||||
@Bean
|
||||
public AuthRequestFactory authRequestFactory() {
|
||||
// TODO 为了解决项目启动问题 后续优化
|
||||
return new AuthRequestFactory(null, null);
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package org.jeecg.config.init;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.config.JeecgCloudCondition;
|
||||
import org.jeecg.modules.system.service.ISysGatewayRouteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @desc: 启动程序,初始化路由配置
|
||||
* @author: flyme
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Conditional(JeecgCloudCondition.class)
|
||||
public class SystemInitListener implements ApplicationListener<ApplicationReadyEvent>, Ordered {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysGatewayRouteService sysGatewayRouteService;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||
|
||||
log.info(" 服务已启动,初始化路由配置 ###################");
|
||||
String context = "AnnotationConfigServletWebServerApplicationContext";
|
||||
if (applicationReadyEvent.getApplicationContext().getDisplayName().indexOf(context) > -1) {
|
||||
sysGatewayRouteService.addRoute2Redis(CacheConstant.GATEWAY_ROUTES);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package org.jeecg.config.init;
|
||||
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.tomcat.util.scan.StandardJarScanner;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Description: TomcatFactoryConfig
|
||||
* @author: scott
|
||||
* @date: 2021年01月25日 11:40
|
||||
*/
|
||||
@Configuration
|
||||
public class TomcatFactoryConfig {
|
||||
/**
|
||||
* tomcat-embed-jasper引用后提示jar找不到的问题
|
||||
*/
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatFactory() {
|
||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() {
|
||||
@Override
|
||||
protected void postProcessContext(Context context) {
|
||||
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
|
||||
}
|
||||
};
|
||||
factory.addConnectorCustomizers(connector -> {
|
||||
connector.setProperty("relaxedPathChars", "[]{}");
|
||||
connector.setProperty("relaxedQueryChars", "[]{}");
|
||||
});
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.jeecg.constant;
|
||||
|
||||
public class SystemConstant {
|
||||
//导入员工信息
|
||||
final public static String TASK_IMPORT_USER_EMP_INFO="importUpdateUserEmpInfo";
|
||||
//员工部门更新导入
|
||||
final public static String TASK_IMPORT_USER_DEPART_INFO="importUpdateUserDepartInfo";
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jeecg.modules.aop;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 系统日志注解
|
||||
*
|
||||
* @Author scott
|
||||
* @email jeecgos@163.com
|
||||
* @Date 2019年1月14日
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface TenantLog {
|
||||
|
||||
/**
|
||||
* 操作日志类型(1查询,2添加,3修改,4删除)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int value() default 0;
|
||||
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package org.jeecg.modules.aop;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterThrowing;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.jeecg.common.api.dto.LogDTO;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.base.service.BaseCommonService;
|
||||
import org.jeecg.modules.system.entity.SysTenantPack;
|
||||
import org.jeecg.modules.system.entity.SysTenantPackUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author taoYan
|
||||
* @Date 2023/2/16 14:27
|
||||
**/
|
||||
@Aspect
|
||||
@Component
|
||||
public class TenantPackUserLogAspect {
|
||||
|
||||
@Resource
|
||||
private BaseCommonService baseCommonService;
|
||||
|
||||
@Pointcut("@annotation(org.jeecg.modules.aop.TenantLog)")
|
||||
public void tenantLogPointCut() {
|
||||
|
||||
}
|
||||
|
||||
@Around("tenantLogPointCut()")
|
||||
public Object aroundMethod(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//System.out.println("环绕通知>>>>>>>>>");
|
||||
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
TenantLog log = method.getAnnotation(TenantLog.class);
|
||||
if (log != null) {
|
||||
int opType = log.value();
|
||||
Integer logType = null;
|
||||
String content = null;
|
||||
Integer tenantId = null;
|
||||
//获取参数
|
||||
Object[] args = joinPoint.getArgs();
|
||||
if (args.length > 0) {
|
||||
for (Object obj : args) {
|
||||
if (obj instanceof SysTenantPack) {
|
||||
// logType=3 租户操作日志
|
||||
logType = 3;
|
||||
SysTenantPack pack = (SysTenantPack) obj;
|
||||
if (opType == 2) {
|
||||
content = "创建了角色权限 " + pack.getPackName();
|
||||
}
|
||||
tenantId = pack.getTenantId();
|
||||
break;
|
||||
} else if (obj instanceof SysTenantPackUser) {
|
||||
logType = 3;
|
||||
SysTenantPackUser packUser = (SysTenantPackUser) obj;
|
||||
if (opType == 2) {
|
||||
content = "将 " + packUser.getRealname() + " 添加到角色 " + packUser.getPackName();
|
||||
} else if (opType == 4) {
|
||||
content = "移除了 " + packUser.getPackName() + " 成员 " + packUser.getRealname();
|
||||
}
|
||||
tenantId = packUser.getTenantId();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (logType != null) {
|
||||
LogDTO dto = new LogDTO();
|
||||
dto.setLogType(logType);
|
||||
dto.setLogContent(content);
|
||||
dto.setOperateType(opType);
|
||||
dto.setTenantId(tenantId);
|
||||
//获取登录用户信息
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser != null) {
|
||||
dto.setUserid(sysUser.getUsername());
|
||||
dto.setUsername(sysUser.getRealname());
|
||||
|
||||
}
|
||||
dto.setCreateTime(new Date());
|
||||
//保存系统日志
|
||||
baseCommonService.addLog(dto);
|
||||
}
|
||||
}
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
|
||||
@AfterThrowing("tenantLogPointCut()")
|
||||
public void afterThrowing() throws Throwable {
|
||||
System.out.println("异常通知");
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package org.jeecg.modules.api.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Jiang Shunzhi
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class FileEntity {
|
||||
|
||||
private String fileName;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.jeecg.modules.api.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Shunzhi Jiang
|
||||
* @since 2023/10/13
|
||||
*/
|
||||
@Data
|
||||
public class LogFilter {
|
||||
|
||||
private String service;
|
||||
|
||||
private String taskType;
|
||||
|
||||
private String trigger;
|
||||
|
||||
private String keyword;
|
||||
|
||||
private Boolean isEx;
|
||||
|
||||
private Long spend;
|
||||
|
||||
private Long start;
|
||||
|
||||
private Long end;
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package org.jeecg.modules.api.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author Jiang Shunzhi
|
||||
*/
|
||||
@Data
|
||||
public class ProjectEntity {
|
||||
|
||||
@NotBlank(message = "项目名不能为空")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "项目编码不能为空")
|
||||
private String code;
|
||||
|
||||
@NotBlank(message = "项目路径不能为空")
|
||||
private String path;
|
||||
|
||||
private String url;
|
||||
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.api.bean.FileEntity;
|
||||
import org.jeecg.modules.api.bean.ProjectEntity;
|
||||
import org.jeecg.modules.api.service.FrontendUpdateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jiang Shunzhi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/service/frontend")
|
||||
@Slf4j
|
||||
@Tag(name = "system/前端")
|
||||
public class FrontendUpdateController {
|
||||
|
||||
private FrontendUpdateService frontendUpdateService;
|
||||
|
||||
@Autowired
|
||||
public void setFrontendUpdateService(FrontendUpdateService frontendUpdateService) {
|
||||
this.frontendUpdateService = frontendUpdateService;
|
||||
}
|
||||
|
||||
@Operation(description = "前端项目列表")
|
||||
@GetMapping("/project/list")
|
||||
@RequiresRoles("admin")
|
||||
public Result<List<ProjectEntity>> frontendList() {
|
||||
return Result.ok(frontendUpdateService.frontendList());
|
||||
}
|
||||
|
||||
@Operation(description = "前端项目保存")
|
||||
@PostMapping("/project/save")
|
||||
@RequiresRoles("admin")
|
||||
public Result<Boolean> frontendSave(@Validated @RequestBody ProjectEntity entity) {
|
||||
return Result.ok(frontendUpdateService.frontendSave(entity));
|
||||
}
|
||||
|
||||
@Operation(description = "前端项目删除")
|
||||
@DeleteMapping("/project/remove")
|
||||
@RequiresRoles("admin")
|
||||
public Result<Boolean> frontendRemove(
|
||||
@NotBlank(message = "项目编码不能为空") @RequestParam String code
|
||||
) {
|
||||
return Result.ok(frontendUpdateService.frontendRemove(code));
|
||||
}
|
||||
|
||||
|
||||
@Operation(description = "前端项目备份列表")
|
||||
@GetMapping("/project/backup/list")
|
||||
@RequiresRoles("admin")
|
||||
public Result<IPage<FileEntity>> frontendBackupList(
|
||||
@NotBlank(message = "项目编码不能为空") @RequestParam String code,
|
||||
@RequestParam(defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize
|
||||
) throws IOException {
|
||||
return Result.ok(frontendUpdateService.frontendBackupList(code, pageNo, pageSize));
|
||||
}
|
||||
|
||||
@Operation(description = "前端项目上传")
|
||||
@PostMapping("/project/upload")
|
||||
@RequiresRoles("admin")
|
||||
public Result<Boolean> frontendUpload(
|
||||
@NotBlank(message = "项目编码不能为空") @RequestParam String code,
|
||||
MultipartFile file
|
||||
) {
|
||||
return Result.ok(frontendUpdateService.frontendUpload(code, file));
|
||||
}
|
||||
|
||||
@Operation(description = "前端项目更新")
|
||||
@PostMapping("/project/update")
|
||||
@RequiresRoles("admin")
|
||||
public Result<Boolean> frontendUpdate(
|
||||
@NotBlank(message = "项目编码不能为空") @RequestParam String code,
|
||||
@NotBlank(message = "文件名不能为空") @RequestParam String fileName
|
||||
) {
|
||||
return Result.ok(frontendUpdateService.frontendUpdate(code, fileName));
|
||||
}
|
||||
|
||||
|
||||
@Operation(description = "前端项目备份下载")
|
||||
@GetMapping("/project/backup/download")
|
||||
@RequiresRoles("admin")
|
||||
public ResponseEntity<FileSystemResource> frontendBackupDownload(
|
||||
@NotBlank(message = "项目编码不能为空") @RequestParam String code,
|
||||
@NotBlank(message = "文件名不能为空") @RequestParam String fileName
|
||||
) {
|
||||
// log.info("文件下载service:{}\tfilename:{}", service, filename);
|
||||
// try {
|
||||
// File file = getLogPath(service).resolve(filename).normalize().toFile();
|
||||
// if (file.exists()) {
|
||||
// log.info("下载日志【{}】", filename);
|
||||
// FileSystemResource resource = new FileSystemResource(file);
|
||||
// HttpHeaders headers = new HttpHeaders();
|
||||
// String name = URLEncoder.encode(file.getName(), "UTF-8");
|
||||
// headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
// headers.setContentDisposition(ContentDisposition.attachment().filename(name).build()
|
||||
// );
|
||||
// return new ResponseEntity<>(resource, headers, HttpStatus.OK);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("下载文件出错service:{}\tfilename:{}", service, filename, e);
|
||||
// }
|
||||
return frontendUpdateService.frontendBackupDownload(code, fileName);
|
||||
}
|
||||
|
||||
@Operation(description = "前端项目备份删除")
|
||||
@DeleteMapping("/project/backup/remove")
|
||||
@RequiresRoles("admin")
|
||||
public Result<Boolean> frontendBackupRemove(
|
||||
@NotBlank(message = "项目编码不能为空") @RequestParam String code,
|
||||
@NotBlank(message = "文件名不能为空") @RequestParam String fileName
|
||||
) {
|
||||
return Result.ok(frontendUpdateService.frontendBackupRemove(code, fileName));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.api.service.HealthUserStationExApiService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/api/station")
|
||||
public class HealthUserStationExApiController {
|
||||
|
||||
|
||||
@Autowired
|
||||
HealthUserStationExApiService healthUserStationExApiService;
|
||||
|
||||
@Operation(summary = "查询驻场医院", description = "查询驻场医院")
|
||||
@GetMapping("/selectStationHospitalList")
|
||||
public List<String> selectStationHospitalList() {
|
||||
return healthUserStationExApiService.selectStationHospitalList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+256
@@ -0,0 +1,256 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.log.ApiLog;
|
||||
import org.jeecg.common.log.ErrorLog;
|
||||
import org.jeecg.common.log.ErrorLogRepository;
|
||||
import org.jeecg.common.log.TaskLog;
|
||||
import org.jeecg.modules.api.bean.LogFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||
import org.springframework.data.elasticsearch.core.SearchHit;
|
||||
import org.springframework.data.elasticsearch.core.SearchHits;
|
||||
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
||||
import org.springframework.data.elasticsearch.core.query.Query;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Shunzhi Jiang
|
||||
* @since 2023/10/13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/service/log")
|
||||
@Slf4j
|
||||
@Tag(name = "system/日志")
|
||||
public class LogController {
|
||||
|
||||
@Autowired
|
||||
private ElasticsearchOperations elasticsearchOperations;
|
||||
|
||||
@Autowired
|
||||
private ErrorLogRepository errorLogRepository;
|
||||
|
||||
@Value("${logging.file.path:}")
|
||||
private String loggingFilePath;
|
||||
|
||||
@Operation(description = "接口日志列表")
|
||||
@PostMapping("/list")
|
||||
@RequiresRoles("admin")
|
||||
public Result<IPage<ApiLog>> pageList(@RequestBody LogFilter logFilter,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo - 1, pageSize);
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "createTime");
|
||||
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder();
|
||||
BoolQueryBuilder mustQueryBuilder = QueryBuilders.boolQuery();
|
||||
List<QueryBuilder> must = mustQueryBuilder.must();
|
||||
if (StringUtils.hasText(logFilter.getService())) {
|
||||
must.add(QueryBuilders.termQuery("service.keyword", logFilter.getService()));
|
||||
}
|
||||
if (Objects.nonNull(logFilter.getIsEx())) {
|
||||
must.add(QueryBuilders.termQuery("isEx", logFilter.getIsEx()));
|
||||
}
|
||||
if (Objects.nonNull(logFilter.getStart()) && Objects.nonNull(logFilter.getEnd())) {
|
||||
must.add(QueryBuilders.rangeQuery("createTime").gte(logFilter.getStart()).lte(logFilter.getEnd()));
|
||||
}
|
||||
if (Objects.nonNull(logFilter.getSpend())) {
|
||||
must.add(QueryBuilders.rangeQuery("spend").gte(logFilter.getSpend()));
|
||||
}
|
||||
if (StringUtils.hasText(logFilter.getKeyword())) {
|
||||
BoolQueryBuilder shouldQueryBuilder = QueryBuilders.boolQuery();
|
||||
List<QueryBuilder> should = shouldQueryBuilder.should();
|
||||
should.add(QueryBuilders.matchQuery("method", logFilter.getKeyword()));
|
||||
should.add(QueryBuilders.matchQuery("requestUrl", logFilter.getKeyword()));
|
||||
must.add(shouldQueryBuilder);
|
||||
}
|
||||
Query query = queryBuilder.withQuery(mustQueryBuilder)
|
||||
.withPageable(pageable)
|
||||
.withSort(sort)
|
||||
.withTrackTotalHits(Boolean.TRUE)
|
||||
.build();
|
||||
SearchHits<ApiLog> search = elasticsearchOperations.search(query, ApiLog.class);
|
||||
List<ApiLog> apiLogs = search.getSearchHits().stream().map(SearchHit::getContent).collect(Collectors.toList());
|
||||
IPage<ApiLog> pageApiLog = new Page<>(pageNo, pageSize);
|
||||
pageApiLog.setRecords(apiLogs);
|
||||
pageApiLog.setTotal(search.getTotalHits());
|
||||
return Result.ok(pageApiLog);
|
||||
}
|
||||
|
||||
@Operation(description = "接口日志列表")
|
||||
@PostMapping("/taskList")
|
||||
@RequiresRoles("admin")
|
||||
public Result<IPage<TaskLog>> taskList(@RequestBody LogFilter logFilter,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo - 1, pageSize);
|
||||
Sort sort = Sort.by(Sort.Direction.DESC, "createTime");
|
||||
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder();
|
||||
BoolQueryBuilder mustQueryBuilder = QueryBuilders.boolQuery();
|
||||
List<QueryBuilder> must = mustQueryBuilder.must();
|
||||
if (StringUtils.hasText(logFilter.getService())) {
|
||||
must.add(QueryBuilders.termQuery("service", logFilter.getService()));
|
||||
}
|
||||
if (StringUtils.hasText(logFilter.getTaskType())) {
|
||||
must.add(QueryBuilders.termQuery("taskType", logFilter.getTaskType()));
|
||||
}
|
||||
if (StringUtils.hasText(logFilter.getTrigger())) {
|
||||
must.add(QueryBuilders.termQuery("trigger", logFilter.getTrigger()));
|
||||
}
|
||||
if (Objects.nonNull(logFilter.getIsEx())) {
|
||||
must.add(QueryBuilders.termQuery("isEx", logFilter.getIsEx()));
|
||||
}
|
||||
if (Objects.nonNull(logFilter.getStart()) && Objects.nonNull(logFilter.getEnd())) {
|
||||
must.add(QueryBuilders.rangeQuery("createTime").gte(logFilter.getStart()).lte(logFilter.getEnd()));
|
||||
}
|
||||
if (Objects.nonNull(logFilter.getSpend())) {
|
||||
must.add(QueryBuilders.rangeQuery("spend").gte(logFilter.getSpend()));
|
||||
}
|
||||
if (StringUtils.hasText(logFilter.getKeyword())) {
|
||||
BoolQueryBuilder shouldQueryBuilder = QueryBuilders.boolQuery();
|
||||
List<QueryBuilder> should = shouldQueryBuilder.should();
|
||||
should.add(QueryBuilders.matchQuery("taskName", logFilter.getKeyword()));
|
||||
should.add(QueryBuilders.matchQuery("method", logFilter.getKeyword()));
|
||||
must.add(shouldQueryBuilder);
|
||||
}
|
||||
Query query = queryBuilder.withQuery(mustQueryBuilder)
|
||||
.withPageable(pageable)
|
||||
.withSort(sort)
|
||||
.withTrackTotalHits(Boolean.TRUE)
|
||||
.build();
|
||||
SearchHits<TaskLog> search = elasticsearchOperations.search(query, TaskLog.class);
|
||||
List<TaskLog> taskLogs = search.getSearchHits().stream().map(SearchHit::getContent).collect(Collectors.toList());
|
||||
IPage<TaskLog> pageTaskLog = new Page<>(pageNo, pageSize);
|
||||
pageTaskLog.setRecords(taskLogs);
|
||||
pageTaskLog.setTotal(search.getTotalHits());
|
||||
return Result.ok(pageTaskLog);
|
||||
}
|
||||
|
||||
@Operation(description = "错误日志ID查询")
|
||||
@GetMapping("/error/{id}")
|
||||
@RequiresRoles("admin")
|
||||
public Result<ErrorLog> getErrorLogById(@PathVariable String id) {
|
||||
return Result.ok(errorLogRepository.findById(id).orElseThrow(() -> new RuntimeException("未找到错误日志")));
|
||||
}
|
||||
|
||||
@Operation(description = "日志文件列表")
|
||||
@GetMapping("/files")
|
||||
@RequiresRoles("admin")
|
||||
public Result<IPage<String>> pageFiles(String service,
|
||||
@RequestParam(defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
Page<String> resultPage = Page.of(pageNo, pageSize);
|
||||
if (!checkPathExist()) {
|
||||
return Result.ok(resultPage);
|
||||
}
|
||||
File file = getLogPath(service).normalize().toFile();
|
||||
File[] files = file.listFiles();
|
||||
if (ArrayUtil.isEmpty(files)) {
|
||||
return Result.ok(resultPage);
|
||||
}
|
||||
List<String> fileNames = Arrays.stream(files)
|
||||
.filter(File::isFile)
|
||||
.sorted(Comparator.comparing(this::getLastModifiedTime).reversed())
|
||||
.map(File::getName)
|
||||
.collect(Collectors.toList());
|
||||
List<String> results = fileNames.subList(
|
||||
getStartIndex(pageNo, pageSize, fileNames.size()),
|
||||
getEndIndex(pageNo, pageSize, fileNames.size())
|
||||
);
|
||||
resultPage.setTotal(fileNames.size());
|
||||
resultPage.setRecords(results);
|
||||
return Result.ok(resultPage);
|
||||
}
|
||||
|
||||
private int getStartIndex(Integer pageNo, Integer pageSize, Integer listSize) {
|
||||
return Math.min(Math.max(0, pageNo - 1) * pageSize, Math.max(listSize, 0));
|
||||
}
|
||||
|
||||
private int getEndIndex(Integer pageNo, Integer pageSize, Integer listSize) {
|
||||
return Math.min(Math.max(1, pageNo) * pageSize, listSize);
|
||||
}
|
||||
|
||||
private Long getLastModifiedTime(File file) {
|
||||
try {
|
||||
Path path = file.toPath();
|
||||
BasicFileAttributes basicFileAttributes = Files.readAttributes(path, BasicFileAttributes.class);
|
||||
return basicFileAttributes.lastModifiedTime().toMillis();
|
||||
} catch (IOException e) {
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkPathExist() {
|
||||
return StrUtil.isNotBlank(loggingFilePath);
|
||||
}
|
||||
|
||||
private Path getLogPath(String service) {
|
||||
String validService = validFilter(service);
|
||||
return Paths.get(loggingFilePath).getParent().resolve(validService);
|
||||
}
|
||||
|
||||
private String validFilter(String str) {
|
||||
return StrUtil.strip(StrUtil.strip(StrUtil.replace(str, "..", ""), "/"), "\\");
|
||||
}
|
||||
|
||||
@Operation(description = "日志文件下载")
|
||||
@GetMapping("/file/down")
|
||||
@RequiresRoles("admin")
|
||||
public ResponseEntity<FileSystemResource> fileDown(String service, String filename) {
|
||||
log.info("文件下载service:{}\tfilename:{}", service, filename);
|
||||
try {
|
||||
File file = getLogPath(service).resolve(filename).normalize().toFile();
|
||||
if (file.exists()) {
|
||||
log.info("下载日志【{}】", filename);
|
||||
FileSystemResource resource = new FileSystemResource(file);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
String name = URLEncoder.encode(file.getName(), "UTF-8");
|
||||
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
headers.setContentDisposition(ContentDisposition.attachment().filename(name).build()
|
||||
);
|
||||
return new ResponseEntity<>(resource, headers, HttpStatus.OK);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件出错service:{}\tfilename:{}", service, filename, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Operation(description = "日志文件删除")
|
||||
@GetMapping("/file/delete")
|
||||
@RequiresRoles("admin")
|
||||
public Result<Boolean> fileDelete(String service, String filename) throws IOException {
|
||||
return Result.ok(Files.deleteIfExists(getLogPath(service).resolve(filename).normalize()));
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.service.ScalePersonalService;
|
||||
import org.jeecg.modules.system.vo.UserScalePersonalInfo;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/scalePersonal")
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class ScalePersonalApiController {
|
||||
private final ScalePersonalService scalePersonalService;
|
||||
|
||||
@Operation(summary = "查询用户蓝牙秤信息", description = "查询用户蓝牙秤信息")
|
||||
@GetMapping(value = "/queryByUser")
|
||||
public Result<UserScalePersonalInfo> queryByUser(){
|
||||
return Result.ok(scalePersonalService.queryByUser());
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import org.jeecg.base.UserBase;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.bean.response.ScalePersonalUserInfo;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.jeecg.modules.system.service.ScalePersonalService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author stan
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/sys")
|
||||
public class SysApiController {
|
||||
@Autowired
|
||||
private ScalePersonalService scalePersonalService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 通过小秤snCode获取用户信息
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@GetMapping("getUserInfoBySnCode")
|
||||
public Result<ScalePersonalUserInfo> getUserInfoBySnCode(@RequestParam String code) {
|
||||
return Result.ok(scalePersonalService.getUserInfoBySnCode(code));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过工号/手机号/idCard获取用户信息
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@GetMapping("getUserInfoByTypeCode")
|
||||
public Result<List<UserBase>> getUserInfoByTypeCode(@RequestParam String findCode) {
|
||||
return Result.ok(sysUserService.getUserInfoByTypeCode(findCode));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过工号/姓名查询用户
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@GetMapping("findUserByParam")
|
||||
public Result<List<UserBase>> findUserByParam(String findCode) {
|
||||
return Result.ok(sysUserService.findUserByParam(findCode));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.api.service.SysBannerApiService;
|
||||
import org.jeecg.modules.system.entity.SysBannerDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/api/banner")
|
||||
public class SysBannerApiController {
|
||||
|
||||
@Autowired
|
||||
private SysBannerApiService sysBannerApiService;
|
||||
|
||||
|
||||
@Operation(summary = "查询部门", description = "查询轮播图列表")
|
||||
@GetMapping("/selectBannerList")
|
||||
public Result<List<SysBannerDO>> selectBannerList(@RequestParam(value = "showLocation") String showLocation) {
|
||||
return sysBannerApiService.selectBannerList(showLocation);
|
||||
}
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.service.ISysDepartService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Shunzhi Jiang
|
||||
* @since 2023/7/13
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/core")
|
||||
public class SysCoreController {
|
||||
|
||||
@Autowired
|
||||
private ISysDepartService sysDepartService;
|
||||
|
||||
@GetMapping("/getDepartTree")
|
||||
public Result<List<String>> getDepartTree(@RequestParam("departId") String departId) {
|
||||
List<String> departTree = sysDepartService.getDepartTree(departId);
|
||||
return Result.ok(departTree);
|
||||
}
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.bean.request.SysMessageRemindDO;
|
||||
import org.jeecg.modules.api.service.SysMessageRemindApiService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息公告
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/api/messageRemind")
|
||||
public class SysMessageRemindApiController {
|
||||
|
||||
@Autowired
|
||||
private SysMessageRemindApiService sysMessageRemindApiService;
|
||||
|
||||
/**
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "查询消息公告列表", description = "查询消息公告列表")
|
||||
@GetMapping("/selectUserMessageList")
|
||||
public Result<List<SysMessageRemindDO>> selectUserMessageList(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
|
||||
return sysMessageRemindApiService.selectUserMessageList(pageNo, pageSize);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 消息变为已读
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "消息变为已读", description = "消息变为已读")
|
||||
@GetMapping("/changeAlRead")
|
||||
public Result<String> changeAlRead(@RequestParam(value = "id") String id) {
|
||||
return sysMessageRemindApiService.changeAlRead(id);
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.LimitSubmit;
|
||||
import org.jeecg.common.system.bean.request.SysUserEmergencyContactDO;
|
||||
import org.jeecg.modules.api.service.SysUserEmergencyContactService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 紧急联系人
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/api/emergencyContact")
|
||||
public class SysUserEmergencyContactApiController {
|
||||
|
||||
@Autowired
|
||||
private SysUserEmergencyContactService sysUserEmergencyContactService;
|
||||
|
||||
/**
|
||||
* 查询紧急联系人列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "查询紧急联系人列表", description = "查询紧急联系人列表")
|
||||
@GetMapping("/selectEmergencyContactList")
|
||||
public Result<List<SysUserEmergencyContactDO>> selectEmergencyContactList() {
|
||||
return sysUserEmergencyContactService.selectEmergencyContactList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或者修改紧急联系人
|
||||
*
|
||||
* @param sysUserEmergencyContactDO
|
||||
* @return
|
||||
*/
|
||||
@LimitSubmit(key = "updateAndInsertEmergencyContact:%s")
|
||||
@Operation(summary = "添加或者修改紧急联系人", description = "添加或者修改紧急联系人")
|
||||
@PostMapping("/updateAndInsertEmergencyContact")
|
||||
public Result<String> updateAndInsertEmergencyContact(@RequestBody @Validated SysUserEmergencyContactDO sysUserEmergencyContactDO) {
|
||||
|
||||
return sysUserEmergencyContactService.updateAndInsertEmergencyContact(sysUserEmergencyContactDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除紧急联系人列表
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@LimitSubmit(key = "removeEmergencyContactList:%s")
|
||||
@Operation(summary = "删除紧急联系人列表", description = "删除紧急联系人列表")
|
||||
@GetMapping("/removeEmergencyContactList")
|
||||
public Result<String> removeEmergencyContactList(@RequestParam(value = "id") String id) {
|
||||
return sysUserEmergencyContactService.removeEmergencyContactList(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1489
File diff suppressed because it is too large
Load Diff
+66
@@ -0,0 +1,66 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.bean.request.NoticeRead;
|
||||
import org.jeecg.modules.system.entity.SysNotice;
|
||||
import org.jeecg.modules.system.service.ISysNoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务化 system模块 对外接口请求类
|
||||
*
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/api/notice")
|
||||
public class SystemNoticeApiController {
|
||||
@Autowired
|
||||
private ISysNoticeService sysNoticeService;
|
||||
|
||||
|
||||
@PostMapping("/noticeRead")
|
||||
public Result<Boolean> noticeRead(@RequestBody @Validated NoticeRead noticeRead) {
|
||||
return Result.OK(sysNoticeService.noticeRead(noticeRead));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 按照类型获取通知
|
||||
*
|
||||
* @param category 分类
|
||||
* @return result
|
||||
*/
|
||||
@GetMapping()
|
||||
public Result<SysNotice> get(@RequestParam String category) {
|
||||
LambdaQueryWrapper<SysNotice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysNotice::getMsgCategory, category)
|
||||
.eq(SysNotice::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.eq(SysNotice::getSendStatus, CommonConstant.ANNOUNCEMENT_SEND_STATUS_1);
|
||||
|
||||
List<SysNotice> list = sysNoticeService.list(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return Result.ok(new SysNotice());
|
||||
}
|
||||
|
||||
return Result.ok(list.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* ios更新开关
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectIosUpdate")
|
||||
public Result<String> selectIosUpdate(@RequestParam(name = "type") String type) {
|
||||
String menu = sysNoticeService.selectIosUpdate(type);
|
||||
return Result.OK(menu);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.api.service;
|
||||
|
||||
|
||||
import org.jeecg.bean.response.KeyList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-04-24 16:25
|
||||
*/
|
||||
|
||||
public interface ApiHolidayService {
|
||||
boolean isHoliday(Integer year, Integer month, Integer day);
|
||||
|
||||
List<KeyList<Integer, Integer>> holidayList(Integer year, Integer month);
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package org.jeecg.modules.api.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.jeecg.modules.api.bean.FileEntity;
|
||||
import org.jeecg.modules.api.bean.ProjectEntity;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jiang Shunzhi
|
||||
*/
|
||||
public interface FrontendUpdateService {
|
||||
|
||||
List<ProjectEntity> frontendList();
|
||||
|
||||
Boolean frontendSave(ProjectEntity entity);
|
||||
|
||||
Boolean frontendRemove(String code);
|
||||
|
||||
IPage<FileEntity> frontendBackupList(String code, Integer page, Integer pageSize) throws IOException;
|
||||
|
||||
ResponseEntity<FileSystemResource> frontendBackupDownload(String code, String filename);
|
||||
|
||||
Boolean frontendBackupRemove(String code, String filename);
|
||||
|
||||
Boolean frontendUpdate(String code, String filename);
|
||||
|
||||
Boolean frontendUpload(String code, MultipartFile file);
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.api.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HealthUserStationExApiService {
|
||||
|
||||
|
||||
List<String> selectStationHospitalList();
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package org.jeecg.modules.api.service;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.SysBannerDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysBannerApiService {
|
||||
Result<List<SysBannerDO>> selectBannerList(String showLocation);
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package org.jeecg.modules.api.service;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.bean.request.SysMessageRemindDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysMessageRemindApiService {
|
||||
|
||||
Result<List<SysMessageRemindDO>> selectUserMessageList(int pageNo, int pageSize);
|
||||
|
||||
Result<String> changeAlRead(String id);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.api.service;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.bean.request.SysUserEmergencyContactDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysUserEmergencyContactService {
|
||||
|
||||
Result<List<SysUserEmergencyContactDO>> selectEmergencyContactList();
|
||||
|
||||
Result<String> updateAndInsertEmergencyContact(SysUserEmergencyContactDO sysUserEmergencyContactDO);
|
||||
|
||||
|
||||
Result<String> removeEmergencyContactList(String id);
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package org.jeecg.modules.api.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.jeecg.bean.response.KeyList;
|
||||
import org.jeecg.modules.api.service.ApiHolidayService;
|
||||
import org.jeecg.modules.system.entity.HealthHoliday;
|
||||
import org.jeecg.modules.system.mapper.HealthHolidayMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-04-24 16:25
|
||||
*/
|
||||
@Service("apiHolidayService")
|
||||
public class ApiHolidayServiceImpl implements ApiHolidayService {
|
||||
|
||||
@Autowired
|
||||
private HealthHolidayMapper healthHolidayMapper;
|
||||
|
||||
@Override
|
||||
public boolean isHoliday(Integer year, Integer month, Integer day) {
|
||||
LambdaQueryWrapper<HealthHoliday> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(HealthHoliday::getYear, year);
|
||||
queryWrapper.eq(HealthHoliday::getMonth, month);
|
||||
queryWrapper.eq(HealthHoliday::getDay, day);
|
||||
return healthHolidayMapper.exists(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KeyList<Integer, Integer>> holidayList(Integer year, Integer month) {
|
||||
LambdaQueryWrapper<HealthHoliday> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(HealthHoliday::getYear, year);
|
||||
if (month != null) {
|
||||
queryWrapper.eq(HealthHoliday::getMonth, month);
|
||||
}
|
||||
List<HealthHoliday> value = healthHolidayMapper.selectList(queryWrapper);
|
||||
|
||||
if (CollectionUtils.isEmpty(value)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// return
|
||||
List<KeyList<Integer, Integer>> result = new ArrayList<>();
|
||||
|
||||
Map<Integer, List<HealthHoliday>> collect = value.stream().collect(Collectors.groupingBy(HealthHoliday::getMonth));
|
||||
collect.forEach((integer, healthHolidays) -> {
|
||||
|
||||
KeyList<Integer, Integer> holiday = new KeyList<>();
|
||||
|
||||
List<Integer> days = new ArrayList<>();
|
||||
healthHolidays.forEach(healthHoliday -> days.add(healthHoliday.getDay()));
|
||||
holiday.setKey(integer);
|
||||
holiday.setList(days);
|
||||
|
||||
result.add(holiday);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
package org.jeecg.modules.api.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.file.visitor.DelVisitor;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.compress.CompressUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.modules.api.bean.FileEntity;
|
||||
import org.jeecg.modules.api.bean.ProjectEntity;
|
||||
import org.jeecg.modules.api.service.FrontendUpdateService;
|
||||
import org.jeecg.util.PageUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Jiang Shunzhi
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FrontendUpdateServiceImpl implements FrontendUpdateService {
|
||||
|
||||
private static final String PROJECT_CACHE = "system:frontend:project";
|
||||
|
||||
@Value("${renkang.backup.path:/backup/frontend}")
|
||||
private String backupPath;
|
||||
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Autowired
|
||||
public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectEntity> frontendList() {
|
||||
HashOperations<String, String, ProjectEntity> hashOperations = redisTemplate.opsForHash();
|
||||
return hashOperations.values(PROJECT_CACHE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean frontendSave(ProjectEntity entity) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(PROJECT_CACHE, entity.getCode(), entity);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("Save project error: {}", entity, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean frontendRemove(String code) {
|
||||
try {
|
||||
redisTemplate.opsForHash().delete(PROJECT_CACHE, code);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("Remove project error: {}", code, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<FileEntity> frontendBackupList(String code, Integer page, Integer pageSize) throws IOException {
|
||||
Page<FileEntity> resultPage = Page.of(page, pageSize);
|
||||
if (!redisTemplate.opsForHash().hasKey(PROJECT_CACHE, code)) {
|
||||
return resultPage;
|
||||
}
|
||||
Path path = checkPath(code);
|
||||
File file = path.normalize().toFile();
|
||||
File[] files = file.listFiles();
|
||||
if (ArrayUtil.isEmpty(files)) {
|
||||
return resultPage;
|
||||
}
|
||||
List<FileEntity> fileNames = Arrays.stream(files)
|
||||
.filter(File::isFile)
|
||||
.map(this::convert)
|
||||
.sorted(Comparator.comparing(FileEntity::getModifyTime))
|
||||
.collect(Collectors.toList());
|
||||
List<FileEntity> results = fileNames.subList(
|
||||
PageUtil.getStartIndex(page, pageSize, fileNames.size()),
|
||||
PageUtil.getEndIndex(page, pageSize, fileNames.size())
|
||||
);
|
||||
resultPage.setTotal(fileNames.size());
|
||||
resultPage.setRecords(results);
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<FileSystemResource> frontendBackupDownload(String code, String filename) {
|
||||
log.info("下载code:{}\tfilename:{}", code, filename);
|
||||
try {
|
||||
File file = checkPath(code).resolve(filename).normalize().toFile();
|
||||
if (file.exists()) {
|
||||
FileSystemResource resource = new FileSystemResource(file);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
String name = URLEncoder.encode(file.getName(), "UTF-8");
|
||||
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
headers.setContentDisposition(ContentDisposition.attachment().filename(name).build()
|
||||
);
|
||||
return new ResponseEntity<>(resource, headers, HttpStatus.OK);
|
||||
} else {
|
||||
throw new JeecgBootException("文件不存在");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件出错code:{}\tfilename:{}", code, filename, e);
|
||||
throw new JeecgBootException("下载文件出错", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean frontendBackupRemove(String code, String filename) {
|
||||
try {
|
||||
Path filePath = checkPath(code).resolve(filename).normalize();
|
||||
return Files.deleteIfExists(filePath);
|
||||
} catch (IOException e) {
|
||||
log.error("删除文件出错code:{}\tfilename:{}", code, filename, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean frontendUpload(String code, MultipartFile file) {
|
||||
String filename = getFilename(file.getOriginalFilename());
|
||||
try (InputStream fileInputStream = file.getInputStream()) {
|
||||
Path filePath = checkPath(code).resolve(filename).normalize();
|
||||
Files.copy(fileInputStream, filePath);
|
||||
} catch (IOException e) {
|
||||
log.error("保存文件出错code:{}\tfilename:{}", code, filename, e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getFilename(String rawName) {
|
||||
log.info("上传文件名:{}", rawName);
|
||||
String timeStr = DateUtil.format(DateUtil.date(), DatePattern.PURE_DATETIME_FORMAT);
|
||||
String extName = FileUtil.extName(rawName);
|
||||
return timeStr + StrUtil.DOT + extName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean frontendUpdate(String code, String filename) {
|
||||
try {
|
||||
Path projectPath = getPrjectPath(code);
|
||||
Files.walkFileTree(projectPath, new DelVisitor() {
|
||||
@Override
|
||||
public FileVisitResult postVisitDirectory(Path dir, IOException e) {
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
Path filePath = checkPath(code).resolve(filename).normalize();
|
||||
CompressUtil.createExtractor(Charset.defaultCharset(), filePath.toFile()).extract(projectPath.toFile());
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
log.error("文件不存在code:{}\tfilename:{}", code, filename, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private Path getPrjectPath(String code) throws IOException {
|
||||
HashOperations<String, String, ProjectEntity> hashOperations = redisTemplate.opsForHash();
|
||||
if (!hashOperations.hasKey(PROJECT_CACHE, code)) {
|
||||
throw new JeecgBootException("项目不存在");
|
||||
}
|
||||
ProjectEntity projectEntity = hashOperations.get(PROJECT_CACHE, code);
|
||||
if (ObjectUtil.isNull(projectEntity)) {
|
||||
throw new JeecgBootException("项目不存在");
|
||||
}
|
||||
Path path = Paths.get(projectEntity.getPath());
|
||||
Files.createDirectories(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
private Path checkPath(String code) throws IOException {
|
||||
Path path = Paths.get(backupPath).resolve(code);
|
||||
Files.createDirectories(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
private Long getLastModifiedTime(File file) {
|
||||
try {
|
||||
Path path = file.toPath();
|
||||
BasicFileAttributes basicFileAttributes = Files.readAttributes(path, BasicFileAttributes.class);
|
||||
return basicFileAttributes.lastModifiedTime().toMillis();
|
||||
} catch (IOException e) {
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
private FileEntity convert(File file) {
|
||||
return new FileEntity()
|
||||
.setFileName(file.getName())
|
||||
.setModifyTime(DateUtil.date(getLastModifiedTime(file)));
|
||||
}
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package org.jeecg.modules.api.service.impl;
|
||||
|
||||
import org.jeecg.modules.api.service.HealthUserStationExApiService;
|
||||
import org.jeecg.modules.system.mapper.HealthUserStationExMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service("healthUserStationExApiService")
|
||||
public class HealthUserStationExApiServiceImpl implements HealthUserStationExApiService {
|
||||
|
||||
@Autowired
|
||||
private HealthUserStationExMapper healthUserStationExMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> selectStationHospitalList() {
|
||||
|
||||
List<String> list = healthUserStationExMapper.selectStationHospitalList();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package org.jeecg.modules.api.service.impl;
|
||||
|
||||
import com.aliyuncs.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.global.GlobalUtils;
|
||||
import org.jeecg.modules.api.service.SysBannerApiService;
|
||||
import org.jeecg.modules.system.entity.SysBanner;
|
||||
import org.jeecg.modules.system.entity.SysBannerDO;
|
||||
import org.jeecg.modules.system.mapper.HealthHolidayMapper;
|
||||
import org.jeecg.modules.system.mapper.SysBannerMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("sysBannerApiService")
|
||||
public class SysBannerApiServiceImpl implements SysBannerApiService {
|
||||
|
||||
@Autowired
|
||||
private HealthHolidayMapper healthHolidayMapper;
|
||||
@Autowired
|
||||
private SysBannerMapper sysBannerMapper;
|
||||
|
||||
@Override
|
||||
public Result<List<SysBannerDO>> selectBannerList(String showLocation) {
|
||||
|
||||
if (StringUtils.isEmpty(showLocation)) {
|
||||
return Result.error("请选择展示的位置");
|
||||
}
|
||||
|
||||
List<SysBannerDO> list = healthHolidayMapper.selectBannerList(showLocation);
|
||||
|
||||
// 添加长期有效的banner
|
||||
list.addAll(getLongTermEffectiveBanner(showLocation));
|
||||
// 去重返回
|
||||
return Result.ok(list.stream().distinct().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
private List<SysBannerDO> getLongTermEffectiveBanner(String showLocation) {
|
||||
LambdaQueryWrapper<SysBanner> queryWrapper = GlobalUtils.getLambdaQueryWrapper();
|
||||
queryWrapper.eq(SysBanner::getIsLongTermEffective, CommonConstant.YES)
|
||||
.eq(SysBanner::getShowLocation, showLocation);
|
||||
|
||||
List<SysBanner> sysBanners = sysBannerMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(sysBanners)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<SysBannerDO> result = new ArrayList<>();
|
||||
GlobalUtils.convertList(sysBanners, result, SysBannerDO.class);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package org.jeecg.modules.api.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.bean.request.SysMessageRemindDO;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.api.service.SysMessageRemindApiService;
|
||||
import org.jeecg.modules.system.entity.SysMessageRemind;
|
||||
import org.jeecg.modules.system.mapper.SysMessageRemindMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service("sysMessageRemindApiService")
|
||||
public class SysMessageRemindApiServiceImpl implements SysMessageRemindApiService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysMessageRemindMapper sysMessageRemindMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
public Result<List<SysMessageRemindDO>> selectUserMessageList(int pageNo, int pageSize) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = "";
|
||||
if (sysUser != null) {
|
||||
userId = sysUser.getId();
|
||||
}
|
||||
|
||||
Page<SysMessageRemind> page = new Page<SysMessageRemind>(pageNo, pageSize);
|
||||
List<SysMessageRemind> list = sysMessageRemindMapper.selectUserMessageList(page, userId);
|
||||
|
||||
List<SysMessageRemindDO> newList = new ArrayList<>();
|
||||
|
||||
for (SysMessageRemind sysMessageRemind : list) {
|
||||
|
||||
if (!StringUtils.isEmpty(userId)) {
|
||||
String key = "sys:message_remind_" + userId;
|
||||
if (StringUtils.isEmpty(sysMessageRemind.getUserId())) {
|
||||
Double aa = redisTemplate.opsForZSet().score(key, sysMessageRemind.getId());
|
||||
if (aa != null) {
|
||||
sysMessageRemind.setState("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
newList.add(BeanUtil.copyProperties(sysMessageRemind, SysMessageRemindDO.class));
|
||||
}
|
||||
|
||||
return Result.ok(newList);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Result<String> changeAlRead(String id) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String key = "sys:message_remind_" + sysUser.getId();
|
||||
SysMessageRemind sysMessageRemind = sysMessageRemindMapper.selectById(id);
|
||||
if (sysMessageRemind == null) {
|
||||
return Result.ok();
|
||||
}
|
||||
String userId = sysMessageRemind.getUserId();
|
||||
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
redisTemplate.opsForZSet().add(key, id, new Date().getTime());
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
sysMessageRemindMapper.changeAlRead(id);
|
||||
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package org.jeecg.modules.api.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.aliyuncs.utils.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.bean.request.SysUserEmergencyContactDO;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.api.service.SysUserEmergencyContactService;
|
||||
import org.jeecg.modules.system.entity.SysUserEmergencyContact;
|
||||
import org.jeecg.modules.system.mapper.SysUserEmergencyContactMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service("sysUserEmergencyContactService")
|
||||
public class SysUserEmergencyContactServiceImpl implements SysUserEmergencyContactService {
|
||||
|
||||
@Autowired
|
||||
private SysUserEmergencyContactMapper sysUserEmergencyContactMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Result<List<SysUserEmergencyContactDO>> selectEmergencyContactList() {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
List<SysUserEmergencyContactDO> list = sysUserEmergencyContactMapper.selectEmergencyContactListByUserId(sysUser.getId());
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> updateAndInsertEmergencyContact(SysUserEmergencyContactDO sysUserEmergencyContactDO) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUserEmergencyContactDO == null) {
|
||||
return Result.error("请填写数据");
|
||||
}
|
||||
|
||||
SysUserEmergencyContact sysUserEmergencyContact = BeanUtil.copyProperties(sysUserEmergencyContactDO, SysUserEmergencyContact.class);
|
||||
sysUserEmergencyContact.setUserId(sysUser.getId());
|
||||
if (StringUtils.isEmpty(sysUserEmergencyContact.getId())) {
|
||||
sysUserEmergencyContact.setCreateTime(new Date());
|
||||
sysUserEmergencyContactMapper.insert(sysUserEmergencyContact);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
sysUserEmergencyContact.setUpdateTime(new Date());
|
||||
sysUserEmergencyContactMapper.updateById(sysUserEmergencyContact);
|
||||
|
||||
return Result.ok("1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> removeEmergencyContactList(String id) {
|
||||
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return Result.error("请选择紧急联系人");
|
||||
}
|
||||
|
||||
SysUserEmergencyContactDO sysUserEmergencyContactDO = sysUserEmergencyContactMapper.selectEmergencyContactListById(id);
|
||||
|
||||
if (sysUserEmergencyContactDO == null) {
|
||||
return Result.error("紧急联系人不存在");
|
||||
}
|
||||
|
||||
sysUserEmergencyContactMapper.deleteEmergencyContactById(id);
|
||||
|
||||
return Result.ok("1");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package org.jeecg.modules.manager;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.vo.SysCategoryModel;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.system.entity.SysCategory;
|
||||
import org.jeecg.modules.system.entity.SysConfig;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.mapper.SysCategoryMapper;
|
||||
import org.jeecg.modules.system.mapper.SysConfigMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 系统缓存
|
||||
*
|
||||
* @author Junqiang Zhu
|
||||
* @date 2023-04-06 10:46
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class SysCache {
|
||||
private final Map<String, SysDepart> departByIdMap = new HashMap<>();
|
||||
private final Map<String, SysDepart> departByOrgCodeMap = new HashMap<>();
|
||||
private final String departCacheTypeID = "0";
|
||||
private final String departCacheTypeCode = "1";
|
||||
@Resource
|
||||
private SysCategoryMapper sysCategoryMapper;
|
||||
@Resource
|
||||
private SysConfigMapper sysConfigMapper;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private CacheManager cacheManager;
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 缓存所有分类字典
|
||||
cacheCategory();
|
||||
// 缓存所有配置
|
||||
cacheConfig();
|
||||
}
|
||||
|
||||
|
||||
//==========================================配置相关===============================================//
|
||||
private void cacheConfig() {
|
||||
// clean 缓存
|
||||
delSysConfigCache();
|
||||
// 查找数据
|
||||
LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysConfig::getDelFlag, CommonConstant.DEL_FLAG_0);
|
||||
List<SysConfig> list = sysConfigMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
// 缓存配置
|
||||
list.forEach(sysConfig -> redisUtil.set(CommonConstant.SYS_CACHE_CONFIG_KEY + ":" + sysConfig.getConfigKey(), sysConfig.getConfigValue()));
|
||||
}
|
||||
|
||||
@Cacheable(value = CommonConstant.SYS_CACHE_CONFIG_KEY, key = "#code", unless = "#result == null ")
|
||||
public String getConfigValue(String code) {
|
||||
LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysConfig::getConfigKey, code);
|
||||
List<SysConfig> list = sysConfigMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0).getConfigValue();
|
||||
}
|
||||
|
||||
private void delSysConfigCache() {
|
||||
String key = CommonConstant.SYS_CACHE_CONFIG_KEY + ":*";
|
||||
Set<String> keys = redisTemplate.keys(key);
|
||||
redisTemplate.delete(keys);
|
||||
}
|
||||
|
||||
//==========================================分类相关===============================================//
|
||||
private void cacheCategory() {
|
||||
List<SysCategory> categories = sysCategoryMapper.selectList(null);
|
||||
if (CollectionUtils.isEmpty(categories)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 所有的顶级分类
|
||||
List<SysCategory> collect = categories.parallelStream()
|
||||
.filter(f -> CommonConstant.TOP_CATEGORY.equals(f.getPid()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<SysCategory> list = new ArrayList<>();
|
||||
|
||||
for (SysCategory category : collect) {
|
||||
getChild(category.getId(), categories, list);
|
||||
handleCategory(category.getName(), list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleCategory(String categoryName, List<SysCategory> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> map = listToMap(list);
|
||||
redisUtil.hmset(CommonConstant.CATEGORY_REDIS_KEY + categoryName, map);
|
||||
}
|
||||
|
||||
private Map<String, Object> listToMap(List<SysCategory> list) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
list.forEach(sysCategory -> {
|
||||
SysCategoryModel sysCategoryModel = new SysCategoryModel();
|
||||
BeanUtil.copyProperties(sysCategory, sysCategoryModel);
|
||||
map.put(sysCategory.getId(), sysCategoryModel);
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
private void getChild(String id, List<SysCategory> source, List<SysCategory> target) {
|
||||
|
||||
List<SysCategory> collect = source.parallelStream()
|
||||
.filter(f -> id.equals(f.getPid()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtils.isEmpty(collect)) {
|
||||
return;
|
||||
}
|
||||
|
||||
target.addAll(collect);
|
||||
|
||||
for (SysCategory category : collect) {
|
||||
getChild(category.getId(), source, target);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package org.jeecg.modules.message.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
import org.jeecg.modules.message.service.ISysMessageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-04-09
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/message/sysMessage")
|
||||
public class SysMessageController extends JeecgController<SysMessage, ISysMessageService> {
|
||||
@Autowired
|
||||
private ISysMessageService sysMessageService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysMessage
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(SysMessage sysMessage, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<SysMessage> queryWrapper = QueryGenerator.initQueryWrapper(sysMessage, req.getParameterMap());
|
||||
Page<SysMessage> page = new Page<SysMessage>(pageNo, pageSize);
|
||||
IPage<SysMessage> pageList = sysMessageService.page(page, queryWrapper);
|
||||
return Result.ok(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysMessage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysMessage sysMessage) {
|
||||
sysMessageService.save(sysMessage);
|
||||
return Result.ok("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysMessage
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody SysMessage sysMessage) {
|
||||
sysMessageService.updateById(sysMessage);
|
||||
return Result.ok("修改成功!");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysMessageService.removeById(id);
|
||||
return Result.ok("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
|
||||
this.sysMessageService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.ok("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysMessage sysMessage = sysMessageService.getById(id);
|
||||
return Result.ok(sysMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
@GetMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysMessage sysMessage) {
|
||||
return super.exportXls(request, sysMessage, SysMessage.class, "推送消息模板");
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导入
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysMessage.class);
|
||||
}
|
||||
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.message.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.BusTemplateMessageDTO;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.message.entity.MsgParams;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||
import org.jeecg.modules.message.util.PushMsgUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Sate: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/message/sysMessageTemplate")
|
||||
public class SysMessageTemplateController extends JeecgController<SysMessageTemplate, ISysMessageTemplateService> {
|
||||
@Autowired
|
||||
private ISysMessageTemplateService sysMessageTemplateService;
|
||||
@Autowired
|
||||
private PushMsgUtil pushMsgUtil;
|
||||
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseApi;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysMessageTemplate
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(SysMessageTemplate sysMessageTemplate, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<SysMessageTemplate> queryWrapper = QueryGenerator.initQueryWrapper(sysMessageTemplate, req.getParameterMap());
|
||||
Page<SysMessageTemplate> page = new Page<SysMessageTemplate>(pageNo, pageSize);
|
||||
IPage<SysMessageTemplate> pageList = sysMessageTemplateService.page(page, queryWrapper);
|
||||
return Result.ok(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysMessageTemplate
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysMessageTemplate sysMessageTemplate) {
|
||||
sysMessageTemplateService.save(sysMessageTemplate);
|
||||
return Result.ok("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysMessageTemplate
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody SysMessageTemplate sysMessageTemplate) {
|
||||
sysMessageTemplateService.updateById(sysMessageTemplate);
|
||||
return Result.ok("更新成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysMessageTemplateService.removeById(id);
|
||||
return Result.ok("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sysMessageTemplateService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.ok("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysMessageTemplate sysMessageTemplate = sysMessageTemplateService.getById(id);
|
||||
return Result.ok(sysMessageTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
@GetMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysMessageTemplate sysMessageTemplate) {
|
||||
return super.exportXls(request, sysMessageTemplate, SysMessageTemplate.class, "推送消息模板");
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导入
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysMessageTemplate.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*/
|
||||
// @PostMapping(value = "/sendMsg")
|
||||
// public Result<SysMessageTemplate> sendMessage(@RequestBody MsgParams msgParams) {
|
||||
// Result<SysMessageTemplate> result = new Result<SysMessageTemplate>();
|
||||
// try {
|
||||
// MessageDTO md = new MessageDTO();
|
||||
// md.setToAll(false);
|
||||
// md.setTitle("消息发送测试");
|
||||
// md.setTemplateCode(msgParams.getTemplateCode());
|
||||
// md.setToUser(msgParams.getReceiver());
|
||||
// md.setType(msgParams.getMsgType());
|
||||
// String testData = msgParams.getTestData();
|
||||
// if (oConvertUtils.isNotEmpty(testData)) {
|
||||
// Map<String, Object> data = JSON.parseObject(testData, Map.class);
|
||||
// md.setData(data);
|
||||
// }
|
||||
// sysBaseApi.sendTemplateMessage(md);
|
||||
// return result.success("消息发送成功!");
|
||||
// } catch (Exception e) {
|
||||
// log.error("发送消息出错", e.getMessage());
|
||||
// return result.error500("发送消息出错!");
|
||||
// }
|
||||
// }
|
||||
@PostMapping(value = "/sendTestSms")
|
||||
public Result<SysMessageTemplate> sendMessage(@RequestBody MsgParams msgParams) {
|
||||
//发送短信
|
||||
String busType = "test";
|
||||
String busId = "testid";
|
||||
String testData = msgParams.getTestData();
|
||||
sysBaseApi.sendBusSms(
|
||||
new BusTemplateMessageDTO("admin", msgParams.getReceiver(), JSON.parseObject(testData, Map.class), msgParams.getTemplateCode(), busType,busId,false));
|
||||
return Result.ok("添加发送任务成功,请在消息中心查看!");
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package org.jeecg.modules.message.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.WebsocketConst;
|
||||
import org.jeecg.modules.message.websocket.WebSocket;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Description: TestSocketController
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/socketTest")
|
||||
public class TestSocketController {
|
||||
|
||||
@Autowired
|
||||
private WebSocket webSocket;
|
||||
|
||||
@PostMapping("/sendAll")
|
||||
public Result<String> sendAll(@RequestBody JSONObject jsonObject) {
|
||||
Result<String> result = new Result<String>();
|
||||
String message = jsonObject.getString("message");
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_TOPIC);
|
||||
obj.put(WebsocketConst.MSG_ID, "M0001");
|
||||
obj.put(WebsocketConst.MSG_TXT, message);
|
||||
webSocket.sendMessage(obj.toJSONString());
|
||||
result.setResult("群发!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("/sendUser")
|
||||
public Result<String> sendUser(@RequestBody JSONObject jsonObject) {
|
||||
Result<String> result = new Result<String>();
|
||||
String userId = jsonObject.getString("userId");
|
||||
String message = jsonObject.getString("message");
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_USER);
|
||||
obj.put(WebsocketConst.MSG_USER_ID, userId);
|
||||
obj.put(WebsocketConst.MSG_ID, "M0001");
|
||||
obj.put(WebsocketConst.MSG_TXT, message);
|
||||
webSocket.sendMessage(userId, obj.toJSONString());
|
||||
result.setResult("单发");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package org.jeecg.modules.message.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 发送消息实体
|
||||
*
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@Data
|
||||
public class MsgParams implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private String msgType;
|
||||
|
||||
/**
|
||||
* 消息接收方
|
||||
*/
|
||||
private String receiver;
|
||||
|
||||
/**
|
||||
* 消息模板码
|
||||
*/
|
||||
private String templateCode;
|
||||
|
||||
/**
|
||||
* 测试数据
|
||||
*/
|
||||
private String testData;
|
||||
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
package org.jeecg.modules.message.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_sms")
|
||||
public class SysMessage extends JeecgEntity {
|
||||
/**
|
||||
* 推送内容
|
||||
*/
|
||||
@Excel(name = "推送内容", width = 15)
|
||||
private java.lang.String esContent;
|
||||
/**
|
||||
* 推送所需参数Json格式
|
||||
*/
|
||||
@Excel(name = "推送所需参数Json格式", width = 15)
|
||||
private java.lang.String esParam;
|
||||
/**
|
||||
* 接收人
|
||||
*/
|
||||
@Excel(name = "接收人", width = 15)
|
||||
private java.lang.String esReceiver;
|
||||
/**
|
||||
* 推送失败原因
|
||||
*/
|
||||
@Excel(name = "推送失败原因", width = 15)
|
||||
private java.lang.String esResult;
|
||||
/**
|
||||
* 发送次数
|
||||
*/
|
||||
@Excel(name = "发送次数", width = 15)
|
||||
private java.lang.Integer esSendNum;
|
||||
/**
|
||||
* 推送状态 0未推送 1推送成功 2推送失败
|
||||
*/
|
||||
@Excel(name = "推送状态 0未推送 1推送成功 2推送失败", width = 15)
|
||||
@Dict(dicCode = "msgSendStatus")
|
||||
private java.lang.String esSendStatus;
|
||||
/**
|
||||
* 推送时间
|
||||
*/
|
||||
@Excel(name = "推送时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date esSendTime;
|
||||
/**
|
||||
* 消息标题
|
||||
*/
|
||||
@Excel(name = "消息标题", width = 15)
|
||||
private java.lang.String esTitle;
|
||||
/**
|
||||
* 推送方式:参考枚举类MessageTypeEnum
|
||||
*/
|
||||
@Excel(name = "推送方式", width = 15)
|
||||
@Dict(dicCode = "es_type")
|
||||
private java.lang.String esType;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
private java.lang.String remark;
|
||||
|
||||
@Excel(name = "业务ID", width = 15)
|
||||
private String noticeId;
|
||||
|
||||
@Excel(name = "业务类型", width = 15)
|
||||
private String busType;
|
||||
|
||||
@Excel(name = "模板编码", width = 15)
|
||||
private String templateCode;
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package org.jeecg.modules.message.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_sms_template")
|
||||
public class SysMessageTemplate extends JeecgEntity {
|
||||
/**
|
||||
* 模板CODE
|
||||
*/
|
||||
@Excel(name = "模板CODE", width = 15)
|
||||
private java.lang.String templateCode;
|
||||
/**
|
||||
* 模板标题
|
||||
*/
|
||||
@Excel(name = "模板标题", width = 30)
|
||||
private java.lang.String templateName;
|
||||
/**
|
||||
* 模板内容
|
||||
*/
|
||||
@Excel(name = "模板内容", width = 50)
|
||||
private java.lang.String templateContent;
|
||||
/**
|
||||
* 模板测试json
|
||||
*/
|
||||
@Excel(name = "模板测试json", width = 15)
|
||||
private java.lang.String templateTestJson;
|
||||
/**
|
||||
* 模板类型
|
||||
*/
|
||||
@Excel(name = "模板类型", width = 15)
|
||||
private java.lang.String templateType;
|
||||
|
||||
/**
|
||||
* 已经应用/未应用 1是0否
|
||||
*/
|
||||
@Excel(name = "应用状态", width = 15)
|
||||
private String useStatus;
|
||||
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package org.jeecg.modules.message.enums;
|
||||
|
||||
import org.jeecg.common.system.annotation.EnumDict;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用于消息数据查询【vue3】
|
||||
* 新版系统通知查询条件
|
||||
*
|
||||
* @Author taoYan
|
||||
* @Date 2022/8/19 20:41
|
||||
**/
|
||||
@EnumDict("rangeDate")
|
||||
public enum RangeDateEnum {
|
||||
|
||||
JT("jt", "今天"),
|
||||
ZT("zt", "昨天"),
|
||||
QT("qt", "前天"),
|
||||
BZ("bz", "本周"),
|
||||
SZ("sz", "上周"),
|
||||
BY("by", "本月"),
|
||||
SY("sy", "上月"),
|
||||
ZDY("zdy", "自定义日期");
|
||||
|
||||
String key;
|
||||
|
||||
String title;
|
||||
|
||||
RangeDateEnum(String key, String title) {
|
||||
this.key = key;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<DictModel> getDictList() {
|
||||
List<DictModel> list = new ArrayList<>();
|
||||
DictModel dictModel = null;
|
||||
for (RangeDateEnum e : RangeDateEnum.values()) {
|
||||
dictModel = new DictModel();
|
||||
dictModel.setValue(e.key);
|
||||
dictModel.setText(e.title);
|
||||
list.add(dictModel);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key 获取范围时间值
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static Date[] getRangeArray(String key) {
|
||||
Calendar calendar1 = Calendar.getInstance();
|
||||
Calendar calendar2 = Calendar.getInstance();
|
||||
Date[] array = new Date[2];
|
||||
boolean flag = false;
|
||||
if (JT.key.equals(key)) {
|
||||
//今天
|
||||
} else if (ZT.key.equals(key)) {
|
||||
//昨天
|
||||
calendar1.add(Calendar.DAY_OF_YEAR, -1);
|
||||
calendar2.add(Calendar.DAY_OF_YEAR, -1);
|
||||
} else if (QT.key.equals(key)) {
|
||||
//前天
|
||||
calendar1.add(Calendar.DAY_OF_YEAR, -2);
|
||||
calendar2.add(Calendar.DAY_OF_YEAR, -2);
|
||||
} else if (BZ.key.equals(key)) {
|
||||
//本周
|
||||
calendar1.set(Calendar.DAY_OF_WEEK, 2);
|
||||
|
||||
calendar2.add(Calendar.WEEK_OF_MONTH, 1);
|
||||
calendar2.add(Calendar.DAY_OF_WEEK, -1);
|
||||
} else if (SZ.key.equals(key)) {
|
||||
//本周一减一周
|
||||
calendar1.set(Calendar.DAY_OF_WEEK, 2);
|
||||
calendar1.add(Calendar.WEEK_OF_MONTH, -1);
|
||||
|
||||
// 本周一减一天
|
||||
calendar2.set(Calendar.DAY_OF_WEEK, 2);
|
||||
calendar2.add(Calendar.DAY_OF_WEEK, -1);
|
||||
} else if (BY.key.equals(key)) {
|
||||
//本月
|
||||
calendar1.set(Calendar.DAY_OF_MONTH, 1);
|
||||
|
||||
calendar2.set(Calendar.DAY_OF_MONTH, 1);
|
||||
calendar2.add(Calendar.MONTH, 1);
|
||||
calendar2.add(Calendar.DAY_OF_MONTH, -1);
|
||||
} else if (SY.key.equals(key)) {
|
||||
//本月第一天减一月
|
||||
calendar1.set(Calendar.DAY_OF_MONTH, 1);
|
||||
calendar1.add(Calendar.MONTH, -1);
|
||||
|
||||
//本月第一天减一天
|
||||
calendar2.set(Calendar.DAY_OF_MONTH, 1);
|
||||
calendar2.add(Calendar.DAY_OF_MONTH, -1);
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
if (flag) {
|
||||
return null;
|
||||
}
|
||||
// 开始时间00:00:00 结束时间23:59:59
|
||||
calendar1.set(Calendar.HOUR, 0);
|
||||
calendar1.set(Calendar.MINUTE, 0);
|
||||
calendar1.set(Calendar.SECOND, 0);
|
||||
calendar1.set(Calendar.MILLISECOND, 0);
|
||||
calendar2.set(Calendar.HOUR, 23);
|
||||
calendar2.set(Calendar.MINUTE, 59);
|
||||
calendar2.set(Calendar.SECOND, 59);
|
||||
calendar2.set(Calendar.MILLISECOND, 999);
|
||||
array[0] = calendar1.getTime();
|
||||
array[1] = calendar2.getTime();
|
||||
return array;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package org.jeecg.modules.message.enums;
|
||||
|
||||
import org.jeecg.common.system.annotation.EnumDict;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息跳转【vue3】
|
||||
*
|
||||
* @Author taoYan
|
||||
* @Date 2022/8/19 20:41
|
||||
**/
|
||||
@EnumDict("messageHref")
|
||||
public enum Vue3MessageHrefEnum {
|
||||
|
||||
/**
|
||||
* 流程催办
|
||||
*/
|
||||
BPM("bpm", "/task/myHandleTaskInfo"),
|
||||
|
||||
/**
|
||||
* 节点通知
|
||||
*/
|
||||
BPM_TASK("bpm_task", "/task/myHandleTaskInfo"),
|
||||
|
||||
/**
|
||||
* 邮件消息
|
||||
*/
|
||||
EMAIL("email", "/eoa/email");
|
||||
|
||||
String busType;
|
||||
|
||||
String path;
|
||||
|
||||
Vue3MessageHrefEnum(String busType, String path) {
|
||||
this.busType = busType;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<DictModel> getDictList() {
|
||||
List<DictModel> list = new ArrayList<>();
|
||||
DictModel dictModel = null;
|
||||
for (Vue3MessageHrefEnum e : Vue3MessageHrefEnum.values()) {
|
||||
dictModel = new DictModel();
|
||||
dictModel.setValue(e.getBusType());
|
||||
dictModel.setText(e.getPath());
|
||||
list.add(dictModel);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String getBusType() {
|
||||
return busType;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package org.jeecg.modules.message.handle;
|
||||
|
||||
import org.jeecg.common.api.dto.message.BusMessageDTO;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
/**
|
||||
* @Description: 发送信息接口
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
public interface ISendMsgHandle {
|
||||
|
||||
/**
|
||||
* 发送信息
|
||||
*
|
||||
* @param esReceiver 接受人
|
||||
* @param esTitle 标题
|
||||
* @param esContent 内容
|
||||
*/
|
||||
void sendMsg(String esReceiver, String esTitle, String esContent);
|
||||
|
||||
|
||||
/**
|
||||
* 业务相关发送信息
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
Result<?> sendCqSms(int pageSize,boolean isBatch);
|
||||
|
||||
/**
|
||||
* 发送信息
|
||||
*
|
||||
* @param messageDTO
|
||||
*/
|
||||
default void sendMessage(MessageDTO messageDTO) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package org.jeecg.modules.message.handle.enums;
|
||||
|
||||
/**
|
||||
* 推送状态枚举
|
||||
*
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
public enum SendMsgStatusEnum {
|
||||
|
||||
//推送状态 0未推送 1推送成功 2推送失败
|
||||
WAIT("0"), SUCCESS("1"), FAIL("2"), SENDING("3");
|
||||
|
||||
private String code;
|
||||
|
||||
private SendMsgStatusEnum(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setStatusCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package org.jeecg.modules.message.handle.enums;
|
||||
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
/**
|
||||
* 发送消息类型枚举
|
||||
*
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
public enum SendMsgTypeEnum {
|
||||
|
||||
/**
|
||||
* 短信
|
||||
*/
|
||||
SMS("1", "org.jeecg.modules.message.handle.impl.SmsSendMsgHandle"),
|
||||
/**
|
||||
* 邮件
|
||||
*/
|
||||
EMAIL("2", "org.jeecg.modules.message.handle.impl.EmailSendMsgHandle"),
|
||||
/**
|
||||
* 微信
|
||||
*/
|
||||
WX("3", "org.jeecg.modules.message.handle.impl.WxSendMsgHandle"),
|
||||
/**
|
||||
* 系统消息
|
||||
*/
|
||||
SYSTEM_MESSAGE("4", "org.jeecg.modules.message.handle.impl.SystemSendMsgHandle");
|
||||
|
||||
private String type;
|
||||
|
||||
private String implClass;
|
||||
|
||||
private SendMsgTypeEnum(String type, String implClass) {
|
||||
this.type = type;
|
||||
this.implClass = implClass;
|
||||
}
|
||||
|
||||
public static SendMsgTypeEnum getByType(String type) {
|
||||
if (oConvertUtils.isEmpty(type)) {
|
||||
return null;
|
||||
}
|
||||
for (SendMsgTypeEnum val : values()) {
|
||||
if (val.getType().equals(type)) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getImplClass() {
|
||||
return implClass;
|
||||
}
|
||||
|
||||
public void setImplClass(String implClass) {
|
||||
this.implClass = implClass;
|
||||
}
|
||||
}
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
package org.jeecg.modules.message.handle.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.jeecg.common.api.dto.message.BusMessageDTO;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.config.StaticConfig;
|
||||
import org.jeecg.modules.message.handle.ISendMsgHandle;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 邮箱发送信息
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("emailSendMsgHandle")
|
||||
public class EmailSendMsgHandle implements ISendMsgHandle {
|
||||
/**
|
||||
* 真实姓名变量
|
||||
*/
|
||||
private static final String realNameExp = "{REALNAME}";
|
||||
static String emailFrom;
|
||||
@Autowired
|
||||
SysUserMapper sysUserMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
public static void setEmailFrom(String emailFrom) {
|
||||
EmailSendMsgHandle.emailFrom = emailFrom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(String esReceiver, String esTitle, String esContent) {
|
||||
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
||||
MimeMessage message = mailSender.createMimeMessage();
|
||||
MimeMessageHelper helper = null;
|
||||
//update-begin-author:taoyan date:20200811 for:配置类数据获取
|
||||
if (oConvertUtils.isEmpty(emailFrom)) {
|
||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||
setEmailFrom(staticConfig.getEmailFrom());
|
||||
}
|
||||
//update-end-author:taoyan date:20200811 for:配置类数据获取
|
||||
try {
|
||||
helper = new MimeMessageHelper(message, true);
|
||||
// 设置发送方邮箱地址
|
||||
helper.setFrom(emailFrom);
|
||||
helper.setTo(esReceiver);
|
||||
helper.setSubject(esTitle);
|
||||
helper.setText(esContent, true);
|
||||
mailSender.send(message);
|
||||
} catch (MessagingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(MessageDTO messageDTO) {
|
||||
String[] arr = messageDTO.getToUser().split(",");
|
||||
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<SysUser>().in(SysUser::getUsername, arr);
|
||||
List<SysUser> list = sysUserMapper.selectList(query);
|
||||
String content = messageDTO.getContent();
|
||||
String title = messageDTO.getTitle();
|
||||
for (SysUser user : list) {
|
||||
String email = user.getEmail();
|
||||
if (ObjectUtils.isEmpty(email)) {
|
||||
continue;
|
||||
}
|
||||
content = replaceContent(user, content);
|
||||
log.info("邮件内容:" + content);
|
||||
sendMsg(email, title, content);
|
||||
}
|
||||
//发送给抄送人
|
||||
sendMessageToCopyUser(messageDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件给抄送人
|
||||
*
|
||||
* @param messageDTO
|
||||
*/
|
||||
public void sendMessageToCopyUser(MessageDTO messageDTO) {
|
||||
String copyToUser = messageDTO.getCopyToUser();
|
||||
if (ObjectUtils.isNotEmpty(copyToUser)) {
|
||||
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<SysUser>().in(SysUser::getUsername, copyToUser.split(","));
|
||||
List<SysUser> list = sysUserMapper.selectList(query);
|
||||
String content = messageDTO.getContent();
|
||||
String title = messageDTO.getTitle();
|
||||
|
||||
for (SysUser user : list) {
|
||||
String email = user.getEmail();
|
||||
if (ObjectUtils.isEmpty(email)) {
|
||||
continue;
|
||||
}
|
||||
content = replaceContent(user, content);
|
||||
log.info("邮件内容:" + content);
|
||||
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
||||
MimeMessage message = mailSender.createMimeMessage();
|
||||
MimeMessageHelper helper = null;
|
||||
if (oConvertUtils.isEmpty(emailFrom)) {
|
||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||
setEmailFrom(staticConfig.getEmailFrom());
|
||||
}
|
||||
try {
|
||||
helper = new MimeMessageHelper(message, true);
|
||||
// 设置发送方邮箱地址
|
||||
helper.setFrom(emailFrom);
|
||||
helper.setTo(email);
|
||||
//设置抄送人
|
||||
helper.setCc(email);
|
||||
helper.setSubject(title);
|
||||
helper.setText(content, true);
|
||||
mailSender.send(message);
|
||||
} catch (MessagingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换邮件内容变量
|
||||
*
|
||||
* @param user
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
private String replaceContent(SysUser user, String content) {
|
||||
if (content.indexOf(realNameExp) > 0) {
|
||||
content = content.replace("$" + realNameExp, user.getRealname()).replace(realNameExp, user.getRealname());
|
||||
}
|
||||
if (content.indexOf(CommonConstant.LOGIN_TOKEN) > 0) {
|
||||
String token = getToken(user);
|
||||
try {
|
||||
content = content.replace(CommonConstant.LOGIN_TOKEN, URLEncoder.encode(token, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("邮件消息token编码失败", e.getMessage());
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
private String getToken(SysUser user) {
|
||||
// 生成token
|
||||
String token = JwtUtil.sign(user);
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
// 设置超时时间 1个小时
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 1 / 1000);
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> sendCqSms(int pageSize,boolean isBatch){
|
||||
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package org.jeecg.modules.message.handle.impl;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.BusMessageDTO;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.CqSmsUtil;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
import org.jeecg.modules.message.handle.ISendMsgHandle;
|
||||
import org.jeecg.modules.message.handle.enums.SendMsgStatusEnum;
|
||||
import org.jeecg.modules.message.service.ISysMessageService;
|
||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 短信发送
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SmsSendMsgHandle implements ISendMsgHandle {
|
||||
@Autowired
|
||||
private ISysMessageTemplateService sysMessageTemplateService;
|
||||
@Autowired
|
||||
private ISysMessageService sysMessageService;
|
||||
@Autowired
|
||||
private Configuration freemarkerConfig;
|
||||
|
||||
private static final int RETRY_COUNT = 1;// 重试次数
|
||||
|
||||
@Override
|
||||
public void sendMsg(String esReceiver, String esTitle, String esContent) {
|
||||
// TODO Auto-generated method stub
|
||||
log.info("发短信");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> sendCqSms(int pageSize,boolean isBatch){
|
||||
String logSuffix = isBatch?"[群发]":"[单发]";
|
||||
//调用短信接口发送短信
|
||||
log.info("查询未发送和发送失败的短信"+logSuffix);
|
||||
//根据单发和群发拼接查询
|
||||
LambdaQueryWrapper<SysMessage> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(!isBatch){
|
||||
queryWrapper.eq(SysMessage::getEsType,"1");//单发,未达到重发次数,失败的就重发
|
||||
queryWrapper.and(i -> i.eq(SysMessage::getEsSendStatus, SendMsgStatusEnum.WAIT.getCode())
|
||||
.or(ii -> ii.eq(SysMessage::getEsSendStatus, SendMsgStatusEnum.FAIL.getCode()).le(SysMessage::getEsSendNum, RETRY_COUNT)));
|
||||
}else{
|
||||
queryWrapper.eq(SysMessage::getEsType,"2");//群发,群发不重发
|
||||
queryWrapper.eq(SysMessage::getEsSendStatus, SendMsgStatusEnum.WAIT.getCode());
|
||||
}
|
||||
queryWrapper.orderByAsc(SysMessage::getCreateTime).last("limit "+pageSize);
|
||||
//查询需要发送的数据
|
||||
List<SysMessage> sysMessages = sysMessageService.getBaseMapper().selectList(queryWrapper);
|
||||
log.info("开始发送短信("+sysMessages.size()+")"+logSuffix);
|
||||
// 2.执行发送短信任务
|
||||
for (SysMessage sysMessage : sysMessages) {
|
||||
ThreadUtil.safeSleep(100);//防止并发,休眠0.1秒
|
||||
Integer sendNum = sysMessage.getEsSendNum();
|
||||
try {
|
||||
//发送消息成功
|
||||
Result<Map<String,String>> result = CqSmsUtil.cqSmsSend(sysMessage.getEsReceiver(),sysMessage.getEsContent());
|
||||
Map<String,String> mapRes = result.getResult();
|
||||
if(result.isSuccess()){
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.SUCCESS.getCode());
|
||||
sysMessage.setEsResult(result.getMessage());
|
||||
String s = "";
|
||||
s += "send:{" + mapRes.get("send") + "}";
|
||||
s += "return:{" + mapRes.get("return") + "}";
|
||||
sysMessage.setRemark(s);
|
||||
}else{
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.FAIL.getCode());
|
||||
sysMessage.setEsResult(result.getMessage());
|
||||
String s = "";
|
||||
s += "send:{" + mapRes.get("send") + "}";
|
||||
s += "return:{" + mapRes.get("return") + "}";
|
||||
sysMessage.setRemark(s);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 发送消息出现异常
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.FAIL.getCode());
|
||||
sysMessage.setEsResult(e.getMessage());
|
||||
}finally {
|
||||
sysMessage.setEsSendTime(new Date());
|
||||
sysMessage.setEsSendNum(++sendNum);
|
||||
// 发送结果回写到数据库
|
||||
sysMessageService.updateById(sysMessage);
|
||||
}
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 不带业务的发短信
|
||||
* @param messageDTO
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(MessageDTO messageDTO) {
|
||||
List<SysMessageTemplate> sysSmsTemplates = sysMessageTemplateService.selectByCode(messageDTO.getTemplateCode());
|
||||
SysMessage sysMessage = new SysMessage();
|
||||
if (sysSmsTemplates.size() > 0) {
|
||||
SysMessageTemplate sysSmsTemplate = sysSmsTemplates.get(0);
|
||||
sysMessage.setEsType("1");
|
||||
sysMessage.setEsReceiver(messageDTO.getToUser());
|
||||
//模板标题
|
||||
String title = sysSmsTemplate.getTemplateName();
|
||||
//模板内容
|
||||
String content = sysSmsTemplate.getTemplateContent();
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
Template template = null;
|
||||
try {
|
||||
template = new Template("SysMessageTemplate", content, freemarkerConfig);
|
||||
template.process(messageDTO.getData(), stringWriter);
|
||||
} catch (Exception e) {
|
||||
log.error("freemarker模板解析失败", e);
|
||||
return;
|
||||
}
|
||||
content = stringWriter.toString();
|
||||
sysMessage.setEsTitle(title);
|
||||
sysMessage.setEsContent(content);
|
||||
sysMessage.setEsParam(JSONObject.toJSONString(messageDTO.getData()));
|
||||
sysMessage.setEsSendTime(new Date());
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.WAIT.getCode());
|
||||
sysMessage.setEsSendNum(0);
|
||||
sysMessage.setTemplateCode(messageDTO.getTemplateCode());
|
||||
sysMessageService.save(sysMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package org.jeecg.modules.message.handle.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.WebsocketConst;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.message.enums.Vue3MessageHrefEnum;
|
||||
import org.jeecg.modules.message.handle.ISendMsgHandle;
|
||||
import org.jeecg.modules.message.websocket.WebSocket;
|
||||
import org.jeecg.modules.system.entity.SysAnnouncement;
|
||||
import org.jeecg.modules.system.entity.SysAnnouncementSend;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.mapper.SysAnnouncementMapper;
|
||||
import org.jeecg.modules.system.mapper.SysAnnouncementSendMapper;
|
||||
import org.jeecg.modules.system.mapper.SysUserMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 发送系统消息
|
||||
* @Author: wangshuai
|
||||
* @Date: 2022年3月22日 18:48:20
|
||||
*/
|
||||
@Component("systemSendMsgHandle")
|
||||
@Slf4j
|
||||
public class SystemSendMsgHandle implements ISendMsgHandle {
|
||||
|
||||
public static final String FROM_USER = "system";
|
||||
|
||||
@Resource
|
||||
private SysAnnouncementMapper sysAnnouncementMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
@Resource
|
||||
private SysAnnouncementSendMapper sysAnnouncementSendMapper;
|
||||
|
||||
@Resource
|
||||
private WebSocket webSocket;
|
||||
|
||||
/**
|
||||
* 该方法会发送3种消息:系统消息、企业微信 钉钉
|
||||
*
|
||||
* @param esReceiver 发送人
|
||||
* @param esTitle 标题
|
||||
* @param esContent 内容
|
||||
*/
|
||||
@Override
|
||||
public void sendMsg(String esReceiver, String esTitle, String esContent) {
|
||||
if (oConvertUtils.isEmpty(esReceiver)) {
|
||||
throw new JeecgBootException("被发送人不能为空");
|
||||
}
|
||||
ISysBaseAPI sysBaseApi = SpringContextUtils.getBean(ISysBaseAPI.class);
|
||||
MessageDTO messageDTO = new MessageDTO(FROM_USER, esReceiver, esTitle, esContent);
|
||||
sysBaseApi.sendSysAnnouncement(messageDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅发送系统消息
|
||||
*
|
||||
* @param messageDTO
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(MessageDTO messageDTO) {
|
||||
//原方法不支持 sysBaseApi.sendSysAnnouncement(messageDTO); 有企业微信消息逻辑,
|
||||
String title = messageDTO.getTitle();
|
||||
String content = messageDTO.getContent();
|
||||
String fromUser = messageDTO.getFromUser();
|
||||
Map<String, Object> data = messageDTO.getData();
|
||||
String[] arr = messageDTO.getToUser().split(",");
|
||||
for (String username : arr) {
|
||||
doSend(title, content, fromUser, username, data);
|
||||
}
|
||||
}
|
||||
|
||||
private void doSend(String title, String msgContent, String fromUser, String toUser, Map<String, Object> data) {
|
||||
SysAnnouncement announcement = new SysAnnouncement();
|
||||
if (data != null) {
|
||||
//摘要信息
|
||||
Object msgAbstract = data.get(CommonConstant.NOTICE_MSG_SUMMARY);
|
||||
if (msgAbstract != null) {
|
||||
announcement.setMsgAbstract(msgAbstract.toString());
|
||||
}
|
||||
// 任务节点ID
|
||||
Object taskId = data.get(CommonConstant.NOTICE_MSG_BUS_ID);
|
||||
if (taskId != null) {
|
||||
announcement.setBusId(taskId.toString());
|
||||
announcement.setBusType(Vue3MessageHrefEnum.BPM_TASK.getBusType());
|
||||
}
|
||||
}
|
||||
announcement.setTitile(title);
|
||||
announcement.setMsgContent(msgContent);
|
||||
announcement.setSender(fromUser);
|
||||
announcement.setPriority(CommonConstant.PRIORITY_M);
|
||||
announcement.setMsgType(CommonConstant.MSG_TYPE_USER);
|
||||
announcement.setSendStatus(CommonConstant.HAS_SEND);
|
||||
announcement.setSendTime(new Date());
|
||||
//系统消息
|
||||
announcement.setMsgCategory("2");
|
||||
announcement.setDelFlag(String.valueOf(CommonConstant.DEL_FLAG_0));
|
||||
sysAnnouncementMapper.insert(announcement);
|
||||
// 2.插入用户通告阅读标记表记录
|
||||
String userId = toUser;
|
||||
String[] userIds = userId.split(",");
|
||||
String anntId = announcement.getId();
|
||||
for (int i = 0; i < userIds.length; i++) {
|
||||
if (oConvertUtils.isNotEmpty(userIds[i])) {
|
||||
SysUser sysUser = userMapper.getUserByName(userIds[i]);
|
||||
if (sysUser == null) {
|
||||
continue;
|
||||
}
|
||||
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
|
||||
announcementSend.setAnntId(anntId);
|
||||
announcementSend.setUserId(sysUser.getId());
|
||||
announcementSend.setReadFlag(CommonConstant.NO_READ_FLAG);
|
||||
sysAnnouncementSendMapper.insert(announcementSend);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_USER);
|
||||
obj.put(WebsocketConst.MSG_USER_ID, sysUser.getId());
|
||||
obj.put(WebsocketConst.MSG_ID, announcement.getId());
|
||||
obj.put(WebsocketConst.MSG_TXT, announcement.getTitile());
|
||||
webSocket.sendMessage(sysUser.getId(), obj.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> sendCqSms(int pageSize,boolean isBatch) {
|
||||
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package org.jeecg.modules.message.handle.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.BusMessageDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.message.handle.ISendMsgHandle;
|
||||
|
||||
/**
|
||||
* @Description: 发微信消息模板
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@Slf4j
|
||||
public class WxSendMsgHandle implements ISendMsgHandle {
|
||||
|
||||
@Override
|
||||
public void sendMsg(String esReceiver, String esTitle, String esContent) {
|
||||
// TODO Auto-generated method stub
|
||||
log.info("发微信消息模板");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> sendCqSms(int pageSize,boolean isBatch) {
|
||||
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package org.jeecg.modules.message.job;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
import org.jeecg.modules.message.handle.enums.SendMsgStatusEnum;
|
||||
import org.jeecg.modules.message.service.ISysMessageService;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发送消息任务
|
||||
*
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
public class SendMsgJob implements Job {
|
||||
|
||||
@Autowired
|
||||
private ISysMessageService sysMessageService;
|
||||
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
log.info(String.format(" Jeecg-Boot 发送消息任务 SendMsgJob ! 时间:" + DateUtils.getTimestamp()));
|
||||
|
||||
// 1.读取消息中心数据,只查询未发送的和发送失败不超过次数的
|
||||
QueryWrapper<SysMessage> queryWrapper = new QueryWrapper<SysMessage>();
|
||||
queryWrapper.eq("es_send_status", SendMsgStatusEnum.WAIT.getCode())
|
||||
.or(i -> i.eq("es_send_status", SendMsgStatusEnum.FAIL.getCode()).lt("es_send_num", 6));
|
||||
List<SysMessage> sysMessages = sysMessageService.list(queryWrapper);
|
||||
System.out.println(sysMessages);
|
||||
// 2.根据不同的类型走不通的发送实现类
|
||||
for (SysMessage sysMessage : sysMessages) {
|
||||
//update-begin-author:taoyan date:2022-7-8 for: 模板消息发送测试调用方法修改
|
||||
Integer sendNum = sysMessage.getEsSendNum();
|
||||
try {
|
||||
MessageDTO md = new MessageDTO();
|
||||
md.setTitle(sysMessage.getEsTitle());
|
||||
md.setContent(sysMessage.getEsContent());
|
||||
md.setToUser(sysMessage.getEsReceiver());
|
||||
md.setType(sysMessage.getEsType());
|
||||
md.setToAll(false);
|
||||
sysBaseAPI.sendTemplateMessage(md);
|
||||
//发送消息成功
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.SUCCESS.getCode());
|
||||
//update-end-author:taoyan date:2022-7-8 for: 模板消息发送测试调用方法修改
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// 发送消息出现异常
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.FAIL.getCode());
|
||||
}
|
||||
sysMessage.setEsSendNum(++sendNum);
|
||||
// 发送结果回写到数据库
|
||||
sysMessageService.updateById(sysMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.message.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysMessageMapper extends BaseMapper<SysMessage> {
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package org.jeecg.modules.message.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysMessageTemplateMapper extends BaseMapper<SysMessageTemplate> {
|
||||
|
||||
/**
|
||||
* 通过模板CODE查询消息模板
|
||||
*
|
||||
* @param code 模板CODE
|
||||
* @return List<SysMessageTemplate>
|
||||
*/
|
||||
@Select("SELECT * FROM sys_sms_template WHERE template_code = #{code}")
|
||||
List<SysMessageTemplate> selectByCode(String code);
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?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.jeecg.modules.message.mapper.SysMessageMapper">
|
||||
</mapper>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?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.jeecg.modules.message.mapper.SysMessageTemplateMapper">
|
||||
</mapper>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.message.service;
|
||||
|
||||
import org.jeecg.common.system.base.service.JeecgService;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysMessageService extends JeecgService<SysMessage> {
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package org.jeecg.modules.message.service;
|
||||
|
||||
import org.jeecg.common.system.base.service.JeecgService;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysMessageTemplateService extends JeecgService<SysMessageTemplate> {
|
||||
|
||||
/**
|
||||
* 通过模板CODE查询消息模板
|
||||
*
|
||||
* @param code 模板CODE
|
||||
* @return
|
||||
*/
|
||||
List<SysMessageTemplate> selectByCode(String code);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user