Commit a2b139af authored by huyuchen's avatar huyuchen

Merge remote-tracking branch 'origin/develop' into develop

parents 30d025b7 42c8c96e
......@@ -23,6 +23,7 @@ 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.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Past;
......@@ -484,4 +485,21 @@ public class EmployeeProjectExportParamVO extends BaseEntity {
private String[] empNatureArray;
private List<String> idList;
/**
* @Author fxj
* 查询数据起
**/
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
private int limitEnd;
/**
* 导出IDS
*/
@Schema(description = "导出IDS")
private String ids;
}
......@@ -108,15 +108,27 @@ public class TEmployeeContractAreaResController {
@PostMapping
@PreAuthorize("@pms.hasPermission('temployeecontractareares_add')")
public R<Boolean> save(@RequestBody TEmployeeContractAreaRes areaRes) {
TEmployeeContractAreaRes res = tEmployeeContractAreaResService.getOne(Wrappers.<TEmployeeContractAreaRes>query().lambda()
TEmployeeContractAreaRes res = null;
if (Common.isEmpty(areaRes.getFileTown())){
res = tEmployeeContractAreaResService.getOne(Wrappers.<TEmployeeContractAreaRes>query().lambda()
.eq(TEmployeeContractAreaRes::getFileProvince,areaRes.getFileProvince())
.eq(TEmployeeContractAreaRes::getFileCity,areaRes.getFileCity())
.eq(TEmployeeContractAreaRes::getFileTown,areaRes.getFileTown())
.isNull(TEmployeeContractAreaRes::getFileTown)
.eq(TEmployeeContractAreaRes::getUserId,areaRes.getUserId())
.last(CommonConstants.LAST_ONE_SQL));
}
if (Common.isEmpty(areaRes.getFileCity())){
res = tEmployeeContractAreaResService.getOne(Wrappers.<TEmployeeContractAreaRes>query().lambda()
.eq(TEmployeeContractAreaRes::getFileProvince,areaRes.getFileProvince())
.isNull(TEmployeeContractAreaRes::getFileCity)
.eq(TEmployeeContractAreaRes::getUserId,areaRes.getUserId())
.last(CommonConstants.LAST_ONE_SQL));
}
if (Common.isNotNull(res)){
return R.failed("已存在对应审核人及地市配置!");
}
// 清理缓存
tEmployeeContractAreaResService.removeAuthCache();
return R.ok(tEmployeeContractAreaResService.save(areaRes));
}
......@@ -152,6 +164,8 @@ public class TEmployeeContractAreaResController {
return R.failed(CommonConstants.PARAM_INFO_ERROR);
}
areaRes.setStatus(status);
// 清理缓存
tEmployeeContractAreaResService.removeAuthCache();
return R.ok(tEmployeeContractAreaResService.updateById(areaRes));
}
/**
......@@ -165,6 +179,8 @@ public class TEmployeeContractAreaResController {
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('temployeecontractareares_del')")
public R<Boolean> removeById(@PathVariable String id) {
// 清理缓存
tEmployeeContractAreaResService.removeAuthCache();
return R.ok(tEmployeeContractAreaResService.removeById(id));
}
......
......@@ -59,4 +59,8 @@ public interface TEmployeeProjectMapper extends BaseMapper<TEmployeeProject> {
* @return
*/
List<EmployeeProjectExportVO> getTEmployeeProjectExportPage(@Param("tEmployeeProject") EmployeeProjectExportParamVO tEmployeeProject);
// getTEmployeeProjectExportPage 改造
List<EmployeeProjectExportVO> noPageDiy(@Param("tEmployeeProject")EmployeeProjectExportParamVO searchVo);
int noPageCountDiy(@Param("tEmployeeProject")EmployeeProjectExportParamVO searchVo);
}
......@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpContractAreaExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractAreaResSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
......@@ -53,4 +54,6 @@ public interface TEmployeeContractAreaResService extends IService<TEmployeeContr
R<List<ErrorMessage>> importDiy(InputStream inputStream);
void listExport(HttpServletResponse response, TEmployeeContractAreaResSearchVo searchVo);
void removeAuthCache();
}
......@@ -33,9 +33,12 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractAreaResServ
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmpContractAreaExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractAreaResSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractAreaResVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
......@@ -55,6 +58,9 @@ import java.util.List;
@Log4j2
@Service
public class TEmployeeContractAreaResServiceImpl extends ServiceImpl<TEmployeeContractAreaResMapper, TEmployeeContractAreaRes> implements TEmployeeContractAreaResService {
@Autowired
private RedisUtil redisUtil;
/**
* 合同地市权限配置表简单分页查询
*
......@@ -227,4 +233,21 @@ public class TEmployeeContractAreaResServiceImpl extends ServiceImpl<TEmployeeCo
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
/**
* @Author fxj
* @Description 清除项目缓存
* @Date 17:08 2022/7/11
* @Param
* @return
**/
@Override
public void removeAuthCache() {
try{
redisUtil.remove(CacheConstants.DATA_AUTH_DETAILS + CommonConstants.ONE_STRING);
redisUtil.remove(CacheConstants.DATA_AUTH_DETAILS + CommonConstants.ZERO_STRING);
} catch (Exception e) {
log.error("清除权限配置缓存错误:",e);
}
}
}
......@@ -2033,7 +2033,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("不良记录"+index).build();
WriteSheet writeSheet = EasyExcel.writerSheet("人员档案批量导出"+index).build();
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(list)){
......
......@@ -19,10 +19,12 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -62,6 +64,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.*;
......@@ -1173,38 +1176,58 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
* @Date 10:55 2022/6/23
**/
@Override
public void listExportProject(HttpServletResponse response, EmployeeProjectExportParamVO projectDTO, String idstr, List<String> exportFields) {
public void listExportProject(HttpServletResponse response, EmployeeProjectExportParamVO searchVo, String idstr, List<String> exportFields) {
searchVo.setIdList(Common.getList(idstr));
String fileName = "项目档案批量导出" + DateUtil.getThisTime() + CommonConstants.XLSX;
// 根据用户传入确定要导出的字段
Set<String> includeColumnFiledNames = new HashSet<>(exportFields);
//获取要导出的列表
List<EmployeeProjectExportVO> list;
//获取记录
list = gettEmpProInfoExportVos(idstr, projectDTO);
//获取要导出的列表 gettEmpProInfoExportVos
List<EmployeeProjectExportVO> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
if (list == null || list.isEmpty()) {
list = new ArrayList<>();
}
try {
out = response.getOutputStream();
ExcelUtil<EmployeeProjectExportVO> util = new ExcelUtil<>(EmployeeProjectExportVO.class);
for (EmployeeProjectExportVO vo : list) {
util.convertEntity(vo, null, null, null);
}
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding(CommonConstants.UTF8);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(includeColumnFiledNames).sheet("项目档案")
.doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFieldNames(includeColumnFiledNames).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
Field[] allFields = EmployeeProjectExportVO.class.getDeclaredFields();
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)){
ExcelUtil<EmployeeProjectExportVO> util = new ExcelUtil<>(EmployeeProjectExportVO.class);
for (EmployeeProjectExportVO vo:list){
util.convertEntityAsso(vo,null,null,null,allFields);
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("项目档案批量导出"+index).build();
excelWriter.write(list,writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)){
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("项目档案批量导出"+index).build();
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(list)){
list.clear();
}
out.flush();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
excelWriter.finish();
}catch (Exception e){
log.error("执行异常" ,e);
}finally {
try {
if (null != out) {
out.close();
......@@ -1215,6 +1238,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
}
private List<EmployeeProjectExportVO> noPageDiy(EmployeeProjectExportParamVO searchVo) {
return baseMapper.noPageDiy(searchVo);
}
private int noPageCountDiy(EmployeeProjectExportParamVO searchVo) {
return baseMapper.noPageCountDiy(searchVo);
}
/**
* @param employeeInfo
* @Description: 新增项目档案
......
......@@ -802,4 +802,39 @@
</where>
order by a.CREATE_TIME desc
</select>
<!--tEmployeeInfo导出查询改造 fxj 2022-11-03-->
<select id="noPageDiy" resultMap="tEmployeeProjectExportMap">
SELECT
<include refid="Base_Export_List"/>
FROM t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
<where>
a.DELETE_FLAG = '0'
<include refid="exportTEmployeeProject_where"/>
<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
${tEmployeeProject.authSql}
</if>
</where>
order by a.CREATE_TIME desc
<if test="tEmployeeProject != null">
<if test="tEmployeeProject.limitStart != null">
limit #{tEmployeeProject.limitStart},#{tEmployeeProject.limitEnd}
</if>
</if>
</select>
<!--tEmployeeInfo导出查询count改造 fxj 2022-11-03-->
<select id="noPageCountDiy" resultType="java.lang.Integer">
SELECT
count(1)
FROM t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
<where>
a.DELETE_FLAG = '0'
<include refid="exportTEmployeeProject_where"/>
<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
${tEmployeeProject.authSql}
</if>
</where>
</select>
</mapper>
......@@ -107,14 +107,25 @@ public class TInsuranceAreaResController {
@PostMapping
@PreAuthorize("@pms.hasPermission('tinsuranceareares_add')")
public R<Boolean> save(@RequestBody TInsuranceAreaRes areaRes) {
TInsuranceAreaRes res = tInsuranceAreaResService.getOne(Wrappers.<TInsuranceAreaRes>query().lambda()
TInsuranceAreaRes res = null;
if (Common.isEmpty(areaRes.getCity())){
res = tInsuranceAreaResService.getOne(Wrappers.<TInsuranceAreaRes>query().lambda()
.eq(TInsuranceAreaRes::getProvince,areaRes.getProvince())
.isNull(TInsuranceAreaRes::getCity)
.eq(TInsuranceAreaRes::getUserId,areaRes.getUserId())
.last(CommonConstants.LAST_ONE_SQL));
}else {
res = tInsuranceAreaResService.getOne(Wrappers.<TInsuranceAreaRes>query().lambda()
.eq(TInsuranceAreaRes::getProvince,areaRes.getProvince())
.eq(TInsuranceAreaRes::getCity,areaRes.getCity())
.eq(TInsuranceAreaRes::getUserId,areaRes.getUserId())
.last(CommonConstants.LAST_ONE_SQL));
}
if (Common.isNotNull(res)){
return R.failed("已存在对应审核人及地市配置!");
}
// 清理缓存
tInsuranceAreaResService.removeAuthCache();
return R.ok(tInsuranceAreaResService.save(areaRes));
}
......@@ -143,6 +154,8 @@ public class TInsuranceAreaResController {
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('tinsuranceareares_del')")
public R<Boolean> removeById(@PathVariable String id) {
// 清理缓存
tInsuranceAreaResService.removeAuthCache();
return R.ok(tInsuranceAreaResService.removeById(id));
}
......@@ -165,6 +178,8 @@ public class TInsuranceAreaResController {
return R.failed(CommonConstants.PARAM_INFO_ERROR);
}
areaRes.setStatus(status);
// 清理缓存
tInsuranceAreaResService.removeAuthCache();
return R.ok(tInsuranceAreaResService.updateById(areaRes));
}
......
......@@ -53,4 +53,6 @@ public interface TInsuranceAreaResService extends IService<TInsuranceAreaRes> {
R<List<ErrorMessage>> importDiy(InputStream inputStream);
void listExport(HttpServletResponse response, TInsuranceAreaResSearchVo searchVo);
void removeAuthCache();
}
......@@ -30,6 +30,7 @@ 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.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceAreaRes;
......@@ -39,6 +40,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceAreaExportVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceAreaResSearchVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceAreaResVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
......@@ -57,6 +59,9 @@ import java.util.List;
@Log4j2
@Service
public class TInsuranceAreaResServiceImpl extends ServiceImpl<TInsuranceAreaResMapper, TInsuranceAreaRes> implements TInsuranceAreaResService {
@Autowired
private RedisUtil redisUtil;
/**
* 商险地市权限配置表简单分页查询
* @param tInsuranceAreaRes 商险地市权限配置表
......@@ -132,6 +137,16 @@ public class TInsuranceAreaResServiceImpl extends ServiceImpl<TInsuranceAreaResM
}
}
@Override
public void removeAuthCache() {
try{
redisUtil.remove(CacheConstants.DATA_AUTH_DETAILS + CommonConstants.ONE_STRING);
redisUtil.remove(CacheConstants.DATA_AUTH_DETAILS + CommonConstants.ZERO_STRING);
} catch (Exception e) {
log.error("清除权限配置缓存错误:",e);
}
}
@Override
public List<TInsuranceAreaExportVo> noPageDiy(TInsuranceAreaResSearchVo searchVo,
List<String> settleDomainIds,
......
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