Merge remote-tracking branch 'origin/master'

# Conflicts:
#	dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplication.java
#	dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/config/IPageConfig.java
#	dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java
master
shijie 4 years ago
commit 390d301ee3
  1. 6
      dq-financial-api/pom.xml
  2. 11
      dq-financial-api/src/main/java/com/daqing/financial/guarantee/DgStatisticsControllerApi.java
  3. 7
      dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java
  4. 4
      dq-financial-api/src/main/java/com/daqing/financial/hrms/PositionControllerApi.java
  5. 6
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/DqFinancialGuaranteeApplication.java
  6. 4
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/config/IPageConfig.java
  7. 74
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgStatisticsController.java
  8. 27
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/CrmsFeignService.java
  9. 36
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/HrmsFeignService.java
  10. 23
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgStatisticsMapper.java
  11. 48
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/DgStatisticsRequest.java
  12. 77
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgStatisticsListRefuseResponse.java
  13. 74
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/DgStatisticsListResponse.java
  14. 23
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/IDgStatisticsService.java
  15. 373
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgStatisticsServiceImpl.java
  16. 326
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/util/DateUtils.java
  17. 3
      dq-financial-guarantee/src/main/resources/bootstrap.properties
  18. 1
      dq-financial-guarantee/src/main/resources/mapper/guarantee/DgAuditProcessMapper.xml
  19. 71
      dq-financial-guarantee/src/main/resources/mapper/guarantee/DgStatisticsMapper.xml
  20. 12
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java
  21. 8
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PositionController.java
  22. 3
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java
  23. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java
  24. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/PositionDao.java
  25. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java
  26. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PositionService.java
  27. 8
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java
  28. 11
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java
  29. 24
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java
  30. 5
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java
  31. 13
      dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml
  32. 9
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml
  33. 13
      dq-financial-hrms/src/main/resources/mapper/hrms/PositionDao.xml
  34. 2
      dq-framework-common/src/main/java/com/daqing/framework/model/response/PromptSuccess.java
  35. 5
      dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgAuditProcess.java
  36. 35
      dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/DgBusinessType.java
  37. 52
      dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/po/DgEfficiencyTeamPO.java
  38. 71
      dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/po/DgStatisticsPO.java
  39. 76
      dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/po/DgStatisticsRefusePO.java
  40. 30
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeRepetition.java
  41. 6
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeVO.java

@ -27,6 +27,12 @@
<artifactId>spring-boot-starter-web</artifactId>
<version>2.1.8.RELEASE</version>
</dependency>
<!--<dependency>
<groupId>com.daqing.financial.guarantee</groupId>
<artifactId>dq-financial-guarantee</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>-->
</dependencies>
</project>

@ -0,0 +1,11 @@
package com.daqing.financial.guarantee;
import io.swagger.annotations.Api;
/**
* @auther River
* @date 2020/11/5 14:29
*/
@Api(value = "担保业务统计",tags = "提供业务统计增删改查的方法")
public interface DgStatisticsControllerApi {
}

@ -2,6 +2,7 @@ package com.daqing.financial.hrms;
import com.daqing.framework.domain.crms.ext.CustomerCompanyVO;
import com.daqing.framework.domain.hrms.DeptEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import com.daqing.framework.domain.hrms.request.DeptAddRequest;
import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api;
@ -65,4 +66,10 @@ public interface DeptControllerApi {
*/
@ApiOperation(value = "查询该部门下所有子部门及部门下的的员工", notes = "查询该部门下所有子部门及部门下的的员工")
ResponseResult children(Long id);
/**
* 根据部门id查询该部门下所有员工
*/
@ApiOperation(value = "根据部门id查询该部门下所有员工",notes = "根据部门id查询该部门下所有员工",response = EmployeeVO.class)
ResponseResult listEmployeeByDeptId(Long deptId);
}

@ -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定义
@ -49,7 +51,7 @@ public interface PositionControllerApi {
* 所有的职位id和名称
*/
@ApiOperation(value = "所有的职位id和名称", notes = "所有的职位id和名称")
ResponseResult listPositionIdAndName();
ResponseResult listPositionIdAndName(List<Long> deptIds);
/**
* 所有的角色id和名称

@ -9,12 +9,10 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableFeignClients(basePackages = "com.daqing.financial.guarantee.feign")
//@EnableDiscoveryClient
@EnableDiscoveryClient
@SpringBootApplication
//@EnableScheduling
@EnableScheduling
@EnableSwagger2
//@ComponentScan(basePackages = "com.daqing.financial.guarantee.mapper")
@ComponentScan(basePackages = "com.daqing")
public class DqFinancialGuaranteeApplication {
public static void main(String[] args) {

@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @auther River
* @date 2020/11/5 14:38
*/
@Configuration
public class IPageConfig {
@Bean

@ -0,0 +1,74 @@
package com.daqing.financial.guarantee.controller;
import com.daqing.financial.guarantee.DgStatisticsControllerApi;
import com.daqing.financial.guarantee.model.request.DgStatisticsRequest;
import com.daqing.financial.guarantee.model.response.DgStatisticsListRefuseResponse;
import com.daqing.financial.guarantee.model.response.DgStatisticsListResponse;
import com.daqing.financial.guarantee.service.IDgStatisticsService;
import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.ApiOperation;
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;
import javax.servlet.http.HttpServletResponse;
/**
* 业务统计
*
* @auther River
* @date 2020/11/5 14:18
*/
@RestController
@RequestMapping("/guarantee/statistics")
public class DgStatisticsController implements DgStatisticsControllerApi {
@Autowired
private IDgStatisticsService iDgStatisticsService;
/**
* 列表
*/
@GetMapping("/list")
@ApiOperation(value = "业务统计列表",notes = "业务统计列表",response = DgStatisticsListResponse.class)
public ResponseResult list(@RequestParam("page") Integer page,
@RequestParam("size") Integer size, DgStatisticsRequest dgStatisticsRequest) {
return ResponseResult.SUCCESS(iDgStatisticsService.list(page,size,dgStatisticsRequest));
}
/**
* 列表导出
*/
@ApiOperation(value = "统计列表导出",notes = "统计列表导出")
@GetMapping("/excelExport")
public ResponseResult excelExport(HttpServletResponse response){
Boolean result = iDgStatisticsService.excelExport(response);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
/**
* 拒绝列表
*/
@GetMapping("/listRefuse")
@ApiOperation(value = "业务统计拒绝列表",notes = "业务统计拒绝列表",response = DgStatisticsListRefuseResponse.class)
public ResponseResult listRefuse(@RequestParam("page") Integer page,
@RequestParam("size") Integer size, DgStatisticsRequest dgStatisticsRequest) {
return ResponseResult.SUCCESS(iDgStatisticsService.listRefuse(page,size,dgStatisticsRequest));
}
/**
* 拒绝列表导出
*/
@ApiOperation(value = "统计拒绝列表导出",notes = "统计拒绝列表导出")
@GetMapping("/excelExportRefuse")
public ResponseResult excelExportRefuse(HttpServletResponse response){
Boolean result = iDgStatisticsService.excelExportRefuse(response);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
}

@ -1,27 +0,0 @@
package com.daqing.financial.guarantee.feign;
import com.daqing.framework.domain.crms.request.DgApplyAmountInfoRequest;
import com.daqing.framework.model.response.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
/**
* 这是一个声明式的远程调用
*/
@FeignClient(value = "dq-financial-crms", contextId = "guaranteeToCrms")
public interface CrmsFeignService {
/**
* 根据客户编号/客户名称获取企业信息
* @param
* @return
*/
@PostMapping("/crms/customer/queryCustomerInfoById")
ResponseResult queryCustomerInfoById(@RequestBody DgApplyAmountInfoRequest applyAmountInfo);
}

@ -0,0 +1,36 @@
package com.daqing.financial.guarantee.feign;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import com.daqing.framework.model.response.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
* 这是一个声明式的远程调用
*/
@FeignClient(value = "dq-financial-hrms", contextId = "guaranteeToHrms")
public interface HrmsFeignService {
/**
* 根据客户编号/客户名称获取企业信息
*/
// @GetMapping("/crms/customer/list")
// ResponseResult list(@RequestParam Map<String, Object> params);
/**
* 根据id集合获取对应的员工id姓名部门名称
*/
@GetMapping("/hrms/employee/getEmployeeAndDeptById") // 远程调用传递集合类型的参数必须以数组封装,不然会导致数据接收不完整
ResponseResult<List<EmployeeTO>> getEmployeeAndDeptById(@RequestParam("ids") Long[] ids);
/**
* 根据部门id获取该部门下所有员工信息
*/
@GetMapping("/hrms/dept/listEmployeeByDeptId")
ResponseResult<List<EmployeeVO>> listEmployeeByDeptId(@RequestParam("deptId") Long deptId);
}

@ -0,0 +1,23 @@
package com.daqing.financial.guarantee.mapper;
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.financial.guarantee.model.request.DgStatisticsRequest;
import com.daqing.framework.domain.guarantee.DgApplyAmountInfo;
import com.daqing.framework.domain.guarantee.po.DgStatisticsPO;
import com.daqing.framework.domain.guarantee.po.DgStatisticsRefusePO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @auther River
* @date 2020/11/5 15:06
*/
@Mapper
public interface DgStatisticsMapper extends BaseMapper<DgApplyAmountInfo> {
IPage<DgStatisticsPO> list(Page page, @Param("sr") DgStatisticsRequest dgStatisticsRequest);
IPage<DgStatisticsRefusePO> listRefuse(Page page, @Param("sr") DgStatisticsRequest dgStatisticsRequest);
}

@ -0,0 +1,48 @@
package com.daqing.financial.guarantee.model.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
/**
* 业务统计请求参数
*
* @auther River
* @date 2020/11/5 14:39
*/
@Data
@ToString
public class DgStatisticsRequest implements Serializable {
@ApiModelProperty("部门id")
private Integer deptId;
@ApiModelProperty("业务类型")
private String type;
@ApiModelProperty("提单人员工id")
private Integer empId;
@ApiModelProperty("申请时间,固定类型,0:今天,1:昨天,2:本周,3:本月,4:本年")
private Integer createFixedTime;
@ApiModelProperty("申请时间,自定义时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createCustomTime;
@ApiModelProperty("客户名称或者编号")
private String codeOrName;
@ApiModelProperty("辅助字段,不用管,起始时间")
private String startTime;
@ApiModelProperty("辅助字段,不用管,结束时间")
private String endTime;
@ApiModelProperty("辅助字段,不用管,流程状态")
private String status;
}

@ -0,0 +1,77 @@
package com.daqing.financial.guarantee.model.response;
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.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 业务统计拒绝列表
*
* @auther River
* @date 2020/11/9 17:50
*/
@Data
@ToString
public class DgStatisticsListRefuseResponse extends BaseRowModel implements Serializable {
@ApiModelProperty("业务编号")
@ExcelProperty(value = "业务编号",index = 0)
private String businessCode;
@ApiModelProperty("客户姓名")
@ExcelProperty(value = "客户姓名",index = 1)
private String name;
@ApiModelProperty("客户联系方式")
@ExcelProperty(value = "联系电话",index = 2)
private String phone;
@ApiModelProperty("业务类型")
@ExcelProperty(value = "产品类型",index = 3)
private String businessType;
@ApiModelProperty("申请额度")
@ExcelProperty(value = "金额",index = 4)
private Double applyAmount;
@ApiModelProperty("申请期限")
@ExcelProperty(value = "期数",index = 5)
private String applyTime;
@ApiModelProperty("创建时间")
@ExcelProperty(value = "申请日期",index = 6)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("拒绝人")
@ExcelProperty(value = "当前审批人",index = 7)
private String empName;
@ApiModelProperty("节点状态")
@ExcelProperty(value = "任务节点",index = 8)
private String status;
@ApiModelProperty("拒绝时间")
@ExcelProperty(value = "任务分配时间",index = 9)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date dateTime;
@ApiModelProperty("拒绝原因")
@ExcelProperty(value = "拒绝原因",index = 10)
private String remark;
@ApiModelProperty("提单人姓名")
@ExcelProperty(value = "提单人",index = 11)
private String employeeName;
@ApiModelProperty("部门")
@ExcelProperty(value = "所属部门",index = 12)
private List<String> department;
}

@ -0,0 +1,74 @@
package com.daqing.financial.guarantee.model.response;
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.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 业务统计列表
*
* @auther River
* @date 2020/11/6 16:37
*/
@Data
@ToString
public class DgStatisticsListResponse extends BaseRowModel implements Serializable {
@ApiModelProperty("业务编号")
@ExcelProperty(value = "业务编号",index = 0)
private String businessCode;
@ApiModelProperty("客户姓名")
@ExcelProperty(value = "客户姓名",index = 1)
private String name;
@ApiModelProperty("客户联系方式")
@ExcelProperty(value = "联系电话",index = 2)
private String phone;
@ApiModelProperty("业务类型")
@ExcelProperty(value = "产品类型",index = 3)
private String businessType;
@ApiModelProperty("申请额度")
@ExcelProperty(value = "金额",index = 4)
private Double applyAmount;
@ApiModelProperty("申请期限")
@ExcelProperty(value = "期数",index = 5)
private String applyTime;
@ApiModelProperty("创建时间")
@ExcelProperty(value = "申请日期",index = 6)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("审批人")
@ExcelProperty(value = "当前审批人",index = 7)
private String empName;
@ApiModelProperty("节点状态")
@ExcelProperty(value = "任务节点",index = 8)
private String status;
@ApiModelProperty("达到时间")
@ExcelProperty(value = "任务分配时间",index = 9)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date dateTime;
@ApiModelProperty("提单人姓名")
@ExcelProperty(value = "提单人",index = 10)
private String employeeName;
@ApiModelProperty("部门")
@ExcelProperty(value = "所属部门",index = 11)
private List<String> department;
}

@ -0,0 +1,23 @@
package com.daqing.financial.guarantee.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.financial.guarantee.model.request.DgStatisticsRequest;
import com.daqing.framework.domain.guarantee.DgApplyAmountInfo;
import com.daqing.framework.utils.PageUtils;
import javax.servlet.http.HttpServletResponse;
/**
* @auther River
* @date 2020/11/5 15:35
*/
public interface IDgStatisticsService extends IService<DgApplyAmountInfo> {
PageUtils list(Integer page, Integer size, DgStatisticsRequest dgStatisticsRequest);
Boolean excelExport(HttpServletResponse response);
PageUtils listRefuse(Integer page,Integer size, DgStatisticsRequest dgStatisticsRequest);
Boolean excelExportRefuse(HttpServletResponse response);
}

@ -0,0 +1,373 @@
package com.daqing.financial.guarantee.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.guarantee.feign.HrmsFeignService;
import com.daqing.financial.guarantee.mapper.DgStatisticsMapper;
import com.daqing.financial.guarantee.model.request.DgStatisticsRequest;
import com.daqing.financial.guarantee.model.response.DgStatisticsListRefuseResponse;
import com.daqing.financial.guarantee.model.response.DgStatisticsListResponse;
import com.daqing.financial.guarantee.service.IDgStatisticsService;
import com.daqing.financial.guarantee.util.DateUtils;
import com.daqing.framework.domain.crms.response.CrmsCode;
import com.daqing.framework.domain.guarantee.DgApplyAmountInfo;
import com.daqing.framework.domain.guarantee.po.DgStatisticsPO;
import com.daqing.framework.domain.guarantee.po.DgStatisticsRefusePO;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.model.response.PromptSuccess;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.excel.ExcelUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @auther River
* @date 2020/11/5 15:36
*/
@Service
public class DgStatisticsServiceImpl extends ServiceImpl<DgStatisticsMapper, DgApplyAmountInfo> implements IDgStatisticsService {
@Autowired
private HrmsFeignService hrmsFeignService;
/**
* 列表
*/
@Override
public PageUtils list(Integer page, Integer size, DgStatisticsRequest dgStatisticsRequest) {
if (page == null || size == null){
page = 1;
size = 10;
}
// 时间筛选(固定时间)
if (dgStatisticsRequest.getCreateFixedTime() != null && dgStatisticsRequest.getCreateCustomTime() == null){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
switch (dgStatisticsRequest.getCreateFixedTime()){
case 0 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayBegin()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEnd()));// 今天
break;
case 1 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYesterday()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYesterDay()));// 昨天
break;
case 2 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfWeek()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfWeek()));// 本周
break;
case 3 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfMonth()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfMonth()));// 本月
break;
case 4 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYear()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYear()));// 本年
break;
default :
dgStatisticsRequest.setStartTime(null);
dgStatisticsRequest.setEndTime(null);
}
}
// 时间筛选(自定义时间)
if (dgStatisticsRequest.getCreateCustomTime() != null){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayStartTime(dgStatisticsRequest.getCreateCustomTime())));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEndTime(dgStatisticsRequest.getCreateCustomTime())));
}
// 查询列表
IPage<DgStatisticsPO> iPage = this.getBaseMapper().list(new Page(page, size), dgStatisticsRequest);
List<DgStatisticsPO> dgStatisticsPOList = iPage.getRecords();
if (dgStatisticsPOList == null){
return null;
}
// 部门筛选
if (dgStatisticsRequest.getDeptId() != null && dgStatisticsRequest.getEmpId() == null){
ResponseResult<List<EmployeeVO>> result = hrmsFeignService.listEmployeeByDeptId(dgStatisticsRequest.getDeptId().longValue());
if (result.getData() == null || result.getData().size() == 0){
return null;
}
for (int i = 0;i < dgStatisticsPOList.size();i++){
boolean flag = false;
for (EmployeeVO employeeVO : result.getData()) {
if (Objects.equals(dgStatisticsPOList.get(i).getPresenterId().longValue(),employeeVO.getId())){
flag = true;
}
}
if (!flag){
dgStatisticsPOList.remove(i);
i--; // 索引要减一,不然会触发"快速失败"异常
}
}
iPage.setTotal(dgStatisticsPOList.size());
iPage.setSize(iPage.getTotal() % size == 0 ? iPage.getTotal() / size : iPage.getTotal() / size + 1);
}
// 提单人筛选
if (dgStatisticsRequest.getEmpId() != null){
for (int i = 0;i < dgStatisticsPOList.size();i++){
if (!Objects.equals(dgStatisticsPOList.get(i).getPresenterId(),dgStatisticsRequest.getEmpId())){
dgStatisticsPOList.remove(i);
i--;// 索引要减一,不然会触发"快速失败"异常
}
}
iPage.setTotal(dgStatisticsPOList.size());
iPage.setSize(iPage.getTotal() % size == 0 ? iPage.getTotal() / size : iPage.getTotal() / size + 1);
}
// 获取所有的提单人id
Integer[] presenterIds = dgStatisticsPOList.stream().map(DgStatisticsPO::getPresenterId).toArray(Integer[]::new);
if (presenterIds.length != 0){
// 强制类型转换
Long[] ids = new Long[presenterIds.length];
for (int i = 0;i < presenterIds.length;i++){
ids[i] = presenterIds[i].longValue();
}
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids);
if (empAndDeptList.getData() != null){
List<DgStatisticsListResponse> listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData());
IPage<DgStatisticsListResponse> iPages = new Page<>();
BeanUtils.copyProperties(iPage,iPages);
iPages.setRecords(listResponse);
return new PageUtils(iPages);
}else {
return new PageUtils(iPage);
}
}else {
return new PageUtils(iPage);
}
}
/**
* 列表导出
*/
@Override
public Boolean excelExport(HttpServletResponse response) {
IPage<DgStatisticsPO> list = this.getBaseMapper().list(new Page(), new DgStatisticsRequest());
List<DgStatisticsPO> dgStatisticsPOList = list.getRecords();
if (dgStatisticsPOList == null){
return false;
}
Integer[] presenterIds = dgStatisticsPOList.stream().map(DgStatisticsPO::getPresenterId).toArray(Integer[]::new);
if (presenterIds.length != 0) {
// 强制类型转换
Long[] ids = new Long[presenterIds.length];
for (int i = 0; i < presenterIds.length; i++) {
ids[i] = presenterIds[i].longValue();
}
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids);
if (empAndDeptList.getData() != null) {
List<DgStatisticsListResponse> listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData());
try {
ExcelUtil.writeExcelWithSheets(response,listResponse,"业务统计信息一览表","statistics",new DgStatisticsListResponse())
.finish();
}catch (Exception e){
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT);
}
return true;
}else {
return false;
}
}
return false;
}
/**
* 拒绝列表
*/
@Override
public PageUtils listRefuse(Integer page, Integer size, DgStatisticsRequest dgStatisticsRequest) {
if (page == null || size == null){
page = 1;
size = 10;
}
// 时间筛选(固定时间)
if (dgStatisticsRequest.getCreateFixedTime() != null && dgStatisticsRequest.getCreateCustomTime() == null){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
switch (dgStatisticsRequest.getCreateFixedTime()){
case 0 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayBegin()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEnd()));// 今天
break;
case 1 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYesterday()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYesterDay()));// 昨天
break;
case 2 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfWeek()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfWeek()));// 本周
break;
case 3 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfMonth()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfMonth()));// 本月
break;
case 4 :
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getBeginDayOfYear()));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getEndDayOfYear()));// 本年
break;
default :
dgStatisticsRequest.setStartTime(null);
dgStatisticsRequest.setEndTime(null);
}
}
// 时间筛选(自定义时间)
if (dgStatisticsRequest.getCreateCustomTime() != null){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dgStatisticsRequest.setStartTime(dateFormat.format(DateUtils.getDayStartTime(dgStatisticsRequest.getCreateCustomTime())));
dgStatisticsRequest.setEndTime(dateFormat.format(DateUtils.getDayEndTime(dgStatisticsRequest.getCreateCustomTime())));
}
// 拒绝列表
dgStatisticsRequest.setStatus(PromptSuccess.STATUS_REFUSE);
IPage<DgStatisticsRefusePO> iPage = this.getBaseMapper().listRefuse(new Page(page, size), dgStatisticsRequest);
List<DgStatisticsRefusePO> dgStatisticsRefusePOList = iPage.getRecords();
if (dgStatisticsRefusePOList == null){
return null;
}
// 部门筛选
if (dgStatisticsRequest.getDeptId() != null && dgStatisticsRequest.getEmpId() == null){
ResponseResult<List<EmployeeVO>> result = hrmsFeignService.listEmployeeByDeptId(dgStatisticsRequest.getDeptId().longValue());
if (result.getData() == null || result.getData().size() == 0){
return null;
}
for (int i = 0;i < dgStatisticsRefusePOList.size();i++){
boolean flag = false;
for (EmployeeVO employeeVO : result.getData()) {
if (Objects.equals(dgStatisticsRefusePOList.get(i).getPresenterId().longValue(),employeeVO.getId())){
flag = true;
}
}
if (!flag){
dgStatisticsRefusePOList.remove(i);
i--; // 索引要减一,不然会触发"快速失败"异常
}
}
iPage.setTotal(dgStatisticsRefusePOList.size());
iPage.setSize(iPage.getTotal() % size == 0 ? iPage.getTotal() / size : iPage.getTotal() / size + 1);
}
// 提单人筛选
if (dgStatisticsRequest.getEmpId() != null){
for (int i = 0;i < dgStatisticsRefusePOList.size();i++){
if (!Objects.equals(dgStatisticsRefusePOList.get(i).getPresenterId(),dgStatisticsRequest.getEmpId())){
dgStatisticsRefusePOList.remove(i);
i--;// 索引要减一,不然会触发"快速失败"异常
}
}
iPage.setTotal(dgStatisticsRefusePOList.size());
iPage.setSize(iPage.getTotal() % size == 0 ? iPage.getTotal() / size : iPage.getTotal() / size + 1);
}
// 获取所有的提单人id
Integer[] presenterIds = dgStatisticsRefusePOList.stream().map(DgStatisticsRefusePO::getPresenterId).toArray(Integer[]::new);
if (presenterIds.length != 0){
// 强制类型转换
Long[] ids = new Long[presenterIds.length];
for (int i = 0;i < presenterIds.length;i++){
ids[i] = presenterIds[i].longValue();
}
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids);
if (empAndDeptList.getData() != null){
List<DgStatisticsListRefuseResponse> listResponse = this.jointRefuseStatistics(dgStatisticsRefusePOList, empAndDeptList.getData());
IPage<DgStatisticsListRefuseResponse> iPages = new Page<>();
BeanUtils.copyProperties(iPage,iPages);
iPages.setRecords(listResponse);
return new PageUtils(iPages);
}else {
return new PageUtils(iPage);
}
}else {
return new PageUtils(iPage);
}
}
/**
* 拒绝列表导出
*/
@Override
public Boolean excelExportRefuse(HttpServletResponse response) {
DgStatisticsRequest dgStatisticsRequest = new DgStatisticsRequest();
dgStatisticsRequest.setStatus(PromptSuccess.STATUS_REFUSE);
// 列表查询
IPage<DgStatisticsRefusePO> listRefuse = this.getBaseMapper().listRefuse(new Page(), dgStatisticsRequest);
List<DgStatisticsRefusePO> statisticsRefusePOList = listRefuse.getRecords();
if (statisticsRefusePOList == null){
return false;
}
Integer[] presenterIds = statisticsRefusePOList.stream().map(DgStatisticsRefusePO::getPresenterId).toArray(Integer[]::new);
if (presenterIds.length != 0) {
// 强制类型转换
Long[] ids = new Long[presenterIds.length];
for (int i = 0; i < presenterIds.length; i++) {
ids[i] = presenterIds[i].longValue();
}
ResponseResult<List<EmployeeTO>> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids);
if (empAndDeptList.getData() != null) {
// 提单人姓名、部门拼装
List<DgStatisticsListRefuseResponse> listResponse = this.jointRefuseStatistics(statisticsRefusePOList, empAndDeptList.getData());
try {
ExcelUtil.writeExcelWithSheets(response,listResponse,"业务统计拒绝信息一览表","statisticsRefuse",new DgStatisticsListRefuseResponse())
.finish();
}catch (Exception e){
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT);
}
return true;
}else {
return false;
}
}
return false;
}
private List<DgStatisticsListResponse> jointStatistics(List<DgStatisticsPO> dgStatisticsPOList,List<EmployeeTO> empAndDeptList){
// 用于拼装业务统计列表
List<DgStatisticsListResponse> listResponse = new ArrayList<>();
DgStatisticsListResponse dgStatisticsListResponse;
for (DgStatisticsPO dgStatisticsPO : dgStatisticsPOList) {
// 每一个客户对应一个不同的对象
dgStatisticsListResponse = new DgStatisticsListResponse();
for (EmployeeTO employeeTO : empAndDeptList) {
if (Objects.equals(dgStatisticsPO.getPresenterId().longValue(),employeeTO.getId())){
BeanUtils.copyProperties(dgStatisticsPO,dgStatisticsListResponse);
dgStatisticsListResponse.setEmployeeName(employeeTO.getEmpName());
dgStatisticsListResponse.setDepartment(employeeTO.getDeptNames());
listResponse.add(dgStatisticsListResponse);
}
}
if (dgStatisticsListResponse.getEmployeeName() == null || dgStatisticsListResponse.getEmployeeName().length() == 0){
BeanUtils.copyProperties(dgStatisticsPO,dgStatisticsListResponse);
listResponse.add(dgStatisticsListResponse);
}
}
return listResponse;
}
private List<DgStatisticsListRefuseResponse> jointRefuseStatistics(List<DgStatisticsRefusePO> dgStatisticsRefusePOList, List<EmployeeTO> empAndDeptList){
// 用于拼装业务统计列表
List<DgStatisticsListRefuseResponse> listResponse = new ArrayList<>();
DgStatisticsListRefuseResponse dgStatisticsListRefuseResponse;
for (DgStatisticsRefusePO dgStatisticsRefusePO : dgStatisticsRefusePOList) {
// 每一个客户对应一个不同的对象
dgStatisticsListRefuseResponse = new DgStatisticsListRefuseResponse();
for (EmployeeTO employeeTO : empAndDeptList) {
if (Objects.equals(dgStatisticsRefusePO.getPresenterId().longValue(),employeeTO.getId())){
BeanUtils.copyProperties(dgStatisticsRefusePO,dgStatisticsListRefuseResponse);
dgStatisticsListRefuseResponse.setEmployeeName(employeeTO.getEmpName());
dgStatisticsListRefuseResponse.setDepartment(employeeTO.getDeptNames());
listResponse.add(dgStatisticsListRefuseResponse);
}
}
if (dgStatisticsListRefuseResponse.getEmployeeName() == null || dgStatisticsListRefuseResponse.getEmployeeName().length() == 0){
BeanUtils.copyProperties(dgStatisticsRefusePO,dgStatisticsListRefuseResponse);
listResponse.add(dgStatisticsListRefuseResponse);
}
}
return listResponse;
}
}

@ -0,0 +1,326 @@
package com.daqing.financial.guarantee.util;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
/**
* @auther River
* @date 2020/11/9 15:53
*/
public class DateUtils {
//获取当天的开始时间
public static java.util.Date getDayBegin() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
}
//获取当天的结束时间
public static java.util.Date getDayEnd() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
return cal.getTime();
}
//获取昨天的开始时间
public static Date getBeginDayOfYesterday() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayBegin());
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
}
//获取昨天的结束时间
public static Date getEndDayOfYesterDay() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayEnd());
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
}
//获取明天的开始时间
public static Date getBeginDayOfTomorrow() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayBegin());
cal.add(Calendar.DAY_OF_MONTH, 1);
return cal.getTime();
}
//获取明天的结束时间
public static Date getEndDayOfTomorrow() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayEnd());
cal.add(Calendar.DAY_OF_MONTH, 1);
return cal.getTime();
}
//获取本周的开始时间
@SuppressWarnings("unused")
public static Date getBeginDayOfWeek() {
Date date = new Date();
if (date == null) {
return null;
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
if (dayofweek == 1) {
dayofweek += 7;
}
cal.add(Calendar.DATE, 2 - dayofweek);
return getDayStartTime(cal.getTime());
}
//获取本周的结束时间
public static Date getEndDayOfWeek() {
Calendar cal = Calendar.getInstance();
cal.setTime(getBeginDayOfWeek());
cal.add(Calendar.DAY_OF_WEEK, 6);
Date weekEndSta = cal.getTime();
return getDayEndTime(weekEndSta);
}
//获取上周的开始时间
@SuppressWarnings("unused")
public static Date getBeginDayOfLastWeek() {
Date date = new Date();
if (date == null) {
return null;
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
if (dayofweek == 1) {
dayofweek += 7;
}
cal.add(Calendar.DATE, 2 - dayofweek - 7);
return getDayStartTime(cal.getTime());
}
//获取上周的结束时间
public static Date getEndDayOfLastWeek() {
Calendar cal = Calendar.getInstance();
cal.setTime(getBeginDayOfLastWeek());
cal.add(Calendar.DAY_OF_WEEK, 6);
Date weekEndSta = cal.getTime();
return getDayEndTime(weekEndSta);
}
//获取本月的开始时间
public static Date getBeginDayOfMonth() {
Calendar calendar = Calendar.getInstance();
calendar.set(getNowYear(), getNowMonth() - 1, 1);
return getDayStartTime(calendar.getTime());
}
//获取本月的结束时间
public static Date getEndDayOfMonth() {
Calendar calendar = Calendar.getInstance();
calendar.set(getNowYear(), getNowMonth() - 1, 1);
int day = calendar.getActualMaximum(5);
calendar.set(getNowYear(), getNowMonth() - 1, day);
return getDayEndTime(calendar.getTime());
}
//获取上月的开始时间
public static Date getBeginDayOfLastMonth() {
Calendar calendar = Calendar.getInstance();
calendar.set(getNowYear(), getNowMonth() - 2, 1);
return getDayStartTime(calendar.getTime());
}
//获取上月的结束时间
public static Date getEndDayOfLastMonth() {
Calendar calendar = Calendar.getInstance();
calendar.set(getNowYear(), getNowMonth() - 2, 1);
int day = calendar.getActualMaximum(5);
calendar.set(getNowYear(), getNowMonth() - 2, day);
return getDayEndTime(calendar.getTime());
}
//获取本年的开始时间
public static java.util.Date getBeginDayOfYear() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, getNowYear());
// cal.set
cal.set(Calendar.MONTH, Calendar.JANUARY);
cal.set(Calendar.DATE, 1);
return getDayStartTime(cal.getTime());
}
//获取本年的结束时间
public static java.util.Date getEndDayOfYear() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, getNowYear());
cal.set(Calendar.MONTH, Calendar.DECEMBER);
cal.set(Calendar.DATE, 31);
return getDayEndTime(cal.getTime());
}
//获取某个日期的开始时间
public static Timestamp getDayStartTime(Date d) {
Calendar calendar = Calendar.getInstance();
if (null != d) calendar.setTime(d);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
return new Timestamp(calendar.getTimeInMillis());
}
//获取某个日期的结束时间
public static Timestamp getDayEndTime(Date d) {
Calendar calendar = Calendar.getInstance();
if (null != d) calendar.setTime(d);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 23, 59, 59);
calendar.set(Calendar.MILLISECOND, 999);
return new Timestamp(calendar.getTimeInMillis());
}
//获取今年是哪一年
public static Integer getNowYear() {
Date date = new Date();
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(date);
return Integer.valueOf(gc.get(1));
}
//获取本月是哪一月
public static int getNowMonth() {
Date date = new Date();
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(date);
return gc.get(2) + 1;
}
//两个日期相减得到的天数
public static int getDiffDays(Date beginDate, Date endDate) {
if (beginDate == null || endDate == null) {
throw new IllegalArgumentException("getDiffDays param is null!");
}
long diff = (endDate.getTime() - beginDate.getTime())
/ (1000 * 60 * 60 * 24);
int days = new Long(diff).intValue();
return days;
}
//两个日期相减得到的毫秒数
public static long dateDiff(Date beginDate, Date endDate) {
long date1ms = beginDate.getTime();
long date2ms = endDate.getTime();
return date2ms - date1ms;
}
//获取两个日期中的最大日期
public static Date max(Date beginDate, Date endDate) {
if (beginDate == null) {
return endDate;
}
if (endDate == null) {
return beginDate;
}
if (beginDate.after(endDate)) {
return beginDate;
}
return endDate;
}
//获取两个日期中的最小日期
public static Date min(Date beginDate, Date endDate) {
if (beginDate == null) {
return endDate;
}
if (endDate == null) {
return beginDate;
}
if (beginDate.after(endDate)) {
return endDate;
}
return beginDate;
}
//返回某月该季度的第一个月
public static Date getFirstSeasonDate(Date date) {
final int[] SEASON = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4};
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int sean = SEASON[cal.get(Calendar.MONTH)];
cal.set(Calendar.MONTH, sean * 3 - 3);
return cal.getTime();
}
//返回某个日期下几天的日期
public static Date getNextDay(Date date, int i) {
Calendar cal = new GregorianCalendar();
cal.setTime(date);
cal.set(Calendar.DATE, cal.get(Calendar.DATE) + i);
return cal.getTime();
}
//返回某个日期前几天的日期
public static Date getFrontDay(Date date, int i) {
Calendar cal = new GregorianCalendar();
cal.setTime(date);
cal.set(Calendar.DATE, cal.get(Calendar.DATE) - i);
return cal.getTime();
}
//获取某年某月到某年某月按天的切片日期集合(间隔天数的集合)
@SuppressWarnings({"rawtypes", "unchecked"})
public static List getTimeList(int beginYear, int beginMonth, int endYear,
int endMonth, int k) {
List list = new ArrayList();
if (beginYear == endYear) {
for (int j = beginMonth; j <= endMonth; j++) {
list.add(getTimeList(beginYear, j, k));
}
} else {
{
for (int j = beginMonth; j < 12; j++) {
list.add(getTimeList(beginYear, j, k));
}
for (int i = beginYear + 1; i < endYear; i++) {
for (int j = 0; j < 12; j++) {
list.add(getTimeList(i, j, k));
}
}
for (int j = 0; j <= endMonth; j++) {
list.add(getTimeList(endYear, j, k));
}
}
}
return list;
}
//获取某年某月按天切片日期集合(某个月间隔多少天的日期集合)
@SuppressWarnings({"unchecked", "rawtypes"})
public static List getTimeList(int beginYear, int beginMonth, int k) {
List list = new ArrayList();
Calendar begincal = new GregorianCalendar(beginYear, beginMonth, 1);
int max = begincal.getActualMaximum(Calendar.DATE);
for (int i = 1; i < max; i = i + k) {
list.add(begincal.getTime());
begincal.add(Calendar.DATE, k);
}
begincal = new GregorianCalendar(beginYear, beginMonth, max);
list.add(begincal.getTime());
return list;
}
}

@ -13,6 +13,9 @@ spring.cloud.nacos.config.ext-config[1].data-id=datasource.yml
spring.cloud.nacos.config.ext-config[1].group=dev
spring.cloud.nacos.config.ext-config[1].refresh=true
spring.cloud.nacos.config.ext-config[2].data-id=mybatis.yml
spring.cloud.nacos.config.ext-config[2].group=dev
spring.cloud.nacos.config.ext-config[2].refresh=true
spring.redis.host=127.0.0.1
spring.redis.port=6379

@ -7,6 +7,7 @@
<id column="id" property="id" />
<result column="company_id" property="companyId" />
<result column="emp_id" property="empId" />
<result column="dg_apply_amount_info_id" property="dgApplyAmountInfoId"/>
<result column="dept_name" property="deptName" />
<result column="date_time" property="dateTime" />
<result column="status" property="status" />

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.daqing.financial.guarantee.mapper.DgStatisticsMapper">
<resultMap id="BaseResultMap" type="com.daqing.framework.domain.guarantee.DgApplyAmountInfo">
<id column="id" property="id" />
<result column="company_id" property="companyId" />
<result column="presenter_id" property="presenterId" />
<result column="apply_amount" property="applyAmount" />
<result column="apply_time" property="applyTime" />
<result column="bank" property="bank" />
<result column="amount_wide" property="amountWide" />
<result column="en_guarantee_measures" property="enGuaranteeMeasures" />
<result column="business_type" property="businessType" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<select id="list" parameterType="com.daqing.financial.guarantee.model.request.DgStatisticsRequest" resultType="com.daqing.framework.domain.guarantee.po.DgStatisticsPO">
SELECT c.name AS name,c.phone AS phone,a.presenter_id AS presenter_id,a.apply_amount AS apply_amount,a.apply_time AS apply_time,
a.business_type AS business_type,a.create_time AS create_time,a.business_code AS business_code,p.emp_name AS emp_name,
p.status AS status,p.date_time AS date_time
FROM dg_apply_amount_info AS a
LEFT JOIN (SELECT apply_amount_info_id,emp_name,status,date_time FROM dg_audit_process WHERE (apply_amount_info_id,date_time) IN
(SELECT apply_amount_info_id,MAX(date_time) FROM dg_audit_process GROUP BY apply_amount_info_id)) AS p
ON a.id = p.apply_amount_info_id
LEFT JOIN crms_customer AS c
ON a.company_id = c.id
WHERE c.del_or_not = 0
<if test="sr.codeOrName != null and sr.codeOrName != ''">
AND (a.business_code LIKE CONCAT('%',#{sr.codeOrName},'%') OR c.name LIKE CONCAT('%',#{sr.codeOrName},'%'))
</if>
<if test="sr.type != null and sr.type != ''">
AND a.business_type = #{sr.type}
</if>
<if test="sr.startTime != null and sr.startTime != ''">
AND a.create_time &gt;= #{sr.startTime}
</if>
<if test="sr.endTime != null and sr.endTime != ''">
AND a.create_time &lt;= #{sr.endTime}
</if>
ORDER BY a.create_time DESC
</select>
<select id="listRefuse" parameterType="com.daqing.financial.guarantee.model.request.DgStatisticsRequest" resultType="com.daqing.framework.domain.guarantee.po.DgStatisticsRefusePO">
SELECT c.name AS name,c.phone AS phone,a.presenter_id AS presenter_id,a.apply_amount AS apply_amount,a.apply_time AS apply_time,
a.business_type AS business_type,a.create_time AS create_time,a.business_code AS business_code,p.emp_name AS emp_name,
p.status AS status,p.date_time AS date_time,p.remark AS remark
FROM dg_apply_amount_info AS a
LEFT JOIN dg_audit_process AS p
ON a.id = p.apply_amount_info_id
LEFT JOIN crms_customer AS c
ON a.company_id = c.id
WHERE c.del_or_not = 0
AND p.status LIKE CONCAT('%',#{sr.status},'%')
<if test="sr.codeOrName != null and sr.codeOrName != ''">
AND (a.business_code LIKE CONCAT('%',#{sr.codeOrName},'%') OR c.name LIKE CONCAT('%',#{sr.codeOrName},'%'))
</if>
<if test="sr.type != null and sr.type != ''">
AND a.business_type = #{sr.type}
</if>
<if test="sr.startTime != null and sr.startTime != ''">
AND a.create_time &gt;= #{sr.startTime}
</if>
<if test="sr.endTime != null and sr.endTime != ''">
AND a.create_time &lt;= #{sr.endTime}
</if>
ORDER BY a.create_time DESC
</select>
</mapper>

@ -116,6 +116,16 @@ public class DeptController implements DeptControllerApi {
return new ResponseResult<DepartmentVO>().SUCCESS(deptService.getDepartmentAndEmployee(id));
}
/**
* 根据部门id获取该部门下所有的员工
*/
@GetMapping("/listEmployeeByDeptId")
@Override
public ResponseResult listEmployeeByDeptId(@RequestParam("deptId") Long deptId) {
return ResponseResult.SUCCESS(deptService.listEmployeeByDeptId(deptId));
}
/**
* 根据员工id获取对应部门下所有的客户经理
*/
@ -124,4 +134,6 @@ public class DeptController implements DeptControllerApi {
return new ResponseResult<List<EmployeeEntity>>().SUCCESS(deptService.listEmployeeById(id));
}
}

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
/**
@ -70,10 +71,11 @@ public class PositionController implements PositionControllerApi {
/**
* 所有的职位id和名称
*/
@GetMapping("/listPositionIdAndName")
@PostMapping("/listPositionIdAndName")
@Override
public ResponseResult listPositionIdAndName() {
return new ResponseResult<PositionResponse>().SUCCESS(positionService.listPositionIdAndName());
public ResponseResult listPositionIdAndName(@RequestBody List<Long> deptIds) {
return ResponseResult.SUCCESS(positionService.listPositionIdAndName(deptIds));
}
/**

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.daqing.framework.domain.hrms.DepartmentVO;
import com.daqing.framework.domain.hrms.DeptEntity;
import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -31,4 +32,6 @@ public interface DeptDao extends BaseMapper<DeptEntity> {
List<DepartmentVO> listDepartmentIdAndName();
List<EmployeeEntity> listEmployeeById(Long id);
List<EmployeeVO> listEmployeeByDeptId(Long deptId);
}

@ -88,4 +88,6 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
Integer userAccountCount(String account);
Integer employeeJobNumberCount(String jobNumber);
EmployeeRepetition getEmployeeRepetitionByEmpId(Long empId);
}

@ -27,4 +27,6 @@ public interface PositionDao extends BaseMapper<PositionEntity> {
IPage<PositionVO> pageByCondition(Page page, @Param("queryMsg") String queryMsg);
List<PositionVO> listPositionIdAndName();
List<PositionVO> listPositionIdAndNameByDeptId(@Param("deptIds") List<Long> deptIds);
}

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.framework.domain.hrms.DepartmentVO;
import com.daqing.framework.domain.hrms.DeptEntity;
import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import com.daqing.framework.domain.hrms.request.DeptAddRequest;
import java.util.List;
@ -31,5 +32,6 @@ public interface DeptService extends IService<DeptEntity> {
List<EmployeeEntity> listEmployeeById(Long id);
List<EmployeeVO> listEmployeeByDeptId(Long deptId);
}

@ -29,7 +29,7 @@ public interface PositionService extends IService<PositionEntity> {
void removePositionByIds(List<Long> asList);
List<PositionVO> listPositionIdAndName();
List<PositionVO> listPositionIdAndName(List<Long> deptIds);
List<RoleVO> listRoleIdAndName();
}

@ -206,4 +206,12 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
return this.getBaseMapper().listEmployeeById(id);
}
/**
* 根据部门id获取该部门所有的员工id和姓名
*/
public List<EmployeeVO> listEmployeeByDeptId(Long deptId){
return this.getBaseMapper().listEmployeeByDeptId(deptId);
}
}

@ -273,15 +273,23 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
|| employeeInfoVO.getPhone().length() == 0){
ExceptionCast.cast(HrmsCode.EMPLOYEE_INFO_NOT_NULL);
}
// 判重
// 工号判重,修改判重先要判断是否与原来相同
EmployeeRepetition employeeRepetition = this.getBaseMapper().getEmployeeRepetitionByEmpId(employeeInfoVO.getId());
if (employeeRepetition != null && !Objects.equals(employeeInfoVO.getJobNumber(),employeeRepetition.getJobNumber())){
Integer numberCount = this.getBaseMapper().employeeJobNumberCount(employeeInfoVO.getJobNumber());
if (numberCount > 0){
ExceptionCast.cast(HrmsCode.EMPLOYEE_JOB_NUMBER_EXIST);
}
}
// 账号判重
if (employeeRepetition != null && !Objects.equals(employeeInfoVO.getAccount(),employeeRepetition.getAccount())){
Integer accountCount = this.getBaseMapper().userAccountCount(employeeInfoVO.getAccount());
if (accountCount > 0){
ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_ACCOUNT_EXIST);
}
}
// 姓名判重,如果重复,自动在后面加字母"A、B、C、D、E"
if (employeeRepetition != null && !Objects.equals(employeeInfoVO.getName(),employeeRepetition.getName())){
String name = employeeInfoVO.getName();
for (int i = 0;i < PromptSuccess.LETTERS.length;i++){
Integer nameCount = this.getBaseMapper().employeeNameCount(name);
@ -295,6 +303,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
ExceptionCast.cast(HrmsCode.EMPLOYEE_REPETITION_EXCEED);
}
}
}
String account = employeeInfoVO.getAccount();
EmployeeEntity employee = new EmployeeEntity();
BeanUtils.copyProperties(employeeInfoVO, employee);

@ -28,9 +28,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@ -173,8 +171,24 @@ public class PositionServiceImpl extends ServiceImpl<PositionDao, PositionEntity
* 所有的职位id和名称
*/
@Override
public List<PositionVO> listPositionIdAndName() {
return this.getBaseMapper().listPositionIdAndName();
public List<PositionVO> listPositionIdAndName(List<Long> deptIds) {
if (deptIds == null || deptIds.size() == 0){
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
List<PositionVO> positionList = this.getBaseMapper().listPositionIdAndNameByDeptId(deptIds);
if (positionList == null || positionList.size() == 0){
return null;
}
// 去重
HashMap<Long,PositionVO> map = new HashMap<>();
for (PositionVO position : positionList) {
map.put(position.getId(),position);
}
positionList.clear();
for (Long key : map.keySet()) {
positionList.add(map.get(key));
}
return positionList;
}
/**

@ -1,6 +1,5 @@
package com.daqing.financial.hrms.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqing.financial.hrms.dao.EmployeeDao;
import com.daqing.financial.hrms.dao.UserDao;
@ -11,7 +10,6 @@ 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.PromptSuccess;
import com.daqing.framework.util.HttpUtils;
import com.daqing.framework.util.Md5Util;
import com.daqing.framework.util.RedisUtil;
import com.daqing.framework.util.SendSMS;
@ -23,13 +21,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

@ -63,4 +63,17 @@
)
</select>
<select id="listEmployeeByDeptId" parameterType="long" resultType="com.daqing.framework.domain.hrms.ext.EmployeeVO">
SELECT e.id id,e.name name
FROM hrms_employee e
LEFT JOIN hrms_employee_dept ed
ON e.id = ed.employee_id
LEFT JOIN hrms_dept d
ON ed.dept_id = d.id
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
AND d.id = #{deptId}
</select>
</mapper>

@ -493,4 +493,13 @@
AND e.job_number = #{jobNumber}
</select>
<select id="getEmployeeRepetitionByEmpId" parameterType="long" resultType="com.daqing.framework.domain.hrms.ext.EmployeeRepetition">
SELECT e.name name,e.job_number job_number,u.account account
FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
AND e.id = #{empId}
</select>
</mapper>

@ -84,4 +84,17 @@
<select id="listPositionIdAndName" resultType="com.daqing.framework.domain.hrms.ext.PositionVO">
SELECT id,name FROM hrms_position
</select>
<select id="listPositionIdAndNameByDeptId" resultType="com.daqing.framework.domain.hrms.ext.PositionVO" parameterType="long">
SELECT p.id id,p.name name
FROM hrms_position p
LEFT JOIN hrms_dept_position dp
ON p.id = dp.position_id
LEFT JOIN hrms_dept d
ON d.id = dp.dept_id
WHERE d.id IN
<foreach collection="deptIds" open="(" separator="," close=")" item="deptId">
#{deptId}
</foreach>
</select>
</mapper>

@ -36,6 +36,8 @@ public class PromptSuccess {
public static final String[] LETTERS = {"A","B","C","D","E"}; // 员工姓名重复时自动加的字母,可再添加
public static final String STATUS_REFUSE = "拒绝";
public static final String ENCLOSUREFILE_URL_PATH = "http://www.huorantech.cn/enclosureFile/"; // 附件文件存放路径
public static final String FILE_URL_PATH = "//usr//local//nginx//html//admin//enclosureFile//"; // 附件文件存放路径

@ -38,6 +38,11 @@ public class DgAuditProcess implements Serializable {
*/
private Integer empId;
/**
* 贷款信息表id
*/
private Integer dgApplyAmountInfoId;
/**
* 部门名称
*/

@ -0,0 +1,35 @@
package com.daqing.framework.domain.guarantee;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
/**
* 业务类型
*
* @auther River
* @date 2020/11/5 15:17
*/
@Data
@ToString
public class DgBusinessType implements Serializable {
private Integer id;
/**
* 业务类型名称
*/
private String name;
/**
* 关联的客户表id
*/
private Integer companyId;
private Date createTime;
private Date updateTime;
}

@ -0,0 +1,52 @@
package com.daqing.framework.domain.guarantee.po;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
/**
* 业务效率团队
*
* @auther River
* @date 2020/11/10 11:50
*/
@Data
@ToString
public class DgEfficiencyTeamPO implements Serializable {
/**
* id
*/
private Integer id;
/**
* 提单人id
*/
private Integer presenterId;
/**
* 客户名称
*/
private String name;
/**
* 申请日期
*/
private Date createTime;
/**
* 当前审批人
*/
private String empName;
/**
* 任务节点
*/
private String status;
/**
* 完成时间
*/
}

@ -0,0 +1,71 @@
package com.daqing.framework.domain.guarantee.po;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
/**
* @auther River
* @date 2020/11/6 14:32
*/
@Data
@ToString
public class DgStatisticsPO {
/**
* 客户名称
*/
private String name;
/**
* 客户联系方式
*/
private String phone;
/**
* 提单人id
*/
private Integer presenterId;
/**
* 申请额度
*/
private Double applyAmount;
/**
* 申请期限
*/
private String applyTime;
/**
* 业务类型
*/
private String businessType;
/**
* 业务编号
*/
private String businessCode;
/**
* 创建时间
*/
private Date createTime;
/**
* 审批人
*/
private String empName;
/**
* 节点状态
*/
private String status;
/**
* 达到时间
*/
private Date dateTime;
}

@ -0,0 +1,76 @@
package com.daqing.framework.domain.guarantee.po;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
/**
* @auther River
* @date 2020/11/9 17:39
*/
@Data
@ToString
public class DgStatisticsRefusePO implements Serializable {
/**
* 客户名称
*/
private String name;
/**
* 客户联系方式
*/
private String phone;
/**
* 提单人id
*/
private Integer presenterId;
/**
* 申请额度
*/
private Double applyAmount;
/**
* 申请期限
*/
private String applyTime;
/**
* 业务类型
*/
private String businessType;
/**
* 业务编号
*/
private String businessCode;
/**
* 创建时间
*/
private Date createTime;
/**
* 拒绝人
*/
private String empName;
/**
* 节点状态
*/
private String status;
/**
* 达到时间
*/
private Date dateTime;
/**
* 拒绝原因
*/
private String remark;
}

@ -0,0 +1,30 @@
package com.daqing.framework.domain.hrms.ext;
import lombok.Data;
import lombok.ToString;
/**
* 员工姓名工号账号重复信息判断
*
* @auther River
* @date 2020/11/4 17:45
*/
@Data
@ToString
public class EmployeeRepetition {
/**
* 姓名
*/
private String name;
/**
* 工号
*/
private String jobNumber;
/**
* 账号
*/
private String account;
}

@ -1,5 +1,6 @@
package com.daqing.framework.domain.hrms.ext;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
@ -13,13 +14,12 @@ import java.io.Serializable;
@ToString
public class EmployeeVO implements Serializable{
/**
* id
*/
@ApiModelProperty("id")
private Long id;
/**
* 员工姓名
*/
@ApiModelProperty("姓名")
private String name;
}

Loading…
Cancel
Save