parent
0d6580edc6
commit
aee6337496
42 changed files with 1607 additions and 101 deletions
@ -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 { |
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.daqing.financial.guarantee.config; |
||||
|
||||
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 |
||||
public PaginationInterceptor paginationInterceptor() { |
||||
return new PaginationInterceptor(); |
||||
} |
||||
} |
@ -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,24 +0,0 @@ |
||||
package com.daqing.financial.guarantee.feign; |
||||
|
||||
import com.daqing.framework.model.response.ResponseResult; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 这是一个声明式的远程调用 |
||||
*/ |
||||
@FeignClient(value = "dq-financial-crms", contextId = "guaranteeToCrms") |
||||
public interface CrmsFeignService { |
||||
|
||||
/** |
||||
* 根据客户编号/客户名称获取企业信息 |
||||
* @param params |
||||
* @return |
||||
*/ |
||||
@GetMapping("/crms/customer/list") |
||||
ResponseResult list(@RequestParam Map<String, Object> params); |
||||
|
||||
} |
@ -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; |
||||
} |
||||
} |
||||
|
@ -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 >= #{sr.startTime} |
||||
</if> |
||||
<if test="sr.endTime != null and sr.endTime != ''"> |
||||
AND a.create_time <= #{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 >= #{sr.startTime} |
||||
</if> |
||||
<if test="sr.endTime != null and sr.endTime != ''"> |
||||
AND a.create_time <= #{sr.endTime} |
||||
</if> |
||||
ORDER BY a.create_time DESC |
||||
</select> |
||||
|
||||
</mapper> |
@ -1,61 +1,61 @@ |
||||
#服务名称 |
||||
#spring.application.name=dq-financial-hrms |
||||
##配置中心地址 |
||||
#spring.cloud.nacos.config.server-addr=192.168.31.142:8848 |
||||
#spring.cloud.nacos.config.namespace=4c56c2f9-b6a3-4e7b-88b8-b1001e86dfd6 |
||||
##spring.cloud.nacos.config.group=prod |
||||
# |
||||
#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml |
||||
#spring.cloud.nacos.config.ext-config[0].group=dev |
||||
#spring.cloud.nacos.config.ext-config[0].refresh=true |
||||
# |
||||
#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml |
||||
#spring.cloud.nacos.config.ext-config[1].group=dev |
||||
#spring.cloud.nacos.config.ext-config[1].refresh=true |
||||
# |
||||
#spring.cloud.nacos.config.ext-config[2].data-id=other.yml |
||||
#spring.cloud.nacos.config.ext-config[2].group=dev |
||||
#spring.cloud.nacos.config.ext-config[2].refresh=true |
||||
# |
||||
#spring.redis.host=127.0.0.1 |
||||
#spring.redis.port=6379 |
||||
#spring.redis.password=123456 |
||||
#spring.redis.database=0 |
||||
#spring.redis.timeout=30000 |
||||
#spring.redis.jedis.pool.max-active=8 |
||||
#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 |
||||
#配置中心地址 |
||||
spring.cloud.nacos.config.server-addr=120.78.127.12:8848 |
||||
spring.cloud.nacos.config.namespace=69614b55-1521-421c-ac58-dbe4a5b01b43 |
||||
spring.cloud.nacos.config.server-addr=192.168.31.142:8848 |
||||
spring.cloud.nacos.config.namespace=4c56c2f9-b6a3-4e7b-88b8-b1001e86dfd6 |
||||
#spring.cloud.nacos.config.group=prod |
||||
|
||||
spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml |
||||
spring.cloud.nacos.config.ext-config[0].group=prod |
||||
spring.cloud.nacos.config.ext-config[0].group=dev |
||||
spring.cloud.nacos.config.ext-config[0].refresh=true |
||||
|
||||
spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml |
||||
spring.cloud.nacos.config.ext-config[1].group=prod |
||||
spring.cloud.nacos.config.ext-config[1].group=dev |
||||
spring.cloud.nacos.config.ext-config[1].refresh=true |
||||
|
||||
spring.cloud.nacos.config.ext-config[2].data-id=other.yml |
||||
spring.cloud.nacos.config.ext-config[2].group=prod |
||||
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 |
||||
spring.redis.password=dq123456 |
||||
spring.redis.password=123456 |
||||
spring.redis.database=0 |
||||
spring.redis.timeout=30000 |
||||
spring.redis.jedis.pool.max-active=8 |
||||
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 |
||||
##配置中心地址 |
||||
#spring.cloud.nacos.config.server-addr=120.78.127.12:8848 |
||||
#spring.cloud.nacos.config.namespace=69614b55-1521-421c-ac58-dbe4a5b01b43 |
||||
##spring.cloud.nacos.config.group=prod |
||||
# |
||||
#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml |
||||
#spring.cloud.nacos.config.ext-config[0].group=prod |
||||
#spring.cloud.nacos.config.ext-config[0].refresh=true |
||||
# |
||||
#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml |
||||
#spring.cloud.nacos.config.ext-config[1].group=prod |
||||
#spring.cloud.nacos.config.ext-config[1].refresh=true |
||||
# |
||||
#spring.cloud.nacos.config.ext-config[2].data-id=other.yml |
||||
#spring.cloud.nacos.config.ext-config[2].group=prod |
||||
#spring.cloud.nacos.config.ext-config[2].refresh=true |
||||
# |
||||
#spring.redis.host=127.0.0.1 |
||||
#spring.redis.port=6379 |
||||
#spring.redis.password=dq123456 |
||||
#spring.redis.database=0 |
||||
#spring.redis.timeout=30000 |
||||
#spring.redis.jedis.pool.max-active=8 |
||||
#spring.redis.jedis.pool.max-wait=-1 |
||||
#spring.redis.jedis.pool.max-idle=8 |
||||
#spring.redis.jedis.pool.min-idle=0 |
@ -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; |
||||
} |
Loading…
Reference in new issue