Commit a72f11b3 authored by fangxinjiang's avatar fangxinjiang

代码切分-fxj

parent 7e631b2b
...@@ -85,7 +85,7 @@ public class TSocialDeadlineInfo extends BaseEntity { ...@@ -85,7 +85,7 @@ public class TSocialDeadlineInfo extends BaseEntity {
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private String town; private String town;
/** /**
* 社保(增员)起始日 * 社保起始日
*/ */
@ExcelAttribute(name = "社保起始日", isNotEmpty = true, errorInfo = "社保起始日不能为空", isDate = true) @ExcelAttribute(name = "社保起始日", isNotEmpty = true, errorInfo = "社保起始日不能为空", isDate = true)
@NotBlank(message = "社保起始日不能为空") @NotBlank(message = "社保起始日不能为空")
...@@ -93,7 +93,7 @@ public class TSocialDeadlineInfo extends BaseEntity { ...@@ -93,7 +93,7 @@ public class TSocialDeadlineInfo extends BaseEntity {
@Schema(description = "社保起始日") @Schema(description = "社保起始日")
private Date socialStartDate; private Date socialStartDate;
/** /**
* 社保(增员)截止日 * 社保截止日
*/ */
@ExcelAttribute(name = "社保截止日", isNotEmpty = true, errorInfo = "社保截止日不能为空", isDate = true) @ExcelAttribute(name = "社保截止日", isNotEmpty = true, errorInfo = "社保截止日不能为空", isDate = true)
@NotBlank(message = "社保截止日不能为空") @NotBlank(message = "社保截止日不能为空")
...@@ -101,7 +101,7 @@ public class TSocialDeadlineInfo extends BaseEntity { ...@@ -101,7 +101,7 @@ public class TSocialDeadlineInfo extends BaseEntity {
@Schema(description = "社保截止日") @Schema(description = "社保截止日")
private Date socialEndDate; private Date socialEndDate;
/** /**
* 医疗(增员)起始日 * 医疗起始日
*/ */
@ExcelAttribute(name = "医疗起始日", isNotEmpty = true, errorInfo = "医疗起始日不能为空", isDate = true) @ExcelAttribute(name = "医疗起始日", isNotEmpty = true, errorInfo = "医疗起始日不能为空", isDate = true)
@NotBlank(message = "医疗起始日不能为空") @NotBlank(message = "医疗起始日不能为空")
...@@ -109,7 +109,7 @@ public class TSocialDeadlineInfo extends BaseEntity { ...@@ -109,7 +109,7 @@ public class TSocialDeadlineInfo extends BaseEntity {
@Schema(description = "医疗起始日") @Schema(description = "医疗起始日")
private Date medicalStartDate; private Date medicalStartDate;
/** /**
* 医疗(增员)截止日 * 医疗截止日
*/ */
@ExcelAttribute(name = "医疗截止日", isNotEmpty = true, errorInfo = "医疗截止日不能为空", isDate = true) @ExcelAttribute(name = "医疗截止日", isNotEmpty = true, errorInfo = "医疗截止日不能为空", isDate = true)
@NotBlank(message = "医疗截止日不能为空") @NotBlank(message = "医疗截止日不能为空")
...@@ -141,41 +141,4 @@ public class TSocialDeadlineInfo extends BaseEntity { ...@@ -141,41 +141,4 @@ public class TSocialDeadlineInfo extends BaseEntity {
@Schema(description = "配置类型:0 非基础配置 1基础配置(后面配置都是按他生成的)") @Schema(description = "配置类型:0 非基础配置 1基础配置(后面配置都是按他生成的)")
private String type; private String type;
/**
* 社保减员起始日期
*/
@ExcelAttribute(name = "社保减员起始日期", isNotEmpty = true, errorInfo = "社保减员起始日期不能为空", isDate = true)
@NotBlank(message = "社保减员起始日期不可为空")
@ExcelProperty("社保减员起始日期")
@Schema(description = "社保减员起始日期")
private Date socialStartDateReduce;
/**
* 医疗减员起始日期
*/
@ExcelAttribute(name = "医疗减员起始日期", isNotEmpty = true, errorInfo = "医疗减员起始日期不能为空", isDate = true)
@NotBlank(message = "医疗减员起始日期不能为空")
@ExcelProperty("医疗减员起始日期")
@Schema(description = "医疗减员起始日期")
private Date medicalStartDateReduce;
/**
* 社保减员截止日期
*/
@ExcelAttribute(name = "社保减员截止日期", isNotEmpty = true, errorInfo = "社保减员截止日期不能为空", isDate = true)
@NotBlank(message = "社保减员截止日期不能为空")
@ExcelProperty("社保减员截止日期")
@Schema(description = "社保减员截止日期")
private Date socialEndDateReduce;
/**
* 医疗减员截止日期
*/
@ExcelAttribute(name = "医疗减员截止日期", isNotEmpty = true, errorInfo = "医疗减员截止日期不能为空", isDate = true)
@NotBlank(message = "医疗减员截止日期不能为空")
@ExcelProperty("医疗减员截止日期")
@Schema(description = "医疗减员截止日期")
private Date medicalEndDateReduce;
} }
...@@ -145,12 +145,4 @@ public class SocialHandleSearchVo extends TDispatchInfo { ...@@ -145,12 +145,4 @@ public class SocialHandleSearchVo extends TDispatchInfo {
@ExcelProperty("医生大反馈" ) @ExcelProperty("医生大反馈" )
@ExcelIgnore @ExcelIgnore
private String ysdRemark; private String ysdRemark;
/**
* 社保ID
*/
@TableField(exist = false)
@Schema(description ="社保ID")
@ExcelIgnore
private String socialId;
} }
...@@ -98,29 +98,6 @@ ...@@ -98,29 +98,6 @@
<artifactId>yifu-common-ekp</artifactId> <artifactId>yifu-common-ekp</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<!-- Apache POI -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version> <!-- 使用最新版本 -->
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>spire.xls</groupId>
<artifactId>spire.xls</artifactId>
<version>5.3.0</version>
<type>jar</type>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -50,7 +50,6 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -50,7 +50,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -887,21 +886,4 @@ public class TDispatchInfoController { ...@@ -887,21 +886,4 @@ public class TDispatchInfoController {
searchVo.setCreateBy(user.getId()); searchVo.setCreateBy(user.getId());
tDispatchInfoService.doexportFundInfoOne(response,searchVo); tDispatchInfoService.doexportFundInfoOne(response,searchVo);
} }
/**
* @Author fxj
* @Description 导出花名册
* @Date 14:02 2024/12/10
* @Param
* @return
**/
@PostMapping("/doExportRoster")
@Operation(description = "导出花名册")
@SysLog("导出花名册")
public R<URL> doExportRoster(@RequestParam("socialId") String socialId, @RequestParam("type") String type,@RequestParam("unitCreditCode")String unitCreditCode) {
return tDispatchInfoService.doExportRoster(socialId,type,unitCreditCode);
}
} }
...@@ -32,7 +32,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -32,7 +32,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -162,5 +161,4 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> { ...@@ -162,5 +161,4 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
**/ **/
List<SocialHandleExportVo> getRecordRosterList(SocialHandleSearchVo searchVo, String idStr); List<SocialHandleExportVo> getRecordRosterList(SocialHandleSearchVo searchVo, String idStr);
R<URL> doExportRoster(String socialId, String type,String unitCreditCode);
} }
...@@ -63,8 +63,6 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.*; ...@@ -63,8 +63,6 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.*;
import com.yifu.cloud.plus.v1.yifu.social.mapper.*; import com.yifu.cloud.plus.v1.yifu.social.mapper.*;
import com.yifu.cloud.plus.v1.yifu.social.service.*; import com.yifu.cloud.plus.v1.yifu.social.service.*;
import com.yifu.cloud.plus.v1.yifu.social.util.DoSocialTask; import com.yifu.cloud.plus.v1.yifu.social.util.DoSocialTask;
import com.yifu.cloud.plus.v1.yifu.social.util.ExcelMergeImage;
import com.yifu.cloud.plus.v1.yifu.social.util.ExcelToImage;
import com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil; import com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil;
import com.yifu.cloud.plus.v1.yifu.social.vo.*; import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -83,12 +81,9 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -83,12 +81,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
...@@ -142,12 +137,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -142,12 +137,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
private DoSocialTask socialTask; private DoSocialTask socialTask;
private final TDispatchSocialFundInfoService infoService; private final TDispatchSocialFundInfoService infoService;
@Autowired
private ExcelMergeImage excelMergeImage;
@Autowired
private ExcelToImage excelToImage;
@Autowired
private OSSUtil ossUtil;
/** /**
* 派单信息记录表简单分页查询 * 派单信息记录表简单分页查询
...@@ -7519,370 +7508,5 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -7519,370 +7508,5 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
return list; return list;
} }
/**
* @Author fxj
* @Description
* @Date 15:58 2024/12/10
* @Param socialId:社保明细ID type: 1 社保增 2社保减 3 医保增 4 医保减
* @return
**/
@Override
public R<URL> doExportRoster(String socialId, String type,String unitCreditCode) {
SocialHandleSearchVo searchVo = new SocialHandleSearchVo();
if (Common.isEmpty(socialId) || Common.isEmpty(type) || Common.isEmpty(unitCreditCode)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
TSocialInfo socialInfo = socialMapper.selectById(socialId);
if (Common.isEmpty(socialInfo)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
searchVo.setSocialHouseholdName(socialInfo.getSocialHouseholdName());
//searchVo.setDisMonth(DateUtil.getThisMonth());
searchVo.setDisMonth("202410");
searchVo.setAuditStatus(CommonConstants.ZERO_STRING);
//searchVo.setSocialHandleStatus(CommonConstants.ZERO_STRING);
searchVo.setUnitCreditCode(unitCreditCode);
searchVo.setSocialId(socialId);
//社保增减
if (CommonConstants.ONE_STRING.equals(type) || CommonConstants.TWO_STRING.equals(type)){
return doExportRosterSocial(searchVo,type);
}
//医保增减
if (CommonConstants.THREE_STRING.equals(type) || CommonConstants.FOUR_STRING.equals(type)){
return doExportRosterMedical(searchVo,type);
}
return null;
}
/**
* @Author fxj
* @Description 医保增加花名册
* @Date 16:29 2024/12/10
* @Param
* @return
**/
public R<URL> doExportRosterMedical(SocialHandleSearchVo searchVo,String type){
String fileName = DispatchConstants.SOCIAL_MEDICAL_EXPORT + searchVo.getSocialHouseholdName() + "_" + DateUtil.getThisMonth() + CommonConstants.XLSX;
//获取要导出的列表
List<TDispatchSocialExportVo> list = new ArrayList<>();
try (FileOutputStream out = new FileOutputStream(fileName)){
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out).build();
WriteSheet writeSheet;
WriteTable writeTable0;
WriteTable writeTable1;
WriteTable writeTable2;
WriteTable writeTable3;
WriteTable writeTable4;
TDispatchSocialExportVo vo;
List<Integer> columnIndexes = Arrays.asList(0,12);
CustomCellStyleStrategy customCellStyleStrategy = new CustomCellStyleStrategy(columnIndexes);
CustomCellStyleOneStrategy customCellStyleStrategyOne = new CustomCellStyleOneStrategy(columnIndexes);
CustomCellStyleTwoStrategy customCellStyleStrategyTwo = new CustomCellStyleTwoStrategy(columnIndexes);
CustomCellStyleThreeStrategy customCellStyleStrategyThree = new CustomCellStyleThreeStrategy(columnIndexes);
writeTable0 = EasyExcel.writerTable(0).
head(headOne()).
registerWriteHandler(customCellStyleStrategy).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)40,(short)20)).
build();
writeTable1 = EasyExcel.writerTable(1).
head(headTwo(searchVo.getSocialHouseholdName(),searchVo.getUnitCreditCode())).
registerWriteHandler(customCellStyleStrategyOne).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)25,(short)20)).
build();
writeTable2 = EasyExcel.writerTable(2).
head(headThree()).
registerWriteHandler(customCellStyleStrategyThree).
registerWriteHandler(new CustomCellWriteWidthConfig()).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)25,(short)20))
.build();
writeTable3 = EasyExcel.writerTable(3).
head(headFour()).
registerWriteHandler(customCellStyleStrategyTwo).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)50,(short)20))
.build();
writeTable4 = EasyExcel.writerTable(4).
head(headFive()).
registerWriteHandler(customCellStyleStrategyTwo).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)25,(short)20))
.build();
//派增的数据--医保增员
if (CommonConstants.THREE_STRING.equals(type)){
searchVo.setType(CommonConstants.ZERO_STRING);
long count = getSocialDisRecordCount(searchVo);
if (count > CommonConstants.ZERO_INT){
list = getSocialDisRecord(searchVo);
if (Common.isNotNull(list)) {
//判断list的大小是否大于10
if (list.size() < 10) {
int size = 10 - list.size();
int num = list.size() + 1;
for (int i =1;i<= size;i++) {
vo = new TDispatchSocialExportVo();
vo.setNum(num);
num ++;
list.add(vo);
}
}
writeSheet = EasyExcel.writerSheet("增员").build();
// 第一次写入会创建头
excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
// 第二次写如也会创建头,然后在第一次的后面写入数据
excelWriter.write(list, writeSheet, writeTable2);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable3);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable4);
}
} else {
writeSheet = EasyExcel.writerSheet("增员").build();
excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
// 第二次写如也会创建头,然后在第一次的后面写入数据
int num = 1;
for (int i =1;i<= 10;i++) {
vo = new TDispatchSocialExportVo();
vo.setNum(num);
num ++;
list.add(vo);
}
excelWriter.write(list, writeSheet, writeTable2);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable3);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable4);
}
}else if (CommonConstants.FOUR_STRING.equals(type)){
//派减的数据--医保减员
searchVo.setType(CommonConstants.ONE_STRING);
long count1 = getSocialDisRecordCount(searchVo);
if (count1 > CommonConstants.ZERO_INT){
list = baseMapper.getSocialReduceDisRecord(searchVo);
if (Common.isNotNull(list)) {
//判断list的大小是否大于10
if (list.size() < 10) {
int size = 10 - list.size();
int num = list.size() + 1;
for (int i =1;i<= size;i++) {
vo = new TDispatchSocialExportVo();
vo.setNum(num);
num ++;
list.add(vo);
}
}
writeSheet = EasyExcel.writerSheet("减员").build();
// 第一次写入会创建头
excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
// 第二次写如也会创建头,然后在第一次的后面写入数据
excelWriter.write(list, writeSheet, writeTable2);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable3);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable4);
}
} else {
writeSheet = EasyExcel.writerSheet("减员").build();
excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
// 第二次写如也会创建头,然后在第一次的后面写入数据
int num = 1;
list = new ArrayList<>();
for (int i =1;i<= 10;i++) {
vo = new TDispatchSocialExportVo();
vo.setNum(num);
num ++;
list.add(vo);
}
excelWriter.write(list, writeSheet, writeTable2);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable3);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable4);
}
}
if (excelWriter!= null) {
excelWriter.finish();
}
}catch (Exception e){
log.error("执行异常" ,e);
}
return null;
}
/**
* @Author fxj
* @Description 社保增减花名册
* @Date 16:28 2024/12/10
* @Param
* @return
**/
public R<URL> doExportRosterSocial(SocialHandleSearchVo searchVo,String type){
String fileName = DispatchConstants.SOCIAL_MEDICAL_EXPORT + searchVo.getSocialHouseholdName() + "_" + DateUtil.getThisMonth() + CommonConstants.XLS;
String projectRoot = System.getProperty("user.dir");
String filePath = projectRoot+"//"+fileName;
//获取要导出的列表
List<TDispatchSocialPersionExportVo> list = new ArrayList<>();
try {
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(filePath).build();
WriteSheet writeSheet;
WriteTable writeTable0;
WriteTable writeTable1;
WriteTable writeTable2;
WriteTable writeTable3;
WriteTable writeTable4;
TDispatchSocialPersionExportVo vo;
TDispatchSocialPersionReduceExportVo reduceVo;
if (CommonConstants.ONE_STRING.equals(type)){
//派增的数据--社保
searchVo.setType(CommonConstants.ZERO_STRING);
long count = getSocialPersionDisCount(searchVo);
List<Integer> columnIndexes = Arrays.asList(0,17);
CustomCellStyleStrategy customCellStyleStrategy = new CustomCellStyleStrategy(columnIndexes);
CustomCellStyleOneStrategy customCellStyleStrategyOne = new CustomCellStyleOneStrategy(columnIndexes);
CustomCellStyleTwoStrategy customCellStyleStrategyTwo = new CustomCellStyleTwoStrategy(columnIndexes);
CustomCellStyleThreeStrategy customCellStyleStrategyThree = new CustomCellStyleThreeStrategy(columnIndexes);
writeTable0 = EasyExcel.writerTable(0).
head(persionHeadOne()).
registerWriteHandler(customCellStyleStrategy).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)40,(short)20)).
build();
writeTable1 = EasyExcel.writerTable(1).
head(persionHeadTwo(searchVo.getSocialHouseholdName(),searchVo.getCustomerNo())).
registerWriteHandler(customCellStyleStrategyOne).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)20,(short)20)).
build();
writeTable2 = EasyExcel.writerTable(2).
head(persionHead()).
registerWriteHandler(customCellStyleStrategyThree).
registerWriteHandler(new CustomCellWriteWidthOneConfig()).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)30,(short)20))
.build();
writeTable3 = EasyExcel.writerTable(3).
head(persionHeadThree()).
registerWriteHandler(customCellStyleStrategyTwo).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)150,(short)20))
.build();
writeTable4 = EasyExcel.writerTable(4).
head(persionHead1()).
registerWriteHandler(customCellStyleStrategyTwo).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)20,(short)20))
.build();
if (count > CommonConstants.ZERO_INT){
list = getSocialPersionDisRecord(searchVo);
if (Common.isNotNull(list)) {
//判断list的大小是否大于10
if (list.size() < 10) {
int size = 10 - list.size();
int num = list.size() + 1;
for (int i =1;i<= size;i++) {
vo = new TDispatchSocialPersionExportVo();
vo.setNum(num);
num ++;
list.add(vo);
}
}
writeSheet = EasyExcel.writerSheet("增员").build();
// 第一次写入会创建头
// 第二次写如也会创建头,然后在第一次的后面写入数据
excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
excelWriter.write(list, writeSheet, writeTable2);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable3);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable4);
}
} else {
writeSheet = EasyExcel.writerSheet("增员").build();
excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
int num = 1;
for (int i =1;i<= 10;i++) {
vo = new TDispatchSocialPersionExportVo();
vo.setNum(num);
num ++;
list.add(vo);
}
excelWriter.write(list, writeSheet, writeTable2);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable3);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable4);
}
}else if (CommonConstants.ONE_STRING.equals(type)){
//派减的数据--社保
searchVo.setType(CommonConstants.ONE_STRING);
long count1 = getSocialPersionReduceDisCount(searchVo);
//获取要导出的列表
List<TDispatchSocialPersionReduceExportVo> listReduce = new ArrayList<>();
List<Integer> columnIndex = Arrays.asList(0,24);
CustomCellStyleStrategy customCellStyleStrategy1 = new CustomCellStyleStrategy(columnIndex);
CustomCellStyleOneStrategy customCellStyleStrategy2 = new CustomCellStyleOneStrategy(columnIndex);
CustomCellStyleTwoStrategy customCellStyleStrategy3 = new CustomCellStyleTwoStrategy(columnIndex);
CustomCellStyleThreeStrategy customCellStyleStrategy4 = new CustomCellStyleThreeStrategy(columnIndex);
writeTable0 = EasyExcel.writerTable(0).
head(persionReduceHeadOne()).
registerWriteHandler(customCellStyleStrategy1).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)40,(short)20)).
build();
writeTable1 = EasyExcel.writerTable(1).
head(persionReduceHeadTwo(searchVo.getSocialHouseholdName(),searchVo.getCustomerNo())).
registerWriteHandler(customCellStyleStrategy2).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)20,(short)20)).
build();
writeTable2 = EasyExcel.writerTable(2).
head(persionReduceHead()).
registerWriteHandler(customCellStyleStrategy4).
registerWriteHandler(new CustomCellWriteWidthTwoConfig()).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)50,(short)20))
.build();
writeTable3 = EasyExcel.writerTable(3).
head(persionReduceHead1()).
registerWriteHandler(customCellStyleStrategy3).
registerWriteHandler(new SimpleRowHeightStyleStrategy((short)40,(short)20))
.build();
if (count1 > CommonConstants.ZERO_INT){
listReduce = getSocialPersionReduceDisRecord(searchVo);
if (Common.isNotNull(listReduce)) {
//判断list的大小是否大于10
if (listReduce.size() < 10) {
int size = 10 - listReduce.size();
int num = listReduce.size() + 1;
for (int i =1;i<= size;i++) {
reduceVo = new TDispatchSocialPersionReduceExportVo();
reduceVo.setNum(num);
num ++;
listReduce.add(reduceVo);
}
}
writeSheet = EasyExcel.writerSheet("减员").build();
// 第一次写入会创建头
// 第二次写如也会创建头,然后在第一次的后面写入数据
excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
excelWriter.write(listReduce, writeSheet, writeTable2);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable3);
}
} else {
writeSheet = EasyExcel.writerSheet("减员").build();
excelWriter.write(new ArrayList<>(), writeSheet, writeTable0);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable1);
int num = 1;
for (int i =1;i<= 10;i++) {
reduceVo = new TDispatchSocialPersionReduceExportVo();
reduceVo.setNum(num);
num ++;
listReduce.add(reduceVo);
}
excelWriter.write(listReduce, writeSheet, writeTable2);
excelWriter.write(new ArrayList<>(), writeSheet, writeTable3);
}
}
if (excelWriter!= null) {
excelWriter.finish();
}
//读取文件 生成电子章
}catch (Exception e){
log.error("执行异常" ,e);
}
return null;
}
} }
...@@ -307,29 +307,12 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI ...@@ -307,29 +307,12 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
if (Common.isNotNull(save.getSocialEndDate())) { if (Common.isNotNull(save.getSocialEndDate())) {
save.setSocialEndDate(this.getNewDateByOldDate(save.getSocialEndDate())); save.setSocialEndDate(this.getNewDateByOldDate(save.getSocialEndDate()));
} }
//2024-12-09 fxj v1.7.3
if (Common.isNotNull(save.getSocialStartDateReduce())){
save.setSocialStartDateReduce(this.getNewDateByOldDate(save.getSocialStartDateReduce()));
}
if (Common.isNotNull(save.getSocialEndDateReduce())){
save.setSocialEndDateReduce(this.getNewDateByOldDate(save.getSocialEndDateReduce()));
}
if (Common.isNotNull(save.getMedicalStartDateReduce())){
save.setMedicalStartDateReduce(this.getNewDateByOldDate(save.getMedicalStartDateReduce()));
}
if (Common.isNotNull(save.getMedicalEndDateReduce())){
save.setMedicalEndDateReduce(this.getNewDateByOldDate(save.getMedicalEndDateReduce()));
}
initSocialEndDate(holidayMap, save); initSocialEndDate(holidayMap, save);
initMedicalEndDate(holidayMap, save); initMedicalEndDate(holidayMap, save);
//处理社保减少截止时间和医保减少截止时间
initSocialEndDateReduce(holidayMap, save);
initMedicalEndDateReduce(holidayMap, save);
save.setUpdateTime(null); save.setUpdateTime(null);
save.setUpdateBy(null); save.setUpdateBy(null);
save.setUpdateName(null); save.setUpdateName(null);
//已存在跳过
queryWrapper = initCountQuery(save,queryWrapper); queryWrapper = initCountQuery(save,queryWrapper);
if (baseMapper.selectCount(queryWrapper) > 0){ if (baseMapper.selectCount(queryWrapper) > 0){
continue; continue;
...@@ -475,28 +458,6 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI ...@@ -475,28 +458,6 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
initSocialEndDate(holidayMap,save); initSocialEndDate(holidayMap,save);
} }
private void initSocialEndDateReduce(Map<String, String> holidayMap, TSocialDeadlineInfo save) {
// type 0 休假 1 补班
String day= holidayMap.get(DateUtil.getDay(save.getSocialEndDateReduce()));
if (Common.isNotNull(day)){
save.setSocialEndDateReduce(DateUtil.addDayByDate(save.getSocialEndDateReduce(),CommonConstants.ONE_INT_NEGATE));
}else {
return;
}
initSocialEndDateReduce(holidayMap,save);
}
private void initMedicalEndDateReduce(Map<String, String> holidayMap, TSocialDeadlineInfo save) {
// type 0 休假 1 补班
String day= holidayMap.get(DateUtil.getDay(save.getMedicalEndDateReduce()));
if (Common.isNotNull(day)){
save.setMedicalEndDateReduce(DateUtil.addDayByDate(save.getMedicalEndDateReduce(),CommonConstants.ONE_INT_NEGATE));
}else {
return;
}
initMedicalEndDateReduce(holidayMap,save);
}
/** /**
* @Description: 获取 当月启用 的配置 * @Description: 获取 当月启用 的配置
* @Author: hgw * @Author: hgw
......
package com.yifu.cloud.plus.v1.yifu.social.util;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Component;
import javax.imageio.ImageIO;
import java.awt.Color;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
/**
* @Author fxj
* @Date 2024/12/9
* @Description
* @Version 1.0
*/
@Component
public class ExcelMergeImage {
public static void main(String[] args) throws IOException {
String excelFilePath = "E:\\test\\11\\1.xls";
String imageFilePath = "E:\\test\\11\\1.png";
//convertExcelToImage(excelFilePath, imageFilePath);
//stampAdder();
}
public static void convertExcelToImage(String excelFilePath, String imageFilePath) throws IOException {
FileInputStream fis = new FileInputStream(new File(excelFilePath));
Workbook workbook;
if (excelFilePath.endsWith(".xls")) {
workbook = new HSSFWorkbook(fis); // For Excel 97-2003 (.xls) format
} else if (excelFilePath.endsWith(".xlsx")) {
workbook = new XSSFWorkbook(fis); // For Excel 2007 and later (.xlsx) format
} else {
throw new IllegalArgumentException("Unsupported file type");
}
Sheet sheet = workbook.getSheetAt(0);
int rowCount = 16; //sheet.getPhysicalNumberOfRows();
int colCount = 25;//sheet.getRow(0).getPhysicalNumberOfCells();
BufferedImage image = new BufferedImage(896, 424, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = image.createGraphics();
for (int i = 0; i < rowCount; i++) {
Row row = sheet.getRow(i);
for (int j = 0; j < colCount; j++) {
Cell cell = row.getCell(j);
if (cell != null) {
graphics.fillRect(j*150, i*47, 896, 424);
graphics.setColor(Color.black); // 设置边框颜色
graphics.drawRect(j*150, i*47, 896, 424);
String cellValue = getCellValueAsString(cell);
graphics.drawString(cellValue, j * 150+10, i * 45+30);
}
}
}
graphics.dispose();
ImageIO.write(image, "png", new File(imageFilePath));
workbook.close();
fis.close();
}
private static String getCellValueAsString(Cell cell) {
String cellValue = "";
if (cell != null) {
switch (cell.getCellType()) {
case STRING:
cellValue = cell.getStringCellValue();
break;
case NUMERIC:
cellValue = String.valueOf(cell.getNumericCellValue());
break;
case BOOLEAN:
cellValue = String.valueOf(cell.getBooleanCellValue());
break;
case FORMULA:
cellValue = cell.getCellFormula();
break;
default:
cellValue = "";
}
}
return cellValue;
}
/**
* @Author fxj
* @Description 03格式excel添加电子印章或图片
* @Date 15:32 2024/12/9
* @Param
* @return
**/
public FileOutputStream addPictureToExcel(FileInputStream fis,
InputStream imageIs,
FileOutputStream fileOut,
int SheetNum){
Workbook workbook = null;
try {
workbook = new HSSFWorkbook(fis);
Sheet sheet = workbook.getSheetAt(SheetNum);
// 在合适的位置添加印章
Drawing<?> drawing = sheet.createDrawingPatriarch();
CreationHelper helper = workbook.getCreationHelper();
ClientAnchor anchor = helper.createClientAnchor();
anchor.setCol1(2);
anchor.setRow1(0);
anchor.setCol2(4);
anchor.setRow2(7);
// 添加印章图片
int pictureIdx = workbook.addPicture(IOUtils.toByteArray(imageIs), Workbook.PICTURE_TYPE_PNG);
drawing.createPicture(anchor, pictureIdx);
workbook.write(fileOut);
}catch (Exception e){
e.printStackTrace();
}finally {
try {
if (null != fis){
fis.close();
}
if (null != workbook){
workbook.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return fileOut;
}
}
package com.yifu.cloud.plus.v1.yifu.social.util;
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
/**
* @Author fxj
* @Date 2024/12/9
* @Description excel 转换为 图片 并上传阿里云 (上传后自动删除生成的图片文件)
* @Version 1.0
*/
@Component
public class ExcelToImage {
public R<URL> excelToImg(InputStream inputStream ,OSSUtil ossUtil){
String projectRoot = System.getProperty("user.dir");
//加载Excel工作表
Workbook wb = new Workbook();
wb.loadFromHtml(inputStream);
//获取工作表
Worksheet sheet = wb.getWorksheets().get(0);
//调用方法将Excel工作表保存为图片
sheet.saveToImage(projectRoot+"\\ToImg.png");
File file = null;
try {
file = new File(projectRoot+"\\ToImg.png");
if (file.exists()){
String key = System.currentTimeMillis() + file.getName();
if (ossUtil.uploadFileByFile(file,key,null)){
return R.ok(ossUtil.getObjectUrl(null,key));
}else {
return R.failed(CommonConstants.RESULT_DATA_FAIL+":ExcelToImage上传OSS异常");
}
}
} catch (Exception e) {
e.printStackTrace();
return R.failed(CommonConstants.RESULT_DATA_FAIL+":ExcelToImage转换异常-"+e.getMessage());
} finally {
if (file.exists()){
file.delete();
}
}
return R.failed(CommonConstants.RESULT_DATA_FAIL);
//调用方法,将指定Excel单元格数据范围保存为图片
//sheet.saveToImage("ToImg2.png",8,1,30,7);
/*//调用方法将Excel保存为HTML
sheet.saveToHtml("ToHtml.html");
//调用方法将Excel保存为XPS
sheet.saveToFile("ToXPS.xps", String.valueOf(FileFormat.XPS));
//调用方法将Excel保存为CSV
sheet.saveToFile("ToCSV.csv", String.valueOf(FileFormat.CSV));
//调用方法将Excel保存为XML
sheet.saveToFile("ToXML.xml", String.valueOf(FileFormat.XML));
//调用方法将Excel保存为PostScript
sheet.saveToFile("ToPostScript.postscript", String.valueOf(FileFormat.PostScript));
//调用方法将Excel保存为PCL
sheet.saveToFile("ToPCL.pcl", String.valueOf(FileFormat.PCL));*/
}
}
...@@ -1577,7 +1577,6 @@ ...@@ -1577,7 +1577,6 @@
SELECT count(1) from ( SELECT count(1) from (
SELECT 1 SELECT 1
FROM t_dispatch_info a FROM t_dispatch_info a
left join t_social_info s on s.id=a.SOCIAL_ID
<where> <where>
<include refid="where_getSocialDisRecord"/> <include refid="where_getSocialDisRecord"/>
</where> </where>
...@@ -2259,11 +2258,6 @@ ...@@ -2259,11 +2258,6 @@
<sql id="where_getSocialDisRecord"> <sql id="where_getSocialDisRecord">
a.DELETE_FLAG = 0 a.DELETE_FLAG = 0
AND a.social_id is not null AND a.social_id is not null
<if test='tDispatchInfo.socialId != null and tDispatchInfo.socialId.trim() == "0" '>
AND a.social_id = #{tDispatchInfo.socialId}
</if>
<!-- dispatch-status 未提交1待审核2审核通过3审核不通过4办理完成5待SSC审核 --> <!-- dispatch-status 未提交1待审核2审核通过3审核不通过4办理完成5待SSC审核 -->
<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0" '> <if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0" '>
AND a.STATUS in ('2','4') AND a.STATUS in ('2','4')
...@@ -2360,9 +2354,6 @@ ...@@ -2360,9 +2354,6 @@
<sql id="where_getSocialPersionDisRecord"> <sql id="where_getSocialPersionDisRecord">
a.DELETE_FLAG = 0 a.DELETE_FLAG = 0
AND a.social_id is not null AND a.social_id is not null
<if test='tDispatchInfo.socialId != null and tDispatchInfo.socialId.trim() == "0" '>
AND a.social_id = #{tDispatchInfo.socialId}
</if>
<!-- dispatch-status 未提交1待审核2审核通过3审核不通过4办理完成5待SSC审核 --> <!-- dispatch-status 未提交1待审核2审核通过3审核不通过4办理完成5待SSC审核 -->
<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0"'> <if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0"'>
AND a.STATUS in ('2','4') AND a.STATUS in ('2','4')
......
...@@ -41,10 +41,6 @@ ...@@ -41,10 +41,6 @@
<result property="type" column="TYPE"/> <result property="type" column="TYPE"/>
<result property="socialStartDate" column="SOCIAL_START_DATE"/> <result property="socialStartDate" column="SOCIAL_START_DATE"/>
<result property="medicalStartDate" column="MEDICAL_START_DATE"/> <result property="medicalStartDate" column="MEDICAL_START_DATE"/>
<result property="socialStartDateReduce" column="SOCIAL_START_DATE_REDUCE"/>
<result property="medicalStartDateReduce" column="MEDICAL_START_DATE_REDUCE"/>
<result property="socialEndDateReduce" column="SOCIAL_END_DATE_REDUCE"/>
<result property="medicalEndDateReduce" column="MEDICAL_END_DATE_REDUCE"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
...@@ -61,11 +57,7 @@ ...@@ -61,11 +57,7 @@
a.UPDATE_NAME, a.UPDATE_NAME,
a.UPDATE_TIME, a.UPDATE_TIME,
a.STATUS,a.TYPE, a.STATUS,a.TYPE,
a.SOCIAL_START_DATE,a.MEDICAL_START_DATE, a.SOCIAL_START_DATE,a.MEDICAL_START_DATE
a.SOCIAL_START_DATE_REDUCE,
a.MEDICAL_START_DATE_REDUCE,
a.SOCIAL_END_DATE_REDUCE,
a.MEDICAL_END_DATE_REDUCE
</sql> </sql>
<sql id="tSocialDeadlineInfo_where"> <sql id="tSocialDeadlineInfo_where">
<if test="tSocialDeadlineInfo != null"> <if test="tSocialDeadlineInfo != null">
......
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