Commit c1d9620f authored by huyuchen's avatar huyuchen

huych-户配置调整

parent c7754985
......@@ -85,69 +85,37 @@ public class TSocialDeadlineInfo extends BaseEntity {
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String town;
/**
* 社保增员起始日期
* 社保(增员)起始日
*/
@ExcelAttribute(name = "社保增员起始日期", isNotEmpty = true, errorInfo = "社保增员起始日期不能为空", isDate = true)
@NotBlank(message = "社保增员起始日期不能为空")
@ExcelProperty("社保增员起始日期")
@Schema(description = "社保增员起始日期")
@ExcelAttribute(name = "社保起始日", isNotEmpty = true, errorInfo = "社保起始日不能为空", isDate = true)
@NotBlank(message = "社保起始日不能为空")
@ExcelProperty("社保起始日")
@Schema(description = "社保起始日")
private Date socialStartDate;
/**
* 社保增员截止日期
* 社保(增员)截止日
*/
@ExcelAttribute(name = "社保增员截止日期", isNotEmpty = true, errorInfo = "社保增员截止日期不能为空", isDate = true)
@NotBlank(message = "社保增员截止日期不能为空")
@ExcelProperty("社保增员截止日期")
@Schema(description = "社保增员截止日期")
@ExcelAttribute(name = "社保截止日", isNotEmpty = true, errorInfo = "社保截止日不能为空", isDate = true)
@NotBlank(message = "社保截止日不能为空")
@ExcelProperty("社保截止日")
@Schema(description = "社保截止日")
private Date socialEndDate;
/**
* 社保减员起始日期
*/
@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 socialEndDateReduce;
/**
* 医保增员起始日期
* 医疗(增员)起始日
*/
@ExcelAttribute(name = "医保增员起始日期", isNotEmpty = true, errorInfo = "医保增员起始日期不能为空", isDate = true)
@NotBlank(message = "医保增员起始日期不能为空")
@ExcelProperty("医保增员起始日期")
@Schema(description = "医保增员起始日期")
@ExcelAttribute(name = "医疗起始日", isNotEmpty = true, errorInfo = "医疗起始日不能为空", isDate = true)
@NotBlank(message = "医疗起始日不能为空")
@ExcelProperty("医疗起始日")
@Schema(description = "医疗起始日")
private Date medicalStartDate;
/**
* 医保增员截止日期
* 医疗(增员)截止日
*/
@ExcelAttribute(name = "医保增员截止日期", isNotEmpty = true, errorInfo = "医保增员截止日期不能为空", isDate = true)
@NotBlank(message = "医保增员截止日期不能为空")
@ExcelProperty("医保增员截止日期")
@Schema(description = "医保增员截止日期")
@ExcelAttribute(name = "医疗截止日", isNotEmpty = true, errorInfo = "医疗截止日不能为空", isDate = true)
@NotBlank(message = "医疗截止日不能为空")
@ExcelProperty("医疗截止日")
@Schema(description = "医疗截止日")
private Date medicalEndDate;
/**
* 医保减员起始日期
*/
@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 medicalEndDateReduce;
/**
* 更新人
*/
......@@ -173,4 +141,41 @@ public class TSocialDeadlineInfo extends BaseEntity {
@Schema(description = "配置类型:0 非基础配置 1基础配置(后面配置都是按他生成的)")
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,4 +145,12 @@ public class SocialHandleSearchVo extends TDispatchInfo {
@ExcelProperty("医生大反馈" )
@ExcelIgnore
private String ysdRemark;
/**
* 社保ID
*/
@TableField(exist = false)
@Schema(description ="社保ID")
@ExcelIgnore
private String socialId;
}
......@@ -100,6 +100,21 @@
</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>
......
......@@ -50,6 +50,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
......@@ -886,4 +887,21 @@ public class TDispatchInfoController {
searchVo.setCreateBy(user.getId());
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,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Map;
......@@ -161,4 +162,5 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
**/
List<SocialHandleExportVo> getRecordRosterList(SocialHandleSearchVo searchVo, String idStr);
R<URL> doExportRoster(String socialId, String type,String unitCreditCode);
}
......@@ -83,7 +83,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLEncoder;
......@@ -7533,11 +7535,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (Common.isEmpty(socialInfo)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
//查询户名称对应的户配置 以获取公章信息
SysBaseSetInfo socialBaseSet = baseSetMapper.selectById(socialInfo.getSocialHousehold());
if (Common.isEmpty(socialBaseSet)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
searchVo.setSocialHouseholdName(socialInfo.getSocialHouseholdName());
//searchVo.setDisMonth(DateUtil.getThisMonth());
searchVo.setDisMonth("202410");
......@@ -7878,12 +7875,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
excelWriter.finish();
}
//读取文件 生成电子章
FileInputStream inputStream = new FileInputStream(filePath);
String outPath = projectRoot+"//out_"+fileName;
FileOutputStream fileOUt = new FileOutputStream(outPath);
URL url =ossUtil.getObjectUrl(null,"");
InputStream inStream = url.openStream();
excelMergeImage.addPictureToExcel(inputStream,inStream,fileOUt,0);
}catch (Exception e){
log.error("执行异常" ,e);
......
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 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,6 +1577,7 @@
SELECT count(1) from (
SELECT 1
FROM t_dispatch_info a
left join t_social_info s on s.id=a.SOCIAL_ID
<where>
<include refid="where_getSocialDisRecord"/>
</where>
......@@ -2258,6 +2259,11 @@
<sql id="where_getSocialDisRecord">
a.DELETE_FLAG = 0
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审核 -->
<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0" '>
AND a.STATUS in ('2','4')
......@@ -2354,6 +2360,9 @@
<sql id="where_getSocialPersionDisRecord">
a.DELETE_FLAG = 0
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审核 -->
<if test='tDispatchInfo.auditStatus != null and tDispatchInfo.auditStatus.trim() == "0"'>
AND a.STATUS in ('2','4')
......
......@@ -41,7 +41,6 @@
<result property="type" column="TYPE"/>
<result property="socialStartDate" column="SOCIAL_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"/>
......@@ -62,8 +61,7 @@
a.UPDATE_NAME,
a.UPDATE_TIME,
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,
......
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