Commit 5f9ce6f9 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/MVP-1.7.3-shuiyou' into MVP-1.7.3-shuiyou

parents 14e8c4bf 4a619e3c
......@@ -107,7 +107,7 @@ public class TEmployeeContractInfo extends BaseEntity {
* 合同起始时间
*/
@NotBlank(message = "合同起始时间不能为空")
@ExcelAttribute(name = "合同起始时间", needExport = true)
@ExcelAttribute(name = "合同起始时间", needExport = true,isNotEmpty = true)
@Schema(description = "合同起始时间", name = "contractStart")
@JsonFormat(shape= JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
private Date contractStart;
......
......@@ -109,7 +109,7 @@ public class TSocialHouseholdInsertVo extends RowIndex implements Serializable {
@Schema(description ="手机号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("手机号")
private Integer phone;
private String phone;
/**
* 类型 0 独立户 1 自由户
......
......@@ -108,7 +108,7 @@ public class TSocialHouseholdUpdateVo extends RowIndex implements Serializable {
@Schema(description ="手机号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("手机号")
private Integer phone;
private String phone;
/**
* 类型 0 独立户 1 自由户
......
......@@ -459,6 +459,7 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
SysHouseHoldInfo info;
SysUser auditUser;
SysUser handlerUser;
String errorMsg;
// 个性化校验逻辑
// 执行数据插入操作组装
for (int i = 0; i < excelVOList.size(); i++) {
......@@ -524,11 +525,11 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
continue;
}
//校验手机号准确性
// errorMsg = checkMobile(String.valueOf(excel.getPhone()));
// if (!errorMsg.contains(HouseConfigConstants.SUCESS)) {
// errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMsg,excel));
// continue;
// }
errorMsg = checkMobile(excel.getPhone());
if (!errorMsg.contains(HouseConfigConstants.SUCESS)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMsg,excel));
continue;
}
//封装和插入数据
household.setAreaCode(areaMap.get(household.getCity()).getAreaCode());
household.setAutoStatus(excel.getAutoStatus().equals(CommonConstants.IS_TRUE) ? "0" : "1");
......@@ -580,6 +581,7 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
}
Map<String,String> exitNameMap = new HashMap<>();
SysHouseHoldInfo info;
String errorMsg;
// 个性化校验逻辑
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
......@@ -663,13 +665,13 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
}
//校验手机号准确性
// if (Common.isNotNull(excel.getPhone())) {
// errorMsg = checkMobile(String.valueOf(excel.getPhone()));
// if (!errorMsg.contains(HouseConfigConstants.SUCESS)) {
// errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMsg, excel));
// continue;
// }
// }
if (Common.isNotNull(excel.getPhone())) {
errorMsg = checkMobile(excel.getPhone());
if (!errorMsg.contains(HouseConfigConstants.SUCESS)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorMsg, excel));
continue;
}
}
// 新老数据审核人办理人不同,先删除,再添加
if (Common.isNotNull(excel.getAuditUserName()) && !excel.getAuditUserName().equals(info.getAuditUserName())) {
tSocialfundHouseResService.deleteAuditUser(info);
......@@ -720,7 +722,7 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
info.setOrganName(excel.getOrganName());
}
if (Common.isNotNull(excel.getPhone())) {
info.setPhone(String.valueOf(excel.getPhone()));
info.setPhone(excel.getPhone());
}
if (Common.isNotNull(excel.getCustomerNo())) {
info.setCustomerNo(excel.getCustomerNo());
......
......@@ -4,6 +4,7 @@ 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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialFriendConfig;
......@@ -27,10 +28,18 @@ import java.util.Base64;
@Component
public class ExcelToImage {
private final static String toImag ="\\ToImg.png";
private final static String toImagParamError = ":带印章excel生成图片传参异常";
private final static String toImagConvertError = ":ExcelToImage转换异常-";
private final static String toImagOSSError = ":ExcelToImage上传OSS异常";
public R<String> excelToImg(InputStream inputStream , SocialFriendConfig socialFriendConfig
, RestTemplate restTemplate, TSocialFriendBackLog backLog){
if (null == inputStream || null == socialFriendConfig){
return R.failed(CommonConstants.RESULT_DATA_FAIL+":带印章excel生成图片传参异常");
return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagParamError);
}
String projectRoot = System.getProperty(CommonConstants.USER_DIR);
//加载Excel工作表
......@@ -40,20 +49,23 @@ public class ExcelToImage {
Worksheet sheet = wb.getWorksheets().get(0);
//调用方法将Excel工作表保存为图片
sheet.saveToImage(projectRoot+"\\ToImg.png");
sheet.saveToImage(projectRoot+toImag);
File file = null;
try {
// 上传税友文件服务器,返回文件路径
file = new File(projectRoot+"\\ToImg.png");
file = new File(projectRoot+toImag);
if (file.exists()){
String key = System.currentTimeMillis() + file.getName();
byte[] fileContent = Files.readAllBytes(file.toPath());
String base64String = Base64.getEncoder().encodeToString(fileContent);
String url = socialFriendConfig.uploadPng(restTemplate, key, base64String, backLog);
if (Common.isEmpty(url)){
return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagOSSError);
}
return R.ok(url);
}
} catch (Exception e) {
return R.failed(CommonConstants.RESULT_DATA_FAIL+":ExcelToImage转换异常-"+e.getMessage());
return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagConvertError+e.getMessage());
} finally {
if (file.exists()){
file.delete();
......@@ -70,7 +82,7 @@ public class ExcelToImage {
}
public R<URL> excelToImg(InputStream inputStream ,OSSUtil ossUtil){
if (null == inputStream || null == ossUtil){
return R.failed(CommonConstants.RESULT_DATA_FAIL+":带印章excel生成图片传参异常");
return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagParamError);
}
String projectRoot = System.getProperty(CommonConstants.USER_DIR);
//加载Excel工作表
......@@ -79,20 +91,20 @@ public class ExcelToImage {
//获取工作表
Worksheet sheet = wb.getWorksheets().get(0);
//调用方法将Excel工作表保存为图片
sheet.saveToImage(projectRoot+"\\ToImg.png");
sheet.saveToImage(projectRoot+toImag);
File file = null;
try {
file = new File(projectRoot+"\\ToImg.png");
file = new File(projectRoot+toImag);
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异常");
return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagOSSError);
}
}
} catch (Exception e) {
return R.failed(CommonConstants.RESULT_DATA_FAIL+":ExcelToImage转换异常-"+e.getMessage());
return R.failed(CommonConstants.RESULT_DATA_FAIL+toImagConvertError+e.getMessage());
} finally {
if (file.exists()){
file.delete();
......
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