diff --git a/dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerWorkbenchControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerWorkbenchControllerApi.java new file mode 100644 index 00000000..dde4af51 --- /dev/null +++ b/dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerWorkbenchControllerApi.java @@ -0,0 +1,23 @@ +package com.daqing.financial.crms; + +import com.daqing.framework.domain.crms.request.CustomerWorkbenchRequest; +import com.daqing.framework.domain.crms.response.CustomerWorkbenchListVO; +import com.daqing.framework.model.response.ResponseResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 工作台客户资源接口定义 + * + * @auther River + * @date 2020/10/19 10:24 + */ +@Api(value = "工作台客户资源", tags = "提供工作台客户信息增删改查等相关方法") +public interface CustomerWorkbenchControllerApi { + + /** + * 列表展示 + */ + @ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示",response = CustomerWorkbenchListVO.class) + ResponseResult List(Integer page, Integer size, CustomerWorkbenchRequest customerWorkbenchRequest); +} diff --git a/dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java index 39cfd3cf..5a4f2ed1 100644 --- a/dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java +++ b/dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java @@ -7,6 +7,8 @@ import com.daqing.framework.model.response.ResponseResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.util.List; + /** * @Author: gongsj. * @Description: 部门管理controllerApi定义 @@ -32,7 +34,7 @@ public interface DeptControllerApi { * 拖拉拽重新排序,批量修改部门信息 */ @ApiOperation(value = "拖拉拽重新排序,批量修改部门信息", notes = "拖拉拽重新排序,批量修改部门信息") - ResponseResult updateSort(DeptEntity[] depts); + ResponseResult updateSort(List depts); /** * 根据id查询部门详细信息 diff --git a/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java index ca7bac8a..0cdee721 100644 --- a/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java +++ b/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java @@ -1,9 +1,18 @@ package com.daqing.financial.hrms; +import com.daqing.framework.domain.crms.request.EmployeeDisableRequest; import com.daqing.framework.domain.hrms.EmployeeEntity; +import com.daqing.framework.domain.hrms.ext.EmployeeInfoVO; +import com.daqing.framework.domain.hrms.ext.EmployeeListVO; +import com.daqing.framework.domain.hrms.request.EmployeeRequest; +import com.daqing.framework.domain.hrms.response.RolePermissionResponse; import com.daqing.framework.model.response.ResponseResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * @auther River @@ -18,14 +27,44 @@ public interface EmployeeControllerApi { @ApiOperation(value = "根据id查询员工姓名", notes = "根据id查询员工姓名") ResponseResult getEmployeeById(Long id); - /** - * 分页加条件查询员工信息 - */ - @ApiOperation(value = "分页加条件查询员工信息", notes = "分页加条件查询员工信息") - ResponseResult list(Integer page, Integer size,EmployeeEntity employee); + @ApiOperation(value = "分页加条件查询员工信息", notes = "分页加条件查询员工信息",response = EmployeeListVO.class) + ResponseResult list(Integer page, Integer size, EmployeeRequest employeeRequest); @ApiOperation(value = "根据id删除员工信息", notes = "根据id删除员工信息") - ResponseResult delete(Long[] ids); + ResponseResult delete(List ids); + + @ApiOperation(value = "启用",notes = "启用") + ResponseResult start(Long id); + + @ApiOperation(value = "禁用",notes = "禁用") + ResponseResult stop(EmployeeDisableRequest employeeDisableRequest); + + @ApiOperation(value = "禁用详情",notes = "禁用详情") + ResponseResult forbidInfo(Long id); + + @ApiOperation(value = "重置密码",notes = "重置密码") + ResponseResult reset(Long id); + + @ApiOperation(value = "详细信息",notes = "相信信息",response = EmployeeInfoVO.class) + ResponseResult info(Long id); + + @ApiOperation(value = "角色对应的权限",notes = "角色对应的权限",response = RolePermissionResponse.class) + ResponseResult tree(List ids); + + @ApiOperation(value = "更新",notes = "更新") + ResponseResult update(EmployeeInfoVO employeeInfoVO); + + @ApiOperation(value = "新增",notes = "新增") + ResponseResult save(EmployeeInfoVO employeeInfoVO); + + @ApiOperation(value = "导出",notes = "导出") + ResponseResult excelExport(HttpServletResponse response); + + @ApiOperation(value = "导出模板",notes = "导出模板") + ResponseResult excelTemplate(HttpServletResponse response); + + @ApiOperation(value = "导入",notes = "导入") + ResponseResult excelImport(MultipartFile file); @ApiOperation(value = "查询所有员工id和姓名",notes = "查询所有员工id和姓名") ResponseResult listEmployeeName(); diff --git a/dq-financial-api/src/main/java/com/daqing/financial/hrms/PositionControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/hrms/PositionControllerApi.java index fc4374aa..1a95caa5 100644 --- a/dq-financial-api/src/main/java/com/daqing/financial/hrms/PositionControllerApi.java +++ b/dq-financial-api/src/main/java/com/daqing/financial/hrms/PositionControllerApi.java @@ -1,6 +1,8 @@ package com.daqing.financial.hrms; +import com.daqing.framework.domain.hrms.ext.PositionVO; import com.daqing.framework.domain.hrms.request.PositionRequest; +import com.daqing.framework.domain.hrms.response.PositionResponse; import com.daqing.framework.model.response.ResponseResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -22,7 +24,7 @@ public interface PositionControllerApi { /** * 分页加条件查询职位信息 */ - @ApiOperation(value = "分页加条件查询职位信息", notes = "分页加条件查询职位信息") + @ApiOperation(value = "分页加条件查询职位信息", notes = "分页加条件查询职位信息",response = PositionVO.class) ResponseResult list(Integer page, Integer size, String queryMsg); /** @@ -34,7 +36,7 @@ public interface PositionControllerApi { /** * 根据职位id查询职位信息详情 */ - @ApiOperation(value = "修改职位信息", notes = "修改职位信息") + @ApiOperation(value = "根据职位id查询职位信息详情", notes = "根据职位id查询职位信息详情",response = PositionResponse.class) ResponseResult info(Long id); /** @@ -42,4 +44,16 @@ public interface PositionControllerApi { */ @ApiOperation(value = "删除职位信息", notes = "删除职位信息") ResponseResult delete(Long[] ids); + + /** + * 所有的职位id和名称 + */ + @ApiOperation(value = "所有的职位id和名称", notes = "所有的职位id和名称") + ResponseResult listPositionIdAndName(); + + /** + * 所有的角色id和名称 + */ + @ApiOperation(value = "所有的角色id和名称", notes = "所有的角色id和名称") + ResponseResult listRoleIdAndName(); } diff --git a/dq-financial-api/src/main/java/com/daqing/financial/hrms/UserControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/hrms/UserControllerApi.java new file mode 100644 index 00000000..03522868 --- /dev/null +++ b/dq-financial-api/src/main/java/com/daqing/financial/hrms/UserControllerApi.java @@ -0,0 +1,29 @@ +package com.daqing.financial.hrms; + +import com.daqing.framework.domain.hrms.ext.EmployeeAndUserVO; +import com.daqing.framework.model.response.ResponseResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * @auther River + * @date 2020/10/15 9:44 + */ +@Api(value = "用户相关操作", tags = "提供工作台人力资源等相关方法") +public interface UserControllerApi { + + @ApiOperation(value = "用户详情",notes = "用户详情",response = EmployeeAndUserVO.class) + ResponseResult info(); + + @ApiOperation(value = "修改用户信息",notes = "修改用户信息") + ResponseResult update(EmployeeAndUserVO employeeAndUserVO); + + @ApiOperation(value = "获取验证码",notes = "获取验证码") + ResponseResult code(String phone); + + @ApiOperation(value = "修改密码",notes = "修改密码") + ResponseResult updatePassword(Long id, String primaryPassword, String newPassword, String affirmNewPassword); + + @ApiOperation(value = "绑定手机号",notes = "绑定手机号") + ResponseResult binding(Long id,String phone,String code); +} diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java index 44630e25..19061103 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java @@ -35,9 +35,6 @@ public class CustomerController implements CustomerControllerApi { @Autowired private CustomerService customerService; - /*@Autowired - private HrmsFeignService hrmsFeignService;*/ - /** * 列表 */ diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerWorkbenchController.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerWorkbenchController.java new file mode 100644 index 00000000..6e239fbd --- /dev/null +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerWorkbenchController.java @@ -0,0 +1,38 @@ +package com.daqing.financial.crms.controller; + +import com.daqing.financial.crms.CustomerWorkbenchControllerApi; +import com.daqing.financial.crms.service.CustomerWorkbenchService; +import com.daqing.framework.domain.crms.request.CustomerWorkbenchRequest; +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.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * 工作台客户资源系统 + * + * @auther River + * @date 2020/10/19 10:05 + */ +@RestController +@RequestMapping("/crms/workbench") +public class CustomerWorkbenchController implements CustomerWorkbenchControllerApi { + + @Autowired + private CustomerWorkbenchService customerWorkbenchService; + + /** + * 列表 + */ + @Override + @GetMapping("/list") + public ResponseResult List(@RequestParam("page") Integer page, @RequestParam("size") Integer size, CustomerWorkbenchRequest customerWorkbenchRequest) { + + PageUtils list = customerWorkbenchService.list(page, size, customerWorkbenchRequest); + + return new ResponseResult().SUCCESS(list); + } +} diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerWorkbenchDao.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerWorkbenchDao.java new file mode 100644 index 00000000..af511c08 --- /dev/null +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerWorkbenchDao.java @@ -0,0 +1,19 @@ +package com.daqing.financial.crms.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.domain.crms.request.CustomerWorkbenchRequest; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @auther River + * @date 2020/10/19 10:45 + */ +@Mapper +public interface CustomerWorkbenchDao extends BaseMapper { + + IPage queryList(Page page, @Param("cr")CustomerWorkbenchRequest customerWorkbenchRequest); +} diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerWorkbenchService.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerWorkbenchService.java new file mode 100644 index 00000000..c1a735b7 --- /dev/null +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerWorkbenchService.java @@ -0,0 +1,16 @@ +package com.daqing.financial.crms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.domain.crms.request.CustomerWorkbenchRequest; +import com.daqing.framework.utils.PageUtils; + + +/** + * @auther River + * @date 2020/10/19 10:39 + */ +public interface CustomerWorkbenchService extends IService { + + PageUtils list(Integer page, Integer size, CustomerWorkbenchRequest customerWorkbenchRequest); +} diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java index c0a7d736..f8ba6c8f 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java @@ -72,11 +72,11 @@ public class CustomerServiceImpl extends ServiceImpl customers = customerEntityIPage.getRecords(); // 获取所有的客户经理id - Long[] ids = customers.stream().map(CustomerEntity::getManager).toArray(Long[]::new); + Long[] managerIds = customers.stream().map(CustomerEntity::getManager).toArray(Long[]::new); - if (ids != null && ids.length != 0) { + if (managerIds.length != 0) { //TODO 远程调用查询客户经理信息的接口 - ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(ids); + ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); List employeeTO = (List) responseResult.getData(); if (employeeTO != null){ // 将客户信息和客户经理及部门信息拼装起来 @@ -203,6 +203,7 @@ public class CustomerServiceImpl extends ServiceImpl pageCheckout(Integer page, Integer size) { + private Page pageCheckout(Integer page, Integer size) { // 查询客户有效总条数 Integer count = this.count(new QueryWrapper().eq("del_or_not", CrmsConstant.NOT_DELETE)); if (size == null || size < 1) { diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerWorkbenchServiceImpl.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerWorkbenchServiceImpl.java new file mode 100644 index 00000000..815dd9d3 --- /dev/null +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerWorkbenchServiceImpl.java @@ -0,0 +1,133 @@ +package com.daqing.financial.crms.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.daqing.financial.crms.dao.CustomerWorkbenchDao; +import com.daqing.financial.crms.feign.HrmsFeignService; +import com.daqing.financial.crms.service.CustomerWorkbenchService; +import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.domain.crms.ext.CustomerTO; +import com.daqing.framework.domain.crms.request.CustomerWorkbenchRequest; +import com.daqing.framework.domain.crms.response.CustomerWorkbenchListVO; +import com.daqing.framework.domain.hrms.ext.EmployeeTO; +import com.daqing.framework.model.response.ResponseResult; +import com.daqing.framework.utils.PageUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @auther River + * @date 2020/10/19 10:44 + */ +@Service +public class CustomerWorkbenchServiceImpl extends ServiceImpl + implements CustomerWorkbenchService { + + @Autowired + private HrmsFeignService hrmsFeignService; + + /** + * 列表 + */ + @Override + public PageUtils list(Integer page, Integer size, CustomerWorkbenchRequest cwr) { + + if (page == null || size == null){ + page = 1; + size = 10; + } + // 校验时间参数 + this.timeCheckout(cwr.getCreateTime(),cwr.getStartTime(),cwr.getEndTime(),cwr); + IPage customerEntityIPage = this.getBaseMapper().queryList(new Page(page, size), cwr); + List customers = customerEntityIPage.getRecords(); + // 获取所有的客户经理id + Long[] managerIds = customers.stream().map(CustomerEntity::getManager).toArray(Long[]::new); + // 获取所有的客户id + Long[] customerIds = customers.stream().map(CustomerEntity::getId).toArray(Long[]::new); + // 返回列表实体类集合 + List customerWorkbenchListVOS = new ArrayList<>(); + BeanUtils.copyProperties(customers,customerWorkbenchListVOS); + if (managerIds.length != 0){ + // 远程调用查询客户对应的客户经理信息 + ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); + List employeeTOs = (List) responseResult.getData(); + if (employeeTOs != null){ + customerWorkbenchListVOS = this.jointCustomerEmployee(customers, employeeTOs); + } + } + if (customerIds.length != 0){ + // TODO:调用担保服务查询每个客户的审批状态 + for (CustomerWorkbenchListVO customerWorkbenchListVO : customerWorkbenchListVOS) { + customerWorkbenchListVO.setStatus(2); + } + } + // 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils + IPage iPage = new Page<>(); + BeanUtils.copyProperties(customerEntityIPage,iPage); + iPage.setRecords(customerWorkbenchListVOS); + + return new PageUtils(iPage); + } + + /** + * 选择某段时间内客户信息的时间参数校验 + */ + private void timeCheckout(Integer createTime, String startTime, String endTime, CustomerWorkbenchRequest customerWorkbenchRequest) { + // 没有选择自定义时间且选择了固定的"3个月内、6个月内、9个月内...."时间 + if ((startTime == null || startTime.length() == 0) && (endTime == null || endTime.length() == 0) && createTime != null) { + if (createTime == 3 || createTime == 6 || createTime == 9 || createTime == 12) { + String pastTime = this.pastTime(createTime); + customerWorkbenchRequest.setStartTime(pastTime); + } else { + customerWorkbenchRequest.setStartTime(null); + } + } + // 选择了自定义时间且选择了固定时间则固定时间无效 + if (createTime != null && ((startTime != null && startTime.length() != 0) || (endTime != null && endTime.length() != 0))) { + customerWorkbenchRequest.setCreateTime(null); + } + } + + /** + * 得到过去number月内的时间 + */ + private String pastTime(Integer number) { + Date date = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, -number); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm"); + return sdf.format(calendar.getTime()); + } + + /** + * 拼接客户及其对应的客户经理及部门信息 + */ + private List jointCustomerEmployee(List customers, List employeeTO) { + List customerWorkbenchListVOS = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合 + CustomerWorkbenchListVO customerWorkbenchListVO; + // 将客户信息和客户经理及部门信息拼装起来 + for (CustomerEntity customer : customers) { + // 每一个客户对应一个不同的对象 + customerWorkbenchListVO = new CustomerWorkbenchListVO(); + for (EmployeeTO anEmployeeTO : employeeTO) { + if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) { + BeanUtils.copyProperties(customer,customerWorkbenchListVO); + customerWorkbenchListVO.setManager(anEmployeeTO.getEmpName()); + customerWorkbenchListVO.setDepartments(anEmployeeTO.getDeptNames()); + customerWorkbenchListVOS.add(customerWorkbenchListVO); + } + } + if (!Objects.equals(customerWorkbenchListVO.getId(), customer.getId())) { + BeanUtils.copyProperties(customer,customerWorkbenchListVO); + customerWorkbenchListVOS.add(customerWorkbenchListVO); + } + } + return customerWorkbenchListVOS; + } +} diff --git a/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml b/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml index 36ac5037..7b4db4b2 100644 --- a/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml +++ b/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml @@ -90,4 +90,6 @@ WHERE del_or_not = 0; + + \ No newline at end of file diff --git a/dq-financial-crms/src/main/resources/mapper/crms/CustomerWorkbenchDao.xml b/dq-financial-crms/src/main/resources/mapper/crms/CustomerWorkbenchDao.xml new file mode 100644 index 00000000..5462739c --- /dev/null +++ b/dq-financial-crms/src/main/resources/mapper/crms/CustomerWorkbenchDao.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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 index 8a266936..b21c483e 100644 --- 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 @@ -5,11 +5,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableScheduling; @EnableFeignClients(basePackages = "com.daqing.financial.hrms.feign") @EnableDiscoveryClient @SpringBootApplication @ComponentScan(basePackages = "com.daqing") +@EnableScheduling public class DqFinancialHrmsApplication { public static void main(String[] args) { diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/config/CorsConfig.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/config/CorsConfig.java index 552094b0..fc82045d 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/config/CorsConfig.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/config/CorsConfig.java @@ -1,33 +1,34 @@ -//package com.daqing.financial.hrms.config; -// -//import org.springframework.context.annotation.Bean; -//import org.springframework.context.annotation.Configuration; -//import org.springframework.web.cors.CorsConfiguration; -//import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -//import org.springframework.web.filter.CorsFilter; -// -///** -// * 实现基本的跨域请求 -// * -// * @auther River -// * @date 2020/9/25 15:09 -// */ -//@Configuration -//public class CorsConfig { -// -// @Bean -// public CorsFilter corsFilter() { -// final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); -// final CorsConfiguration corsConfiguration = new CorsConfiguration(); -// /*是否允许请求带有验证信息*/ -// corsConfiguration.setAllowCredentials(true); -// /*允许访问的客户端域名*/ -// corsConfiguration.addAllowedOrigin("*"); -// /*允许服务端访问的客户端请求头*/ -// corsConfiguration.addAllowedHeader("*"); -// /*允许访问的方法名,GET POST等*/ -// corsConfiguration.addAllowedMethod("*"); -// urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); -// return new CorsFilter(urlBasedCorsConfigurationSource); -// } -//} +package com.daqing.financial.hrms.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +/** + * 实现基本的跨域请求 + * + * @auther River + * @date 2020/9/25 15:09 + */ +@Configuration +public class CorsConfig { + + @Bean + public CorsFilter corsFilter() { + final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); + final CorsConfiguration corsConfiguration = new CorsConfiguration(); + /*是否允许请求带有验证信息*/ + corsConfiguration.setAllowCredentials(true); + /*允许访问的客户端域名*/ + corsConfiguration.addAllowedOrigin("*"); + /*允许服务端访问的客户端请求头*/ + corsConfiguration.addAllowedHeader("*"); + /*允许访问的方法名,GET POST等*/ + corsConfiguration.addAllowedMethod("*"); + urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); + return new CorsFilter(urlBasedCorsConfigurationSource); + } +} +//TODO:跨域注解,上线时注解掉,网关已经统一处理了 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 index f6fcee9f..2e3c102a 100644 --- 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 @@ -6,8 +6,6 @@ import com.daqing.framework.domain.hrms.DepartmentVO; import com.daqing.framework.domain.hrms.DeptEntity; import com.daqing.framework.domain.hrms.request.DeptAddRequest; import com.daqing.framework.model.response.ResponseResult; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -65,8 +63,8 @@ public class DeptController implements DeptControllerApi { @Override @PutMapping("/update/sort") //@RequiresPermissions("hrms:dept:update_sort") - public ResponseResult updateSort(@RequestBody DeptEntity[] depts) { - return deptService.updateBatchById(Arrays.asList(depts)) ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + public ResponseResult updateSort(@RequestBody List depts) { + return deptService.updateBatchById(depts) ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); } /** 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 index 99c0df78..10679a82 100644 --- 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 @@ -5,16 +5,25 @@ import com.daqing.financial.hrauth.enums.OperationType; import com.daqing.financial.hrauth.enums.OperationUnit; import com.daqing.financial.hrms.EmployeeControllerApi; import com.daqing.financial.hrms.service.EmployeeService; +import com.daqing.framework.domain.crms.request.EmployeeDisableRequest; import com.daqing.framework.domain.hrms.EmployeeEntity; +import com.daqing.framework.domain.hrms.UserEntity; +import com.daqing.framework.domain.hrms.ext.EmployeeInfoVO; import com.daqing.framework.domain.hrms.ext.EmployeeTO; import com.daqing.framework.domain.hrms.ext.EmployeeVO; +import com.daqing.framework.domain.hrms.request.EmployeeRequest; +import com.daqing.framework.domain.hrms.response.RolePermissionResponse; +import com.daqing.framework.model.response.CommonCode; 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 org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.Arrays; +import java.util.HashMap; import java.util.List; @@ -37,19 +46,44 @@ public class EmployeeController implements EmployeeControllerApi { //@RequiresPermissions("hrms:employee:info") public ResponseResult list(@RequestParam("page") Integer page, @RequestParam("size") Integer size, - @Valid EmployeeEntity employee) { - PageUtils data = employeeService.queryPage(page, size, employee); + EmployeeRequest employeeRequest) { + PageUtils data = employeeService.queryPage(page, size, employeeRequest); return new ResponseResult().SUCCESS(data); } /** - * 信息 + * 详情 */ - @GetMapping("/info/{id}") + @GetMapping("/info") //@RequiresPermissions("hrms:employee:info") - public ResponseResult info(@PathVariable("id") Long id) { - EmployeeEntity employee = employeeService.getById(id); - return ResponseResult.SUCCESS(); + public ResponseResult info(@RequestParam("id") Long id) { + + EmployeeInfoVO data = employeeService.info(id); + + return new ResponseResult().SUCCESS(data); + } + + /** + * 权限树 + */ + @Override + @PostMapping("/tree") + public ResponseResult tree(@RequestBody List ids) { + List result = employeeService.permissionTreeList(ids); + return result == null ? new ResponseResult(CommonCode.PERMISSION_IS_NOT) : + new ResponseResult>().SUCCESS(result); + } + + /** + * 修改 + */ + @Override + @PostMapping("/update") + public ResponseResult update(@RequestBody @Valid EmployeeInfoVO employeeInfoVO) { + + Boolean result = employeeService.update(employeeInfoVO); + + return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.UPDATE_FAIL); } /** @@ -57,21 +91,46 @@ public class EmployeeController implements EmployeeControllerApi { */ @PostMapping("/save") //@RequiresPermissions("hrms:employee:save") - public ResponseResult save(@RequestBody EmployeeEntity employee) { - employeeService.save(employee); + public ResponseResult save(@RequestBody EmployeeInfoVO employeeInfoVO) { + Boolean result = employeeService.save(employeeInfoVO); - return ResponseResult.SUCCESS(); + return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.SAVE_FAIL); } /** - * 修改 + * 导出 + */ + @GetMapping("/excelExport") + @Override + public ResponseResult excelExport(HttpServletResponse response) { + + Boolean result = employeeService.excelExport(response); + + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } + + /** + * 导出模板 + */ + @GetMapping("/excelTemplate") + @Override + public ResponseResult excelTemplate(HttpServletResponse response) { + + Boolean result = employeeService.excelTemplate(response); + + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } + + /** + * 导入 */ - @PutMapping("/update") - //@RequiresPermissions("hrms:employee:update") - public ResponseResult update(@RequestBody EmployeeEntity employee) { - employeeService.updateById(employee); + @PostMapping("/excelImport") + @Override + public ResponseResult excelImport(MultipartFile file) { - return ResponseResult.SUCCESS(); + Boolean result = employeeService.excelImport(file); + + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); } /** @@ -79,10 +138,56 @@ public class EmployeeController implements EmployeeControllerApi { */ @DeleteMapping("/delete") //@RequiresPermissions("hrms:employee:delete") - public ResponseResult delete(@RequestBody Long[] ids) { - employeeService.removeByIds(Arrays.asList(ids)); + public ResponseResult delete(@RequestBody List ids) { + Boolean result = employeeService.delete(ids); + + return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.DELETE_FAIL); + } - return ResponseResult.SUCCESS(); + /** + * 启用 + */ + @Override + @GetMapping("/start") + public ResponseResult start(@RequestParam("id")Long id) { + + Boolean result = employeeService.start(id); + + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } + + /** + * 禁用 + */ + @Override + @PostMapping("/stop") + public ResponseResult stop(@RequestBody @Valid EmployeeDisableRequest employeeDisableRequest) { + + Boolean result = employeeService.stop(employeeDisableRequest); + + return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.DISABLE_FAIL); + } + + /** + * 禁用详情 + */ + @GetMapping("/forbidInfo") + @Override + public ResponseResult forbidInfo(@RequestParam("id")Long id) { + + UserEntity user = employeeService.forbidInfo(id); + + return new ResponseResult().SUCCESS(user); + } + + /** + * 重置密码 + */ + @Override + @GetMapping("/reset") + public ResponseResult reset(@RequestParam("id") Long id) { + Boolean result = employeeService.reset(id); + return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.RESET_FAIL); } /** 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 index 0f7a33d3..e1f506a8 100644 --- 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 @@ -66,4 +66,22 @@ public class PositionController implements PositionControllerApi { positionService.removePositionByIds(Arrays.asList(ids)); return ResponseResult.SUCCESS(); } + + /** + * 所有的职位id和名称 + */ + @GetMapping("/listPositionIdAndName") + @Override + public ResponseResult listPositionIdAndName() { + return new ResponseResult().SUCCESS(positionService.listPositionIdAndName()); + } + + /** + * 所有的角色id和名称 + */ + @GetMapping("/listRoleIdAndName") + @Override + public ResponseResult listRoleIdAndName() { + return new ResponseResult().SUCCESS(positionService.listRoleIdAndName()); + } } 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 index a1a82215..b6596f00 100644 --- 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 @@ -1,12 +1,16 @@ package com.daqing.financial.hrms.controller; +import com.daqing.financial.hrms.UserControllerApi; import com.daqing.financial.hrms.service.UserService; import com.daqing.framework.domain.hrms.UserEntity; +import com.daqing.framework.domain.hrms.ext.EmployeeAndUserVO; +import com.daqing.framework.model.response.CommonCode; 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 javax.validation.Valid; import java.util.Arrays; import java.util.Map; @@ -20,63 +24,68 @@ import java.util.Map; */ @RestController @RequestMapping("hrms/user") -public class UserController { +public class UserController implements UserControllerApi { + @Autowired private UserService userService; /** - * 列表 + * 信息 */ - @GetMapping("/list") - //@RequiresPermissions("hrms:user:list") - public ResponseResult list(@RequestParam Map params) { - PageUtils page = userService.queryPage(params); + @GetMapping("/info") + //@RequiresPermissions("hrms:user:info") + public ResponseResult info() { - return ResponseResult.SUCCESS(); - } + EmployeeAndUserVO info = userService.info(); + return new ResponseResult().SUCCESS(info); + } /** - * 信息 + * 修改 */ - @GetMapping("/info/{id}") - //@RequiresPermissions("hrms:user:info") - public ResponseResult info(@PathVariable("id") Long id) { - UserEntity user = userService.getById(id); + @PostMapping("/update") + @Override + public ResponseResult update(@RequestBody @Valid EmployeeAndUserVO employeeAndUserVO) { + + Boolean result = userService.update(employeeAndUserVO); - return ResponseResult.SUCCESS(); + return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.UPDATE_FAIL); } /** - * 保存 + * 获取验证码 */ - @PostMapping("/save") - //@RequiresPermissions("hrms:user:save") - public ResponseResult save(@RequestBody UserEntity user) { - userService.save(user); + @GetMapping("/code") + @Override + public ResponseResult code(String phone) { + + Boolean result = userService.getVerificationCode(phone); - return ResponseResult.SUCCESS(); + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); } /** - * 修改 + * 修改密码 */ - @PutMapping("/update") - //@RequiresPermissions("hrms:user:update") - public ResponseResult update(@RequestBody UserEntity user) { - userService.updateById(user); - return ResponseResult.SUCCESS(); + @GetMapping("/updatePassword") + @Override + public ResponseResult updatePassword(@RequestParam("id") Long id, String primaryPassword, + String newPassword, String affirmNewPassword) { + Boolean result = userService.updatePassword(id, primaryPassword, newPassword, affirmNewPassword); + + return result ? ResponseResult.SUCCESS() : new ResponseResult(CommonCode.UPDATE_FAIL); } /** - * 删除 + * 绑定手机号 */ - @DeleteMapping("/delete") - //@RequiresPermissions("hrms:user:delete") - public ResponseResult delete(@RequestBody Long[] ids) { - userService.removeByIds(Arrays.asList(ids)); + @Override + public ResponseResult binding(@RequestParam("id") Long id, String phone, String code) { + + Boolean result = userService.bindingPhoneAccount(id, phone, code); - return ResponseResult.SUCCESS(); + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); } /** 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 index f6718ebc..3442d3c7 100644 --- 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 @@ -27,4 +27,6 @@ public interface DeptDao extends BaseMapper { List getDepartmentByParentId(Long parentId); + List listDepartmentIdAndName(); + } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptPositionDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptPositionDao.java index 9ea1a3cd..e0e467ba 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptPositionDao.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptPositionDao.java @@ -19,4 +19,5 @@ public interface DeptPositionDao extends BaseMapper { int saveBatch(@Param("list") List deptPositionList); int deleteByPositionId(@Param("positionId") Long positionId); + } 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 index be862b2b..0e6a8e99 100644 --- 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 @@ -4,12 +4,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.daqing.framework.domain.hrms.EmployeeEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.daqing.framework.domain.hrms.ext.EmployeeTO; -import com.daqing.framework.domain.hrms.ext.EmployeeVO; -import com.daqing.framework.domain.hrms.ext.PositionVO; +import com.daqing.framework.domain.hrms.UserEntity; +import com.daqing.framework.domain.hrms.ext.*; +import com.daqing.framework.domain.hrms.request.EmployeeRequest; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; /** @@ -31,4 +32,52 @@ public interface EmployeeDao extends BaseMapper { List listEmployeeName(); IPage pageByCondition(Page page, @Param("employee") EmployeeEntity employee); + + IPage pageList(Page page, @Param("employee") EmployeeRequest employeeRequest); + + List excelList(); + + IPage pageListByDept(Page page, @Param("employee") EmployeeRequest employeeRequest); + + List queryIds(@Param("ids") List ids); + + Boolean deleteByIds(@Param("ids") List ids); + + Integer getStatus(Long id); + + Boolean startOrStop(UserEntity user); + + UserEntity forbidInfo(Long id); + + List listDisableTime(); + + Long getUserId(Long id); + + Boolean updatePassword(@Param("id")Long id,@Param("password")String password); + + EmployeeInfoVO getInfo(Long id); + + Boolean updateEmployee(EmployeeEntity employeeEntity); + + Boolean updateUser(@Param("id")Long id, @Param("account")String account, @Param("modifyTime")Date modifyTime); + + Boolean deleteDepartment(Long id); + + Boolean deletePosition(Long id); + + Boolean deleteRole(Long id); + + Boolean insertDepartment(@Param("id") Long id,@Param("deptIds") List ids); + + Boolean insertPosition(@Param("id") Long id,@Param("positionIds") List ids); + + Boolean insertRole(@Param("id")Long id,@Param("roleIds") List roleIds); + + Boolean insertUser(UserEntity user); + + Boolean insertEmployee(EmployeeEntity employeeEntity); + + EmployeeAndUserVO getEmployeeByUserId(Long id); + + Boolean updateEmployeeAndUser(EmployeeEntity employeeEntity); } 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 index 1f294b30..caa7c64c 100644 --- 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 @@ -2,7 +2,11 @@ package com.daqing.financial.hrms.dao; import com.daqing.framework.domain.hrms.PermissionEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.daqing.framework.domain.hrms.response.RolePermissionResponse; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 记录菜单权限 @@ -13,5 +17,7 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PermissionDao extends BaseMapper { - + + List listPermissionByRoleIds(@Param("ids") List ids); + } 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 index 341b0605..e801c033 100644 --- 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 @@ -8,6 +8,8 @@ import com.daqing.framework.domain.hrms.ext.PositionVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 记录职位信息 * @@ -23,4 +25,6 @@ public interface PositionDao extends BaseMapper { Integer getCountByNameAndDeptIdAndId(@Param("deptId") Long deptId, @Param("name") String name, @Param("id") Long id); IPage pageByCondition(Page page, @Param("queryMsg") String queryMsg); + + List listPositionIdAndName(); } 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 index 538f248b..c823bd0b 100644 --- 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 @@ -2,8 +2,11 @@ package com.daqing.financial.hrms.dao; import com.daqing.framework.domain.hrms.RoleEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.daqing.framework.domain.hrms.ext.RoleVO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 员工角色表 * @@ -13,5 +16,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface RoleDao extends BaseMapper { - + + List listRoleIdAndName(); } 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 index fab08c4e..a0c375ff 100644 --- 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 @@ -3,6 +3,7 @@ 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; +import org.apache.ibatis.annotations.Param; /** * 人资管理系统,员工账号信息表,用于存储员工账号密码等登录相关数据 @@ -13,5 +14,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface UserDao extends BaseMapper { - + + String getPasswordById(Long id); + + String getAccountById(Long id); + + Boolean updatePassword(@Param("id") Long id, @Param("password") String password); + + String getPhoneAccount(Long id); + + Boolean updatePhoneAccount(@Param("id")Long id,@Param("phoneAccount") String phoneAccount); } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/HrmsAuthFeignService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/HrmsAuthFeignService.java new file mode 100644 index 00000000..165d9737 --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/HrmsAuthFeignService.java @@ -0,0 +1,14 @@ +package com.daqing.financial.hrms.feign; + +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 声明这是一个远程调用 + * @auther River + * @date 2020/10/12 17:58 + */ +@FeignClient("dq-financial-hrms-auht") +public interface HrmsAuthFeignService { + + +} 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 index d716be3e..179af90c 100644 --- 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 @@ -1,11 +1,18 @@ package com.daqing.financial.hrms.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.domain.crms.request.EmployeeDisableRequest; +import com.daqing.framework.domain.hrms.UserEntity; +import com.daqing.framework.domain.hrms.ext.EmployeeInfoVO; import com.daqing.framework.domain.hrms.ext.EmployeeTO; import com.daqing.framework.domain.hrms.ext.EmployeeVO; +import com.daqing.framework.domain.hrms.request.EmployeeRequest; +import com.daqing.framework.domain.hrms.response.RolePermissionResponse; import com.daqing.framework.utils.PageUtils; import com.daqing.framework.domain.hrms.EmployeeEntity; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; @@ -24,6 +31,32 @@ public interface EmployeeService extends IService { List listEmployeeName(); - PageUtils queryPage(Integer page, Integer size, EmployeeEntity employee); + PageUtils queryPage(Integer page, Integer size, EmployeeRequest employeeRequest); + + Boolean delete(List ids); + + Boolean start(Long id); + + Boolean stop(EmployeeDisableRequest employeeDisableRequest); + + UserEntity forbidInfo(Long id); + + void disableDetection(); + + Boolean reset(Long id); + + EmployeeInfoVO info(Long id); + + List permissionTreeList(List ids); + + Boolean update(EmployeeInfoVO employeeInfoVO); + + Boolean save(EmployeeInfoVO employeeInfoVO); + + Boolean excelExport(HttpServletResponse response); + + Boolean excelTemplate(HttpServletResponse response); + + Boolean excelImport(MultipartFile file); } 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 index 86abebef..9a6f7838 100644 --- 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 @@ -2,6 +2,8 @@ package com.daqing.financial.hrms.service; import com.baomidou.mybatisplus.extension.service.IService; import com.daqing.framework.domain.hrms.PositionEntity; +import com.daqing.framework.domain.hrms.ext.PositionVO; +import com.daqing.framework.domain.hrms.ext.RoleVO; import com.daqing.framework.domain.hrms.request.PositionRequest; import com.daqing.framework.domain.hrms.response.PositionResponse; import com.daqing.framework.utils.PageUtils; @@ -26,5 +28,9 @@ public interface PositionService extends IService { PositionResponse getPositionById(Long id); void removePositionByIds(List asList); + + List listPositionIdAndName(); + + List listRoleIdAndName(); } 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 index 43e1b6eb..7fcc4adb 100644 --- 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 @@ -1,9 +1,11 @@ package com.daqing.financial.hrms.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.domain.hrms.ext.EmployeeAndUserVO; import com.daqing.framework.utils.PageUtils; import com.daqing.framework.domain.hrms.UserEntity; +import java.io.IOException; import java.util.Map; /** @@ -15,6 +17,14 @@ import java.util.Map; */ public interface UserService extends IService { - PageUtils queryPage(Map params); + EmployeeAndUserVO info(); + + Boolean update(EmployeeAndUserVO employeeAndUserVO); + + Boolean updatePassword(Long id,String primaryPassword,String newPassword,String affirmNewPassword); + + Boolean getVerificationCode(String phone); + + Boolean bindingPhoneAccount(Long id,String phone,String code); } 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 index 847edf66..c1ad957a 100644 --- 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 @@ -102,6 +102,10 @@ public class DeptServiceImpl extends ServiceImpl implements return this.save(deptEntity); } + /** + * 树形结构部门查询 + * @return + */ @Override public List listWithTree() { return getDeptTreeList(this.list(), 0L); 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 index 0752d78e..6ca23860 100644 --- 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 @@ -2,57 +2,479 @@ package com.daqing.financial.hrms.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.daqing.framework.domain.hrms.ext.EmployeeTO; -import com.daqing.framework.domain.hrms.ext.EmployeeVO; -import com.daqing.framework.domain.hrms.ext.PositionVO; -import com.daqing.framework.utils.PageUtils; -import org.springframework.stereotype.Service; -import java.util.List; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.daqing.financial.hrms.dao.EmployeeDao; -import com.daqing.framework.domain.hrms.EmployeeEntity; +import com.daqing.financial.hrms.dao.*; import com.daqing.financial.hrms.service.EmployeeService; +import com.daqing.framework.domain.crms.request.EmployeeDisableRequest; +import com.daqing.framework.domain.crms.response.CrmsCode; +import com.daqing.framework.domain.hrms.*; +import com.daqing.framework.domain.hrms.ext.*; +import com.daqing.framework.domain.hrms.request.EmployeeRequest; +import com.daqing.framework.domain.hrms.response.HrmsCode; +import com.daqing.framework.domain.hrms.response.RolePermissionResponse; +import com.daqing.framework.exception.ExceptionCast; +import com.daqing.framework.model.response.CommonCode; +import com.daqing.framework.model.response.PromptSuccess; +import com.daqing.framework.util.Md5Util; +import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.excel.ExcelUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; +import java.util.stream.Collectors; @Service("employeeService") +@Slf4j public class EmployeeServiceImpl extends ServiceImpl implements EmployeeService { + @Autowired + private PermissionDao permissionDao; + + @Autowired + private DeptDao deptDao; + + @Autowired + private PositionDao positionDao; + + @Autowired + private RoleDao roleDao; + /** - * 根据员工id查询员工的姓名和部门信息 - * @param ids 员工id集合 - * @return + * 列表 */ @Override - public List getEmployeeAndDeptById(List ids) { - return this.getBaseMapper().getEmployeeAndDeptById(ids); + public PageUtils queryPage(Integer page, Integer size, EmployeeRequest employeeRequest) { + //分页参数参数校验,后续优化为自定义选择每页条数和跳转到第几页 + if (page == null || size == null){ + page = 1; + size = 10; + } + IPage iPage; + if (employeeRequest.getId() == null) { + iPage = this.getBaseMapper().pageList(new Page(page, size), employeeRequest); + } else { + iPage = this.getBaseMapper().pageListByDept(new Page(page, size), employeeRequest); + } + return new PageUtils(iPage); } + /** + * 删除 + */ + @Transactional @Override - public PageUtils queryPage(Integer page, Integer size, EmployeeEntity employee) { - //分页参数 - if (page <= 0) { - page = 1; + public Boolean delete(List ids) { + if (ids == null || ids.size() == 0) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); } - if (size <= 0) { - size = 10; + List user_ids = this.getBaseMapper().queryIds(ids); + if (user_ids == null || user_ids.size() == 0) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_IS_NULL); } - IPage employeeVO = this.getBaseMapper().pageByCondition(new Page(page, size), employee); + return this.getBaseMapper().deleteByIds(user_ids); + } - return new PageUtils(employeeVO); + /** + * 启用 + */ + @Transactional + @Override + public Boolean start(Long id) { + if (id == null){ + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + Long userId = this.getBaseMapper().getUserId(id); + UserEntity user = new UserEntity(); + user.setId(userId); + user.setStatus(PromptSuccess.START_STATUS); + return this.getBaseMapper().startOrStop(user); } + /** - * 根据id查询员工的id - * @param id - * @return + * 禁用 + */ + @Transactional + @Override + public Boolean stop(EmployeeDisableRequest employeeDisableRequest) { + UserEntity user = new UserEntity(); + BeanUtils.copyProperties(employeeDisableRequest,user); + if (employeeDisableRequest.getEmployeeId() == null || user.getDisableStartTime() == null + || user.getDisableEndTime() == null || user.getDisableCause() == null){ + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + if (user.getDisableStartTime().getTime() >= user.getDisableEndTime().getTime()){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_DISABLE_TIME_ERROR); + } + Long userId = this.getBaseMapper().getUserId(employeeDisableRequest.getEmployeeId()); + if (user.getDisableStartTime().getTime() <= (new Date()).getTime() + && (new Date()).getTime() <= user.getDisableEndTime().getTime()){ + user.setId(userId); + user.setStatus(PromptSuccess.STOP_STATUS); + return this.getBaseMapper().startOrStop(user); + }else if (user.getDisableStartTime().getTime() > (new Date()).getTime()){ + user.setId(userId); + user.setStatus(PromptSuccess.UPCOMING_STOP_STATUS); + return this.getBaseMapper().startOrStop(user); + }else { + return false; + } + } + + /** + * 禁用详情 + */ + @Override + public UserEntity forbidInfo(Long id) { + if (id == null){ + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + Long userId = this.getBaseMapper().getUserId(id); + return this.getBaseMapper().forbidInfo(userId); + } + + /** + * 定时检测是否禁用 + */ + @Transactional + @Override + public void disableDetection() { + List users = this.getBaseMapper().listDisableTime(); + if (users.size() != 0){ + for (UserEntity user : users) { + if (user.getDisableStartTime().getTime() <= (new Date()).getTime() + && (new Date()).getTime() <= user.getDisableEndTime().getTime()){ + user.setStatus(PromptSuccess.STOP_STATUS); + this.getBaseMapper().startOrStop(user); + }else if ((new Date()).getTime() < user.getDisableStartTime().getTime()){ + user.setStatus(PromptSuccess.UPCOMING_STOP_STATUS); + this.getBaseMapper().startOrStop(user); + }else if ((new Date()).getTime() > user.getDisableEndTime().getTime()){ + user.setStatus(PromptSuccess.START_STATUS); + user.setDisableStartTime(null); + user.setDisableEndTime(null); + user.setDisableCause(null); + this.getBaseMapper().startOrStop(user); + } + } + } + } + + /** + * 重置密码 + */ + @Override + public Boolean reset(Long id) { + if (id == null) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + Long userId = this.getBaseMapper().getUserId(id); + if (userId == null) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_IS_NULL); + } + String password = Md5Util.md5(PromptSuccess.RESET_PASSWORD + userId); + return this.getBaseMapper().updatePassword(id, password); + } + + /** + * 详细信息 + */ + @Override + public EmployeeInfoVO info(Long id) { + if (id == null) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + EmployeeInfoVO info = this.getBaseMapper().getInfo(id); + if (info == null) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_IS_NULL); + } + if (info.getRoles().size() != 0 && info.getRoles() != null) { + List roleIds = new ArrayList<>(); + for (RoleEntity role : info.getRoles()) { + roleIds.add(role.getId()); + } + List list = permissionDao.listPermissionByRoleIds(roleIds); + if (list.size() != 0) { + // 去重 + Map map = new HashMap<>(); + for (RolePermissionResponse rolePermissionResponse : list) { + map.put(rolePermissionResponse.getPermissionId(),rolePermissionResponse); + } + list.clear(); + for (Long key : map.keySet()) { + list.add(map.get(key)); + } + List permissionTreeList = this.getRolePermissionTreeList(list, 0L); + if (permissionTreeList != null && permissionTreeList.size() != 0) { + info.setPermissions(permissionTreeList); + } + } + } + return info; + } + + /** + * 选择角色后对应的权限展示 + */ + @Override + public List permissionTreeList(List ids) { + if (ids == null || ids.size() == 0) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + List list = permissionDao.listPermissionByRoleIds(ids); + if (list.size() != 0) { + // 去重 + Map map = new HashMap<>(); + for (RolePermissionResponse rolePermissionResponse : list) { + map.put(rolePermissionResponse.getPermissionId(),rolePermissionResponse); + } + list.clear(); + for (Long key : map.keySet()) { + list.add(map.get(key)); + } + return this.getRolePermissionTreeList(list, 0L); + } else { + return null; + } + } + + /** + * 更新 + */ + @Transactional + @Override + public Boolean update(EmployeeInfoVO employeeInfoVO) { + if (employeeInfoVO.getId() == null) { + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + if (employeeInfoVO.getDepartmentIds() == null || employeeInfoVO.getDepartmentIds().size() == 0) { + ExceptionCast.cast(HrmsCode.DEPT_NOT_NULL); + } + if (employeeInfoVO.getPositionIds() == null || employeeInfoVO.getPositionIds().size() == 0) { + ExceptionCast.cast(HrmsCode.POSITION_NOT_NULL); + } + if (employeeInfoVO.getRoleIds() == null || employeeInfoVO.getRoleIds().size() == 0) { + ExceptionCast.cast(HrmsCode.ROLE_NOT_NULL); + } + Long userId = this.getBaseMapper().getUserId(employeeInfoVO.getId()); + if (userId == null){ + ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_IS_NULL); + } + String account = employeeInfoVO.getAccount(); + EmployeeEntity employee = new EmployeeEntity(); + BeanUtils.copyProperties(employeeInfoVO, employee); + Boolean result1 = this.getBaseMapper().updateEmployee(employee); + Boolean result2 = this.getBaseMapper().updateUser(userId, account, new Date()); + this.getBaseMapper().deleteDepartment(employeeInfoVO.getId()); + this.getBaseMapper().deletePosition(employeeInfoVO.getId()); + this.getBaseMapper().deleteRole(userId); + Boolean result3 = this.getBaseMapper().insertDepartment(employeeInfoVO.getId(), employeeInfoVO.getDepartmentIds()); + Boolean result4 = this.getBaseMapper().insertPosition(employeeInfoVO.getId(), employeeInfoVO.getPositionIds()); + Boolean result5 = this.getBaseMapper().insertRole(userId, employeeInfoVO.getRoleIds()); + + return result1 && result2 && result3 && result4 && result5; + } + + /** + * 新增 + */ + @Transactional + @Override + public Boolean save(EmployeeInfoVO employeeInfoVO) { + if (employeeInfoVO.getDepartmentIds() == null || employeeInfoVO.getDepartmentIds().size() == 0) { + ExceptionCast.cast(HrmsCode.DEPT_NOT_NULL); + } + if (employeeInfoVO.getPositionIds() == null || employeeInfoVO.getPositionIds().size() == 0) { + ExceptionCast.cast(HrmsCode.POSITION_NOT_NULL); + } + if (employeeInfoVO.getRoleIds() == null || employeeInfoVO.getRoleIds().size() == 0) { + ExceptionCast.cast(HrmsCode.ROLE_NOT_NULL); + } + UserEntity user = new UserEntity(); + user.setAccount(employeeInfoVO.getAccount()); + user.setCreateTime(new Date()); + Boolean result1 = this.getBaseMapper().insertUser(user); + EmployeeEntity employee = new EmployeeEntity(); + if (result1) { + employee.setUserId(user.getId()); + BeanUtils.copyProperties(employeeInfoVO, employee); + Boolean result2 = this.getBaseMapper().insertEmployee(employee); + if (result2) { + Boolean result3 = this.getBaseMapper().insertDepartment(employee.getId(), employeeInfoVO.getDepartmentIds()); + Boolean result4 = this.getBaseMapper().insertPosition(employee.getId(), employeeInfoVO.getPositionIds()); + Boolean result5 = this.getBaseMapper().insertRole(user.getId(), employeeInfoVO.getRoleIds()); + return result3 && result4 && result5; + } + } + return false; + } + + /** + * 导出 + */ + @Transactional + @Override + public Boolean excelExport(HttpServletResponse response) { + try { + List list = this.getBaseMapper().excelList(); + ExcelUtil.writeExcelWithSheets(response, list, "员工信息一览表", "employee", new EmployeeListVO()) + .finish(); + return true; + } catch (Exception e) { + ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); + return false; + } + } + + /** + * 导出模板 + */ + @Transactional + @Override + public Boolean excelTemplate(HttpServletResponse response) { + try { + ExcelUtil.writeExcelWithSheets(response, new ArrayList(), "员工信息导入模板", "employee", new EmployeeTemplate()) + .finish(); + return true; + } catch (Exception e) { + ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); + return false; + } + } + + /** + * 导入 + */ + @Transactional + @Override + public Boolean excelImport(MultipartFile file) { + if (file == null || file.isEmpty()){ + ExceptionCast.cast(CrmsCode.NOT_NULL); + } + EmployeeExcelImport employeeExcelImport = new EmployeeExcelImport(); + UserEntity user = new UserEntity(); + EmployeeEntity employee = new EmployeeEntity(); + List listDepartmentIdAndName = deptDao.listDepartmentIdAndName(); + List listPositionIdAndName = positionDao.listPositionIdAndName(); + List listRoleIdAndName = roleDao.listRoleIdAndName(); + Set deptIds = new HashSet<>(); + Set positionIds = new HashSet<>(); + Set roleIds = new HashSet<>(); + List employees = ExcelUtil.readExcel(file, employeeExcelImport, 1); + if (employees.size() == 0) { + ExceptionCast.cast(HrmsCode.EXCEL_DATA_IS_NULL); + } + for (Object e : employees) { + BeanUtils.copyProperties(e, employeeExcelImport); + if (employeeExcelImport.getName() == null) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_NAME_IS_NULL); + } + if (employeeExcelImport.getAccount() == null) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_ACCOUNT_IS_NULL); + } + if (employeeExcelImport.getJobNumber() == null) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_JOBNUMBER_IS_NULL); + } + user.setAccount(employeeExcelImport.getAccount()); + user.setCreateTime(new Date()); + this.getBaseMapper().insertUser(user); + BeanUtils.copyProperties(e, employee); + employee.setUserId(user.getId()); + this.getBaseMapper().insertEmployee(employee); + // 部门 + String[] departmentNames = employeeExcelImport.getDepartmentNameList().split(","); + if (departmentNames.length == 0) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_DEPARTMENT_IS_NULL); + } + for (DepartmentVO department : listDepartmentIdAndName) { + for (String s : departmentNames) { + if (Objects.equals(department.getName(), s)) { + deptIds.add(department.getId()); + } + } + } + if (deptIds.size() != departmentNames.length) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_DEPARTMENT_NAME_IS_NOT); + } + this.getBaseMapper().insertDepartment(employee.getId(), new ArrayList<>(deptIds)); + // 职位 + String[] positionNames = employeeExcelImport.getPositionNameList().split(","); + if (positionNames.length == 0) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_POSITION_IS_NULL); + } + for (PositionVO position : listPositionIdAndName) { + for (String s : positionNames) { + if (Objects.equals(position.getName(), s)) { + positionIds.add(position.getId()); + } + } + } + if (positionIds.size() != positionNames.length) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_POSITION_NAME_IS_NOT); + } + this.getBaseMapper().insertPosition(employee.getId(), new ArrayList<>(positionIds)); + // 角色 + String[] roleNames = employeeExcelImport.getRoleNameList().split(","); + if (roleNames.length == 0) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_ROLE_IS_NULL); + } + for (RoleVO role : listRoleIdAndName) { + for (String s : roleNames) { + if (Objects.equals(role.getName(), s)) { + roleIds.add(role.getId()); + } + } + } + if (roleIds.size() != roleNames.length) { + ExceptionCast.cast(HrmsCode.EMPLOYEE_ROLE_NAME_IS_NOT); + } + this.getBaseMapper().insertRole(employee.getId(), new ArrayList<>(roleIds)); + } + return true; + } + + /** + * 封装员工的权限树 + */ + private List getRolePermissionTreeList(List list, Long parentId) { + return list.stream() + .filter(item -> parentId.equals(item.getParentId())) + .peek(item -> item.setChildren(getRolePermissionTreeList(list, item.getPermissionId()))) + .sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))) + .collect(Collectors.toList()); + } + + /** + * 根据id查询员工的姓名 */ @Override public EmployeeEntity getEmployeeById(Long id) { return this.getBaseMapper().getEmployeeById(id); } + /** + * 查询所有的员工id和姓名 + */ @Override public List listEmployeeName() { return this.getBaseMapper().listEmployeeName(); } + + /** + * 根据员工id查询员工的姓名和部门信息 + * + * @param ids 员工id集合 + * @return + */ + @Override + public List getEmployeeAndDeptById(List ids) { + return this.getBaseMapper().getEmployeeAndDeptById(ids); + } } \ 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 index 8437c17e..bba463bc 100644 --- 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 @@ -4,16 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.daqing.financial.hrms.dao.DeptDao; -import com.daqing.financial.hrms.dao.DeptPositionDao; -import com.daqing.financial.hrms.dao.EmployeePositionDao; -import com.daqing.financial.hrms.dao.PositionDao; +import com.daqing.financial.hrms.dao.*; import com.daqing.financial.hrms.service.PositionService; import com.daqing.framework.domain.hrms.DeptEntity; import com.daqing.framework.domain.hrms.DeptPositionEntity; import com.daqing.framework.domain.hrms.EmployeePositionEntity; import com.daqing.framework.domain.hrms.PositionEntity; import com.daqing.framework.domain.hrms.ext.PositionVO; +import com.daqing.framework.domain.hrms.ext.RoleVO; import com.daqing.framework.domain.hrms.request.PositionRequest; import com.daqing.framework.domain.hrms.response.HrmsCode; import com.daqing.framework.domain.hrms.response.PositionResponse; @@ -44,6 +42,9 @@ public class PositionServiceImpl extends ServiceImpl deptPositionDao.deleteByPositionId(id)); } + /** + * 所有的职位id和名称 + */ + @Override + public List listPositionIdAndName() { + return this.getBaseMapper().listPositionIdAndName(); + } + + /** + * 所有的角色id和名称 + */ + @Override + public List listRoleIdAndName() { + return roleDao.listRoleIdAndName(); + } + private List getDeptPositionList(List deptIdList, Long id) { return deptIdList.stream().map(deptId -> { DeptPositionEntity deptPositionEntity = new DeptPositionEntity(); - deptPositionEntity.setId(SnowflakeIdUtils.getRandomid()); deptPositionEntity.setDeptId(deptId); deptPositionEntity.setPositionId(id); return deptPositionEntity; 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 index 90c73488..7c885ff4 100644 --- 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 @@ -1,7 +1,25 @@ package com.daqing.financial.hrms.service.impl; +import com.daqing.financial.hrms.dao.EmployeeDao; +import com.daqing.framework.domain.hrms.EmployeeEntity; +import com.daqing.framework.domain.hrms.ext.EmployeeAndUserVO; +import com.daqing.framework.domain.hrms.response.HrmsCode; +import com.daqing.framework.exception.ExceptionCast; +import com.daqing.framework.model.response.CommonCode; +import com.daqing.framework.model.response.PromptSuccess; +import com.daqing.framework.util.Md5Util; +import com.daqing.framework.util.RedisUtil; +import com.daqing.framework.util.SendSMS; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.awt.image.BufferedImage; +import java.io.*; import java.util.Map; +import java.util.Objects; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -11,19 +29,203 @@ 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; +import org.springframework.transaction.annotation.Transactional; +import javax.imageio.ImageIO; + +@Slf4j @Service("userService") public class UserServiceImpl extends ServiceImpl implements UserService { + @Autowired + private EmployeeDao employeeDao; + + /** + * 当前登录的用户信息 + */ + @Override + public EmployeeAndUserVO info() { + /*HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String token = request.getHeader("token"); + String userId = RedisUtil.get("dq:token:"+token);*/ + //TODO:测试环境模拟从redis中拿取用户id + String userId = "1"; + return employeeDao.getEmployeeByUserId(Long.parseLong(userId)); + } + + /** + * 更新 + */ + @Transactional @Override - public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - ); + public Boolean update(EmployeeAndUserVO employeeAndUserVO) { + EmployeeEntity employee = new EmployeeEntity(); + Boolean result = true; + if (employeeAndUserVO.getFile() != null && !employeeAndUserVO.getFile().isEmpty()){ + //TODO:上传图像文件到oss服务器,返回一个路径地址 + try { + // 通过获取图片文件的宽度和高度来校验是否为图片文件 + BufferedImage image = ImageIO.read(employeeAndUserVO.getFile().getInputStream()); + if (image == null || image.getHeight() <= 0 || image.getWidth() <= 0){ + ExceptionCast.cast(HrmsCode.USER_FILE_TYPE_MISTAKE); + } + }catch (IOException e){ + ExceptionCast.cast(HrmsCode.USER_FILE_UPLOAD_FAIL); + } + OutputStream os = null; + InputStream inputStream = null; + String fileName = null; + try { + inputStream = employeeAndUserVO.getFile().getInputStream(); + fileName = employeeAndUserVO.getFile().getOriginalFilename(); + log.info("fileName="+fileName); + } catch (IOException e) { + e.printStackTrace(); + } + try { + String path = "D:\\image"; + // 2、保存到临时文件 + // 1K的数据缓冲 + byte[] bs = new byte[1024]; + // 读取到的数据长度 + int len; + // 输出的文件流保存到本地文件 + File tempFile = new File(path); + if (!tempFile.exists()) { + tempFile.mkdirs(); + } + os = new FileOutputStream(tempFile.getPath() + File.separator + "MyFileName.png"); + // 开始读取 + while ((len = inputStream.read(bs)) != -1) { + os.write(bs, 0, len); + } + } catch (IOException e) { + ExceptionCast.cast(HrmsCode.USER_FILE_UPLOAD_FAIL); + } catch (Exception e) { + e.printStackTrace(); + } finally { + // 完毕,关闭所有链接 + try { + os.close(); + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + BeanUtils.copyProperties(employeeAndUserVO,employee); + String phoneAccount = this.getBaseMapper().getPhoneAccount(employee.getUserId()); + if ((phoneAccount == null || phoneAccount.length() == 0) + && employeeAndUserVO.getPrimaryPhone() != null + && employeeAndUserVO.getPrimaryPhone().length() != 0 + && employeeAndUserVO.getPrimaryCode() != null + && employeeAndUserVO.getPrimaryCode().length() != 0){ + // 没有绑定手机号,现在绑定 + String code = RedisUtil.get(employeeAndUserVO.getPrimaryPhone()); + if (code == null || code.length() == 0 || !Objects.equals(employeeAndUserVO.getPrimaryCode(),code)){ + ExceptionCast.cast(HrmsCode.USER_PHONE_CODE_MISTAKE); + } + RedisUtil.del(employeeAndUserVO.getPrimaryPhone()); + result = this.getBaseMapper().updatePhoneAccount(employee.getUserId(), employeeAndUserVO.getPrimaryPhone()); + } + if (employeeAndUserVO.getPrimaryPhone() != null + && employeeAndUserVO.getPrimaryPhone().length() != 0 + && employeeAndUserVO.getPrimaryCode() != null + && employeeAndUserVO.getPrimaryCode().length() != 0 + && employeeAndUserVO.getNewPhone() != null + && employeeAndUserVO.getNewPhone().length() != 0 + && employeeAndUserVO.getNewCode() != null + && employeeAndUserVO.getNewCode().length() != 0 + && phoneAccount != null && phoneAccount.length() != 0){ + // 更换绑定的手机号 + if (!Objects.equals(phoneAccount,employeeAndUserVO.getPrimaryPhone())){ + ExceptionCast.cast(HrmsCode.USER_PRIMARY_PHONE_MISTAKE); + } + String primaryCode = RedisUtil.get(employeeAndUserVO.getPrimaryPhone()); + if (primaryCode == null || primaryCode.length() == 0 + || !Objects.equals(primaryCode,employeeAndUserVO.getPrimaryCode())){ + ExceptionCast.cast(HrmsCode.USER_PRIMARY_CODE_MISTAKE); + } + RedisUtil.del(employeeAndUserVO.getPrimaryPhone()); + String newCode = RedisUtil.get(employeeAndUserVO.getNewPhone()); + if (newCode == null || newCode.length() == 0 + || !Objects.equals(newCode,employeeAndUserVO.getNewCode())){ + ExceptionCast.cast(HrmsCode.USER_NEW_CODE_MISTAKE); + } + RedisUtil.del(employeeAndUserVO.getNewPhone()); + result = this.getBaseMapper().updatePhoneAccount(employee.getUserId(), employeeAndUserVO.getNewPhone()); + } + return result && employeeDao.updateEmployeeAndUser(employee); + } - return new PageUtils(page); + /** + * 修改密码 + */ + @Transactional + @Override + public Boolean updatePassword(Long id, String primaryPassword, String newPassword, String affirmNewPassword) { + if (id == null){ + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + if (primaryPassword == null || primaryPassword.length() == 0 + || newPassword == null || newPassword.length() == 0 + || affirmNewPassword == null || affirmNewPassword.length() == 0){ + ExceptionCast.cast(HrmsCode.USER_PASSWORD_NOT_NULL); + } + // 两次输入是否相同 + if (!Objects.equals(affirmNewPassword, newPassword)){ + ExceptionCast.cast(HrmsCode.USER_PASSWORD_NO_CONSISTENT); + } + if (!Objects.equals(Md5Util.md5(primaryPassword + id),this.getBaseMapper().getPasswordById(id))){ + ExceptionCast.cast(HrmsCode.USER_PASSWORD_MISTAKE); + } + // 正则校验 + if (!newPassword.matches(PromptSuccess.MATCHES_STRING)){ + ExceptionCast.cast(HrmsCode.USER_PASSWORD_MATCHES); + } + // 是否与账号相同 + if (Objects.equals(newPassword,this.getBaseMapper().getAccountById(id))){ + ExceptionCast.cast(HrmsCode.USER_PASSWORD_IS_NO_ACCOUNT); + } + return this.getBaseMapper().updatePassword(id,Md5Util.md5(newPassword + id)); } + /** + * 获取验证码 + */ + @Override + public Boolean getVerificationCode(String phone) { + if (phone == null || phone.length() == 0){ + ExceptionCast.cast(HrmsCode.USER_PHONE_NOT_NULL); + } + String code = (int)((Math.random() * 9 + 1) * 100000)+ ""; + // 发送短信 + Boolean result = SendSMS.sendCode(phone, code); + if (result){ + RedisUtil.setEx(phone,code,PromptSuccess.OVERDUE_TIME); + return true; + } + return false; + } + + /** + * 绑定手机号 + */ + @Transactional + @Override + public Boolean bindingPhoneAccount(Long id,String phone, String code) { + if (id == null){ + ExceptionCast.cast(CommonCode.INVALID_PARAM); + } + if (phone == null || phone.length() == 0 || code == null || code.length() == 0){ + ExceptionCast.cast(HrmsCode.USER_PHONE_OR_CODE_NOT_NULL); + } + if (RedisUtil.get(phone) == null || RedisUtil.get(phone).length() == 0 + || !Objects.equals(code,RedisUtil.get(phone))){ + ExceptionCast.cast(HrmsCode.USER_BINDING_FAIL); + } + RedisUtil.del(phone); + return this.getBaseMapper().updatePhoneAccount(id, phone); + } } \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/task/DisableDetectionTask.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/task/DisableDetectionTask.java new file mode 100644 index 00000000..9a8f5e3c --- /dev/null +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/task/DisableDetectionTask.java @@ -0,0 +1,25 @@ +package com.daqing.financial.hrms.task; + +import com.daqing.financial.hrms.service.EmployeeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +/** + * 定时禁用检测类 + * @auther River + * @date 2020/10/14 16:04 + */ +@Component +public class DisableDetectionTask { + + @Autowired + private EmployeeService employeeService; + + //格式 :秒 分 时 日 月 年 + @Scheduled(cron = "0 0 0 * * ?") + public void disableDetection(){ + + employeeService.disableDetection(); + } +} diff --git a/dq-financial-hrms/src/main/resources/bootstrap.properties b/dq-financial-hrms/src/main/resources/bootstrap.properties index bcab82bd..88864d53 100644 --- a/dq-financial-hrms/src/main/resources/bootstrap.properties +++ b/dq-financial-hrms/src/main/resources/bootstrap.properties @@ -27,6 +27,9 @@ spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-idle=8 spring.redis.jedis.pool.min-idle=0 +spring.servlet.multipart.max-file-size=10MB +spring.servlet.multipart.max-request-size=10MB + # 正式环境(prod) #服务名称 #spring.application.name=dq-financial-hrms diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml index 8ffcc49b..a51eb1a1 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml @@ -41,4 +41,8 @@ FROM hrms_dept WHERE parent_id = #{parentId} + + \ 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 index 0988e6e1..326e5d3c 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml @@ -18,11 +18,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -98,4 +213,250 @@ AND u.del_or_not = 0 + + + + + + + + + + + + + + + + + + + UPDATE hrms_user SET del_or_not = 1 WHERE id IN + + #{id} + + + + + + + + UPDATE hrms_user SET status = #{status},disable_start_time = #{disableStartTime}, + disable_end_time = #{disableEndTime},disable_cause = #{disableCause} + WHERE id = #{id} + + + + + + + + + + + + + + UPDATE hrms_user SET password = #{password} WHERE id = #{id} + + + + + + UPDATE hrms_employee SET name = #{name},job_number = #{jobNumber},gender = #{gender},birthday = #{birthday}, + phone = #{phone},company_mail = #{companyMail} + WHERE id = #{id} + + + + UPDATE hrms_user SET account = #{account},motify_time = #{modifyTime} WHERE id = #{id} + + + + DELETE FROM hrms_employee_dept WHERE employee_id = #{id} + + + + DELETE FROM hrms_employee_position WHERE emp_id = #{id} + + + + DELETE FROM hrms_employee_role WHERE user_id = #{id} + + + + INSERT INTO hrms_employee_dept + (employee_id,dept_id) + VALUES + + (#{id},#{deptId}) + + + + + INSERT INTO hrms_employee_position + (emp_id,position_id) + VALUES + + (#{id},#{positionId}) + + + + + INSERT INTO hrms_employee_role + (user_id,role_id) + VALUES + + (#{id},#{roleId}) + + + + + INSERT INTO hrms_employee (name,job_number,gender,birthday,phone,company_mail,user_id) + VALUES (#{name},#{jobNumber},#{gender},#{birthday},#{phone},#{companyMail},#{userId}) + + + + INSERT INTO hrms_user (account,create_time) VALUES (#{account},#{createTime}) + + + + + + UPDATE hrms_employee SET gender = #{gender},office_phone = #{officePhone},phone = #{phone}, + company_mail = #{companyMail},spare_mail = #{spareMail},head_portarit_url = #{headPortaritUrl} + WHERE id = #{id} + \ 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 index 9daf7734..93287347 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/PermissionDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/PermissionDao.xml @@ -19,5 +19,15 @@ + \ 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 index 88fb9584..f95fb17a 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/PositionDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/PositionDao.xml @@ -81,5 +81,7 @@ p.id != #{id} - + \ 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 index 14d82ba9..5df619cf 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml @@ -12,5 +12,8 @@ + \ 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 index 8885d686..422cac3c 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/UserDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/UserDao.xml @@ -21,5 +21,24 @@ + + + + + + UPDATE hrms_user SET password = #{password} WHERE id = #{id} + + + + + + UPDATE hrms_user SET phone_account = #{phoneAccount} WHERE id = #{id} + \ No newline at end of file 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 index 2e71ad4c..2bbec6f3 100644 --- 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 @@ -17,6 +17,10 @@ public enum CommonCode implements ResultCode { SUCCESS(true, 10000, "操作成功!"), FAIL(false, 11111, "操作失败!"), INEXISTENCE(false,10004,"抱歉,当前客户信息已不存在!"), + START_FAIL(false,10009,"启用或禁用失败,当前用户状态异常!"), + RESET_FAIL(false,10010,"重置密码失败,当前用户状态异常!"), + PERMISSION_IS_NOT(false,10011,"当前角色的权限信息不存在!"), + DISABLE_FAIL(false,10012,"禁用失败,禁用结束时间可能早于当前时间"), UPDATE_FAIL(false,10005,"更新信息失败!"), SAVE_FAIL(false,10006,"新增信息失败!"), DELETE_FAIL(false,10007,"删除失败!"), diff --git a/dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java b/dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java index 55e79037..8cd0992f 100644 --- a/dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java +++ b/dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java @@ -14,4 +14,15 @@ public class PromptSuccess { public static final String NOT_BEING = "该员工已不存在"; + public static final Integer STOP_STATUS = 1; + + public static final Integer START_STATUS = 0; + + public static final Integer UPCOMING_STOP_STATUS = 2; + + public static final String RESET_PASSWORD = "666666"; + + public static final String MATCHES_STRING = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{6,}$"; + + public static final Long OVERDUE_TIME = 70L; // 过期时间,单位为秒 } diff --git a/dq-framework-common/src/main/java/com/daqing/framework/util/SendSMS.java b/dq-framework-common/src/main/java/com/daqing/framework/util/SendSMS.java index 68bc4c91..c6b05dd9 100644 --- a/dq-framework-common/src/main/java/com/daqing/framework/util/SendSMS.java +++ b/dq-framework-common/src/main/java/com/daqing/framework/util/SendSMS.java @@ -14,17 +14,16 @@ public class SendSMS { public static void main(String[] args){ - String mobile="18707074784";//需要接受短信验证码的手机号 + String mobile="15773390498";//需要接受短信验证码的手机号 String sendTemplate="SMS_204155294";//短信模板ID,需要去阿里云平台申请,审核通过后方能使用,通常是以"SMS_"开头字符串 String code = (int)((Math.random() * 9 + 1) * 100000)+ "";//要发送给用户的短信验证码,行业通常使用六位纯数字 - boolean result= sendCode(mobile,sendTemplate,code); + boolean result= sendCode(mobile,code); if(result){ System.out.println("短信发送成功"); }else{ System.out.println("短信发送失败"); } - } /** * 通过阿里云平台发送短信,如果发送成功,返回"OK" ;否则返回的是错误信息 @@ -32,7 +31,7 @@ public class SendSMS { * @param sendTemplate 短信模板id,此处将其封装为变量,是为了由该方法的调用者决定自己来发送哪种类型的短信验证码,比如注册,重置密码类的 * @param code 您将发送到用户手机的短信验证码 */ - public static Boolean sendCode(String mobile,String sendTemplate,String code){ + public static Boolean sendCode(String mobile,String code){ boolean isSend = false; //请求失败这里会抛ClientException异常 String result=""; @@ -60,7 +59,7 @@ public class SendSMS { //必填:短信签名-可在短信控制台中找到 request.setSignName("职站");//注意要与你在短信控制台中的签名一致 //必填:短信模板-可在短信控制台中找到 - request.setTemplateCode(sendTemplate); + request.setTemplateCode("SMS_204155294"); //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 //友情提示:如果JSON中需要带换行符,请参照标准的JSON协议对换行符的要求,比如短信内容中包含\r\n的情况在JSON中需要表示成\\r\\n,否则会导致JSON在服务端解析失败 // request.setTemplateParam("{\"name\":\"Tom\", \"code\":\"123\"}"); diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerWorkbenchRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerWorkbenchRequest.java new file mode 100644 index 00000000..f4b63461 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerWorkbenchRequest.java @@ -0,0 +1,34 @@ +package com.daqing.framework.domain.crms.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; + +/** + * @auther River + * @date 2020/10/19 10:32 + */ +@Data +@ToString +public class CustomerWorkbenchRequest implements Serializable { + + @ApiModelProperty(value = "客户编号或者名称") + private String codeOrName; + + @ApiModelProperty(value = "客户类型") + private Integer customerType; + + @ApiModelProperty(value = "创建时间") + private Integer createTime; + + @ApiModelProperty(value = "起始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "审批状态(0:通过,1:不通过,2:待审核)") + private Integer status; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/EmployeeDisableRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/EmployeeDisableRequest.java new file mode 100644 index 00000000..8e4f3b75 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/EmployeeDisableRequest.java @@ -0,0 +1,37 @@ +package com.daqing.framework.domain.crms.request; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @auther River + * @date 2020/10/19 11:52 + */ +@Data +@ToString +public class EmployeeDisableRequest implements Serializable { + + @NotNull(message = "员工id不能为空") + @ApiModelProperty("员工id") + private Long employeeId; + + @NotNull(message = "禁用开始时间不能为空") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("禁用开始时间") + private Date disableStartTime; + + @NotNull(message = "禁用结束时间不能为空") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("禁用结束时间") + private Date disableEndTime; + + @NotNull(message = "禁用原因不能为空") + @ApiModelProperty("禁用原因") + private String disableCause; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/response/CustomerWorkbenchListVO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/response/CustomerWorkbenchListVO.java new file mode 100644 index 00000000..75313df7 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/response/CustomerWorkbenchListVO.java @@ -0,0 +1,43 @@ +package com.daqing.framework.domain.crms.response; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.util.List; + +/** + * 工作台客户资源列表展示类 + * + * @auther River + * @date 2020/10/19 14:19 + */ +@Data +@ToString +public class CustomerWorkbenchListVO implements Serializable { + + @ApiModelProperty(value = "id") + private Long id; + + @ApiModelProperty(value = "客户编号") + private String code; + + @ApiModelProperty(value = "客户名称") + private String name; + + @ApiModelProperty(value = "联系电话") + private String phone; + + @ApiModelProperty(value = "客户类型(0:个人类型,1:企业类型)") + private Integer type; + + @ApiModelProperty(value = "客户经理") + private String manager; + + @ApiModelProperty(value = "所属部门") + private List departments; + + @ApiModelProperty(value = "审批状态(0:,1:,2:)") + private Integer status; +} 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 index a40937f3..4d10a91e 100644 --- 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 @@ -23,7 +23,7 @@ public class PositionEntity implements Serializable { /** * 主键 */ - @TableId(value = "id", type = IdType.INPUT) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 职位名称 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 index eda6cf9e..cb5b163b 100644 --- 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 @@ -3,8 +3,11 @@ package com.daqing.framework.domain.hrms; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; @@ -56,14 +59,19 @@ public class UserEntity implements Serializable { /** * 禁用开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("禁用开始时间") private Date disableStartTime; /** * 禁用结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("禁用结束时间") private Date disableEndTime; /** * 禁用原因 */ + @ApiModelProperty("禁用原因") private String disableCause; /** * 是否删除:0、未删除,1、删除 diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeAndUserVO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeAndUserVO.java new file mode 100644 index 00000000..b9183615 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeAndUserVO.java @@ -0,0 +1,122 @@ +package com.daqing.framework.domain.hrms.ext; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.daqing.framework.domain.hrms.DeptEntity; +import com.daqing.framework.domain.hrms.PositionEntity; +import com.daqing.framework.domain.hrms.RoleEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 员工+用户详情展示类 + * + * @auther River + * @date 2020/10/15 10:01 + */ +@Data +@ToString +public class EmployeeAndUserVO implements Serializable { + + @ApiModelProperty("id") + @NotNull(message = "员工id不能为空") + @TableId(value = "id", type = IdType.INPUT) + private Long id; + + @ApiModelProperty("员工姓名") + private String name; + + @NotNull(message = "性别不能为空") + @ApiModelProperty("性别") + private Integer gender; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("生日") + private Date birthday; + + @NotNull(message = "办公电话不能为空") + @ApiModelProperty("办公电话") + private String officePhone; + + @NotNull(message = "手机号码不能为空") + @ApiModelProperty("手机号码") + private String phone; + + @NotNull(message = "公司邮箱不能为空") + @ApiModelProperty("公司邮箱") + private String companyMail; + + @NotNull(message = "备用邮箱不能为空") + @ApiModelProperty("备用邮箱") + private String spareMail; + + @ApiModelProperty("职位描述") + private String positionDescription; + + @ApiModelProperty("工号") + private String jobNumber; + + @ApiModelProperty("图像地址") + private String headPortaritUrl; + + @NotNull(message = "用户id不能为空") + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("部门") + private List departments; + + @ApiModelProperty("职位") + private List positions; + + /** + * 用户 + */ + @ApiModelProperty("账号") + private String account; + + @ApiModelProperty("密码") + private String password; + + @ApiModelProperty("登录次数") + private Integer loginNum; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @ApiModelProperty("上次登录时间") + private Date lasttime; + + @ApiModelProperty("手机账号") + private String phoneAccount; + + @ApiModelProperty("微信账号") + private String wechatId; + + @ApiModelProperty("角色") + private List roles; + + /** + * 修改信息字段 + */ + @ApiModelProperty("接收图像文件") + private MultipartFile file; + + @ApiModelProperty("旧手机号") + private String primaryPhone; + + @ApiModelProperty("旧验证码") + private String primaryCode; + + @ApiModelProperty("新手机号") + private String newPhone; + + @ApiModelProperty("新验证码") + private String newCode; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeExcelImport.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeExcelImport.java new file mode 100644 index 00000000..e8990f5a --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeExcelImport.java @@ -0,0 +1,35 @@ +package com.daqing.framework.domain.hrms.ext; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.metadata.BaseRowModel; +import lombok.Data; +import lombok.ToString; +import java.io.Serializable; + + +/** + * @auther River + * @date 2020/10/14 11:48 + */ +@Data +@ToString +public class EmployeeExcelImport extends BaseRowModel implements Serializable { + + @ExcelProperty(value = "姓名",index = 0) + private String name; + + @ExcelProperty(value = "账号",index = 1) + private String account; + + @ExcelProperty(value = "工号",index = 2) + private String jobNumber; + + @ExcelProperty(value = "部门",index = 3) + private String departmentNameList; + + @ExcelProperty(value = "职位",index = 4) + private String positionNameList; + + @ExcelProperty(value = "角色",index = 5) + private String roleNameList; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeInfoVO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeInfoVO.java new file mode 100644 index 00000000..4b747b29 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeInfoVO.java @@ -0,0 +1,84 @@ +package com.daqing.framework.domain.hrms.ext; + +import com.daqing.framework.domain.hrms.DeptEntity; +import com.daqing.framework.domain.hrms.PositionEntity; +import com.daqing.framework.domain.hrms.RoleEntity; +import com.daqing.framework.domain.hrms.response.RolePermissionResponse; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 员工详细信息展示类 + * @auther River + * @date 2020/10/12 16:23 + */ +@Data +@ToString +public class EmployeeInfoVO implements Serializable { + + @ApiModelProperty("id") + private Long id; + + @NotNull(message = "姓名不能为空") + @ApiModelProperty("姓名") + private String name; + + @NotNull(message = "工号不能为空") + @ApiModelProperty("工号") + private String jobNumber; + + @NotNull(message = "性别不能为空") + @ApiModelProperty("性别") + private Integer gender; + + @NotNull(message = "生日不能为空") + @ApiModelProperty("生日") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date birthday; + + @NotNull(message = "手机号码不能为空") + @ApiModelProperty("手机号码") + private String phone; + + @NotNull(message = "公司邮箱不能为空") + @ApiModelProperty("公司邮箱") + private String companyMail; + + @NotNull(message = "账号不能为空") + @ApiModelProperty("账号") + private String account; + + @ApiModelProperty("状态") + private Integer status; + + @ApiModelProperty("部门") + private List departments; + + @ApiModelProperty("职位") + private List positions; + + @ApiModelProperty("角色") + private List roles; + + @ApiModelProperty("权限") + private List permissions; + + /** + * 接收部门、职位、角色 + */ + @ApiModelProperty("部门id集合") + private List departmentIds; + + @ApiModelProperty("职位id集合") + private List positionIds; + + @ApiModelProperty("角色id集合") + private List roleIds; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeListVO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeListVO.java new file mode 100644 index 00000000..74ddf4d6 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeListVO.java @@ -0,0 +1,63 @@ +package com.daqing.framework.domain.hrms.ext; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.metadata.BaseRowModel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import org.springframework.data.annotation.Transient; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 员工列表展示pojo类 + * @auther River + * @date 2020/10/10 15:44 + */ +@Data +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class EmployeeListVO extends BaseRowModel implements Serializable { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("姓名") + @ExcelProperty(value = "姓名",index = 0) + private String name; + + @ExcelProperty(value = "账号",index = 1) + @ApiModelProperty("账号") + private String account; + + @ExcelProperty(value = "工号",index = 2) + @ApiModelProperty("工号") + private String jobNumber; + + @ExcelProperty(value = "部门",index = 3) + @ApiModelProperty("部门") + @Transient + private List departmentNameList; + + @ExcelProperty(value = "职位",index = 4) + @ApiModelProperty("职位") + private List positionNameList; + + @ExcelProperty(value = "角色",index = 5) + @ApiModelProperty("角色") + private List roleNameList; + + @ExcelProperty(value = "创建时间",index = 6) + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date createTime; + + @ApiModelProperty("状态(0:启用,1:禁用,2:即将禁用(展示的时候属于启用))") + private Integer status; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTemplate.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTemplate.java new file mode 100644 index 00000000..14762ddb --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTemplate.java @@ -0,0 +1,38 @@ +package com.daqing.framework.domain.hrms.ext; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.metadata.BaseRowModel; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.util.List; + +/** + * 导出员工信息模板 + * @auther River + * @date 2020/10/13 16:08 + */ +@Data +@ToString +public class EmployeeTemplate extends BaseRowModel implements Serializable { + + @ExcelProperty(value = "姓名",index = 0) + private String name; + + @ExcelProperty(value = "账号",index = 1) + private String account; + + @ExcelProperty(value = "工号",index = 2) + private String jobNumber; + + @ExcelProperty(value = "部门(eg:安全部门,技术部门,请按照格式填写正常且已存在的部门名称)",index = 3) + private List departmentNameList; + + @ExcelProperty(value = "职位(eg:总经理,产品经理,请按照格式填写正常且已存在的职位名称)",index = 4) + private List positionNameList; + + @ExcelProperty(value = "角色(eg:管理员,员工,请按照格式填写正常且已存在的角色名称)",index = 5) + private List roleNameList; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/PositionVO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/PositionVO.java index 8a02e5cc..1c31ff4a 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/PositionVO.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/PositionVO.java @@ -1,5 +1,7 @@ package com.daqing.framework.domain.hrms.ext; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @@ -14,25 +16,21 @@ import java.util.Date; */ @Data public class PositionVO implements Serializable { - /** - * 主键 - */ + + @ApiModelProperty("id") private Long id; - /** - * 职位名称 - */ + + @ApiModelProperty("职位名称") private String name; - /** - * 所属部门 - */ + + @ApiModelProperty("所属部门") private String deptNames; - /** - * 创建人 - */ + + @ApiModelProperty("创建人") private String createUserName; - /** - * 创建时间 - */ + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + @ApiModelProperty("创建时间") private Date createTime; } diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/RoleVO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/RoleVO.java new file mode 100644 index 00000000..9742274e --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/RoleVO.java @@ -0,0 +1,22 @@ +package com.daqing.framework.domain.hrms.ext; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; + +/** + * @auther River + * @date 2020/10/13 17:15 + */ +@Data +@ToString +public class RoleVO implements Serializable { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("名称") + private String name; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/EmployeeRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/EmployeeRequest.java new file mode 100644 index 00000000..3750d539 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/EmployeeRequest.java @@ -0,0 +1,22 @@ +package com.daqing.framework.domain.hrms.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +/** + * 员工列表请求参数类 + * @auther River + * @date 2020/10/10 15:29 + */ +@Data +@ToString +public class EmployeeRequest { + + @ApiModelProperty("部门id") + private Long id; + + @ApiModelProperty("姓名、账号、工号") + private String codeOrName; + +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/PositionRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/PositionRequest.java index 118f66e1..fc6654a0 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/PositionRequest.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/PositionRequest.java @@ -1,5 +1,6 @@ package com.daqing.framework.domain.hrms.request; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @@ -13,24 +14,19 @@ import java.io.Serializable; */ @Data public class PositionRequest implements Serializable { - /** - * 主键 - */ + + @ApiModelProperty("id") private Long id; - /** - * 用户id - */ + + @ApiModelProperty("用户id") private Long userId; - /** - * 部门id - */ + + @ApiModelProperty("部门id") private Long[] deptIds; - /** - * 职位名称 - */ + + @ApiModelProperty("职位名称id") private String name; - /** - * 职位介绍 - */ + + @ApiModelProperty("职位介绍") private String introduction; } diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java index d4a4d1ad..9dfe9436 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java @@ -20,6 +20,41 @@ public enum HrmsCode implements ResultCode { DEPT_LEVEL_ILLEGAL(false, 22003, "部门层级不可超出5级!"), DEPT_EMP_EXSIT(false, 22004, "请将部门下所有员工移除后再执行删除操作!"), DEPT_POSITION_EXSIT(false, 22005, "该部门下已存在该职位!"), + DEPT_NOT_NULL(false,22006,"部门不能为空!"), + + EMPLOYEE_IS_NULL(false,44001,"当前员工已不存在!"), + EMPLOYEE_NAME_IS_NULL(false,44002,"请完善员工姓名!"), + EMPLOYEE_ACCOUNT_IS_NULL(false,44003,"请完善员工账号!"), + EMPLOYEE_JOBNUMBER_IS_NULL(false,44004,"请完善员工工号!"), + EMPLOYEE_DEPARTMENT_IS_NULL(false,44005,"请完善员工部门!"), + EMPLOYEE_POSITION_IS_NULL(false,44006,"请完善员工职位!"), + EMPLOYEE_ROLE_IS_NULL(false,44007,"请完善员工角色!"), + EMPLOYEE_DEPARTMENT_NAME_IS_NOT(false,44008,"部门名称重复或不存在,请输入正常的部门名称!"), + EMPLOYEE_POSITION_NAME_IS_NOT(false,44009,"职位名称重复或不存在,请输入正常的职位名称!"), + EMPLOYEE_ROLE_NAME_IS_NOT(false,44010,"角色名称重复或不存在,请输入正常的角色名称!"), + EMPLOYEE_DISABLE_TIME_ERROR(false,44011,"禁用失败,当前禁用开始时间可能大于或等于结束时间!"), + EMPLOYEE_USER_IS_NULL(false,44012,"当前员工的用户信息已不存在!"), + + POSITION_NOT_NULL(false,55001,"职位不能为空!"), + + ROLE_NOT_NULL(false,66001,"角色不能为空!"), + + EXCEL_DATA_IS_NULL(false,77001,"当前数据为空,请填写数据!"), + + USER_PASSWORD_NOT_NULL(false,88001,"原密码或者新密码不能为空!"), + USER_PASSWORD_MISTAKE(false,88002,"原密码不正确,请重新输入!"), + USER_PASSWORD_NO_CONSISTENT(false,88003,"确认密码和新密码不一致,请重新输入!"), + USER_PASSWORD_MATCHES(false,88004,"新密码必须包含大写字母、小写字母、数字,且长度不小于6位!"), + USER_PASSWORD_IS_NO_ACCOUNT(false,88005,"新密码不能和账户相同,请重新输入!"), + USER_PHONE_NOT_NULL(false,88006,"手机号码不能为空,请输入手机号码!"), + USER_PRIMARY_CODE_MISTAKE(false,88007,"更新失败,原手机号验证码错误!"), + USER_NEW_CODE_MISTAKE(false,88008,"更新失败,新手机号验证码错误!"), + USER_PHONE_CODE_MISTAKE(false,88009,"更新失败,手机验证码错误!"), + USER_PRIMARY_PHONE_MISTAKE(false,88010,"原手机号码错误!"), + USER_PHONE_OR_CODE_NOT_NULL(false,88011,"手机号码或验证码不能为空!"), + USER_BINDING_FAIL(false,88012,"绑定失败,手机验证码错误!"), + USER_FILE_TYPE_MISTAKE(false,88013,"文件格式不正确,请重新选择图片文件!"), + USER_FILE_UPLOAD_FAIL(false,88014,"上传图像失败,请稍后刷新再试!"), PHNOE_ACCOUNT_NOT_EMPTY(false,33001,"手机号码为空!"), VERIFY_CODE_NOT_EMPTY(false,33002,"短信验证码为空!"), @@ -51,6 +86,8 @@ public enum HrmsCode implements ResultCode { @Getter private int code; + public static HrmsCode hrmsCode; + /** * 提示信息 */ diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/PositionResponse.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/PositionResponse.java index bc15d72f..f8581733 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/PositionResponse.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/PositionResponse.java @@ -1,6 +1,7 @@ package com.daqing.framework.domain.hrms.response; import com.daqing.framework.domain.hrms.DeptEntity; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @@ -19,17 +20,21 @@ public class PositionResponse implements Serializable { /** * 主键 */ + @ApiModelProperty("id") private Long id; /** * 职位名称 */ + @ApiModelProperty("职位名称") private String name; /** * 职位介绍 */ + @ApiModelProperty("职位介绍") private String introduction; /** * 部门列表 */ + @ApiModelProperty("部门列表") private List deptList; } diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/RolePermissionResponse.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/RolePermissionResponse.java index 2f8347da..e9f8b09d 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/RolePermissionResponse.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/RolePermissionResponse.java @@ -3,6 +3,7 @@ package com.daqing.framework.domain.hrms.response; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @@ -23,35 +24,42 @@ public class RolePermissionResponse implements Serializable { /** * 角色id */ + @ApiModelProperty("id") private Long roleId; /** * 角色名称 */ + @ApiModelProperty("名称") private String name; /** * 角色描述 */ + @ApiModelProperty("角色描述") private String description; /** * 权限id */ + @ApiModelProperty("权限id") private Long permissionId; /** * 拥有权限名称 */ + @ApiModelProperty("权限名称") private String permissionName; /** * 父级id */ + @ApiModelProperty("父级id") private Long parentId; /** * 子权限 */ + @ApiModelProperty("子权限") @JsonInclude(JsonInclude.Include.NON_EMPTY) @TableField(exist = false) private List children; @@ -59,6 +67,7 @@ public class RolePermissionResponse implements Serializable { /** * 排序 */ + @ApiModelProperty("子权限") private Integer sort; /** diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/TestResult.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/TestResult.java new file mode 100644 index 00000000..4dbd04e5 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/TestResult.java @@ -0,0 +1,27 @@ +package com.daqing.framework.domain.hrms.response; + +import com.daqing.framework.model.response.ResultCode; + +/** + * @auther River + * @date 2020/10/14 10:05 + */ +public class TestResult implements ResultCode +{ + public static String message1 = null; + public boolean success() { + return false; + } + + public int code() { + return 88888; + } + + public String message() { + return message1; + } + + public String test(String message){ + return message1 = message; + } +} diff --git a/客户资源信息一览表.xlsx b/员工信息一览表.xlsx similarity index 100% rename from 客户资源信息一览表.xlsx rename to 员工信息一览表.xlsx diff --git a/客户资源信息表模板.xlsx b/员工信息导入模板.xlsx similarity index 100% rename from 客户资源信息表模板.xlsx rename to 员工信息导入模板.xlsx