Sfoglia il codice sorgente

封装考勤规则管理接口

wangdong6 4 anni fa
parent
commit
e951e5e09c
14 ha cambiato i file con 788 aggiunte e 9 eliminazioni
  1. 157 0
      security-protection-service/pom.xml
  2. 61 0
      security-protection-service/src/main/assembly/package.xml
  3. 2 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/SecurityProtectionApp.java
  4. 84 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/controller/AttendanceCommonController.java
  5. 22 3
      security-protection-service/src/main/java/com/ai/bss/security/protection/controller/attendanceRulesController.java
  6. 75 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/controller/WorkShiftController.java
  7. 90 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/AttendanceCommonServiceImpl.java
  8. 55 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/AttendanceRulesServiceImpl.java
  9. 92 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/WorkShiftServiceImpl.java
  10. 44 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/AttendanceCommonService.java
  11. 9 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/AttendanceRulesService.java
  12. 44 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/WorkShiftService.java
  13. 19 0
      security-protection-service/src/main/java/com/ai/bss/security/protection/utils/SecurityConfigSEVEN.java
  14. 34 6
      security-protection-service/src/main/resources/application.properties

+ 157 - 0
security-protection-service/pom.xml

@ -44,6 +44,65 @@
44 44
                        spring-boot-starter-security
45 45
                    </artifactId>
46 46
                </exclusion>
47
                <exclusion>
48
                    <groupId>org.springframework.boot</groupId>
49
                    <artifactId>
50
                        spring-boot-starter-test
51
                    </artifactId>
52
                </exclusion>
53
                <exclusion>
54
                    <groupId>org.hibernate</groupId>
55
                    <artifactId>
56
                        hibernate-envers
57
                    </artifactId>
58
                </exclusion>
59
            </exclusions>
60
        </dependency>
61
62
        <dependency>
63
            <groupId>com.ai.bss</groupId>
64
            <artifactId>system-user-service-api</artifactId>
65
            <version>2.1-SNAPSHOT</version>
66
        </dependency>
67
68
        <dependency>
69
            <groupId>com.ai.bss</groupId>
70
            <artifactId>work-attendance-service</artifactId>
71
            <version>2.1.5-SNAPSHOT</version>
72
            <exclusions>
73
                <exclusion>
74
                    <groupId>org.springframework.boot</groupId>
75
                    <artifactId>
76
                        spring-boot-starter-security
77
                    </artifactId>
78
                </exclusion>
79
            </exclusions>
80
        </dependency>
81
82
        <dependency>
83
            <groupId>com.ai.bss</groupId>
84
            <artifactId>work-attendance-service-api</artifactId>
85
            <version>2.1.5-SNAPSHOT</version>
86
        </dependency>
87
88
89
        <dependency>
90
            <groupId>com.ai.bss</groupId>
91
            <artifactId>work-service-api</artifactId>
92
            <version>2.1.5-SNAPSHOT</version>
93
        </dependency>
94
95
        <dependency>
96
            <groupId>com.ai.bss</groupId>
97
            <artifactId>work-service</artifactId>
98
            <version>2.1.5-SNAPSHOT</version>
99
            <exclusions>
100
                <exclusion>
101
                    <groupId>org.springframework.boot</groupId>
102
                    <artifactId>
103
                        spring-boot-starter-security
104
                    </artifactId>
105
                </exclusion>
47 106
            </exclusions>
48 107
        </dependency>
49 108
    </dependencies>
@ -69,4 +128,102 @@
69 128
            </snapshots>
70 129
        </pluginRepository>
71 130
    </pluginRepositories>
131
132
133
134
    <build>
135
136
        <resources>
137
            <resource>
138
                <directory>src/main/resources</directory>
139
            </resource>
140
        </resources>
141
142
        <plugins>
143
144
            <!-- The configuration of maven-jar-plugin -->
145
            <plugin>
146
                <groupId>org.apache.maven.plugins</groupId>
147
                <artifactId>maven-jar-plugin</artifactId>
148
                <version>2.4</version>
149
                <!-- The configuration of the plugin -->
150
                <configuration>
151
                    <!-- Configuration of the archiver -->
152
                    <archive>
153
                        <!--生成的jar中,不要包含pom.xml和pom.properties这两个文件-->
154
                        <addMavenDescriptor>false</addMavenDescriptor>
155
156
                        <!-- Manifest specific configuration -->
157
                        <manifest>
158
                            <!--是否要把第三方jar放到manifest的classpath中-->
159
                            <addClasspath>true</addClasspath>
160
                            <!--生成的manifest中classpath的前缀,因为要把第三方jar放到lib目录下,所以classpath的前缀是lib/-->
161
                            <classpathPrefix>lib/</classpathPrefix>
162
                            <!--应用的main class-->
163
                            <mainClass>com.ai.bss.security.protection.SecurityProtectionApp</mainClass>
164
                        </manifest>
165
                        <manifestEntries>
166
                            <Class-Path>./config/</Class-Path>
167
                        </manifestEntries>
168
                    </archive>
169
                    <!--过滤掉不希望包含在jar中的文件-->
170
                    <excludes>
171
                        <exclude>**/*.properties</exclude>
172
                        <exclude>**/*.xml</exclude>
173
                    </excludes>
174
                </configuration>
175
            </plugin>
176
177
            <plugin>
178
                <groupId>org.apache.maven.plugins</groupId>
179
                <artifactId>maven-dependency-plugin</artifactId>
180
                <version>2.10</version>
181
                <executions>
182
                    <execution>
183
                        <id>copy-dependencies</id>
184
                        <phase>package</phase>
185
                        <goals>
186
                            <goal>copy-dependencies</goal>
187
                        </goals>
188
                        <configuration>
189
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
190
                            <outputAbsoluteArtifactFilename></outputAbsoluteArtifactFilename>
191
                        </configuration>
192
                    </execution>
193
                </executions>
194
            </plugin>
195
196
            <!-- The configuration of maven-assembly-plugin -->
197
            <plugin>
198
                <groupId>org.apache.maven.plugins</groupId>
199
                <artifactId>maven-assembly-plugin</artifactId>
200
                <version>2.4</version>
201
                <!-- The configuration of the plugin -->
202
                <configuration>
203
                    <!-- Specifies the configuration file of the assembly plugin -->
204
                    <descriptors>
205
                        <descriptor>src/main/assembly/package.xml</descriptor>
206
                    </descriptors>
207
                </configuration>
208
                <executions>
209
                    <execution>
210
                        <id>make-assembly</id>
211
                        <phase>package</phase>
212
                        <goals>
213
                            <goal>single</goal>
214
                        </goals>
215
                    </execution>
216
                </executions>
217
            </plugin>
218
219
            <plugin>
220
                <groupId>org.apache.maven.plugins</groupId>
221
                <artifactId>maven-surefire-plugin</artifactId>
222
                <configuration>
223
                    <skip>true</skip>
224
                </configuration>
225
            </plugin>
226
        </plugins>
227
228
    </build>
72 229
</project>

+ 61 - 0
security-protection-service/src/main/assembly/package.xml

@ -0,0 +1,61 @@
1
<assembly>
2
    <id>bin</id>
3
    <!-- 最终打包成一个用于发布的zip文件 -->
4
    <formats>
5
        <format>zip</format>
6
    </formats>
7
8
    <!-- Adds dependencies to zip package under lib directory -->
9
    <dependencySets>
10
        <dependencySet>
11
            <!-- 不使用项目的artifact,第三方jar不要解压,打包进zip文件的lib目录 -->
12
            <useProjectArtifact>false</useProjectArtifact>
13
            <outputDirectory>lib</outputDirectory>
14
            <unpack>false</unpack>
15
            <scope>runtime</scope>
16
17
        </dependencySet>
18
    </dependencySets>
19
20
21
    <fileSets>
22
        <!-- 把项目相关的说明文件,打包进zip文件的根目录 -->
23
        <fileSet>
24
            <directory>${project.basedir}</directory>
25
            <outputDirectory>/</outputDirectory>
26
        <includes>
27
            <include>README*</include>
28
            <include>LICENSE*</include>
29
            <include>NOTICE*</include>
30
        </includes>
31
    </fileSet>
32
33
        <!-- 把项目的配置文件,打包进zip文件的config目录 -->
34
        <fileSet>
35
            <directory>src/main/resources</directory>
36
            <outputDirectory>/config</outputDirectory>
37
            <includes>
38
                <include>**/*.properties</include>
39
                <include>**/*.xml</include>
40
            </includes>
41
        </fileSet>
42
43
        <!-- 把项目的脚本文件目录( src/main/scripts )中的启动脚本文件,打包进zip文件的跟目录 -->
44
        <fileSet>
45
            <directory>${project.build.scriptSourceDirectory}</directory>
46
            <outputDirectory></outputDirectory>
47
            <includes>
48
                <include>startup.*</include>
49
            </includes>
50
        </fileSet>
51
52
        <!-- 把项目自己编译出来的jar文件,打包进zip文件的根目录 -->
53
        <fileSet>
54
            <directory>${project.build.directory}</directory>
55
            <outputDirectory></outputDirectory>
56
            <includes>
57
                <include>*.jar</include>
58
            </includes>
59
        </fileSet>
60
    </fileSets>
61
</assembly>

+ 2 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/SecurityProtectionApp.java

@ -6,10 +6,12 @@ import org.springframework.boot.autoconfigure.domain.EntityScan;
6 6
import org.springframework.context.annotation.ComponentScan;
7 7
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
8 8
import org.springframework.scheduling.annotation.EnableAsync;
9
import org.springframework.scheduling.annotation.EnableScheduling;
9 10
10 11
/**
11 12
 * @author zhangfeng
12 13
 */
14
13 15
@EnableJpaRepositories(basePackages = "com.ai.bss")
14 16
@EntityScan(basePackages = {"com.ai.bss","com.ai.abc"})
15 17
@ComponentScan(basePackages = {"com.ai.bss","com.ai.abc"})

+ 84 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/AttendanceCommonController.java

@ -0,0 +1,84 @@
1
package com.ai.bss.security.protection.controller;
2
3
4
import com.ai.abc.api.model.CommonRequest;
5
import com.ai.abc.api.model.CommonResponse;
6
import com.ai.bss.components.common.model.PageBean;
7
import com.ai.bss.person.model.Organization;
8
import com.ai.bss.security.protection.service.interfaces.AttendanceCommonService;
9
import com.ai.bss.user.dto.UserDto;
10
import org.springframework.beans.factory.annotation.Autowired;
11
import org.springframework.stereotype.Controller;
12
import org.springframework.web.bind.annotation.RequestBody;
13
import org.springframework.web.bind.annotation.RequestMapping;
14
import org.springframework.web.bind.annotation.ResponseBody;
15
16
import java.util.List;
17
import java.util.Map;
18
19
/**
20
 * 公共服务,包括部门、用户
21
 * @Auth wangdong
22
 */
23
@Controller
24
@RequestMapping("/workEmployee")
25
public class AttendanceCommonController {
26
27
    @Autowired
28
    AttendanceCommonService attendanceCommonService;
29
30
    /**
31
     * 查询部门列表
32
     */
33
    @ResponseBody
34
    @RequestMapping("/queryAllOrganize")
35
    public CommonResponse<List<Organization>> queryAllOrganize(@RequestBody Map<String, Object> params)  {
36
        return attendanceCommonService.queryAllOrganize(params);
37
    }
38
39
//    /**
40
//     * 分页查询所有员工信息
41
//     */
42
//    @ResponseBody
43
//    @RequestMapping("/queryWorkEmployee")
44
//    public CommonResponse<PageBean<UserDto>> queryWorkEmployee(@RequestBody(required = false) Map<String, Object> params)  {
45
//
46
//        return attendanceCommonService.queryWorkEmployee(params);
47
//    }
48
49
    /**
50
     * 分页查询用户信息
51
     */
52
    @ResponseBody
53
    @RequestMapping("/queryWorkEmployee")
54
    public CommonResponse<PageBean<UserDto>> queryWorkEmployee(@RequestBody CommonRequest<UserDto> request) throws Exception {
55
		/*UserDto userDto = new UserDto();
56
		userDto.setOrgId(params.get("orgId"));
57
		userDto.setCode(params.get("code"));
58
		userDto.setName(params.get("name"));
59
		// TODO 组织编码
60
		userDto.setOrgCode("0000");
61
62
		// 当前页数
63
		int pageNumber  = Integer.parseInt(params.get("pageNumber"));
64
		// 每页条数
65
		int pageSize = Integer.parseInt(params.get("pageSize"));
66
67
		CommonRequest<UserDto> request=new CommonRequest<UserDto>(userDto, pageNumber, pageSize);
68
*/
69
        //CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(pageNum).pageSize(pageSize).build();
70
71
        return attendanceCommonService.queryWorkEmployee(request);
72
    }
73
74
75
    /**
76
     * 查询部门下员工
77
     */
78
    @ResponseBody
79
    @RequestMapping("/queryEmployeeByOrg")
80
    public CommonResponse<List<UserDto>> queryEmployeeByOrg(@RequestBody Map<String, Object> params)  {
81
82
        return attendanceCommonService.queryEmployeeByOrg(params);
83
    }
84
}

+ 22 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/attendanceRulesController.java

@ -1,11 +1,15 @@
1 1
package com.ai.bss.security.protection.controller;
2 2
3
import com.ai.abc.api.model.CommonResponse;
3 4
import com.ai.bss.security.protection.service.interfaces.AreaInRecordService;
5
import com.ai.bss.security.protection.service.interfaces.AttendanceRulesService;
6
import com.ai.bss.work.attendance.service.api.inparam.AttendanceRuleParams;
4 7
import com.github.pagehelper.PageInfo;
5 8
import org.slf4j.Logger;
6 9
import org.slf4j.LoggerFactory;
7 10
import org.springframework.beans.factory.annotation.Autowired;
8 11
import org.springframework.stereotype.Controller;
12
import org.springframework.web.bind.annotation.RequestBody;
9 13
import org.springframework.web.bind.annotation.RequestMapping;
10 14
import org.springframework.web.bind.annotation.ResponseBody;
11 15
@ -14,15 +18,18 @@ import java.util.Map;
14 18
15 19
/**
16 20
 * 考勤规则
21
 * @Auth wangdong
17 22
 */
18 23
@Controller
19 24
@RequestMapping("/attendanceRules")
20
public class attendanceRulesController {
21
	Logger logger = LoggerFactory.getLogger(attendanceRulesController.class);
25
public class AttendanceRulesController {
22 26
23 27
	@Autowired
24 28
	AreaInRecordService areaInRecordService;
25 29
30
	@Autowired
31
	AttendanceRulesService attendanceRulesService;
32
26 33
	/**
27 34
	 * 分页查询考勤统计分析
28 35
	 */
@ -39,8 +46,20 @@ public class attendanceRulesController {
39 46
		}
40 47
		PageInfo pageInfo = areaInRecordService.queryPageAttendanceCount(params, pageNum, pageSize);
41 48
42
43 49
		return pageInfo;
44 50
45 51
	}
52
53
	/**
54
	 * 创建考勤规则
55
	 * @param attendanceRuleParams
56
	 * @return
57
	 * @throws Exception
58
	 */
59
	@ResponseBody
60
	@RequestMapping("/createAttendanceRule")
61
	public CommonResponse createAttendanceRule(@RequestBody AttendanceRuleParams attendanceRuleParams) throws Exception {
62
63
		return attendanceRulesService.createAttendanceRule(attendanceRuleParams);
64
	}
46 65
}

+ 75 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/WorkShiftController.java

@ -0,0 +1,75 @@
1
package com.ai.bss.security.protection.controller;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.security.protection.service.interfaces.WorkShiftService;
6
import com.ai.bss.work.task.model.common.WorkShift;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.stereotype.Controller;
9
import org.springframework.web.bind.annotation.RequestBody;
10
import org.springframework.web.bind.annotation.RequestMapping;
11
import org.springframework.web.bind.annotation.ResponseBody;
12
13
import java.util.Map;
14
15
@Controller
16
@RequestMapping("/workShift")
17
public class WorkShiftController {
18
19
20
    @Autowired
21
    private WorkShiftService workShiftService;
22
23
    /**
24
     * 创建班次
25
     * @param workShift
26
     * @return
27
     * @throws Exception
28
     */
29
    @ResponseBody
30
    @RequestMapping("/createWorkShift")
31
    public CommonResponse createWorkShift(@RequestBody WorkShift workShift) throws Exception {
32
33
         workShiftService.createWorkShift(workShift);
34
        return CommonResponse.OK_VOID;
35
    }
36
37
    /**
38
     * 修改班次
39
     * @param workShift
40
     * @return
41
     * @throws Exception
42
     */
43
    @ResponseBody
44
    @RequestMapping("/modifyWorkShift")
45
    public CommonResponse modifyWorkShift(@RequestBody WorkShift workShift) throws Exception {
46
47
        return workShiftService.modifyWorkShift(workShift);
48
    }
49
50
    /**
51
     * 删除班次
52
     * @param workShift
53
     * @return
54
     * @throws Exception
55
     */
56
    @ResponseBody
57
    @RequestMapping("/deleteWorkShift")
58
    public CommonResponse deleteWorkShift(@RequestBody WorkShift workShift) throws Exception {
59
60
        return workShiftService.deleteWorkShift(workShift);
61
    }
62
63
    /**
64
     * 查询班次列表
65
     * @param conditionMapRequest
66
     * @return
67
     * @throws Exception
68
     */
69
    @ResponseBody
70
    @RequestMapping("/queryWorkShiftForPage")
71
    public CommonResponse queryWorkShiftForPage(@RequestBody CommonRequest<Map<String, Object>> conditionMapRequest) throws Exception {
72
73
        return workShiftService.queryWorkShiftForPage(conditionMapRequest);
74
    }
75
}

+ 90 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/AttendanceCommonServiceImpl.java

@ -0,0 +1,90 @@
1
package com.ai.bss.security.protection.service.impl;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.components.common.constant.CommonConstant;
6
import com.ai.bss.components.common.model.PageBean;
7
import com.ai.bss.person.model.Organization;
8
import com.ai.bss.person.service.api.OrganizationQuery;
9
import com.ai.bss.security.protection.service.interfaces.AttendanceCommonService;
10
import com.ai.bss.user.dto.UserDto;
11
import com.ai.bss.user.service.api.EmployeeService;
12
import com.ai.bss.user.service.api.UserDtoQuery;
13
import lombok.extern.slf4j.Slf4j;
14
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.stereotype.Service;
16
17
import java.util.List;
18
import java.util.Map;
19
20
@Slf4j
21
@Service
22
public class AttendanceCommonServiceImpl implements AttendanceCommonService {
23
24
    @Autowired
25
    private UserDtoQuery userDtoQuery;
26
27
    @Autowired
28
    private OrganizationQuery organizationQuery;
29
30
    @Autowired
31
    private EmployeeService employeeService;
32
33
    @Override
34
    public CommonResponse<PageBean<UserDto>> queryWorkEmployee(Map<String, Object> params)  {
35
        String orgCode = (!(params.get("orgCode") == null || "".equals(params.get("orgCode")))) ? (String) params.get("orgCode") : null;
36
        String orgId = (!(params.get("orgId") == null || "".equals(params.get("orgId")))) ? (String) params.get("orgId") : null;
37
        String employeeId = (!(params.get("employeeId") == null || "".equals(params.get("employeeId")))) ? (String) params.get("employeeId") : null;
38
        String employeeName = (!(params.get("employeeName") == null || "".equals(params.get("employeeName")))) ? (String) params.get("employeeName") : null;
39
        String employeeCode = (!(params.get("employeeCode") == null || "".equals(params.get("employeeCode")))) ? (String) params.get("employeeCode") : null;
40
41
        UserDto userDto = new UserDto();
42
        userDto.setOrgCode(orgCode);
43
        userDto.setOrgId(orgId);
44
        userDto.setId(employeeId);
45
        userDto.setName(employeeName);
46
        userDto.setCode(employeeCode);
47
48
        CommonRequest<UserDto> request2=new CommonRequest<UserDto>(userDto);
49
        return userDtoQuery.queryWorkEmployee(request2);
50
    }
51
52
    @Override
53
    public CommonResponse<PageBean<UserDto>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception {
54
        // TODO 组织编码
55
        //request.getData().setOrgCode("0000");
56
        return userDtoQuery.queryWorkEmployee(request);
57
    }
58
59
    @Override
60
    public CommonResponse<List<Organization>> queryAllOrganize(Map<String, Object> params) {
61
        Organization organize = new Organization();
62
        //1:只查有效的;0:查全部的
63
        organize.setDataStatus(CommonConstant.STATUS_NORMAL_STR);
64
65
        String orgName = (!(params.get("name") == null || "".equals(params.get("name")))) ? (String) params.get("name") : null;
66
67
        organize.setName(orgName);
68
        CommonRequest<Organization> commonRequest = CommonRequest.<Organization>builder().data(organize).build();
69
        return organizationQuery.queryAllOrganize(commonRequest);
70
    }
71
72
    @Override
73
    public CommonResponse<List<UserDto>> queryEmployeeByOrg(Map<String, Object> params)  {
74
75
        UserDto userDto = new UserDto();
76
        String username = (!(params.get("name") == null || "".equals(params.get("name")))) ? (String) params.get("name") : null;
77
        String orgId = (!(params.get("orgId") == null || "".equals(params.get("orgId")))) ? (String) params.get("orgId") : null;
78
        String orgCode = (!(params.get("orgCode") == null || "".equals(params.get("orgCode")))) ? (String) params.get("orgCode") : null;
79
//        int pageNumber = (!(params.get("pageNumber") == null || "".equals(params.get("pageNumber")))) ? (Integer) params.get("pageNumber") : 1;
80
//        int pageSize = (!(params.get("pageSize") == null || "".equals(params.get("pageSize")))) ? (Integer) params.get("pageSize") : 10;
81
        userDto.setName(username);
82
        userDto.setOrgId(orgId);
83
        userDto.setOrgCode(orgCode);
84
//        CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).pageNumber(pageNumber).pageSize(pageSize).build();
85
        CommonRequest<UserDto> request = CommonRequest.<UserDto>builder().data(userDto).build();
86
87
        return userDtoQuery.queryWorkEmployeeByOrg(request);
88
    }
89
90
}

