Commit ef18080d authored by suhuiguang's avatar suhuiguang

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents ef2d7327 764336f8
...@@ -15,6 +15,18 @@ ...@@ -15,6 +15,18 @@
</parent> </parent>
<dependencies> <dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<!-- knife4j --> <!-- knife4j -->
<dependency> <dependency>
<groupId>com.github.xiaoymin</groupId> <groupId>com.github.xiaoymin</groupId>
......
...@@ -9,11 +9,6 @@ ...@@ -9,11 +9,6 @@
<artifactId>amos-boot-module-common-api</artifactId> <artifactId>amos-boot-module-common-api</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId> <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency> </dependency>
......
package com.yeejoin.amos.boot.module.common.api.dto; package com.yeejoin.amos.boot.module.common.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -36,7 +37,7 @@ public class FailureAuditDto extends BaseDto { ...@@ -36,7 +37,7 @@ public class FailureAuditDto extends BaseDto {
private String auditOpinion; private String auditOpinion;
@ApiModelProperty(value = "审核结果") @ApiModelProperty(value = "审核结果")
private Integer auditResult; private int auditResult;
@ApiModelProperty(value = "设备故障报修单id") @ApiModelProperty(value = "设备故障报修单id")
private Long faultId; private Long faultId;
......
...@@ -21,14 +21,9 @@ public class FailureRepairlogDto extends BaseDto { ...@@ -21,14 +21,9 @@ public class FailureRepairlogDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "流程处理人")
private String processAuditor;
@ApiModelProperty(value = "流程处理人Id") @ApiModelProperty(value = "流程处理人Id")
private Integer processAuditorId; private Integer processAuditorId;
@ApiModelProperty(value = "处理人所属部门") @ApiModelProperty(value = "处理人所属部门")
private String processDepartment; private String processDepartment;
...@@ -44,7 +39,7 @@ public class FailureRepairlogDto extends BaseDto { ...@@ -44,7 +39,7 @@ public class FailureRepairlogDto extends BaseDto {
@ApiModelProperty(value = "设备故障报修主表ID") @ApiModelProperty(value = "设备故障报修主表ID")
private Long faultId; private Long faultId;
@ApiModelProperty(value = "操作人中文名称") @ApiModelProperty(value = "流程处理人")
private String processAuditorCid; private String processAuditorName;
} }
...@@ -34,7 +34,9 @@ public class FailureAudit extends BaseEntity { ...@@ -34,7 +34,9 @@ public class FailureAudit extends BaseEntity {
*/ */
@TableField("audit_department") @TableField("audit_department")
private String auditDepartment; private String auditDepartment;
/**
* 审核部门id
*/
@TableField("audit_department_id") @TableField("audit_department_id")
private Long auditDepartmentId; private Long auditDepartmentId;
...@@ -62,6 +64,12 @@ public class FailureAudit extends BaseEntity { ...@@ -62,6 +64,12 @@ public class FailureAudit extends BaseEntity {
@TableField("fault_id") @TableField("fault_id")
private Long faultId; private Long faultId;
/**
* 审核结果
*/
@TableField("audit_result")
private int auditResult;
} }
...@@ -27,11 +27,7 @@ public class FailureRepairlog extends BaseEntity { ...@@ -27,11 +27,7 @@ public class FailureRepairlog extends BaseEntity {
*/ */
@TableField("process_auditor_id") @TableField("process_auditor_id")
private Integer processAuditorId; private Integer processAuditorId;
/**
* 流程处理人
*/
@TableField("process_auditor")
private String processAuditor;
/** /**
* 流程处理人 * 流程处理人
*/ */
...@@ -66,10 +62,4 @@ public class FailureRepairlog extends BaseEntity { ...@@ -66,10 +62,4 @@ public class FailureRepairlog extends BaseEntity {
@TableField("fault_id") @TableField("fault_id")
private Long faultId; private Long faultId;
/**
* 操作人中文名称
*/
@TableField("process_auditor_name")
private String processAuditorCid;
} }
package com.yeejoin.amos.boot.module.common.api.enums;
public enum UserRolesEnum {
ADMIN("admin","机场单位"),
AIRPORTUNIT("AIRPORTUNIT","机场单位");
private String code;
private String name;
UserRolesEnum(String code, String name){
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.yeejoin.amos.boot.module.common.api.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
*
* <pre>
* 设备联动服务(车库门、广播、警铃)
* </pre>
*
* @author gwb
* @version $Id: JcsControlServerClient.java, v 0.1 2021年8月19日 上午9:41:10 gwb Exp $
*/
@FeignClient(name = "${control.fegin.name}", configuration = {MultipartSupportConfig.class})
public interface JcsControlServerClient {
/**
*
* <pre>
* 打开/关闭消防警铃
* </pre>
*
* @param areasStr
* @param type(1 为开启 0为关闭)
* @return
*/
@GetMapping(value = "/v1/wksendbell/{codestr}/{type}")
FeignClientResult<String> sendBellAction(@PathVariable("codestr") String areasStr, @PathVariable("type") String type);
/**
*
* <pre>
* 播放广播
* </pre>
*
* @param areasStr
* @param fileUrlsStr
* @return
*/
@GetMapping(value = "/v1/wksend/{codestr}/{urlstr}")
FeignClientResult<String> sendFileAction(@PathVariable("codestr") String areasStr,@PathVariable("urlstr") String fileUrlsStr);
/**
*
* <pre>
* 获取单个设备状态(车库门)
* </pre>
*
* @param ip
* @param port
* @param whichone
* @return
*/
@GetMapping(value = "/v1/controlequip/kndread/{ip}/{port}/{num}")
FeignClientResult<String> readStateAction(@PathVariable("ip") String ip, @PathVariable("port") int port,
@PathVariable("num") int whichone);
/**
*
* <pre>
* 获取连续设备状态(车库门)
* </pre>
*
* @param ip
* @param port
* @param whichone
* @param count
* @return
*/
@GetMapping(value = "/v1/controlequip/kndread/{ip}/{port}/{num}/{count}")
FeignClientResult<String> readMoreStateAction(@PathVariable("ip") String ip,@PathVariable("port") int port,
@PathVariable("num") int whichone, @PathVariable("count") int count);
/**
*
* <pre>
* 设置设备状态(车库门)
* </pre>
*
* @param ip
* @param port
* @param whichone
* @param stateStr
* @return
*/
@GetMapping(value = "/v1/controlequip/kndwrite/{ip}/{port}/{num}/{result}")
FeignClientResult<String> writeStateAction(@PathVariable("ip") String ip,@PathVariable("port") int port,
@PathVariable("num") int whichone, @PathVariable("result") String stateStr);
}
package com.yeejoin.amos.boot.module.common.api.mapper; package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails; import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -10,4 +15,28 @@ import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails; ...@@ -10,4 +15,28 @@ import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
* @date 2021-08-04 * @date 2021-08-04
*/ */
public interface FailureDetailsMapper extends BaseMapper<FailureDetails> { public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
/**
*查询全部 分页
* @param page
* @return
*/
IPage<FailureDetails> selectAllPage(Page page);
/**
*查询我发起的 分页
* current 当前页
* size 条数
* @return
*/
IPage<FailureDetails> selectISubPage(Page page, String submissionPid);
/**
*查询待处理 分页
* @param page
* @return
*/
IPage<FailureDetails> selectInProcessing(Page page);
} }
...@@ -63,4 +63,9 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -63,4 +63,9 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List< Map<String,Object>> getparent(); List< Map<String,Object>> getparent();
List< OrgUsrExcelDto> exportToExcel(); List< OrgUsrExcelDto> exportToExcel();
/**
* 查询单位基本信息列表和单位下所有的重点部位数量。
*/
List<OrgUsrTreeDto> getCompanyAndKeySite(Long companyId);
} }
...@@ -8,8 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -8,8 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
/** /**
...@@ -176,4 +175,20 @@ public interface IOrgUsrService { ...@@ -176,4 +175,20 @@ public interface IOrgUsrService {
List< Map<String,Object>> getparent(); List< Map<String,Object>> getparent();
List< OrgUsrExcelDto> exportToExcel(); List< OrgUsrExcelDto> exportToExcel();
/**
* 根据登陆人获取公司部门人员树
*/
List<OrgMenuDto> companyUserTreeByUser (AgencyUserModel user);
/**
* 根据登陆人获取公司部门树
*/
List<OrgMenuDto> companyTreeByUser(AgencyUserModel user);
/**
* 根据登陆人获取公司列表(关联重点部位)
*/
List<OrgUsrTreeDto> companyListByUser(AgencyUserModel user);
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.FailureDetailsMapper"> <mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.FailureDetailsMapper">
<select id="selectAllPage" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT
sequence_nbr,
current_status,
current_status,
failure_equipment_id,
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM
cb_failure_details
</select>
<select id="selectISubPage" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT
sequence_nbr,
current_status,
failure_equipment_id,
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM
cb_failure_details
WHERE
submission_pid = #{submissionPid}
</select>
<select id="selectInProcessing" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT
sequence_nbr,
current_status,
current_status,
failure_equipment_id,
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM
cb_failure_details
WHERE
is_delete = 0
</select>
</mapper> </mapper>
...@@ -335,5 +335,49 @@ LEFT JOIN ( ...@@ -335,5 +335,49 @@ LEFT JOIN (
on b.instance_id=a.sequence_nbr where a.biz_org_name is not null on b.instance_id=a.sequence_nbr where a.biz_org_name is not null
</select> </select>
<select id="getCompanyAndKeySite" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrTreeDto" >
SELECT
company_sur.sequence_nbr as sequenceNbr,
company_sur.biz_org_name as bizOrgName ,
company_sur.parent_id as parentId,
company_sur.biz_org_type as bizOrgType,
-- cb.field_value_label,
CASE
WHEN keysite_sur.num IS NULL THEN
0
ELSE
keysite_sur.num
END AS num
FROM
(
SELECT
company.sequence_nbr,
company.parent_id,
company.biz_org_name,
company.biz_org_type
FROM
cb_org_usr company
WHERE
(company.biz_org_type = 'COMPANY' OR company.biz_org_type = 'DEPARTMENT')
AND company.is_delete = FALSE
<if test="companyId != null and companyId != ''">
AND biz_org_code LIKE CONCAT((SELECT biz_org_code FROM cb_org_usr WHERE sequence_nbr = #{companyId}),'%')
</if>
) company_sur
LEFT JOIN (
SELECT
keysite.belong_id,
COUNT(keysite.belong_id) as num
FROM
cb_key_site keysite
WHERE
keysite.is_delete = FALSE
GROUP BY
keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id
-- LEFT JOIN cb_dynamic_form_instance as cb ON company_sur.sequence_nbr = cb.instance_id where field_code = 'companyNature'
</select>
</mapper> </mapper>
...@@ -14,11 +14,6 @@ ...@@ -14,11 +14,6 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions> <exclusions>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>amos-boot-module-api</artifactId> <artifactId>amos-boot-module-api</artifactId>
...@@ -12,16 +14,19 @@ ...@@ -12,16 +14,19 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId> <artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-boot-module-common-api</artifactId> <artifactId>amos-component-rule</artifactId>
<version>${amos-biz-boot.version}</version> <exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>amos-boot-module-api</artifactId>
<groupId>com.amosframework.boot</groupId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-module-jpush-api</artifactId>
<dependencies>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</exclusion>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</exclusion>
<exclusion>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
package com.yeejoin.amos.jpush.common.core.request;
import java.util.List;
import java.util.Map;
public class CheckResultPushSpcRequest {
private String riskSourceId;
private String riskSourceName;//危险源名称
private String pointName; //名称
private String nodeState;//巡检状态
private String executorName;//执行人名称
private String executeStatus;//执行状态
private String executorTime;//执行时间 yyyy-MM-dd HH:mm:ss
private Map<String, List<String>> riskFactorMap ;//危险因素和管控措施
//新加巡检点id
private int pointID;
//新建点公司code
private String code;
//点楼层
private String num;
//三维坐标
private String coordinates;
//巡检点明称
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getCoordinates() {
return coordinates;
}
public void setCoordinates(String coordinates) {
this.coordinates = coordinates;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public int getPointID() {
return pointID;
}
public void setPointID(int pointID) {
this.pointID = pointID;
}
public String getRiskSourceName() {
return riskSourceName;
}
public void setRiskSourceName(String riskSourceName) {
this.riskSourceName = riskSourceName;
}
public String getPointName() {
return pointName;
}
public void setPointName(String pointName) {
this.pointName = pointName;
}
public String getNodeState() {
return nodeState;
}
public void setNodeState(String nodeState) {
this.nodeState = nodeState;
}
public String getExecutorName() {
return executorName;
}
public void setExecutorName(String executorName) {
this.executorName = executorName;
}
public String getExecuteStatus() {
return executeStatus;
}
public void setExecuteStatus(String executeStatus) {
this.executeStatus = executeStatus;
}
public String getExecutorTime() {
return executorTime;
}
public void setExecutorTime(String executorTime) {
this.executorTime = executorTime;
}
public Map<String, List<String>> getRiskFactorMap() {
return riskFactorMap;
}
public void setRiskFactorMap(Map<String, List<String>> riskFactorMap) {
this.riskFactorMap = riskFactorMap;
}
public String getRiskSourceId() {
return riskSourceId;
}
public void setRiskSourceId(String riskSourceId) {
this.riskSourceId = riskSourceId;
}
}
package com.yeejoin.amos.jpush.common.core.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* <pre>
* 公共请求对象
* </pre>
*
* @author as-shibaobao
* @version $Id: CommonRequest.java, v 0.1 2018年1月26日 上午10:59:19 as-shibaobao Exp $
*/
@ApiModel
public class CommonRequest {
/**
* 字段名称
*/
@ApiModelProperty(value="字段名称",required=true)
private String name;
/**
* 字段值
*/
@ApiModelProperty(value="字段值",required=true)
private Object value;
/**
* 查询类型
*/
@ApiModelProperty(value="查询类型",notes="空值时,默认为等于;其它类型按QueryOperatorEnum",required=false)
private String type;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package com.yeejoin.amos.jpush.common.core.request;
public class LatentDangerResultPushSpcRequest {
private String hiddenTroubleStatus;//隐患状态
private String processingTime;//处理时间
private String hiddenTroubleName;//隐患名称
private String riskSourceId;//风险点id
public String getHiddenTroubleStatus() {
return hiddenTroubleStatus;
}
public void setHiddenTroubleStatus(String hiddenTroubleStatus) {
this.hiddenTroubleStatus = hiddenTroubleStatus;
}
public String getProcessingTime() {
return processingTime;
}
public void setProcessingTime(String processingTime) {
this.processingTime = processingTime;
}
public String getHiddenTroubleName() {
return hiddenTroubleName;
}
public void setHiddenTroubleName(String hiddenTroubleName) {
this.hiddenTroubleName = hiddenTroubleName;
}
public String getRiskSourceId() {
return riskSourceId;
}
public void setRiskSourceId(String riskSourceId) {
this.riskSourceId = riskSourceId;
}
}
package com.yeejoin.amos.jpush.common.core.request;
/**
* 线路巡检点巡检项查询条件
* @author Administrator
*
*/
public class RoutePointInputItemRequest {
/**
* 巡检点id
*/
private Long pointId;
/**
* 是否绑定
*/
private String isBound;
/**
* 路线id
*/
private Long routeId;
/**
* 分类id
*/
private Long classifyId;
/**
* 巡检项等级
*/
private String level;
/**
* 巡检项名称
*/
private String inputName;
public Long getPointId() {
return pointId;
}
public void setPointId(Long pointId) {
this.pointId = pointId;
}
public Long getRouteId() {
return routeId;
}
public void setRouteId(Long routeId) {
this.routeId = routeId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getInputName() {
return inputName;
}
public void setInputName(String inputName) {
this.inputName = inputName;
}
public String getIsBound() {
return isBound;
}
public void setIsBound(String isBound) {
this.isBound = isBound;
}
}
package com.yeejoin.amos.jpush.common.entity;
import java.io.Serializable;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import io.swagger.annotations.ApiModelProperty;
/**
* <pre>
* 返回封装对象
* </pre>
*
* @author mincx
* @version CommonReponse.java v0.1
* @time 2017-9-19 15:43:32
*/
public class CommonResponse implements Serializable {
private static final long serialVersionUID = -8737351878134480646L;
/**
* 操作状态
*/
@ApiModelProperty(required=true,value="操作状态")
private String result;
/**
* 数据
*/
@ApiModelProperty(required=false,value="数据")
private Object dataList;
/**
* 操作详细信息
*/
@ApiModelProperty(required=false,value="操作详细信息")
private String message;
public CommonResponse(){
}
public CommonResponse(String result) {
this.result = result;
}
public CommonResponse(Object dataList) {
this.dataList = dataList;
this.result = "";
}
public CommonResponse(String result, Object dataList) {
this.dataList = dataList;
this.result = result;
}
public CommonResponse(String result, String message) {
this.result = result;
this.message = message;
}
public CommonResponse(String result, Object dataList, String message) {
this.dataList = dataList;
this.result = result;
this.message = message;
}
public Boolean isSuccess(){
return "SUCCESS".equals(getResult());
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Object getDataList() {
return dataList;
}
public void setDataList(Object dataList) {
this.dataList = dataList;
}
public String toJsonStr() throws Exception {
return JSON.toJSONString(this,SerializerFeature.WriteMapNullValue,SerializerFeature.DisableCircularReferenceDetect,SerializerFeature.SkipTransientField);
}
}
package com.yeejoin.amos.jpush.common.entity;
public class CommonResponseUtil
{
public static CommonResponse success()
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
return response;
}
public static CommonResponse success(Object obj)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
response.setDataList(obj);
return response;
}
public static CommonResponse success(Object obj, String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
response.setDataList(obj);
response.setMessage(message);
return response;
}
public static CommonResponse failure()
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
return response;
}
public static CommonResponse failure(String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
response.setMessage(message);
return response;
}
public static CommonResponse failure(Object obj, String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
response.setDataList(obj);
response.setMessage(message);
return response;
}
}
package com.yeejoin.amos.jpush.common.entity;
/**
* <pre>
* 系统常量
* </pre>
*
* @author mincx
* @version Constants.java v0.1
* @time 2017-9-19 15:43:32
*/
public class Constants {
public static final String ERROR_MESSAGE = "系统异常";
public static final String RESULT_SUCCESS = "SUCCESS";
public static final String RESULT_FAILURE = "FAILURE";
public static final String RULE_FACT_PREFIX = "rule_";
public static final String RULE_COMPILATION_ERROR = "规则编译异常";
public static final String NEW_LINE= "\r\n";
public static final String POSITION_LATITUDE = "latitude";
public static final String POSITION_LONGITUDE = "longitude";
public static final double PI = 3.1415;
public static final double EARTH_RADIUS = 6370.996;
public static final String RULE_CONDITION_AND = "&&";
public static final String RULE_CONDITION_OR = "||";
/**
* DES加密解密默认key
*/
public static final String XSS_KEY = "qaz";
/**
* 灾情状态
*/
public static final String FireHappenStateID = "90db70b7-49a4-4a72-b54b-0fabbed9bec7";//发生
public static final String FireDevelopStateID = "1f7fe7d7-b30c-4518-8c95-6e3bc506ca86";//猛烈
/**
* 车辆状态
*/
public static final String CarArrivedStateID = "ad55748a-1206-4507-8831-95b7f2ad804f";//到达
public static final String CarDispatchingStateID = "43a23576-3d0f-4c3d-a46b-555391a4d870";//待出动
public static final String CarOnDutyStateID = "21cc717f-60b4-46ae-942e-9efd63d13415";//执勤
public static final String CarOnSiteStateID = "d7eddc16-4c55-4de0-b726-3547c7b0b980";//在位
public static final String CarOnTheWayStateID = "5e1b6e98-d1dc-4c49-a7ad-b959d2278dba";//在途
public static final String CarRepairStateID = "e86d455b-e9fd-4938-9826-38ca46623287";//维修
/**
* 战斗力量编队状态
*/
public static final String RescuePowerArrivedStateID = "0951f770-7f75-43d8-bcec-47d7559be727";//到达
public static final String RescuePowerDispatchedStateID = "ec4afc56-6cec-41a3-95f5-20c735f052d4";//已调派
public static final String RescuePowerEnhanceStateID = "3d6cf113-b69d-47c3-a3a8-ded448cc4636";//增援
public static final String RescuePowerFightingStateID = "4bacd4b4-b07d-454e-b737-431e7c997cde";//战斗
public static final String RescuePowerStandByStateID = "4fc6e4d6-c6a8-453c-b554-ce7de0b828b2";//待命
/**
* sql注入关键字
*/
public static String badStr = "'|and|exec|execute|insert|select|delete|update|count|drop|%|chr|mid|master|truncate|" +
"char|declare|sitename|net user|xp_cmdshell|;|or|-|+|,|like'|and|exec|execute|insert|create|drop|" +
"table|from|grant|use|group_concat|column_name|" +
"information_schema.columns|table_schema|union|where|select|delete|update|order|by|count|" +
"chr|mid|master|truncate|char|declare|or|;|-|--|,|like|//|/|%|#";
}
package com.yeejoin.amos.jpush.common.entity;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
*
* <pre>
* 查询条件封装类
* </pre>
*
* @author as-hanshipeng
* @version $Id: DaoCriteria.java, v 0.1 2016-12-9 下午12:22:03 as-hanshipeng Exp $
*/
public class DaoCriteria implements Serializable
{
private static final long serialVersionUID = 812759366580443779L;
//属性名称
private String propertyName;
//操作符
private String operator;
//属性值
private Object value;
public String getOperator()
{
return operator;
}
public void setOperator(String operator)
{
this.operator = operator;
}
public String getPropertyName()
{
return propertyName;
}
public void setPropertyName(String propertyName)
{
this.propertyName = propertyName;
}
public Object getValue()
{
return value;
}
public void setValue(Object value)
{
this.value = value;
}
public DaoCriteria()
{
}
public DaoCriteria(String property, String operator, Object value)
{
propertyName = property;
this.operator = operator;
this.value = value;
}
public String toString()
{
return (new ToStringBuilder(this)).append("Property", propertyName).append(operator).append("Value", value).toString();
}
}
package com.yeejoin.amos.jpush.common.entity;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
/**
* 日期工具类
*
*/
public class DateUtil {
// 默认日期格式
public static final String DATE_DEFAULT_FORMAT = "yyyy-MM-dd";
// 默认日期格式
public static final String DATE_YEARANDMONTH_FORMAT = "yyyy-MM";
// 默认时间格式
public static final String DATETIME_DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final String TIME_DEFAULT_FORMAT = "HH:mm:ss";
// 日期格式化
private static DateFormat dateFormat = null;
// 时间格式化
private static DateFormat dateTimeFormat = null;
// 年月格式化
private static DateFormat dateYearAndMonthFormat = null;
private static DateFormat timeFormat = null;
private static Calendar gregorianCalendar = null;
static {
dateFormat = new SimpleDateFormat(DATE_DEFAULT_FORMAT);
dateYearAndMonthFormat = new SimpleDateFormat(DATE_YEARANDMONTH_FORMAT);
dateTimeFormat = new SimpleDateFormat(DATETIME_DEFAULT_FORMAT);
timeFormat = new SimpleDateFormat(TIME_DEFAULT_FORMAT);
gregorianCalendar = new GregorianCalendar();
}
/**
* 日期格式化yyyy-MM-dd
*
* @param date
* @return
*/
public static Date formatDate(String date, String format) {
try {
return new SimpleDateFormat(format).parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 日期格式化yyyy-MM-dd
*
* @param date
* @return
*/
public static String getDateFormat(Date date) {
return dateFormat.format(date);
}
/**
* 日期格式化yyyy-MM
*
* @param date
* @return
*/
public static String getDateYearAndMonthFormat(Date date) {
return dateYearAndMonthFormat.format(date);
}
/**
* 日期格式化yyyy-MM-dd HH:mm:ss
*
* @param date
* @return
*/
public static String getDateTimeFormat(Date date) {
return dateTimeFormat.format(date);
}
/**
* 时间格式化
*
* @param date
* @return HH:mm:ss
*/
public static String getTimeFormat(Date date) {
return timeFormat.format(date);
}
/**
* 日期格式化
*
* @param date
* @param 格式类型
* @return
*/
public static String getDateFormat(Date date, String formatStr) {
if (StringUtils.isNotBlank(formatStr)) {
return new SimpleDateFormat(formatStr).format(date);
}
return null;
}
/**
* 日期格式化
*
* @param date
* @return
*/
public static Date getDateFormat(String date) {
try {
return dateFormat.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 时间格式化
*
* @param date
* @return
*/
public static Date getDateTimeFormat(String date) {
try {
return dateTimeFormat.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 获取当前日期(yyyy-MM-dd)
*
* @param date
* @return
*/
public static Date getNowDate() {
return DateUtil.getDateFormat(dateFormat.format(new Date()));
}
/**
* 获取当前日期星期一日期
*
* @return date
*/
public static Date getFirstDayOfWeek() {
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek()); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取当前日期星期日日期
*
* @return date
*/
public static Date getLastDayOfWeek() {
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek() + 6); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取日期星期一日期
*
* @param 指定日期
* @return date
*/
public static Date getFirstDayOfWeek(Date date) {
if (date == null) {
return null;
}
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek()); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取日期星期一日期
*
* @param 指定日期
* @return date
*/
public static Date getLastDayOfWeek(Date date) {
if (date == null) {
return null;
}
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek() + 6); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取当前月的第一天
*
* @return date
*/
public static Date getFirstDayOfMonth() {
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
return gregorianCalendar.getTime();
}
/**
* 获取当前月的最后一天
*
* @return
*/
public static Date getLastDayOfMonth() {
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
gregorianCalendar.add(Calendar.MONTH, 1);
gregorianCalendar.add(Calendar.DAY_OF_MONTH, -1);
return gregorianCalendar.getTime();
}
/**
* 获取指定月的第一天
*
* @param date
* @return
*/
public static Date getFirstDayOfMonth(Date date) {
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
return gregorianCalendar.getTime();
}
/**
* 获取指定月的最后一天
*
* @param date
* @return
*/
public static Date getLastDayOfMonth(Date date) {
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
gregorianCalendar.add(Calendar.MONTH, 1);
gregorianCalendar.add(Calendar.DAY_OF_MONTH, -1);
return gregorianCalendar.getTime();
}
/**
* 获取日期前一天
*
* @param date
* @return
*/
public static Date getDayBefore(Date date) {
gregorianCalendar.setTime(date);
int day = gregorianCalendar.get(Calendar.DATE);
gregorianCalendar.set(Calendar.DATE, day - 1);
return gregorianCalendar.getTime();
}
/**
* 获取日期后一天
*
* @param date
* @return
*/
public static Date getDayAfter(Date date) {
gregorianCalendar.setTime(date);
int day = gregorianCalendar.get(Calendar.DATE);
gregorianCalendar.set(Calendar.DATE, day + 1);
return gregorianCalendar.getTime();
}
/**
* 获取当前年
*
* @return
*/
public static int getNowYear() {
Calendar d = Calendar.getInstance();
return d.get(Calendar.YEAR);
}
/**
* 获取当前月份
*
* @return
*/
public static int getNowMonth() {
Calendar d = Calendar.getInstance();
return d.get(Calendar.MONTH) + 1;
}
/**
* 获取date的年
*
* @return
*/
public static int getDateYear(Date date) {
Calendar d = Calendar.getInstance();
d.setTime(date);
return d.get(Calendar.YEAR);
}
/**
* 获取date的月份
*
* @return
*/
public static int getDateMonth(Date date) {
Calendar d = Calendar.getInstance();
d.setTime(date);
return d.get(Calendar.MONTH) + 1;
}
/**
* 获取当月天数
*
* @return
*/
public static int getNowMonthDay() {
Calendar d = Calendar.getInstance();
return d.getActualMaximum(Calendar.DATE);
}
/**
* 获取时间段的每一天
*
* @param 开始日期
* @param 结算日期
* @return 日期列表
*/
public static List<Date> getEveryDay(Date startDate, Date endDate) {
if (startDate == null || endDate == null) {
return null;
}
// 格式化日期(yy-MM-dd)
startDate = DateUtil.getDateFormat(DateUtil.getDateFormat(startDate));
endDate = DateUtil.getDateFormat(DateUtil.getDateFormat(endDate));
List<Date> dates = new ArrayList<Date>();
gregorianCalendar.setTime(startDate);
dates.add(gregorianCalendar.getTime());
while (gregorianCalendar.getTime().compareTo(endDate) < 0) {
// 加1天
gregorianCalendar.add(Calendar.DAY_OF_MONTH, 1);
dates.add(gregorianCalendar.getTime());
}
return dates;
}
/**
* 获取提前多少个月
*
* @param monty
* @return
*/
public static Date getFirstMonth(int monty) {
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -monty);
return c.getTime();
}
/**
* 得到现在时间
*
* @return
*/
public static Date getNow()
{
Date currentTime = new Date();
return currentTime;
}
/**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm:ss
*/
public static String getNowDateLongForHandset()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd-HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString;
}
public static String getDateLongForHandset(java.util.Date dateDate){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
public static String getDateStr(String formatterstr) {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(formatterstr);
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm:ss
*/
public static Date getNowDateLong()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
}
/**
* 获取现在时间
*
* @return返回短时间格式 yyyy-MM-dd
*/
public static Date getNowDateShort()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
}
/**
* 获取现在时间字符串
*
* @return返回字符串格式 yyyy-MM-dd HH:mm:ss
*/
public static String getNowStrLong()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取现在时间字符串
*
* @return 返回短时间字符串格式yyyy-MM-dd
*/
public static String getNowStrShort()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取时间 小时:分;秒 HH:mm:ss
*
* @return
*/
public static String getNowHHMMSS()
{
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
Date currentTime = new Date();
String dateString = formatter.format(currentTime);
return dateString;
}
/**
*
* <pre>
*
* </pre>
*
* @param strDate
* @param dateFormat
* @return
*/
public static Date str2Date(String strDate, String dateFormat)
{
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
*
* <pre>
* e.g localDateStr ="2017-03-30T06:28:12.803Z";
* </pre>
*
* @param strDate
* @param dateFormat
* @return
*/
public static Date localDateStr2Date(String localDateStr)
{
LocalDateTime localDate = LocalDateTime.parse(localDateStr,DateTimeFormatter.ISO_ZONED_DATE_TIME);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formatLocalDate2Str = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(formatLocalDate2Str, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
*
* @param strDate
* @return
*/
public static Date longStr2Date(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm
*
* @param strDate
* @return
*/
public static Date longStr3Date(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为long型数据
*
* @param strDate
* @return
*/
public static Long longStr2Long(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate.getTime();
}
/**
* 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss
*
* @param dateDate
* @return
*/
public static String date2LongStr(Date dateDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
/**
* 将短时间格式时间转换为字符串 yyyy-MM-dd
*
* @param dateDate
* @param k
* @return
*/
public static String date2ShortStr(java.util.Date dateDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(dateDate);
return dateString;
}
/**
*
* <pre>
*
* </pre>
*
* @param l
* @param dateFormat
* @return
*/
public static String long2Str(long l, String dateFormat)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 把LONG数据类型转换为字符串
*
* @param l
* @return
*/
public static String long2LongStr(long l)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 把LONG数据类型转换为字符串
*
* <pre>
*
* </pre>
*
* @param l
* @return
*/
public static String long2ShortStr(long l)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 将短时间格式字符串转换为时间 yyyy-MM-dd
*
* @param strDate
* @return
*/
public static Date shortStr2ShortDate(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 提取一个月中的最后一天
*
* @param day
* @return
*/
public static Date getLastDateOfThisMonth(long day)
{
Date date = new Date();
long date_3_hm = date.getTime() - 3600000 * 34 * day;
Date date_3_hm_date = new Date(date_3_hm);
return date_3_hm_date;
}
/**
* 获取日期中的年
*
* @param date
* @return
*/
public static String getYear(Date date) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
String year;
year = dateString.substring(0, 4);
return year;
}
/**
* 得到现在小时
*/
public static String getHour()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String hour;
hour = dateString.substring(11, 13);
return hour;
}
/**
* 得到现在分钟
*
* @return
*/
public static String getMinute()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String min;
min = dateString.substring(14, 16);
return min;
}
/**
* 根据用户传入的时间表示格式,返回当前时间的格式 如果是yyyyMMdd,注意字母y不能大写。
*
* @param sformat
* yyyyMMddhhmmss
* @return
*/
public static String parseDate(String sformat)
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(sformat);
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 二个小时时间间的差值,必须保证二个时间都是"HH:MM"的格式,返回字符型的分钟
*/
public static String getTwoHour(String st1, String st2)
{
String[] kk = null;
String[] jj = null;
kk = st1.split(":");
jj = st2.split(":");
if (Integer.parseInt(kk[0]) < Integer.parseInt(jj[0])) return "0";
else
{
double y = Double.parseDouble(kk[0]) + Double.parseDouble(kk[1]) / 60;
double u = Double.parseDouble(jj[0]) + Double.parseDouble(jj[1]) / 60;
if ((y - u) > 0) return y - u + "";
else
return "0";
}
}
/**
* 得到二个日期间的间隔天数
*/
public static String getTwoDay(String sj1, String sj2)
{
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
long day = 0;
try
{
java.util.Date date = myFormatter.parse(sj1);
java.util.Date mydate = myFormatter.parse(sj2);
day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
}
catch (Exception e)
{
return "";
}
return day + "";
}
/**
* 时间前推或后推分钟,其中JJ表示分钟.
*/
public static String getPreTime(String sj1, String jj)
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String mydate1 = "";
try
{
Date date1 = format.parse(sj1);
long Time = (date1.getTime() / 1000) + Integer.parseInt(jj) * 60;
date1.setTime(Time * 1000);
mydate1 = format.format(date1);
}
catch (Exception e)
{
mydate1 = "";
}
return mydate1;
}
/**
* 得到一个时间延后或前移几天的时间,nowdate为时间,delay为前移或后延的天数
*/
public static String getNextDay(String nowdate, String delay)
{
try
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String mdate = "";
Date d = shortStr2ShortDate(nowdate);
long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60;
d.setTime(myTime * 1000);
mdate = format.format(d);
return mdate;
}
catch (Exception e)
{
return "";
}
}
/**
* 判断是否润年
*
* @param ddate
* @return
*/
public static boolean isLeapYear(String ddate)
{
/**
* 详细设计: 1.被400整除是闰年,否则: 2.不能被4整除则不是闰年 3.能被4整除同时不能被100整除则是闰年
* 3.能被4整除同时能被100整除则不是闰年
*/
Date d = shortStr2ShortDate(ddate);
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(d);
int year = gc.get(Calendar.YEAR);
if ((year % 400) == 0) return true;
else if ((year % 4) == 0)
{
if ((year % 100) == 0) return false;
else
return true;
}
else
return false;
}
/**
* 返回美国时间格式 26 Apr 2006
*
* @param str
* @return
*/
public static String getEDate(String str)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(str, pos);
String j = strtodate.toString();
String[] k = j.split(" ");
return k[2] + k[1].toUpperCase() + k[5].substring(2, 4);
}
/**
* 获取一个月的最后一天
*
* @param dat
* @return
*/
public static String getEndDateOfMonth(String dat)
{// yyyy-MM-dd
String str = dat.substring(0, 8);
String month = dat.substring(5, 7);
int mon = Integer.parseInt(month);
if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12)
{
str += "31";
}
else if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
{
str += "30";
}
else
{
if (isLeapYear(dat))
{
str += "29";
}
else
{
str += "28";
}
}
return str;
}
/**
* 判断二个时间是否在同一个周
*
* @param date1
* @param date2
* @return
*/
public static boolean isSameWeekDates(Date date1, Date date2)
{
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
cal1.setTime(date1);
cal2.setTime(date2);
int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
if (0 == subYear)
{
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
else if (1 == subYear && 11 == cal2.get(Calendar.MONTH))
{
// 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
else if (-1 == subYear && 11 == cal1.get(Calendar.MONTH))
{
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
return false;
}
/**
* 产生周序列,即得到当前时间所在的年度是第几周
*
* @return
*/
public static String getSeqWeek()
{
Calendar c = Calendar.getInstance(Locale.CHINA);
String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
if (week.length() == 1) week = "0" + week;
String year = Integer.toString(c.get(Calendar.YEAR));
return year + week;
}
/**
* 获得一个日期所在的周的星期几的日期,如要找出2002年2月3日所在周的星期一是几号
*
* @param sdate
* @param num
* @return
*/
public static String getWeek(String sdate, String num)
{
// 再转换为时间
Date dd = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(dd);
if (num.equals("1")) // 返回星期一所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
else if (num.equals("2")) // 返回星期二所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
else if (num.equals("3")) // 返回星期三所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
else if (num.equals("4")) // 返回星期四所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
else if (num.equals("5")) // 返回星期五所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
else if (num.equals("6")) // 返回星期六所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
else if (num.equals("0")) // 返回星期日所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
}
/**
* 根据一个日期,返回是星期几的字符串
*
* @param sdate
* @return
*/
public static String getWeek(String sdate)
{
// 再转换为时间
Date date = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
// int hour=c.get(Calendar.DAY_OF_WEEK);
// hour中存的就是星期几了,其范围 1~7
// 1=星期日 7=星期六,其他类推
return new SimpleDateFormat("EEEE").format(c.getTime());
}
public static String getWeekStr(String sdate)
{
String str = "";
str = getWeek(sdate);
if ("1".equals(str))
{
str = "星期日";
}
else if ("2".equals(str))
{
str = "星期一";
}
else if ("3".equals(str))
{
str = "星期二";
}
else if ("4".equals(str))
{
str = "星期三";
}
else if ("5".equals(str))
{
str = "星期四";
}
else if ("6".equals(str))
{
str = "星期五";
}
else if ("7".equals(str))
{
str = "星期六";
}
return str;
}
/**
* 两个时间之间的天数
*
* @param date1
* @param date2
* @return
*/
public static long getDays(String date1, String date2)
{
if (date1 == null || date1.equals("")) return 0;
if (date2 == null || date2.equals("")) return 0;
// 转换为标准时间
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date date = null;
java.util.Date mydate = null;
try
{
date = myFormatter.parse(date1);
mydate = myFormatter.parse(date2);
}
catch (Exception e)
{
;
}
long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
return day;
}
/**
* 形成如下的日历 , 根据传入的一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 星期六 下面是当月的各个时间
* 此函数返回该日历第一行星期日所在的日期
*
* @param sdate
* @return
*/
public static String getNowMonth(String sdate)
{
// 取该时间所在月的一号
sdate = sdate.substring(0, 8) + "01";
// 得到这个月的1号是星期几
Date date = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
int u = c.get(Calendar.DAY_OF_WEEK);
String newday = DateUtil.getNextDay(sdate, (1 - u) + "");
return newday;
}
/**
* 取得数据库主键 生成格式为yyyymmddhhmmss+k位随机数
*
* @param k
* 表示是取几位随机数,可以自己定
*/
public static String getNo(int k)
{
return parseDate("yyyyMMddhhmmss") + getRandom(k);
}
/**
* 返回一个随机数
*
* @param i
* @return
*/
private static String getRandom(int i)
{
Random jjj = new Random();
// int suiJiShu = jjj.nextInt(9);
if (i == 0) return "";
String jj = "";
for (int k = 0; k < i; k++)
{
jj = jj + jjj.nextInt(9);
}
return jj;
}
/**
*
* @param args
*/
public static boolean rightDate(String date)
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
if (date == null) return false;
if (date.length() > 10)
{
sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
}
else
{
sdf = new SimpleDateFormat("yyyy-MM-dd");
}
try
{
sdf.parse(date);
}
catch (ParseException e)
{
return false;
}
return true;
}
public static void main(String[] args)
{
//
}
/**
* 将date 按照指定 的 格式 formatStr 转换成 字符串
*
* @param date
* @param formatStr
* @return
*/
public static String date2Str(Date date, String formatStr)
{
SimpleDateFormat formatter = new SimpleDateFormat(formatStr);
String dateString = formatter.format(date);
return dateString;
}
/**
* 增加hours小時
*
* @param date
* @param hours
* @return
*/
public static Date addHours(Date date, int hours)
{
if (date == null) return null;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.HOUR_OF_DAY, hours);// 24小时制
// cal.add(Calendar.HOUR, x);12小时制
date = cal.getTime();
return date;
}
/**
* 增加minutes分鐘
*
* @param date
* @param minutes
* @return
*/
public static Date addMinutes(Date date, int minutes)
{
if (date == null) return null;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MINUTE, minutes);//
date = cal.getTime();
return date;
}
/**
* 功能描述:格式化日期
*
* @param dateStr
* String 字符型日期
* @param format
* String 格式
* @return Date 日期
*/
public static Date parseDate(String dateStr, String format) {
Date date=null;
try {
DateFormat dateFormat = new SimpleDateFormat(format);
date = (Date) dateFormat.parse(dateStr);
} catch (Exception e) {
}
return date;
}
// 指定模式的时间格式
private static SimpleDateFormat getSDFormat(String pattern) {
return new SimpleDateFormat(pattern);
}
/**
* 当前日历,这里用中国时间表示
*
* @return 以当地时区表示的系统当前日历
*/
public static Calendar getCalendar() {
return Calendar.getInstance();
}
/**
* 默认日期按指定格式显示
*
* @param pattern
* 指定的格式
* @return 默认日期按指定格式显示
*/
public static String formatDate(String pattern) {
return getSDFormat(pattern).format(getCalendar().getTime());
}
/**
* 获取当前时间任意
* @return
*/
public static String get(int field) {
return String.valueOf(getCalendar().get(field));
}
/**
* 获取今日的开始时间
* @return
*/
public static Date getTodayBeginTime(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
Date today = calendar.getTime();
return today;
}
/**
* 获取今日的结束时间
* @return
*/
public static Date getTodayEndTime(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date today = calendar.getTime();
return today;
}
/**
* 获取两个时间相差的 *小时*分钟
* @param endDate
* @param nowDate
* @return
*/
public static String getDatePoorToMin(Date endDate, Date nowDate) {
// long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
// long day = diff / nd;
// 计算差多少小时
long hour = diff / nh;
// 计算差多少分钟
long min = diff % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return hour + "小时" + min + "分钟";
}
public static String getDatePoorToSec(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
long ss = 1000;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
long sen = diff % nd % nh % nm / ss;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟"+ sen + "秒";
}
}
\ No newline at end of file
package com.yeejoin.amos.jpush.common.entity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
/**
*
* <pre>
* JSON工具类
* </pre>
*
* @author dell
* @version $Id: JSONUtil.java, v 0.1 2017年3月28日 下午9:04:47 dell Exp $
*/
public class JSONUtil
{
private static Gson gson = null;
static
{
gson = new Gson();
}
public static synchronized Gson newInstance()
{
if (gson == null)
{
gson = new Gson();
}
return gson;
}
public static String toJson(Object obj)
{
return gson.toJson(obj);
}
public static <T> T toBean(String json, Class<T> clz)
{
return gson.fromJson(json, clz);
}
public static <T> Map<String, T> toMap(String json, Class<T> clz)
{
Map<String, JsonObject> map = gson.fromJson(json,
new TypeToken<Map<String, JsonObject>>() {
}.getType());
Map<String, T> result = new HashMap<>();
for (String key : map.keySet())
{
result.put(key, gson.fromJson(map.get(key), clz));
}
return result;
}
public static Map<String, Object> toMap(String json)
{
Map<String, Object> map = gson.fromJson(json,
new TypeToken<Map<String, Object>>() {
}.getType());
return map;
}
public static <T> List<T> toList(String json, Class<T> clz)
{
JsonArray array = new JsonParser().parse(json).getAsJsonArray();
List<T> list = new ArrayList<>();
for (final JsonElement elem : array)
{
list.add(gson.fromJson(elem, clz));
}
return list;
}
}
package com.yeejoin.amos.jpush.common.entity;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.enums.ValuedEnum;
/**
*
* <pre>
* 操作枚举
* </pre>
*
* @author as-hanshipeng
* @version $Id: QueryOperatorEnum.java, v 0.1 2016-12-10 下午03:07:33 as-hanshipeng Exp $
*/
public final class QueryOperatorEnum extends ValuedEnum
{
private static final long serialVersionUID = -375127751242109017L;
public static final int LESS_VALUE = 1; //小于
public static final int BIGGER_VALUE = 2; //大于
public static final int EQUAL_VALUE = 3; //等于
public static final int LESS_EQUAL_VALUE = 4; // 小于等于
public static final int BIGGER_EQUAL_VALUE = 5; //大于等于
public static final int NOT_EQUAL_VALUE = 6; //不等于
public static final int IN_VALUE = 7; //包含
public static final int LIKE_VALUE = 8; //like
public static final int OR_VALUE = 9; // 或者
public static final int ORDER_VALUE = 10; // 排序
public static final int NOT_IN_VALUE = 11; // 不包含
public static final int IS_VALUE= 12; //是
public static final QueryOperatorEnum LESS = new QueryOperatorEnum("LESS",
1, "<");
public static final QueryOperatorEnum BIGGER = new QueryOperatorEnum(
"BIGGER", 2, ">");
public static final QueryOperatorEnum EQUAL = new QueryOperatorEnum(
"EQUAL", 3, "=");
public static final QueryOperatorEnum LESS_EQUAL = new QueryOperatorEnum(
"LESS_EQUAL", 4, "<=");
public static final QueryOperatorEnum BIGGER_EQUAL = new QueryOperatorEnum(
"BIGGER_EQUAL", 5, ">=");
public static final QueryOperatorEnum NOT_EQUAL = new QueryOperatorEnum(
"NOT_EQUAL", 6, "<>");
public static final QueryOperatorEnum IN = new QueryOperatorEnum("IN", 7,
"IN");
public static final QueryOperatorEnum LIKE = new QueryOperatorEnum("LIKE",
8, "LIKE");
public static final QueryOperatorEnum OR = new QueryOperatorEnum("OR", 9,
"OR");
public static final QueryOperatorEnum ORDER_BY = new QueryOperatorEnum(
"ORDER BY", 10, "ORDER BY");
public static final QueryOperatorEnum NOT_IN = new QueryOperatorEnum(
"NOT IN", 11, "NOT IN");
public static final QueryOperatorEnum IS = new QueryOperatorEnum(
"IS", 12, "IS");
public String condition;
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
protected QueryOperatorEnum(String arg0, int arg1,String condition)
{
super(arg0, arg1);
this.condition = condition;
}
public static QueryOperatorEnum getEnum(String name)
{
try{
return ((QueryOperatorEnum)getEnum(QueryOperatorEnum.class, name));
}catch(Exception ex){return null;}
}
public static QueryOperatorEnum getEnum(int name)
{
try{
return ((QueryOperatorEnum)getEnum(QueryOperatorEnum.class, name));
}catch(Exception ex){return null;}
}
public static Map getMap()
{
try{
return getEnumMap(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
public static List getList()
{
try{
return getEnumList(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
public static Iterator iterator()
{
try{
return iterator(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
}
package com.yeejoin.amos.jpush.common.entity;
import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtil {
private static Pattern NOT_ZERO_AT_THE_END = Pattern.compile("[1-9]+\\d*[1-9]+");
private static Pattern numericPattern = Pattern.compile("-?[0-9]+\\.?[0-9]*");
/**
* 鍒ゆ柇瀵硅薄鏄惁涓虹┖
*
* @param str
* @return
*/
public static boolean isNotEmpty(Object str) {
boolean flag = true;
if (str != null && !str.equals("")) {
if (str.toString().length() > 0) {
flag = true;
}
} else {
flag = false;
}
return flag;
}
/***************************************************************************
* repeat - 閫氳繃婧愬瓧绗︿覆閲嶅鐢熸垚N娆$粍鎴愭柊鐨勫瓧绗︿覆銆�
*
* @param src
* - 婧愬瓧绗︿覆 渚嬪: 绌烘牸(" "), 鏄熷彿("*"), "娴欐睙" 绛夌瓑...
* @param num
* - 閲嶅鐢熸垚娆℃暟
* @return 杩斿洖宸茬敓鎴愮殑閲嶅瀛楃涓�
* @version 1.0 (2006.10.10) Wilson Lin
**************************************************************************/
public static String repeat(String src, int num) {
StringBuffer s = new StringBuffer();
for (int i = 0; i < num; i++)
s.append(src);
return s.toString();
}
/**
* 鍒ゆ柇鏄惁鏁板瓧琛ㄧず
*
* @param
* @return 鏄惁鏁板瓧鐨勬爣蹇�
*/
public static boolean isNumeric(String str) {
// 璇ユ鍒欒〃杈惧紡鍙互鍖归厤鎵�鏈夌殑鏁板瓧 鍖呮嫭璐熸暟
String bigStr;
try {
bigStr = new BigDecimal(str).toString();
} catch (Exception e) {
return false;//寮傚父 璇存槑鍖呭惈闈炴暟瀛椼��
}
Matcher isNum = numericPattern.matcher(bigStr); // matcher鏄叏鍖归厤
if (!isNum.matches()) {
return false;
}
return true;
}
public static int toInt(String s) {
if (s != null && !"".equals(s.trim())) {
try {
return Integer.parseInt(s);
} catch (Exception e) {
return 0;
}
}
return 0;
}
/**
* 鎴彇鍓嶅悗閮戒笉鏄�0鐨勬暟瀛楀瓧绗︿覆
* <p>
* 12010102 => 12010102
* 12010100 => 120101
* ab1201100b => 12011
*
* @param str
* @return
*/
public static String delEndZero(String str) {
Matcher mat = NOT_ZERO_AT_THE_END.matcher(str);
boolean rs = mat.find();
if (rs) {
return mat.group(0);
}
return null;
}
/**
* <pre>
* 绉婚櫎瀛楃涓插悗闈㈢殑0
* </pre>
*
* @param s
* @return
*/
public static String removeSufixZero(String s) {
if (s == null) {
return "";
}
while (s.endsWith("0")) {
if (s.equals("0")) {
s = "";
break;
}
s = s.substring(0, s.length() - 1);
}
return s;
}
public static String notNull(String s){
return s!=null?s:"";
}
public static boolean isStartWithDigit(String str){
char firstCharacter = str.charAt(0);
return Character.isDigit(firstCharacter);
}
public static void main(String[] args){
System.out.println(isStartWithDigit("a3730e937-17e5-4720-8f69-99e8d87d2ee7"));
}
}
package com.yeejoin.amos.jpush.common.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
* <pre>
* 鐢ㄦ埛淇℃伅
* </pre>
*
* @author amos
* @version $Id: UserModel.java, v 0.1 2019骞�7鏈�31鏃� 涓嬪崍8:07:53 amos Exp $
*/
public class UserModel implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 鐗╃悊涓婚敭
*/
protected Long sequenceNbr;
/**
* 鍒涘缓鏃ユ湡
*/
protected Date recDate;
/**
* 鍒涘缓浜�
*/
protected String recUserId;
/**
* 绯荤粺鐢ㄦ埛ID
*/
private String userId;
private String agencyCode;
/**
* 鏁版嵁閿佸畾鐘舵��: N :闈為攣瀹� / Y: 閿佸畾
*/
private String lockStatus;
/**
* 鏁版嵁閿佸畾鏃堕棿
*/
private Date lockDate;
/**
* 閿佸畾浜篒D澶栭敭
*/
private String lockUserId;
/**
* 鐪熷疄濮撳悕
*/
private String realName;
/**
* 鎵嬫満鍙�
*/
private String mobile;
/**
* 閭
*/
private String email;
/**
* 鐧婚檰鐢ㄦ埛鍚�
*/
private String userName;
/**
* 鍒涘缓鏃堕棿
*/
private Date createTime;
/**
* 鍥哄畾鐢佃瘽
*/
private String landlinePhone;
private String password;
private String rePassword;
private String originalPassword;
private String verifyCode;
private String originalMobile;
private List<Map<String, Object>> companys;//鍗曚綅闆嗗悎
private Map<Long, List<Map<String, Object>>> companyDepartments;//key涓哄崟浣峣d锛寁alue涓洪儴闂ㄩ泦鍚�
private Map<Long, List<Map<String, Object>>> orgRoles;//key涓虹粍缁囨満鏋刬d锛堝崟浣�/閮ㄩ棬锛夛紝value涓鸿鑹查泦鍚�
public String getOriginalPassword() {
return originalPassword;
}
public void setOriginalPassword(String originalPassword) {
this.originalPassword = originalPassword;
}
public String getOriginalMobile() {
return originalMobile;
}
public void setOriginalMobile(String originalMobile) {
this.originalMobile = originalMobile;
}
public String getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRePassword() {
return rePassword;
}
public void setRePassword(String rePassword) {
this.rePassword = rePassword;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getAgencyCode() {
return agencyCode;
}
public void setAgencyCode(String agencyCode) {
this.agencyCode = agencyCode;
}
public String getLockStatus() {
return lockStatus;
}
public void setLockStatus(String lockStatus) {
this.lockStatus = lockStatus;
}
public Date getLockDate() {
return lockDate;
}
public void setLockDate(Date lockDate) {
this.lockDate = lockDate;
}
public String getLockUserId() {
return lockUserId;
}
public void setLockUserId(String lockUserId) {
this.lockUserId = lockUserId;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getLandlinePhone() {
return landlinePhone;
}
public void setLandlinePhone(String landlinePhone) {
this.landlinePhone = landlinePhone;
}
public List<Map<String, Object>> getCompanys()
{
return companys;
}
public void setCompanys(List<Map<String, Object>> companys)
{
this.companys = companys;
}
public Map<Long, List<Map<String, Object>>> getCompanyDepartments()
{
return companyDepartments;
}
public void setCompanyDepartments(
Map<Long, List<Map<String, Object>>> companyDepartments)
{
this.companyDepartments = companyDepartments;
}
public Map<Long, List<Map<String, Object>>> getOrgRoles()
{
return orgRoles;
}
public void setOrgRoles(Map<Long, List<Map<String, Object>>> orgRoles)
{
this.orgRoles = orgRoles;
}
public Long getSequenceNbr()
{
return sequenceNbr;
}
public void setSequenceNbr(Long sequenceNbr)
{
this.sequenceNbr = sequenceNbr;
}
public Date getRecDate()
{
return recDate;
}
public void setRecDate(Date recDate)
{
this.recDate = recDate;
}
public String getRecUserId()
{
return recUserId;
}
public void setRecUserId(String recUserId)
{
this.recUserId = recUserId;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
}
package com.yeejoin.amos.jpush.common.enums;
/**
* JPush 推送类型
* @author maoying
*
*/
public enum JPushTypeEnum {
ALL("广播","1"),
TAG("标签","2" ),
ALIAS("别名", "3");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
private JPushTypeEnum(String name,String code){
this.name = name;
this.code = code;
}
public static JPushTypeEnum getEnum(String code) {
JPushTypeEnum jPushTypeEnum = null;
for(JPushTypeEnum type: JPushTypeEnum.values()) {
if (type.getCode().equals(code)) {
jPushTypeEnum = type;
break;
}
}
return jPushTypeEnum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
package com.yeejoin.amos.jpush.common.vo;
/**
* 用于请求和返回数据使用
*
*/
public class BaseParam {
Long id;
/**
* 页码,默认值1
*/
protected Integer current = 1;
/**
* 每页记录数
*/
private Integer pageSize;
/**
* 设备名称
*/
private String name;
/**
* 是否叶子节点,默认true
*/
private Boolean isLeaf = true;
/**
* 从第几条记录开始查
* @return
*/
public Integer getStartPage(){
if(current!=null && current==0) {
return 0;
}
return (current - 1) * pageSize;
}
public Integer getCurrent() {
return current;
}
public void setCurrent(Integer current) {
this.current = current;
}
public void setPageNum(Integer current) {
this.current = current;
}
public Integer getPageSize() {
if(current!=null && current==0) {
return Integer.MAX_VALUE;
}
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getIsLeaf() {
return isLeaf;
}
public void setIsLeaf(Boolean isLeaf) {
this.isLeaf = isLeaf;
}
}
package com.yeejoin.amos.jpush.common.vo;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.Map;
public class DepartmentUserTreeAppVo {
private String name;
private String id;
private String type;
private Map<String, String> object;
private List<DepartmentUserTreeAppVo> children = Lists.newArrayList();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Map<String, String> getObject() {
return object;
}
public void setObject(Map<String, String> object) {
this.object = object;
}
public List<DepartmentUserTreeAppVo> getChildren() {
return children;
}
public void setChildren(List<DepartmentUserTreeAppVo> children) {
this.children = children;
}
}
package com.yeejoin.amos.jpush.common.vo;
import com.google.common.collect.Lists;
import java.util.List;
public class DepartmentUserTreeWebVo {
private String key;
private String label;
private String title;
private String type;
private String value;
private List<DepartmentUserTreeWebVo> children = Lists.newArrayList();
private List<DepartmentUserTreeWebVo> userModelList = Lists.newArrayList();
public List<DepartmentUserTreeWebVo> getUserModelList() {
return userModelList;
}
public void setUserModelList(List<DepartmentUserTreeWebVo> userModelList) {
this.userModelList = userModelList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public List<DepartmentUserTreeWebVo> getChildren() {
return children;
}
public void setChildren(List<DepartmentUserTreeWebVo> children) {
this.children = children;
}
}
\ No newline at end of file
package com.yeejoin.amos.jpush.common.vo;
/**
* @Author: xinglei
* @Description: TODO()
* @Date: 2019/11/27 17:31
*/
public class MonitorParam extends BaseParam {
/**
* 父ID
*/
private Long parentId;
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
}
package com.yeejoin.amos.jpush.util;
import com.yeejoin.amos.jpush.common.entity.CommonResponse;
import com.yeejoin.amos.jpush.common.entity.Constants;
public class CommonResponseUtil
{
public static CommonResponse success()
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
return response;
}
public static CommonResponse success(Object obj)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
response.setDataList(obj);
return response;
}
public static CommonResponse success(Object obj, String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_SUCCESS);
response.setDataList(obj);
response.setMessage(message);
return response;
}
public static CommonResponse failure()
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
return response;
}
public static CommonResponse failure(String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
response.setMessage(message);
return response;
}
public static CommonResponse failure(Object obj, String message)
{
CommonResponse response = new CommonResponse();
response.setResult(Constants.RESULT_FAILURE);
response.setDataList(obj);
response.setMessage(message);
return response;
}
}
package com.yeejoin.amos.jpush.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
/**
* 日期工具类
*
*/
public class DateUtil {
// 默认日期格式
public static final String DATE_DEFAULT_FORMAT = "yyyy-MM-dd";
// 默认日期格式
public static final String DATE_YEARANDMONTH_FORMAT = "yyyy-MM";
// 默认时间格式
public static final String DATETIME_DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final String TIME_DEFAULT_FORMAT = "HH:mm:ss";
// 日期格式化
private static DateFormat dateFormat = null;
// 时间格式化
private static DateFormat dateTimeFormat = null;
// 年月格式化
private static DateFormat dateYearAndMonthFormat = null;
private static DateFormat timeFormat = null;
private static Calendar gregorianCalendar = null;
static {
dateFormat = new SimpleDateFormat(DATE_DEFAULT_FORMAT);
dateYearAndMonthFormat = new SimpleDateFormat(DATE_YEARANDMONTH_FORMAT);
dateTimeFormat = new SimpleDateFormat(DATETIME_DEFAULT_FORMAT);
timeFormat = new SimpleDateFormat(TIME_DEFAULT_FORMAT);
gregorianCalendar = new GregorianCalendar();
}
/**
* 日期格式化yyyy-MM-dd
*
* @param date
* @return
*/
public static Date formatDate(String date, String format) {
try {
return new SimpleDateFormat(format).parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 日期格式化yyyy-MM-dd
*
* @param date
* @return
*/
public static String getDateFormat(Date date) {
return dateFormat.format(date);
}
/**
* 日期格式化yyyy-MM
*
* @param date
* @return
*/
public static String getDateYearAndMonthFormat(Date date) {
return dateYearAndMonthFormat.format(date);
}
/**
* 日期格式化yyyy-MM-dd HH:mm:ss
*
* @param date
* @return
*/
public static String getDateTimeFormat(Date date) {
return dateTimeFormat.format(date);
}
/**
* 时间格式化
*
* @param date
* @return HH:mm:ss
*/
public static String getTimeFormat(Date date) {
return timeFormat.format(date);
}
/**
* 日期格式化
*
* @param date
* @param 格式类型
* @return
*/
public static String getDateFormat(Date date, String formatStr) {
if (StringUtils.isNotBlank(formatStr)) {
return new SimpleDateFormat(formatStr).format(date);
}
return null;
}
/**
* 日期格式化
*
* @param date
* @return
*/
public static Date getDateFormat(String date) {
try {
return dateFormat.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 时间格式化
*
* @param date
* @return
*/
public static Date getDateTimeFormat(String date) {
try {
return dateTimeFormat.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 获取当前日期(yyyy-MM-dd)
*
* @param date
* @return
*/
public static Date getNowDate() {
return DateUtil.getDateFormat(dateFormat.format(new Date()));
}
/**
* 获取当前日期星期一日期
*
* @return date
*/
public static Date getFirstDayOfWeek() {
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek()); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取当前日期星期日日期
*
* @return date
*/
public static Date getLastDayOfWeek() {
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek() + 6); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取日期星期一日期
*
* @param 指定日期
* @return date
*/
public static Date getFirstDayOfWeek(Date date) {
if (date == null) {
return null;
}
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek()); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取日期星期一日期
*
* @param 指定日期
* @return date
*/
public static Date getLastDayOfWeek(Date date) {
if (date == null) {
return null;
}
gregorianCalendar.setFirstDayOfWeek(Calendar.MONDAY);
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_WEEK, gregorianCalendar.getFirstDayOfWeek() + 6); // Monday
return gregorianCalendar.getTime();
}
/**
* 获取当前月的第一天
*
* @return date
*/
public static Date getFirstDayOfMonth() {
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
return gregorianCalendar.getTime();
}
/**
* 获取当前月的最后一天
*
* @return
*/
public static Date getLastDayOfMonth() {
gregorianCalendar.setTime(new Date());
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
gregorianCalendar.add(Calendar.MONTH, 1);
gregorianCalendar.add(Calendar.DAY_OF_MONTH, -1);
return gregorianCalendar.getTime();
}
/**
* 获取指定月的第一天
*
* @param date
* @return
*/
public static Date getFirstDayOfMonth(Date date) {
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
return gregorianCalendar.getTime();
}
/**
* 获取指定月的最后一天
*
* @param date
* @return
*/
public static Date getLastDayOfMonth(Date date) {
gregorianCalendar.setTime(date);
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 1);
gregorianCalendar.add(Calendar.MONTH, 1);
gregorianCalendar.add(Calendar.DAY_OF_MONTH, -1);
return gregorianCalendar.getTime();
}
/**
* 获取日期前一天
*
* @param date
* @return
*/
public static Date getDayBefore(Date date) {
gregorianCalendar.setTime(date);
int day = gregorianCalendar.get(Calendar.DATE);
gregorianCalendar.set(Calendar.DATE, day - 1);
return gregorianCalendar.getTime();
}
/**
* 获取日期后一天
*
* @param date
* @return
*/
public static Date getDayAfter(Date date) {
gregorianCalendar.setTime(date);
int day = gregorianCalendar.get(Calendar.DATE);
gregorianCalendar.set(Calendar.DATE, day + 1);
return gregorianCalendar.getTime();
}
/**
* 获取当前年
*
* @return
*/
public static int getNowYear() {
Calendar d = Calendar.getInstance();
return d.get(Calendar.YEAR);
}
/**
* 获取当前月份
*
* @return
*/
public static int getNowMonth() {
Calendar d = Calendar.getInstance();
return d.get(Calendar.MONTH) + 1;
}
/**
* 获取date的年
*
* @return
*/
public static int getDateYear(Date date) {
Calendar d = Calendar.getInstance();
d.setTime(date);
return d.get(Calendar.YEAR);
}
/**
* 获取date的月份
*
* @return
*/
public static int getDateMonth(Date date) {
Calendar d = Calendar.getInstance();
d.setTime(date);
return d.get(Calendar.MONTH) + 1;
}
/**
* 获取当月天数
*
* @return
*/
public static int getNowMonthDay() {
Calendar d = Calendar.getInstance();
return d.getActualMaximum(Calendar.DATE);
}
/**
* 获取时间段的每一天
*
* @param 开始日期
* @param 结算日期
* @return 日期列表
*/
public static List<Date> getEveryDay(Date startDate, Date endDate) {
if (startDate == null || endDate == null) {
return null;
}
// 格式化日期(yy-MM-dd)
startDate = DateUtil.getDateFormat(DateUtil.getDateFormat(startDate));
endDate = DateUtil.getDateFormat(DateUtil.getDateFormat(endDate));
List<Date> dates = new ArrayList<Date>();
gregorianCalendar.setTime(startDate);
dates.add(gregorianCalendar.getTime());
while (gregorianCalendar.getTime().compareTo(endDate) < 0) {
// 加1天
gregorianCalendar.add(Calendar.DAY_OF_MONTH, 1);
dates.add(gregorianCalendar.getTime());
}
return dates;
}
/**
* 获取提前多少个月
*
* @param monty
* @return
*/
public static Date getFirstMonth(int monty) {
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -monty);
return c.getTime();
}
/**
* 得到现在时间
*
* @return
*/
public static Date getNow()
{
Date currentTime = new Date();
return currentTime;
}
/**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm:ss
*/
public static String getNowDateLongForHandset()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd-HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString;
}
public static String getDateLongForHandset(java.util.Date dateDate){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
public static String getDateStr(String formatterstr) {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(formatterstr);
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取现在时间
*
* @return 返回时间类型 yyyy-MM-dd HH:mm:ss
*/
public static Date getNowDateLong()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
}
/**
* 获取现在时间
*
* @return返回短时间格式 yyyy-MM-dd
*/
public static Date getNowDateShort()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
}
/**
* 获取现在时间字符串
*
* @return返回字符串格式 yyyy-MM-dd HH:mm:ss
*/
public static String getNowStrLong()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取现在时间字符串
*
* @return 返回短时间字符串格式yyyy-MM-dd
*/
public static String getNowStrShort()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 获取时间 小时:分;秒 HH:mm:ss
*
* @return
*/
public static String getNowHHMMSS()
{
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
Date currentTime = new Date();
String dateString = formatter.format(currentTime);
return dateString;
}
/**
*
* <pre>
*
* </pre>
*
* @param strDate
* @param dateFormat
* @return
*/
public static Date str2Date(String strDate, String dateFormat)
{
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
*
* <pre>
* e.g localDateStr ="2017-03-30T06:28:12.803Z";
* </pre>
*
* @param strDate
* @param dateFormat
* @return
*/
public static Date localDateStr2Date(String localDateStr)
{
LocalDateTime localDate = LocalDateTime.parse(localDateStr,DateTimeFormatter.ISO_ZONED_DATE_TIME);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formatLocalDate2Str = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(formatLocalDate2Str, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
*
* @param strDate
* @return
*/
public static Date longStr2Date(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm
*
* @param strDate
* @return
*/
public static Date longStr3Date(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 将长时间格式字符串转换为long型数据
*
* @param strDate
* @return
*/
public static Long longStr2Long(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate.getTime();
}
/**
* 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss
*
* @param dateDate
* @return
*/
public static String date2LongStr(Date dateDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
/**
* 将短时间格式时间转换为字符串 yyyy-MM-dd
*
* @param dateDate
* @param k
* @return
*/
public static String date2ShortStr(java.util.Date dateDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(dateDate);
return dateString;
}
/**
*
* <pre>
*
* </pre>
*
* @param l
* @param dateFormat
* @return
*/
public static String long2Str(long l, String dateFormat)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 把LONG数据类型转换为字符串
*
* @param l
* @return
*/
public static String long2LongStr(long l)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 把LONG数据类型转换为字符串
*
* <pre>
*
* </pre>
*
* @param l
* @return
*/
public static String long2ShortStr(long l)
{
if (l == 0)
{
return "";
}
try
{
Date dateDate = new Date(l);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(dateDate);
return dateString;
}
catch (Exception e)
{
return "";
}
}
/**
* 将短时间格式字符串转换为时间 yyyy-MM-dd
*
* @param strDate
* @return
*/
public static Date shortStr2ShortDate(String strDate)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
/**
* 提取一个月中的最后一天
*
* @param day
* @return
*/
public static Date getLastDateOfThisMonth(long day)
{
Date date = new Date();
long date_3_hm = date.getTime() - 3600000 * 34 * day;
Date date_3_hm_date = new Date(date_3_hm);
return date_3_hm_date;
}
/**
* 获取日期中的年
*
* @param date
* @return
*/
public static String getYear(Date date) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
String year;
year = dateString.substring(0, 4);
return year;
}
/**
* 得到现在小时
*/
public static String getHour()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String hour;
hour = dateString.substring(11, 13);
return hour;
}
/**
* 得到现在分钟
*
* @return
*/
public static String getMinute()
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String min;
min = dateString.substring(14, 16);
return min;
}
/**
* 根据用户传入的时间表示格式,返回当前时间的格式 如果是yyyyMMdd,注意字母y不能大写。
*
* @param sformat
* yyyyMMddhhmmss
* @return
*/
public static String parseDate(String sformat)
{
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(sformat);
String dateString = formatter.format(currentTime);
return dateString;
}
/**
* 二个小时时间间的差值,必须保证二个时间都是"HH:MM"的格式,返回字符型的分钟
*/
public static String getTwoHour(String st1, String st2)
{
String[] kk = null;
String[] jj = null;
kk = st1.split(":");
jj = st2.split(":");
if (Integer.parseInt(kk[0]) < Integer.parseInt(jj[0])) return "0";
else
{
double y = Double.parseDouble(kk[0]) + Double.parseDouble(kk[1]) / 60;
double u = Double.parseDouble(jj[0]) + Double.parseDouble(jj[1]) / 60;
if ((y - u) > 0) return y - u + "";
else
return "0";
}
}
/**
* 得到二个日期间的间隔天数
*/
public static String getTwoDay(String sj1, String sj2)
{
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
long day = 0;
try
{
java.util.Date date = myFormatter.parse(sj1);
java.util.Date mydate = myFormatter.parse(sj2);
day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
}
catch (Exception e)
{
return "";
}
return day + "";
}
/**
* 时间前推或后推分钟,其中JJ表示分钟.
*/
public static String getPreTime(String sj1, String jj)
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String mydate1 = "";
try
{
Date date1 = format.parse(sj1);
long Time = (date1.getTime() / 1000) + Integer.parseInt(jj) * 60;
date1.setTime(Time * 1000);
mydate1 = format.format(date1);
}
catch (Exception e)
{
mydate1 = "";
}
return mydate1;
}
/**
* 得到一个时间延后或前移几天的时间,nowdate为时间,delay为前移或后延的天数
*/
public static String getNextDay(String nowdate, String delay)
{
try
{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String mdate = "";
Date d = shortStr2ShortDate(nowdate);
long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60;
d.setTime(myTime * 1000);
mdate = format.format(d);
return mdate;
}
catch (Exception e)
{
return "";
}
}
/**
* 判断是否润年
*
* @param ddate
* @return
*/
public static boolean isLeapYear(String ddate)
{
/**
* 详细设计: 1.被400整除是闰年,否则: 2.不能被4整除则不是闰年 3.能被4整除同时不能被100整除则是闰年
* 3.能被4整除同时能被100整除则不是闰年
*/
Date d = shortStr2ShortDate(ddate);
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(d);
int year = gc.get(Calendar.YEAR);
if ((year % 400) == 0) return true;
else if ((year % 4) == 0)
{
if ((year % 100) == 0) return false;
else
return true;
}
else
return false;
}
/**
* 返回美国时间格式 26 Apr 2006
*
* @param str
* @return
*/
public static String getEDate(String str)
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(str, pos);
String j = strtodate.toString();
String[] k = j.split(" ");
return k[2] + k[1].toUpperCase() + k[5].substring(2, 4);
}
/**
* 获取一个月的最后一天
*
* @param dat
* @return
*/
public static String getEndDateOfMonth(String dat)
{// yyyy-MM-dd
String str = dat.substring(0, 8);
String month = dat.substring(5, 7);
int mon = Integer.parseInt(month);
if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12)
{
str += "31";
}
else if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
{
str += "30";
}
else
{
if (isLeapYear(dat))
{
str += "29";
}
else
{
str += "28";
}
}
return str;
}
/**
* 判断二个时间是否在同一个周
*
* @param date1
* @param date2
* @return
*/
public static boolean isSameWeekDates(Date date1, Date date2)
{
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
cal1.setTime(date1);
cal2.setTime(date2);
int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
if (0 == subYear)
{
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
else if (1 == subYear && 11 == cal2.get(Calendar.MONTH))
{
// 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
else if (-1 == subYear && 11 == cal1.get(Calendar.MONTH))
{
if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) return true;
}
return false;
}
/**
* 产生周序列,即得到当前时间所在的年度是第几周
*
* @return
*/
public static String getSeqWeek()
{
Calendar c = Calendar.getInstance(Locale.CHINA);
String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
if (week.length() == 1) week = "0" + week;
String year = Integer.toString(c.get(Calendar.YEAR));
return year + week;
}
/**
* 获得一个日期所在的周的星期几的日期,如要找出2002年2月3日所在周的星期一是几号
*
* @param sdate
* @param num
* @return
*/
public static String getWeek(String sdate, String num)
{
// 再转换为时间
Date dd = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(dd);
if (num.equals("1")) // 返回星期一所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
else if (num.equals("2")) // 返回星期二所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
else if (num.equals("3")) // 返回星期三所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
else if (num.equals("4")) // 返回星期四所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
else if (num.equals("5")) // 返回星期五所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
else if (num.equals("6")) // 返回星期六所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
else if (num.equals("0")) // 返回星期日所在的日期
c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
}
/**
* 根据一个日期,返回是星期几的字符串
*
* @param sdate
* @return
*/
public static String getWeek(String sdate)
{
// 再转换为时间
Date date = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
// int hour=c.get(Calendar.DAY_OF_WEEK);
// hour中存的就是星期几了,其范围 1~7
// 1=星期日 7=星期六,其他类推
return new SimpleDateFormat("EEEE").format(c.getTime());
}
public static String getWeekStr(String sdate)
{
String str = "";
str = getWeek(sdate);
if ("1".equals(str))
{
str = "星期日";
}
else if ("2".equals(str))
{
str = "星期一";
}
else if ("3".equals(str))
{
str = "星期二";
}
else if ("4".equals(str))
{
str = "星期三";
}
else if ("5".equals(str))
{
str = "星期四";
}
else if ("6".equals(str))
{
str = "星期五";
}
else if ("7".equals(str))
{
str = "星期六";
}
return str;
}
/**
* 两个时间之间的天数
*
* @param date1
* @param date2
* @return
*/
public static long getDays(String date1, String date2)
{
if (date1 == null || date1.equals("")) return 0;
if (date2 == null || date2.equals("")) return 0;
// 转换为标准时间
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date date = null;
java.util.Date mydate = null;
try
{
date = myFormatter.parse(date1);
mydate = myFormatter.parse(date2);
}
catch (Exception e)
{
;
}
long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
return day;
}
/**
* 形成如下的日历 , 根据传入的一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 星期六 下面是当月的各个时间
* 此函数返回该日历第一行星期日所在的日期
*
* @param sdate
* @return
*/
public static String getNowMonth(String sdate)
{
// 取该时间所在月的一号
sdate = sdate.substring(0, 8) + "01";
// 得到这个月的1号是星期几
Date date = shortStr2ShortDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
int u = c.get(Calendar.DAY_OF_WEEK);
String newday = DateUtil.getNextDay(sdate, (1 - u) + "");
return newday;
}
/**
* 取得数据库主键 生成格式为yyyymmddhhmmss+k位随机数
*
* @param k
* 表示是取几位随机数,可以自己定
*/
public static String getNo(int k)
{
return parseDate("yyyyMMddhhmmss") + getRandom(k);
}
/**
* 返回一个随机数
*
* @param i
* @return
*/
private static String getRandom(int i)
{
Random jjj = new Random();
// int suiJiShu = jjj.nextInt(9);
if (i == 0) return "";
String jj = "";
for (int k = 0; k < i; k++)
{
jj = jj + jjj.nextInt(9);
}
return jj;
}
/**
*
* @param args
*/
public static boolean rightDate(String date)
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
if (date == null) return false;
if (date.length() > 10)
{
sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
}
else
{
sdf = new SimpleDateFormat("yyyy-MM-dd");
}
try
{
sdf.parse(date);
}
catch (ParseException e)
{
return false;
}
return true;
}
public static void main(String[] args)
{
//
}
/**
* 将date 按照指定 的 格式 formatStr 转换成 字符串
*
* @param date
* @param formatStr
* @return
*/
public static String date2Str(Date date, String formatStr)
{
SimpleDateFormat formatter = new SimpleDateFormat(formatStr);
String dateString = formatter.format(date);
return dateString;
}
/**
* 增加hours小時
*
* @param date
* @param hours
* @return
*/
public static Date addHours(Date date, int hours)
{
if (date == null) return null;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.HOUR_OF_DAY, hours);// 24小时制
// cal.add(Calendar.HOUR, x);12小时制
date = cal.getTime();
return date;
}
/**
* 增加minutes分鐘
*
* @param date
* @param minutes
* @return
*/
public static Date addMinutes(Date date, int minutes)
{
if (date == null) return null;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MINUTE, minutes);//
date = cal.getTime();
return date;
}
/**
* 功能描述:格式化日期
*
* @param dateStr
* String 字符型日期
* @param format
* String 格式
* @return Date 日期
*/
public static Date parseDate(String dateStr, String format) {
Date date=null;
try {
DateFormat dateFormat = new SimpleDateFormat(format);
date = (Date) dateFormat.parse(dateStr);
} catch (Exception e) {
}
return date;
}
// 指定模式的时间格式
private static SimpleDateFormat getSDFormat(String pattern) {
return new SimpleDateFormat(pattern);
}
/**
* 当前日历,这里用中国时间表示
*
* @return 以当地时区表示的系统当前日历
*/
public static Calendar getCalendar() {
return Calendar.getInstance();
}
/**
* 默认日期按指定格式显示
*
* @param pattern
* 指定的格式
* @return 默认日期按指定格式显示
*/
public static String formatDate(String pattern) {
return getSDFormat(pattern).format(getCalendar().getTime());
}
/**
* 获取当前时间任意
* @return
*/
public static String get(int field) {
return String.valueOf(getCalendar().get(field));
}
/**
* 获取今日的开始时间
* @return
*/
public static Date getTodayBeginTime(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
Date today = calendar.getTime();
return today;
}
/**
* 获取今日的结束时间
* @return
*/
public static Date getTodayEndTime(){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date today = calendar.getTime();
return today;
}
/**
* 获取两个时间相差的 *小时*分钟
* @param endDate
* @param nowDate
* @return
*/
public static String getDatePoorToMin(Date endDate, Date nowDate) {
// long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
// long day = diff / nd;
// 计算差多少小时
long hour = diff / nh;
// 计算差多少分钟
long min = diff % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return hour + "小时" + min + "分钟";
}
public static String getDatePoorToSec(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
long ss = 1000;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
long sen = diff % nd % nh % nm / ss;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟"+ sen + "秒";
}
}
\ No newline at end of file
package com.yeejoin.amos.jpush.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
/**
*
* <pre>
* JSON工具类
* </pre>
*
* @author dell
* @version $Id: JSONUtil.java, v 0.1 2017年3月28日 下午9:04:47 dell Exp $
*/
public class JSONUtil
{
private static Gson gson = null;
static
{
gson = new Gson();
}
public static synchronized Gson newInstance()
{
if (gson == null)
{
gson = new Gson();
}
return gson;
}
public static String toJson(Object obj)
{
return gson.toJson(obj);
}
public static <T> T toBean(String json, Class<T> clz)
{
return gson.fromJson(json, clz);
}
public static <T> Map<String, T> toMap(String json, Class<T> clz)
{
Map<String, JsonObject> map = gson.fromJson(json,
new TypeToken<Map<String, JsonObject>>() {
}.getType());
Map<String, T> result = new HashMap<>();
for (String key : map.keySet())
{
result.put(key, gson.fromJson(map.get(key), clz));
}
return result;
}
public static Map<String, Object> toMap(String json)
{
Map<String, Object> map = gson.fromJson(json,
new TypeToken<Map<String, Object>>() {
}.getType());
return map;
}
public static <T> List<T> toList(String json, Class<T> clz)
{
JsonArray array = new JsonParser().parse(json).getAsJsonArray();
List<T> list = new ArrayList<>();
for (final JsonElement elem : array)
{
list.add(gson.fromJson(elem, clz));
}
return list;
}
}
package com.yeejoin.amos.jpush.util;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.enums.ValuedEnum;
/**
*
* <pre>
* 操作枚举
* </pre>
*
* @author as-hanshipeng
* @version $Id: QueryOperatorEnum.java, v 0.1 2016-12-10 下午03:07:33 as-hanshipeng Exp $
*/
public final class QueryOperatorEnum extends ValuedEnum
{
private static final long serialVersionUID = -375127751242109017L;
public static final int LESS_VALUE = 1; //小于
public static final int BIGGER_VALUE = 2; //大于
public static final int EQUAL_VALUE = 3; //等于
public static final int LESS_EQUAL_VALUE = 4; // 小于等于
public static final int BIGGER_EQUAL_VALUE = 5; //大于等于
public static final int NOT_EQUAL_VALUE = 6; //不等于
public static final int IN_VALUE = 7; //包含
public static final int LIKE_VALUE = 8; //like
public static final int OR_VALUE = 9; // 或者
public static final int ORDER_VALUE = 10; // 排序
public static final int NOT_IN_VALUE = 11; // 不包含
public static final int IS_VALUE= 12; //是
public static final QueryOperatorEnum LESS = new QueryOperatorEnum("LESS",
1, "<");
public static final QueryOperatorEnum BIGGER = new QueryOperatorEnum(
"BIGGER", 2, ">");
public static final QueryOperatorEnum EQUAL = new QueryOperatorEnum(
"EQUAL", 3, "=");
public static final QueryOperatorEnum LESS_EQUAL = new QueryOperatorEnum(
"LESS_EQUAL", 4, "<=");
public static final QueryOperatorEnum BIGGER_EQUAL = new QueryOperatorEnum(
"BIGGER_EQUAL", 5, ">=");
public static final QueryOperatorEnum NOT_EQUAL = new QueryOperatorEnum(
"NOT_EQUAL", 6, "<>");
public static final QueryOperatorEnum IN = new QueryOperatorEnum("IN", 7,
"IN");
public static final QueryOperatorEnum LIKE = new QueryOperatorEnum("LIKE",
8, "LIKE");
public static final QueryOperatorEnum OR = new QueryOperatorEnum("OR", 9,
"OR");
public static final QueryOperatorEnum ORDER_BY = new QueryOperatorEnum(
"ORDER BY", 10, "ORDER BY");
public static final QueryOperatorEnum NOT_IN = new QueryOperatorEnum(
"NOT IN", 11, "NOT IN");
public static final QueryOperatorEnum IS = new QueryOperatorEnum(
"IS", 12, "IS");
public String condition;
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
protected QueryOperatorEnum(String arg0, int arg1,String condition)
{
super(arg0, arg1);
this.condition = condition;
}
public static QueryOperatorEnum getEnum(String name)
{
try{
return ((QueryOperatorEnum)getEnum(QueryOperatorEnum.class, name));
}catch(Exception ex){return null;}
}
public static QueryOperatorEnum getEnum(int name)
{
try{
return ((QueryOperatorEnum)getEnum(QueryOperatorEnum.class, name));
}catch(Exception ex){return null;}
}
public static Map getMap()
{
try{
return getEnumMap(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
public static List getList()
{
try{
return getEnumList(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
public static Iterator iterator()
{
try{
return iterator(QueryOperatorEnum.class);
}catch(Exception ex){return null;}
}
}
package com.yeejoin.amos.jpush.util;
import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtil {
private static Pattern NOT_ZERO_AT_THE_END = Pattern.compile("[1-9]+\\d*[1-9]+");
private static Pattern numericPattern = Pattern.compile("-?[0-9]+\\.?[0-9]*");
/**
* 鍒ゆ柇瀵硅薄鏄惁涓虹┖
*
* @param str
* @return
*/
public static boolean isNotEmpty(Object str) {
boolean flag = true;
if (str != null && !str.equals("")) {
if (str.toString().length() > 0) {
flag = true;
}
} else {
flag = false;
}
return flag;
}
/***************************************************************************
* repeat - 閫氳繃婧愬瓧绗︿覆閲嶅鐢熸垚N娆$粍鎴愭柊鐨勫瓧绗︿覆銆�
*
* @param src
* - 婧愬瓧绗︿覆 渚嬪: 绌烘牸(" "), 鏄熷彿("*"), "娴欐睙" 绛夌瓑...
* @param num
* - 閲嶅鐢熸垚娆℃暟
* @return 杩斿洖宸茬敓鎴愮殑閲嶅瀛楃涓�
* @version 1.0 (2006.10.10) Wilson Lin
**************************************************************************/
public static String repeat(String src, int num) {
StringBuffer s = new StringBuffer();
for (int i = 0; i < num; i++)
s.append(src);
return s.toString();
}
/**
* 鍒ゆ柇鏄惁鏁板瓧琛ㄧず
*
* @param
* @return 鏄惁鏁板瓧鐨勬爣蹇�
*/
public static boolean isNumeric(String str) {
// 璇ユ鍒欒〃杈惧紡鍙互鍖归厤鎵�鏈夌殑鏁板瓧 鍖呮嫭璐熸暟
String bigStr;
try {
bigStr = new BigDecimal(str).toString();
} catch (Exception e) {
return false;//寮傚父 璇存槑鍖呭惈闈炴暟瀛椼��
}
Matcher isNum = numericPattern.matcher(bigStr); // matcher鏄叏鍖归厤
if (!isNum.matches()) {
return false;
}
return true;
}
public static int toInt(String s) {
if (s != null && !"".equals(s.trim())) {
try {
return Integer.parseInt(s);
} catch (Exception e) {
return 0;
}
}
return 0;
}
/**
* 鎴彇鍓嶅悗閮戒笉鏄�0鐨勬暟瀛楀瓧绗︿覆
* <p>
* 12010102 => 12010102
* 12010100 => 120101
* ab1201100b => 12011
*
* @param str
* @return
*/
public static String delEndZero(String str) {
Matcher mat = NOT_ZERO_AT_THE_END.matcher(str);
boolean rs = mat.find();
if (rs) {
return mat.group(0);
}
return null;
}
/**
* <pre>
* 绉婚櫎瀛楃涓插悗闈㈢殑0
* </pre>
*
* @param s
* @return
*/
public static String removeSufixZero(String s) {
if (s == null) {
return "";
}
while (s.endsWith("0")) {
if (s.equals("0")) {
s = "";
break;
}
s = s.substring(0, s.length() - 1);
}
return s;
}
public static String notNull(String s){
return s!=null?s:"";
}
public static boolean isStartWithDigit(String str){
char firstCharacter = str.charAt(0);
return Character.isDigit(firstCharacter);
}
public static void main(String[] args){
System.out.println(isStartWithDigit("a3730e937-17e5-4720-8f69-99e8d87d2ee7"));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>amos-boot-module-api</artifactId>
<groupId>com.amosframework.boot</groupId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-module-knowledgebase-api</artifactId>
<dependencies>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-emq</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 规则模块 -->
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
</dependency>
<!-- 解析word -->
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>3.3.6</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-ImportXHTML</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-export-fo</artifactId>
<version>3.3.6</version>
</dependency>
<!-- 解析html -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.2</version>
</dependency>
<!-- 解析pdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>${itext.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>${itext.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>html2pdf</artifactId>
<version>2.0.1</version>
</dependency>
<!-- 解析excel -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
</dependencies>
</project>
package com.yeejoin.amos.knowledgebase.face.model;
import lombok.Data;
/**
* @author 杨博超
* @ClassName AttachmentModel
**/
@Data
public class AttachmentModel {
private String fileType;
private String filename;
private String originalFileName;
private String fileUrl;
}
package com.yeejoin.amos.knowledgebase.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import java.util.Date;
/**
* <p>
* 知识库文档注释信息
* </p>
*
* @author ningtianqing
* @since 2020-09-16
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeDocAnnotateModel extends BaseModel {
/**
* 文档id
*/
private Long docSeq;
/**
* 添加注释的用户id
*/
private String userId;
/**
* 添加注释的用户名称
*/
private String username;
/**
* 是否是当前用户添加的注释
*/
private Boolean isCurrentUser;
/**
* 添加注释后文档内容
*/
private String htmlContent;
/**
* 注释内容
*/
private String annotateContent;
/**
* 注释位置信息(前端定义和使用的内容)
*/
private String positionInfo;
/**
* 机构编号
*/
private String agencyCode;
private Date createTime;
private Date updateTime;
public Date getUpdateTime() {
return recDate;
}
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.foundation.utils.TreeNode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Collection;
/**
* <p>
* 知识库文档分类
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeDocCategoryModel extends BaseModel implements TreeNode<KnowledgeDocCategoryModel,Long> {
/**
* 分组名称
*/
private String categoryName;
private Long parentId;
/**
* 机构编号
*/
private String agencyCode;
private Collection<KnowledgeDocCategoryModel> children;
@Override
public Long getMyParentId() {
return this.parentId;
}
@Override
public Long getMyId() {
return this.sequenceNbr;
}
@Override
public Collection<KnowledgeDocCategoryModel> getChildren() {
return children;
}
@Override
public void setChildren(Collection<KnowledgeDocCategoryModel> children) {
this.children = children;
}
@Override
public int compareTo(KnowledgeDocCategoryModel groupModel) {
return this.getMyId().compareTo(groupModel.getMyId());
}
}
package com.yeejoin.amos.knowledgebase.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import java.util.Date;
/**
* <p>
* 知识库评论信息
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeDocCommentsModel extends BaseModel {
/**
* 文档id
*/
private Long docSeq;
/**
* 发表评论的用户id
*/
private String userId;
private String username;
/**
* 评论内容
*/
private String commentsContent;
/**
* 父级评论id
*/
private Long parentId;
/**
* 机构编号
*/
private String agencyCode;
/**
* 是否点赞
*/
private Boolean like;
/**
* 总点赞数量
*/
private Integer likedNum;
private Date createTime;
public Date getCreateTime() {
return recDate;
}
}
package com.yeejoin.amos.knowledgebase.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
* 知识库文档存储
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeDocContentModel extends BaseModel {
/**
* 富文本内容存储
*/
private String htmlContent;
/**
* 文档状态:发布,未发布
*/
private String docStatus;
/**
* 录入者id
*/
private String userId;
/**
* 录入者姓名
*/
private String userName;
/**
* 创建时间
*/
private Date createTime;
/**
* 是否有附件
*/
private Boolean haveAttachment;
/**
* 摘要
*/
private String summary;
/**
* 机构编号
*/
private String agencyCode;
/**
* 审核状态:通过,驳回,待审核,待提交
**/
private String auditStatus;
/**
* 驳回意见
**/
private String rejectionComment;
/**
* 审核人id
**/
private String auditorUserId;
private String orgCode;
/**
* 纯文本内容
*/
private String textContent;
/**
* 排序内容
*/
private String sortStr;
/**
* 所属目录
*/
private Long directoryId;
/**
* 文档标题
*/
private String docTitle;
private String directoryName; // 目录名称
private Date lastUpdateTime;
private Map<String, Object> docBaseInfo; // 文档基础信息<feildName,value>
private List<KnowledgeTagInstanceModel> docTags; // 文档标签<tagInstanceModel,>
private List<KnowledgeTagInstanceModel> docContentTags; // 文档内容标签<tagInstanceModel>
private List<KnowledgeTagInstanceModel> tagsToShow; // 只能搜索列表显示的标签信息
private List<AttachmentModel> attachments; // 附件信息;<附件id,附件原始名称>
private Boolean collected; // 收藏标识
public Date getLastUpdateTime() {
return recDate;
}
}
package com.yeejoin.amos.knowledgebase.face.model;
import com.baomidou.mybatisplus.annotation.TableField;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 知识库系统动态选项配置的分组,用于区分不同功能的字段列表
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeDynamicsGroupModel extends BaseModel {
/**
* 分组名称
*/
private String groupName;
/**
* 前端配置
*/
private String frontEndConfig;
/**
* 机构编号
*/
private String agencyCode;
/**
* 功能标识
*/
private String functional;
/**
* 业务项目标识
*/
private String appKey;
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 知识库系统动态选项配置,多用于动态字段配置
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeDynamicsOptionModel extends BaseModel {
/**
* 字段名
*/
private String fieldName;
/**
* 中文名
*/
private String fieldLabel;
/**
* 数据类型:文本,数字,枚举,日期
*/
private String dataType;
/**
* 功能标识
*/
private String functional;
/**
* 业务项目标识
*/
private String appKey;
private String frontEndConfig;
/**
* 机构编号
*/
private String agencyCode;
/**
* 字段分组主键
**/
private Long groupSeq;
private String queryStrategy;
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 知识库系统动态选项配置的实例值
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeDynamicsValueModel extends BaseModel {
/**
* 字段名
*/
private String fieldName;
/**
* 中文名
*/
private String fieldLabel;
/**
* 数据类型:文本,数字,枚举,日期
*/
private String dataType;
/**
* 字段分组id
*/
private Long groupSeq;
/**
* 动态配置字段的值
*/
private String fieldValue;
/**
* 关联的对象id,即文档id
*/
private Long instanceId;
/**
* 机构编号
*/
private String agencyCode;
private Long optionSeq;
private String queryStrategy;
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 知识库内容交互计数表
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeInteractionCountModel extends BaseModel {
/**
* 操作类型(标签所有情况引用,标签被已审核/已发布文档引用,文档引用)
*/
private String operateType;
/**
* 关联对象类型
*/
private String entityType;
/**
* 关联对象id
*/
private String entityId;
/**
* 计数
*/
private Integer operateCount;
/**
* 机构编号
*/
private String agencyCode;
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 知识库内容交互记录
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeInteractionRecordModel extends BaseModel {
/**
* 用户id
*/
private String userId;
/**
* 操作类型(点赞,吐槽,收藏)
*/
private String operateType;
/**
* 关联对象类型
*/
private String entityType;
/**
* 关联对象id
*/
private String entityId;
/**
* 机构编号
*/
private String agencyCode;
}
package com.yeejoin.amos.knowledgebase.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
/**
* <p>
* 消息
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeMessageModel extends BaseModel {
/**
* 消息类型
*/
private String messageType;
/**
* 消息标题
*/
private String messageTitle;
/**
* 消息内容
*/
private String messageContent;
/**
* 相关文档ID
*/
private Long targetSeq;
}
package com.yeejoin.amos.knowledgebase.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
/**
* <p>
* 个人消息
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeMessagePersonalModel extends BaseModel {
/**
* 接收人
*/
private String messageOwner;
/**
* 消息ID
*/
private Long messageSeq;
/**
* 消息状态
*/
private Integer messageStatus;
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.foundation.utils.TreeNode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Collection;
/**
* <p>
* 标签分组
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeTagGroupModel extends BaseModel implements TreeNode<KnowledgeTagGroupModel,Long> {
/**
* 标签分类名称
*/
private String groupName;
/**
* 父级分类id
*/
private Long parentId;
/**
* 机构编号
*/
private String agencyCode;
private Collection<KnowledgeTagGroupModel> children;
@Override
public Long getMyParentId() {
return this.parentId;
}
@Override
public Long getMyId() {
return this.sequenceNbr;
}
@Override
public Collection<KnowledgeTagGroupModel> getChildren() {
return children;
}
@Override
public void setChildren(Collection<KnowledgeTagGroupModel> children) {
this.children = children;
}
@Override
public int compareTo(KnowledgeTagGroupModel groupModel) {
return this.getMyId().compareTo(groupModel.getMyId());
}
}
package com.yeejoin.amos.knowledgebase.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
/**
* <p>
* 标签分组
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeTagGroupRefModel extends BaseModel {
/**
* 标签分组id
*/
private Long groupSeq;
/**
* 标签id
*/
private Long tagSeq;
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* <p>
* 标签实例
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeTagInstanceModel extends BaseModel {
/**
* 标签id
*/
private Long tagSeq;
/**
* 标签标记的目标id
*/
private Long targetSeq;
/**
* 标签名称
*/
private String tagName;
/**
* 标记方式:文档,内容
*/
private String markingType;
/**
* 机构编号
*/
private String agencyCode;
private String tagType;
private String frontEndConfig;
private List<KnowledgeTagValueModel> tagValues;//值标签的具体值
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
import java.util.Map;
/**
* <p>
* 标签库
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeTagModel extends BaseModel {
/**
* 标签名称
*/
private String tagName;
/**
* 标签编码
*/
private String tagCode;
/**
* 标签分类:文本标签,值标签,
*/
private String tagType;
/**
* 标签状态:启用,禁用
*/
private String tagStatus;
/**
* 标签备注
*/
private String tagRemark;
/**
* 机构编号
*/
private String agencyCode;
/**
* 被引用数量(所有文档)
*/
private Integer referenceNumber;
/**
* 动态值
*/
private Map<String, Object> tagValues;
/**
* 标签分类
*/
private List<Long> tagGroup;
/**
* 创建人姓名
*/
private String creator;
}
package com.yeejoin.amos.knowledgebase.face.model;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 值标签的实例值
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class KnowledgeTagValueModel extends BaseModel {
/**
* 标签实例id
*/
private Long instanceSeq;
/**
* 值标签的扩展字段名,内容标签文本位置,值标签文本内容/单值/日期,值标签范围最大值-最小值
*/
private String fieldName;
/**
* 值标签扩展字段的值
*/
private String tagValue;
/**
* 机构编号
*/
private String agencyCode;
private String unit;
}
package com.yeejoin.amos.knowledgebase.face.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.rdbms.model.BaseModel;
import java.util.Date;
/**
* <p>
* 标签分组
* </p>
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("knowlege_statistics_record")
public class KnowlegeStatisticsRecordModel extends BaseModel {
/**
* 文档ID
*/
@TableField("DOC_SEQ")
private Long docSeq;
/**
* 警情发生时间
*/
@TableField("DISASTER_TIME")
private Date disasterTime;
/**
* 记录类型
*/
@TableField("RECORD_NAME")
private String recordName;
/**
* 分类字段值
*/
@TableField("CATEGORY_VALUE")
private String categoryValue;
/**
* 统计数值
*/
@TableField("COUNT_VALUE")
private Long countValue;
/**
* 值放大倍数
*/
@TableField("VALUE_WEIGHT")
private Integer valueWeight;
/**
* 数值单位
*/
@TableField("UNIT")
private Long unit;
}
package com.yeejoin.amos.knowledgebase.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.typroject.tyboot.core.foundation.utils.TreeNode;
import java.util.Collection;
/**
* <h1><h1>
*
* @author tiantao
* @date 2021/1/18 11:36
*/
@EqualsAndHashCode
@Data
public class MultipleNodeModel implements TreeNode<MultipleNodeModel, Long> {
private String nodeType;
private Long nodeKey;
private String nodeTitle;
private Long nodeParent;
private Collection<MultipleNodeModel> nodeChildren;
private Object nodeExtraInfo;
@Override
public Long getMyParentId() {
return this.nodeParent;
}
@Override
public Long getMyId() {
return this.nodeKey;
}
@Override
public Collection<MultipleNodeModel> getChildren() {
return this.nodeChildren;
}
@Override
public void setChildren(Collection<MultipleNodeModel> collection) {
this.setNodeChildren(collection);
}
@Override
public int compareTo(MultipleNodeModel o) {
return this.getNodeKey().compareTo(o.getNodeKey());
}
}
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocAnnotate;
/**
* <p>
* 知识库文档注释 Mapper 接口
* </p>
*
* @author ningtianqing
* @since 2020-09-16
*/
public interface DocAnnotateMapper extends BaseMapper<KnowledgeDocAnnotate> {
}
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.model.MultipleNodeModel;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocCategory;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 知识库文档分类 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface DocCategoryMapper extends BaseMapper<KnowledgeDocCategory> {
List<MultipleNodeModel> queryDocAndCategoryTree(@Param("categoryIds") List<Long> categoryIds, @Param("docStatus") String docStatus);
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocComments;
/**
* <p>
* 知识库评论信息 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface DocCommentsMapper extends BaseMapper<KnowledgeDocComments> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* 知识库文档存储 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface DocContentMapper extends BaseMapper<KnowledgeDocContent> {
List<Map<String,Long>> searchForDocIds(@Param("agencyCode") String agencyCode,
@Param("queryStr") String queryStr,
@Param("docStatus")String []docStatus,
@Param("auditStatus")String [] auditStatus,
@Param("userId")String userId,
@Param("orgCode")String orgCode,
@Param("offset") long offset,
@Param("length") long length);
List<Map<String,Object>> queryDocBaseInfoList(Map<String, Object> paramMap);
int queryDocBaseInfoTotal(Map<String, Object> paramMap);
List<Long> getAllPublishedDocIds();
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDynamicsGroup;
/**
* <p>
* 知识库系统动态选项配置的分组,用于区分不同功能的字段列表 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface DynamicsGroupMapper extends BaseMapper<KnowledgeDynamicsGroup> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDynamicsOption;
/**
* <p>
* 知识库系统动态选项配置,多用于动态字段配置 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface DynamicsOptionMapper extends BaseMapper<KnowledgeDynamicsOption> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDynamicsValue;
/**
* <p>
* 知识库系统动态选项配置的实例值 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface DynamicsValueMapper extends BaseMapper<KnowledgeDynamicsValue> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.yeejoin.amos.knowledgebase.face.orm.entity.ESDocEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchCrudRepository;
public interface ESDocRepository extends ElasticsearchCrudRepository<ESDocEntity, Long> {
}
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeInteractionCount;
import java.util.List;
/**
* <p>
* 知识库内容交互计数表 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface InteractionCountMapper extends BaseMapper<KnowledgeInteractionCount> {
/**
* 查询标签被所有文档的引用状况
* @return
*/
List<KnowledgeInteractionCount> queryTagQuoteAll();
/**
* 查询标签被发布文档的引用状况
* @return
*/
List<KnowledgeInteractionCount> queryTagQuotePublish();
/**
* 根据实体类型删除记录
* @param entityType 类型
* @return
*/
int deleteByEntityType(String entityType);
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeInteractionRecord;
/**
* <p>
* 知识库内容交互记录 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface InteractionRecordMapper extends BaseMapper<KnowledgeInteractionRecord> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface MessageMapper extends BaseMapper<KnowledgeMessage> {
List<Map> selectMessageListByOwner(@Param("owner") String owner, @Param("messageType")String messageType);
Map selectMessageBySeq(Long sequenceNbr);
List<Map> selectMessageListByPage(Map<String,Object> param );
Integer selectMessageListByCount(Map<String,Object> param);
}
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeMessagePersonal;
/**
* <p>
* 标签库 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface MessagePersonalMapper extends BaseMapper<KnowledgeMessagePersonal> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowlegeStatisticsRecord;
import java.util.List;
import java.util.Map;
/**
* <p>
* 标签分组 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface StatisticsRecordMapper extends BaseMapper<KnowlegeStatisticsRecord> {
/**
* 表清空
* @return
*/
void deleteAll();
/**
* 查询灾情总计
* @return
*/
Map<String, Object> selectDisasterCount();
/**
* 按类型分组查询
*/
List<Map<String, Object>> selectCategoryByName(String recordName);
/**
* 按类型查询/按时间分段总计
*/
List<Map<String, Object>> selectCountByNameAndDateRange(Map<String, Object> queryMap);
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagGroup;
/**
* <p>
* 标签分组 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface TagGroupMapper extends BaseMapper<KnowledgeTagGroup> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagGroupRef;
/**
* <p>
* 标签分组 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface TagGroupRefMapper extends BaseMapper<KnowledgeTagGroupRef> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
/**
* <p>
* 标签实例 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface TagInstanceMapper extends BaseMapper<KnowledgeTagInstance> {
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTag;
import java.util.List;
/**
* <p>
* 标签库 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface TagMapper extends BaseMapper<KnowledgeTag> {
List<KnowledgeTag> queryTagByNameInPublishedDoc(String tagName);
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* <p>
* 值标签的实例值 Mapper 接口
* </p>
*
* @author 子杨
* @since 2020-08-05
*/
public interface TagValueMapper extends BaseMapper<KnowledgeTagValue> {
/**
* 根据文档id查询标签值列表
* @param docSeq 文档id
* @return
*/
List<KnowledgeTagValue> queryTagValuesByDocId(Long docSeq);
/**
* 根据文档id查询标签值列表
* @param docIds 文档id列表
* @return
*/
List<KnowledgeTagValue> queryTagValuesByDocIds(@Param("docIds") Collection<Long> docIds);
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.util;
public class Constants {
public static final String VALUE_TAG_FIELD_SINGLEVALUE = "singleValue";//单值字段名
public static final String VALUE_TAG_FIELD_RANGE_MAX = "rangeMax";//范围值 上界
public static final String VALUE_TAG_FIELD_RANGE_MIN = "rangeMin";//范围值 下界
public static final String VALUE_TAG_FIELD_TEXT = "text";//文本值
public static final String VALUE_TAG_FIELD_DATE_H = "dateH";//时间,年月日时分秒
public static final String VALUE_TAG_FIELD_ENUM_NAME = "enumName";// 枚举类型字段名
public static final String DOC_STATUS_UNPUBLISHED = "UNPUBLISHED";//文档发布状态--未发布
public static final String DOC_STATUS_PUBLISHED = "PUBLISHED"; //文档发布状态--已发布
public static final String MARKING_TYPE_DOC = "DOC"; // 标记类型--文档标签
public static final String MARKING_TYPE_CONTENT = "CONTENT";// 标记类型--内容标签
/**
* 审核状态--待提交
*/
public static final String DOC_AUDIT_STATUS_SAVED = "SAVED";
/**
* 审核状态--待审核
*/
public static final String DOC_AUDIT_STATUS_SUBMITTED = "SUBMITTED";
/**
* 审核状态--通过
*/
public static final String DOC_AUDIT_STATUS_PASSED = "PASSED";
/**
* 审核状态--驳回
*/
public static final String DOC_AUDIT_STATUS_REJECTED = "REJECTED";
public static final String TAG_INSTANCE_LABEL = "label";
public static final String DELETE_SYNC_PLAN_TOPIC = "DELETE_SYNC_PLAN_DOC";
/**
* 消息类型-要点推送
*/
public static final String MESSAGE_TYPE_PUSH = "ESSENTIAL_PUSH";
/**
* 消息类型-战例分享
*/
public static final String MESSAGE_TYPE_SHARE = "DOC_SHARE";
/**
* 消息主题前缀
*/
public static final String TOPIC_PREFIX = "knowledge_message_";
public static final String SHARE_WAY_APP = "app";
/**
* 标签状态-激活
*/
public static final String TAG_STATUS_ACTIVATE = "ACTIVATED";
/**
* 标签状态-禁用
*/
public static final String TAG_STATUS_DEACTIVATE = "DEACTIVATED";
/**
* 标签类型-文本标签
*/
public static final String TAG_TYPE_TEXT = "TEXT_TAG";
/**
* 标签类型-值标签
*/
public static final String TAG_TYPE_VALUE = "VALUE_TAG";
public static final String APPKEY_ALL = "ALL";
}
...@@ -3,7 +3,6 @@ package com.yeejoin.amos.knowledgebase.face.util; ...@@ -3,7 +3,6 @@ package com.yeejoin.amos.knowledgebase.face.util;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.service.TagValueService;
import lombok.Data; import lombok.Data;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
...@@ -163,10 +162,10 @@ public class DocSortUtil { ...@@ -163,10 +162,10 @@ public class DocSortUtil {
String fieldName = tagValues.get(0).getFieldName(); String fieldName = tagValues.get(0).getFieldName();
String tagValue = tagValues.get(0).getTagValue(); String tagValue = tagValues.get(0).getTagValue();
switch (fieldName) { switch (fieldName) {
case TagValueService.VALUE_TAG_FIELD_DATE_H: case Constants.VALUE_TAG_FIELD_DATE_H:
res = DateUtil.formatStringToDate(tagValue, null).getTime(); res = DateUtil.formatStringToDate(tagValue, null).getTime();
break; break;
case TagValueService.VALUE_TAG_FIELD_SINGLEVALUE: case Constants.VALUE_TAG_FIELD_SINGLEVALUE:
res = Long.valueOf(tagValue); res = Long.valueOf(tagValue);
break; break;
default: default:
......
...@@ -9,10 +9,7 @@ import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent; ...@@ -9,10 +9,7 @@ import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDynamicsValue; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDynamicsValue;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
import com.yeejoin.amos.knowledgebase.face.service.DocAuditService; import com.yeejoin.amos.knowledgebase.face.util.Constants;
import com.yeejoin.amos.knowledgebase.face.service.DocContentService;
import com.yeejoin.amos.knowledgebase.face.service.TagInstanceService;
import com.yeejoin.amos.knowledgebase.face.service.TagValueService;
import com.yeejoin.amos.knowledgebase.face.util.DocSortUtil; import com.yeejoin.amos.knowledgebase.face.util.DocSortUtil;
import lombok.Data; import lombok.Data;
import lombok.Getter; import lombok.Getter;
...@@ -154,7 +151,7 @@ public class ExcelParser { ...@@ -154,7 +151,7 @@ public class ExcelParser {
if (ValidationUtil.isEmpty(cellValue) || !NUMBER_STRING_PATTEN.matcher(cellValue).matches()) { if (ValidationUtil.isEmpty(cellValue) || !NUMBER_STRING_PATTEN.matcher(cellValue).matches()) {
continue; continue;
} }
tagValues.add(getTagValue(tagInstance, TagValueService.VALUE_TAG_FIELD_SINGLEVALUE, cellValue)); tagValues.add(getTagValue(tagInstance, Constants.VALUE_TAG_FIELD_SINGLEVALUE, cellValue));
replaceHtmlHolder(docContent, valueColIndex, cellValue, cellValue); replaceHtmlHolder(docContent, valueColIndex, cellValue, cellValue);
break; break;
} }
...@@ -168,7 +165,7 @@ public class ExcelParser { ...@@ -168,7 +165,7 @@ public class ExcelParser {
Date date = DateUtil.formatStringToDate(cellValue, formatMap.get(valueColIndex)); Date date = DateUtil.formatStringToDate(cellValue, formatMap.get(valueColIndex));
cellValue = DateUtil.formatDate(date, DATE_FORMAT); cellValue = DateUtil.formatDate(date, DATE_FORMAT);
String htmlDateStr = DateUtil.formatDate(date, DATE_FORMAT4_HTML); String htmlDateStr = DateUtil.formatDate(date, DATE_FORMAT4_HTML);
tagValues.add(getTagValue(tagInstance, TagValueService.VALUE_TAG_FIELD_DATE_H, cellValue)); tagValues.add(getTagValue(tagInstance, Constants.VALUE_TAG_FIELD_DATE_H, cellValue));
replaceHtmlHolder(docContent, valueColIndex, htmlDateStr, cellValue); replaceHtmlHolder(docContent, valueColIndex, htmlDateStr, cellValue);
} catch (Exception e) { } catch (Exception e) {
continue; continue;
...@@ -181,7 +178,7 @@ public class ExcelParser { ...@@ -181,7 +178,7 @@ public class ExcelParser {
if (ValidationUtil.isEmpty(cellValue)) { if (ValidationUtil.isEmpty(cellValue)) {
continue; continue;
} }
tagValues.add(getTagValue(tagInstance, TagValueService.VALUE_TAG_FIELD_TEXT, cellValue)); tagValues.add(getTagValue(tagInstance, Constants.VALUE_TAG_FIELD_TEXT, cellValue));
replaceHtmlHolder(docContent, valueColIndex, cellValue, cellValue); replaceHtmlHolder(docContent, valueColIndex, cellValue, cellValue);
break; break;
} }
...@@ -196,11 +193,11 @@ public class ExcelParser { ...@@ -196,11 +193,11 @@ public class ExcelParser {
continue; continue;
} }
if (!ValidationUtil.isEmpty(cellValue1)) { if (!ValidationUtil.isEmpty(cellValue1)) {
tagValues.add(getTagValue(tagInstance, TagValueService.VALUE_TAG_FIELD_RANGE_MIN, cellValue1)); tagValues.add(getTagValue(tagInstance, Constants.VALUE_TAG_FIELD_RANGE_MIN, cellValue1));
replaceHtmlHolder(docContent, valueColIndex1, cellValue1, cellValue1); replaceHtmlHolder(docContent, valueColIndex1, cellValue1, cellValue1);
} }
if (!ValidationUtil.isEmpty(cellValue2)) { if (!ValidationUtil.isEmpty(cellValue2)) {
tagValues.add(getTagValue(tagInstance, TagValueService.VALUE_TAG_FIELD_RANGE_MAX, cellValue2)); tagValues.add(getTagValue(tagInstance, Constants.VALUE_TAG_FIELD_RANGE_MAX, cellValue2));
replaceHtmlHolder(docContent, valueColIndex2, cellValue2, cellValue2); replaceHtmlHolder(docContent, valueColIndex2, cellValue2, cellValue2);
} }
} else { } else {
...@@ -289,8 +286,8 @@ public class ExcelParser { ...@@ -289,8 +286,8 @@ public class ExcelParser {
docContent.setOrgCode(this.orgCode); docContent.setOrgCode(this.orgCode);
docContent.setHtmlContent(excelConfig.getHtmlModule()); docContent.setHtmlContent(excelConfig.getHtmlModule());
docContent.setTextContent(excelConfig.getSummaryModule()); docContent.setTextContent(excelConfig.getSummaryModule());
docContent.setDocStatus(DocContentService.DOC_STATUS_UNPUBLISHED); docContent.setDocStatus(Constants.DOC_STATUS_UNPUBLISHED);
docContent.setAuditStatus(DocAuditService.DOC_AUDIT_STATUS_SAVED); docContent.setAuditStatus(Constants.DOC_AUDIT_STATUS_SAVED);
docContent.setHaveAttachment(false); docContent.setHaveAttachment(false);
return docContent; return docContent;
} }
...@@ -349,7 +346,7 @@ public class ExcelParser { ...@@ -349,7 +346,7 @@ public class ExcelParser {
tagInstance.setTargetSeq(docSequenceNbr); tagInstance.setTargetSeq(docSequenceNbr);
tagInstance.setTagType(tagModel.getTagType()); tagInstance.setTagType(tagModel.getTagType());
tagInstance.setTagName(tagModel.getTagName()); tagInstance.setTagName(tagModel.getTagName());
tagInstance.setMarkingType(TagInstanceService.MARKING_TYPE_DOC); tagInstance.setMarkingType(Constants.MARKING_TYPE_DOC);
return tagInstance; return tagInstance;
} }
......
...@@ -9,11 +9,6 @@ ...@@ -9,11 +9,6 @@
<artifactId>amos-boot-module-maintenance-api</artifactId> <artifactId>amos-boot-module-maintenance-api</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions> <exclusions>
......
...@@ -11,14 +11,8 @@ ...@@ -11,14 +11,8 @@
<artifactId>amos-boot-module-patrol-api</artifactId> <artifactId>amos-boot-module-patrol-api</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions> <exclusions>
......
...@@ -9,11 +9,6 @@ ...@@ -9,11 +9,6 @@
<artifactId>amos-boot-module-supervision-api</artifactId> <artifactId>amos-boot-module-supervision-api</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions> <exclusions>
......
...@@ -11,14 +11,8 @@ ...@@ -11,14 +11,8 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId> <artifactId>spring-data-elasticsearch</artifactId>
<version>4.0.9.RELEASE</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -23,5 +23,7 @@ ...@@ -23,5 +23,7 @@
<module>amos-boot-module-fas-api</module> <module>amos-boot-module-fas-api</module>
<module>amos-boot-module-maintenance-api</module> <module>amos-boot-module-maintenance-api</module>
<module>amos-boot-module-supervision-api</module> <module>amos-boot-module-supervision-api</module>
<module>amos-boot-module-jpush-api</module>
<module>amos-boot-module-knowledgebase-api</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jcs-api</artifactId> <artifactId>amos-boot-module-jcs-api</artifactId>
<version>1.0.0</version> <version>${amos-biz-boot.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -49,8 +49,6 @@ public class FailureAuditController extends BaseController { ...@@ -49,8 +49,6 @@ public class FailureAuditController extends BaseController {
} }
} }
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
...@@ -64,35 +62,6 @@ public class FailureAuditController extends BaseController { ...@@ -64,35 +62,6 @@ public class FailureAuditController extends BaseController {
return ResponseHelper.buildResponse(failureAuditServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(failureAuditServiceImpl.queryBySeq(sequenceNbr));
} }
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
public ResponseModel<Page<FailureAuditDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<FailureAuditDto> page = new Page<FailureAuditDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(failureAuditServiceImpl.queryForFailureAuditPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<FailureAuditDto>> selectForList() {
return ResponseHelper.buildResponse(failureAuditServiceImpl.queryForFailureAuditList());
}
/** /**
* 审核列表记录查询 * 审核列表记录查询
......
...@@ -2,23 +2,23 @@ package com.yeejoin.amos.boot.module.common.biz.controller; ...@@ -2,23 +2,23 @@ package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.common.api.entity.FailureAudit;
import com.yeejoin.amos.boot.module.common.api.entity.FailureMaintain; import com.yeejoin.amos.boot.module.common.api.entity.FailureMaintain;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.FailureMaintainDto; import com.yeejoin.amos.boot.module.common.api.dto.FailureMaintainDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FailureMaintainServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FailureMaintainServiceImpl;
...@@ -59,71 +59,6 @@ public class FailureMaintainController extends BaseController { ...@@ -59,71 +59,6 @@ public class FailureMaintainController extends BaseController {
} }
/** /**
* 根据sequenceNbr更新
* 根据传递的Status状态确认验收状态
*
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/verify")
@ApiOperation(httpMethod = "PUT", value = "验收操作", notes = "根据sequenceNbr更新")
public Object updateBySequenceNbrFailureMaintain(@RequestBody FailureMaintainDto model) {
try {
return ResponseHelper.buildResponse(failureMaintainServiceImpl.updateModel(model,getSelectedOrgInfo()));
} catch (Exception e) {
e.printStackTrace();
return ResponseHelper.buildResponse(false);
}
}
/*
*/
/**
* 根据sequenceNbr更新
* 根据传递的Status状态确认验收状态
*
* @param sequenceNbr 主键
* @return
*//*
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/update/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "维修完成", notes = "根据sequenceNbr更新")
public Object updateByFailureMaintain(@RequestBody FailureMaintainDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
try {
return ResponseHelper.buildResponse(failureMaintainServiceImpl.updateStatus(model,getSelectedOrgInfo()));
} catch (Exception e) {
return ResponseHelper.buildResponse(false);
}
}
*/
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
public ResponseModel<Page<FailureMaintainDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<FailureMaintainDto> page = new Page<FailureMaintainDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(failureMaintainServiceImpl.queryForFailureMaintainPage(page));
}
/**
* 维修列表记录查询 * 维修列表记录查询
*根据关联主表faultId查询 *根据关联主表faultId查询
* @return * @return
......
...@@ -7,6 +7,8 @@ import java.util.Map; ...@@ -7,6 +7,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.SearchHits; import org.springframework.data.elasticsearch.core.SearchHits;
...@@ -320,7 +322,52 @@ public class OrgUsrController extends BaseController { ...@@ -320,7 +322,52 @@ public class OrgUsrController extends BaseController {
} }
/**
*
* 获取单位部门树
* @param
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTreeByUser", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登陆人获取单位部门树", notes = "根据登陆人获取单位部门树")
public ResponseModel< List<OrgMenuDto>>selectCompanyTreeByUser() throws Exception {
// 获取登陆人角色
AgencyUserModel user = getUserInfo();
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUser(user);
return ResponseHelper.buildResponse(menus);
}
/**
*
* 获取单位部门树
* @param
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyUserTreeByUser", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登陆人获取单位部门用户树", notes = "根据登陆人获取单位部门用户树")
public ResponseModel< List<OrgMenuDto>>companyUserTreeByUser() {
// 获取登陆人角色
AgencyUserModel user = getUserInfo();
List<OrgMenuDto> menus = iOrgUsrService.companyUserTreeByUser(user);
return ResponseHelper.buildResponse(menus);
}
/**
*
* 获取单位列表
* @param
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyListByUser", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登陆人获取单位列表", notes = "根据登陆人获取单位列表")
public ResponseModel< List<OrgUsrTreeDto>> companyListByUser() {
// 获取登陆人角色
AgencyUserModel user = getUserInfo();
List<OrgUsrTreeDto> menus = iOrgUsrService.companyListByUser(user);
return ResponseHelper.buildResponse(menus);
}
} }
\ No newline at end of file
...@@ -44,21 +44,7 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur ...@@ -44,21 +44,7 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur
@Autowired @Autowired
FailureRepairlogServiceImpl failureRepairlogService; FailureRepairlogServiceImpl failureRepairlogService;
private final Logger logger = LoggerFactory.getLogger(FailureAuditServiceImpl.class);
/**
* 分页查询
*/
public Page<FailureAuditDto> queryForFailureAuditPage(Page<FailureAuditDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<FailureAuditDto> queryForFailureAuditList() {
return this.queryForList("", false);
}
/** /**
* 发起审核 * 发起审核
...@@ -75,23 +61,23 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur ...@@ -75,23 +61,23 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur
FailureDetailsDto failureDetailsDto = failureDetailsService.queryBySeq(model.getFaultId()); FailureDetailsDto failureDetailsDto = failureDetailsService.queryBySeq(model.getFaultId());
int auditResult = 0; int auditResult = 0;
Boolean repairResult = null;
//根据审核的结果进行业务操作 //根据审核的结果进行业务操作
if (condition == AuditResultEnum.AGREE.getCode() && userInfo.getDepartment().getSequenceNbr().equals(failureDetailsDto.getBizCode())) { if (condition == AuditResultEnum.AGREE.getCode() && userInfo.getDepartment().getSequenceNbr().equals(failureDetailsDto.getBizCode())) {
auditResult = AuditResultEnum.AGREE.getCode(); auditResult = AuditResultEnum.AGREE.getCode();
Boolean repairResult = updateStatus(model, FailureStatuEnum.WAITING_AUDIT, userInfo, condition); repairResult = updateStatus(model, FailureStatuEnum.WAITING_AUDIT, userInfo, condition);
} else if (condition == (AuditResultEnum.REFUSE.getCode())) { } else if (condition == (AuditResultEnum.REFUSE.getCode())) {
auditResult = AuditResultEnum.REFUSE.getCode(); auditResult = AuditResultEnum.REFUSE.getCode();
Boolean repairResult = updateStatus(model, FailureStatuEnum.REFUSE, userInfo, condition); repairResult = updateStatus(model, FailureStatuEnum.REFUSE, userInfo, condition);
} else if (condition == (AuditResultEnum.SEND_BACK.getCode())) { } else if (condition == (AuditResultEnum.SEND_BACK.getCode())) {
auditResult = AuditResultEnum.SEND_BACK.getCode(); auditResult = AuditResultEnum.SEND_BACK.getCode();
Boolean repairResult = updateStatus(model, FailureStatuEnum.WAITING_SUBMIT, userInfo, condition); repairResult = updateStatus(model, FailureStatuEnum.WAITING_SUBMIT, userInfo, condition);
} else if (condition == AuditResultEnum.AGREE.getCode()) { } else if (condition == AuditResultEnum.AGREE.getCode()) {
auditResult = AuditResultEnum.AGREE.getCode(); auditResult = AuditResultEnum.AGREE.getCode();
Boolean repairResult = updateStatus(model, FailureStatuEnum.WAITING_MAINTAIN, userInfo, condition); repairResult = updateStatus(model, FailureStatuEnum.WAITING_MAINTAIN, userInfo, condition);
} }
if (ObjectUtils.isEmpty(auditResult)) { if (!repairResult) {
throw new Exception("添加报修日志失败"); throw new Exception("添加报修日志失败");
} }
model.setAuditResult(auditResult); model.setAuditResult(auditResult);
...@@ -115,7 +101,7 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur ...@@ -115,7 +101,7 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur
//当前角色部门id为维修部门的时候 修改状态 //当前角色部门id为维修部门的时候 修改状态
failureDetailsDto.setCurrentStatus(status.getCode()); failureDetailsDto.setCurrentStatus(status.getCode());
failureDetailsDto.setSequenceNbr(model.getFaultId()); failureDetailsDto.setSequenceNbr(model.getFaultId());
FailureDetailsDto failureDetailsDtos = failureDetailsService.updateWithModel(failureDetailsDto); failureDetailsService.updateWithModel(failureDetailsDto);
String conditionText; String conditionText;
boolean result = failureDetailsService.checkExcuteTaskAuth(failureDetailsDto.getSequenceNbr(), userInfo); boolean result = failureDetailsService.checkExcuteTaskAuth(failureDetailsDto.getSequenceNbr(), userInfo);
...@@ -124,19 +110,18 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur ...@@ -124,19 +110,18 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur
Long faultId = model.getFaultId(); Long faultId = model.getFaultId();
Date processTime = model.getAuditTime(); Date processTime = model.getAuditTime();
String processDepartment = model.getAuditDepartment(); String processDepartment = model.getAuditDepartment();
String processAuditor = model.getAuditor();
Integer processAuditorId = Integer.parseInt(userInfo.getUserModel().getUserId()); Integer processAuditorId = Integer.parseInt(userInfo.getUserModel().getUserId());
String processAuditorCid = userInfo.getUserModel().getUserName(); String processAuditorName = userInfo.getUserModel().getRealName();
Long auditDepartmentId = (userInfo.getDepartment().getSequenceNbr()); Long auditDepartmentId = (userInfo.getDepartment().getSequenceNbr());
if (condition == AuditResultEnum.AGREE.getCode()) { if (condition == AuditResultEnum.AGREE.getCode()) {
conditionText = AuditResultEnum.AGREE.getName(); conditionText = AuditResultEnum.AGREE.getName();
repairlog(faultId, processAuditor, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorCid); repairlog(faultId, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorName);
} else if (condition == AuditResultEnum.SEND_BACK.getCode()) { } else if (condition == AuditResultEnum.SEND_BACK.getCode()) {
conditionText = AuditResultEnum.SEND_BACK.getName(); conditionText = AuditResultEnum.SEND_BACK.getName();
repairlog(faultId, processAuditor, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorCid); repairlog(faultId, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorName);
} else if (condition == AuditResultEnum.REFUSE.getCode()) { } else if (condition == AuditResultEnum.REFUSE.getCode()) {
conditionText = AuditResultEnum.REFUSE.getName(); conditionText = AuditResultEnum.REFUSE.getName();
repairlog(faultId, processAuditor, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorCid); repairlog(faultId, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorName);
} }
if (failureDetailsService.excuteTask(failureDetailsDto.getProcessId(), userInfo, condition + "")){ if (failureDetailsService.excuteTask(failureDetailsDto.getProcessId(), userInfo, condition + "")){
return true; return true;
...@@ -151,17 +136,16 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur ...@@ -151,17 +136,16 @@ public class FailureAuditServiceImpl extends BaseService<FailureAuditDto, Failur
* 添加报修日志 * 添加报修日志
*/ */
@Transactional @Transactional
public Boolean repairlog(Long faultId, String processAuditor, Integer processAuditorId, Long departmentId, Date processTime, public Boolean repairlog(Long faultId, Integer processAuditorId, Long departmentId, Date processTime,
String processDepartment, String processResult, String processAuditorCid) { String processDepartment, String processResult, String processAuditorName) {
FailureRepairlogDto failureRepairlogDto = new FailureRepairlogDto(); FailureRepairlogDto failureRepairlogDto = new FailureRepairlogDto();
failureRepairlogDto.setFaultId(faultId); failureRepairlogDto.setFaultId(faultId);
failureRepairlogDto.setProcessAuditor(processAuditor);
failureRepairlogDto.setProcessAuditorId(processAuditorId); failureRepairlogDto.setProcessAuditorId(processAuditorId);
failureRepairlogDto.setProcessDepartmentId(departmentId); failureRepairlogDto.setProcessDepartmentId(departmentId);
failureRepairlogDto.setProcessTime(processTime); failureRepairlogDto.setProcessTime(processTime);
failureRepairlogDto.setProcessDepartment(processDepartment); failureRepairlogDto.setProcessDepartment(processDepartment);
failureRepairlogDto.setProcessResult(processResult); failureRepairlogDto.setProcessResult(processResult);
failureRepairlogDto.setProcessAuditorCid(processAuditorCid); failureRepairlogDto.setProcessAuditorName(processAuditorName);
failureRepairlogService.createWithModel(failureRepairlogDto); failureRepairlogService.createWithModel(failureRepairlogDto);
if (ObjectUtils.isNotEmpty(failureRepairlogDto)) { if (ObjectUtils.isNotEmpty(failureRepairlogDto)) {
return true; return true;
......
...@@ -8,7 +8,6 @@ import java.util.HashMap; ...@@ -8,7 +8,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -18,7 +17,6 @@ import org.springframework.stereotype.Service; ...@@ -18,7 +17,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -39,7 +37,6 @@ import com.yeejoin.amos.boot.module.common.api.service.IFailureAuditService; ...@@ -39,7 +37,6 @@ import com.yeejoin.amos.boot.module.common.api.service.IFailureAuditService;
import com.yeejoin.amos.boot.module.common.api.service.IFailureDetailsService; import com.yeejoin.amos.boot.module.common.api.service.IFailureDetailsService;
import com.yeejoin.amos.boot.module.common.api.service.IFailureRepairlogService; import com.yeejoin.amos.boot.module.common.api.service.IFailureRepairlogService;
import com.yeejoin.amos.boot.module.common.biz.constats.Constants; import com.yeejoin.amos.boot.module.common.biz.constats.Constants;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
/** /**
* 服务实现类 * 服务实现类
...@@ -72,43 +69,35 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -72,43 +69,35 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
@Autowired @Autowired
IFailureRepairlogService failureRepairlog; IFailureRepairlogService failureRepairlog;
public static String EMERGENCY_COMMAND = "应急指挥科";
public static String[] PROCESS_NAME = { "提交维修单", "审核", "维修", "验收", "维修中" };
private final Logger logger = LoggerFactory.getLogger(FailureDetailsServiceImpl.class);
public static String EMERGENCY_COMMAND = "应急指挥科";
public static String[] PROCESS_NAME = {"提交报修单", "审核", "维修", "验收", "维修中"};
public static Integer SELECY_ALL = 6; public static Integer SELECY_ALL = 6;
public static Integer SELECY_STATUS = 7; public static Integer SELECY_STATUS = 7;
public static Integer SELECY_ISUBMIT = 8; public static Integer SELECY_ISUBMIT = 8;
public String[] roleName = {"",""} ;
/** /**
* 分页查询 * 分页查询
*/ */
public IPage<FailureDetails> queryAllPage(long size, long current) { public IPage<FailureDetails> queryAllPage(long size, long current) {
/*QueryWrapper<FailureDetails> wrapper = new QueryWrapper<>(); Page pages = new Page<>(current, size);
wrapper.orderByDesc("submission_time");
IPage<FailureDetails> page = new Page<>(current, size);
return baseMapper.selectPage(page, wrapper);*/
Page pages = new Page<>(current,size);
LambdaQueryWrapper<FailureDetails> lambdaQueryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<FailureDetails> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.orderByDesc(FailureDetails::getSubmissionTime); lambdaQueryWrapper.orderByDesc(FailureDetails::getSubmissionTime);
IPage iPage = page(pages, lambdaQueryWrapper); return page(pages, lambdaQueryWrapper);
Page<FailureDetails> page = new Page();
page.setCurrent(current);
page.setSize(size);
page.setRecords(iPage.getRecords());
return page;
} }
public IPage<FailureDetails> queryForFailureDetailsPage(Page<FailureDetails> page, ReginParams userInfo, public IPage<FailureDetails> queryForFailureDetailsPage(Page<FailureDetails> page, ReginParams userInfo,
Integer type) { Integer type) {
if (type.equals(SELECY_ALL)) { if (type.equals(SELECY_ALL)) {
return this.queryAllPage(page.getSize(), page.getCurrent()); return this.baseMapper.selectAllPage(page);
} }
if (type.equals(SELECY_ISUBMIT)) { if (type.equals(SELECY_ISUBMIT)) {
return queryForPage(page, userInfo.getUserModel().getUserId()); return baseMapper.selectISubPage(page,userInfo.getUserModel().getUserId());
} }
return this.queryForWaitManage(page, userInfo.getUserModel().getUserId()); return this.queryForWaitManage(page, userInfo);
} }
/** /**
...@@ -118,15 +107,9 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -118,15 +107,9 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
if (submissionPid == null) { if (submissionPid == null) {
return null; return null;
} }
/* QueryWrapper<FailureDetails> wrapper = new QueryWrapper<>(); Page pages = new Page<>(page.getCurrent(), page.getSize());
wrapper.eq("submission_pid", submissionPid);
wrapper.orderByDesc("submission_time");
IPage<FailureDetails> failureDetailsPage = new Page<>(page.getCurrent(), page.getSize());
return baseMapper.selectPage(failureDetailsPage, wrapper);*/
Page pages = new Page<>(page.getCurrent(),page.getSize());
LambdaQueryWrapper<FailureDetails> lambdaQueryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<FailureDetails> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(FailureDetails::getSubmissionPid,submissionPid); lambdaQueryWrapper.eq(FailureDetails::getSubmissionPid, submissionPid);
lambdaQueryWrapper.orderByDesc(FailureDetails::getSubmissionTime); lambdaQueryWrapper.orderByDesc(FailureDetails::getSubmissionTime);
return page(pages, lambdaQueryWrapper); return page(pages, lambdaQueryWrapper);
} }
...@@ -134,20 +117,17 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -134,20 +117,17 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
/** /**
* 待处理分页查询 * 待处理分页查询
*/ */
public IPage<FailureDetails> queryForWaitManage(Page<FailureDetails> page, String submissionPid) { public IPage<FailureDetails> queryForWaitManage(Page<FailureDetails> page, ReginParams userInfo) {
if (submissionPid == null) { /* if (userInfo.getRole().getRoleName().equals())*/
/* if (submissionPid == null) {
return null; return null;
} }
LambdaQueryWrapper<FailureDetails> lambdaQueryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<FailureDetails> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.notIn(FailureDetails::getCurrentStatus,FailureStatuEnum.REFUSE.getCode(), FailureStatuEnum.FINISH.getCode() lambdaQueryWrapper.notIn(FailureDetails::getCurrentStatus, FailureStatuEnum.REFUSE.getCode(), FailureStatuEnum.FINISH.getCode()
).orderByDesc(FailureDetails::getSubmissionTime); ).orderByDesc(FailureDetails::getSubmissionTime);
/*QueryWrapper<FailureDetails> wrapper = new QueryWrapper<>();
wrapper.eq("submission_pid", submissionPid);
wrapper.notIn("current_status", FailureStatuEnum.REFUSE.getCode(), FailureStatuEnum.FINISH.getCode(),
FailureStatuEnum.WAITING_AUDIT.getCode());
wrapper.orderByDesc("submission_time");*/
IPage<FailureDetails> failureDetailsPage = new Page<>(page.getCurrent(), page.getSize()); IPage<FailureDetails> failureDetailsPage = new Page<>(page.getCurrent(), page.getSize());
return baseMapper.selectPage(failureDetailsPage, lambdaQueryWrapper); return baseMapper.selectPage(failureDetailsPage, lambdaQueryWrapper);*/
return baseMapper.selectInProcessing(page);
} }
...@@ -187,16 +167,12 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -187,16 +167,12 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
if (currentStatus.equals(list.get(i).getCode())) { if (currentStatus.equals(list.get(i).getCode())) {
status = list.get(i).getName(); status = list.get(i).getName();
} }
;
} }
/* FailureStatuEnum[] failureStatuEnums = new FailureStatuEnum []{}; */
QueryWrapper<FailureDetails> queryWrapper = new QueryWrapper<>(); QueryWrapper<FailureDetails> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("current_status", status).orderByDesc("submission_time"); queryWrapper.eq("current_status", status).orderByDesc("submission_time");
return baseMapper.selectList(queryWrapper); return baseMapper.selectList(queryWrapper);
} }
/** /**
* 查询任务状态数量 * 查询任务状态数量
*/ */
...@@ -217,13 +193,11 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -217,13 +193,11 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
int inMaintenance = 0; int inMaintenance = 0;
List<FailureStatusCountDto> list = new ArrayList<>(); List<FailureStatusCountDto> list = new ArrayList<>();
// String[] statusName = new String[]{"待审核", "待提交", "待维修", "待验收", "已拒绝", "已完结"};
List<String> statusName = new ArrayList<>(); List<String> statusName = new ArrayList<>();
Collections.addAll(statusName, FailureStatuEnum.WAITING_AUDIT.getName(), Collections.addAll(statusName, FailureStatuEnum.WAITING_AUDIT.getName(),
FailureStatuEnum.WAITING_SUBMIT.getName(), FailureStatuEnum.WAITING_MAINTAIN.getName(), FailureStatuEnum.WAITING_SUBMIT.getName(), FailureStatuEnum.WAITING_MAINTAIN.getName(),
FailureStatuEnum.WAITING_ACCEPTANCE.getName(), FailureStatuEnum.REFUSE.getName(), FailureStatuEnum.WAITING_ACCEPTANCE.getName(), FailureStatuEnum.REFUSE.getName(),
FailureStatuEnum.FINISH.getName(), FailureStatuEnum.IN_MAINTENANCE.getName()); FailureStatuEnum.FINISH.getName(), FailureStatuEnum.IN_MAINTENANCE.getName());
for (int i = 0; i < failureDetailsDtos.size(); i++) { for (int i = 0; i < failureDetailsDtos.size(); i++) {
if (failureDetailsDtos.get(i).getCurrentStatus().equals(FailureStatuEnum.WAITING_AUDIT.getCode())) { if (failureDetailsDtos.get(i).getCurrentStatus().equals(FailureStatuEnum.WAITING_AUDIT.getCode())) {
auditStatus++; auditStatus++;
...@@ -247,10 +221,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -247,10 +221,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
inMaintenance++; inMaintenance++;
} }
} }
int[] statusCount = {auditStatus, submitStatus, maintainStatus, acceptanceStatus, refuseStatus, finishStatus,
int[] statusCount = { auditStatus, submitStatus, maintainStatus, acceptanceStatus, refuseStatus, finishStatus, inMaintenance};
inMaintenance };
for (int i = 0; i < statusName.size(); i++) { for (int i = 0; i < statusName.size(); i++) {
FailureStatusCountDto statusCountDto = new FailureStatusCountDto(); FailureStatusCountDto statusCountDto = new FailureStatusCountDto();
statusCountDto.setStatus(statusName.get(i)); statusCountDto.setStatus(statusName.get(i));
...@@ -267,6 +239,10 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -267,6 +239,10 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
*/ */
@Transactional @Transactional
public Object savemodel(FailureDetailsDto failureDetailsDto, ReginParams userInfo) throws Exception { public Object savemodel(FailureDetailsDto failureDetailsDto, ReginParams userInfo) throws Exception {
if (null != failureDetailsDto.getSequenceNbr()){
return updatetoModel(failureDetailsDto, userInfo);
}
String businessKey = buildOrderNo(); String businessKey = buildOrderNo();
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("businessKey", businessKey); body.put("businessKey", businessKey);
...@@ -288,8 +264,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -288,8 +264,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
// 发起主表流程 并添加至报修日志 // 发起主表流程 并添加至报修日志
failureDetailsDto.setSubmissionTime(new Date()); failureDetailsDto.setSubmissionTime(new Date());
failureDetailsDto.setFailureCode(buildOrderNo()); failureDetailsDto.setFailureCode(buildOrderNo());
failureDetailsDto.setSubmissionName(userInfo.getUserModel().getRealName());
failureDetailsDto.setBizCode(userInfo.getDepartment().getSequenceNbr()); failureDetailsDto.setBizCode(userInfo.getDepartment().getSequenceNbr());
failureDetailsDto.setIsDelete(false);
model = this.createWithModel(failureDetailsDto); model = this.createWithModel(failureDetailsDto);
if (ObjectUtils.isNotEmpty(failureDetailsDto.getAttachment())) { if (ObjectUtils.isNotEmpty(failureDetailsDto.getAttachment())) {
...@@ -297,20 +273,50 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -297,20 +273,50 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
failureDetailsDto.getAttachment()); failureDetailsDto.getAttachment());
} }
// 添加至报修日志 // 添加至报修日志
Long faultId = model.getSequenceNbr(); Long faultId = model.getSequenceNbr();
String processAuditor = model.getRecUserName();
Integer processAuditorId = model.getSubmissionPid(); Integer processAuditorId = model.getSubmissionPid();
String processResult = "提交报修单"; String processResult = "提交报修单";
String processDepartment = userInfo.getDepartment().getDepartmentName(); String processDepartment = userInfo.getDepartment().getDepartmentName();
Long departmentId = userInfo.getDepartment().getSequenceNbr(); Long departmentId = userInfo.getDepartment().getSequenceNbr();
Date processTime = model.getSubmissionTime(); Date processTime = model.getSubmissionTime();
String processAuditorCid = userInfo.getUserModel().getUserName(); String processAuditorName = failureDetailsDto.getSubmissionName();
repairlog(faultId, processAuditor,processAuditorId,departmentId, processTime, processDepartment, processResult,processAuditorCid); repairlog(faultId, processAuditorId, departmentId, processTime, processDepartment, processResult, processAuditorName);
if (excuteTask(instance.getString("id"), userInfo, null)) {
return true;
} else {
throw new Exception("执行流程失败");
}
}
/**
* 更新故障保修单
*/
public Object updatetoModel(FailureDetailsDto failureDetailsDto, ReginParams userInfo) throws Exception {
if (excuteTask(instance.getString("id"), userInfo, null)){
// 发起主表流程 并添加至报修日志
failureDetailsDto.setSubmissionTime(new Date());
FailureDetailsDto model = this.updateWithModel(failureDetailsDto);
if (ObjectUtils.isNotEmpty(failureDetailsDto.getAttachment())) {
sourceFileServiceImpl.saveSourceFile(failureDetailsDto.getSequenceNbr(),
failureDetailsDto.getAttachment());
}
// 添加至报修日志
Long faultId = model.getSequenceNbr();
Integer processAuditorId = model.getSubmissionPid();
String processResult = "重新提交报修单";
String processDepartment = userInfo.getDepartment().getDepartmentName();
Long departmentId = userInfo.getDepartment().getSequenceNbr();
Date processTime = model.getSubmissionTime();
String processAuditorName = failureDetailsDto.getSubmissionName();
repairlog(faultId, processAuditorId, departmentId, processTime, processDepartment, processResult, processAuditorName);
if (excuteTask(failureDetailsDto.getProcessId(), userInfo, null)) {
return true; return true;
}else { } else {
throw new Exception("执行流程失败"); throw new Exception("执行流程失败");
} }
...@@ -320,17 +326,16 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -320,17 +326,16 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
* 添加报修日志 * 添加报修日志
*/ */
@Transactional @Transactional
public Boolean repairlog(Long faultId, String processAuditor, Integer processAuditorId, Long departmentId, public Boolean repairlog(Long faultId, Integer processAuditorId, Long departmentId,
Date processTime, String processDepartment, String processResult, String processAuditorCid) { Date processTime, String processDepartment, String processResult, String processAuditorName) {
FailureRepairlogDto failureRepairlogDto = new FailureRepairlogDto(); FailureRepairlogDto failureRepairlogDto = new FailureRepairlogDto();
failureRepairlogDto.setFaultId(faultId); failureRepairlogDto.setFaultId(faultId);
failureRepairlogDto.setProcessAuditor(processAuditor);
failureRepairlogDto.setProcessAuditorId(processAuditorId); failureRepairlogDto.setProcessAuditorId(processAuditorId);
failureRepairlogDto.setProcessDepartmentId(departmentId); failureRepairlogDto.setProcessDepartmentId(departmentId);
failureRepairlogDto.setProcessTime(processTime); failureRepairlogDto.setProcessTime(processTime);
failureRepairlogDto.setProcessDepartment(processDepartment); failureRepairlogDto.setProcessDepartment(processDepartment);
failureRepairlogDto.setProcessResult(processResult); failureRepairlogDto.setProcessResult(processResult);
failureRepairlogDto.setProcessAuditorCid(processAuditorCid); failureRepairlogDto.setProcessAuditorName(processAuditorName);
FailureRepairlogDto repairlogModel = failureRepairlogService.createWithModel(failureRepairlogDto); FailureRepairlogDto repairlogModel = failureRepairlogService.createWithModel(failureRepairlogDto);
if (ObjectUtils.isNotEmpty(repairlogModel)) { if (ObjectUtils.isNotEmpty(repairlogModel)) {
return true; return true;
...@@ -364,7 +369,6 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -364,7 +369,6 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
* *
* @param sequenceNbr * @param sequenceNbr
* @param userInfo * @param userInfo
* @return * @return
*/ */
public boolean excuteTaskOnlyOperation(Long sequenceNbr, ReginParams userInfo) { public boolean excuteTaskOnlyOperation(Long sequenceNbr, ReginParams userInfo) {
......
...@@ -76,8 +76,6 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto, ...@@ -76,8 +76,6 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,
WorkflowFeignService workflowFeignService; WorkflowFeignService workflowFeignService;
private static String RECORE_TYPE = "维修记录"; private static String RECORE_TYPE = "维修记录";
private final Logger logger = LoggerFactory.getLogger(FailureMaintainServiceImpl.class);
private static String[] MAINTENANCE_STATUS = {"维修完成", "维修中"}; private static String[] MAINTENANCE_STATUS = {"维修完成", "维修中"};
private static int MAINTENANCE_COMPLETE = 0; private static int MAINTENANCE_COMPLETE = 0;
...@@ -86,25 +84,7 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto, ...@@ -86,25 +84,7 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,
private static String[] PROCESS_RESULT = {"验证通过", "验证未通过"}; private static String[] PROCESS_RESULT = {"验证通过", "验证未通过"};
/**
* 分页查询
*/
public Page<FailureMaintainDto> queryForFailureMaintainPage(Page<FailureMaintainDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<FailureMaintainDto> queryForFailureMaintainList() {
return this.queryForList("", false);
}
/** /**
* 添加维修记录 * 添加维修记录
...@@ -132,10 +112,10 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto, ...@@ -132,10 +112,10 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,
// 添加报修日志 // 添加报修日志
String processResult = MAINTENANCE_STATUS[1];// 维修中 String processResult = MAINTENANCE_STATUS[1];// 维修中
Integer processAuditorId = Integer.parseInt(failureMaintainDto.getRecUserId()); Integer processAuditorId = Integer.parseInt(failureMaintainDto.getRecUserId());
String processAuditorCid = userInfo.getUserModel().getUserName(); String processAuditorName = userInfo.getUserModel().getRealName();
repairlog(failureMaintainDto.getFaultId(), failureMaintainDto.getMaintainMan(), processAuditorId, repairlog(failureMaintainDto.getFaultId(), processAuditorId,
userInfo.getDepartment().getSequenceNbr(), failureMaintainDto.getMaintainTime(), userInfo.getDepartment().getSequenceNbr(), failureMaintainDto.getMaintainTime(),
failureMaintainDto.getDepartment(), processResult, processAuditorCid); failureMaintainDto.getDepartment(), processResult, processAuditorName);
if (ObjectUtils.isNotEmpty(failureMaintainDto.getAttachment())) { if (ObjectUtils.isNotEmpty(failureMaintainDto.getAttachment())) {
sourceFileServiceImpl.saveSourceFile(failureMaintainDto.getSequenceNbr(), sourceFileServiceImpl.saveSourceFile(failureMaintainDto.getSequenceNbr(),
failureMaintainDto.getAttachment()); failureMaintainDto.getAttachment());
...@@ -179,10 +159,10 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto, ...@@ -179,10 +159,10 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,
// 添加报修日志 // 添加报修日志
String processResult = MAINTENANCE_STATUS[0];// 维修完成 String processResult = MAINTENANCE_STATUS[0];// 维修完成
Integer processAuditorId = Integer.parseInt(failureMaintainDto.getRecUserId()); Integer processAuditorId = Integer.parseInt(failureMaintainDto.getRecUserId());
String processAuditorCid = userInfo.getUserModel().getUserName(); String processAuditorName = userInfo.getUserModel().getRealName();
repairlog(failureMaintainDto.getFaultId(), failureMaintainDto.getMaintainMan(), processAuditorId, repairlog(failureMaintainDto.getFaultId(), processAuditorId,
userInfo.getDepartment().getSequenceNbr(), failureMaintainDto.getMaintainTime(), userInfo.getDepartment().getSequenceNbr(), failureMaintainDto.getMaintainTime(),
failureMaintainDto.getDepartment(), processResult, processAuditorCid); failureMaintainDto.getDepartment(), processResult, processAuditorName);
if (ObjectUtils.isNotEmpty(failureMaintainDto.getAttachment())) { if (ObjectUtils.isNotEmpty(failureMaintainDto.getAttachment())) {
sourceFileServiceImpl.saveSourceFile(failureMaintainDto.getSequenceNbr(), sourceFileServiceImpl.saveSourceFile(failureMaintainDto.getSequenceNbr(),
failureMaintainDto.getAttachment()); failureMaintainDto.getAttachment());
...@@ -195,55 +175,6 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto, ...@@ -195,55 +175,6 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,
return true; return true;
} }
/**
* 根据审核结果更新维修表
*/
public Boolean updateModel(FailureMaintainDto failureMaintainDto, ReginParams userInfo) throws Exception {
boolean result = failureDetailsService.checkExcuteTaskAuth(failureMaintainDto.getFaultId(), userInfo);
FailureDetailsDto failureDetailsDto = failureDetailsService.queryBySeq(failureMaintainDto.getFaultId());
if (result) {
this.updateWithModel(failureMaintainDto);
// 根据status修改状态
String processResult = new String();
String condition = failureMaintainDto.getCondition();
int conditionStatus = Integer.parseInt(condition);
if (conditionStatus == AuditResultEnum.AGREE.getCode() && userInfo.getDepartment().getSequenceNbr()
== failureDetailsDto.getBizCode()) {// 同意状态为已完结
processResult = PROCESS_RESULT[0];
} else if (conditionStatus == AuditResultEnum.AGREE.getCode()) {// 同意状态为已完结
failureDetailsDto.setCurrentStatus(failureDetailsDto.getCurrentStatus());
failureDetailsService.updateWithModel(failureDetailsDto);
processResult = PROCESS_RESULT[0];
} else if (conditionStatus == AuditResultEnum.REFUSE.getCode()){// 不同意状态为已拒绝
failureDetailsDto.setCurrentStatus(FailureStatuEnum.REFUSE.getCode());
failureDetailsService.updateWithModel(failureDetailsDto);
processResult = PROCESS_RESULT[1];
}
// 添加报修日志
Integer processAuditorId = Integer.parseInt(failureMaintainDto.getRecUserId());
String processAuditorCid = userInfo.getUserModel().getUserName();
Boolean repairlog = repairlog(failureMaintainDto.getFaultId(), failureMaintainDto.getMaintainMan(), processAuditorId,
userInfo.getDepartment().getSequenceNbr(), failureMaintainDto.getMaintainTime(),
failureMaintainDto.getDepartment(), processResult, processAuditorCid);
if (ObjectUtils.isEmpty(repairlog)){
throw new RuntimeException("验收添加报修日志出错");
}
if (failureDetailsService.excuteTask(failureMaintainDto.getFaultId(), userInfo, condition)){
return true;
}else {
throw new RuntimeException("验收执行流程失败");
}
}
return false;
}
/** /**
* 根据FaultId查询 * 根据FaultId查询
...@@ -272,20 +203,17 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto, ...@@ -272,20 +203,17 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,
/** /**
* 添加报修日志 * 添加报修日志
*/ */
public Boolean repairlog(Long faultId, String processAuditor, Integer processAuditorId, Long departmentId, public Boolean repairlog(Long faultId, Integer processAuditorId, Long departmentId,
Date processTime, Date processTime, String processDepartment, String processResult, String processAuditorName) {
String processDepartment, String processResult, String processAuditorCid) {
FailureRepairlogDto failureRepairlogDto = new FailureRepairlogDto(); FailureRepairlogDto failureRepairlogDto = new FailureRepairlogDto();
failureRepairlogDto.setFaultId(faultId); failureRepairlogDto.setFaultId(faultId);
failureRepairlogDto.setProcessAuditor(processAuditor);
failureRepairlogDto.setProcessAuditorId(processAuditorId); failureRepairlogDto.setProcessAuditorId(processAuditorId);
failureRepairlogDto.setProcessDepartmentId(departmentId); failureRepairlogDto.setProcessDepartmentId(departmentId);
failureRepairlogDto.setProcessTime(processTime); failureRepairlogDto.setProcessTime(processTime);
failureRepairlogDto.setProcessDepartment(processDepartment); failureRepairlogDto.setProcessDepartment(processDepartment);
failureRepairlogDto.setProcessResult(processResult); failureRepairlogDto.setProcessResult(processResult);
failureRepairlogDto.setProcessAuditorCid(processAuditorCid); failureRepairlogDto.setProcessAuditorName(processAuditorName);
failureRepairlogService.createWithModel(failureRepairlogDto); failureRepairlogService.createWithModel(failureRepairlogDto);
if (ObjectUtils.isNotEmpty(failureRepairlogDto)) { if (ObjectUtils.isNotEmpty(failureRepairlogDto)) {
return true; return true;
......
...@@ -51,10 +51,11 @@ public class FailureRepairlogServiceImpl extends BaseService<FailureRepairlogDto ...@@ -51,10 +51,11 @@ public class FailureRepairlogServiceImpl extends BaseService<FailureRepairlogDto
public FailureRepairlog findByprocessAuditor(String userId) { public FailureRepairlog findByprocessAuditor(String userId) {
LambdaQueryWrapper<FailureRepairlog> queryWrapper = new LambdaQueryWrapper<FailureRepairlog>(); LambdaQueryWrapper<FailureRepairlog> queryWrapper = new LambdaQueryWrapper<FailureRepairlog>();
queryWrapper.eq(FailureRepairlog::getProcessAuditor, userId); queryWrapper.eq(FailureRepairlog::getProcessAuditorName, userId);
queryWrapper.last("LIMIT 1"); queryWrapper.last("LIMIT 1");
return baseMapper.selectOne(queryWrapper); return baseMapper.selectOne(queryWrapper);
} }
public FailureRepairlog findByFaultId(Long faultId) { public FailureRepairlog findByFaultId(Long faultId) {
LambdaQueryWrapper<FailureRepairlog> wrapper = new LambdaQueryWrapper<FailureRepairlog>(); LambdaQueryWrapper<FailureRepairlog> wrapper = new LambdaQueryWrapper<FailureRepairlog>();
wrapper.eq(FailureRepairlog::getIsDelete, false); wrapper.eq(FailureRepairlog::getIsDelete, false);
......
...@@ -66,33 +66,21 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail ...@@ -66,33 +66,21 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail
} }
Boolean repairResult = null; Boolean repairResult = null;
//根据验收的结果进行业务操作 //根据验收的结果进行业务操作
/* if (condition == AuditResultEnum.AGREE.getCode() ) {
verifyResult = AuditResultEnum.AGREE.getCode();
Boolean repairResult = updateStatus(model, FailureStatuEnum.WAITING_ACCEPTANCE, userInfo, condition);
} else*/
if (condition == (AuditResultEnum.REFUSE.getCode())) { if (condition == (AuditResultEnum.REFUSE.getCode())) {
verifyResult = AuditResultEnum.REFUSE.getCode(); verifyResult = AuditResultEnum.REFUSE.getCode();
repairResult = updateStatus(model, FailureStatuEnum.REFUSE, userInfo, condition); repairResult = updateStatus(model, FailureStatuEnum.REFUSE, userInfo, condition);
} /*else if (condition == (AuditResultEnum.SEND_BACK.getCode())) { } else if (condition == AuditResultEnum.AGREE.getCode()) {
verifyResult = AuditResultEnum.SEND_BACK.getCode();
Boolean repairResult = updateStatus(model, FailureStatuEnum.WAITING_SUBMIT, userInfo, condition);
} */ else if (condition == AuditResultEnum.AGREE.getCode()) {
verifyResult = AuditResultEnum.AGREE.getCode(); verifyResult = AuditResultEnum.AGREE.getCode();
repairResult = updateStatus(model, FailureStatuEnum.FINISH, userInfo, condition); repairResult = updateStatus(model, FailureStatuEnum.FINISH, userInfo, condition);
} }
model.setVerifyResult(verifyResult); model.setVerifyResult(verifyResult);
List<FailureVerify> byfaultId = findByfaultId(failureDetailsDto.getSequenceNbr());
/* if (byfaultId.size() == 0) {
this.createWithModel(model);
} else {*/
this.createWithModel(model); this.createWithModel(model);
if (!failureDetailsService.excuteTask(failureDetailsDto.getSequenceNbr(), userInfo, condition + "")) { if (!failureDetailsService.excuteTask(failureDetailsDto.getSequenceNbr(), userInfo, condition + "")) {
throw new Exception("执行流程失败"); throw new Exception("执行流程失败");
} }
/* }*/
return true; return true;
} }
...@@ -122,16 +110,15 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail ...@@ -122,16 +110,15 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail
Date processTime = model.getVerifyTime(); Date processTime = model.getVerifyTime();
String processDepartment = model.getVerifyDepartment(); String processDepartment = model.getVerifyDepartment();
Integer processAuditorId = Integer.parseInt(userInfo.getUserModel().getUserId()); Integer processAuditorId = Integer.parseInt(userInfo.getUserModel().getUserId());
String processVerifyor = model.getAcceptor(); String processAuditorCid = userInfo.getRole().getRoleName();
String processAuditorCid = userInfo.getUserModel().getUserName();
Long auditDepartmentId = (userInfo.getDepartment().getSequenceNbr()); Long auditDepartmentId = (userInfo.getDepartment().getSequenceNbr());
Boolean repairlog = null; Boolean repairlog = null;
if (condition == AuditResultEnum.AGREE.getCode()) { if (condition == AuditResultEnum.AGREE.getCode()) {
conditionText = AuditResultEnum.AGREE.getName(); conditionText = AuditResultEnum.AGREE.getName();
repairlog = repairlog(faultId, processVerifyor, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorCid); repairlog = repairlog(faultId, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorCid);
} else if (condition == AuditResultEnum.REFUSE.getCode()) { } else if (condition == AuditResultEnum.REFUSE.getCode()) {
conditionText = AuditResultEnum.REFUSE.getName(); conditionText = AuditResultEnum.REFUSE.getName();
repairlog = repairlog(faultId, processVerifyor, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorCid); repairlog = repairlog(faultId, processAuditorId, auditDepartmentId, processTime, processDepartment, conditionText, processAuditorCid);
} }
if (!repairlog) { if (!repairlog) {
throw new Exception("执行流程失败"); throw new Exception("执行流程失败");
...@@ -146,17 +133,16 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail ...@@ -146,17 +133,16 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail
* 添加报修日志 * 添加报修日志
*/ */
@Transactional @Transactional
public Boolean repairlog(Long faultId, String processAuditor, Integer processAuditorId, Long departmentId, Date processTime, public Boolean repairlog(Long faultId, Integer processAuditorId, Long departmentId, Date processTime,
String processDepartment, String processResult, String processVerifyorCid) { String processDepartment, String processResult, String processVerifyorCid) {
FailureRepairlogDto failureRepairlogDto = new FailureRepairlogDto(); FailureRepairlogDto failureRepairlogDto = new FailureRepairlogDto();
failureRepairlogDto.setFaultId(faultId); failureRepairlogDto.setFaultId(faultId);
failureRepairlogDto.setProcessAuditor(processAuditor);
failureRepairlogDto.setProcessAuditorId(processAuditorId); failureRepairlogDto.setProcessAuditorId(processAuditorId);
failureRepairlogDto.setProcessDepartmentId(departmentId); failureRepairlogDto.setProcessDepartmentId(departmentId);
failureRepairlogDto.setProcessTime(processTime); failureRepairlogDto.setProcessTime(processTime);
failureRepairlogDto.setProcessDepartment(processDepartment); failureRepairlogDto.setProcessDepartment(processDepartment);
failureRepairlogDto.setProcessResult(processResult); failureRepairlogDto.setProcessResult(processResult);
failureRepairlogDto.setProcessAuditorCid(processVerifyorCid); failureRepairlogDto.setProcessAuditorName(processVerifyorCid);
failureRepairlogService.createWithModel(failureRepairlogDto); failureRepairlogService.createWithModel(failureRepairlogDto);
if (ObjectUtils.isNotEmpty(failureRepairlogDto)) { if (ObjectUtils.isNotEmpty(failureRepairlogDto)) {
return true; return true;
...@@ -168,7 +154,6 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail ...@@ -168,7 +154,6 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail
* 根据FaultId查询 * 根据FaultId查询
*/ */
public List<FailureVerify> findByfaultId(Long faultId) { public List<FailureVerify> findByfaultId(Long faultId) {
Page<FailureVerify> page = new Page<>();
QueryWrapper<FailureVerify> queryWrapper = new QueryWrapper<>(); QueryWrapper<FailureVerify> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("fault_id", faultId).orderByDesc("verify_time"); queryWrapper.eq("fault_id", faultId).orderByDesc("verify_time");
return baseMapper.selectList(queryWrapper); return baseMapper.selectList(queryWrapper);
......
...@@ -11,11 +11,13 @@ import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn; ...@@ -11,11 +11,13 @@ import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum; import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserRolesEnum;
import com.yeejoin.amos.boot.module.common.api.feign.SupervisionFeign; import com.yeejoin.amos.boot.module.common.api.feign.SupervisionFeign;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper; import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService; import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -27,13 +29,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -27,13 +29,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -1011,6 +1007,220 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1011,6 +1007,220 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return this.baseMapper.selectList(wrapper); return this.baseMapper.selectList(wrapper);
} }
@Override
public List<OrgMenuDto> companyUserTreeByUser (AgencyUserModel user) {
LambdaQueryWrapper<OrgUsr> wrapper= new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getIsDelete, false);
List<OrgUsr> companyDepartmentMsgList = this.baseMapper.selectList(wrapper);
return gettTreeByUser(user, companyDepartmentMsgList);
}
@Override
public List<OrgMenuDto> companyTreeByUser(AgencyUserModel user) {
List<OrgUsr> companyDepartmentMsgList = selectCompanyDepartmentMsg();
return gettTreeByUser(user, companyDepartmentMsgList);
};
@Override
public List<OrgUsrTreeDto> companyListByUser(AgencyUserModel user) {
List<OrgUsrTreeDto> list = new ArrayList<>();
// 需要角色为机场单位或管理员,其余角色返回空
String code = UserRolesEnum.AIRPORTUNIT.getCode();
String codeAdmin = UserRolesEnum.ADMIN.getCode();
String roles = getRoles(user, code);
if (!StringUtils.isEmpty(roles)) {
List<OrgUsrTreeDto> companyList = this.baseMapper.getCompanyAndKeySite(null);
if (roles.equals(codeAdmin)) {
// 返回全部单位列表
return companyAndKeySiteList(companyList);
} else if (roles.equals(code)) {
// } else {
// 人员与多个部门/公司关联
List<OrgUsr> orgUsrList = orgUsrList(user);
if (ObjectUtils.isEmpty(orgUsrList)) {
return list;
}
Set<Long> set = new HashSet<>();
orgUsrList.forEach(orgUsr -> {
Long parent = ObjectUtils.isEmpty(orgUsr.getParentId()) ? 0L : Long.parseLong(orgUsr.getParentId());
if (set.add(parent)) {
Long companyIdByDto = getCompanyIdByDto(parent, companyList);
List<OrgUsrTreeDto> orgUsrTreeDtoList = this.baseMapper.getCompanyAndKeySite(companyIdByDto);
list.addAll(companyAndKeySiteList(orgUsrTreeDtoList));
}
});
// 返回所在用户单位列表
return list.stream().distinct().collect(Collectors.toList());
}
}
return list;
}
/**
* 获取登陆人所在公司
*/
private Long getCompanyIdByDto (Long parentId, List<OrgUsrTreeDto> companyDepartmentMsgList) {
Long pid = null;
for (OrgUsrTreeDto orgUsr : companyDepartmentMsgList) {
if (orgUsr.getSequenceNbr().equals(parentId)) {
if (orgUsr.getBizOrgType().equals(OrgPersonEnum.公司.getKey()) && ObjectUtils.isEmpty(orgUsr.getParentId())) {
return orgUsr.getSequenceNbr();
} else {
pid = getCompanyIdByDto(Long.parseLong(orgUsr.getParentId()),companyDepartmentMsgList);
}
}
}
return pid;
}
/**
* 查询单位列表
*/
private List<OrgUsrTreeDto> companyAndKeySiteList (List<OrgUsrTreeDto> companyList) {
List<OrgUsrTreeDto> list = new ArrayList<>();
if (ObjectUtils.isEmpty(companyList)) {
return list;
}
Map<Long, OrgUsrTreeDto> map = new HashMap<>(companyList.size());
companyList.forEach(e -> map.put(e.getSequenceNbr(), e));
Set<? extends Map.Entry<Long, ? extends OrgUsrTreeDto>> entries = map.entrySet();
entries.parallelStream().forEach(entry -> {
OrgUsrTreeDto value = entry.getValue();
if (!ObjectUtils.isEmpty(value)) {
Long parent = ObjectUtils.isEmpty(value.getParentId()) ? 0L : Long.parseLong(value.getParentId());
OrgUsrTreeDto orgUsrTreeDto = map.get(parent);
if (!ObjectUtils.isEmpty(orgUsrTreeDto)) {
int num = orgUsrTreeDto.getNum() + value.getNum();
orgUsrTreeDto.setNum(num);
} else {
if (value.getBizOrgType().equals(OrgPersonEnum.公司.getKey())) {
list.add(value);
}
}
}
});
return list;
}
/**
* 获取树
*/
private List<OrgMenuDto> gettTreeByUser (AgencyUserModel user, List<OrgUsr> list) {
List<OrgMenuDto> treeList = new ArrayList<>();
// 需要角色为机场单位或管理员,其余角色返回空
String code = UserRolesEnum.AIRPORTUNIT.getCode();
String codeAdmin = UserRolesEnum.ADMIN.getCode();
String roles = getRoles(user, code);
if (!StringUtils.isEmpty(roles)) {
// treeList = getDepartmentTreeByUser(user,list);
if (roles.equals(codeAdmin)) {
// 返回全量树
treeList = buildTreeParallel(list);
} else if (roles.equals(code)) {
// 获取当前用户所在部门树
treeList = getDepartmentTreeByUser(user,list);
}
}
return treeList;
}
/**
* 根基登陆人获取指定角色/最高角色,默认最高角色
*/
private String getRoles(AgencyUserModel user, String code) {
String type = null;
Map<Long, List<RoleModel>> orgRolesMap = user.getOrgRoles();
if (ObjectUtils.isEmpty(orgRolesMap)) {
return null;
}
for (Long key : orgRolesMap.keySet()) {
if (!ObjectUtils.isEmpty(orgRolesMap.get(key))) {
for (RoleModel roleModel: orgRolesMap.get(key)) {
String roleType = roleModel.getRoleType();
if (roleType.equals(code)) {
type = code;
}
if (roleType.equals(UserRolesEnum.ADMIN.getCode())) {
return roleType;
}
}
}
}
return type;
}
/**
* 获取当前用户所在部门/用户树
*/
private List<OrgMenuDto> getDepartmentTreeByUser (AgencyUserModel user,List<OrgUsr> companyDepartmentMsgList) {
List<OrgMenuDto> list = new ArrayList<>();
if (ObjectUtils.isEmpty(companyDepartmentMsgList)) {
return list;
}
// 1.获取当前登陆用户关联人员
List<OrgUsr> orgUsrList = orgUsrList(user);
if (ObjectUtils.isEmpty(orgUsrList)) {
return list;
}
// 2.查询人员所属部门
List<OrgMenuDto> treeList = buildTreeParallel(companyDepartmentMsgList);
Set<Long> set = new HashSet<>();
orgUsrList.forEach(orgUsr -> {
Long parentId = Long.parseLong(orgUsr.getParentId());
getTreeChildre(list, treeList, parentId, set, companyDepartmentMsgList);
});
return list;
}
/**
* 获取登陆人关联账号
*/
private List<OrgUsr> orgUsrList (AgencyUserModel user) {
String userId = user.getUserId();
LambdaQueryWrapper<OrgUsr> wrapper= new LambdaQueryWrapper<>();
wrapper.eq(OrgUsr::getIsDelete,false);
wrapper.eq(OrgUsr::getAmosOrgId,userId);
wrapper.eq(OrgUsr::getBizOrgType,OrgPersonEnum.人员.getKey());
List<OrgUsr> orgUsrList = this.baseMapper.selectList(wrapper);
return orgUsrList;
}
/**
* 组装树
*/
private void getTreeChildre (List<OrgMenuDto> list, List<OrgMenuDto> treeList, Long parentId, Set<Long> set, List<OrgUsr> companyDepartmentMsgList) {
if (ObjectUtils.isEmpty(treeList) && ObjectUtils.isEmpty(companyDepartmentMsgList)) {
return;
}
// 获取登陆人所在公司
Long pid = getCompanyId(parentId, companyDepartmentMsgList);
if (set.add(pid)) {
List<OrgMenuDto> list1 = treeList.stream().filter(orgMenuDto -> orgMenuDto.getKey().equals(pid)).collect(Collectors.toList());
list.addAll(list1);
}
}
/**
* 获取登陆人所在公司
*/
private Long getCompanyId (Long parentId, List<OrgUsr> companyDepartmentMsgList) {
Long pid = null;
for (OrgUsr orgUsr : companyDepartmentMsgList) {
if (orgUsr.getSequenceNbr().equals(parentId)) {
if (orgUsr.getBizOrgType().equals(OrgPersonEnum.公司.getKey()) && ObjectUtils.isEmpty(orgUsr.getParentId())) {
return orgUsr.getSequenceNbr();
} else {
pid = getCompanyId(Long.parseLong(orgUsr.getParentId()),companyDepartmentMsgList);
}
}
}
return pid;
}
} }
......
...@@ -19,6 +19,16 @@ ...@@ -19,6 +19,16 @@
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId> <artifactId>poi-scratchpad</artifactId>
<version>3.15</version> <version>3.15</version>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-biz</artifactId> <artifactId>amos-boot-module-common-biz</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> <!-- ES--> </dependency>
</dependencies> </dependencies>
</project> </project>
package com.yeejoin.amos.boot.module.jcs.biz.controller; package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -22,14 +21,12 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -22,14 +21,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.CommonUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -39,13 +36,10 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -39,13 +36,10 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto; import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto; import com.yeejoin.amos.boot.module.jcs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService; import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
...@@ -88,9 +82,7 @@ public class AlertCalledController extends BaseController { ...@@ -88,9 +82,7 @@ public class AlertCalledController extends BaseController {
if (ValidationUtil.isEmpty(alertCalledObjsDto) if (ValidationUtil.isEmpty(alertCalledObjsDto)
|| ValidationUtil.isEmpty(alertCalledObjsDto.getAlertCalled())) || ValidationUtil.isEmpty(alertCalledObjsDto.getAlertCalled()))
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
ReginParams reginParams = ReginParams reginParams =getSelectedOrgInfo();
JSONObject.parseObject(null != redisUtils.get(getToken()) ?
redisUtils.get(getToken()).toString() : null, ReginParams.class);
//获取当前登录人公司 //获取当前登录人公司
String name= reginParams.getCompany().getCompanyName(); String name= reginParams.getCompany().getCompanyName();
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled(); AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
...@@ -287,4 +279,23 @@ public class AlertCalledController extends BaseController { ...@@ -287,4 +279,23 @@ public class AlertCalledController extends BaseController {
@RequestParam("endDate") String endDate) { @RequestParam("endDate") String endDate) {
return ResponseHelper.buildResponse(iAlertCalledService.getAlertInfoList(beginDate, endDate)); return ResponseHelper.buildResponse(iAlertCalledService.getAlertInfoList(beginDate, endDate));
} }
/**
*
* <pre>
* 设备联动紧急响应
* 启动所有消防队伍的警铃、广播,并自动开启所有车库门
* </pre>
*
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/billsend")
@ApiOperation(httpMethod = "POST", value = "设备联动紧急响应", notes = "启动所有消防队伍的警铃、广播,并自动开启所有车库门")
@Transactional
public ResponseModel<Boolean> controlEquip() throws Exception{
return ResponseHelper.buildResponse(iAlertCalledService.controlEquip());
}
} }
\ No newline at end of file
...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.feign.JcsControlServerClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
...@@ -73,6 +74,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -73,6 +74,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@Autowired @Autowired
AlertSubmittedMapper alertSubmittedMapper; AlertSubmittedMapper alertSubmittedMapper;
@Autowired @Autowired
private JcsControlServerClient jcsControlServerClient;
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService; private AlertFormValueServiceImpl iAlertFormValueService;
@Autowired @Autowired
private ESAlertCalledService eSAlertCalledService; private ESAlertCalledService eSAlertCalledService;
...@@ -428,5 +431,22 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -428,5 +431,22 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
return alertCalledMapper.getTodayAlertCalled(); return alertCalledMapper.getTodayAlertCalled();
} }
@Transactional(rollbackFor = RuntimeException.class)
public Boolean controlEquip() throws Exception
{
//打开消防警铃
jcsControlServerClient.sendBellAction("204,205,206", "1");
//播放广播
jcsControlServerClient.sendFileAction("201,202,203", "1490075199246.mp3");
//打开北站车库门
jcsControlServerClient.writeStateAction("172.19.111.153", 502, 100, "1,1,1,1");
//打开北站车库门弱电警铃
jcsControlServerClient.writeStateAction("172.19.111.153", 502, 107, "1");
//打开南站车库门
jcsControlServerClient.writeStateAction("172.19.111.163", 502, 100, "1");
//打开南站车库门弱电警铃
jcsControlServerClient.writeStateAction("172.19.111.163", 502, 107, "1");
return true;
}
} }
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>amos-boot-module-biz</artifactId>
<groupId>com.amosframework.boot</groupId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-module-jpush-biz</artifactId>
<dependencies>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jpush-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId>
<version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</exclusion>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
package com.yeejoin.amos.jpush.service.business.controller;
import com.yeejoin.amos.jpush.common.entity.CommonResponse;
import com.yeejoin.amos.jpush.common.entity.CommonResponseUtil;
import com.yeejoin.amos.jpush.service.business.param.PushMsgParam;
import com.yeejoin.amos.jpush.service.jpush.AppMessagePushService;
import cn.jpush.api.push.model.PushPayload;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
/**
* 获取用户信息
*
* @author gaodongdong
*/
@RestController
@RequestMapping(value = "/api/user")
@Api(tags = "用户信息api")
public class UserController {
private final Logger logger = LoggerFactory.getLogger(UserController.class);
@Autowired
private AppMessagePushService appMessagePushService;
//极光推送
@ApiOperation(value = "发送消息", notes = "发送消息")
@RequestMapping(value = "/sendMessage", method = RequestMethod.POST)
public CommonResponse sendMessage(@RequestBody List<PushMsgParam> responses) {
try {
appMessagePushService.sendMessage( responses);
return CommonResponseUtil.success("发送成功");
} catch (Exception e) {
return CommonResponseUtil.failure("发送失败");
}
}
@ApiOperation(value = "发送消息", notes = "发送消息")
@RequestMapping(value = "/sendMessageone", method = RequestMethod.POST)
public CommonResponse sendMessageone(@RequestBody PushMsgParam responses) {
try {
appMessagePushService.sendMessage( responses);
return CommonResponseUtil.success("发送成功");
} catch (Exception e) {
return CommonResponseUtil.failure("发送失败");
}
}
@ApiOperation(value = "发送消息", notes = "发送消息")
@RequestMapping(value = "/pushNoticeMany", method = RequestMethod.POST)
public CommonResponse pushNoticeMany(@RequestBody PushMsgParam responses) {
try {
appMessagePushService.pushNoticeMany( responses);
return CommonResponseUtil.success("发送成功");
} catch (Exception e) {
return CommonResponseUtil.failure("发送失败");
}
}
@ApiOperation(value = "发送消息", notes = "发送消息")
@RequestMapping(value = "/buildPushPayload", method = RequestMethod.POST)
public CommonResponse buildPushPayload(@RequestBody PushMsgParam responses) {
try {
PushPayload pushPayload =appMessagePushService.buildPushPayload( responses);
return CommonResponseUtil.success(pushPayload);
} catch (Exception e) {
return CommonResponseUtil.failure("发送失败");
}
}
@ApiOperation(value = "删除别名关联设备", notes = "删除别名关联设备")
@RequestMapping(value = "/pushDevice", method = RequestMethod.GET)
public CommonResponse pushDevice(@RequestParam("alias") String alias) {
try {
boolean falg =appMessagePushService.PushDevice( alias);
if(falg){
return CommonResponseUtil.failure();
}else{
return CommonResponseUtil.success();
}
} catch (Exception e) {
return CommonResponseUtil.failure();
}
}
@ApiOperation(value = "别名关联设备", notes = "别名关联设备")
@RequestMapping(value = "/PushDeviceRegistration", method = RequestMethod.GET)
public CommonResponse PushDeviceRegistration(@RequestParam("registrationId") String registrationId,@RequestParam("alias") String alias) {
try {
boolean falg =appMessagePushService.PushDeviceRegistration( registrationId,alias);
if(falg){
return CommonResponseUtil.success();
}else{
return CommonResponseUtil.failure();
}
} catch (Exception e) {
return CommonResponseUtil.failure();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.jpush.service.business.param;
import java.util.List;
import java.util.Map;
public class PushMsgParam {
/**
* 标题
*/
private String subject;
/**
* 消息内容
*/
private String content;
/**
* 邮件地址
*/
private String[] emails;
/**
* jpush接收人
*/
private List<String> recivers;
//
/**
* jpush参数传递
*/
Map<String, String> extras;
/**
* jpush发送类型:1:广播;2:标签;3:别名
*/
private String type = "3";
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public List<String> getRecivers() {
return recivers;
}
public void setRecivers(List<String> recivers) {
this.recivers = recivers;
}
public Map<String, String> getExtras() {
return extras;
}
public void setExtras(Map<String, String> extras) {
this.extras = extras;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String[] getEmails() {
return emails;
}
public void setEmails(String[] emails) {
this.emails = emails;
}
}
/**
*
*/
package com.yeejoin.amos.jpush.service.constants;
import java.text.SimpleDateFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 常量
*/
public class XJConstant {
private static final Logger logger = LoggerFactory.getLogger(XJConstant.class);
/**
* 构造方法
*/
private XJConstant() {
logger.debug(XJConstant.CONSTRUCTOR);
}
public static final String CM_CATEGORY_DIC_CODE = "CM_CATEGORY";
public static final String CM_TYPE_DIC_CODE = "CM_TYPE";
public static final String JPUSH_USER_KEY ="CONVERTER_STATION";
/**
* 网络服务ip
*/
public static final String NET_SERVER_HOST = "0.0.0.0";
/**
* 请求头key
*/
public static final String TOKEN_KEY = "X-Access-Token";
/**
* 时间格式(yyyy-MM-dd HH:mm:ss)
*/
public static final SimpleDateFormat SIMPLEDATAFORMAT_YMDHMS = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
/**
* 构造方法字符串
*/
public static final String CONSTRUCTOR = "constructor...";
/**
* 轮询job最大线程数
*/
public static final int POLLING_JOB_THREAD_MAX_NUM = 20;
/**
* amos线程池数量
*/
public static final int AMOS_THREAD_NUM = 20;
/**
* 设备测试最大线程数
*/
public static final int TEST_EQUIPMENT_THREAD_MAX_NUM = 5;
/**
* 时间格式字符串:yyyy-MM-dd HH:mm:ss
*/
public static final String DATE_TIME_STR_YMDHMS = "yyyy-MM-dd HH:mm:ss";
/**
* bar
*/
public static final String BAR = "-";
/**
* Underline
*/
public static final String UNDERLINE = "_";
/**
* user
*/
public static final String USER = "user";
/**
* token
*/
public static final String TOKEN = "token";
/**
* loginType
*/
public static final String LOGIN_TYPE = "loginType";
/**
* subGraphId
*/
public static final String SUB_GRAPH_ID = "subGraphId";
public static final String ADMIN_ID = "1";
/**
* 帧报文异常
*/
public static final String FRAME_EXECPTION = "FRAME";
/**
* 性能指标
*/
public static final String METRIC = "METRIC";
/**
* 报文通道
*/
public static final String CHANNEL = "CHANNEL";
/**
* 设备状态(掉线)告警
*/
public static final String EQUIPMENT_STATUS = "EQUIPMENT_STATUS";
/**
* 设备连通性告警告警
*/
public static final String EQUIPMENT_CONNECTION = "EQUIPMENT_CONNECTION";
/**
* 通道注册
*/
public static final String REGISTER = "REGISTER";
/**
* 通道注销
*/
public static final String UNREGISTER = "UNREGISTER";
/**
* 报文正常
*/
public static final String NORMAL = "NORMAL";
/**
* 报文异常
*/
public static final String UNNORMAL = "UNNORMAL";
/**
* 告警socket类型
*/
public static final String ALARM_SOCKET = "ALARM_SOCKET";
/**
* 数据socket类型
*/
public static final String METRIC_SOCKET = "METRIC_SOCKET";
/**
* 数据socket类型
*/
public static final String MORPHIC_SOCKET = "MORPHIC_SOCKET";
/**
* false
*/
public static final Boolean FAIL_BOOLEAN_VALUE = Boolean.FALSE;
/**
* 0
*/
public static final Integer ZERO_INT_VALUE = Integer.parseInt("0");
/**
* -1
*/
public static final Integer FAIL_INT_VALUE = Integer.parseInt("-1");
/**
* -1
*/
public static final Long FAIL_LONG_VALUE = Long.parseLong("-1");
/**
* -1
*/
public static final Short FAIL_SHORT_VALUE = Short.parseShort("-1");
/**
*
*/
public static final Float FAIL_FLOAT_VALUE = Float.parseFloat("-1");
/**
* -1
*/
public static final Double FAIL_DOUBLE_VALUE = Double.parseDouble("-1");
/**
* 空格
*/
public static final Character FAIL_CHARACTER_VALUE = Character.valueOf(' ');
/**
* 失败
*/
public static final int FAILURE = 0;
/**
* 成功
*/
public static final int SUCCESS = 1;
/**
* 在线
*/
public static final String ONLINE = "在线";
/**
* 掉线
*/
public static final String OFFLINE = "掉线";
/**
* 通
*/
public static final String OPEN = "通";
/**
* 不通
*/
public static final String OFF = "不通";
/**
* ip
*/
public static final String IP = "ip";
/**
* #
*/
public static final String SHARP = "#";
/**
* TCP
*/
public static final String TCP = "TCP";
public static final String PIE_CHAR = "pieChar";
public static final String BAR_CHAR = "barChar";
public static final String HBAR_CHAR = "hbarChar";
public static final String LINE_CHAR = "lineChar";
public static final String DOUGHUNT_CHAR = "doughuntChar";
public static final String ROSE_CHAR = "roseChar";
public static final String AREA_CHAR = "areaChar";
public static final String DIMENSION = "dimension";
public static final String MEASURE = "measure";
/**
* xunjian
*/
public static final String TABLE_USERS = "Users";
public static final String EDIT_PWD = "editPassword";
public static final String EDIT_NOT_PWD = "editUsersInfo";
public static final String SAVE_USERS = "saveTableById";
public static final String SAVE_COM_USER = "saveComUserInfo";
public static final String EDIT_COM_USER = "editComUserInfo";
public static final String TABLE_CHECK = "Check";
public static final String TABLE_COM_USER = "companyUser";
public static final int FINISH_YES = 2;
public static final int FINISH_ING = 1;
public static final int FINISH_NO = 0;
public static final String SAVE_DEPART = "saveDepartMent";
public static final String EDIT_DEPART = "editsDepartMent";
public static final String TABLE_DEPART = "Group";
public static final String TABLE_ERROR = "Error";//隐患表
public static final String SAVE_ERROR = "saveErrorByID";//更新隐患表
public static final int XJ_ADMIN_ROLE = 9;//巡检管理员角色ID
public static final int XJ_USER_ROLE = 0;//巡检普通用户角色ID
public static final int TASK_STATUS_TIMEOUT = 3;//已超时
public static final int TASK_STATUS_FINISH = 2;//已结束
public static final int TASK_STATUS_DEAL = 1;//进行中
public static final int TASK_STATUS_NO_START = 0;//未开始
public static final String PLAN_TASK_DET_FINISH_NO = "0";//任务明细状态:未完成
public static final String PLAN_TASK_DET_FINISH_YES = "1";//任务明细状态:完成
public static final String PLAN_TASK_DET_FINISH_OUT = "2";//任务明细状态:超时漏检
public static final String USER_DATA_ADMIN = "全部可见"; //用户数据可见范围
public static final String USER_DATA_DEPART = "部门可见"; //用户数据可见范围
public static final String USER_DATA_PERSON = "个人可见"; //用户数据可见范围
public static final String USER_ROLE_SUPERADMIN = "1"; //权限id-超级管理员
public static final String USER_ROLE_ADMIN = "2"; //权限id-管理员
public static final String USER_ROLE_DEPART = "3"; //权限id-部门管理
public static final String USER_ROLE_PERSON = "4"; //权限id-普通用户
public static final String ROLE_NAME_SUPERADMIN = "SUPERADMIN"; //数据权限-超级管理员
public static final String ROLE_NAME_ADMIN = "ADMIN"; //数据权限-超级管理员
public static final String ROLE_NAME_DEPTADMIN = "DEPTADMIN"; //数据权限-部门
public static final String ROLE_NAME_PERSON = "PERSONAL"; //数据权限-个人
public static final String ADMIN_FLAG = "2"; //权限标记
public static final String DEPART_FLAG = "1"; //权限标记
public static final String PERSON_FLAG = "0";//权限标记
public static final String ADMIN_FLAG_NO = "0"; //标记 0-无关
public static final String ADMIN_FLAG_UP = "1"; //1-上级admin
public static final String ADMIN_FLAG_THIS = "2"; //2-本级admin
public static final String UNCLASSIFIED = "Unclassifed"; //巡检点未分类
public static final String ADMIN_ORG_CODE = "2";
public static final String CHECK_CHANGE_NO = "0";//是否记为合格:否
public static final String CHECK_CHANGE_YES = "1";//是否记为合格:是
public static final String SCHED_FLAG = "99";//自动任务标记
public static final String REGEN_FLAG = "98";//重做任务标记
public static final String FIX_DATE_NO = "0";//不固定日期(区间)
public static final String FIX_DATE_YES = "1";//固定日期
//计划类型
public static final String PLAN_TYPE_DAY = "1";//日计划
public static final String PLAN_TYPE_WEEK = "2";//周计划
public static final String PLAN_TYPE_MONTH = "3";//月计划
public static final String PLAN_TYPE_YEAR = "4";//年计划
//月类型
public static final String MONTH_TYPE_DAY = "1";//第几天
public static final String MONTH_TYPE_AT = "2";//在第几周的第几天
public static final String INTERVAL_UNIT_HOUR = "1";//执行间隔小时
public static final String INTERVAL_UNIT_MINUTE = "2";//执行间隔分钟
public static final String INTERVAL_UNIT_SECOND = "3";//执行间隔秒
public static final String ZERO_TIME = "00:00:00";//time
public static final String PLAN_STATUS_START = "0";//计划状态:正常
public static final String PLAN_STATUS_STOP = "1";//计划状态:已停用
public static final int PLAN_FIRST_STATUS_YES = 0;//计划:初始状态
public static final int PLAN_FIRST_STATUS_NO = 1;//计划:非初始状态
public static final String UPD_PLAN_GEN_DATE = "1";//更新plan表日期
public static final String UPD_PLAN_STATUS = "2";//更新plan表next_gen_status
public static final int DAY_RATE_ONE = 0;//0-1次
public static final int DAY_RATE_MANY = 1;//1-多次
public static final int IS_DETETE_NO = 0;//未删除
public static final int IS_DETETE_YES = 1;//删除
public static final String UPLOAD_ROOT_PATH = "upload";
public static final String INPUT_ITEM_TEXT = "文本";
public static final String INPUT_ITEM_NUMBER = "数字";
public static final String INPUT_ITEM_SELECT = "选择";
public static final String CHECK_TYPE_ALWAYS_OK = "始终合格";
public static final String CHECK_TYPE_ALWAYS_NO = "始终不合格";
public static final String CHECK_TYPE_NO_CONTEXT_OK = "无内容合格";
public static final String CHECK_TYPE_CONTEXT_OK = "有内容合格";
public static final String GEN_MORE_DATA_YES = "YES";
public static final String OK = "合格";
public static final String NO = "不合格";
public static final String YES = "是";
public static final String NOT = "否";
public static final String INPUT_ITEM_OK_SCORE = "OkScore";
public static final String INPUT_ITEM_NOT_SCORE = "NoScore";
/**
* 任务是否发送消息状态
*/
public static final String TASK_WARN = "是";
public static final String TASK_NOT_WARN = "否";
/**
* 系统定时任务类型
*/
public static final String STATUS_MONITOR_START = "statusMonitorStart"; //状态监控是否开始
public static final String STATUS_MONITOR_END = "statusMonitorEnd"; //状态监控是否结束
public static final String PLAN_TASK_WARN_MSG_PUSH = "planTaskWarnMsgPush"; //计划即将开始消息提醒推送开始前几分钟
public static final String PLAN_TASK_BEGIN_MSG_PUSH = "planTaskBeginMsgPush"; //计划已经开始消息提醒推送已经开始后几分钟
public static final String PLAN_TASK_END_MSG_PUSH = "planTaskEndMsgPush"; //计划已经开始消息提醒推送漏检
public static final String MESSAGE_PUSH = "messagePush"; //消息推送
public static final int IS_SENT = 1; //已发送
public static final int NOT_SENT = 0; //未发送
public static final String IS_FIXED_YES = "1"; //固定点
public static final String IMG = "img";
public static final String REVIEW_DEPT = "1";
public static final String COMBINE_DATA = "2";
}
package com.yeejoin.amos.jpush.service.core.enums;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.enums.ValuedEnum;
/**
* 操作枚举
*
* @author as-youjun
*
*/
@SuppressWarnings("all")
public final class QueryOperatorEnum extends ValuedEnum {
private static final long serialVersionUID = -375127751242109017L;
public static final int LESS_VALUE = 1; // 小于
public static final int BIGGER_VALUE = 2; // 大于
public static final int EQUAL_VALUE = 3; // 等于
public static final int LESS_EQUAL_VALUE = 4; // 小于等于
public static final int BIGGER_EQUAL_VALUE = 5; // 大于等于
public static final int NOT_EQUAL_VALUE = 6; // 不等于
public static final int IN_VALUE = 7; // 包含
public static final int LIKE_VALUE = 8; // like
public static final int OR_VALUE = 9; // 或者
public static final int ORDER_VALUE = 10; // 排序
public static final int NOT_IN_VALUE = 11; // 不包含
public static final int IS_VALUE= 12; //是
public static final QueryOperatorEnum LESS = new QueryOperatorEnum("LESS", 1, "<");
public static final QueryOperatorEnum BIGGER = new QueryOperatorEnum("BIGGER", 2, ">");
public static final QueryOperatorEnum EQUAL = new QueryOperatorEnum("EQUAL", 3, "=");
public static final QueryOperatorEnum LESS_EQUAL = new QueryOperatorEnum("LESS_EQUAL", 4, "<=");
public static final QueryOperatorEnum BIGGER_EQUAL = new QueryOperatorEnum("BIGGER_EQUAL", 5, ">=");
public static final QueryOperatorEnum NOT_EQUAL = new QueryOperatorEnum("NOT_EQUAL", 6, "<>");
public static final QueryOperatorEnum IN = new QueryOperatorEnum("IN", 7, "IN");
public static final QueryOperatorEnum LIKE = new QueryOperatorEnum("LIKE", 8, "LIKE");
public static final QueryOperatorEnum OR = new QueryOperatorEnum("OR", 9, "OR");
public static final QueryOperatorEnum ORDER_BY = new QueryOperatorEnum("ORDER BY", 10, "ORDER BY");
public static final QueryOperatorEnum NOT_IN = new QueryOperatorEnum("NOT IN", 11, "NOT IN");
public static final QueryOperatorEnum IS = new QueryOperatorEnum("IS", 12, "IS");
public String condition;
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
protected QueryOperatorEnum(String arg0, int arg1, String condition) {
super(arg0, arg1);
this.condition = condition;
}
public static QueryOperatorEnum getEnum(String name) {
try {
return ((QueryOperatorEnum) getEnum(QueryOperatorEnum.class, name));
} catch (Exception ex) {
return null;
}
}
public static QueryOperatorEnum getEnum(int name) {
try {
return ((QueryOperatorEnum) getEnum(QueryOperatorEnum.class, name));
} catch (Exception ex) {
return null;
}
}
public static Map getMap() {
try {
return getEnumMap(QueryOperatorEnum.class);
} catch (Exception ex) {
return null;
}
}
public static List getList() {
try {
return getEnumList(QueryOperatorEnum.class);
} catch (Exception ex) {
return null;
}
}
public static Iterator iterator() {
try {
return iterator(QueryOperatorEnum.class);
} catch (Exception ex) {
return null;
}
}
}
package com.yeejoin.amos.jpush.service.core.util;
import java.sql.Time;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import com.yeejoin.amos.jpush.service.exception.YeeException;
/**
* <pre>
* 日期
* </pre>
*
* @author as-chenjiajun
* @version $Id: DateUtil.java, v 0.1 2018年1月29日 下午5:08:40 as-chenjiajun Exp $
*/
public class DateUtil {
public static String LONG_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static String MID_PATTERN = "yyyy-MM-dd HH:mm";
public static String SHORT_PATTERN = "yyyy-MM-dd";
public static long THREE_DAY_MILLSEC = 259200000L;
public static long ONE_DAY_MILLSEC = 86400000L;
public static long ONE_HOUR_MILLSEC = 3600000L;
public static long THREE_HOURS_MILLSEC = 10800000L;
public static long TWELVE_HOURS_MILLSEC = 43200000L;
public static Date EMPTY_DATE = null;
static {
Calendar calendar = Calendar.getInstance();
calendar.set(9999, 0, 0);
EMPTY_DATE = calendar.getTime();
}
/**
* <pre>
* 获取当前北京时间
* </pre>
*
* @return
*/
public static Date getCurrentDate() {
return getCurrentCalendar().getTime();
}
public static String getLongCurrentDate() {
return new SimpleDateFormat(LONG_PATTERN)
.format(getCurrentCalendar().getTime());
}
public static String getLongDate(Date date) {
if (null == date)
return getLongCurrentDate();
else
return new SimpleDateFormat(LONG_PATTERN).format(date);
}
public static String getLongDate(long value) {
return new SimpleDateFormat(LONG_PATTERN).format(new Date(value));
}
public static String getShortCurrentDate() {
return new SimpleDateFormat(SHORT_PATTERN).format(new Date());
}
public static String getShortDate(Date date) {
if (null == date)
return getShortCurrentDate();
else
return new SimpleDateFormat(SHORT_PATTERN).format(date);
}
public static String getShortDate(long value) {
return new SimpleDateFormat(SHORT_PATTERN).format(new Date(value));
}
public static Date getShortCurrentDate(String shortDateStr) throws ParseException {
return new SimpleDateFormat(SHORT_PATTERN).parse(shortDateStr);
}
public static Date getLongDate(String longDateStr) throws ParseException {
return new SimpleDateFormat(LONG_PATTERN).parse(longDateStr);
}
public static String getMidCurrentDate() {
return new SimpleDateFormat(MID_PATTERN).format(new Date());
}
public static String getMidDate(Date date) {
if (null == date)
return getMidCurrentDate();
else
return new SimpleDateFormat(MID_PATTERN).format(new Date());
}
public static String getMidDate(long value) {
return new SimpleDateFormat(MID_PATTERN).format(new Date(value));
}
public static Date str2Date(String strDate, String dateFormat) {
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(strDate, pos);
return strtodate;
}
public static int getYear(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
return year;
}
public static int getMonth(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int month = calendar.get(Calendar.MONTH) + 1;
return month;
}
public static int getDay(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
int day = c.get(Calendar.DATE);
return day;
}
public static int getHour(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
int hour = c.get(Calendar.HOUR_OF_DAY);
return hour;
}
public static int getMinite(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
int minite = c.get(Calendar.MINUTE);
return minite;
}
/**
* <pre>
* 获取当前北京时间
* </pre>
*
* @return
*/
public static Calendar getCurrentCalendar() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
return Calendar.getInstance();
}
/**
* <pre>
* 获取当前两个时间差
* </pre>
*
* @return
*/
public static String getTimeDifference(Date dateBefore, Date dateAfter) {
long l = dateAfter.getTime() - dateBefore.getTime();
long day = l / (24 * 60 * 60 * 1000);
long hour = (l / (60 * 60 * 1000) - day * 24);
long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
return "" + day + "天" + hour + "小时" + min + "分" + s + "秒";
}
/**
* 获取某年某月的第一天日期
*
* @param date
* @param format
* @return
*/
public static String getStartMonthDate(String date, String format) {
if (date == null || date.length() < 6 || format == null) {
return null;
}
int year = Integer.parseInt(date.substring(0, 4));
int month = Integer.parseInt(date.substring(4, 6));
Calendar calendar = Calendar.getInstance();
calendar.set(year, month - 1, 1);
return new SimpleDateFormat(format).format(calendar.getTime());
}
/**
* 获取某年某月的最后一天日期
*
* @param date
* @param format
* @return
*/
public static String getEndMonthDate(String date, String format) {
if (date == null || date.length() < 6 || format == null) {
return null;
}
int year = Integer.parseInt(date.substring(0, 4));
int month = Integer.parseInt(date.substring(4, 6));
Calendar calendar = Calendar.getInstance();
calendar.set(year, month - 1, 1);
int day = calendar.getActualMaximum(5);
calendar.set(year, month - 1, day);
return new SimpleDateFormat(format).format(calendar.getTime());
}
/**
* 获取某天的间隔天数
*
* @param date
* @param interval 间隔天数。负数为前,正数为后
* @param format 输出格式化
* @return
*/
public static String getIntervalDateStr(Date date, int interval, String format) {
if (date == null || format == null) {
return null;
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DATE, interval);
return new SimpleDateFormat(format).format(calendar.getTime());
}
/**
* 获取某天的年初第一天
*
* @param date
* @param format 输出格式化
* @return
*/
public static String getFirstDayOfYear(String date, String format) {
int year = Integer.parseInt(date.substring(0, 4));
Calendar calendar = Calendar.getInstance();
calendar.set(year, Calendar.JANUARY, 1);
return new SimpleDateFormat(format).format(calendar.getTime());
}
/**
* 获取某天的年初第一天
*
* @param date
* @param format 输出格式化
* @return date
*/
public static Date getFirstDayOfYearDate(String date) {
int year = Integer.parseInt(date.substring(0, 4));
Calendar calendar = Calendar.getInstance();
calendar.set(year, Calendar.JANUARY, 1);
return calendar.getTime();
}
/**
* 获取某天的年末最后一天
*
* @param date
* @param format 输出格式化
* @return date
*/
public static Date getLastDayOfYearDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
final int last = calendar.getActualMaximum(Calendar.DAY_OF_YEAR);
calendar.set(Calendar.DAY_OF_YEAR, last);
return calendar.getTime();
}
/**
* 获取某天的间隔天数
*
* @param date
* @param interval 间隔天数。负数为前,正数为后
* @param format 输出格式化
* @return
*/
public static Date getIntervalDate(Date date, int interval) {
if (date == null) {
return null;
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DATE, interval);
return calendar.getTime();
}
/**
* 获得指定日期的间隔周末
*
* @param exeDate
* @param init
* @return
*/
public static Date getIntervalWeekDate(Date exeDate, int init) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(exeDate);
calendar.add(Calendar.DATE, init * 7);
calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
return calendar.getTime();
}
/**
* 获得制定日期间隔的上个月最后一天
*
* @param exeDate
* @param inter
* @return
*/
public static Date getEndMonthDate(Date exeDate, int inter) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(exeDate);
calendar.add(Calendar.MONTH, inter - 1);
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
return calendar.getTime();
}
/**
* 获取间隔周的
*
* @param mounthFirstDate
* @param whatWeek
* @param weekDay
* @return
*/
public static Date getIntMonthWeekDate(Date mounthFirstDate, int week, int day) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(mounthFirstDate);
if (day == 7) {
day = 1;
week = week + 1;
} else {
day = day + 1;
}
calendar.set(Calendar.WEEK_OF_MONTH, week);
calendar.set(Calendar.DAY_OF_WEEK, day);
return calendar.getTime();
}
/**
* 获取间隔的年日期
*
* @param planDegin
* @param init
* @return
*/
public static String getIntervalYearDate(Date planDegin, int init) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(planDegin);
calendar.add(Calendar.YEAR, init);
return new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
}
/**
* 格式化日期
*
* @param beginDate
* @param string
* @return
*/
public static String formatDatrToStr(Date beginDate, String formart) {
SimpleDateFormat df = new SimpleDateFormat(formart);
String strDate = df.format(beginDate);
return strDate;
}
public static Time formatStrToTime(String strDate) {
String str = strDate;
SimpleDateFormat format = new SimpleDateFormat("hh:mm:ss");
Date d = null;
try {
d = format.parse(str);
} catch (Exception e) {
e.printStackTrace();
}
Time date = new Time(d.getTime());
return date;
}
/**
* 获得间隔分钟的时间
*
* @param strBeginTime 被操作时间
* @param duration 间隔分钟数
* @param string 格式化的格式
* @return
*/
public static String getIntMinStrDate(String strBeginTime, int duration, String formart) {
SimpleDateFormat df = new SimpleDateFormat(formart);
Date date;
try {
date = df.parse(strBeginTime);
} catch (ParseException e) {
throw new YeeException("格式化日期失败");
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MINUTE, duration);
String strDate = df.format(calendar.getTime());
return strDate;
}
public static String cronTime(Date date) {
StringBuilder cron = new StringBuilder();
cron.append(date.getSeconds()).append(" ")
.append(date.getMinutes()).append(" ")
.append(date.getHours()).append(" ")
.append(date.getDay()).append(" ")
.append(date.getMonth()).append(" ")
.append("?").append(" ")
.append(date.getYear());
return cron.toString();
}
/**
* 获取指定日期的周一
*/
public static Date getThisWeekMonday(Date date) {
Calendar cal = getCurrentCalendar();
cal.setTime(date);
// 获得当前日期是一个星期的第几天
int dayWeek = cal.get(Calendar.DAY_OF_WEEK);
if (1 == dayWeek) {
cal.add(Calendar.DAY_OF_MONTH, -1);
}
// 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
cal.setFirstDayOfWeek(Calendar.MONDAY);
// 获得当前日期是一个星期的第几天
int day = cal.get(Calendar.DAY_OF_WEEK);
// 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);
return cal.getTime();
}
/**
* 获取指定日期的月份第一天
*/
public static Date getThisMonthFirstDay(Date date) {
Calendar cal = getCurrentCalendar();
cal.setTime(date);
//获取某月最小天数
int firstDay = cal.getMinimum(Calendar.DATE);
//设置日历中月份的最小天数
cal.set(Calendar.DAY_OF_MONTH, firstDay);
return cal.getTime();
}
public static Date getCurrYearFirst() {
Calendar currCal = getCurrentCalendar();
int currentYear = currCal.get(Calendar.YEAR);
return getYearFirst(currentYear);
}
public static Date getCurrYearLast() {
Calendar currCal = getCurrentCalendar();
int currentYear = currCal.get(Calendar.YEAR);
return getYearLast(currentYear);
}
public static Date getYearFirst(int year) {
Calendar calendar = getCurrentCalendar();
calendar.clear();
calendar.set(Calendar.YEAR, year);
return calendar.getTime();
}
public static Date getYearLast(int year) {
Calendar calendar = getCurrentCalendar();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
return calendar.getTime();
}
/**
* 获得指定日期所在周第一天
* @param planBegin
* @return
*/
public static String getFirstDayOfWeekAtDay(String planBegin) {
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date;
try {
date = df.parse(planBegin);
} catch (ParseException e) {
throw new YeeException("日期格式化失败");
}
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY);
return df.format(calendar.getTime());
}
/**
* 获得指定日期所在周第一天
* @param planEnd
* @return
*/
public static String getEndDayOfWeekAtDay(String planEnd) {
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date;
try {
date = df.parse(planEnd);
} catch (ParseException e) {
throw new YeeException("日期格式化失败");
}
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY);
return df.format(calendar.getTime());
}
/**
* 获得日期在周的天数
* @param planBegin
* @return
* @throws ParseException
*/
public static int getDayOfWeek(String planBegin) {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date;
try {
date = df.parse(planBegin);
} catch (ParseException e) {
throw new YeeException("日期格式化失败");
}
calendar.setFirstDayOfWeek(Calendar.MONDAY);
calendar.setTime(date);
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
if(dayOfWeek == 0) {
dayOfWeek = 7;
}
return dayOfWeek;
}
/**
* 计算两个日期间隔天数
* @param beginData
* @param endData
* @return
*/
public static int calInterverDay(String beginDate,String endDate){
LocalDate ld1 = LocalDate.parse(beginDate);
LocalDate ld2 = LocalDate.parse(endDate);
Period pe = Period.between(ld1, ld2);
return pe.getDays();
}
/**
* 获得日期所在周
* @param beginData
* @return
* @throws ParseException
*/
public static int calAtWeekOfDay(String srtdate){
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date1;
try {
date1 = df.parse(srtdate);
} catch (ParseException e) {
throw new YeeException("日期格式化失败");
}
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
calendar.setTime(date1);
return calendar.get(Calendar.WEEK_OF_YEAR);
}
public static Date getDateByNumber(Date date, Integer dayNumber) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, dayNumber);
return cal.getTime();
}
public static Date getHourBeginOfDay(int hour) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
return cal.getTime();
}
}
package com.yeejoin.amos.jpush.service.core.util;
public class MailUtil {
private static final String regex = "^[A-Za-z]{1,40}@[A-Za-z0-9]{1,40}\\.[A-Za-z]{2,3}$";
public static boolean isValidEmail(String email){
boolean flag = true;
if (email != null && !email.equals("")) {
if (email.toString().length() > 0) {
flag = email.matches(regex);
}
} else {
flag = false;
}
return flag;
}
}
package com.yeejoin.amos.jpush.service.core.util;
import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.util.Assert;
/**
* 字符串工具类
*
* @author as-youjun
*
*/
public class StringUtil {
private static Pattern NOT_ZERO_AT_THE_END = Pattern.compile("[1-9](\\d*[1-9])?");
private static Pattern numericPattern = Pattern.compile("-?[0-9]+\\.?[0-9]*");
/**
* 判断对象是否为空
*
* @param str
* @return
*/
public static boolean isNotEmpty(Object str) {
boolean flag = true;
if (str != null && !str.equals("")) {
if (str.toString().length() > 0) {
flag = true;
}
} else {
flag = false;
}
return flag;
}
/***************************************************************************
* repeat - 通过源字符串重复生成N次组成新的字符串。
*
* @param src
* - 源字符串 例如: 空格(" "), 星号("*"), "浙江" 等等...
* @param num
* - 重复生成次数
* @return 返回已生成的重复字符串
* @version 1.0 (2006.10.10) Wilson Lin
**************************************************************************/
public static String repeat(String src, int num) {
StringBuffer s = new StringBuffer();
for (int i = 0; i < num; i++)
s.append(src);
return s.toString();
}
/**
* 判断是否数字表示
*
* @param src
* 源字符串
* @return 是否数字的标志
*/
public static boolean isNumeric(String str) {
// 该正则表达式可以匹配所有的数字 包括负数
String bigStr;
try {
bigStr = new BigDecimal(str).toString();
} catch (Exception e) {
return false;// 异常 说明包含非数字。
}
Matcher isNum = numericPattern.matcher(bigStr); // matcher是全匹配
if (!isNum.matches()) {
return false;
}
return true;
}
public static int toInt(String s) {
if (s != null && !"".equals(s.trim())) {
try {
return Integer.parseInt(s);
} catch (Exception e) {
return 0;
}
}
return 0;
}
/**
* 截取前后都不是0的数字字符串
*
* 12010102 => 12010102 12010100 => 120101 ab1201100b => 12011
*
* @param str
* @return
*/
public static String delEndZero(String str) {
Matcher mat = NOT_ZERO_AT_THE_END.matcher(str);
boolean rs = mat.find();
if (rs) {
return mat.group(0);
}
return null;
}
/**
*
* <pre>
* 移除字符串后面的0
* </pre>
*
* @param s
* @return
*/
public static String removeSufixZero(String s) {
if (s == null) {
return "";
}
while (s.endsWith("0")) {
if (s.equals("0")) {
s = "";
break;
}
s = s.substring(0, s.length() - 1);
}
return s;
}
public static String transforCode(String code) {
if (code.endsWith("0000000")) {
code = code.substring(0, 1);
} else if (code.endsWith("000000")) {
code = code.substring(0, 2);
} else if (code.endsWith("0000")) {
code = code.substring(0, 4);
} else if (code.endsWith("00")) {
code = code.substring(0, 6);
}
return code;
}
/**
* 获取支队orgCode
*
* @param orgCode
* @return
*/
public static String getDetachmentOrgCode(String orgCode) {
Assert.notNull(orgCode, "组织结构orgCode不能为空!");
String[] codes = orgCode.split("\\*");
if (codes.length < 2) {
throw new IllegalArgumentException("组织结构orgCode为总队,不能获取支队orgCode!");
} else {
return codes[0] + "*" + codes[1];
}
}
}
package com.yeejoin.amos.jpush.service.exception;
/**
*
* <pre>
* 自定义异常
* </pre>
*
* @author as-youjun
* @version $Id: YeeException.java, v 0.1 2017年7月18日 上午9:34:21 as-youjun Exp $
*/
public class YeeException extends RuntimeException {
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = -1963401137898098411L;
private int errorCode = 0;
public YeeException(int errorCode) {
this.errorCode = errorCode;
}
public YeeException(String message, int errorCode) {
super(message);
this.errorCode = errorCode;
}
public YeeException(String message) {
super(message);
}
public YeeException(String message, Throwable cause, int errorCode) {
super(message, cause);
this.errorCode = errorCode;
}
public YeeException(Throwable cause, int errorCode) {
super(cause);
this.errorCode = errorCode;
}
public YeeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace,
int errorCode) {
super(message, cause, enableSuppression, writableStackTrace);
this.errorCode = errorCode;
}
/**
* Getter method for property <tt>errorCode</tt>.
*
* @return property value of errorCode
*/
public int getErrorCode() {
return errorCode;
}
/**
* Setter method for property <tt>errorCode</tt>.
*
* @param errorCode
* value to be assigned to property errorCode
*/
public void setErrorCode(int errorCode) {
this.errorCode = errorCode;
}
}
package com.yeejoin.amos.jpush.service.jpush;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.jpush.common.enums.JPushTypeEnum;
import com.yeejoin.amos.jpush.service.business.param.PushMsgParam;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.model.Options;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.PushPayload.Builder;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.Notification;
@Service
@Component
public class AppMessagePushService {
protected static final Logger log = LoggerFactory
.getLogger(AppMessagePushService.class);
@Value("${params.isPush}")
private String isPush;
private static RestTemplate restTemplate;
private static ObjectMapper objectMapper = new ObjectMapper();
//端口443
protected static final String URL ="https://device.jpush.cn/";
protected static final String APP_KEY = "1b3f7b961200f4b236811dfe";
protected static final String MASTER_SECRET = "8b650e645fb3a43c96be02b2";
private static JPushClient jpushClient = new JPushClient(MASTER_SECRET,
APP_KEY);
public static String buildJpushUserKey(String userId) {
// return XJConstant.JPUSH_USER_KEY + "_" + userId;
return userId;
}
public void sendMessage(List<PushMsgParam> responses) {
try {
if (responses != null && "true".equals(isPush)) {
for (PushMsgParam response : responses) {
PushPayload payload = buildPushPayload(response);
jpushClient.sendPush(payload);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
e.printStackTrace();
}
}
public static PushPayload buildPushPayload(PushMsgParam response) {
Builder builder= PushPayload.newBuilder();
builder.setPlatform(Platform.all());
//设置如果用户不在线、离线消息保存的时间
Options options=Options.sendno();
options.setTimeToLive(86400l);
options.setApnsProduction(true);
builder.setOptions(options);
//设置推送方式
List<String> recivers = response.getRecivers();
List<String> users = Lists.newArrayList();
recivers.forEach(e -> users.add(buildJpushUserKey(e)));
if (JPushTypeEnum.ALL.getCode().equals(response.getType())) {
builder.setAudience(Audience.all());//Audience设置为all,说明采用广播方式推送,所有用户都可以接收到
} else if (JPushTypeEnum.TAG.getCode().equals(response.getType())) {
builder.setAudience(Audience.tag(users));//根据标签推送
} else {
builder.setAudience(Audience.alias(users));//根据别名推送
}
builder.setNotification(Notification.newBuilder()
.addPlatformNotification(AndroidNotification.newBuilder().addExtras(response.getExtras()).setAlert(response.getContent()).setTitle(response.getSubject()).build())
.build());
PushPayload pushPayload=builder.build();
return pushPayload;
}
public void sendMessage(PushMsgParam response) {
try {
if (null != response && "true".equals(isPush)) {
Builder builder= PushPayload.newBuilder();
builder.setPlatform(Platform.all());
Options options=Options.sendno();
options.setTimeToLive(86400l);
options.setApnsProduction(true);
builder.setOptions(options);
//设置推送方式
List<String> recivers = response.getRecivers();
List<String> users = Lists.newArrayList();
recivers.forEach(e -> users.add(buildJpushUserKey(e)));
builder.setAudience(Audience.all());
builder.setNotification(Notification.newBuilder()
.addPlatformNotification(AndroidNotification.newBuilder().addExtras(response.getExtras()).setAlert(response.getContent()).setTitle(response.getSubject()).build())
.build());
PushPayload payload=builder.build();
jpushClient.sendPush(payload);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
e.printStackTrace();
}
}
public static void pushNoticeMany( PushMsgParam response){
PushPayload payload = buildPushPayload(response);
try {
jpushClient.sendPush(payload);
} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIRequestException e) {
e.printStackTrace();
}
}
//删除一个别名,以及该别名与设备的绑定关系。
public static boolean PushDevice(String alias) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse httpResponse = null;
try {
httpClient = HttpClients.createDefault();
HttpDelete httpDelete = new HttpDelete(URL +"v3/aliases/"+alias);
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(35000)
.setConnectionRequestTimeout(35000)
.setSocketTimeout(60000)
.build();
httpDelete.setConfig(requestConfig);
httpDelete.addHeader("Accept", "application/json");
httpDelete.addHeader("Authorization", "Basic "+Base64(APP_KEY+":"+MASTER_SECRET));
httpResponse = httpClient.execute(httpDelete);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
// 关闭资源
if (null != httpResponse) {
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != httpClient) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//设置设备的别名与标签
public static boolean PushDeviceRegistration(String registrationId,String alias) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse httpResponse = null;
try {
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(URL +"v3/devices/"+registrationId);
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(35000)
.setConnectionRequestTimeout(35000)
.setSocketTimeout(60000)
.build();
httpPost.setConfig(requestConfig);
httpPost.addHeader("Accept", "application/json");
httpPost.addHeader("Authorization", "Basic "+Base64(APP_KEY+":"+MASTER_SECRET));
if (null != alias ) {
Map<String, Object> nvps = new HashMap<>();
// 通过map集成entrySet方法获取entity
nvps.put("alias", alias);
nvps.put("tags", "");
nvps.put("mobile", "");
String json= JSON.toJSONString(nvps);
StringEntity stringEntity = new StringEntity(json,"UTF-8");//解决中文乱码问题
httpPost.setEntity(stringEntity);
httpResponse = httpClient.execute(httpPost);
return true;
}else{
return false;
}
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
// 关闭资源
if (null != httpResponse) {
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != httpClient) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//Base64转码
public static String Base64(String code) {
final Base64.Encoder encoder = Base64.getEncoder();
byte[] textByte;
try {
textByte = code.getBytes("UTF-8");
//编码
String encodedText = encoder.encodeToString(textByte);
return encodedText;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "";
}
}
}
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>amos-boot-module-biz</artifactId> <artifactId>amos-boot-module-biz</artifactId>
...@@ -13,85 +15,9 @@ ...@@ -13,85 +15,9 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-biz-common</artifactId> <artifactId>amos-boot-module-knowledgebase-api</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-emq</artifactId>
<version>${tyboot-version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 规则模块 -->
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<version>${amos.version}</version>
</dependency>
<!-- 解析word -->
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>3.3.6</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-ImportXHTML</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-export-fo</artifactId>
<version>3.3.6</version>
</dependency>
<!-- 解析html -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.2</version>
</dependency>
<!-- 解析pdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>${itext.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>${itext.version}</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>html2pdf</artifactId>
<version>2.0.1</version>
</dependency>
<!-- 解析excel -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
package com.yeejoin.amos.knowledgebase.controller; package com.yeejoin.amos.knowledgebase.controller;
import com.alibaba.fastjson.JSON; import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.knowledgebase.face.service.DocContentService; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.knowledgebase.face.service.DocLibraryService; import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.knowledgebase.face.service.ESDocService;
import com.yeejoin.amos.knowledgebase.face.util.excel.ExcelImportConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -20,9 +23,15 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -20,9 +23,15 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import com.alibaba.fastjson.JSON;
import javax.servlet.http.HttpServletResponse; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Map; import com.yeejoin.amos.knowledgebase.face.service.DocLibraryService;
import com.yeejoin.amos.knowledgebase.face.service.ESDocService;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
import com.yeejoin.amos.knowledgebase.face.util.excel.ExcelImportConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* <p> * <p>
...@@ -64,7 +73,7 @@ public class DocLibraryResource { ...@@ -64,7 +73,7 @@ public class DocLibraryResource {
@RequestParam(value = "createTimeLeft", required = false) String createTimeLeft, @RequestParam(value = "createTimeLeft", required = false) String createTimeLeft,
@RequestParam(value = "createTimeRight", required = false) String createTimeRight) { @RequestParam(value = "createTimeRight", required = false) String createTimeRight) {
Map requestMap = request.getParameterMap(); Map requestMap = request.getParameterMap();
Page page = docLibraryService.queryDocList(offset, end, directoryId, docTitle, null, DocContentService.DOC_STATUS_PUBLISHED, Page page = docLibraryService.queryDocList(offset, end, directoryId, docTitle, null, Constants.DOC_STATUS_PUBLISHED,
requestMap, createTimeLeft, createTimeRight, Boolean.parseBoolean(filterByCollection), false); requestMap, createTimeLeft, createTimeRight, Boolean.parseBoolean(filterByCollection), false);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
......
package com.yeejoin.amos.knowledgebase.controller; package com.yeejoin.amos.knowledgebase.controller;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel;
import com.yeejoin.amos.knowledgebase.face.service.TagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RequestBody;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.StringUtil; import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -19,6 +18,13 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -19,6 +18,13 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel;
import com.yeejoin.amos.knowledgebase.face.service.TagService;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* <p> * <p>
* 标签库 前端控制器 * 标签库 前端控制器
...@@ -101,7 +107,7 @@ public class TagResource { ...@@ -101,7 +107,7 @@ public class TagResource {
@ApiOperation(value = "查询TOP15") @ApiOperation(value = "查询TOP15")
@RequestMapping(value = "/list/top", method = RequestMethod.GET) @RequestMapping(value = "/list/top", method = RequestMethod.GET)
public ResponseModel selectForList(@RequestParam(value = "quoteType", required = false) String quoteType) { public ResponseModel selectForList(@RequestParam(value = "quoteType", required = false) String quoteType) {
boolean isAll = ValidationUtil.equalsIgnoreCase(quoteType, TagService.APPKEY_ALL); boolean isAll = ValidationUtil.equalsIgnoreCase(quoteType, Constants.APPKEY_ALL);
return ResponseHelper.buildResponse(tagService.queryTopList(isAll)); return ResponseHelper.buildResponse(tagService.queryTopList(isAll));
} }
...@@ -117,14 +123,14 @@ public class TagResource { ...@@ -117,14 +123,14 @@ public class TagResource {
@ApiOperation(value = "启用标签") @ApiOperation(value = "启用标签")
@RequestMapping(value = "status/activate/{ids}", method = RequestMethod.PUT) @RequestMapping(value = "status/activate/{ids}", method = RequestMethod.PUT)
public ResponseModel batchActivate(@PathVariable(value = "ids") String ids) { public ResponseModel batchActivate(@PathVariable(value = "ids") String ids) {
return ResponseHelper.buildResponse(tagService.updateTagStatus(StringUtil.String2LongList(ids), TagService.TAG_STATUS_ACTIVATE)); return ResponseHelper.buildResponse(tagService.updateTagStatus(StringUtil.String2LongList(ids), Constants.TAG_STATUS_ACTIVATE));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "停用标签") @ApiOperation(value = "停用标签")
@RequestMapping(value = "status/deactivate/{ids}", method = RequestMethod.PUT) @RequestMapping(value = "status/deactivate/{ids}", method = RequestMethod.PUT)
public ResponseModel batchDeactivate(@PathVariable(value = "ids") String ids) { public ResponseModel batchDeactivate(@PathVariable(value = "ids") String ids) {
return ResponseHelper.buildResponse(tagService.updateTagStatus(StringUtil.String2LongList(ids), TagService.TAG_STATUS_DEACTIVATE)); return ResponseHelper.buildResponse(tagService.updateTagStatus(StringUtil.String2LongList(ids), Constants.TAG_STATUS_DEACTIVATE));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
package com.yeejoin.amos.knowledgebase.face.util; package com.yeejoin.amos.knowledgebase.face.feign;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import sun.util.resources.cldr.vai.CalendarData_vai_Latn_LR;
import java.util.*;
/** /**
* @author 杨博超 * @author 杨博超
......
package com.yeejoin.amos.knowledgebase.face.util; package com.yeejoin.amos.knowledgebase.face.feign;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import com.yeejoin.amos.component.feign.utils.FeignUtil;
......
package com.yeejoin.amos.knowledgebase.face.service; package com.yeejoin.amos.knowledgebase.face.service;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocAnnotateModel; import java.util.Date;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DocAnnotateMapper; import java.util.List;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocAnnotate; import java.util.Map;
import com.yeejoin.amos.knowledgebase.face.util.RemoteData; import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -14,11 +16,10 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -14,11 +16,10 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Date; import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import java.util.List; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocAnnotateModel;
import java.util.Map; import com.yeejoin.amos.knowledgebase.face.orm.dao.DocAnnotateMapper;
import java.util.Set; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocAnnotate;
import java.util.stream.Collectors;
/** /**
......
package com.yeejoin.amos.knowledgebase.face.service; package com.yeejoin.amos.knowledgebase.face.service;
import com.alibaba.fastjson.JSON; import java.util.ArrayList;
import com.alibaba.fastjson.JSONObject; import java.util.Collection;
import com.yeejoin.amos.component.rule.action.Topic; import java.util.Iterator;
import com.yeejoin.amos.component.rule.config.ClazzUtils; import java.util.List;
import com.yeejoin.amos.component.rule.config.RuleConfig; import java.util.concurrent.atomic.AtomicBoolean;
import com.yeejoin.amos.component.rule.model.ConstantCategoryModel; import java.util.concurrent.atomic.AtomicReference;
import com.yeejoin.amos.component.rule.model.ConstantModel;
import com.yeejoin.amos.component.rule.model.DefinitionModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.util.BaseUtil;
import com.yeejoin.amos.knowledgebase.face.util.ConfigLoader;
import com.yeejoin.amos.knowledgebase.face.util.QuoteCountFlushTiming;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -31,12 +24,21 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -31,12 +24,21 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.DataNotFound; import org.typroject.tyboot.core.restful.exception.instance.DataNotFound;
import org.typroject.tyboot.core.restful.exception.instance.RequestForbidden; import org.typroject.tyboot.core.restful.exception.instance.RequestForbidden;
import java.util.ArrayList; import com.alibaba.fastjson.JSON;
import java.util.Collection; import com.alibaba.fastjson.JSONObject;
import java.util.Iterator; import com.yeejoin.amos.component.rule.action.Topic;
import java.util.List; import com.yeejoin.amos.component.rule.config.ClazzUtils;
import java.util.concurrent.atomic.AtomicBoolean; import com.yeejoin.amos.component.rule.config.RuleConfig;
import java.util.concurrent.atomic.AtomicReference; import com.yeejoin.amos.component.rule.model.ConstantCategoryModel;
import com.yeejoin.amos.component.rule.model.ConstantModel;
import com.yeejoin.amos.component.rule.model.DefinitionModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.util.BaseUtil;
import com.yeejoin.amos.knowledgebase.face.util.ConfigLoader;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
import com.yeejoin.amos.knowledgebase.face.util.QuoteCountFlushTiming;
/** /**
...@@ -50,26 +52,6 @@ import java.util.concurrent.atomic.AtomicReference; ...@@ -50,26 +52,6 @@ import java.util.concurrent.atomic.AtomicReference;
@Component @Component
public class DocAuditService { public class DocAuditService {
/**
* 审核状态--待提交
*/
public static final String DOC_AUDIT_STATUS_SAVED = "SAVED";
/**
* 审核状态--待审核
*/
public static final String DOC_AUDIT_STATUS_SUBMITTED = "SUBMITTED";
/**
* 审核状态--通过
*/
public static final String DOC_AUDIT_STATUS_PASSED = "PASSED";
/**
* 审核状态--驳回
*/
public static final String DOC_AUDIT_STATUS_REJECTED = "REJECTED";
private static final String TAG_INSTANCE_LABEL = "label";
private static String DELETE_SYNC_PLAN_TOPIC = "DELETE_SYNC_PLAN_DOC";
@Autowired @Autowired
private DocContentService service; private DocContentService service;
...@@ -103,9 +85,9 @@ public class DocAuditService { ...@@ -103,9 +85,9 @@ public class DocAuditService {
} }
//更新状态 //更新状态
for (KnowledgeDocContentModel oldDoc : resList) { for (KnowledgeDocContentModel oldDoc : resList) {
if (ValidationUtil.equals(oldDoc.getDocStatus(), DocContentService.DOC_STATUS_UNPUBLISHED)) { if (ValidationUtil.equals(oldDoc.getDocStatus(), Constants.DOC_STATUS_UNPUBLISHED)) {
oldDoc.setDocStatus(DocContentService.DOC_STATUS_PUBLISHED); oldDoc.setDocStatus(Constants.DOC_STATUS_PUBLISHED);
oldDoc.setAuditStatus(DOC_AUDIT_STATUS_PASSED); oldDoc.setAuditStatus(Constants.DOC_AUDIT_STATUS_PASSED);
oldDoc.setAuditorUserId(RequestContext.getExeUserId()); oldDoc.setAuditorUserId(RequestContext.getExeUserId());
service.updateWithModel(oldDoc); service.updateWithModel(oldDoc);
} else { } else {
...@@ -136,13 +118,13 @@ public class DocAuditService { ...@@ -136,13 +118,13 @@ public class DocAuditService {
throw new DataNotFound("数据不存在"); throw new DataNotFound("数据不存在");
} }
for (KnowledgeDocContentModel oldDoc : resList) { for (KnowledgeDocContentModel oldDoc : resList) {
if (ValidationUtil.equals(oldDoc.getDocStatus(), DocContentService.DOC_STATUS_PUBLISHED)) { if (ValidationUtil.equals(oldDoc.getDocStatus(), Constants.DOC_STATUS_PUBLISHED)) {
//判断文档是否被引用 //判断文档是否被引用
if (service.getReference(oldDoc.getSequenceNbr()) > 0) { if (service.getReference(oldDoc.getSequenceNbr()) > 0) {
throw new RequestForbidden("含被引用文档,不能取消发布"); throw new RequestForbidden("含被引用文档,不能取消发布");
} }
oldDoc.setDocStatus(DocContentService.DOC_STATUS_UNPUBLISHED); oldDoc.setDocStatus(Constants.DOC_STATUS_UNPUBLISHED);
oldDoc.setAuditStatus(DOC_AUDIT_STATUS_SAVED); oldDoc.setAuditStatus(Constants.DOC_AUDIT_STATUS_SAVED);
oldDoc.setAuditorUserId(RequestContext.getExeUserId()); oldDoc.setAuditorUserId(RequestContext.getExeUserId());
service.updateWithModel(oldDoc); service.updateWithModel(oldDoc);
} else { } else {
...@@ -173,9 +155,9 @@ public class DocAuditService { ...@@ -173,9 +155,9 @@ public class DocAuditService {
throw new DataNotFound("数据不存在"); throw new DataNotFound("数据不存在");
} }
for (KnowledgeDocContentModel oldDoc : resList) { for (KnowledgeDocContentModel oldDoc : resList) {
if (ValidationUtil.equals(oldDoc.getAuditStatus(), DOC_AUDIT_STATUS_SAVED)) { if (ValidationUtil.equals(oldDoc.getAuditStatus(), Constants.DOC_AUDIT_STATUS_SAVED)) {
//更新审核状态 //更新审核状态
oldDoc.setAuditStatus(DOC_AUDIT_STATUS_SUBMITTED); oldDoc.setAuditStatus(Constants.DOC_AUDIT_STATUS_SUBMITTED);
service.updateWithModel(oldDoc); service.updateWithModel(oldDoc);
} else { } else {
throw new RequestForbidden("只允许对待提交状态的文档执行此操作"); throw new RequestForbidden("只允许对待提交状态的文档执行此操作");
...@@ -197,12 +179,12 @@ public class DocAuditService { ...@@ -197,12 +179,12 @@ public class DocAuditService {
throw new DataNotFound("数据不存在"); throw new DataNotFound("数据不存在");
} }
for (KnowledgeDocContentModel oldDoc : resList) { for (KnowledgeDocContentModel oldDoc : resList) {
if (ValidationUtil.equals(oldDoc.getAuditStatus(), DOC_AUDIT_STATUS_SUBMITTED)) { if (ValidationUtil.equals(oldDoc.getAuditStatus(), Constants.DOC_AUDIT_STATUS_SUBMITTED)) {
//更新审核状态 //更新审核状态
oldDoc.setAuditStatus(DOC_AUDIT_STATUS_PASSED); oldDoc.setAuditStatus(Constants.DOC_AUDIT_STATUS_PASSED);
oldDoc.setAuditorUserId(RequestContext.getExeUserId()); oldDoc.setAuditorUserId(RequestContext.getExeUserId());
//更新文档发布状态 //更新文档发布状态
oldDoc.setDocStatus(DocContentService.DOC_STATUS_PUBLISHED); oldDoc.setDocStatus(Constants.DOC_STATUS_PUBLISHED);
service.updateWithModel(oldDoc); service.updateWithModel(oldDoc);
} else { } else {
throw new RequestForbidden("只允许对待审核状态的文档执行此操作"); throw new RequestForbidden("只允许对待审核状态的文档执行此操作");
...@@ -231,12 +213,12 @@ public class DocAuditService { ...@@ -231,12 +213,12 @@ public class DocAuditService {
if (ValidationUtil.isEmpty(oldDoc)) { if (ValidationUtil.isEmpty(oldDoc)) {
throw new DataNotFound("数据不存在"); throw new DataNotFound("数据不存在");
} }
if (ValidationUtil.equals(oldDoc.getAuditStatus(), DOC_AUDIT_STATUS_SUBMITTED)) { if (ValidationUtil.equals(oldDoc.getAuditStatus(), Constants.DOC_AUDIT_STATUS_SUBMITTED)) {
//更新审核状态&文档状态 //更新审核状态&文档状态
oldDoc.setAuditStatus(DOC_AUDIT_STATUS_REJECTED); oldDoc.setAuditStatus(Constants.DOC_AUDIT_STATUS_REJECTED);
oldDoc.setRejectionComment(rejectionComment); oldDoc.setRejectionComment(rejectionComment);
oldDoc.setAuditorUserId(RequestContext.getExeUserId()); oldDoc.setAuditorUserId(RequestContext.getExeUserId());
oldDoc.setDocStatus(DocContentService.DOC_STATUS_UNPUBLISHED); oldDoc.setDocStatus(Constants.DOC_STATUS_UNPUBLISHED);
return service.updateWithModel(oldDoc); return service.updateWithModel(oldDoc);
} else { } else {
throw new RequestForbidden("只允许对待审核状态的文档执行此操作"); throw new RequestForbidden("只允许对待审核状态的文档执行此操作");
...@@ -251,7 +233,7 @@ public class DocAuditService { ...@@ -251,7 +233,7 @@ public class DocAuditService {
public void pushDeletedDocs2DigitalPlanByMQ(List<KnowledgeDocContentModel> resList) { public void pushDeletedDocs2DigitalPlanByMQ(List<KnowledgeDocContentModel> resList) {
List<Long> ids = BaseUtil.getModelIds(resList); List<Long> ids = BaseUtil.getModelIds(resList);
try { try {
emqKeeper.getMqttClient().publish(DELETE_SYNC_PLAN_TOPIC, ClazzUtils.serializableObject(ids), RuleConfig.DEFAULT_QOS, false); emqKeeper.getMqttClient().publish(Constants.DELETE_SYNC_PLAN_TOPIC, ClazzUtils.serializableObject(ids), RuleConfig.DEFAULT_QOS, false);
logger.info("文档" + ids.toString() + "取消发布,已推送消息至数字预案服务"); logger.info("文档" + ids.toString() + "取消发布,已推送消息至数字预案服务");
} catch (Exception e) { } catch (Exception e) {
logger.fatal("文档" + ids.toString() + "取消发布未能成功推送至数字预案服务", e); logger.fatal("文档" + ids.toString() + "取消发布未能成功推送至数字预案服务", e);
...@@ -364,13 +346,13 @@ public class DocAuditService { ...@@ -364,13 +346,13 @@ public class DocAuditService {
AtomicReference<String> unit = new AtomicReference<>(""); AtomicReference<String> unit = new AtomicReference<>("");
if (!ObjectUtils.isEmpty(values)) { if (!ObjectUtils.isEmpty(values)) {
values.forEach(value -> { values.forEach(value -> {
if (TagValueService.VALUE_TAG_FIELD_RANGE_MAX.equals(value.getFieldName())) { if (Constants.VALUE_TAG_FIELD_RANGE_MAX.equals(value.getFieldName())) {
resRight.set(value.getTagValue()); resRight.set(value.getTagValue());
} else { } else {
resLeft.set(value.getTagValue()); resLeft.set(value.getTagValue());
} }
if (TagValueService.VALUE_TAG_FIELD_RANGE_MAX.equals(value.getFieldName()) if (Constants.VALUE_TAG_FIELD_RANGE_MAX.equals(value.getFieldName())
|| TagValueService.VALUE_TAG_FIELD_RANGE_MIN.equals(value.getFieldName())) { || Constants.VALUE_TAG_FIELD_RANGE_MIN.equals(value.getFieldName())) {
isRange.set(true); isRange.set(true);
} }
unit.set(ValidationUtil.isEmpty(value.getUnit()) || "null".equals(value.getUnit()) ? "" : value.getUnit()); unit.set(ValidationUtil.isEmpty(value.getUnit()) || "null".equals(value.getUnit()) ? "" : value.getUnit());
...@@ -393,7 +375,7 @@ public class DocAuditService { ...@@ -393,7 +375,7 @@ public class DocAuditService {
if (!ValidationUtil.isEmpty(frontEndConfig)) { if (!ValidationUtil.isEmpty(frontEndConfig)) {
try { try {
JSONObject configObject = JSON.parseObject(frontEndConfig); JSONObject configObject = JSON.parseObject(frontEndConfig);
return (String) configObject.get(TAG_INSTANCE_LABEL); return (String) configObject.get(Constants.TAG_INSTANCE_LABEL);
} catch (Exception e) { } catch (Exception e) {
} }
} }
......
package com.yeejoin.amos.knowledgebase.face.service; package com.yeejoin.amos.knowledgebase.face.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import java.util.ArrayList;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.util.Arrays;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocCategoryModel; import java.util.Collection;
import com.yeejoin.amos.knowledgebase.face.model.MultipleNodeModel; import java.util.Collections;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DocCategoryMapper; import java.util.List;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocCategory; import java.util.Map;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTag; import java.util.SortedSet;
import com.yeejoin.amos.knowledgebase.face.util.BaseUtil; import java.util.TreeSet;
import com.yeejoin.amos.knowledgebase.face.util.TreeUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -24,7 +24,16 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -24,7 +24,16 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.exception.instance.RequestForbidden; import org.typroject.tyboot.core.restful.exception.instance.RequestForbidden;
import java.util.*; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocCategoryModel;
import com.yeejoin.amos.knowledgebase.face.model.MultipleNodeModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DocCategoryMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocCategory;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTag;
import com.yeejoin.amos.knowledgebase.face.util.BaseUtil;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
import com.yeejoin.amos.knowledgebase.face.util.TreeUtil;
/** /**
* <p> * <p>
...@@ -203,7 +212,7 @@ public class DocCategoryService extends BaseService<KnowledgeDocCategoryModel, K ...@@ -203,7 +212,7 @@ public class DocCategoryService extends BaseService<KnowledgeDocCategoryModel, K
List<KnowledgeDocCategoryModel> allChildren = TreeUtil.getAllChildren(categoryTree); List<KnowledgeDocCategoryModel> allChildren = TreeUtil.getAllChildren(categoryTree);
if (!allChildren.isEmpty()) { if (!allChildren.isEmpty()) {
List<Long> directoryIds = BaseUtil.getModelIds(allChildren); List<Long> directoryIds = BaseUtil.getModelIds(allChildren);
List<MultipleNodeModel> multipleNodeModels = this.baseMapper.queryDocAndCategoryTree(directoryIds, onlyPublish ? DocContentService.DOC_STATUS_PUBLISHED : null); List<MultipleNodeModel> multipleNodeModels = this.baseMapper.queryDocAndCategoryTree(directoryIds, onlyPublish ? Constants.DOC_STATUS_PUBLISHED : null);
return TreeBuilder.buildByRecursive(multipleNodeModels, null == rootCategory ? root : rootCategory.getParentId()); return TreeBuilder.buildByRecursive(multipleNodeModels, null == rootCategory ? root : rootCategory.getParentId());
} }
} }
......
package com.yeejoin.amos.knowledgebase.face.service; package com.yeejoin.amos.knowledgebase.face.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.util.Date;
import com.yeejoin.amos.knowledgebase.face.enumeration.OperateType; import java.util.List;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocCommentsModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeInteractionRecordModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DocCommentsMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocComments;
import com.yeejoin.amos.knowledgebase.face.util.RemoteData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Date; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import com.yeejoin.amos.knowledgebase.face.enumeration.OperateType;
import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocCommentsModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeInteractionRecordModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DocCommentsMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocComments;
/** /**
......
...@@ -11,13 +11,14 @@ import com.yeejoin.amos.feign.systemctl.model.FileInfoModel; ...@@ -11,13 +11,14 @@ import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional; import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional;
import com.yeejoin.amos.knowledgebase.face.enumeration.KnowledgeRoleName; import com.yeejoin.amos.knowledgebase.face.enumeration.KnowledgeRoleName;
import com.yeejoin.amos.knowledgebase.face.enumeration.OperateType; import com.yeejoin.amos.knowledgebase.face.enumeration.OperateType;
import com.yeejoin.amos.knowledgebase.face.feign.DataFillter;
import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import com.yeejoin.amos.knowledgebase.face.model.*; import com.yeejoin.amos.knowledgebase.face.model.*;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DocContentMapper; import com.yeejoin.amos.knowledgebase.face.orm.dao.DocContentMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.util.DataFillter; import com.yeejoin.amos.knowledgebase.face.util.Constants;
import com.yeejoin.amos.knowledgebase.face.util.DocSortUtil; import com.yeejoin.amos.knowledgebase.face.util.DocSortUtil;
import com.yeejoin.amos.knowledgebase.face.util.QuoteCountFlushTiming; import com.yeejoin.amos.knowledgebase.face.util.QuoteCountFlushTiming;
import com.yeejoin.amos.knowledgebase.face.util.RemoteData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -46,12 +47,11 @@ import java.util.*; ...@@ -46,12 +47,11 @@ import java.util.*;
@Component @Component
public class DocContentService extends BaseService<KnowledgeDocContentModel, KnowledgeDocContent, DocContentMapper> implements DataFillter { public class DocContentService extends BaseService<KnowledgeDocContentModel, KnowledgeDocContent, DocContentMapper> implements DataFillter {
public static final String DOC_STATUS_UNPUBLISHED = "UNPUBLISHED";//文档发布状态--未发布
public static final String DOC_STATUS_PUBLISHED = "PUBLISHED"; //文档发布状态--已发布
private final String orderBy = new StringBuilder().append("ORDER BY FIELD(audit_status, '").append(DocAuditService.DOC_AUDIT_STATUS_SAVED).append("', '")
.append(DocAuditService.DOC_AUDIT_STATUS_SUBMITTED).append("', '").append(DocAuditService.DOC_AUDIT_STATUS_REJECTED).append("', '") private final String orderBy = new StringBuilder().append("ORDER BY FIELD(audit_status, '").append(Constants.DOC_AUDIT_STATUS_SAVED).append("', '")
.append(DocAuditService.DOC_AUDIT_STATUS_PASSED).append("') ASC, create_time DESC").toString(); .append(Constants.DOC_AUDIT_STATUS_SUBMITTED).append("', '").append(Constants.DOC_AUDIT_STATUS_REJECTED).append("', '")
.append(Constants.DOC_AUDIT_STATUS_PASSED).append("') ASC, create_time DESC").toString();
@Autowired @Autowired
private DynamicsValueService dynamicsValueService; private DynamicsValueService dynamicsValueService;
...@@ -127,8 +127,8 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -127,8 +127,8 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
docContentModel.setAgencyCode(RequestContext.getAgencyCode()); docContentModel.setAgencyCode(RequestContext.getAgencyCode());
docContentModel.setUserId(RequestContext.getExeUserId()); docContentModel.setUserId(RequestContext.getExeUserId());
docContentModel.setCreateTime(new Date()); docContentModel.setCreateTime(new Date());
docContentModel.setDocStatus(DOC_STATUS_UNPUBLISHED); docContentModel.setDocStatus(Constants.DOC_STATUS_UNPUBLISHED);
docContentModel.setAuditStatus(DocAuditService.DOC_AUDIT_STATUS_SAVED); docContentModel.setAuditStatus(Constants.DOC_AUDIT_STATUS_SAVED);
docContentModel.setSequenceNbr(sequenceNbr); docContentModel.setSequenceNbr(sequenceNbr);
String inputerOrg = RemoteData.getOrgWithCurUserAndRole(KnowledgeRoleName.INPUTER.getRoleName()); String inputerOrg = RemoteData.getOrgWithCurUserAndRole(KnowledgeRoleName.INPUTER.getRoleName());
if (ValidationUtil.isEmpty(inputerOrg)) { if (ValidationUtil.isEmpty(inputerOrg)) {
...@@ -145,8 +145,8 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -145,8 +145,8 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
dynamicsValueService.saveValueList(docContentModel.getDocBaseInfo(), sequenceNbr, DynamicsFunctional.DOC_BASEINFO, RequestContext.getAppKey()); dynamicsValueService.saveValueList(docContentModel.getDocBaseInfo(), sequenceNbr, DynamicsFunctional.DOC_BASEINFO, RequestContext.getAppKey());
// 保存标签实例 // 保存标签实例
List<KnowledgeTagInstanceModel> docTags = tagInstanceService.saveInstance(docContentModel.getDocTags(), sequenceNbr, TagInstanceService.MARKING_TYPE_DOC); List<KnowledgeTagInstanceModel> docTags = tagInstanceService.saveInstance(docContentModel.getDocTags(), sequenceNbr, Constants.MARKING_TYPE_DOC);
tagInstanceService.saveInstance(docContentModel.getDocContentTags(), sequenceNbr, TagInstanceService.MARKING_TYPE_CONTENT); tagInstanceService.saveInstance(docContentModel.getDocContentTags(), sequenceNbr, Constants.MARKING_TYPE_CONTENT);
QuoteCountFlushTiming.needFlushTag(); QuoteCountFlushTiming.needFlushTag();
//保存附件信息 //保存附件信息
saveAttachments(docContentModel.getAttachments(), sequenceNbr); saveAttachments(docContentModel.getAttachments(), sequenceNbr);
...@@ -234,14 +234,14 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -234,14 +234,14 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
throw new DataNotFound("找不到指定的文档."); throw new DataNotFound("找不到指定的文档.");
} }
//判断文档的可编辑状态。 //判断文档的可编辑状态。
if (DOC_STATUS_PUBLISHED.equals(oldModel.getDocStatus()) if (Constants.DOC_STATUS_PUBLISHED.equals(oldModel.getDocStatus())
|| DocAuditService.DOC_AUDIT_STATUS_PASSED.equals(oldModel.getAuditStatus()) || Constants.DOC_AUDIT_STATUS_PASSED.equals(oldModel.getAuditStatus())
|| DocAuditService.DOC_AUDIT_STATUS_SUBMITTED.equals(oldModel.getAuditStatus())) { || Constants.DOC_AUDIT_STATUS_SUBMITTED.equals(oldModel.getAuditStatus())) {
throw new BadRequest("当前文档状态不可编辑."); throw new BadRequest("当前文档状态不可编辑.");
} }
//如果文档为驳回状态,更改为待提交 //如果文档为驳回状态,更改为待提交
if (ValidationUtil.equals(DocAuditService.DOC_AUDIT_STATUS_REJECTED, oldModel.getAuditStatus())) { if (ValidationUtil.equals(Constants.DOC_AUDIT_STATUS_REJECTED, oldModel.getAuditStatus())) {
oldModel.setAuditStatus(DocAuditService.DOC_AUDIT_STATUS_SAVED); oldModel.setAuditStatus(Constants.DOC_AUDIT_STATUS_SAVED);
} }
if (!ValidationUtil.isEmpty(docContentModel.getHaveAttachment())) { if (!ValidationUtil.isEmpty(docContentModel.getHaveAttachment())) {
oldModel.setHaveAttachment(docContentModel.getHaveAttachment()); oldModel.setHaveAttachment(docContentModel.getHaveAttachment());
...@@ -254,8 +254,8 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -254,8 +254,8 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
// 保存标签实例 // 保存标签实例
tagInstanceService.deleteByTargetSeq(oldModel.getSequenceNbr());//删除已有的标签 tagInstanceService.deleteByTargetSeq(oldModel.getSequenceNbr());//删除已有的标签
List<KnowledgeTagInstanceModel> docTags = tagInstanceService.saveInstance(docContentModel.getDocTags(), oldModel.getSequenceNbr(), TagInstanceService.MARKING_TYPE_DOC); List<KnowledgeTagInstanceModel> docTags = tagInstanceService.saveInstance(docContentModel.getDocTags(), oldModel.getSequenceNbr(), Constants.MARKING_TYPE_DOC);
tagInstanceService.saveInstance(docContentModel.getDocContentTags(), oldModel.getSequenceNbr(), TagInstanceService.MARKING_TYPE_CONTENT); tagInstanceService.saveInstance(docContentModel.getDocContentTags(), oldModel.getSequenceNbr(), Constants.MARKING_TYPE_CONTENT);
// 重新保存附件信息 // 重新保存附件信息
deleteAttachments(oldModel.getSequenceNbr());//删除已有的文件信息 deleteAttachments(oldModel.getSequenceNbr());//删除已有的文件信息
...@@ -278,9 +278,9 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -278,9 +278,9 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
if (ValidationUtil.isEmpty(docContentModel)) { if (ValidationUtil.isEmpty(docContentModel)) {
throw new BadRequest("指定的文档不存在."); throw new BadRequest("指定的文档不存在.");
} }
if (DOC_STATUS_PUBLISHED.equals(docContentModel.getDocStatus()) if (Constants.DOC_STATUS_PUBLISHED.equals(docContentModel.getDocStatus())
|| DocAuditService.DOC_AUDIT_STATUS_PASSED.equals(docContentModel.getAuditStatus()) || Constants.DOC_AUDIT_STATUS_PASSED.equals(docContentModel.getAuditStatus())
|| DocAuditService.DOC_AUDIT_STATUS_SUBMITTED.equals(docContentModel.getAuditStatus())) { || Constants.DOC_AUDIT_STATUS_SUBMITTED.equals(docContentModel.getAuditStatus())) {
throw new BadRequest("当前文档状态不可删除."); throw new BadRequest("当前文档状态不可删除.");
} }
this.dynamicsValueService.deleteByInstanceId(docContentModel.getSequenceNbr()); this.dynamicsValueService.deleteByInstanceId(docContentModel.getSequenceNbr());
...@@ -324,7 +324,7 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -324,7 +324,7 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
}); });
tagInstanceModelList.forEach(instanceModel -> { tagInstanceModelList.forEach(instanceModel -> {
switch (instanceModel.getMarkingType()) { switch (instanceModel.getMarkingType()) {
case TagInstanceService.MARKING_TYPE_DOC: case Constants.MARKING_TYPE_DOC:
docTags.add(instanceModel); docTags.add(instanceModel);
break; break;
default: default:
...@@ -534,8 +534,8 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -534,8 +534,8 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
case AUDITOR: case AUDITOR:
case INPUTER: case INPUTER:
case VIEWER: case VIEWER:
auditStatusSet.add(DocAuditService.DOC_AUDIT_STATUS_PASSED); auditStatusSet.add(Constants.DOC_AUDIT_STATUS_PASSED);
docStatusSet.add(DocContentService.DOC_STATUS_PUBLISHED); docStatusSet.add(Constants.DOC_STATUS_PUBLISHED);
dataPrivilegemap.put(docStatus, docStatusSet.toArray(new String[docStatusSet.size()])); dataPrivilegemap.put(docStatus, docStatusSet.toArray(new String[docStatusSet.size()]));
dataPrivilegemap.put(auditStatus, auditStatusSet.toArray(new String[auditStatusSet.size()])); dataPrivilegemap.put(auditStatus, auditStatusSet.toArray(new String[auditStatusSet.size()]));
break; break;
...@@ -615,7 +615,7 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno ...@@ -615,7 +615,7 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
} }
} }
if (!ValidationUtil.isEmpty(auditorOrg)) { if (!ValidationUtil.isEmpty(auditorOrg)) {
String[] auditStatus = {DocAuditService.DOC_AUDIT_STATUS_PASSED, DocAuditService.DOC_AUDIT_STATUS_SUBMITTED}; String[] auditStatus = {Constants.DOC_AUDIT_STATUS_PASSED, Constants.DOC_AUDIT_STATUS_SUBMITTED};
w.likeRight("org_code", auditorOrg).in("audit_status", Arrays.asList(auditStatus)); w.likeRight("org_code", auditorOrg).in("audit_status", Arrays.asList(auditStatus));
} }
}); });
......
...@@ -10,6 +10,7 @@ import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional; ...@@ -10,6 +10,7 @@ import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional;
import com.yeejoin.amos.knowledgebase.face.enumeration.KnowledgeRoleName; import com.yeejoin.amos.knowledgebase.face.enumeration.KnowledgeRoleName;
import com.yeejoin.amos.knowledgebase.face.enumeration.OperateType; import com.yeejoin.amos.knowledgebase.face.enumeration.OperateType;
import com.yeejoin.amos.knowledgebase.face.enumeration.OptionDataType; import com.yeejoin.amos.knowledgebase.face.enumeration.OptionDataType;
import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import com.yeejoin.amos.knowledgebase.face.model.*; import com.yeejoin.amos.knowledgebase.face.model.*;
import com.yeejoin.amos.knowledgebase.face.orm.entity.ESDocEntity; import com.yeejoin.amos.knowledgebase.face.orm.entity.ESDocEntity;
import com.yeejoin.amos.knowledgebase.face.orm.entity.ESTagEntity; import com.yeejoin.amos.knowledgebase.face.orm.entity.ESTagEntity;
...@@ -95,8 +96,8 @@ public class DocLibraryService { ...@@ -95,8 +96,8 @@ public class DocLibraryService {
static { static {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list.add(DocAuditService.DOC_AUDIT_STATUS_SUBMITTED); list.add(Constants.DOC_AUDIT_STATUS_SUBMITTED);
list.add(DocAuditService.DOC_AUDIT_STATUS_PASSED); list.add(Constants.DOC_AUDIT_STATUS_PASSED);
auditStatusList = Collections.unmodifiableList(list); auditStatusList = Collections.unmodifiableList(list);
} }
...@@ -288,7 +289,7 @@ public class DocLibraryService { ...@@ -288,7 +289,7 @@ public class DocLibraryService {
public Page searchAdvanced(Page page, Map<String, Object> queryParams) { public Page searchAdvanced(Page page, Map<String, Object> queryParams) {
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>(); QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>();
wrapper.select("SEQUENCE_NBR") wrapper.select("SEQUENCE_NBR")
.eq("DOC_STATUS", DocContentService.DOC_STATUS_PUBLISHED) .eq("DOC_STATUS", Constants.DOC_STATUS_PUBLISHED)
.orderByAsc("SORT_STR"); .orderByAsc("SORT_STR");
BaseSqlCondition sqlCondition = BaseSqlCondition.getInstance(queryParams); BaseSqlCondition sqlCondition = BaseSqlCondition.getInstance(queryParams);
...@@ -451,7 +452,7 @@ public class DocLibraryService { ...@@ -451,7 +452,7 @@ public class DocLibraryService {
List<KnowledgeTag> tagList = tagService.getBaseMapper().queryTagByNameInPublishedDoc(queryStr); List<KnowledgeTag> tagList = tagService.getBaseMapper().queryTagByNameInPublishedDoc(queryStr);
resList.addAll(Bean.listToMap(tagList, "tagName", KnowledgeTag.class).keySet()); resList.addAll(Bean.listToMap(tagList, "tagName", KnowledgeTag.class).keySet());
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<KnowledgeDocContent>() QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<KnowledgeDocContent>()
.select("DOC_TITLE").eq("DOC_STATUS", DocContentService.DOC_STATUS_PUBLISHED).like("DOC_TITLE", queryStr); .select("DOC_TITLE").eq("DOC_STATUS", Constants.DOC_STATUS_PUBLISHED).like("DOC_TITLE", queryStr);
List<KnowledgeDocContent> docContentList = docContentService.list(wrapper); List<KnowledgeDocContent> docContentList = docContentService.list(wrapper);
docContentList.forEach(doc -> { docContentList.forEach(doc -> {
if (!resList.contains(doc.getDocTitle())) { if (!resList.contains(doc.getDocTitle())) {
...@@ -469,7 +470,7 @@ public class DocLibraryService { ...@@ -469,7 +470,7 @@ public class DocLibraryService {
public Map<String, Integer> count(int days) { public Map<String, Integer> count(int days) {
Map<String, Integer> res = new HashMap<>(); Map<String, Integer> res = new HashMap<>();
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>(); QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>();
wrapper.eq("doc_status", DocContentService.DOC_STATUS_PUBLISHED); wrapper.eq("doc_status", Constants.DOC_STATUS_PUBLISHED);
res.put("totalAll", docContentService.count(wrapper)); res.put("totalAll", docContentService.count(wrapper));
Date rightRange = new Date(); Date rightRange = new Date();
Date leftRange = getDateBeforeDays(rightRange, days - 1); Date leftRange = getDateBeforeDays(rightRange, days - 1);
...@@ -485,7 +486,7 @@ public class DocLibraryService { ...@@ -485,7 +486,7 @@ public class DocLibraryService {
* @return * @return
*/ */
public List queryNewDocs(int top) { public List queryNewDocs(int top) {
List<KnowledgeDocContentModel> list = docContentService.queryNewDocsWithStatus(top, DocContentService.DOC_STATUS_PUBLISHED); List<KnowledgeDocContentModel> list = docContentService.queryNewDocsWithStatus(top, Constants.DOC_STATUS_PUBLISHED);
fillDirectoryName(list); fillDirectoryName(list);
return fillDynamics(list, false); return fillDynamics(list, false);
} }
...@@ -686,7 +687,7 @@ public class DocLibraryService { ...@@ -686,7 +687,7 @@ public class DocLibraryService {
tagInstanceModelList.forEach(tagInstanceModel -> { tagInstanceModelList.forEach(tagInstanceModel -> {
KnowledgeDocContentModel docContentModel = docContentModelMap.get(tagInstanceModel.getTargetSeq()); KnowledgeDocContentModel docContentModel = docContentModelMap.get(tagInstanceModel.getTargetSeq());
if (null != docContentModel) { if (null != docContentModel) {
boolean isDoc = TagInstanceService.MARKING_TYPE_DOC.equals(tagInstanceModel.getMarkingType()); boolean isDoc = Constants.MARKING_TYPE_DOC.equals(tagInstanceModel.getMarkingType());
List<KnowledgeTagInstanceModel> tagList = isDoc ? docContentModel.getDocTags() : docContentModel.getDocContentTags(); List<KnowledgeTagInstanceModel> tagList = isDoc ? docContentModel.getDocTags() : docContentModel.getDocContentTags();
if (null == tagList) { if (null == tagList) {
tagList = new ArrayList<>(); tagList = new ArrayList<>();
...@@ -806,7 +807,7 @@ public class DocLibraryService { ...@@ -806,7 +807,7 @@ public class DocLibraryService {
records.forEach(doc -> { records.forEach(doc -> {
if (ValidationUtil.isEmpty(doc.getTextContent()) && ValidationUtil.isEmpty(doc.getSortStr())) { if (ValidationUtil.isEmpty(doc.getTextContent()) && ValidationUtil.isEmpty(doc.getSortStr())) {
doc.setTextContent(htmlContent2Text(doc.getHtmlContent())); doc.setTextContent(htmlContent2Text(doc.getHtmlContent()));
doc.setSortStr(DocSortUtil.getSortStr(tagInstanceService.queryByTargetAndType(null, doc.getSequenceNbr(), TagInstanceService.MARKING_TYPE_DOC))); doc.setSortStr(DocSortUtil.getSortStr(tagInstanceService.queryByTargetAndType(null, doc.getSequenceNbr(), Constants.MARKING_TYPE_DOC)));
} }
}); });
docContentService.updateBatchById(records); docContentService.updateBatchById(records);
...@@ -845,7 +846,7 @@ public class DocLibraryService { ...@@ -845,7 +846,7 @@ public class DocLibraryService {
public Page queryDocPage(Page page, String docTitle, String code) { public Page queryDocPage(Page page, String docTitle, String code) {
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>(); QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>();
wrapper.eq("DOC_STATUS", DocContentService.DOC_STATUS_PUBLISHED); wrapper.eq("DOC_STATUS", Constants.DOC_STATUS_PUBLISHED);
if (!ValidationUtil.isEmpty(docTitle)) { if (!ValidationUtil.isEmpty(docTitle)) {
wrapper.like("DOC_TITLE", docTitle); wrapper.like("DOC_TITLE", docTitle);
} }
...@@ -873,7 +874,7 @@ public class DocLibraryService { ...@@ -873,7 +874,7 @@ public class DocLibraryService {
} }
); );
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>(); QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>();
wrapper.eq("DOC_STATUS", DocContentService.DOC_STATUS_PUBLISHED) wrapper.eq("DOC_STATUS", Constants.DOC_STATUS_PUBLISHED)
.in("DIRECTORY_ID", directoryIdSet); .in("DIRECTORY_ID", directoryIdSet);
if (total != null) { if (total != null) {
wrapper.last("ORDER BY RAND() LIMIT "+ total); wrapper.last("ORDER BY RAND() LIMIT "+ total);
......
...@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional; import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional;
import com.yeejoin.amos.knowledgebase.face.enumeration.KnowledgeRoleName; import com.yeejoin.amos.knowledgebase.face.enumeration.KnowledgeRoleName;
import com.yeejoin.amos.knowledgebase.face.enumeration.OptionDataType; import com.yeejoin.amos.knowledgebase.face.enumeration.OptionDataType;
import com.yeejoin.amos.knowledgebase.face.feign.DataFillter;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsOptionModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsOptionModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsValueModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DynamicsValueMapper; import com.yeejoin.amos.knowledgebase.face.orm.dao.DynamicsValueMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDynamicsValue; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDynamicsValue;
import com.yeejoin.amos.knowledgebase.face.util.DataFillter; import com.yeejoin.amos.knowledgebase.face.util.Constants;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -146,8 +148,8 @@ public class DynamicsValueService extends BaseService<KnowledgeDynamicsValueMode ...@@ -146,8 +148,8 @@ public class DynamicsValueService extends BaseService<KnowledgeDynamicsValueMode
} }
switch (knowledgeRoleName) { switch (knowledgeRoleName) {
case AUDITOR: case AUDITOR:
auditStatusSet.add(DocAuditService.DOC_AUDIT_STATUS_PASSED); auditStatusSet.add(Constants.DOC_AUDIT_STATUS_PASSED);
auditStatusSet.add(DocAuditService.DOC_AUDIT_STATUS_SUBMITTED); auditStatusSet.add(Constants.DOC_AUDIT_STATUS_SUBMITTED);
dataPrivilegemap.put(DataFillter.orgCode, orgCode); dataPrivilegemap.put(DataFillter.orgCode, orgCode);
dataPrivilegemap.put(auditStatus, auditStatusSet.toArray(new String[auditStatusSet.size()])); dataPrivilegemap.put(auditStatus, auditStatusSet.toArray(new String[auditStatusSet.size()]));
break; break;
...@@ -158,8 +160,8 @@ public class DynamicsValueService extends BaseService<KnowledgeDynamicsValueMode ...@@ -158,8 +160,8 @@ public class DynamicsValueService extends BaseService<KnowledgeDynamicsValueMode
dataPrivilegemap.put(DataFillter.noData, true); dataPrivilegemap.put(DataFillter.noData, true);
break; break;
case VIEWER: case VIEWER:
auditStatusSet.add(DocAuditService.DOC_AUDIT_STATUS_PASSED); auditStatusSet.add(Constants.DOC_AUDIT_STATUS_PASSED);
docStatusSet.add(DocContentService.DOC_STATUS_PUBLISHED); docStatusSet.add(Constants.DOC_STATUS_PUBLISHED);
dataPrivilegemap.put(docStatus, docStatusSet.toArray(new String[docStatusSet.size()])); dataPrivilegemap.put(docStatus, docStatusSet.toArray(new String[docStatusSet.size()]));
dataPrivilegemap.put(auditStatus, auditStatusSet.toArray(new String[auditStatusSet.size()])); dataPrivilegemap.put(auditStatus, auditStatusSet.toArray(new String[auditStatusSet.size()]));
break; break;
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.knowledgebase.face.service; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.knowledgebase.face.service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsValueModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsValueModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
...@@ -11,7 +12,8 @@ import com.yeejoin.amos.knowledgebase.face.orm.dao.ESDocRepository; ...@@ -11,7 +12,8 @@ import com.yeejoin.amos.knowledgebase.face.orm.dao.ESDocRepository;
import com.yeejoin.amos.knowledgebase.face.orm.entity.ESDocEntity; import com.yeejoin.amos.knowledgebase.face.orm.entity.ESDocEntity;
import com.yeejoin.amos.knowledgebase.face.orm.entity.ESTagEntity; import com.yeejoin.amos.knowledgebase.face.orm.entity.ESTagEntity;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.util.RemoteData; import com.yeejoin.amos.knowledgebase.face.util.Constants;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder; import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
...@@ -304,7 +306,7 @@ public class ESDocService { ...@@ -304,7 +306,7 @@ public class ESDocService {
Map<String, Map<String, String>> enumCnEnMap = docLibraryService.getBaseEnumMap(); Map<String, Map<String, String>> enumCnEnMap = docLibraryService.getBaseEnumMap();
List<ESDocEntity> esDocs = new ArrayList<>(); List<ESDocEntity> esDocs = new ArrayList<>();
for (KnowledgeDocContentModel docDetail : docs) { for (KnowledgeDocContentModel docDetail : docs) {
if (ValidationUtil.equals(docDetail.getDocStatus(), DocContentService.DOC_STATUS_PUBLISHED)) { if (ValidationUtil.equals(docDetail.getDocStatus(), Constants.DOC_STATUS_PUBLISHED)) {
List<ESTagEntity> docTags = buildESTagsByInstanceList(docDetail.getDocTags()); List<ESTagEntity> docTags = buildESTagsByInstanceList(docDetail.getDocTags());
List<ESTagEntity> contentTags = buildESTagsByInstanceList(docDetail.getDocContentTags()); List<ESTagEntity> contentTags = buildESTagsByInstanceList(docDetail.getDocContentTags());
ESDocEntity esDocEntity = new ESDocEntity() ESDocEntity esDocEntity = new ESDocEntity()
...@@ -384,7 +386,7 @@ public class ESDocService { ...@@ -384,7 +386,7 @@ public class ESDocService {
private String getTagInfoStr(KnowledgeTagInstanceModel instanceModel) { private String getTagInfoStr(KnowledgeTagInstanceModel instanceModel) {
StringBuilder infoStr = new StringBuilder(); StringBuilder infoStr = new StringBuilder();
infoStr.append(instanceModel.getTagName()).append(" "); infoStr.append(instanceModel.getTagName()).append(" ");
if (TagService.TAG_TYPE_TEXT.equals(instanceModel.getTagType()) if (Constants.TAG_TYPE_TEXT.equals(instanceModel.getTagType())
|| ValidationUtil.isEmpty(instanceModel.getTagValues())) { || ValidationUtil.isEmpty(instanceModel.getTagValues())) {
return infoStr.toString().trim(); return infoStr.toString().trim();
} }
...@@ -392,7 +394,7 @@ public class ESDocService { ...@@ -392,7 +394,7 @@ public class ESDocService {
String fieldName = valueModel.getFieldName(); String fieldName = valueModel.getFieldName();
String tagValue = valueModel.getTagValue(); String tagValue = valueModel.getTagValue();
switch (fieldName) { switch (fieldName) {
case TagValueService.VALUE_TAG_FIELD_DATE_H: case Constants.VALUE_TAG_FIELD_DATE_H:
infoStr.append(tagValue).append(" "); infoStr.append(tagValue).append(" ");
try { try {
Date date = DateUtil.formatStringToDate(tagValue, null); Date date = DateUtil.formatStringToDate(tagValue, null);
...@@ -442,7 +444,7 @@ public class ESDocService { ...@@ -442,7 +444,7 @@ public class ESDocService {
esDocRepository.deleteAll(); esDocRepository.deleteAll();
//保存所有已发布文档 //保存所有已发布文档
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>(); QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>();
wrapper.eq("doc_status", DocContentService.DOC_STATUS_PUBLISHED); wrapper.eq("doc_status", Constants.DOC_STATUS_PUBLISHED);
int count = docContentService.count(wrapper); int count = docContentService.count(wrapper);
int finishNmu = 0; int finishNmu = 0;
int current = 0; int current = 0;
......
...@@ -4,11 +4,12 @@ package com.yeejoin.amos.knowledgebase.face.service; ...@@ -4,11 +4,12 @@ package com.yeejoin.amos.knowledgebase.face.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeMessageModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeMessageModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.MessageMapper; import com.yeejoin.amos.knowledgebase.face.orm.dao.MessageMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeMessage; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeMessage;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeMessagePersonal; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeMessagePersonal;
import com.yeejoin.amos.knowledgebase.face.util.RemoteData; import com.yeejoin.amos.knowledgebase.face.util.Constants;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -35,20 +36,7 @@ import java.util.*; ...@@ -35,20 +36,7 @@ import java.util.*;
@Component @Component
public class MessageService extends BaseService<KnowledgeMessageModel, KnowledgeMessage, MessageMapper> { public class MessageService extends BaseService<KnowledgeMessageModel, KnowledgeMessage, MessageMapper> {
/**
* 消息类型-要点推送
*/
public static final String MESSAGE_TYPE_PUSH = "ESSENTIAL_PUSH";
/**
* 消息类型-战例分享
*/
public static final String MESSAGE_TYPE_SHARE = "DOC_SHARE";
/**
* 消息主题前缀
*/
public static final String TOPIC_PREFIX = "knowledge_message_";
public static final String SHARE_WAY_APP = "app";
private final String userTypeUser = "user"; private final String userTypeUser = "user";
private final String userTypeGroup = "group"; private final String userTypeGroup = "group";
...@@ -107,14 +95,14 @@ public class MessageService extends BaseService<KnowledgeMessageModel, Knowledge ...@@ -107,14 +95,14 @@ public class MessageService extends BaseService<KnowledgeMessageModel, Knowledge
*/ */
@Transactional(rollbackFor = {BaseException.class, Exception.class}) @Transactional(rollbackFor = {BaseException.class, Exception.class})
public boolean shareDoc(List<Map<String, Object>> users, List<Map<String, Object>> docs, String way) { public boolean shareDoc(List<Map<String, Object>> users, List<Map<String, Object>> docs, String way) {
if (ValidationUtil.equalsIgnoreCase(way, SHARE_WAY_APP)) { if (ValidationUtil.equalsIgnoreCase(way, Constants.SHARE_WAY_APP)) {
for (Map<String, Object> doc : docs) { for (Map<String, Object> doc : docs) {
//创建消息 //创建消息
if (ValidationUtil.isEmpty(doc) || ValidationUtil.isEmpty(doc.get("sequenceNbr"))) { if (ValidationUtil.isEmpty(doc) || ValidationUtil.isEmpty(doc.get("sequenceNbr"))) {
throw new BadRequest("分享内容缺失"); throw new BadRequest("分享内容缺失");
} }
String messageTitle = String.valueOf(doc.get("docTitle")); String messageTitle = String.valueOf(doc.get("docTitle"));
KnowledgeMessageModel message = createMessage(MESSAGE_TYPE_SHARE, Long.valueOf(doc.get("sequenceNbr").toString()), messageTitle, String.valueOf(doc.get("summary"))); KnowledgeMessageModel message = createMessage(Constants.MESSAGE_TYPE_SHARE, Long.valueOf(doc.get("sequenceNbr").toString()), messageTitle, String.valueOf(doc.get("summary")));
Set<String> userIdSet = new HashSet<>(); Set<String> userIdSet = new HashSet<>();
userIdSet = parseUserMapToIdList(users, userIdSet); userIdSet = parseUserMapToIdList(users, userIdSet);
//创建个人消息 //创建个人消息
...@@ -134,7 +122,7 @@ public class MessageService extends BaseService<KnowledgeMessageModel, Knowledge ...@@ -134,7 +122,7 @@ public class MessageService extends BaseService<KnowledgeMessageModel, Knowledge
@Transactional(rollbackFor = {BaseException.class, Exception.class}) @Transactional(rollbackFor = {BaseException.class, Exception.class})
public boolean pushEssential(List<Map<String, Object>> users, String messageTitle, String content, Long docSeq) { public boolean pushEssential(List<Map<String, Object>> users, String messageTitle, String content, Long docSeq) {
//创建消息 //创建消息
KnowledgeMessageModel message = createMessage(MESSAGE_TYPE_PUSH, docSeq, messageTitle, content); KnowledgeMessageModel message = createMessage(Constants.MESSAGE_TYPE_PUSH, docSeq, messageTitle, content);
Set<String> userIdSet = new HashSet<>(); Set<String> userIdSet = new HashSet<>();
userIdSet = parseUserMapToIdList(users, userIdSet); userIdSet = parseUserMapToIdList(users, userIdSet);
//创建个人消息 //创建个人消息
...@@ -251,7 +239,7 @@ public class MessageService extends BaseService<KnowledgeMessageModel, Knowledge ...@@ -251,7 +239,7 @@ public class MessageService extends BaseService<KnowledgeMessageModel, Knowledge
* 获取用户的主题 * 获取用户的主题
*/ */
private String getTopic(String userId) { private String getTopic(String userId) {
return TOPIC_PREFIX + String.valueOf(userId); return Constants.TOPIC_PREFIX + String.valueOf(userId);
} }
/** /**
......
...@@ -8,6 +8,8 @@ import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel; ...@@ -8,6 +8,8 @@ import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagInstanceMapper; import com.yeejoin.amos.knowledgebase.face.orm.dao.TagInstanceMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -31,10 +33,6 @@ import java.util.*; ...@@ -31,10 +33,6 @@ import java.util.*;
@Component @Component
public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, KnowledgeTagInstance, TagInstanceMapper> { public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, KnowledgeTagInstance, TagInstanceMapper> {
public static final String MARKING_TYPE_DOC = "DOC"; // 标记类型--文档标签
public static final String MARKING_TYPE_CONTENT = "CONTENT";// 标记类型--内容标签
@Autowired @Autowired
private TagValueService tagValueService; private TagValueService tagValueService;
...@@ -71,7 +69,7 @@ public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, K ...@@ -71,7 +69,7 @@ public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, K
instanceModel.setTagType(tagModel.getTagType()); instanceModel.setTagType(tagModel.getTagType());
//值标签保存标签的具体值 //值标签保存标签的具体值
List<KnowledgeTagValueModel> valueModels = instanceModel.getTagValues(); List<KnowledgeTagValueModel> valueModels = instanceModel.getTagValues();
if (TagService.TAG_TYPE_VALUE.equals(tagModel.getTagType()) && !ValidationUtil.isEmpty(valueModels)) { if (Constants.TAG_TYPE_VALUE.equals(tagModel.getTagType()) && !ValidationUtil.isEmpty(valueModels)) {
List<KnowledgeDynamicsValueModel> valueTagConfigs = dynamicsValueService.queryByInstanceId(tagModel.getSequenceNbr()); List<KnowledgeDynamicsValueModel> valueTagConfigs = dynamicsValueService.queryByInstanceId(tagModel.getSequenceNbr());
Map<String,Object> valueTagConfigMap = Bean.listToMap(valueTagConfigs,"fieldName","fieldValue",KnowledgeDynamicsValueModel.class); Map<String,Object> valueTagConfigMap = Bean.listToMap(valueTagConfigs,"fieldName","fieldValue",KnowledgeDynamicsValueModel.class);
String unit = String.valueOf(valueTagConfigMap.get("unit")); String unit = String.valueOf(valueTagConfigMap.get("unit"));
...@@ -138,7 +136,7 @@ public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, K ...@@ -138,7 +136,7 @@ public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, K
List<KnowledgeTagInstanceModel> instanceModels = this.queryForList(null, false, agencyCode, targetSeq,markingType); List<KnowledgeTagInstanceModel> instanceModels = this.queryForList(null, false, agencyCode, targetSeq,markingType);
if (!ValidationUtil.isEmpty(instanceModels)) { if (!ValidationUtil.isEmpty(instanceModels)) {
for (KnowledgeTagInstanceModel instanceModel : instanceModels) { for (KnowledgeTagInstanceModel instanceModel : instanceModels) {
if (TagService.TAG_TYPE_VALUE.equals(instanceModel.getTagType())) { if (Constants.TAG_TYPE_VALUE.equals(instanceModel.getTagType())) {
List<KnowledgeTagValueModel> list = this.tagValueService.queryByInstance(instanceModel.getSequenceNbr()); List<KnowledgeTagValueModel> list = this.tagValueService.queryByInstance(instanceModel.getSequenceNbr());
instanceModel.setTagValues(list); instanceModel.setTagValues(list);
} }
......
...@@ -4,12 +4,14 @@ package com.yeejoin.amos.knowledgebase.face.service; ...@@ -4,12 +4,14 @@ package com.yeejoin.amos.knowledgebase.face.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional; import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional;
import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import com.yeejoin.amos.knowledgebase.face.model.*; import com.yeejoin.amos.knowledgebase.face.model.*;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagMapper; import com.yeejoin.amos.knowledgebase.face.orm.dao.TagMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTag; import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTag;
import com.yeejoin.amos.knowledgebase.face.util.ConfigLoader; import com.yeejoin.amos.knowledgebase.face.util.ConfigLoader;
import com.yeejoin.amos.knowledgebase.face.util.RemoteData; import com.yeejoin.amos.knowledgebase.face.util.Constants;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -39,27 +41,6 @@ import java.util.*; ...@@ -39,27 +41,6 @@ import java.util.*;
@Component @Component
public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, TagMapper> { public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, TagMapper> {
/**
* 标签状态-激活
*/
public static final String TAG_STATUS_ACTIVATE = "ACTIVATED";
/**
* 标签状态-禁用
*/
public static final String TAG_STATUS_DEACTIVATE = "DEACTIVATED";
/**
* 标签类型-文本标签
*/
public static final String TAG_TYPE_TEXT = "TEXT_TAG";
/**
* 标签类型-值标签
*/
public static final String TAG_TYPE_VALUE = "VALUE_TAG";
public static final String APPKEY_ALL = "ALL";
@Autowired @Autowired
private TagGroupService tagGroupService; private TagGroupService tagGroupService;
@Autowired @Autowired
...@@ -92,7 +73,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag ...@@ -92,7 +73,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag
} }
Long sequenceNbr = sequence.nextId(); Long sequenceNbr = sequence.nextId();
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
model.setTagStatus(TAG_STATUS_DEACTIVATE); model.setTagStatus(Constants.TAG_STATUS_DEACTIVATE);
model.setAgencyCode(RequestContext.getAgencyCode()); model.setAgencyCode(RequestContext.getAgencyCode());
model.setCreator(RequestContext.getExeUserId()); model.setCreator(RequestContext.getExeUserId());
//创建标签-分组关联关系 //创建标签-分组关联关系
...@@ -120,7 +101,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag ...@@ -120,7 +101,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag
throw new BadRequest("标签名称不可重复"); throw new BadRequest("标签名称不可重复");
} }
//判断标签状态 //判断标签状态
if (ValidationUtil.equals(oldTagModel.getTagStatus(), TAG_STATUS_ACTIVATE)) { if (ValidationUtil.equals(oldTagModel.getTagStatus(), Constants.TAG_STATUS_ACTIVATE)) {
throw new BadRequest("启用状态的标签不允许编辑"); throw new BadRequest("启用状态的标签不允许编辑");
} }
Long sequenceNbr = oldTagModel.getSequenceNbr(); Long sequenceNbr = oldTagModel.getSequenceNbr();
...@@ -134,12 +115,12 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag ...@@ -134,12 +115,12 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag
} }
private void restoreDynamicsValues(Long sequenceNbr, KnowledgeTagModel model) { private void restoreDynamicsValues(Long sequenceNbr, KnowledgeTagModel model) {
if (ValidationUtil.equals(TAG_TYPE_VALUE, model.getTagType())) { if (ValidationUtil.equals(Constants.TAG_TYPE_VALUE, model.getTagType())) {
Map<String, Object> tagValues = model.getTagValues(); Map<String, Object> tagValues = model.getTagValues();
if (!ValidationUtil.isEmpty(tagValues)) { if (!ValidationUtil.isEmpty(tagValues)) {
dynamicsValueService.saveValueList(tagValues, sequenceNbr, dynamicsValueService.saveValueList(tagValues, sequenceNbr,
DynamicsFunctional.VALUE_TAG_CONFIG, DynamicsFunctional.VALUE_TAG_CONFIG,
APPKEY_ALL); Constants.APPKEY_ALL);
} }
} }
} }
...@@ -259,7 +240,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag ...@@ -259,7 +240,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag
tagIdList = StringUtil.String2LongList(tags); tagIdList = StringUtil.String2LongList(tags);
} }
for (KnowledgeTagModel tagModel : tagModels) { for (KnowledgeTagModel tagModel : tagModels) {
if (ValidationUtil.equals(tagModel.getTagStatus(), TAG_STATUS_ACTIVATE)) { if (ValidationUtil.equals(tagModel.getTagStatus(), Constants.TAG_STATUS_ACTIVATE)) {
throw new RequestForbidden("包含启用状态的标签,不允许删除"); throw new RequestForbidden("包含启用状态的标签,不允许删除");
} }
if (tagIsQuoted(tagModel.getSequenceNbr())) { if (tagIsQuoted(tagModel.getSequenceNbr())) {
...@@ -398,7 +379,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag ...@@ -398,7 +379,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag
} }
public List<KnowledgeTagModel> queryTagDetailList(String tagName) { public List<KnowledgeTagModel> queryTagDetailList(String tagName) {
List<KnowledgeTag> tagList = queryTagListWithGroup(null, tagName, null, TAG_STATUS_ACTIVATE); List<KnowledgeTag> tagList = queryTagListWithGroup(null, tagName, null, Constants.TAG_STATUS_ACTIVATE);
List<KnowledgeTagModel> res = new ArrayList<>(); List<KnowledgeTagModel> res = new ArrayList<>();
for (KnowledgeTag tag : tagList) { for (KnowledgeTag tag : tagList) {
KnowledgeTagModel tagModel = new KnowledgeTagModel(); KnowledgeTagModel tagModel = new KnowledgeTagModel();
...@@ -412,7 +393,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag ...@@ -412,7 +393,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag
} }
private void tagAddDynamicsValues(KnowledgeTagModel tagModel) { private void tagAddDynamicsValues(KnowledgeTagModel tagModel) {
if (ValidationUtil.equals(TAG_TYPE_VALUE, tagModel.getTagType())) { if (ValidationUtil.equals(Constants.TAG_TYPE_VALUE, tagModel.getTagType())) {
List<KnowledgeDynamicsValueModel> valueModels = dynamicsValueService.queryByInstanceId(tagModel.getSequenceNbr()); List<KnowledgeDynamicsValueModel> valueModels = dynamicsValueService.queryByInstanceId(tagModel.getSequenceNbr());
if (!ValidationUtil.isEmpty(valueModels)) { if (!ValidationUtil.isEmpty(valueModels)) {
Map fieldsMap = Bean.listToMap(valueModels, "fieldName", KnowledgeDynamicsValueModel.class); Map fieldsMap = Bean.listToMap(valueModels, "fieldName", KnowledgeDynamicsValueModel.class);
...@@ -436,7 +417,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag ...@@ -436,7 +417,7 @@ public class TagService extends BaseService<KnowledgeTagModel, KnowledgeTag, Tag
throw new BadRequest("参数有误"); throw new BadRequest("参数有误");
} }
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<KnowledgeDocContent>() QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<KnowledgeDocContent>()
.eq("DOC_STATUS", DocContentService.DOC_STATUS_PUBLISHED) .eq("DOC_STATUS", Constants.DOC_STATUS_PUBLISHED)
.inSql("SEQUENCE_NBR", "SELECT DISTINCT TARGET_SEQ FROM knowledge_tag_instance WHERE TAG_SEQ = " + sequenceNbr); .inSql("SEQUENCE_NBR", "SELECT DISTINCT TARGET_SEQ FROM knowledge_tag_instance WHERE TAG_SEQ = " + sequenceNbr);
return docContentService.list(wrapper); return docContentService.list(wrapper);
} }
......
package com.yeejoin.amos.knowledgebase.face.service; package com.yeejoin.amos.knowledgebase.face.service;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel; import java.util.Collection;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagValueMapper; import java.util.List;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collection; import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import java.util.List; import com.yeejoin.amos.knowledgebase.face.orm.dao.TagValueMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
/** /**
...@@ -29,15 +28,6 @@ import java.util.List; ...@@ -29,15 +28,6 @@ import java.util.List;
@Component @Component
public class TagValueService extends BaseService<KnowledgeTagValueModel, KnowledgeTagValue, TagValueMapper> { public class TagValueService extends BaseService<KnowledgeTagValueModel, KnowledgeTagValue, TagValueMapper> {
public static final String VALUE_TAG_FIELD_SINGLEVALUE = "singleValue";//单值字段名
public static final String VALUE_TAG_FIELD_RANGE_MAX = "rangeMax";//范围值 上界
public static final String VALUE_TAG_FIELD_RANGE_MIN = "rangeMin";//范围值 下界
public static final String VALUE_TAG_FIELD_TEXT = "text";//文本值
public static final String VALUE_TAG_FIELD_DATE_H = "dateH";//时间,年月日时分秒
public static final String VALUE_TAG_FIELD_ENUM_NAME = "enumName";// 枚举类型字段名
@Transactional(rollbackFor = {Exception.class, BaseException.class}) @Transactional(rollbackFor = {Exception.class, BaseException.class})
public List<KnowledgeTagValueModel> saveInstanceValue(Long instanceSeq, List<KnowledgeTagValueModel> valueModels, String unit) { public List<KnowledgeTagValueModel> saveInstanceValue(Long instanceSeq, List<KnowledgeTagValueModel> valueModels, String unit) {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>amos-boot-module-biz</artifactId> <artifactId>amos-boot-module-biz</artifactId>
...@@ -15,6 +17,16 @@ ...@@ -15,6 +17,16 @@
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions> <exclusions>
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
<artifactId>amos-boot-module-patrol-biz</artifactId> <artifactId>amos-boot-module-patrol-biz</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
...@@ -19,6 +18,16 @@ ...@@ -19,6 +18,16 @@
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions> <exclusions>
......
...@@ -24,6 +24,16 @@ ...@@ -24,6 +24,16 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 添加fastjson 依赖包. --> <!-- 添加fastjson 依赖包. -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
......
...@@ -261,10 +261,9 @@ public class AlertCalledController extends BaseController { ...@@ -261,10 +261,9 @@ public class AlertCalledController extends BaseController {
queryWrapper.orderByDesc("call_time"); queryWrapper.orderByDesc("call_time");
if (alertCalled.getCallTimeStart() != null && alertCalled.getCallTimeEnd() != null) {
queryWrapper.between("call_time", DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN), queryWrapper.between("call_time", DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN)); DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
}
if (alertCalled.getIsFatherAlert()) { // 0:接警;1:处警 if (alertCalled.getIsFatherAlert()) { // 0:接警;1:处警
queryWrapper.isNull("father_alert"); queryWrapper.isNull("father_alert");
} }
......
...@@ -313,13 +313,13 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa ...@@ -313,13 +313,13 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa
DispatchPaper dispatchPaper = dispatchPaperFormDto.getDispatchPaper(); DispatchPaper dispatchPaper = dispatchPaperFormDto.getDispatchPaper();
// 动态字段 // 动态字段
List<AlertFormValue> dynamicFormAlert = dispatchPaperFormDto.getDynamicFormAlert(); List<AlertFormValue> dynamicFormAlert = dispatchPaperFormDto.getDynamicFormAlert();
Map<String,Boolean> tempMap = new HashMap<String,Boolean>();
dynamicFormAlert.stream().forEach(alertFormValue -> { dynamicFormAlert.stream().forEach(alertFormValue -> {
switch (alertFormValue.getFieldCode()) { switch (alertFormValue.getFieldCode()) {
case TzsCommonParam.SAVE_FEEDBACK_TIME: case TzsCommonParam.SAVE_FEEDBACK_TIME:
if (dispatchSaveFeedbackDto.getSaveFeedbackTime() != null) { if (dispatchSaveFeedbackDto.getSaveFeedbackTime() != null) {
if(alertFormValue.getFieldValue() == null ) { if(alertFormValue.getFieldValue() == null ) {
// 坐席回访 tempMap.put(TzsCommonParam.BXFK,true);
repairConsultServiceImpl.saveRepairConsultByAlertIdType(dispatchSaveFeedbackDto.getAlertId(),TzsCommonParam.JYHF,null,user);
} }
alertFormValue.setFieldValue(DateUtils.date2LongStr(dispatchSaveFeedbackDto.getSaveFeedbackTime())); alertFormValue.setFieldValue(DateUtils.date2LongStr(dispatchSaveFeedbackDto.getSaveFeedbackTime()));
} }
...@@ -368,6 +368,17 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa ...@@ -368,6 +368,17 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa
dispatchPaper.setFeedbackUid(dispatchSaveFeedbackDto.getFeedbackUid()); dispatchPaper.setFeedbackUid(dispatchSaveFeedbackDto.getFeedbackUid());
dispatchPaper.setFeedbackUname(dispatchSaveFeedbackDto.getFeedbackUname()); dispatchPaper.setFeedbackUname(dispatchSaveFeedbackDto.getFeedbackUname());
if(dispatchPaper.getFeedbackTime() == null && dispatchSaveFeedbackDto.getFeedbackFinishTime() != null) { if(dispatchPaper.getFeedbackTime() == null && dispatchSaveFeedbackDto.getFeedbackFinishTime() != null) {
tempMap.put("FEEDBACK",true);
}
// 保存派遣表
flag = this.updateById(dispatchPaper);
// 保存动态表单数据
iAlertFormValueService.updateBatchById(dynamicFormAlert);
if(tempMap.get("BXFK") != null) {
// 救援回访
repairConsultServiceImpl.saveRepairConsultByAlertIdType(dispatchSaveFeedbackDto.getAlertId(),TzsCommonParam.JYHF,null,user);
}
if(tempMap.get("FEEDBACK") != null) {
// 维修反馈 // 维修反馈
Long taskId = dispatchPaper.getRepairOrgTaskId() != null ? dispatchPaper.getRepairOrgTaskId() : dispatchPaper.getUseOrgTaskId(); Long taskId = dispatchPaper.getRepairOrgTaskId() != null ? dispatchPaper.getRepairOrgTaskId() : dispatchPaper.getUseOrgTaskId();
if(taskId == null) { if(taskId == null) {
...@@ -376,10 +387,6 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa ...@@ -376,10 +387,6 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa
repairConsultServiceImpl.saveRepairConsultByAlertIdType(dispatchSaveFeedbackDto.getAlertId(),TzsCommonParam.WXFK,taskId,user); repairConsultServiceImpl.saveRepairConsultByAlertIdType(dispatchSaveFeedbackDto.getAlertId(),TzsCommonParam.WXFK,taskId,user);
dispatchPaper.setFeedbackTime(dispatchSaveFeedbackDto.getFeedbackFinishTime()); // 没有回访时间只有维修完成时间 2021.8.18 演示沟通 维修完成时间即为 反馈时间 dispatchPaper.setFeedbackTime(dispatchSaveFeedbackDto.getFeedbackFinishTime()); // 没有回访时间只有维修完成时间 2021.8.18 演示沟通 维修完成时间即为 反馈时间
} }
// 保存动态表单数据
iAlertFormValueService.updateBatchById(dynamicFormAlert);
// 保存派遣表
flag = this.updateById(dispatchPaper);
return flag; return flag;
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>amos-boot-module</artifactId> <artifactId>amos-boot-module</artifactId>
...@@ -11,6 +13,7 @@ ...@@ -11,6 +13,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<dependencies> <dependencies>
</dependencies> </dependencies>
<modules> <modules>
...@@ -23,5 +26,6 @@ ...@@ -23,5 +26,6 @@
<module>amos-boot-module-fas-biz</module> <module>amos-boot-module-fas-biz</module>
<module>amos-boot-module-maintenance-biz</module> <module>amos-boot-module-maintenance-biz</module>
<module>amos-boot-module-supervision-biz</module> <module>amos-boot-module-supervision-biz</module>
<module>amos-boot-module-jpush-biz</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>amos-biz-boot</artifactId> <artifactId>amos-biz-boot</artifactId>
...@@ -12,19 +14,11 @@ ...@@ -12,19 +14,11 @@
<dependencies> <dependencies>
<!-- amos rule-->
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-component-rule</artifactId> <artifactId>amos-boot-biz-common</artifactId>
<version>1.4.7</version> <version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
<modules> <modules>
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
<version>3.0.1.3</version> <version>3.0.1.3</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-fas-biz</artifactId> <artifactId>amos-boot-module-fas-biz</artifactId>
......
...@@ -32,7 +32,7 @@ rule.definition.default-agency=jcs ...@@ -32,7 +32,7 @@ rule.definition.default-agency=jcs
rule.definition.localIp=172.16.3.39 rule.definition.localIp=172.16.3.39
## mongodb properties: ## mongodb properties:
spring.data.mongodb.uri=mongodb://172.16.3.41:27017/command_db spring.data.mongodb.uri=mongodb://172.16.10.66:27017/command_db
## file properties: ## file properties:
file.url=http://39.98.45.134:9000/ file.url=http://39.98.45.134:9000/
......
...@@ -65,3 +65,6 @@ supervision.feign.name = AMOS-SUPERVISION-API ...@@ -65,3 +65,6 @@ supervision.feign.name = AMOS-SUPERVISION-API
iot.fegin.name=AMOS-API-IOT iot.fegin.name=AMOS-API-IOT
equip.fegin.name=AMOS-EQUIPMANAGE equip.fegin.name=AMOS-EQUIPMANAGE
## 设备联动服务(车库门、广播、警铃)
control.fegin.name=JCS-API-CONTROL
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>amos-biz-boot</artifactId>
<groupId>com.amosframework.boot</groupId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-system-jpush</artifactId>
<version>8.0.0</version>
<dependencies>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-jpush-biz</artifactId>
<version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.yeejoin.amos;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
/**
* <pre>
* 服务启动类
* </pre>
*
* @author amos
* @version $Id: YeeAMOSPatrolStart.java, v 0.1 2018年11月26日 下午4:56:29 amos Exp $
*/
@SpringBootApplication
@EnableConfigurationProperties
@ServletComponentScan
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@EnableEurekaClient
@ComponentScan({"org.typroject","com.yeejoin.amos"})
public class JpushApplication {
private static final Logger logger = LoggerFactory.getLogger(JpushApplication.class);
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(JpushApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
}
\ No newline at end of file
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.10.72:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url-path=/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
params.isPush=true
\ No newline at end of file
eureka.client.serviceUrl.defaultZone=http://amos-eurka:10001/eureka/
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.client.healthcheck.enabled=true
eureka.client.fetchRegistry=true
params.isPush=true
\ No newline at end of file
server.port=7800
spring.application.name=AMOS-PUSH
spring.profiles.active=dev
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
ribbon.eureka.enabled=true
ribbon.ConnectTimeout=60000
ribbon.ReadTimeout=60000
ribbon.OkToRetryOnAllOperations=true
ribbon.MaxAutoRetriesNextServer=2
ribbon.MaxAutoRetries=1
spring.jackson.serialization.write-dates-as-timestamps=true
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/knowledgebase.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/knowledgebase.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--按大小分割同一天的-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO"/>
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin.amos" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
...@@ -62,21 +62,6 @@ ...@@ -62,21 +62,6 @@
<version>1.2.67</version> <version>1.2.67</version>
</dependency> </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<!--
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.2</version> </dependency> -->
<!--����MongoDB -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
...@@ -89,7 +74,6 @@ ...@@ -89,7 +74,6 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- ���commons-lang������ -->
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
...@@ -100,10 +84,6 @@ ...@@ -100,10 +84,6 @@
<artifactId>commons-compress</artifactId> <artifactId>commons-compress</artifactId>
<version>1.18</version> <version>1.18</version>
</dependency> </dependency>
<!--集成apache poi word 转html -->
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId> <artifactId>poi-scratchpad</artifactId>
...@@ -142,7 +122,6 @@ ...@@ -142,7 +122,6 @@
<artifactId>poi-ooxml-schemas</artifactId> <artifactId>poi-ooxml-schemas</artifactId>
<version>3.17</version> <version>3.17</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId> <artifactId>ooxml-schemas</artifactId>
...@@ -160,20 +139,14 @@ ...@@ -160,20 +139,14 @@
<artifactId>jsoup</artifactId> <artifactId>jsoup</artifactId>
<version>1.11.3</version> <version>1.11.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>joda-time</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>joda-time</artifactId>
<version>2.10.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>org.apache.commons</groupId>
<artifactId>mybatis-plus-generator</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.velocity</groupId> <groupId>org.apache.velocity</groupId>
...@@ -236,20 +209,14 @@ ...@@ -236,20 +209,14 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.typroject</groupId> <groupId>com.yeejoin</groupId>
<artifactId>tyboot-core-auth</artifactId> <artifactId>amos-feign-privilege</artifactId>
<version>${tyboot-version}</version> <version>${amos.version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>joda-time</groupId> <groupId>com.yeejoin</groupId>
<artifactId>joda-time</artifactId> <artifactId>amos-feign-systemctl</artifactId>
<version>2.10.4</version> <version>${amos.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.typroject</groupId> <groupId>org.typroject</groupId>
...@@ -267,17 +234,17 @@ ...@@ -267,17 +234,17 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yeejoin</groupId> <groupId>org.typroject</groupId>
<artifactId>amos-feign-privilege</artifactId> <artifactId>tyboot-core-auth</artifactId>
<version>${amos.version}</version> <version>${tyboot-version}</version>
</dependency> <exclusions>
<dependency> <exclusion>
<groupId>com.yeejoin</groupId> <groupId>org.typroject</groupId>
<artifactId>amos-feign-systemctl</artifactId> <artifactId>*</artifactId>
<version>${amos.version}</version> </exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
...@@ -295,6 +262,26 @@ ...@@ -295,6 +262,26 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<repositories> <repositories>
...@@ -334,5 +321,6 @@ ...@@ -334,5 +321,6 @@
<module>amos-boot-system-patrol</module> <module>amos-boot-system-patrol</module>
<module>amos-boot-system-maintenance</module> <module>amos-boot-system-maintenance</module>
<module>amos-boot-system-supervision</module> <module>amos-boot-system-supervision</module>
<module>amos-boot-system-jpush</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment