Commit 8d99c75b authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.6.11' into MVP1.6.11

parents db07d61f 061d8c98
......@@ -12,7 +12,6 @@ import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* 风险管控统计
......@@ -33,6 +32,12 @@ public class TRiskMonitor extends BaseEntity {
@Schema(description = "主键")
private String id;
/**
* 项目id
*/
@Schema(description ="项目id")
private String deptId;
/**
* 结算主体名称
*/
......@@ -180,7 +185,7 @@ public class TRiskMonitor extends BaseEntity {
@ExcelAttribute(name = "最后一次发薪日期", isDate = true)
@ExcelProperty("最后一次发薪日期")
@Schema(description = "最后一次发薪日期")
private Date lastSalaryTime;
private String lastSalaryTime;
/**
* 所属客户名称
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 风险管控比例
*
* @author huyc
* @date 2024-09-27 15:54:40
*/
@Data
@ColumnWidth(30)
public class RiskMonitorPerVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 总项目数
*/
@Schema(description = "总项目数")
private String deptNum;
/**
* 存在风险项目数
*/
@Schema(description = "存在风险项目数")
private String riskDeptNum;
/**
* 存在风险项目占比
*/
@Schema(description = "存在风险项目占比")
private String riskDeptPer;
/**
* 商险漏买项目数
*/
@Schema(description = "商险漏买项目数")
private String riskInsuraceNum;
/**
* 商险漏买项目占比
*/
@Schema(description = "商险漏买占比")
private String riskInsuracePer;
}
......@@ -21,7 +21,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* 风险管控统计
......@@ -32,12 +31,6 @@ import java.util.List;
@Data
public class TRiskMonitorSearchVo extends TRiskMonitor {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,id数组")
private List<String> idList;
/**
* 创建时间区间 [开始时间,结束时间]
*/
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
......@@ -20,257 +19,220 @@ import java.util.Date;
* @date 2024-09-25 10:01:06
*/
@Data
public class TRiskMonitorVo extends RowIndex implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11)
@ColumnWidth(15)
public class TRiskMonitorVo implements Serializable {
/**
* 主键
* 结算主体名称
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "主键 不能为空")
@Length(max = 32, message = "主键 不能超过32 个字符")
@ExcelAttribute(name = "主键", isNotEmpty = true, errorInfo = "主键 不能为空", maxLength = 32)
@Schema(description = "主键")
@ExcelProperty("主键")
private String id;
@ExcelAttribute(name = "项目名称", isNotEmpty = true, errorInfo = "项目名称不能为空", maxLength = 50)
@ExcelProperty("项目名称")
@Schema(description = "项目名称")
private String departName;
/**
* 结算主体编码
*/
@NotBlank(message = "结算主体编码 不能为空")
@Length(max = 32, message = "结算主体编码 不能超过32 个字符")
@ExcelAttribute(name = "结算主体编码", isNotEmpty = true, errorInfo = "结算主体编码 不能为空", maxLength = 32)
@Schema(description = "结算主体编码")
@ExcelProperty("结算主体编码")
@ExcelAttribute(name = "项目编码", isNotEmpty = true, errorInfo = "项目编码不能为空", maxLength = 32)
@NotBlank(message = "项目编码不能为空")
@ExcelProperty("项目编码")
@Schema(description = "项目编码")
private String departNo;
/**
* 结算主体名称
*/
@NotBlank(message = "结算主体名称 不能为空")
@Length(max = 50, message = "结算主体名称 不能超过50 个字符")
@ExcelAttribute(name = "结算主体名称", isNotEmpty = true, errorInfo = "结算主体名称 不能为空", maxLength = 50)
@Schema(description = "结算主体名称")
@ExcelProperty("结算主体名称")
private String departName;
/**
* 项目状态:0正常 1停止服务 2 已冻结
*/
@NotBlank(message = "项目状态:0正常 1停止服务 2 已冻结 不能为空")
@Length(max = 1, message = "项目状态:0正常 1停止服务 2 已冻结 不能超过1 个字符")
@ExcelAttribute(name = "项目状态:0正常 1停止服务 2 已冻结", isNotEmpty = true, errorInfo = "项目状态:0正常 1停止服务 2 已冻结 不能为空", maxLength = 1)
@ExcelAttribute(name = "项目状态", isNotEmpty = true, errorInfo = "项目状态不能为空", maxLength = 1)
@NotBlank(message = "项目状态:0正常 1停止服务 2 已冻结不能为空")
@Length(max = 1, message = "项目状态:0正常 1停止服务 2 已冻结不能超过1个字符")
@ExcelProperty("项目状态")
@Schema(description = "项目状态:0正常 1停止服务 2 已冻结")
@ExcelProperty("项目状态:0正常 1停止服务 2 已冻结")
private String stopFlag;
/**
* 业务类型分类
*/
@Length(max = 32, message = "业务类型分类 不能超过32 个字符")
@ExcelAttribute(name = "业务类型分类", maxLength = 32)
@Schema(description = "业务类型分类")
@ExcelProperty("业务类型分类")
private String businessPrimaryType;
/**
* 业务类型二级分类
*/
@Length(max = 32, message = "业务类型二级分类 不能超过32 个字符")
@ExcelAttribute(name = "业务类型二级分类", maxLength = 32)
@Schema(description = "业务类型二级分类")
@ExcelProperty("业务类型二级分类")
private String businessSecondType;
/**
* 业务类型三级分类
*/
@Length(max = 32, message = "业务类型三级分类 不能超过32 个字符")
@ExcelAttribute(name = "业务类型三级分类", maxLength = 32)
@Schema(description = "业务类型三级分类")
@ExcelProperty("业务类型三级分类")
private String businessThirdType;
/**
* 所属客户名称
*/
@Length(max = 50, message = "所属客户名称 不能超过50 个字符")
@ExcelAttribute(name = "所属客户名称", maxLength = 50)
@Schema(description = "所属客户名称")
@ExcelProperty("所属客户名称")
private String customerName;
/**
* 所属客户编码
*/
@Length(max = 50, message = "所属客户编码 不能超过50 个字符")
@ExcelAttribute(name = "所属客户编码", maxLength = 50)
@Schema(description = "所属客户编码")
@ExcelProperty("所属客户编码")
private String customerNo;
/**
* 二级指标归属
*/
@Length(max = 50, message = "二级指标归属 不能超过50 个字符")
@ExcelAttribute(name = "二级指标归属", maxLength = 50)
@Schema(description = "二级指标归属")
@Length(max = 50, message = "二级指标归属不能超过50个字符")
@ExcelProperty("二级指标归属")
@Schema(description = "二级指标归属")
private String secondIndicatorBelong;
/**
* 条线类型
*/
@Length(max = 20, message = "条线类型 不能超过20 个字符")
@ExcelAttribute(name = "条线类型", maxLength = 20)
@Schema(description = "条线类型")
@ExcelProperty("条线类型")
private String lineType;
/**
* BU归属(0:央企BU,1:区域政府BU,2:电信事业部,3:其他)
*/
@Length(max = 20, message = "BU归属(0:央企BU,1:区域政府BU,2:电信事业部,3:其他) 不能超过20 个字符")
@ExcelAttribute(name = "BU归属(0:央企BU,1:区域政府BU,2:电信事业部,3:其他)", maxLength = 20)
@Schema(description = "BU归属(0:央企BU,1:区域政府BU,2:电信事业部,3:其他)")
@ExcelProperty("BU归属(0:央企BU,1:区域政府BU,2:电信事业部,3:其他)")
private String buBelong;
/**
* 是否存在风险 0 是 1否
*/
@Length(max = 1, message = "是否存在风险 0 是 1否 不能超过1 个字符")
@ExcelAttribute(name = "是否存在风险 0 是 1否", maxLength = 1)
@ExcelAttribute(name = "是否存在风险", maxLength = 1)
@Length(max = 1, message = "是否存在风险 0 是 1否不能超过1个字符")
@ExcelProperty("是否存在风险")
@Schema(description = "是否存在风险 0 是 1否")
@ExcelProperty("是否存在风险 0 是 1否")
private String isRisk;
/**
* 可能风险点
*/
@Length(max = 100, message = "可能风险点 不能超过100 个字符")
@ExcelAttribute(name = "可能风险点", maxLength = 100)
@Schema(description = "可能风险点")
@ExcelAttribute(name = "可能风险点")
@ExcelProperty("可能风险点")
@Schema(description = "可能风险点")
private String riskType;
/**
* 在项人数
*/
@ExcelAttribute(name = "在项人数")
@Schema(description = "在项人数")
@ExcelProperty("在项人数")
@Schema(description = "在项人数")
private Integer projectNum;
/**
* 不在项人员有效合同数
*/
@ExcelAttribute(name = "不在项人员有效合同数")
@Schema(description = "不在项人员有效合同数")
@ExcelProperty("不在项人员有效合同数")
@Schema(description = "不在项人员有效合同数")
private Integer unproContractNum;
/**
* 在项人员有效合同数
*/
@ExcelAttribute(name = "在项人员有效合同数")
@Schema(description = "在项人员有效合同数")
@ExcelProperty("在项人员有效合同数")
@Schema(description = "在项人员有效合同数")
private Integer proContractNum;
/**
* 不在项人员有效商险数
*/
@ExcelAttribute(name = "不在项人员有效商险数")
@Schema(description = "不在项人员有效商险数")
@ExcelProperty("不在项人员有效商险数")
@ExcelAttribute(name = "不在项人员商险在保人数")
@ExcelProperty("不在项人员商险在保人数")
@Schema(description = "不在项人员商险在保人数")
private Integer unproInsuranceNum;
/**
* 在项人员有效商险
* 在项人员商险在保人
*/
@ExcelAttribute(name = "在项人员有效商险数")
@Schema(description = "在项人员有效商险数")
@ExcelProperty("在项人员有效商险数")
@ExcelAttribute(name = "在项人员商险在保人数")
@ExcelProperty("在项人员商险在保人数")
@Schema(description = "在项人员商险在保人数")
private Integer proInsuranceNum;
/**
* 不在项人员有效社保
* 不在项人员社保在保人
*/
@ExcelAttribute(name = "不在项人员有效社保数")
@Schema(description = "不在项人员有效社保数")
@ExcelProperty("不在项人员有效社保数")
@ExcelAttribute(name = "不在项人员社保在保人数")
@ExcelProperty("不在项人员社保在保人数")
@Schema(description = "不在项人员社保在保人数")
private Integer unproSocialNum;
/**
* 在项人员有效社保
* 在项人员社保在保人
*/
@ExcelAttribute(name = "在项人员有效社保数")
@Schema(description = "在项人员有效社保数")
@ExcelProperty("在项人员有效社保数")
@ExcelAttribute(name = "在项人员社保在保人数")
@ExcelProperty("在项人员社保在保人数")
@Schema(description = "在项人员社保在保人数")
private Integer proSocialNum;
/**
* 不在项人员有效公积金
* 不在项人员公积金购买人
*/
@ExcelAttribute(name = "不在项人员有效公积金数")
@Schema(description = "不在项人员有效公积金数")
@ExcelProperty("不在项人员有效公积金数")
@ExcelAttribute(name = "不在项人员公积金购买人数")
@ExcelProperty("不在项人员公积金购买人数")
@Schema(description = "不在项人员公积金购买人数")
private Integer unproFundNum;
/**
* 在项人员有效公积金
* 在项人员公积金购买人
*/
@ExcelAttribute(name = "在项人员有效公积金数")
@Schema(description = "在项人员有效公积金数")
@ExcelProperty("在项人员有效公积金数")
@ExcelAttribute(name = "在项人员公积金购买人数")
@ExcelProperty("在项人员公积金购买人数")
@Schema(description = "在项人员公积金购买人数")
private Integer proFundNum;
/**
* 不在项人员有效发薪数
*/
@ExcelAttribute(name = "不在项人员有效发薪数")
@Schema(description = "不在项人员有效发薪数")
@ExcelProperty("不在项人员有效发薪数")
@ExcelAttribute(name = "不在项人员最后一次发薪人数")
@ExcelProperty("不在项人员最后一次发薪人数")
@Schema(description = "不在项人员最后一次发薪人数")
private Integer unproSalaryNum;
/**
* 在项人员有效发薪数
*/
@ExcelAttribute(name = "在项人员有效发薪数")
@Schema(description = "在项人员有效发薪数")
@ExcelProperty("在项人员有效发薪数")
@ExcelAttribute(name = "在项人员最后一次发薪人数")
@ExcelProperty("在项人员最后一次发薪人数")
@Schema(description = "在项人员最后一次发薪人数")
private Integer proSalaryNum;
/**
* 最后发薪日期
*/
@ExcelAttribute(name = "最后发薪日期", isDate = true)
@Schema(description = "最后发薪日期")
@ExcelProperty("最后发薪日期")
private Date lastSalaryTime;
@ExcelAttribute(name = "最后一次发薪日期")
@ExcelProperty("最后一次发薪日期")
@Schema(description = "最后一次发薪日期")
private String lastSalaryTime;
/**
* 所属客户名称
*/
@ExcelAttribute(name = "客户名称", maxLength = 50)
@Length(max = 50, message = "客户名称不能超过50个字符")
@ExcelProperty("客户名称")
@Schema(description = "客户名称")
private String customerName;
/**
* 是否删除(0否/1是)
* 所属客户编码
*/
@NotBlank(message = "是否删除(0否/1是) 不能为空")
@Length(max = 1, message = "是否删除(0否/1是) 不能超过1 个字符")
@ExcelAttribute(name = "是否删除(0否/1是)", isNotEmpty = true, errorInfo = "是否删除(0否/1是) 不能为空", maxLength = 1)
@Schema(description = "是否删除(0否/1是)")
@ExcelProperty("是否删除(0否/1是)")
private String deleteFlag;
@ExcelAttribute(name = "客户编码", maxLength = 50)
@Length(max = 50, message = "客户编码不能超过50个字符")
@ExcelProperty("客户编码")
@Schema(description = "客户编码")
private String customerNo;
/**
* 创建人id
* 业务类型分类
*/
@NotBlank(message = "创建人id 不能为空")
@Length(max = 32, message = "创建人id 不能超过32 个字符")
@ExcelAttribute(name = "创建人id", isNotEmpty = true, errorInfo = "创建人id 不能为空", maxLength = 32)
@Schema(description = "创建人id")
@ExcelProperty("创建人id")
private String createBy;
@ExcelAttribute(name = "业务类型", maxLength = 32)
@Length(max = 32, message = "业务类型不能超过32个字符")
@ExcelProperty("业务类型")
@Schema(description = "业务类型")
private String businessPrimaryType;
/**
* 创建人姓名
* 业务类型二级分类
*/
@Length(max = 32, message = "创建人姓名 不能超过32 个字符")
@ExcelAttribute(name = "创建人姓名", maxLength = 32)
@Schema(description = "创建人姓名")
@ExcelProperty("创建人姓名")
private String createName;
@ExcelAttribute(name = "二级分类", maxLength = 32)
@Length(max = 32, message = "二级分类不能超过32个字符")
@ExcelProperty("二级分类")
@Schema(description = "二级分类")
private String businessSecondType;
/**
* 创建时间
* 业务类型三级分类
*/
@NotBlank(message = "创建时间 不能为空")
@ExcelAttribute(name = "创建时间", isNotEmpty = true, errorInfo = "创建时间 不能为空", isDate = true)
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private Date createTime;
@ExcelAttribute(name = "三级分类", maxLength = 32)
@Length(max = 32, message = "三级分类不能超过32个字符")
@ExcelProperty("三级分类")
@Schema(description = "三级分类")
private String businessThirdType;
/**
* 更新人id
* 条线类型
*/
@Length(max = 32, message = "更新人id 不能超过32 个字符")
@ExcelAttribute(name = "更新人id", maxLength = 32)
@Schema(description = "更新人id")
@ExcelProperty("更新人id")
private String updateBy;
@ExcelAttribute(name = "条线类型", maxLength = 20)
@Length(max = 20, message = "条线类型不能超过20个字符")
@ExcelProperty("条线类型")
@Schema(description = "条线类型")
private String lineType;
/**
* 更新时间
* BU归属
*/
@ExcelAttribute(name = "更新时间", isDate = true)
@Schema(description = "更新时间")
@ExcelProperty("更新时间")
private Date updateTime;
@ExcelAttribute(name = "BU归属", maxLength = 20)
@Length(max = 20, message = "BU归属不能超过20个字符")
@ExcelProperty("BU归属")
@Schema(description = "BU归属")
private String buBelong;
}
......@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TRiskMonitorService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -38,7 +39,6 @@ public class TRiskMonitorController {
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('archives_triskmonitor_get')")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('archives_triskmonitor_get')")
public R<TRiskMonitor> getById(@PathVariable("id") String id) {
return R.ok(tRiskMonitorService.getById(id));
}
......@@ -92,8 +92,30 @@ public class TRiskMonitorController {
**/
@Operation(description = "导出风险管控统计 hasPermission('archives_triskmonitor-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('archives_triskmonitor-export')")
public void export(HttpServletResponse response, @RequestBody TRiskMonitorSearchVo searchVo) {
tRiskMonitorService.listExport(response, searchVo);
}
/**
* 风险管控统计 批量生成
* @author huyc
* @date 2024-09-27 14:08:58
**/
@Operation(description = "生成风险管控统计")
@Inner
@PostMapping("/inner/createRiskMonitor")
public void createRiskMonitor(){
tRiskMonitorService.createRiskMonitor();
}
/**
* 查询风险占比
* @author huyc
* @date 2024-06-17 16:08:58
**/
@Operation(description = "查询风险占比")
@PostMapping("/selectCurrentRiskMonitor")
public R selectCurrentRiskMonitor(@RequestBody TRiskMonitorSearchVo tRiskMonitor) {
return tRiskMonitorService.selectCurrentRiskMonitor(tRiskMonitor);
}
}
......@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TRiskMonitor;
import com.yifu.cloud.plus.v1.yifu.archives.vo.RiskMonitorPerVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -37,5 +39,17 @@ public interface TRiskMonitorMapper extends BaseMapper<TRiskMonitor> {
* @param tRiskMonitor 风险管控统计
* @return
*/
List<TRiskMonitor> getRiskMonitorExportList(@Param("tRiskMonitor") TRiskMonitorSearchVo tRiskMonitor);
List<TRiskMonitorVo> getRiskMonitorExportList(@Param("tRiskMonitor") TRiskMonitorSearchVo tRiskMonitor);
/**
* 风险管控统计导出查询
* @return
*/
List<TRiskMonitor> selectRiskMonitorList();
/**
* 查询风险占比
* @return
*/
RiskMonitorPerVo getTRiskMonitorPer(@Param("tRiskMonitor") TRiskMonitorSearchVo tRiskMonitor);
}
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TRiskMonitor;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import javax.servlet.http.HttpServletResponse;
......@@ -46,4 +47,17 @@ public interface TRiskMonitorService extends IService<TRiskMonitor> {
*/
void listExport(HttpServletResponse response, TRiskMonitorSearchVo searchVo);
/**
* 生成管控统计
* @return
*/
void createRiskMonitor();
/**
* 查询风险占比
* @return
*/
R selectCurrentRiskMonitor(TRiskMonitorSearchVo tRiskMonitor);
}
......@@ -4,22 +4,29 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TRiskMonitor;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TRiskMonitorMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TRiskMonitorService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.RiskMonitorPerVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
......@@ -32,7 +39,11 @@ import java.util.List;
*/
@Log4j2
@Service
@RequiredArgsConstructor
public class TRiskMonitorServiceImpl extends ServiceImpl<TRiskMonitorMapper, TRiskMonitor> implements TRiskMonitorService {
private final MenuUtil menuUtil;
/**
* 风险管控统计简单分页查询
*
......@@ -41,29 +52,41 @@ public class TRiskMonitorServiceImpl extends ServiceImpl<TRiskMonitorMapper, TRi
*/
@Override
public IPage<TRiskMonitor> getTRiskMonitorPage(Page<TRiskMonitor> page, TRiskMonitorSearchVo tRiskMonitor) {
YifuUser user = SecurityUtils.getUser();
long roleId = 1839501715787390978L;
boolean isSsc = this.haveRole(user, roleId);
if (!isSsc) {
menuUtil.setAuthSql(user, tRiskMonitor);
}
return baseMapper.getTRiskMonitorPage(page, tRiskMonitor);
}
/**
* 风险管控统计批量导出
*
* @param searchVo 风险管控统计
* @return
*/
@Override
public void listExport(HttpServletResponse response, TRiskMonitorSearchVo searchVo) {
String fileName = "风险管控统计批量导出" + DateUtil.getThisTime() + ".xlsx";
YifuUser user = SecurityUtils.getUser();
long roleId = 1839501715787390978L;
boolean isSsc = this.haveRole(user, roleId);
if (!isSsc) {
menuUtil.setAuthSql(user, searchVo);
}
String fileName = "运营风险管控" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TRiskMonitor> list = new ArrayList<>();
List<TRiskMonitorVo> list = new ArrayList<>();
//获取要导出的数量
long count = baseMapper.getTRiskMonitorExportCount(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
try(ServletOutputStream out = response.getOutputStream()) {
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TRiskMonitor.class).build();
ExcelWriter excelWriter = EasyExcel.write(out, TRiskMonitorVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
......@@ -71,12 +94,6 @@ public class TRiskMonitorServiceImpl extends ServiceImpl<TRiskMonitorMapper, TRi
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.getRiskMonitorExportList(searchVo);
if (Common.isNotNull(list)) {
ExcelUtil<TRiskMonitor> util = new ExcelUtil<>(TRiskMonitor.class);
for (TRiskMonitor vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("运营风险管控" + index).build();
excelWriter.write(list, writeSheet);
......@@ -97,14 +114,49 @@ public class TRiskMonitorServiceImpl extends ServiceImpl<TRiskMonitorMapper, TRi
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
/**
* 风险管控统计批量生成
* @return
*/
@Override
public void createRiskMonitor() {
//批量删除之前生成的管控统计
baseMapper.delete(Wrappers.<TRiskMonitor>query().lambda()
.eq(TRiskMonitor::getDeleteFlag, CommonConstants.ZERO_STRING));
//批量生成统计数据
List<TRiskMonitor> list = baseMapper.selectRiskMonitorList();
if (!list.isEmpty()) {
this.saveBatch(list);
}
}
/**
* 查询风险占比
* @return
*/
@Override
public R selectCurrentRiskMonitor(TRiskMonitorSearchVo tRiskMonitor) {
YifuUser user = SecurityUtils.getUser();
long roleId = 1839501715787390978L;
boolean isSsc = this.haveRole(user, roleId);
if (!isSsc) {
menuUtil.setAuthSql(user, tRiskMonitor);
}
RiskMonitorPerVo RiskMonitorPerVo = baseMapper.getTRiskMonitorPer(tRiskMonitor);
return R.ok(RiskMonitorPerVo);
}
public boolean haveRole(YifuUser user, long roleId) {
List<Long> roleList = user.getClientRoleMap().get(ClientNameConstants.CLIENT_MVP);
for (Long role : roleList) {
if (role == roleId) {
return true;
}
}
return false;
}
}
......@@ -5,6 +5,7 @@
<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TRiskMonitorMapper">
<resultMap id="tRiskMonitorMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TRiskMonitor">
<id property="id" column="ID"/>
<result property="deptId" column="DEPT_ID"/>
<result property="departNo" column="DEPART_NO"/>
<result property="departName" column="DEPART_NAME"/>
<result property="stopFlag" column="STOP_FLAG"/>
......@@ -37,8 +38,38 @@
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<resultMap id="tRiskMonitorExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TRiskMonitorVo">
<result property="departNo" column="DEPART_NO"/>
<result property="departName" column="DEPART_NAME"/>
<result property="stopFlag" column="STOP_FLAG"/>
<result property="businessPrimaryType" column="BUSINESS_PRIMARY_TYPE"/>
<result property="businessSecondType" column="BUSINESS_SECOND_TYPE"/>
<result property="businessThirdType" column="BUSINESS_THIRD_TYPE"/>
<result property="customerName" column="CUSTOMER_NAME"/>
<result property="customerNo" column="CUSTOMER_NO"/>
<result property="secondIndicatorBelong" column="SECOND_INDICATOR_BELONG"/>
<result property="lineType" column="LINE_TYPE"/>
<result property="buBelong" column="BU_BELONG"/>
<result property="isRisk" column="IS_RISK"/>
<result property="riskType" column="RISK_TYPE"/>
<result property="projectNum" column="PROJECT_NUM"/>
<result property="unproContractNum" column="UNPRO_CONTRACT_NUM"/>
<result property="proContractNum" column="PRO_CONTRACT_NUM"/>
<result property="unproInsuranceNum" column="UNPRO_INSURANCE_NUM"/>
<result property="proInsuranceNum" column="PRO_INSURANCE_NUM"/>
<result property="unproSocialNum" column="UNPRO_SOCIAL_NUM"/>
<result property="proSocialNum" column="PRO_SOCIAL_NUM"/>
<result property="unproFundNum" column="UNPRO_FUND_NUM"/>
<result property="proFundNum" column="PRO_FUND_NUM"/>
<result property="unproSalaryNum" column="UNPRO_SALARY_NUM"/>
<result property="proSalaryNum" column="PRO_SALARY_NUM"/>
<result property="lastSalaryTime" column="LAST_SALARY_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.DEPT_ID,
a.DEPART_NO,
a.DEPART_NAME,
a.STOP_FLAG,
......@@ -51,7 +82,7 @@
a.LINE_TYPE,
a.BU_BELONG,
a.IS_RISK,
a.RISK_TYPE,
substring(a.risk_type,1,CHAR_LENGTH(a.risk_type) -2) risk_type,
a.PROJECT_NUM,
a.UNPRO_CONTRACT_NUM,
a.PRO_CONTRACT_NUM,
......@@ -71,14 +102,19 @@
a.UPDATE_BY,
a.UPDATE_TIME
</sql>
<select id="getTRiskMonitorPage" resultMap="tRiskMonitorMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_risk_monitor a
<where>
a.DELETE_FLAG = '0'
<include refid="tRiskMonitor_where"/>
</where>
</select>
<!--tRiskMonitor简单分页查询-->
<sql id="tRiskMonitor_where">
<if test="tRiskMonitor != null">
<if test="idList != null">
AND a.id in
<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="tRiskMonitor.id != null and tRiskMonitor.id.trim() != ''">
AND a.ID = #{tRiskMonitor.id}
</if>
......@@ -121,20 +157,12 @@
<if test="tRiskMonitor.riskType != null and tRiskMonitor.riskType.trim() != ''">
AND a.RISK_TYPE regexp #{tRiskMonitor.riskType}
</if>
<if test="tRiskMonitor.authSql != null and tRiskMonitor.authSql.trim() != ''">
${tRiskMonitor.authSql}
</if>
</if>
</sql>
<!--tRiskMonitor简单分页查询-->
<select id="getTRiskMonitorPage" resultMap="tRiskMonitorMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_risk_monitor a
<where>
a.DELETE_FLAG = '0'
<include refid="tRiskMonitor_where"/>
</where>
</select>
<select id="getTRiskMonitorExportCount" resultType="java.lang.Long">
SELECT
count(1)
......@@ -146,7 +174,7 @@
</select>
<!--tRiskMonitor导出查询-->
<select id="getRiskMonitorExportList" resultMap="tRiskMonitorMap">
<select id="getRiskMonitorExportList" resultMap="tRiskMonitorExportMap">
SELECT
a.DEPART_NAME,
a.DEPART_NO,
......@@ -158,7 +186,7 @@
CASE WHEN a.IS_RISK=0 THEN "是"
WHEN a.IS_RISK =1 THEN "否"
ELSE a.IS_RISK END as IS_RISK,
a.RISK_TYPE,
substring(a.risk_type,1,CHAR_LENGTH(a.risk_type) -2) risk_type,
a.PROJECT_NUM,
a.UNPRO_CONTRACT_NUM,
a.PRO_CONTRACT_NUM,
......@@ -183,5 +211,233 @@
a.DELETE_FLAG = '0'
<include refid="tRiskMonitor_where"/>
</where>
<if test="tRiskMonitor.limitStart != null">
limit #{tRiskMonitor.limitStart},#{tRiskMonitor.limitEnd}
</if>
</select>
<!--tRiskMonitor批量生成-->
<select id="selectRiskMonitorList" resultMap="tRiskMonitorMap">
select A.id as DEPT_ID,
a.DEPART_NAME,
a.DEPART_NO,
ifnull(a.SECOND_INDICATOR_BELONG,'') SECOND_INDICATOR_BELONG,
a.CUSTOMER_NAME,
a.CUSTOMER_NO,
ifnull(a.BUSINESS_SECOND_TYPE,'') BUSINESS_SECOND_TYPE,
ifnull(a.BUSINESS_PRIMARY_TYPE,'') BUSINESS_PRIMARY_TYPE,
ifnull(a.BUSINESS_THIRD_TYPE,'') BUSINESS_THIRD_TYPE,
ifnull(a.BU_BELONG,'') BU_BELONG,
ifnull(a.LINE_TYPE,'') LINE_TYPE,
CONCAT(if(ifnull(pro.countPer,0) > ifnull(q.onContractNum,0),'合同漏签 / ','')
,if(ifnull(ht.countContract,0) - ifnull(q.onContractNum,0) > 0,'合同漏减 / ','')
,if(ifnull(pro.countPer,0) > ifnull(r.onInsuranceNum,0),'商险漏买 / ','')
,if(ifnull(sx.countInsurance,0) - ifnull(r.onInsuranceNum,0) >0, '商险多买 / ','')
,if(ifnull(pro.countPer,0) > ifnull(w.onSocialNum,0), '社保漏买 / ','')
,if(ifnull(so.countSocial,0) - ifnull(w.onSocialNum,0) >0, '社保多买 / ','')
,if(ifnull(pro.countPer,0) > ifnull(e.onFundNum,0), '公积金漏买 / ','')
,if(ifnull(fu.countFund,0) - ifnull(e.onFundNum,0) >0, '公积金多买 / ','')
,if(ifnull(pro.countPer,0) > ifnull(t.onSalaryNum,0), '工资漏发 / ','')
,if(ifnull(sa.countSalary,0) - ifnull(t.onSalaryNum,0) >0, '工资多发 / ','')
) RISK_TYPE,
if (length(CONCAT(if(ifnull(pro.countPer,0) > ifnull(q.onContractNum,0),'合同漏签 / ','')
,if(ifnull(ht.countContract,0) - ifnull(q.onContractNum,0) > 0,'合同漏减 / ','')
,if(ifnull(pro.countPer,0) > ifnull(r.onInsuranceNum,0),'商险漏买 / ','')
,if(ifnull(sx.countInsurance,0) - ifnull(r.onInsuranceNum,0) >0, '商险多买 / ','')
,if(ifnull(pro.countPer,0) > ifnull(w.onSocialNum,0), '社保漏买 / ','')
,if(ifnull(so.countSocial,0) - ifnull(w.onSocialNum,0) >0, '社保多买 / ','')
,if(ifnull(pro.countPer,0) > ifnull(e.onFundNum,0), '公积金漏买 / ','')
,if(ifnull(fu.countFund,0) - ifnull(e.onFundNum,0) >0, '公积金多买 / ','')
,if(ifnull(pro.countPer,0) > ifnull(t.onSalaryNum,0), '工资漏发 / ','')
,if(ifnull(sa.countSalary,0) - ifnull(t.onSalaryNum,0) >0, '工资多发 / ','')
)) >0,'0','1') IS_RISK,
ifnull(q.onContractNum, 0) PRO_CONTRACT_NUM,
ifnull(w.onSocialNum, 0) PRO_SOCIAL_NUM,
ifnull(e.onFundNum, 0) PRO_FUND_NUM,
ifnull(r.onInsuranceNum, 0) PRO_INSURANCE_NUM,
ifnull(t.onSalaryNum, 0) PRO_SALARY_NUM,
ifnull(ht.countContract, 0) - ifnull(q.onContractNum, 0) UNPRO_CONTRACT_NUM,
ifnull(so.countSocial, 0) - ifnull(w.onSocialNum, 0) UNPRO_SOCIAL_NUM,
ifnull(fu.countFund, 0) - ifnull(e.onFundNum, 0) UNPRO_FUND_NUM,
ifnull(sx.countInsurance, 0) - ifnull(r.onInsuranceNum, 0) UNPRO_INSURANCE_NUM,
ifnull(sa.countSalary, 0) - ifnull(t.onSalaryNum, 0) UNPRO_SALARY_NUM,
ifnull(DATE_FORMAT(sa.CREATE_TIME,'%Y-%m-%d %H:%i:%s'),'') LAST_SALARY_TIME,
ifnull(pro.countPer, 0) PROJECT_NUM,
'1' create_by,
'超管' create_name,
'1' UPDATE_BY
from t_settle_domain a
left join (
select a.DEPT_NO,
count(a.EMP_IDCARD) as countContract
from t_employee_contract_info a
where a.IN_USE = '0'
and CONTRACT_END >= CURDATE()
and length(ifnull(a.DEPT_NO, 0)) > 0
group by a.DEPT_NO
) ht on a.DEPART_NO = ht.DEPT_NO
left join (
select a.SETTLE_DOMAIN_CODE,
count(a.EMP_IDCARD) as countSocial
from mvp_social.t_social_fund_info a
where a.SOCIAL_STATUS in ('3', '4', '9', '12')
and length(ifnull(a.SETTLE_DOMAIN_CODE, 0)) > 0
group by a.SETTLE_DOMAIN_CODE
) so on so.SETTLE_DOMAIN_CODE = a.DEPART_NO
left join (
select a.SETTLE_DOMAIN_CODE,
count(a.EMP_IDCARD) as countFund
from mvp_social.t_social_fund_info a
where a.fund_STATUS in ('3', '8')
and length(ifnull(a.SETTLE_DOMAIN_CODE, 0)) > 0
group by a.SETTLE_DOMAIN_CODE
) fu on fu.SETTLE_DOMAIN_CODE = a.DEPART_NO
left join (
select a.DEPT_NO,
count(a.EMP_IDCARD_NO) as countInsurance
from mvp_insurances.t_insurance_detail a
where a.IS_USE = 0
and IS_EFFECT = 0
and a.IS_OVERDUE = 0
and length(ifnull(a.DEPT_NO, 0)) > 0
group by a.DEPT_NO
) sx on a.DEPART_NO = sx.DEPT_NO
left join (
select count(acc.EMP_IDCARD) as countSalary, lll.CREATE_TIME, lll.DEPT_NO
from mvp_salary.t_salary_standard lll
left join mvp_salary.t_salary_account acc on lll.id = acc.SALARY_FORM_ID
where lll.id in
(select b.id
from (
select a.DEPT_NO,
a.id,
max(a.CREATE_TIME) CREATE_TIME
from mvp_salary.t_salary_standard a
where a.DELETE_FLAG = 0
and length(ifnull(a.DEPT_NO, 0)) > 0
group by a.DEPT_NO) hh
INNER JOIN mvp_salary.t_salary_standard b
on hh.DEPT_NO = b.DEPT_NO and hh.CREATE_TIME = b.CREATE_TIME)
group by lll.id
) sa on a.DEPART_NO = sa.DEPT_NO
left join
(
select a.DEPT_NO,
a.EMP_IDCARD,
count(a.EMP_IDCARD) countPer
from t_employee_project a
where a.PROJECT_STATUS = 0
group by a.DEPT_NO) pro on a.DEPART_NO = pro.DEPT_NO
left join (select a.DEPT_NO,
count(a.EMP_IDCARD) onContractNum
from t_employee_contract_info a
where a.IN_USE = '0'
and CONTRACT_END >= CURDATE()
and length(ifnull(a.DEPT_NO, 0)) > 0
and EXISTS(
select 1
from t_employee_project a1
where a1.PROJECT_STATUS = 0
and a1.DELETE_FLAG = '0'
and a.EMP_IDCARD = a1.EMP_IDCARD
and a.DEPT_NO = a1.DEPT_NO)
group by a.DEPT_NO) q on a.DEPART_NO = q.DEPT_NO
left join
(
select a.SETTLE_DOMAIN_CODE,
count(a.EMP_IDCARD) onSocialNum
from mvp_social.t_social_fund_info a
where a.SOCIAL_STATUS in ('3', '4', '9', '12')
and length(ifnull(a.SETTLE_DOMAIN_CODE, 0)) > 0
and EXISTS(
select 1
from t_employee_project a1
where a1.PROJECT_STATUS = 0
and a1.DELETE_FLAG = '0'
and a.EMP_IDCARD = a1.EMP_IDCARD
and a.SETTLE_DOMAIN_CODE = a1.DEPT_NO)
group by a.SETTLE_DOMAIN_CODE
) w on a.DEPART_NO = w.SETTLE_DOMAIN_CODE
left join
(
select a.SETTLE_DOMAIN_CODE,
count(a.EMP_IDCARD) onFundNum
from mvp_social.t_social_fund_info a
where a.fund_STATUS in ('3', '8')
and length(ifnull(a.SETTLE_DOMAIN_CODE, 0)) > 0
and EXISTS(
select 1
from t_employee_project a1
where a1.PROJECT_STATUS = 0
and a1.DELETE_FLAG = '0'
and a.EMP_IDCARD = a1.EMP_IDCARD
and a.SETTLE_DOMAIN_CODE = a1.DEPT_NO)
group by a.SETTLE_DOMAIN_CODE
) e on a.DEPART_NO = e.SETTLE_DOMAIN_CODE
left join
(
select a.DEPT_NO,
count(a.EMP_IDCARD_NO) onInsuranceNum
from mvp_insurances.t_insurance_detail a
where a.IS_USE = 0
and IS_EFFECT = 0
and a.IS_OVERDUE = 0
and length(ifnull(a.DEPT_NO, 0)) > 0
and EXISTS(
select 1
from t_employee_project a1
where a1.PROJECT_STATUS = 0
and a1.DELETE_FLAG = '0'
and a.EMP_IDCARD_NO = a1.EMP_IDCARD
and a.DEPT_NO = a1.DEPT_NO)
group by a.DEPT_NO
) r on a.DEPART_NO = r.DEPT_NO
left join
(
select count(acc.EMP_IDCARD) as onSalaryNum, lll.DEPT_NO
from mvp_salary.t_salary_standard lll
left join mvp_salary.t_salary_account acc on lll.id = acc.SALARY_FORM_ID
where lll.id in
(select b.id
from (
select a.DEPT_NO,
a.id,
max(a.CREATE_TIME) CREATE_TIME
from mvp_salary.t_salary_standard a
where a.DELETE_FLAG = 0
and length(ifnull(a.DEPT_NO, 0)) > 0
group by a.DEPT_NO) hh
INNER JOIN mvp_salary.t_salary_standard b
on hh.DEPT_NO = b.DEPT_NO and hh.CREATE_TIME = b.CREATE_TIME)
and EXISTS(
select 1
from t_employee_project a1
where a1.PROJECT_STATUS = 0
and a1.DELETE_FLAG = '0'
and acc.EMP_IDCARD = a1.EMP_IDCARD
and lll.DEPT_NO = a1.DEPT_NO)
group by lll.DEPT_NO, lll.id
) t on a.DEPART_NO = t.DEPT_NO
where a.DELETE_FLAG = '0'
group by a.DEPART_NO
</select>
<select id="getTRiskMonitorPer" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.RiskMonitorPerVo">
SELECT
count(1) as deptNum,
sum(if(IS_RISK = '0',1,0)) as riskDeptNum,
concat(round(sum(if(IS_RISK = '0',1,0)) *100/count(1),2),'%') riskDeptPer,
sum(if(PROJECT_NUM > PRO_INSURANCE_NUM,1,0)) as riskInsuraceNum,
concat(round(sum(if(PROJECT_NUM > PRO_INSURANCE_NUM,1,0))*100/count(1),2),'%') riskInsuracePer
FROM
t_risk_monitor a
where
a.DELETE_FLAG = '0'
<if test="tRiskMonitor.authSql != null and tRiskMonitor.authSql.trim() != ''">
${tRiskMonitor.authSql}
</if>
</select>
</mapper>
......@@ -84,4 +84,13 @@ public class ArchiveTask {
SecurityConstants.FROM_IN);
log.info("-------------每日刷新档案完整监控数据-定时任务开始------------");
}
public void everyDayCreateRiskMonitor() {
log.info("-------------每日刷新运营风险管控数据------------");
HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(), daprArchivesProperties.getAppId(),
"/triskmonitor/inner/createRiskMonitor", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------每日刷新运营风险管控数据-定时任务开始------------");
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment