diff --git a/.gitignore b/.gitignore index 84adb3f8..3f9b83f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,18 @@ -# ---> Java -# Compiled class file -*.class +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildMumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* +**/mvnw +**/mvnw.cmd +**/.mvn +**/target/ +.idea +**/.gitignore \ No newline at end of file diff --git a/dq-financial-api/dq-financial-api.iml b/dq-financial-api/dq-financial-api.iml new file mode 100644 index 00000000..6f583860 --- /dev/null +++ b/dq-financial-api/dq-financial-api.iml @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-api/pom.xml b/dq-financial-api/pom.xml new file mode 100644 index 00000000..846f0a4a --- /dev/null +++ b/dq-financial-api/pom.xml @@ -0,0 +1,50 @@ + + + + financial + com.daqing.financial + 0.0.1-SNAPSHOT + + 4.0.0 + + com.daqing.financial + dq-financial-api + + 系统API统一定义 + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + com.daqing.framework + dq-framework-model + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + 2.1.8.RELEASE + + + io.springfox + springfox-swagger2 + 2.9.2 + + + io.springfox + springfox-swagger-ui + 2.9.2 + + + org.springframework.boot + spring-boot-starter-test + 2.1.8.RELEASE + test + + + \ No newline at end of file diff --git a/dq-financial-crms-auth/pom.xml b/dq-financial-crms-auth/pom.xml new file mode 100644 index 00000000..e2266989 --- /dev/null +++ b/dq-financial-crms-auth/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.8.RELEASE + + + com.daqing.financial + dq-financial-crms-auth + 0.0.1-SNAPSHOT + dq-financial-crms-auth + 大庆智慧金融平台-客户资源认证服务 + + + 1.8 + Greenwich.SR3 + + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + com.daqing.framework + dq-framework-model + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/dq-financial-crms-auth/src/main/java/com/daqing/financial/crauth/DqFinancialCrmsAuthApplication.java b/dq-financial-crms-auth/src/main/java/com/daqing/financial/crauth/DqFinancialCrmsAuthApplication.java new file mode 100644 index 00000000..76c68c1b --- /dev/null +++ b/dq-financial-crms-auth/src/main/java/com/daqing/financial/crauth/DqFinancialCrmsAuthApplication.java @@ -0,0 +1,13 @@ +package com.daqing.financial.crauth; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DqFinancialCrmsAuthApplication { + + public static void main(String[] args) { + SpringApplication.run(DqFinancialCrmsAuthApplication.class, args); + } + +} diff --git a/dq-financial-crms-auth/src/main/resources/application.properties b/dq-financial-crms-auth/src/main/resources/application.properties new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/dq-financial-crms-auth/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/dq-financial-crms-auth/src/test/java/com/daqing/financial/crauth/DqFinancialCrmsAuthApplicationTests.java b/dq-financial-crms-auth/src/test/java/com/daqing/financial/crauth/DqFinancialCrmsAuthApplicationTests.java new file mode 100644 index 00000000..01d5991d --- /dev/null +++ b/dq-financial-crms-auth/src/test/java/com/daqing/financial/crauth/DqFinancialCrmsAuthApplicationTests.java @@ -0,0 +1,13 @@ +package com.daqing.financial.crauth; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DqFinancialCrmsAuthApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/dq-financial-crms/pom.xml b/dq-financial-crms/pom.xml new file mode 100644 index 00000000..7a666471 --- /dev/null +++ b/dq-financial-crms/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.8.RELEASE + + + com.daqing.financial + dq-financial-crms + 0.0.1-SNAPSHOT + dq-financial-crms + 大庆智慧金融平台-客户资源管理服务 + + + 1.8 + Greenwich.SR3 + + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + com.daqing.framework + dq-framework-model + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/DqFinancialCrmsApplication.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/DqFinancialCrmsApplication.java new file mode 100644 index 00000000..a9afcab8 --- /dev/null +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/DqFinancialCrmsApplication.java @@ -0,0 +1,17 @@ +package com.daqing.financial.crms; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +@EnableFeignClients(basePackages = "com.daqing.financial.crms.feign") +@EnableDiscoveryClient +@SpringBootApplication +public class DqFinancialCrmsApplication { + + public static void main(String[] args) { + SpringApplication.run(DqFinancialCrmsApplication.class, args); + } + +} diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/contoller/TestFeignController.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/contoller/TestFeignController.java new file mode 100644 index 00000000..d632823e --- /dev/null +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/contoller/TestFeignController.java @@ -0,0 +1,53 @@ +package com.daqing.financial.crms.contoller; + +import com.daqing.financial.crms.feign.HrmsFeignService; +import com.daqing.framework.model.response.ResponseResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 记录部门信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@RestController +@RequestMapping("crms") +public class TestFeignController { + + @Autowired + HrmsFeignService hrmsFeignService; + + /** + * 列表 + */ + @GetMapping("/list") + //@RequiresPermissions("hrms:dept:list") + public ResponseResult list() { + List list = new ArrayList<>(); + list.add("张三"); + list.add("李四"); + list.add("王五"); + list.add("赵六"); + list.add("孙七"); + return new ResponseResult(true, 200, list, "success"); + } + + /** + * 列表 + */ + @GetMapping("/hrms_list") + //@RequiresPermissions("hrms:dept:list") + public ResponseResult hrmsList() { + Map params = new HashMap<>(); + return hrmsFeignService.list(params); + } +} diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java new file mode 100644 index 00000000..afb44b8f --- /dev/null +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java @@ -0,0 +1,19 @@ +package com.daqing.financial.crms.feign; + +import com.daqing.framework.model.response.ResponseResult; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.Map; + +/** + * 这是一个声明式的远程调用 + */ +@FeignClient("dq-financial-hrms") +public interface HrmsFeignService { + + @GetMapping("/hrms/dept/list") + public ResponseResult list(@RequestParam Map params); + +} diff --git a/dq-financial-crms/src/main/resources/bootstrap.properties b/dq-financial-crms/src/main/resources/bootstrap.properties new file mode 100644 index 00000000..95bb071b --- /dev/null +++ b/dq-financial-crms/src/main/resources/bootstrap.properties @@ -0,0 +1,18 @@ +#服务名称 +spring.application.name=dq-financial-crms +#配置中心地址 +spring.cloud.nacos.config.server-addr=192.168.31.142:8848 +spring.cloud.nacos.config.namespace=1f69d47e-0aeb-4a1e-8ab4-0e84dfb86354 +#spring.cloud.nacos.config.group=prod + +spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml +spring.cloud.nacos.config.ext-config[0].group=dev +spring.cloud.nacos.config.ext-config[0].refresh=true + +spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml +spring.cloud.nacos.config.ext-config[1].group=dev +spring.cloud.nacos.config.ext-config[1].refresh=true + +spring.cloud.nacos.config.ext-config[2].data-id=other.yml +spring.cloud.nacos.config.ext-config[2].group=dev +spring.cloud.nacos.config.ext-config[2].refresh=true \ No newline at end of file diff --git a/dq-financial-crms/src/test/java/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.java b/dq-financial-crms/src/test/java/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.java new file mode 100644 index 00000000..11bb9c8f --- /dev/null +++ b/dq-financial-crms/src/test/java/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.java @@ -0,0 +1,13 @@ +package com.daqing.financial.crms; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DqFinancialCrmsApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/dq-financial-guarantee/pom.xml b/dq-financial-guarantee/pom.xml new file mode 100644 index 00000000..5fc6172d --- /dev/null +++ b/dq-financial-guarantee/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.8.RELEASE + + + com.daqing.financial + dq-financial-guarantee + 0.0.1-SNAPSHOT + dq-financial-guarantee + 大庆智慧金融平台-担保业务服务 + + + 1.8 + Greenwich.SR3 + + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + com.daqing.framework + dq-framework-model + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplication.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplication.java new file mode 100644 index 00000000..85b79c03 --- /dev/null +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplication.java @@ -0,0 +1,13 @@ +package com.daqing.financial.guarantee; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DqFinancialGuaranteeApplication { + + public static void main(String[] args) { + SpringApplication.run(DqFinancialGuaranteeApplication.class, args); + } + +} diff --git a/dq-financial-guarantee/src/main/resources/application.properties b/dq-financial-guarantee/src/main/resources/application.properties new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/dq-financial-guarantee/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/dq-financial-guarantee/src/test/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplicationTests.java b/dq-financial-guarantee/src/test/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplicationTests.java new file mode 100644 index 00000000..fa202884 --- /dev/null +++ b/dq-financial-guarantee/src/test/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplicationTests.java @@ -0,0 +1,13 @@ +package com.daqing.financial.guarantee; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DqFinancialGuaranteeApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/dq-financial-hrms-auth/pom.xml b/dq-financial-hrms-auth/pom.xml new file mode 100644 index 00000000..eafd1d2a --- /dev/null +++ b/dq-financial-hrms-auth/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.8.RELEASE + + + com.daqing.financial + dq-financial-hrms-auth + 0.0.1-SNAPSHOT + dq-financial-hrms-auth + 大庆智慧金融平台-人资用户认证服务 + + + 1.8 + Greenwich.SR3 + + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + com.daqing.framework + dq-framework-model + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/DqFinancialHrmsAuthApplication.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/DqFinancialHrmsAuthApplication.java new file mode 100644 index 00000000..3a5828a1 --- /dev/null +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/DqFinancialHrmsAuthApplication.java @@ -0,0 +1,13 @@ +package com.daqing.financial.hrauth; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DqFinancialHrmsAuthApplication { + + public static void main(String[] args) { + SpringApplication.run(DqFinancialHrmsAuthApplication.class, args); + } + +} diff --git a/dq-financial-hrms-auth/src/main/resources/application.properties b/dq-financial-hrms-auth/src/main/resources/application.properties new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/dq-financial-hrms-auth/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/dq-financial-hrms-auth/src/test/java/com/daqing/financial/hrauth/DqFinancialHrmsAuthApplicationTests.java b/dq-financial-hrms-auth/src/test/java/com/daqing/financial/hrauth/DqFinancialHrmsAuthApplicationTests.java new file mode 100644 index 00000000..a39aa46e --- /dev/null +++ b/dq-financial-hrms-auth/src/test/java/com/daqing/financial/hrauth/DqFinancialHrmsAuthApplicationTests.java @@ -0,0 +1,13 @@ +package com.daqing.financial.hrauth; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DqFinancialHrmsAuthApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/dq-financial-hrms/pom.xml b/dq-financial-hrms/pom.xml new file mode 100644 index 00000000..d0edb1f3 --- /dev/null +++ b/dq-financial-hrms/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.8.RELEASE + + + com.daqing.financial + dq-financial-hrms + 0.0.1-SNAPSHOT + dq-financial-hrms + 大庆智慧金融平台-人力资源管理服务 + + + 1.8 + Greenwich.SR3 + + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + com.daqing.framework + dq-framework-model + 1.0-SNAPSHOT + + + com.daqing.framework + dq-framework-utils + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/DqFinancialHrmsApplication.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/DqFinancialHrmsApplication.java new file mode 100644 index 00000000..aab52da0 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/DqFinancialHrmsApplication.java @@ -0,0 +1,17 @@ +package com.daqing.financial.hrms; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +@EnableFeignClients(basePackages = "com.daqing.financial.hrms.feign") +@EnableDiscoveryClient +@SpringBootApplication +public class DqFinancialHrmsApplication { + + public static void main(String[] args) { + SpringApplication.run(DqFinancialHrmsApplication.class, args); + } + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java new file mode 100644 index 00000000..f706e90e --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java @@ -0,0 +1,97 @@ +package com.daqing.financial.hrms.controller; + +import java.util.Arrays; +import java.util.Map; + +import com.daqing.financial.hrms.feign.CrmsFeignService; +import com.daqing.framework.model.response.ResponseResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import com.daqing.framework.domain.hrms.DeptEntity; +import com.daqing.financial.hrms.service.DeptService; +import com.daqing.framework.utils.PageUtils; + +/** + * 记录部门信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@RestController +@RequestMapping("hrms/dept") +public class DeptController { + + @Autowired + private DeptService deptService; + + @Autowired + private CrmsFeignService crmsFeignService; + + /** + * 测试远程调用 + */ + @GetMapping("/crms_list") + //@RequiresPermissions("hrms:dept:list") + public ResponseResult crmsList(){ + return crmsFeignService.list(); + } + + /** + * 列表 + */ + @GetMapping("/list") + //@RequiresPermissions("hrms:dept:list") + public ResponseResult list(@RequestParam Map params){ + PageUtils page = deptService.queryPage(params); + + return ResponseResult.SUCCESS(); + } + + + /** + * 信息 + */ + @GetMapping("/info/{id}") + //@RequiresPermissions("hrms:dept:info") + public ResponseResult info(@PathVariable("id") Long id){ + DeptEntity dept = deptService.getById(id); + + return ResponseResult.SUCCESS(); + } + + /** + * 保存 + */ + @PostMapping("/save") + //@RequiresPermissions("hrms:dept:save") + public ResponseResult save(@RequestBody DeptEntity dept){ + deptService.save(dept); + + return ResponseResult.SUCCESS(); + } + + /** + * 修改 + */ + @PutMapping("/update") + //@RequiresPermissions("hrms:dept:update") + public ResponseResult update(@RequestBody DeptEntity dept){ + deptService.updateById(dept); + + return ResponseResult.SUCCESS(); + } + + /** + * 删除 + */ + @DeleteMapping("/delete") + //@RequiresPermissions("hrms:dept:delete") + public ResponseResult delete(@RequestBody Long[] ids){ + deptService.removeByIds(Arrays.asList(ids)); + + return ResponseResult.SUCCESS(); + } + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java new file mode 100644 index 00000000..9c3dfe57 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java @@ -0,0 +1,81 @@ +package com.daqing.financial.hrms.controller; + +import com.daqing.financial.hrms.service.EmployeeService; +import com.daqing.framework.domain.hrms.EmployeeEntity; +import com.daqing.framework.model.response.ResponseResult; +import com.daqing.framework.utils.PageUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Map; + + +/** + * 记录员工的基本信息,如姓名、电话、部门等 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@RestController +@RequestMapping("hrms/employee") +public class EmployeeController { + @Autowired + private EmployeeService employeeService; + + /** + * 列表 + */ + @GetMapping("/list") + //@RequiresPermissions("hrms:employee:list") + public ResponseResult list(@RequestParam Map params) { + PageUtils page = employeeService.queryPage(params); + return ResponseResult.SUCCESS(); + } + + + /** + * 信息 + */ + @GetMapping("/info/{id}") + //@RequiresPermissions("hrms:employee:info") + public ResponseResult info(@PathVariable("id") Long id) { + EmployeeEntity employee = employeeService.getById(id); + return ResponseResult.SUCCESS(); + } + + /** + * 保存 + */ + @PostMapping("/save") + //@RequiresPermissions("hrms:employee:save") + public ResponseResult save(@RequestBody EmployeeEntity employee) { + employeeService.save(employee); + + return ResponseResult.SUCCESS(); + } + + /** + * 修改 + */ + @PutMapping("/update") + //@RequiresPermissions("hrms:employee:update") + public ResponseResult update(@RequestBody EmployeeEntity employee) { + employeeService.updateById(employee); + + return ResponseResult.SUCCESS(); + } + + /** + * 删除 + */ + @DeleteMapping("/delete") + //@RequiresPermissions("hrms:employee:delete") + public ResponseResult delete(@RequestBody Long[] ids) { + employeeService.removeByIds(Arrays.asList(ids)); + + return ResponseResult.SUCCESS(); + } + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PermissionController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PermissionController.java new file mode 100644 index 00000000..7d4d4d2a --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PermissionController.java @@ -0,0 +1,83 @@ +package com.daqing.financial.hrms.controller; + +import com.daqing.financial.hrms.service.PermissionService; +import com.daqing.framework.domain.hrms.PermissionEntity; +import com.daqing.framework.model.response.ResponseResult; +import com.daqing.framework.utils.PageUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Map; + + +/** + * 记录菜单权限 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@RestController +@RequestMapping("hrms/permission") +public class PermissionController { + @Autowired + private PermissionService permissionService; + + /** + * 列表 + */ + @GetMapping("/list") + //@RequiresPermissions("hrms:permission:list") + public ResponseResult list(@RequestParam Map params) { + PageUtils page = permissionService.queryPage(params); + + return ResponseResult.SUCCESS(); + } + + + /** + * 信息 + */ + @GetMapping("/info/{id}") + //@RequiresPermissions("hrms:permission:info") + public ResponseResult info(@PathVariable("id") Long id) { + PermissionEntity permission = permissionService.getById(id); + + return ResponseResult.SUCCESS(); + } + + /** + * 保存 + */ + @PostMapping("/save") + //@RequiresPermissions("hrms:permission:save") + public ResponseResult save(@RequestBody PermissionEntity permission) { + permissionService.save(permission); + + return ResponseResult.SUCCESS(); + } + + /** + * 修改 + */ + @PutMapping("/update") + //@RequiresPermissions("hrms:permission:update") + public ResponseResult update(@RequestBody PermissionEntity permission) { + permissionService.updateById(permission); + + return ResponseResult.SUCCESS(); + } + + /** + * 删除 + */ + @DeleteMapping("/delete") + //@RequiresPermissions("hrms:permission:delete") + public ResponseResult delete(@RequestBody Long[] ids) { + permissionService.removeByIds(Arrays.asList(ids)); + + return ResponseResult.SUCCESS(); + } + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PositionController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PositionController.java new file mode 100644 index 00000000..2553e1fc --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PositionController.java @@ -0,0 +1,83 @@ +package com.daqing.financial.hrms.controller; + +import com.daqing.financial.hrms.service.PositionService; +import com.daqing.framework.domain.hrms.PositionEntity; +import com.daqing.framework.model.response.ResponseResult; +import com.daqing.framework.utils.PageUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Map; + + +/** + * 记录职位信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@RestController +@RequestMapping("hrms/position") +public class PositionController { + @Autowired + private PositionService positionService; + + /** + * 列表 + */ + @GetMapping("/list") + //@RequiresPermissions("hrms:position:list") + public ResponseResult list(@RequestParam Map params) { + PageUtils page = positionService.queryPage(params); + + return ResponseResult.SUCCESS(); + } + + + /** + * 信息 + */ + @GetMapping("/info/{id}") + //@RequiresPermissions("hrms:position:info") + public ResponseResult info(@PathVariable("id") Long id) { + PositionEntity position = positionService.getById(id); + + return ResponseResult.SUCCESS(); + } + + /** + * 保存 + */ + @PostMapping("/save") + //@RequiresPermissions("hrms:position:save") + public ResponseResult save(@RequestBody PositionEntity position) { + positionService.save(position); + + return ResponseResult.SUCCESS(); + } + + /** + * 修改 + */ + @PutMapping("/update") + //@RequiresPermissions("hrms:position:update") + public ResponseResult update(@RequestBody PositionEntity position) { + positionService.updateById(position); + + return ResponseResult.SUCCESS(); + } + + /** + * 删除 + */ + @DeleteMapping("/delete") + //@RequiresPermissions("hrms:position:delete") + public ResponseResult delete(@RequestBody Long[] ids) { + positionService.removeByIds(Arrays.asList(ids)); + + return ResponseResult.SUCCESS(); + } + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/RoleController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/RoleController.java new file mode 100644 index 00000000..14ea9a08 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/RoleController.java @@ -0,0 +1,83 @@ +package com.daqing.financial.hrms.controller; + +import com.daqing.financial.hrms.service.RoleService; +import com.daqing.framework.domain.hrms.RoleEntity; +import com.daqing.framework.model.response.ResponseResult; +import com.daqing.framework.utils.PageUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Map; + + +/** + * 员工角色表 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@RestController +@RequestMapping("hrms/role") +public class RoleController { + @Autowired + private RoleService roleService; + + /** + * 列表 + */ + @GetMapping("/list") + //@RequiresPermissions("hrms:role:list") + public ResponseResult list(@RequestParam Map params) { + PageUtils page = roleService.queryPage(params); + + return ResponseResult.SUCCESS(); + } + + + /** + * 信息 + */ + @GetMapping("/info/{id}") + //@RequiresPermissions("hrms:role:info") + public ResponseResult info(@PathVariable("id") Long id) { + RoleEntity role = roleService.getById(id); + + return ResponseResult.SUCCESS(); + } + + /** + * 保存 + */ + @PostMapping("/save") + //@RequiresPermissions("hrms:role:save") + public ResponseResult save(@RequestBody RoleEntity role) { + roleService.save(role); + + return ResponseResult.SUCCESS(); + } + + /** + * 修改 + */ + @PutMapping("/update") + //@RequiresPermissions("hrms:role:update") + public ResponseResult update(@RequestBody RoleEntity role) { + roleService.updateById(role); + + return ResponseResult.SUCCESS(); + } + + /** + * 删除 + */ + @DeleteMapping("/delete") + //@RequiresPermissions("hrms:role:delete") + public ResponseResult delete(@RequestBody Long[] ids) { + roleService.removeByIds(Arrays.asList(ids)); + + return ResponseResult.SUCCESS(); + } + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/UserController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/UserController.java new file mode 100644 index 00000000..e76563a5 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/UserController.java @@ -0,0 +1,82 @@ +package com.daqing.financial.hrms.controller; + +import com.daqing.financial.hrms.service.UserService; +import com.daqing.framework.domain.hrms.UserEntity; +import com.daqing.framework.model.response.ResponseResult; +import com.daqing.framework.utils.PageUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Map; + + +/** + * 人资管理系统,员工账号信息表,用于存储员工账号密码等登录相关数据 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@RestController +@RequestMapping("hrms/user") +public class UserController { + @Autowired + private UserService userService; + + /** + * 列表 + */ + @GetMapping("/list") + //@RequiresPermissions("hrms:user:list") + public ResponseResult list(@RequestParam Map params) { + PageUtils page = userService.queryPage(params); + + return ResponseResult.SUCCESS(); + } + + + /** + * 信息 + */ + @GetMapping("/info/{id}") + //@RequiresPermissions("hrms:user:info") + public ResponseResult info(@PathVariable("id") Long id) { + UserEntity user = userService.getById(id); + + return ResponseResult.SUCCESS(); + } + + /** + * 保存 + */ + @PostMapping("/save") + //@RequiresPermissions("hrms:user:save") + public ResponseResult save(@RequestBody UserEntity user) { + userService.save(user); + + return ResponseResult.SUCCESS(); + } + + /** + * 修改 + */ + @PutMapping("/update") + //@RequiresPermissions("hrms:user:update") + public ResponseResult update(@RequestBody UserEntity user) { + userService.updateById(user); + return ResponseResult.SUCCESS(); + } + + /** + * 删除 + */ + @DeleteMapping("/delete") + //@RequiresPermissions("hrms:user:delete") + public ResponseResult delete(@RequestBody Long[] ids) { + userService.removeByIds(Arrays.asList(ids)); + + return ResponseResult.SUCCESS(); + } + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java new file mode 100644 index 00000000..d76dab25 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java @@ -0,0 +1,17 @@ +package com.daqing.financial.hrms.dao; + +import com.daqing.framework.domain.hrms.DeptEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 记录部门信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Mapper +public interface DeptDao extends BaseMapper { + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java new file mode 100644 index 00000000..133f3de6 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java @@ -0,0 +1,17 @@ +package com.daqing.financial.hrms.dao; + +import com.daqing.framework.domain.hrms.EmployeeEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 记录员工的基本信息,如姓名、电话、部门等 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Mapper +public interface EmployeeDao extends BaseMapper { + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/PermissionDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/PermissionDao.java new file mode 100644 index 00000000..1f294b30 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/PermissionDao.java @@ -0,0 +1,17 @@ +package com.daqing.financial.hrms.dao; + +import com.daqing.framework.domain.hrms.PermissionEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 记录菜单权限 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Mapper +public interface PermissionDao extends BaseMapper { + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/PositionDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/PositionDao.java new file mode 100644 index 00000000..36e3128d --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/PositionDao.java @@ -0,0 +1,17 @@ +package com.daqing.financial.hrms.dao; + +import com.daqing.framework.domain.hrms.PositionEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 记录职位信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Mapper +public interface PositionDao extends BaseMapper { + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RoleDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RoleDao.java new file mode 100644 index 00000000..538f248b --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RoleDao.java @@ -0,0 +1,17 @@ +package com.daqing.financial.hrms.dao; + +import com.daqing.framework.domain.hrms.RoleEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 员工角色表 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Mapper +public interface RoleDao extends BaseMapper { + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/UserDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/UserDao.java new file mode 100644 index 00000000..fab08c4e --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/UserDao.java @@ -0,0 +1,17 @@ +package com.daqing.financial.hrms.dao; + +import com.daqing.framework.domain.hrms.UserEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 人资管理系统,员工账号信息表,用于存储员工账号密码等登录相关数据 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Mapper +public interface UserDao extends BaseMapper { + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/CrmsFeignService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/CrmsFeignService.java new file mode 100644 index 00000000..55052e2f --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/CrmsFeignService.java @@ -0,0 +1,16 @@ +package com.daqing.financial.hrms.feign; + +import com.daqing.framework.model.response.ResponseResult; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * 这是一个声明式的远程调用 + */ +@FeignClient("dq-financial-crms") +public interface CrmsFeignService { + + @GetMapping("/crms/list") + ResponseResult list(); + +} diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java new file mode 100644 index 00000000..1952732c --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java @@ -0,0 +1,20 @@ +package com.daqing.financial.hrms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.domain.hrms.DeptEntity; + +import java.util.Map; + +/** + * 记录部门信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +public interface DeptService extends IService { + + PageUtils queryPage(Map params); +} + diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java new file mode 100644 index 00000000..883003b3 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java @@ -0,0 +1,20 @@ +package com.daqing.financial.hrms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.domain.hrms.EmployeeEntity; + +import java.util.Map; + +/** + * 记录员工的基本信息,如姓名、电话、部门等 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +public interface EmployeeService extends IService { + + PageUtils queryPage(Map params); +} + diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PermissionService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PermissionService.java new file mode 100644 index 00000000..2f419437 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PermissionService.java @@ -0,0 +1,20 @@ +package com.daqing.financial.hrms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.domain.hrms.PermissionEntity; + +import java.util.Map; + +/** + * 记录菜单权限 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +public interface PermissionService extends IService { + + PageUtils queryPage(Map params); +} + diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PositionService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PositionService.java new file mode 100644 index 00000000..d2f21312 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PositionService.java @@ -0,0 +1,20 @@ +package com.daqing.financial.hrms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.domain.hrms.PositionEntity; + +import java.util.Map; + +/** + * 记录职位信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +public interface PositionService extends IService { + + PageUtils queryPage(Map params); +} + diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/RoleService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/RoleService.java new file mode 100644 index 00000000..cb85ead6 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/RoleService.java @@ -0,0 +1,20 @@ +package com.daqing.financial.hrms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.domain.hrms.RoleEntity; + +import java.util.Map; + +/** + * 员工角色表 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +public interface RoleService extends IService { + + PageUtils queryPage(Map params); +} + diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/UserService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/UserService.java new file mode 100644 index 00000000..43e1b6eb --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/UserService.java @@ -0,0 +1,20 @@ +package com.daqing.financial.hrms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.domain.hrms.UserEntity; + +import java.util.Map; + +/** + * 人资管理系统,员工账号信息表,用于存储员工账号密码等登录相关数据 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +public interface UserService extends IService { + + PageUtils queryPage(Map params); +} + diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java new file mode 100644 index 00000000..6d2673d2 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java @@ -0,0 +1,29 @@ +package com.daqing.financial.hrms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.financial.hrms.dao.DeptDao; +import com.daqing.financial.hrms.service.DeptService; +import com.daqing.framework.domain.hrms.DeptEntity; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.Query; +import org.springframework.stereotype.Service; + +import java.util.Map; + + +@Service("deptService") +public class DeptServiceImpl extends ServiceImpl implements DeptService { + + @Override + public PageUtils queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + + return new PageUtils(page); + } + +} \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java new file mode 100644 index 00000000..2a394322 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java @@ -0,0 +1,29 @@ +package com.daqing.financial.hrms.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.Query; + +import com.daqing.financial.hrms.dao.EmployeeDao; +import com.daqing.framework.domain.hrms.EmployeeEntity; +import com.daqing.financial.hrms.service.EmployeeService; + + +@Service("employeeService") +public class EmployeeServiceImpl extends ServiceImpl implements EmployeeService { + + @Override + public PageUtils queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + + return new PageUtils(page); + } + +} \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PermissionServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PermissionServiceImpl.java new file mode 100644 index 00000000..e331ef3e --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PermissionServiceImpl.java @@ -0,0 +1,29 @@ +package com.daqing.financial.hrms.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.Query; + +import com.daqing.financial.hrms.dao.PermissionDao; +import com.daqing.framework.domain.hrms.PermissionEntity; +import com.daqing.financial.hrms.service.PermissionService; + + +@Service("permissionService") +public class PermissionServiceImpl extends ServiceImpl implements PermissionService { + + @Override + public PageUtils queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + + return new PageUtils(page); + } + +} \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java new file mode 100644 index 00000000..5d63218a --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java @@ -0,0 +1,29 @@ +package com.daqing.financial.hrms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.financial.hrms.dao.PositionDao; +import com.daqing.financial.hrms.service.PositionService; +import com.daqing.framework.domain.hrms.PositionEntity; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.Query; +import org.springframework.stereotype.Service; + +import java.util.Map; + + +@Service("positionService") +public class PositionServiceImpl extends ServiceImpl implements PositionService { + + @Override + public PageUtils queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + + return new PageUtils(page); + } + +} \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/RoleServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/RoleServiceImpl.java new file mode 100644 index 00000000..9b69d6de --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/RoleServiceImpl.java @@ -0,0 +1,29 @@ +package com.daqing.financial.hrms.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.Query; + +import com.daqing.financial.hrms.dao.RoleDao; +import com.daqing.framework.domain.hrms.RoleEntity; +import com.daqing.financial.hrms.service.RoleService; + + +@Service("roleService") +public class RoleServiceImpl extends ServiceImpl implements RoleService { + + @Override + public PageUtils queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + + return new PageUtils(page); + } + +} \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java new file mode 100644 index 00000000..90c73488 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java @@ -0,0 +1,29 @@ +package com.daqing.financial.hrms.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.Query; + +import com.daqing.financial.hrms.dao.UserDao; +import com.daqing.framework.domain.hrms.UserEntity; +import com.daqing.financial.hrms.service.UserService; + + +@Service("userService") +public class UserServiceImpl extends ServiceImpl implements UserService { + + @Override + public PageUtils queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + + return new PageUtils(page); + } + +} \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/bootstrap.properties b/dq-financial-hrms/src/main/resources/bootstrap.properties new file mode 100644 index 00000000..d1c6bdec --- /dev/null +++ b/dq-financial-hrms/src/main/resources/bootstrap.properties @@ -0,0 +1,18 @@ +#服务名称 +spring.application.name=dq-financial-hrms +#配置中心地址 +spring.cloud.nacos.config.server-addr=192.168.31.142:8848 +spring.cloud.nacos.config.namespace=4c56c2f9-b6a3-4e7b-88b8-b1001e86dfd6 +#spring.cloud.nacos.config.group=prod + +spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml +spring.cloud.nacos.config.ext-config[0].group=dev +spring.cloud.nacos.config.ext-config[0].refresh=true + +spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml +spring.cloud.nacos.config.ext-config[1].group=dev +spring.cloud.nacos.config.ext-config[1].refresh=true + +spring.cloud.nacos.config.ext-config[2].data-id=other.yml +spring.cloud.nacos.config.ext-config[2].group=dev +spring.cloud.nacos.config.ext-config[2].refresh=true \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml new file mode 100644 index 00000000..e345cb1f --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml new file mode 100644 index 00000000..f1d5df92 --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDeptDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDeptDao.xml new file mode 100644 index 00000000..5cdf5c39 --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDeptDao.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeePositionDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeePositionDao.xml new file mode 100644 index 00000000..e6cc8987 --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeePositionDao.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeRoleDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeRoleDao.xml new file mode 100644 index 00000000..7e34662a --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeRoleDao.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/PermissionDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/PermissionDao.xml new file mode 100644 index 00000000..9daf7734 --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/PermissionDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/PositionDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/PositionDao.xml new file mode 100644 index 00000000..e918326f --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/PositionDao.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml new file mode 100644 index 00000000..14d82ba9 --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/RolePermissionDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/RolePermissionDao.xml new file mode 100644 index 00000000..0073b5e7 --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/RolePermissionDao.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/UserDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/UserDao.xml new file mode 100644 index 00000000..8885d686 --- /dev/null +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/UserDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-financial-hrms/src/test/java/com/daqing/financial/hrms/DqFinancialHrmsApplicationTests.java b/dq-financial-hrms/src/test/java/com/daqing/financial/hrms/DqFinancialHrmsApplicationTests.java new file mode 100644 index 00000000..d3fa77d4 --- /dev/null +++ b/dq-financial-hrms/src/test/java/com/daqing/financial/hrms/DqFinancialHrmsApplicationTests.java @@ -0,0 +1,13 @@ +package com.daqing.financial.hrms; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DqFinancialHrmsApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/dq-financial-workflow/pom.xml b/dq-financial-workflow/pom.xml new file mode 100644 index 00000000..96d34131 --- /dev/null +++ b/dq-financial-workflow/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.8.RELEASE + + + com.daqing.financial + dq-financial-workflow + 0.0.1-SNAPSHOT + dq-financial-workflow + 大庆智慧金融平台-工作流服务 + + + 1.8 + Greenwich.SR3 + + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + com.daqing.framework + dq-framework-model + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/dq-financial-workflow/src/main/java/com/daqing/financial/workflow/DqFinancialWorkflowApplication.java b/dq-financial-workflow/src/main/java/com/daqing/financial/workflow/DqFinancialWorkflowApplication.java new file mode 100644 index 00000000..cd7c9823 --- /dev/null +++ b/dq-financial-workflow/src/main/java/com/daqing/financial/workflow/DqFinancialWorkflowApplication.java @@ -0,0 +1,13 @@ +package com.daqing.financial.workflow; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DqFinancialWorkflowApplication { + + public static void main(String[] args) { + SpringApplication.run(DqFinancialWorkflowApplication.class, args); + } + +} diff --git a/dq-financial-workflow/src/main/resources/application.properties b/dq-financial-workflow/src/main/resources/application.properties new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/dq-financial-workflow/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/dq-financial-workflow/src/test/java/com/daqing/financial/workflow/DqFinancialWorkflowApplicationTests.java b/dq-financial-workflow/src/test/java/com/daqing/financial/workflow/DqFinancialWorkflowApplicationTests.java new file mode 100644 index 00000000..df9bd3ac --- /dev/null +++ b/dq-financial-workflow/src/test/java/com/daqing/financial/workflow/DqFinancialWorkflowApplicationTests.java @@ -0,0 +1,13 @@ +package com.daqing.financial.workflow; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DqFinancialWorkflowApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/dq-framework-common/dq-framework-common.iml b/dq-framework-common/dq-framework-common.iml new file mode 100644 index 00000000..11230f1a --- /dev/null +++ b/dq-framework-common/dq-framework-common.iml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-framework-common/pom.xml b/dq-framework-common/pom.xml new file mode 100644 index 00000000..fd22a415 --- /dev/null +++ b/dq-framework-common/pom.xml @@ -0,0 +1,80 @@ + + + 4.0.0 + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + 每一个微服务公共的依赖 + + + + org.apache.maven.plugins + maven-compiler-plugin + + 7 + 7 + + + + + + + + + mysql + mysql-connector-java + 8.0.17 + + + com.baomidou + mybatis-plus-boot-starter + 3.3.1 + + + org.projectlombok + lombok + 1.18.12 + + + + javax.servlet + servlet-api + 2.5 + provided + + + org.springframework + spring-web + 5.2.8.RELEASE + + + com.google.guava + guava + 24.0-jre + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + 2.1.0.RELEASE + pom + import + + + + \ No newline at end of file diff --git a/dq-framework-common/src/main/java/com/daqing/framework/client/DqFinancialList.java b/dq-framework-common/src/main/java/com/daqing/framework/client/DqFinancialList.java new file mode 100644 index 00000000..d8800918 --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/client/DqFinancialList.java @@ -0,0 +1,19 @@ +package com.daqing.framework.client; + +/** + * @Author: gongsj. + * @Description: 各个微服务名称定义 + * @Date:Created in 2020/09/07 11:33. + * @Modified By: + */ +public class DqFinancialList { + public static final String DQ_GOVERN_CENTER = "dq-govern-center"; + public static final String DQ_FINANCIAL_HRMS = "dq-financial-hrms"; + public static final String DQ_FINANCIAL_HRMS_AUTH = "dq-financial-hrms-auth"; + public static final String DQ_FINANCIAL_HRMS_JWT = "dq-financial-hrms-jwt"; + public static final String DQ_FINANCIAL_CRMS = "dq-financial-crms"; + public static final String DQ_FINANCIAL_CRMS_AUTH = "dq-financial-crms-auth"; + public static final String DQ_FINANCIAL_CRMS_JWT = "dq-financial-crms-jwt"; + public static final String DQ_FINANCIAL_BASE_OSS = "dq-financial-base-oss"; + public static final String DQ_GOVERN_GATEWAY = "dq-govern-gateway"; +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/exception/CustomException.java b/dq-framework-common/src/main/java/com/daqing/framework/exception/CustomException.java new file mode 100644 index 00000000..5457a5a3 --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/exception/CustomException.java @@ -0,0 +1,23 @@ +package com.daqing.framework.exception; + +import com.daqing.framework.model.response.ResponseResult; + +/** + * @Author: gongsj. + * @Description: 自定义异常处理类 + * @Date:Created in 2020/09/07 11:35. + * @Modified By: + */ +public class CustomException extends RuntimeException { + private ResponseResult responseResult; + + public CustomException(ResponseResult responseResult) { + //异常信息为错误码+异常信息 + super("错误码:" + responseResult.getCode() + "错误信息:" + responseResult.getMessage()); + this.responseResult = responseResult; + } + + public ResponseResult getResultCode() { + return this.responseResult; + } +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/exception/ExceptionCast.java b/dq-framework-common/src/main/java/com/daqing/framework/exception/ExceptionCast.java new file mode 100644 index 00000000..6e2697b2 --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/exception/ExceptionCast.java @@ -0,0 +1,16 @@ +package com.daqing.framework.exception; + +import com.daqing.framework.model.response.ResponseResult; + +/** + * @Author: gongsj. + * @Description: 自定义抛出异常类 + * @Date:Created in 2020/09/07 11:35. + * @Modified By: + */ +public class ExceptionCast { + //使用此静态方法抛出自定义异常 + public static void cast(ResponseResult responseResult) { + throw new CustomException(responseResult); + } +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/exception/ExceptionCatch.java b/dq-framework-common/src/main/java/com/daqing/framework/exception/ExceptionCatch.java new file mode 100644 index 00000000..d2d11bcd --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/exception/ExceptionCatch.java @@ -0,0 +1,62 @@ +package com.daqing.framework.exception; + +import com.daqing.framework.model.response.CommonCode; +import com.daqing.framework.model.response.ResponseResult; +import com.google.common.collect.ImmutableMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; + + +/** + * @Author: gongsj. + * @Description: 自定义捕获异常类,使用@ControllerAdvice和@ExceptionHandler注解来捕获指定类型的异常 + * @Date:Created in 2020/09/07 11:35. + * @Modified By: + */ +@ControllerAdvice//控制器增强 +public class ExceptionCatch { + private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionCatch.class); + + //定义Map,配置异常类型所对应的错误代码,使用 ImmutableMap 一旦写入数据,就无法更改,只读并且线程安全 + private static ImmutableMap, ResponseResult> EXCEPTIONS; + + //定义map的builder对象,去构建ImmutableMap + protected static ImmutableMap.Builder, ResponseResult> builder = ImmutableMap.builder(); + + @ResponseBody + @ExceptionHandler(Exception.class) + public ResponseResult exception(Exception exception) { + exception.printStackTrace(); + //记录日志 + LOGGER.error("catch exception:{}", exception.getMessage()); + if (EXCEPTIONS == null) { + EXCEPTIONS = builder.build();//EXCEPTION构建成功 + } + //从EXCEPTIONS中找到异常类型所对应的错误代码,如果找到了,将错误代码相应给用户,如果找不到则给用户相应99999 + ResponseResult responseResult = EXCEPTIONS.get(exception.getClass()); + if (responseResult != null) { + return responseResult; + } + //返回99999异常 + return new ResponseResult(CommonCode.SERVER_ERROR); + } + + static { + //定义异常类型所对应的错误代码 + builder.put(HttpMessageNotReadableException.class, new ResponseResult(CommonCode.INVALID_PARAM)); + } + + @ExceptionHandler(CustomException.class)//捕获CustomException类型异常 + @ResponseBody + public ResponseResult customException(CustomException customException) { + customException.printStackTrace(); + //记录日志 + LOGGER.error("catch exception:{}", customException.getMessage()); + + return customException.getResultCode(); + } +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/model/Constant.java b/dq-framework-common/src/main/java/com/daqing/framework/model/Constant.java new file mode 100644 index 00000000..aa2b5b4c --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/model/Constant.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) 2016-2019 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.daqing.framework.model; + +/** + * @Author: gongsj. + * @Description: 系统常量 + * @Date:Created in 2020/09/07 11:35. + * @Modified By: + */ +public class Constant { + /** 超级管理员ID */ + public static final int SUPER_ADMIN = 1; + /** + * 当前页码 + */ + public static final String PAGE = "page"; + /** + * 每页显示记录数 + */ + public static final String LIMIT = "limit"; + /** + * 排序字段 + */ + public static final String ORDER_FIELD = "sidx"; + /** + * 排序方式 + */ + public static final String ORDER = "order"; + /** + * 升序 + */ + public static final String ASC = "asc"; + /** + * 菜单类型 + * + * @author chenshun + * @email sunlightcs@gmail.com + * @date 2016年11月15日 下午1:24:29 + */ + public enum MenuType { + /** + * 目录 + */ + CATALOG(0), + /** + * 菜单 + */ + MENU(1), + /** + * 按钮 + */ + BUTTON(2); + + private int value; + + MenuType(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + /** + * 定时任务状态 + * + * @author chenshun + * @email sunlightcs@gmail.com + * @date 2016年12月3日 上午12:07:22 + */ + public enum ScheduleStatus { + /** + * 正常 + */ + NORMAL(0), + /** + * 暂停 + */ + PAUSE(1); + + private int value; + + ScheduleStatus(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + /** + * 云服务商 + */ + public enum CloudService { + /** + * 七牛云 + */ + QINIU(1), + /** + * 阿里云 + */ + ALIYUN(2), + /** + * 腾讯云 + */ + QCLOUD(3); + + private int value; + + CloudService(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/model/request/RequestData.java b/dq-framework-common/src/main/java/com/daqing/framework/model/request/RequestData.java new file mode 100644 index 00000000..bee71d88 --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/model/request/RequestData.java @@ -0,0 +1,15 @@ +package com.daqing.framework.model.request; + +import lombok.Data; +import lombok.ToString; + +/** + * @Author: gongsj. + * @Description: 统一的请求数据类型 + * @Date:Created in 2020/09/07 11:35. + * @Modified By: + */ +@Data +@ToString +public class RequestData { +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java b/dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java new file mode 100644 index 00000000..61e02eb7 --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/model/response/CommonCode.java @@ -0,0 +1,39 @@ +package com.daqing.framework.model.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @Author: gongsj. + * @Description: 系统操作状态集 + * @Date:Created in 2020/09/07 11:35. + * @Modified By: + */ +@AllArgsConstructor +public enum CommonCode { + + SUCCESS(true, 10000, "操作成功!"), + FAIL(false, 11111, "操作失败!"), + UNAUTHENTICATED(false, 10001, "此操作需要登陆系统!"), + UNAUTHORISE(false, 10002, "权限不足,无权操作!"), + INVALID_PARAM(false, 10003, "非法参数!"), + SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); + + /** + * 操作是否成功 + */ + @Getter + private boolean success; + + /** + * 状态码 + */ + @Getter + private int code; + + /** + * 提示信息 + */ + @Getter + private String message; +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java b/dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java new file mode 100644 index 00000000..84c39ced --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java @@ -0,0 +1,62 @@ +package com.daqing.framework.model.response; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +/** + * @Author: gongsj. + * @Description: 统一返回的结果集。 + * @Date:Created in 2020/09/07 12:28. + * @Modified By: + */ +@Data +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class ResponseResult { + /** + * 操作是否成功 + */ + private boolean success; + + /** + * 状态码 + */ + private int code; + + /** + * 返回的数据 + */ + private T data; + + /** + * 提示信息 + */ + private String message; + + public ResponseResult(boolean success, int code, String message) { + this.success = success; + this.code = code; + this.message = message; + } + + public ResponseResult(CommonCode commonCode) { + this.success = commonCode.isSuccess(); + this.code = commonCode.getCode(); + this.message = commonCode.getMessage(); + } + + public static ResponseResult SUCCESS() { + return new ResponseResult(CommonCode.SUCCESS); + } + + public static ResponseResult FAIL() { + return new ResponseResult(CommonCode.FAIL); + } + + public static ResponseResult FAIL(String message) { + return new ResponseResult(false, 500, message); + } +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/web/BaseController.java b/dq-framework-common/src/main/java/com/daqing/framework/web/BaseController.java new file mode 100644 index 00000000..a9caaec7 --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/web/BaseController.java @@ -0,0 +1,31 @@ +package com.daqing.framework.web; + +import org.springframework.web.bind.annotation.ModelAttribute; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +/** + * @Author: gongsj. + * @Description: http请求体和响应体及session设置。 + * @Date:Created in 2020/09/07 12:28. + * @Modified By: + */ +public class BaseController { + protected HttpServletRequest request; + + protected HttpServletResponse response; + + protected HttpSession session; + + @ModelAttribute + public void setReqAndRes(HttpServletRequest request, HttpServletResponse response) { + + this.request = request; + + this.response = response; + + this.session = request.getSession(); + } +} diff --git a/dq-framework-common/src/main/java/com/daqing/framework/xss/SQLFilter.java b/dq-framework-common/src/main/java/com/daqing/framework/xss/SQLFilter.java new file mode 100644 index 00000000..25c1f6de --- /dev/null +++ b/dq-framework-common/src/main/java/com/daqing/framework/xss/SQLFilter.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016-2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.daqing.framework.xss; + +import com.daqing.framework.exception.ExceptionCast; +import com.daqing.framework.model.response.ResponseResult; +import org.apache.commons.lang.StringUtils; + +/** + * SQL过滤 + * + * @author Mark sunlightcs@gmail.com + */ +public class SQLFilter { + + /** + * SQL注入过滤 + * + * @param str 待验证的字符串 + */ + public static String sqlInject(String str) { + if (StringUtils.isBlank(str)) { + return null; + } + //去掉'|"|;|\字符 + str = StringUtils.replace(str, "'", ""); + str = StringUtils.replace(str, "\"", ""); + str = StringUtils.replace(str, ";", ""); + str = StringUtils.replace(str, "\\", ""); + + //转换成小写 + str = str.toLowerCase(); + + //非法字符 + String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; + + //判断是否包含非法字符 + for (String keyword : keywords) { + //if (str.indexOf(keyword) != -1) + if (str.contains(keyword)) { + ExceptionCast.cast(ResponseResult.FAIL("包含非法字符")); + } + } + return str; + } +} diff --git a/dq-framework-model/dq-framework-model.iml b/dq-framework-model/dq-framework-model.iml new file mode 100644 index 00000000..cea872bb --- /dev/null +++ b/dq-framework-model/dq-framework-model.iml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-framework-model/pom.xml b/dq-framework-model/pom.xml new file mode 100644 index 00000000..f8e47283 --- /dev/null +++ b/dq-framework-model/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.daqing.framework + dq-framework-model + 1.0-SNAPSHOT + + 统一管理项目涉及到的实体类 + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + \ No newline at end of file diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DeptEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DeptEntity.java new file mode 100644 index 00000000..1b0bb4ad --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DeptEntity.java @@ -0,0 +1,52 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 记录部门信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 17:12:14 + */ +@Data +@TableName("hrms_dept") +public class DeptEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 部门名称 + */ + private String name; + /** + * 上级部门id + */ + private Long parentId; + /** + * 层级 + */ + private Integer level; + /** + * 排序 + */ + private Integer sort; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date motifyTime; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeDeptEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeDeptEntity.java new file mode 100644 index 00000000..8f1717e3 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeDeptEntity.java @@ -0,0 +1,36 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 员工—部门中间表 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Data +@TableName("hrms_employee_dept") +public class EmployeeDeptEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 员工id + */ + private Long employeeId; + /** + * 部门id + */ + private Long deptId; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeEntity.java new file mode 100644 index 00000000..049a5dd8 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeEntity.java @@ -0,0 +1,72 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 记录员工的基本信息,如姓名、电话、部门等 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Data +@TableName("hrms_employee") +public class EmployeeEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 姓名 + */ + private String name; + /** + * 性别:1、男,0、女 + */ + private Integer gender; + /** + * 生日 + */ + private Date birthday; + /** + * 办公电话 + */ + private String officePhone; + /** + * 手机号码 + */ + private String phone; + /** + * 公司邮箱 + */ + private String companyMail; + /** + * 备用邮箱 + */ + private String spareMail; + /** + * 职位描述 + */ + private String positionDescription; + /** + * 工号 + */ + private String jobNumber; + /** + * 头像地址 + */ + private String headPortaritUrl; + /** + * 账号表id + */ + private Long userId; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeePositionEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeePositionEntity.java new file mode 100644 index 00000000..e1857107 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeePositionEntity.java @@ -0,0 +1,36 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 员工——职位中间表 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Data +@TableName("hrms_employee_position") +public class EmployeePositionEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 员工id + */ + private Long empId; + /** + * 职位id + */ + private Long positionId; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeRoleEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeRoleEntity.java new file mode 100644 index 00000000..296aae58 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/EmployeeRoleEntity.java @@ -0,0 +1,36 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Data +@TableName("hrms_employee_role") +public class EmployeeRoleEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 用户id + */ + private Long userId; + /** + * 角色id + */ + private Long roleId; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PermissionEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PermissionEntity.java new file mode 100644 index 00000000..3b614ca4 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PermissionEntity.java @@ -0,0 +1,72 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 记录菜单权限 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 17:12:14 + */ +@Data +@TableName("hrms_permission") +public class PermissionEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 权限标识符 + */ + private String code; + /** + * 名称 + */ + private String name; + /** + * 路径 + */ + private String url; + /** + * 父权限id + */ + private Long parentId; + /** + * 层级 + */ + private Integer level; + /** + * 是否是菜单:1、是,0、不是 + */ + private Integer menuOrNot; + /** + * 状态:0、启用,1、禁用 + */ + private Integer status; + /** + * 排序 + */ + private Integer sort; + /** + * 图标 + */ + private String icon; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date motifyTime; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PositionEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PositionEntity.java new file mode 100644 index 00000000..a0e8c90e --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PositionEntity.java @@ -0,0 +1,52 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 记录职位信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Data +@TableName("hrms_position") +public class PositionEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 部门id + */ + private Long deptId; + /** + * 职位名称 + */ + private String name; + /** + * 职位介绍 + */ + private String introduction; + /** + * 排序 + */ + private Integer sort; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date motifyTime; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/RoleEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/RoleEntity.java new file mode 100644 index 00000000..f466e2be --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/RoleEntity.java @@ -0,0 +1,44 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 员工角色表 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Data +@TableName("hrms_role") +public class RoleEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 角色名称 + */ + private String name; + /** + * 角色描述 + */ + private String description; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date motifyTime; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/RolePermissionEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/RolePermissionEntity.java new file mode 100644 index 00000000..9775b6b3 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/RolePermissionEntity.java @@ -0,0 +1,36 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 角色——权限中间表 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Data +@TableName("hrms_role_permission") +public class RolePermissionEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 角色id + */ + private Long roleId; + /** + * 权限id + */ + private Long permissionId; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/UserEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/UserEntity.java new file mode 100644 index 00000000..8644942a --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/UserEntity.java @@ -0,0 +1,80 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 人资管理系统,员工账号信息表,用于存储员工账号密码等登录相关数据 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-09-07 16:26:04 + */ +@Data +@TableName("hrms_user") +public class UserEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 用于登录的账号,必填 + */ + private String account; + /** + * 用户可以绑定手机账号,用于登录 + */ + private String phoneAccount; + /** + * 登录密码 + */ + private String password; + /** + * 登录次数 + */ + private Integer loginNum; + /** + * 上次的登录时间 + */ + private Date lasttime; + /** + * 微信的唯一标识 + */ + private String wechatId; + /** + * 状态:0、启用,1、禁用 + */ + private Integer status; + /** + * 禁用开始时间 + */ + private Date disableStartTime; + /** + * 禁用结束时间 + */ + private Date disableEndTime; + /** + * 禁用原因 + */ + private String disableCause; + /** + * 是否删除:0、未删除,1、删除 + */ + private Integer delOrNot; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date motifyTime; + +} diff --git a/dq-framework-utils/dq-framework-utils.iml b/dq-framework-utils/dq-framework-utils.iml new file mode 100644 index 00000000..bd6ca41b --- /dev/null +++ b/dq-framework-utils/dq-framework-utils.iml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dq-framework-utils/pom.xml b/dq-framework-utils/pom.xml new file mode 100644 index 00000000..3e74ef4a --- /dev/null +++ b/dq-framework-utils/pom.xml @@ -0,0 +1,36 @@ + + + + financial + com.daqing.financial + 0.0.1-SNAPSHOT + + 4.0.0 + + com.daqing.framework + dq-framework-utils + + 系统通用的工具类 + + + + org.apache.maven.plugins + maven-compiler-plugin + + 7 + 7 + + + + + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + \ No newline at end of file diff --git a/dq-framework-utils/src/main/java/com/daqing/framework/utils/PageUtils.java b/dq-framework-utils/src/main/java/com/daqing/framework/utils/PageUtils.java new file mode 100644 index 00000000..07c57f1a --- /dev/null +++ b/dq-framework-utils/src/main/java/com/daqing/framework/utils/PageUtils.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) 2016-2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.daqing.framework.utils; + +import com.baomidou.mybatisplus.core.metadata.IPage; + +import java.io.Serializable; +import java.util.List; + +/** + * 分页工具类 + * + * @author Mark sunlightcs@gmail.com + */ +public class PageUtils implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 总记录数 + */ + private int totalCount; + /** + * 每页记录数 + */ + private int pageSize; + /** + * 总页数 + */ + private int totalPage; + /** + * 当前页数 + */ + private int currPage; + /** + * 列表数据 + */ + private List list; + + /** + * 分页 + * @param list 列表数据 + * @param totalCount 总记录数 + * @param pageSize 每页记录数 + * @param currPage 当前页数 + */ + public PageUtils(List list, int totalCount, int pageSize, int currPage) { + this.list = list; + this.totalCount = totalCount; + this.pageSize = pageSize; + this.currPage = currPage; + this.totalPage = (int) Math.ceil((double) totalCount / pageSize); + } + + /** + * 分页 + */ + public PageUtils(IPage page) { + this.list = page.getRecords(); + this.totalCount = (int) page.getTotal(); + this.pageSize = (int) page.getSize(); + this.currPage = (int) page.getCurrent(); + this.totalPage = (int) page.getPages(); + } + + public int getTotalCount() { + return totalCount; + } + + public void setTotalCount(int totalCount) { + this.totalCount = totalCount; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getTotalPage() { + return totalPage; + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } + + public int getCurrPage() { + return currPage; + } + + public void setCurrPage(int currPage) { + this.currPage = currPage; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} diff --git a/dq-framework-utils/src/main/java/com/daqing/framework/utils/Query.java b/dq-framework-utils/src/main/java/com/daqing/framework/utils/Query.java new file mode 100644 index 00000000..2d3f35fa --- /dev/null +++ b/dq-framework-utils/src/main/java/com/daqing/framework/utils/Query.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.daqing.framework.utils; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.daqing.framework.model.Constant; +import com.daqing.framework.xss.SQLFilter; +import org.apache.commons.lang.StringUtils; + +import java.util.Map; + +/** + * 查询参数 + * + * @author Mark sunlightcs@gmail.com + */ +public class Query { + + public IPage getPage(Map params) { + return this.getPage(params, null, false); + } + + public IPage getPage(Map params, String defaultOrderField, boolean isAsc) { + //分页参数 + long curPage = 1; + long limit = 10; + + if (params.get(Constant.PAGE) != null) { + curPage = Long.parseLong((String) params.get(Constant.PAGE)); + } + if (params.get(Constant.LIMIT) != null) { + limit = Long.parseLong((String) params.get(Constant.LIMIT)); + } + + //分页对象 + Page page = new Page<>(curPage, limit); + + //分页参数 + params.put(Constant.PAGE, page); + + //排序字段 + //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) + String orderField = SQLFilter.sqlInject((String) params.get(Constant.ORDER_FIELD)); + String order = (String) params.get(Constant.ORDER); + + + //前端字段排序 + if (StringUtils.isNotEmpty(orderField) && StringUtils.isNotEmpty(order)) { + if (Constant.ASC.equalsIgnoreCase(order)) { + return page.addOrder(OrderItem.asc(orderField)); + } else { + return page.addOrder(OrderItem.desc(orderField)); + } + } + + //没有排序字段,则不排序 + if (StringUtils.isBlank(defaultOrderField)) { + return page; + } + + //默认排序 + if (isAsc) { + page.addOrder(OrderItem.asc(defaultOrderField)); + } else { + page.addOrder(OrderItem.desc(defaultOrderField)); + } + + return page; + } +} diff --git a/dq-govern-gateway/pom.xml b/dq-govern-gateway/pom.xml new file mode 100644 index 00000000..70da4975 --- /dev/null +++ b/dq-govern-gateway/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.8.RELEASE + + + com.daqing.financial + dq-govern-gateway + 0.0.1-SNAPSHOT + dq-govern-gateway + 大庆智慧金融平台-网关服务 + + + 1.8 + Greenwich.SR3 + + + + + com.daqing.framework + dq-framework-common + 1.0-SNAPSHOT + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/DqGovernGatewayApplication.java b/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/DqGovernGatewayApplication.java new file mode 100644 index 00000000..bbc54658 --- /dev/null +++ b/dq-govern-gateway/src/main/java/com/daqing/financial/gateway/DqGovernGatewayApplication.java @@ -0,0 +1,14 @@ +package com.daqing.financial.gateway; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; + +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) +public class DqGovernGatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(DqGovernGatewayApplication.class, args); + } + +} diff --git a/dq-govern-gateway/src/main/resources/application.yml b/dq-govern-gateway/src/main/resources/application.yml new file mode 100644 index 00000000..dd9cd4b3 --- /dev/null +++ b/dq-govern-gateway/src/main/resources/application.yml @@ -0,0 +1,20 @@ +spring: + cloud: + gateway: + routes: +# - id: test_route +# uri: https://www.baidu.com +# predicates: +# - Query=url,baidu +# +# - id: qq_route +# uri: https://www.qq.com +# predicates: +# - Query=url,qq +# + - id: hrms_route + uri: lb://dq-financial-hrms + predicates: + - Path=/api/hrms/** + filters: + - RewritePath=/api/(?.*),/$\{segment} \ No newline at end of file diff --git a/dq-govern-gateway/src/main/resources/bootstrap.properties b/dq-govern-gateway/src/main/resources/bootstrap.properties new file mode 100644 index 00000000..5d6a98ae --- /dev/null +++ b/dq-govern-gateway/src/main/resources/bootstrap.properties @@ -0,0 +1,9 @@ +#服务名称 +spring.application.name=dq-govern-gateway +#配置中心地址 +spring.cloud.nacos.config.server-addr=192.168.31.142:8848 +spring.cloud.nacos.config.namespace=772e2607-b929-4246-9671-ee5a36d74d25 + +spring.cloud.nacos.config.ext-config[0].data-id=dq-govern-gateway.yml +spring.cloud.nacos.config.ext-config[0].group=dev +spring.cloud.nacos.config.ext-config[0].refresh=true \ No newline at end of file diff --git a/dq-govern-gateway/src/test/java/com/daqing/financial/gateway/DqGovernGatewayApplicationTests.java b/dq-govern-gateway/src/test/java/com/daqing/financial/gateway/DqGovernGatewayApplicationTests.java new file mode 100644 index 00000000..23af90f6 --- /dev/null +++ b/dq-govern-gateway/src/test/java/com/daqing/financial/gateway/DqGovernGatewayApplicationTests.java @@ -0,0 +1,15 @@ +package com.daqing.financial.gateway; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +@EnableDiscoveryClient +@SpringBootTest +class DqGovernGatewayApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..ecd9c34b --- /dev/null +++ b/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + com.daqing.financial + financial + 0.0.1-SNAPSHOT + financial + 聚合服务 + pom + + + dq-framework-common + dq-framework-model + dq-framework-utils + dq-financial-api + dq-financial-hrms + dq-financial-hrms-auth + dq-financial-crms + dq-financial-crms-auth + dq-financial-workflow + dq-financial-guarantee + +