招行新模版
This commit is contained in:
parent
516b83f1dd
commit
f8c35ba173
|
|
@ -23,6 +23,7 @@ import java.net.URLConnection;
|
|||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Api(tags = "下载")
|
||||
@RestController
|
||||
|
|
@ -53,6 +54,9 @@ public class DownloadController {
|
|||
response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
response.addHeader("charset", "utf-8");
|
||||
response.addHeader("Pragma", "no-cache");
|
||||
if(Objects.equals(filename,"zh_model.xlsx")){ // 招行新模版
|
||||
filename = "招商银行工资导入模板(新).xlsx";
|
||||
}
|
||||
String encodeName = URLEncoder.encode(filename, StandardCharsets.UTF_8.toString());
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodeName + "\"; filename*=utf-8''" + encodeName);
|
||||
|
||||
|
|
|
|||
|
|
@ -104,12 +104,25 @@ public class ImportNoPhotoExcelHelper {
|
|||
|
||||
private static boolean checkModal(Sheet sheet, String className) {
|
||||
int colNum = 0;
|
||||
// 是否是招行新模板
|
||||
boolean isNewModel = false;
|
||||
if (className.equals("UploadPayrollBean")){
|
||||
colNum = sheet.getRow(1).getLastCellNum();
|
||||
}else if (className.equals("CareerBean")){
|
||||
colNum = sheet.getRow(1).getLastCellNum();
|
||||
}else if (className.equals("WagesDetailsBean")){
|
||||
colNum = sheet.getRow(5).getLastCellNum();
|
||||
String applyDateTitle = sheet.getRow(4).getCell(0).getStringCellValue();
|
||||
if(Objects.equals(applyDateTitle,"申请时间")){
|
||||
isNewModel = true;
|
||||
colNum = sheet.getRow(12).getLastCellNum();
|
||||
System.err.println(sheet.getRow(11).getLastCellNum());
|
||||
System.err.println(sheet.getRow(12).getLastCellNum());
|
||||
System.err.println(sheet.getRow(13).getLastCellNum());
|
||||
|
||||
}else{
|
||||
colNum = sheet.getRow(5).getLastCellNum();
|
||||
}
|
||||
|
||||
}else{
|
||||
colNum = sheet.getRow(0).getLastCellNum();
|
||||
}
|
||||
|
|
@ -123,7 +136,11 @@ public class ImportNoPhotoExcelHelper {
|
|||
case "CareerBean":
|
||||
return colNum == 12;
|
||||
case "WagesDetailsBean":
|
||||
return colNum >= 18;
|
||||
if(isNewModel){
|
||||
return colNum >= 7;
|
||||
}else{
|
||||
return colNum >= 18;
|
||||
}
|
||||
case "VoucherDetailsBean":
|
||||
return colNum == 28;
|
||||
case "CCBWagesDetailsBean":
|
||||
|
|
@ -140,8 +157,17 @@ public class ImportNoPhotoExcelHelper {
|
|||
}
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
int last = 0;
|
||||
// 是否是招行新模板
|
||||
boolean isNewModel = false;
|
||||
Map<String, String> zhDataMap = new HashMap<>(); // 存放招行新模板通用数据
|
||||
if (className.equals("WagesDetailsBean")){
|
||||
last = sheet.getRow(5).getLastCellNum();
|
||||
String applyDateTitle = sheet.getRow(4).getCell(0).getStringCellValue();
|
||||
if(Objects.equals(applyDateTitle,"申请时间")){
|
||||
isNewModel = true;
|
||||
last = sheet.getRow(12).getLastCellNum();
|
||||
}else{
|
||||
last = sheet.getRow(5).getLastCellNum();
|
||||
}
|
||||
}else{
|
||||
last = sheet.getRow(0).getLastCellNum();
|
||||
}
|
||||
|
|
@ -193,7 +219,54 @@ public class ImportNoPhotoExcelHelper {
|
|||
if (row.getRowNum() < 2) continue;
|
||||
break;
|
||||
case "WagesDetailsBean":
|
||||
if (row.getRowNum() < 5) continue;
|
||||
if(isNewModel){
|
||||
if (row.getRowNum() < 3) {
|
||||
continue;
|
||||
}else if(row.getRowNum() == 4){
|
||||
// 申请时间、主账号
|
||||
row.getCell(1).setCellType(CellType.STRING);
|
||||
row.getCell(3).setCellType(CellType.STRING);
|
||||
String applyDate = row.getCell(1).getStringCellValue();
|
||||
String mainNumber = row.getCell(3).getStringCellValue();
|
||||
if(StringUtils.isEmpty(applyDate)){
|
||||
return R.fail("申请时间不能为空");
|
||||
}
|
||||
if(StringUtils.isEmpty(mainNumber)){
|
||||
return R.fail("主账号不能为空");
|
||||
}
|
||||
zhDataMap.put("applyDate",applyDate);
|
||||
zhDataMap.put("mainNumber",mainNumber);
|
||||
continue;
|
||||
}else if(row.getRowNum() == 7){
|
||||
// 业务参考号、批次摘要/备注
|
||||
row.getCell(1).setCellType(CellType.STRING);
|
||||
row.getCell(3).setCellType(CellType.STRING);
|
||||
String serviceReferenceNumber = row.getCell(1).getStringCellValue();
|
||||
String batchSummary = row.getCell(3).getStringCellValue();
|
||||
if(StringUtils.isEmpty(serviceReferenceNumber)){
|
||||
return R.fail("业务参考号不能为空");
|
||||
}
|
||||
if(StringUtils.isEmpty(batchSummary)){
|
||||
return R.fail("批次摘要/备注不能为空");
|
||||
}
|
||||
zhDataMap.put("serviceReferenceNumber",serviceReferenceNumber);
|
||||
zhDataMap.put("batchSummary",batchSummary);
|
||||
continue;
|
||||
}else if(row.getRowNum() == 8){
|
||||
row.getCell(1).setCellType(CellType.STRING);
|
||||
// 主账户名称
|
||||
String masterAccountName = row.getCell(1).getStringCellValue();
|
||||
if(StringUtils.isEmpty(masterAccountName)){
|
||||
return R.fail("主账户名称不能为空");
|
||||
}
|
||||
zhDataMap.put("masterAccountName",masterAccountName);
|
||||
continue;
|
||||
}else if(row.getRowNum() == 3 || row.getRowNum() == 5 || row.getRowNum() == 6 || (row.getRowNum() > 8 && row.getRowNum() <= 12)){
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
if (row.getRowNum() < 5) continue;
|
||||
}
|
||||
break;
|
||||
case "CCBWagesDetailsBean":
|
||||
if (row.getRowNum() < 1) continue;
|
||||
|
|
@ -353,59 +426,85 @@ public class ImportNoPhotoExcelHelper {
|
|||
case "WagesDetailsBean":
|
||||
int dynamicColumnCount = row.getLastCellNum();
|
||||
setExcleTString(dynamicColumnCount, row, 0);
|
||||
if (row.getCell(0) != null)
|
||||
obj.put("zh", row.getCell(0).getStringCellValue());
|
||||
if (row.getCell(1) != null)
|
||||
obj.put("hm", row.getCell(1).getStringCellValue());
|
||||
if (row.getCell(2) != null)
|
||||
obj.put("je", row.getCell(2).getStringCellValue());
|
||||
if (row.getCell(3) != null)
|
||||
obj.put("sjdkje", row.getCell(3).getStringCellValue());
|
||||
if (row.getCell(4) != null)
|
||||
obj.put("zt", row.getCell(4).getStringCellValue());
|
||||
if (row.getCell(5) != null)
|
||||
obj.put("zs", row.getCell(5).getStringCellValue());
|
||||
if (row.getCell(6) != null)
|
||||
obj.put("ckh", row.getCell(6).getStringCellValue());
|
||||
if (row.getCell(7) != null)
|
||||
obj.put("ts", row.getCell(7).getStringCellValue());
|
||||
if (row.getCell(8) != null)
|
||||
obj.put("khh", row.getCell(8).getStringCellValue());
|
||||
if (row.getCell(9) != null)
|
||||
obj.put("khd", row.getCell(9).getStringCellValue());
|
||||
if (row.getCell(10) != null)
|
||||
obj.put("jbr", row.getCell(10).getStringCellValue());
|
||||
if (row.getCell(11) != null)
|
||||
obj.put("qwr", row.getCell(11).getStringCellValue());
|
||||
if (row.getCell(12) != null)
|
||||
obj.put("sfkzhm", row.getCell(12).getStringCellValue());
|
||||
if (row.getCell(13) != null)
|
||||
obj.put("sfkzh", row.getCell(13).getStringCellValue());
|
||||
if (row.getCell(14) != null)
|
||||
obj.put("yt", row.getCell(14).getStringCellValue());
|
||||
if (row.getCell(15) != null)
|
||||
obj.put("ywckh", row.getCell(15).getStringCellValue());
|
||||
if (row.getCell(16) != null)
|
||||
obj.put("lx", row.getCell(16).getStringCellValue());
|
||||
if (row.getCell(17) != null)
|
||||
obj.put("qdbz", row.getCell(17).getStringCellValue());
|
||||
if(!isNewModel){
|
||||
if (row.getCell(0) != null)
|
||||
obj.put("zh", row.getCell(0).getStringCellValue());
|
||||
if (row.getCell(1) != null)
|
||||
obj.put("hm", row.getCell(1).getStringCellValue());
|
||||
if (row.getCell(2) != null)
|
||||
obj.put("je", row.getCell(2).getStringCellValue());
|
||||
if (row.getCell(3) != null)
|
||||
obj.put("sjdkje", row.getCell(3).getStringCellValue());
|
||||
if (row.getCell(4) != null)
|
||||
obj.put("zt", row.getCell(4).getStringCellValue());
|
||||
if (row.getCell(5) != null)
|
||||
obj.put("zs", row.getCell(5).getStringCellValue());
|
||||
if (row.getCell(6) != null)
|
||||
obj.put("ckh", row.getCell(6).getStringCellValue());
|
||||
if (row.getCell(7) != null)
|
||||
obj.put("ts", row.getCell(7).getStringCellValue());
|
||||
if (row.getCell(8) != null)
|
||||
obj.put("khh", row.getCell(8).getStringCellValue());
|
||||
if (row.getCell(9) != null)
|
||||
obj.put("khd", row.getCell(9).getStringCellValue());
|
||||
if (row.getCell(10) != null)
|
||||
obj.put("jbr", row.getCell(10).getStringCellValue());
|
||||
if (row.getCell(11) != null)
|
||||
obj.put("qwr", row.getCell(11).getStringCellValue());
|
||||
if (row.getCell(12) != null)
|
||||
obj.put("sfkzhm", row.getCell(12).getStringCellValue());
|
||||
if (row.getCell(13) != null)
|
||||
obj.put("sfkzh", row.getCell(13).getStringCellValue());
|
||||
if (row.getCell(14) != null)
|
||||
obj.put("yt", row.getCell(14).getStringCellValue());
|
||||
if (row.getCell(15) != null)
|
||||
obj.put("ywckh", row.getCell(15).getStringCellValue());
|
||||
if (row.getCell(16) != null)
|
||||
obj.put("lx", row.getCell(16).getStringCellValue());
|
||||
if (row.getCell(17) != null)
|
||||
obj.put("qdbz", row.getCell(17).getStringCellValue());
|
||||
// if (row.getCell(18) != null)
|
||||
// obj.put("hnbz", row.getCell(18).getStringCellValue());
|
||||
// 处理第18列之后的所有列
|
||||
StringBuilder additionalData = new StringBuilder();
|
||||
for (int i = 18; i < dynamicColumnCount; i++) {
|
||||
Cell cell = row.getCell(i);
|
||||
if (cell != null) {
|
||||
String columnName = sheet.getRow(5).getCell(i).getStringCellValue();
|
||||
String cellValue = cell.getStringCellValue();
|
||||
if (additionalData.length() > 0) {
|
||||
additionalData.append("; ");
|
||||
// 处理第18列之后的所有列
|
||||
StringBuilder additionalData = new StringBuilder();
|
||||
for (int i = 18; i < dynamicColumnCount; i++) {
|
||||
Cell cell = row.getCell(i);
|
||||
if (cell != null) {
|
||||
String columnName = sheet.getRow(5).getCell(i).getStringCellValue();
|
||||
String cellValue = cell.getStringCellValue();
|
||||
if (additionalData.length() > 0) {
|
||||
additionalData.append("; ");
|
||||
}
|
||||
additionalData.append(columnName).append(": ").append(cellValue);
|
||||
}
|
||||
additionalData.append(columnName).append(": ").append(cellValue);
|
||||
}
|
||||
}
|
||||
if (additionalData.length() > 0) {
|
||||
obj.put("additionalData", additionalData.toString());
|
||||
if (additionalData.length() > 0) {
|
||||
obj.put("additionalData", additionalData.toString());
|
||||
}
|
||||
}else{
|
||||
if (row.getCell(0) != null) // 员工姓名
|
||||
obj.put("hm", row.getCell(0).getStringCellValue());
|
||||
if (row.getCell(1) != null) // 个人账号
|
||||
obj.put("zh", row.getCell(1).getStringCellValue());
|
||||
if (row.getCell(2) != null) // 开户行
|
||||
obj.put("khh", row.getCell(2).getStringCellValue());
|
||||
if (row.getCell(3) != null) // 代发金额(元)
|
||||
obj.put("je", row.getCell(3).getStringCellValue());
|
||||
if (row.getCell(4) != null) // 代发状态
|
||||
obj.put("zt", row.getCell(4).getStringCellValue());
|
||||
if (row.getCell(5) != null) // 失败原因
|
||||
obj.put("ts", row.getCell(5).getStringCellValue());
|
||||
if (row.getCell(6) != null) // 备注
|
||||
obj.put("additionalData", row.getCell(6).getStringCellValue());
|
||||
obj.put("zs", "网上代发代扣");
|
||||
obj.put("jbr", zhDataMap.get("applyDate"));
|
||||
obj.put("qwr", zhDataMap.get("applyDate"));
|
||||
obj.put("sfkzhm", zhDataMap.get("masterAccountName"));
|
||||
obj.put("sfkzh", zhDataMap.get("mainNumber"));
|
||||
obj.put("yt", zhDataMap.get("batchSummary"));
|
||||
obj.put("ywckh", zhDataMap.get("serviceReferenceNumber"));
|
||||
obj.put("lx", "代发其他");
|
||||
obj.put("qdbz", "超网代发");
|
||||
}
|
||||
break;
|
||||
case "CCBWagesDetailsBean":
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -48,6 +48,7 @@
|
|||
<div class="layui-inline" style="float: right;">
|
||||
<button type="button" class="layui-btn" onclick="downloadVoucher()">下载凭证模板</button>
|
||||
<button type="button" class="layui-btn" onclick="downloadWages()">下载工资册模板</button>
|
||||
<button type="button" class="layui-btn" onclick="downloadNewWages()">下载工资册模板(新)</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -190,6 +191,13 @@
|
|||
function downloadWages() {
|
||||
window.open(ctxPath + "/download/download?filename=招商银行工资导入模板.xlsx")
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载工资册模板(新)
|
||||
* */
|
||||
function downloadNewWages() {
|
||||
window.open(ctxPath + "/download/download?filename=zh_model.xlsx")
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue