吉安感知网项目-后端
xiebin
2026-01-20 58a840b31099dcd1bc59dcc063820b9926ae9561
add-Flowable集成
6 files modified
24 files added
1304 ■■■■■ changed files
drone-ops-api/drone-flow-api/pom.xml 11 ●●●●● patch | view | raw | blame | history
drone-ops/drone-flow/pom.xml 7 ●●●● patch | view | raw | blame | history
drone-ops/drone-flow/src/main/java/org/sxkj/flow/FlowApplication.java 4 ●●●● patch | view | raw | blame | history
drone-ops/pom.xml 2 ●●● patch | view | raw | blame | history
drone-service-api/drone-desk-api/pom.xml 16 ●●●●● patch | view | raw | blame | history
drone-service-api/drone-desk-api/src/main/java/org/sxkj/desk/entity/Notice.java 64 ●●●●● patch | view | raw | blame | history
drone-service-api/drone-desk-api/src/main/java/org/sxkj/desk/feign/INoticeClient.java 49 ●●●●● patch | view | raw | blame | history
drone-service-api/drone-desk-api/src/main/java/org/sxkj/desk/vo/NoticeVO.java 23 ●●●●● patch | view | raw | blame | history
drone-service-api/pom.xml 1 ●●●● patch | view | raw | blame | history
drone-service/drone-desk/Dockerfile 15 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/pom.xml 79 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/DeskApplication.java 40 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/controller/DashBoardController.java 207 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/controller/LeaveController.java 66 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/controller/NoticeController.java 150 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/entity/ProcessLeave.java 67 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/feign/NoticeClient.java 54 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/mapper/LeaveMapper.java 29 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/mapper/LeaveMapper.xml 6 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/mapper/NoticeMapper.java 50 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/mapper/NoticeMapper.xml 54 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/service/ILeaveService.java 37 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/service/INoticeService.java 39 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/service/impl/LeaveServiceImpl.java 81 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/service/impl/NoticeServiceImpl.java 43 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/java/org/sxkj/desk/wrapper/NoticeWrapper.java 64 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/resources/application-dev.yml 11 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/resources/application-prod.yml 10 ●●●●● patch | view | raw | blame | history
drone-service/drone-desk/src/main/resources/application-test.yml 10 ●●●●● patch | view | raw | blame | history
drone-service/pom.xml 15 ●●●●● patch | view | raw | blame | history
drone-ops-api/drone-flow-api/pom.xml
@@ -13,4 +13,15 @@
    <name>${project.artifactId}</name>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-starter-cache</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-common</artifactId>
        </dependency>
    </dependencies>
</project>
drone-ops/drone-flow/pom.xml
@@ -44,10 +44,11 @@
            <artifactId>blade-core-auto</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-flow-api</artifactId>
            <version>${revision}</version>
        </dependency>
        <!-- 工作流 -->
        <dependency>
@@ -59,6 +60,10 @@
            <artifactId>blade-core-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-system-api</artifactId>
        </dependency>
    </dependencies>
    <build>
drone-ops/drone-flow/src/main/java/org/sxkj/flow/FlowApplication.java
@@ -16,9 +16,11 @@
 */
package org.sxkj.flow;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
 * Flowable启动器
@@ -27,6 +29,8 @@
 */
//@SeataCloudApplication
@BladeCloudApplication
@EnableFeignClients({"org.sxkj","com.dji.sample"})
@MapperScan({"org.springblade.**.mapper.**","org.sxkj.**.mapper.**"})
public class FlowApplication {
    public static void main(String[] args) {
drone-ops/pom.xml
@@ -16,7 +16,7 @@
    <modules>
        <module>drone-admin</module>
        <module>drone-develop</module>
<!--        <module>drone-flow</module>-->
        <module>drone-flow</module>
        <module>drone-job</module>
        <module>drone-log</module>
        <module>drone-report</module>
drone-service-api/drone-desk-api/pom.xml
New file
@@ -0,0 +1,16 @@
<?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">
    <parent>
        <artifactId>drone-service-api</artifactId>
        <groupId>org.springblade</groupId>
        <version>${revision}</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>drone-desk-api</artifactId>
    <name>${project.artifactId}</name>
    <packaging>jar</packaging>
</project>
drone-service-api/drone-desk-api/src/main/java/org/sxkj/desk/entity/Notice.java
New file
@@ -0,0 +1,64 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.util.Date;
/**
 * 实体类
 *
 * @author Chill
 */
@Data
@TableName("blade_notice")
@EqualsAndHashCode(callSuper = true)
public class Notice extends TenantEntity {
    private static final long serialVersionUID = 1L;
    /**
     * 标题
     */
    @ApiModelProperty(value = "标题")
    private String title;
    /**
     * 通知类型
     */
    @ApiModelProperty(value = "通知类型")
    private Integer category;
    /**
     * 发布日期
     */
    @ApiModelProperty(value = "发布日期")
    private Date releaseTime;
    /**
     * 内容
     */
    @ApiModelProperty(value = "内容")
    private String content;
}
drone-service-api/drone-desk-api/src/main/java/org/sxkj/desk/feign/INoticeClient.java
New file
@@ -0,0 +1,49 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.feign;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.BladePage;
import org.sxkj.desk.entity.Notice;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Notice Feign接口类
 *
 * @author Chill
 */
@FeignClient(
    value = AppConstant.APPLICATION_DESK_NAME
)
public interface INoticeClient {
    String API_PREFIX = "/client";
    String TOP = API_PREFIX + "/top";
    /**
     * 获取notice列表
     *
     * @param current
     * @param size
     * @return
     */
    @GetMapping(TOP)
    BladePage<Notice> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
}
drone-service-api/drone-desk-api/src/main/java/org/sxkj/desk/vo/NoticeVO.java
New file
@@ -0,0 +1,23 @@
package org.sxkj.desk.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.sxkj.desk.entity.Notice;
/**
 * 通知公告视图类
 *
 * @author Chill
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class NoticeVO extends Notice {
    @ApiModelProperty(value = "通知类型名")
    private String categoryName;
    @ApiModelProperty(value = "租户编号")
    private String tenantId;
}
drone-service-api/pom.xml
@@ -15,6 +15,7 @@
    <description>BladeX 微服务API集合</description>
    <modules>
        <module>drone-desk-api</module>
        <module>drone-dict-api</module>
        <module>drone-odm-api</module>
        <module>drone-py-tools-api</module>
drone-service/drone-desk/Dockerfile
New file
@@ -0,0 +1,15 @@
FROM bladex/alpine-java:openjdk8-openj9_cn_slim
MAINTAINER bladejava@qq.com
RUN mkdir -p /blade/desk
WORKDIR /blade/desk
EXPOSE 8105
ADD ./target/blade-desk.jar ./app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
CMD ["--spring.profiles.active=test"]
drone-service/drone-desk/pom.xml
New file
@@ -0,0 +1,79 @@
<?xml version="1.0"?>
<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">
    <parent>
        <groupId>org.springblade</groupId>
        <artifactId>drone-service</artifactId>
        <version>${revision}</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>drone-desk</artifactId>
    <name>${project.artifactId}</name>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-core-boot</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-starter-swagger</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-desk-api</artifactId>
            <version>${revision}</version>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-flow-api</artifactId>
            <version>${revision}</version>
        </dependency>
        <!--Oss-->
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-starter-oss</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-system-api</artifactId>
        </dependency>
        <!--MinIO-->
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
        </dependency>
        <!--QiNiu-->
        <dependency>
            <groupId>com.qiniu</groupId>
            <artifactId>qiniu-java-sdk</artifactId>
        </dependency>
        <!--<dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-starter-transaction</artifactId>
        </dependency>-->
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <configuration>
                    <skip>${docker.fabric.skip}</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
drone-service/drone-desk/src/main/java/org/sxkj/desk/DeskApplication.java
New file
@@ -0,0 +1,40 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
 * Desk启动器
 *
 * @author Chill
 */
@BladeCloudApplication
@EnableFeignClients({"org.sxkj","org.springblade","com.dji.sample"})
@MapperScan({"org.springblade.**.mapper.**","org.sxkj.**.mapper.**"})
public class DeskApplication {
    public static void main(String[] args) {
        BladeApplication.run(AppConstant.APPLICATION_DESK_NAME, DeskApplication.class, args);
    }
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/controller/DashBoardController.java
New file
@@ -0,0 +1,207 @@
package org.sxkj.desk.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 首页
 *
 * @author Chill
 */
@NonDS
@RestController
@AllArgsConstructor
@Api(value = "首页接口", tags = "首页接口")
public class DashBoardController {
    /**
     * 活跃用户
     */
    @GetMapping("/dashboard/activities")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "活跃用户", notes = "活跃用户")
    public R activities() {
        List<Map<String, Object>> list = new ArrayList<>();
        Map<String, Object> map1 = new HashMap<>(16);
        map1.put("id", "trend-1");
        map1.put("updatedAt", "2019-01-01");
        map1.put("user", Kv.create().set("name", "曲丽丽").set("avatar", "https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png"));
        map1.put("group", Kv.create().set("name", "高逼格设计天团").set("link", "http://github.com/"));
        map1.put("project", Kv.create().set("name", "六月迭代").set("link", "http://github.com/"));
        map1.put("template", "在 @{group} 新建项目 @{project}");
        list.add(map1);
        Map<String, Object> map2 = new HashMap<>(16);
        map2.put("id", "trend-2");
        map2.put("updatedAt", "2019-01-01");
        map2.put("user", Kv.create().set("name", "付小小").set("avatar", "https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png"));
        map2.put("group", Kv.create().set("name", "高逼格设计天团").set("link", "http://github.com/"));
        map2.put("project", Kv.create().set("name", "七月月迭代").set("link", "http://github.com/"));
        map2.put("template", "在  @{group} 新建项目 @{project}");
        list.add(map2);
        return R.data(list);
    }
    /**
     * 用户信息
     */
    @GetMapping("/dashboard/info")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "用户信息", notes = "用户信息")
    public R info() {
        Map<String, Object> map = new HashMap<>(16);
        map.put("id", "trend-1");
        map.put("updatedAt", "2019-01-01");
        map.put("user", Kv.create().set("name", "曲丽丽").set("avatar", "https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png"));
        map.put("group", Kv.create().set("name", "高逼格设计天团").set("link", "http://github.com/"));
        map.put("project", Kv.create().set("name", "六月迭代").set("link", "http://github.com/"));
        map.put("template", "在 @{group} 新建项目 @{project}");
        return R.data(map);
    }
    /**
     * 签名信息
     */
    @PostMapping("/dashboard/sign")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "签名信息", notes = "签名信息")
    public R sign() {
        Map<String, Object> map = new HashMap<>(16);
        map.put("user", Kv.create().set("name", "曲丽丽").set("avatar", "https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png"));
        return R.data(map);
    }
    /**
     * 获取消息
     */
    @GetMapping("/notice/notices")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "消息", notes = "消息")
    public R notices() {
        List<Map<String, String>> list = new ArrayList<>();
        Map<String, String> map1 = new HashMap<>(16);
        map1.put("logo", "https://spring.io/img/homepage/icon-spring-framework.svg");
        map1.put("title", "SpringBoot");
        map1.put("description", "现在的web项目几乎都会用到spring框架,而要使用spring难免需要配置大量的xml配置文件,而 springboot的出现解   决了这一问题,一个项目甚至不用部署到服务器上直接开跑,真像springboot所说:“just run”。");
        map1.put("member", "Chill");
        map1.put("href", "http://spring.io/projects/spring-boot");
        list.add(map1);
        Map<String, String> map2 = new HashMap<>(16);
        map2.put("logo", "https://spring.io/img/homepage/icon-spring-cloud.svg");
        map2.put("title", "SpringCloud");
        map2.put("description", "SpringCloud是基于SpringBoot的一整套实现微服务的框架。他提供了微服务开发所需的配置管理、服务发现、断路器、智能路由、微代理、控制总线、全局锁、决策竞选、分布式会话和集群状态管理等组件。");
        map2.put("member", "Chill");
        map2.put("href", "http://spring.io/projects/spring-cloud");
        list.add(map2);
        Map<String, String> map3 = new HashMap<>(16);
        map3.put("logo", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1546359961068&di=05ff9406e6675ca9a58a525a7e7950b9&imgtype=jpg&src=http%3A%2F%2Fimg0.imgtn.bdimg.com%2Fit%2Fu%3D575314515%2C4268715674%26fm%3D214%26gp%3D0.jpg");
        map3.put("title", "Mybatis");
        map3.put("description", "MyBatis 是一款优秀的持久层框架,它支持定制化 SQL、存储过程以及高级映射。MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集。MyBatis 可以使用简单的 XML 或注解来配置和映射原生信息,将接口和 Java 的 POJOs(Plain Old Java Objects,普通的 Java对象)映射成数据库中的记录。");
        map3.put("member", "Chill");
        map3.put("href", "http://www.mybatis.org/mybatis-3/getting-started.html");
        list.add(map3);
        Map<String, String> map4 = new HashMap<>(16);
        map4.put("logo", "https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png");
        map4.put("title", "React");
        map4.put("description", "React 起源于 Facebook 的内部项目,因为该公司对市场上所有 JavaScript MVC 框架,都不满意,就决定自己写一套,用来架设Instagram 的网站。做出来以后,发现这套东西很好用,就在2013年5月开源了。");
        map4.put("member", "Chill");
        map4.put("href", "https://reactjs.org/");
        list.add(map4);
        Map<String, String> map5 = new HashMap<>(16);
        map5.put("logo", "https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png");
        map5.put("title", "Ant Design");
        map5.put("description", "蚂蚁金服体验技术部经过大量的项目实践和总结,沉淀出设计语言 Ant Design,这可不单纯只是设计原则、控件规范和视觉尺寸,还配套有前端代码实现方案。也就是说采用Ant Design后,UI设计和前端界面研发可同步完成,效率大大提升。");
        map5.put("member", "Chill");
        map5.put("href", "https://ant.design/docs/spec/introduce-cn");
        list.add(map5);
        Map<String, String> map6 = new HashMap<>(16);
        map6.put("logo", "https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png");
        map6.put("title", "Ant Design Pro");
        map6.put("description", "Ant Design Pro 是一个企业级开箱即用的中后台前端/设计解决方案。符合阿里追求的'敏捷的前端+强大的中台'的思想。");
        map6.put("member", "Chill");
        map6.put("href", "https://pro.ant.design");
        list.add(map6);
        return R.data(list);
    }
    /**
     * 获取我的消息
     */
    @GetMapping("/notice/my-notices")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "消息", notes = "消息")
    public R myNotices() {
        List<Map<String, String>> list = new ArrayList<>();
        Map<String, String> map1 = new HashMap<>(16);
        map1.put("id", "000000001");
        map1.put("avatar", "https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png");
        map1.put("title", "你收到了 14 份新周报");
        map1.put("datetime", "2018-08-09");
        map1.put("type", "notification");
        list.add(map1);
        Map<String, String> map2 = new HashMap<>(16);
        map2.put("id", "000000002");
        map2.put("avatar", "https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png");
        map2.put("title", "你推荐的 曲妮妮 已通过第三轮面试");
        map2.put("datetime", "2018-08-08");
        map2.put("type", "notification");
        list.add(map2);
        Map<String, String> map3 = new HashMap<>(16);
        map3.put("id", "000000003");
        map3.put("avatar", "https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg");
        map3.put("title", "曲丽丽 评论了你");
        map3.put("description", "描述信息描述信息描述信息");
        map3.put("datetime", "2018-08-07");
        map3.put("type", "message");
        map3.put("clickClose", "true");
        list.add(map3);
        Map<String, String> map4 = new HashMap<>(16);
        map4.put("id", "000000004");
        map4.put("avatar", "https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg");
        map4.put("title", "朱偏右 回复了你");
        map4.put("description", "这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像");
        map4.put("type", "message");
        map4.put("datetime", "2018-08-07");
        map4.put("clickClose", "true");
        list.add(map4);
        Map<String, String> map5 = new HashMap<>(16);
        map5.put("id", "000000005");
        map5.put("title", "任务名称");
        map5.put("description", "任务需要在 2018-01-12 20:00 前启动");
        map5.put("extra", "未开始");
        map5.put("status", "todo");
        map5.put("type", "event");
        list.add(map5);
        return R.data(list);
    }
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/controller/LeaveController.java
New file
@@ -0,0 +1,66 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.controller;
import lombok.AllArgsConstructor;
import org.sxkj.common.cache.CacheNames;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.sxkj.desk.entity.ProcessLeave;
import org.sxkj.desk.service.ILeaveService;
import org.sxkj.system.cache.UserCache;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
/**
 * 控制器
 *
 * @author Chill
 */
@NonDS
@ApiIgnore
@RestController
@RequestMapping("/process/leave")
@AllArgsConstructor
public class LeaveController extends BladeController implements CacheNames {
    private final ILeaveService leaveService;
    /**
     * 详情
     *
     * @param businessId 主键
     */
    @GetMapping("detail")
    public R<ProcessLeave> detail(Long businessId) {
        ProcessLeave detail = leaveService.getById(businessId);
        detail.getFlow().setAssigneeName(UserCache.getUser(detail.getCreateUser()).getName());
        return R.data(detail);
    }
    /**
     * 新增或修改
     *
     * @param leave 请假信息
     */
    @PostMapping("start-process")
    public R startProcess(@RequestBody ProcessLeave leave) {
        return R.status(leaveService.startProcess(leave));
    }
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/controller/NoticeController.java
New file
@@ -0,0 +1,150 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.TenantDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.sxkj.desk.entity.Notice;
import org.sxkj.desk.feign.INoticeClient;
import org.sxkj.desk.service.INoticeService;
import org.sxkj.desk.vo.NoticeVO;
import org.sxkj.desk.wrapper.NoticeWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
 * 控制器
 *
 * @author Chill
 */
@TenantDS
@RestController
@RequestMapping("notice")
@AllArgsConstructor
@Api(value = "用户博客", tags = "博客接口")
public class NoticeController extends BladeController {
    private final INoticeService noticeService;
    private final INoticeClient noticeClient;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入notice")
    public R<NoticeVO> detail(Notice notice) {
        Notice detail = noticeService.getOne(Condition.getQueryWrapper(notice));
        return R.data(NoticeWrapper.build().entityVO(detail));
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"),
        @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string")
    })
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入notice")
    public R<IPage<NoticeVO>> list(@ApiIgnore @RequestParam Map<String, Object> notice, Query query) {
        NoticeWrapper.build().noticeQuery(notice);
        IPage<Notice> pages = noticeService.page(Condition.getPage(query), Condition.getQueryWrapper(notice, Notice.class));
        return R.data(NoticeWrapper.build().pageVO(pages));
    }
    /**
     * 多表联合查询自定义分页
     */
    @GetMapping("/page")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"),
        @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string")
    })
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入notice")
    public R<IPage<NoticeVO>> page(@ApiIgnore NoticeVO notice, Query query) {
        IPage<NoticeVO> pages = noticeService.selectNoticePage(Condition.getPage(query), notice);
        return R.data(pages);
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入notice")
    public R save(@RequestBody Notice notice) {
        return R.status(noticeService.save(notice));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入notice")
    public R update(@RequestBody Notice notice) {
        return R.status(noticeService.updateById(notice));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入notice")
    public R submit(@RequestBody Notice notice) {
        return R.status(noticeService.saveOrUpdate(notice));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入notice")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
        boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
        return R.status(temp);
    }
    /**
     * 远程调用分页接口
     */
    @GetMapping("/top")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "分页远程调用", notes = "传入current,size")
    public R<BladePage<Notice>> top(@ApiParam(value = "当前页") @RequestParam Integer current, @ApiParam(value = "每页显示条数") @RequestParam Integer size) {
        BladePage<Notice> page = noticeClient.top(current, size);
        return R.data(page);
    }
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/entity/ProcessLeave.java
New file
@@ -0,0 +1,67 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.sxkj.flow.core.entity.FlowEntity;
import java.util.Date;
/**
 * 请假流程实体类
 *
 * @author Chill
 */
@Data
@TableName("blade_process_leave")
@EqualsAndHashCode(callSuper = true)
public class ProcessLeave extends FlowEntity {
    private static final long serialVersionUID = 1L;
    /**
     * 流程定义id
     */
    private String processDefinitionId;
    /**
     * 流程实例id
     */
    private String processInstanceId;
    /**
     * 请假开始时间
     */
    private Date startTime;
    /**
     * 请假结束时间
     */
    private Date endTime;
    /**
     * 请假理由
     */
    private String reason;
    /**
     * 审批人
     */
    private String taskUser;
    /**
     * 流程申请时间
     */
    private Date applyTime;
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/feign/NoticeClient.java
New file
@@ -0,0 +1,54 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.sxkj.desk.entity.Notice;
import org.sxkj.desk.service.INoticeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
/**
 * Notice Feign
 *
 * @author Chill
 */
@NonDS
@ApiIgnore()
@RestController
@AllArgsConstructor
public class NoticeClient implements INoticeClient {
    private final INoticeService service;
    @Override
    @GetMapping(TOP)
    public BladePage<Notice> top(Integer current, Integer size) {
        Query query = new Query();
        query.setCurrent(current);
        query.setSize(size);
        IPage<Notice> page = service.page(Condition.getPage(query));
        return BladePage.of(page);
    }
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/mapper/LeaveMapper.java
New file
@@ -0,0 +1,29 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.sxkj.desk.entity.ProcessLeave;
/**
 * Mapper 接口
 *
 * @author Chill
 */
public interface LeaveMapper extends BaseMapper<ProcessLeave> {
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/mapper/LeaveMapper.xml
New file
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.sxkj.desk.mapper.LeaveMapper">
</mapper>
drone-service/drone-desk/src/main/java/org/sxkj/desk/mapper/NoticeMapper.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.sxkj.desk.entity.Notice;
import org.sxkj.desk.vo.NoticeVO;
import java.util.List;
/**
 * Mapper 接口
 *
 * @author Chill
 */
public interface NoticeMapper extends BaseMapper<Notice> {
    /**
     * 前N条数据
     *
     * @param number 数量
     * @return List<Notice>
     */
    List<Notice> topList(Integer number);
    /**
     * 自定义分页
     *
     * @param page   分页
     * @param notice 实体
     * @return List<NoticeVO>
     */
    List<NoticeVO> selectNoticePage(IPage page, NoticeVO notice);
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/mapper/NoticeMapper.xml
New file
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.sxkj.desk.mapper.NoticeMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="noticeResultMap" type="org.sxkj.desk.entity.Notice">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="release_time" property="releaseTime"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
    </resultMap>
    <!-- 通用查询映射结果 -->
    <resultMap id="noticeVOResultMap" type="org.sxkj.desk.vo.NoticeVO">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="release_time" property="releaseTime"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
    </resultMap>
    <select id="topList" resultMap="noticeResultMap">
        select * from blade_notice limit #{number}
    </select>
    <select id="selectNoticePage" resultMap="noticeVOResultMap">
        SELECT
        n.*,
        d.dict_value AS categoryName
        FROM
        blade_notice n
        LEFT JOIN ( SELECT * FROM blade_dict WHERE CODE = 'notice' ) d ON n.category = d.dict_key
        WHERE
        n.is_deleted = 0 and n.tenant_id = #{notice.tenantId}
        <if test="notice.title!=null">
            and n.title like concat(concat('%', #{notice.title}), '%')
        </if>
        <if test="notice.category!=null">
            and n.category = #{notice.category}
        </if>
    </select>
</mapper>
drone-service/drone-desk/src/main/java/org/sxkj/desk/service/ILeaveService.java
New file
@@ -0,0 +1,37 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.service;
import org.springblade.core.mp.base.BaseService;
import org.sxkj.desk.entity.ProcessLeave;
/**
 * 服务类
 *
 * @author Chill
 */
public interface ILeaveService extends BaseService<ProcessLeave> {
    /**
     * 开启流程
     *
     * @param leave 请假实体
     * @return boolean
     */
    boolean startProcess(ProcessLeave leave);
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/service/INoticeService.java
New file
@@ -0,0 +1,39 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.sxkj.desk.entity.Notice;
import org.sxkj.desk.vo.NoticeVO;
/**
 * 服务类
 *
 * @author Chill
 */
public interface INoticeService extends BaseService<Notice> {
    /**
     * 自定义分页
     * @param page
     * @param notice
     * @return
     */
    IPage<NoticeVO> selectNoticePage(IPage<NoticeVO> page, NoticeVO notice);
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/service/impl/LeaveServiceImpl.java
New file
@@ -0,0 +1,81 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.service.impl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.sxkj.desk.entity.ProcessLeave;
import org.sxkj.desk.mapper.LeaveMapper;
import org.sxkj.desk.service.ILeaveService;
import org.sxkj.flow.core.constant.ProcessConstant;
import org.sxkj.flow.core.entity.BladeFlow;
import org.sxkj.flow.core.feign.IFlowClient;
import org.sxkj.flow.core.utils.FlowUtil;
import org.sxkj.flow.core.utils.TaskUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * 服务实现类
 *
 * @author Chill
 */
@Slf4j
@Service
@AllArgsConstructor
public class LeaveServiceImpl extends BaseServiceImpl<LeaveMapper, ProcessLeave> implements ILeaveService {
    private final IFlowClient flowClient;
    @Override
    @Transactional(rollbackFor = Exception.class)
    // @GlobalTransactional
    public boolean startProcess(ProcessLeave leave) {
        String businessTable = FlowUtil.getBusinessTable(ProcessConstant.LEAVE_KEY);
        if (Func.isEmpty(leave.getId())) {
            // 保存leave
            leave.setApplyTime(DateUtil.now());
            save(leave);
            // 启动流程
            Kv variables = Kv.create()
                .set(ProcessConstant.TASK_VARIABLE_CREATE_USER, AuthUtil.getUserName())
                .set("taskUser", TaskUtil.getTaskUser(leave.getTaskUser()))
                .set("days", DateUtil.between(leave.getStartTime(), leave.getEndTime()).toDays());
            R<BladeFlow> result = flowClient.startProcessInstanceById(leave.getProcessDefinitionId(), FlowUtil.getBusinessKey(businessTable, String.valueOf(leave.getId())), variables);
            if (result.isSuccess()) {
                log.debug("流程已启动,流程ID:" + result.getData().getProcessInstanceId());
                // 返回流程id写入leave
                leave.setProcessInstanceId(result.getData().getProcessInstanceId());
                updateById(leave);
            } else {
                throw new ServiceException("开启流程失败");
            }
        } else {
            updateById(leave);
        }
        return true;
    }
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/service/impl/NoticeServiceImpl.java
New file
@@ -0,0 +1,43 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.sxkj.desk.entity.Notice;
import org.sxkj.desk.mapper.NoticeMapper;
import org.sxkj.desk.service.INoticeService;
import org.sxkj.desk.vo.NoticeVO;
import org.springframework.stereotype.Service;
/**
 * 服务实现类
 *
 * @author Chill
 */
@Service
public class NoticeServiceImpl extends BaseServiceImpl<NoticeMapper, Notice> implements INoticeService {
    @Override
    public IPage<NoticeVO> selectNoticePage(IPage<NoticeVO> page, NoticeVO notice) {
        // 若不使用mybatis-plus自带的分页方法,则不会自动带入tenantId,所以我们需要自行注入
        notice.setTenantId(AuthUtil.getTenantId());
        return page.setRecords(baseMapper.selectNoticePage(page, notice));
    }
}
drone-service/drone-desk/src/main/java/org/sxkj/desk/wrapper/NoticeWrapper.java
New file
@@ -0,0 +1,64 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.desk.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.sxkj.desk.entity.Notice;
import org.sxkj.desk.vo.NoticeVO;
import org.sxkj.system.cache.DictCache;
import org.sxkj.system.enums.DictEnum;
import java.util.Map;
import java.util.Objects;
/**
 * Notice包装类,返回视图层所需的字段
 *
 * @author Chill
 */
public class NoticeWrapper extends BaseEntityWrapper<Notice, NoticeVO> {
    public static NoticeWrapper build() {
        return new NoticeWrapper();
    }
    @Override
    public NoticeVO entityVO(Notice notice) {
        NoticeVO noticeVO = Objects.requireNonNull(BeanUtil.copy(notice, NoticeVO.class));
        String dictValue = DictCache.getValue(DictEnum.NOTICE, noticeVO.getCategory());
        noticeVO.setCategoryName(dictValue);
        return noticeVO;
    }
    /**
     * 查询条件处理
     */
    public void noticeQuery(Map<String, Object> notice) {
        // 此场景仅在 pg数据库 map类型传参的情况下需要处理,entity传参已经包含数据类型,则无需关心
        // 针对 pg数据库 int类型字段查询需要强转的处理示例
        String searchKey = "category";
        if (Func.isNotEmpty(notice.get(searchKey))) {
            // 数据库字段为int类型,设置"="查询,具体查询参数请见 @org.springblade.core.mp.support.SqlKeyword
            notice.put(searchKey.concat("_equal"), Func.toInt(notice.get(searchKey)));
            // 默认"like"查询,pg数据库 场景会报错,所以将其删除
            notice.remove(searchKey);
        }
    }
}
drone-service/drone-desk/src/main/resources/application-dev.yml
New file
@@ -0,0 +1,11 @@
#服务器端口
server:
  port: 8105
#数据源配置
spring:
  datasource:
    url: ${blade.datasource.dev.url}
    username: ${blade.datasource.dev.username}
    password: ${blade.datasource.dev.password}
drone-service/drone-desk/src/main/resources/application-prod.yml
New file
@@ -0,0 +1,10 @@
#服务器端口
server:
  port: 8105
#数据源配置
spring:
  datasource:
    url: ${blade.datasource.prod.url}
    username: ${blade.datasource.prod.username}
    password: ${blade.datasource.prod.password}
drone-service/drone-desk/src/main/resources/application-test.yml
New file
@@ -0,0 +1,10 @@
#服务器端口
server:
  port: 8105
#数据源配置
spring:
  datasource:
    url: ${blade.datasource.test.url}
    username: ${blade.datasource.test.username}
    password: ${blade.datasource.test.password}
drone-service/pom.xml
@@ -17,6 +17,7 @@
    <description>BladeX 微服务集合</description>
    <modules>
        <module>drone-desk</module>
        <module>drone-fw</module>
        <module>drone-gd</module>
        <module>drone-system</module>
@@ -62,6 +63,20 @@
            <artifactId>jnats</artifactId>
            <version>2.11.2</version>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-core-boot</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-system-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-flow-api</artifactId>
            <version>3.4.0.RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>