+ 55 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/AttendanceRulesServiceImpl.java

@ -0,0 +1,55 @@
1
package com.ai.bss.security.protection.service.impl;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.components.common.util.JsonUtils;
6
import com.ai.bss.security.protection.service.interfaces.AttendanceRulesService;
7
import com.ai.bss.work.attendance.service.api.AttendanceCommand;
8
import com.ai.bss.work.attendance.service.api.inparam.AttendanceRuleParams;
9
import lombok.extern.slf4j.Slf4j;
10
import org.springframework.beans.factory.annotation.Autowired;
11
import org.springframework.stereotype.Service;
12
13
@Slf4j
14
@Service
15
public class AttendanceRulesServiceImpl implements AttendanceRulesService {
16
17
    @Autowired
18
    AttendanceCommand attendanceCommand;
19
20
21
    @Override
22
    public CommonResponse createAttendanceRule(AttendanceRuleParams attendanceRuleParams) throws Exception {
23
24
//        AttendanceRuleParams
25
//        "attendanceTaskSpec":{
26
//            "goToWorkAheadMinutes": 60,
27
//                    "goToWorkPostponeMinutes": 20,
28
//                    "goToWorkDeadLine": 60,
29
//                    "goOffWorkAheadMinutes": 60,
30
//                    "goOffWorkPostponeMinutes": 10,
31
//                    "g0OffWorkDeadLine": 30,
32
//                    "allowFieldClocking": "0",
33
//                    "lateAlarmThreshold": 5,
34
//                    "earlyExitAlarmThreshold": 5,
35
//                    "absentAlarmThreshold": 3,
36
//                    "workTaskSpecId": "",
37
//                    "workTaskSpecTypeId": "CLOCKING",
38
//                    "name": "打卡",
39
//                    "charValueSet": "{}"
40
//        },
41
//        "workTaskSpecPlan":{
42
//            "workOrgRoleId": "1",
43
//            "planMemo": "测试计划",
44
//            "planCycleType": "NAT_MON",
45
//            "workShiftId": 0
46
//        }
47
48
49
50
        CommonResponse runningResult =  attendanceCommand.createAttendanceRule(new CommonRequest<>(attendanceRuleParams));
51
//        return runningResult;
52
        log.info("runningResult: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
53
        return runningResult;
54
    }
55
}

+ 92 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/WorkShiftServiceImpl.java

@ -0,0 +1,92 @@
1
package com.ai.bss.security.protection.service.impl;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.components.common.util.JsonUtils;
6
import com.ai.bss.security.protection.service.interfaces.WorkShiftService;
7
import com.ai.bss.work.service.api.WorkShiftCommand;
8
import com.ai.bss.work.service.api.WorkShiftQuery;
9
import com.ai.bss.work.task.model.common.WorkShift;
10
import com.alibaba.fastjson.JSON;
11
import com.alibaba.fastjson.serializer.SerializerFeature;
12
import lombok.extern.slf4j.Slf4j;
13
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.stereotype.Service;
15
16
import java.util.ArrayList;
17
import java.util.List;
18
import java.util.Map;
19
20
@Slf4j
21
@Service
22
public class WorkShiftServiceImpl implements WorkShiftService {
23
24
//    @Autowired
25
//    AttendanceCommand attendanceCommand;
26
27
    @Autowired
28
    WorkShiftCommand workShiftCommand;
29
30
    @Autowired
31
    WorkShiftQuery workShiftQuery;
32
33
34
    @Override
35
    public CommonResponse createWorkShift(WorkShift workShift) throws Exception {
36
37
        CommonRequest<WorkShift> requestWorkShift = new CommonRequest(workShift);
38
        log.info("requestWorkShift: \n{}", JSON.toJSONString(requestWorkShift, true));
39
        CommonResponse runningResult = workShiftCommand.createWorkShift(requestWorkShift);
40
        log.info("runningResult: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
41
        return runningResult;
42
    }
43
44
    @Override
45
    public CommonResponse modifyWorkShift(WorkShift workShift) throws Exception {
46
47
        CommonRequest<WorkShift> requestWorkShift = new CommonRequest(workShift);
48
        log.info("requestWorkShift: \n{}", JSON.toJSONString(requestWorkShift, true));
49
        CommonResponse runningResult = workShiftCommand.modifyWorkShift(requestWorkShift);
50
        log.info("runningResult: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
51
        return runningResult;
52
    }
53
54
    @Override
55
    public CommonResponse deleteWorkShift(WorkShift workShift) throws Exception {
56
57
        if(workShift == null || workShift.getWorkShiftId()==null){
58
            throw new Exception("WorkShiftId be not null!");
59
        }
60
        List<Long> WorkShiftIdList = new ArrayList<>();
61
        WorkShiftIdList.add(workShift.getWorkShiftId());
62
63
        CommonRequest<List<Long>> workShiftRequest = new CommonRequest(WorkShiftIdList);
64
        log.info("requestWorkShift: \n{}", JSON.toJSONString(workShiftRequest, true));
65
        CommonResponse runningResult = workShiftCommand.deleteWorkShift(workShiftRequest);
66
        log.info("runningResult: \n{}", JsonUtils.toJSONStringByDateFormat(runningResult, true));
67
68
69
70
71
        return runningResult;
72
    }
73
74
    @Override
75
    public CommonResponse<List<WorkShift>> queryWorkShiftForPage(CommonRequest<Map<String, Object>> conditionMapRequest) {
76
77
//        String orgId = (!(params.get("orgId") == null || "".equals(params.get("orgId")))) ? (String) params.get("orgId") : null;
78
79
        log.info("requestWorkShift: \n{}", JSON.toJSONString(conditionMapRequest, true));
80
81
        return null;// workShiftQuery.queryWorkShift(new CommonRequest<>(null));
82
    }
83
84
    public static String toJSONStringByDateFormat(Object object, boolean perttyFormat) {
85
        JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
86
        if (perttyFormat) {
87
            return JSON.toJSONString(object, SerializerFeature.WriteDateUseDateFormat, SerializerFeature.PrettyFormat);
88
        } else {
89
            return JSON.toJSONString(object, SerializerFeature.WriteDateUseDateFormat);
90
        }
91
    }
92
}

+ 44 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/AttendanceCommonService.java

@ -0,0 +1,44 @@
1
package com.ai.bss.security.protection.service.interfaces;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.components.common.model.PageBean;
6
import com.ai.bss.person.model.Organization;
7
import com.ai.bss.user.dto.UserDto;
8
9
import java.util.List;
10
import java.util.Map;
11
12
public interface AttendanceCommonService {
13
    /**
14
     * 人员列表分页查询
15
     * @param request
16
     * @return
17
     * @throws Exception
18
     */
19
    CommonResponse<PageBean<UserDto>> queryWorkEmployee(Map<String, Object> params) ;
20
21
22
23
    /**
24
     * 人员列表分页查询
25
     * @param request
26
     * @return
27
     * @throws Exception
28
     */
29
    CommonResponse<PageBean<UserDto>> queryWorkEmployee(CommonRequest<UserDto> request) throws Exception;
30
31
    /**
32
     * 查询所有部门(课通过name过滤)
33
     * @param params{"name":""}
34
     * @return
35
     */
36
    CommonResponse<List<Organization>> queryAllOrganize(Map<String, Object> params);
37
38
    /**
39
     * 根据orgId查询该部门下员工(可同时支持员工姓名过滤)
40
     * @param params{"orgId":"","name":""}
41
     * @return
42
     */
43
    CommonResponse<List<UserDto>> queryEmployeeByOrg(Map<String, Object> params);
44
}

+ 9 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/AttendanceRulesService.java

@ -0,0 +1,9 @@
1
package com.ai.bss.security.protection.service.interfaces;
2
3
import com.ai.abc.api.model.CommonResponse;
4
import com.ai.bss.work.attendance.service.api.inparam.AttendanceRuleParams;
5
6
public interface AttendanceRulesService {
7
8
    CommonResponse createAttendanceRule(AttendanceRuleParams attendanceRuleParams) throws Exception;
9
}

+ 44 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/WorkShiftService.java

@ -0,0 +1,44 @@
1
package com.ai.bss.security.protection.service.interfaces;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.work.attendance.service.api.inparam.AttendanceRuleParams;
6
import com.ai.bss.work.task.model.common.WorkShift;
7
8
import java.util.List;
9
import java.util.Map;
10
11
public interface WorkShiftService {
12
13
    /**
14
     * 创建班次
15
     * @param workShift
16
     * @return
17
     * @throws Exception
18
     */
19
    CommonResponse createWorkShift(WorkShift workShift) throws Exception;
20
21
    /**
22
     * 修改班次
23
     * @param workShift
24
     * @return
25
     * @throws Exception
26
     */
27
    CommonResponse modifyWorkShift(WorkShift workShift) throws Exception;
28
29
    /**
30
     * 删除班次
31
     * @param workShift
32
     * @return
33
     * @throws Exception
34
     */
35
    CommonResponse deleteWorkShift(WorkShift workShift) throws Exception;
36
37
38
    /**
39
     * 查询班次信息
40
     * @param conditionMapRequest
41
     * @return
42
     */
43
    CommonResponse<List<WorkShift>> queryWorkShiftForPage(CommonRequest<Map<String, Object>> conditionMapRequest);
44
}

+ 19 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/utils/SecurityConfigSEVEN.java

@ -0,0 +1,19 @@
1
//package com.ai.bss.security.protection.utils;
2
//
3
//import org.springframework.context.annotation.Configuration;
4
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
5
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
6
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
7
//
8
//@Configuration
9
//@EnableWebSecurity
10
//public class SecurityConfigSEVEN extends WebSecurityConfigurerAdapter {
11
//
12
//    @Override
13
//    protected void configure(HttpSecurity http) throws Exception {
14
//        //super.configure(http);
15
//        //配置不需要登陆验证
16
//        http.authorizeRequests().anyRequest().permitAll().and().logout().permitAll();
17
//    }
18
//}
19
//

+ 34 - 6
security-protection-service/src/main/resources/application.properties

@ -1,12 +1,14 @@
1 1
spring.application.name=WorkTaskSpec
2
server.port=8086
2
server.port=8018
3
4
server.servlet.context-path=/sp
3 5
4 6
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
5 7
#spring.datasource.url=jdbc:mysql://localhost:3306/cmp
6
spring.datasource.url=jdbc:mysql://10.11.20.120:3306/common_frm?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&verifyServerCertificate=false&useSSL=false&requireSSL=false
8
spring.datasource.url=jdbc:mysql://10.19.90.34:3307/energy?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&verifyServerCertificate=false&useSSL=false&requireSSL=false
7 9
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
8
spring.datasource.username=comon_frm
9
spring.datasource.password=1qaz@WSX
10
spring.datasource.username=ebc
11
spring.datasource.password=ebc@123
10 12
11 13
# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
12 14
#spring.jpa.database=default
@ -17,10 +19,36 @@ spring.jpa.properties.hibernate.format_sql=true
17 19
spring.jpa.properties.hibernate.generate_statistics=false
18 20
spring.main.allow-bean-definition-overriding=true
19 21
22
#kafka
23
kafka.bootstrap-servers=47.105.160.21:9090
24
#kafka.bootstrap-servers=10.19.90.34:2182
25
#kafka.topic.deviceLocation=Topic_IoT_DeviceLocation
26
#kafka.topic.alarm=Topic_IoT_IndividualAlarm
27
kafka.topic.deviceLocation=DeviceLocationA
28
kafka.topic.alarm=IndividualAlarmA
29
kafka.producer.batch-size=16785
30
kafka.producer.retries=1
31
kafka.producer.buffer-memory=33554432
32
kafka.producer.linger=1
33
kafka.consumer.auto-offset-reset=latest
34
kafka.consumer.max-poll-records=3100
35
kafka.consumer.enable-auto-commit=false
36
kafka.consumer.auto-commit-interval=1000
37
kafka.consumer.session-timeout=20000
38
kafka.consumer.max-poll-interval=15000
39
kafka.consumer.max-partition-fetch-bytes=15728640
40
kafka.listener.batch-listener=false
41
kafka.listener.concurrencys=3,6
42
kafka.listener.poll-timeout=1500
43
44
20 45
# CACHE
21 46
#spring.cache.type=ehcache
22 47
#spring.cache.ehcache.config=ehcache.xml
23 48
24 49
# LOGGING
25
logging.level.com.ai=info
26
logging.level.org.springframework.data=info
50
logging.level.com.ai=debug
51
logging.level.org.springframework.data=debug
52
53
# \u5f15\u5165gis\u548ciot\u7684\u914d\u7f6e\u6587\u4ef6
54
spring.profiles.active=iot,gis