Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -646,5 +646,28 @@ public class DateUtils extends PropertyEditorSupport {
|
||||
calendar.setTime(getDate());
|
||||
return calendar.get(Calendar.YEAR);
|
||||
}
|
||||
/**
|
||||
* @Description 校验日期格式
|
||||
* @Author lqt
|
||||
* @Date 2021/7/8
|
||||
* @Param str
|
||||
* @Return
|
||||
* @Exception
|
||||
*/
|
||||
public static boolean isValidDate(String str) {
|
||||
boolean convertSuccess=true;
|
||||
if(str.length() != 10){
|
||||
return false;
|
||||
}
|
||||
// 指定日期格式为四位年/两位月份/两位日期,注意yyyy/MM/dd区分大小写;
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
format.setLenient(false);
|
||||
format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
convertSuccess = false;
|
||||
}
|
||||
return convertSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -1,5 +1,8 @@
|
||||
package com.jero.contract.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class PayIncomeContractCommon {
|
||||
/**
|
||||
* 合同状态(1:草稿,2:待审核,3:已通过,4:未通过,5:已存档)
|
||||
@@ -29,6 +32,18 @@ public class PayIncomeContractCommon {
|
||||
* 是否打包(1:是,0:否)
|
||||
*/
|
||||
public final static Integer PACK0 = 0;
|
||||
/**
|
||||
* 账款状态(1:未支付,2:部分支付,3:已付全款)
|
||||
*/
|
||||
public final static Integer ACCOUNT_STATUS1 = 1;
|
||||
/**
|
||||
* 账款状态(1:未支付,2:部分支付,3:已付全款)
|
||||
*/
|
||||
public final static Integer ACCOUNT_STATUS2 = 2;
|
||||
/**
|
||||
* 账款状态(1:未支付,2:部分支付,3:已付全款)
|
||||
*/
|
||||
public final static Integer ACCOUNT_STATUS3 = 3;
|
||||
/**
|
||||
* 项目类型(1:普通项目,2:工作组项目,3:会议项目,4:会员项目,5:标协会员项目)
|
||||
*/
|
||||
@@ -49,5 +64,15 @@ public class PayIncomeContractCommon {
|
||||
* 项目类型(1:普通项目,2:工作组项目,3:会议项目,4:会员项目,5:标协会员项目)
|
||||
*/
|
||||
public final static String PROJECT_TYPE5 = "5";
|
||||
/**
|
||||
* 支出合同excel表头
|
||||
*/
|
||||
public final static List<String> LIST_SPENDING_CONTRACT = Arrays.asList("合同编号","合同名称","签订单位名称","签订单位联系人","是否开口","负责人",
|
||||
"签订合同总金额","税率","未税金额","合同签订日期","合同终止日期","合同约定主要时点",
|
||||
"应收金额","已收金额","合同约定付款次数","是否打包","打包年份");
|
||||
/**
|
||||
* 支出合同分期信息excel 表头
|
||||
*/
|
||||
public final static List<String> LIST_SPENDING_CONTRACT_INSTALLMENT = Arrays.asList("阶段","期应收","期应收时间","期实收","期实收时间");
|
||||
|
||||
}
|
||||
|
||||
+5
-4
@@ -26,6 +26,7 @@ import com.jero.contract.service.IPayIncomeContractInstallmentService;
|
||||
import com.jero.contract.service.IPayIncomeContractService;
|
||||
import com.jero.contract.vo.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
@@ -142,7 +143,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
|
||||
return Result.OK("合同编号存在!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("普通项目管理-验证合同编号是否存在异常",e);
|
||||
log.error("收入合同-验证合同编号是否存在异常",e);
|
||||
return Result.OK("合同编号存在!");
|
||||
}
|
||||
return Result.error("合同编号不存在!");
|
||||
@@ -167,7 +168,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
|
||||
return Result.OK("合同名称存在!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("普通项目管理-验证合同编号是否存在异常",e);
|
||||
log.error("收入合同-验证合同编号是否存在异常",e);
|
||||
return Result.OK("合同名称存在!");
|
||||
}
|
||||
return Result.error("合同名称不存在!");
|
||||
@@ -193,7 +194,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
|
||||
return Result.OK("可以操作!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("普通项目管理-通过id查询该项目是否关联了合同异常",e);
|
||||
log.error("收入合同-通过id查询该项目是否关联了合同异常",e);
|
||||
return Result.error("已关联合同不可操作!");
|
||||
}
|
||||
return Result.error("已关联合同不可操作!");
|
||||
@@ -496,8 +497,8 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
|
||||
filedsList.add(new ExcelExportEntity("应收金额", "accountsReceivableAmount"));
|
||||
filedsList.add(new ExcelExportEntity("已收金额", "amountReceived"));
|
||||
filedsList.add(new ExcelExportEntity("未收金额", "outstandingAmount"));
|
||||
filedsList.add(new ExcelExportEntity("账款状态", "accountStatus"));
|
||||
filedsList.add(new ExcelExportEntity("合同约定付款次数", "contractPaymentTimes"));
|
||||
filedsList.add(new ExcelExportEntity("账款状态", "accountStatus"));
|
||||
filedsList.add(new ExcelExportEntity("是否打包", "pack"));
|
||||
filedsList.add(new ExcelExportEntity("打包年份", "packYear"));
|
||||
int count = mapCount.get("count");
|
||||
|
||||
+28
-255
@@ -1,14 +1,7 @@
|
||||
package com.jero.contract.controller;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -35,8 +28,6 @@ import com.jero.contract.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.jeecgframework.poi.excel.def.MapExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
|
||||
@@ -45,8 +36,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -129,7 +118,31 @@ public class PaySpendingContractController extends JeroController<PaySpendingCon
|
||||
paySpendingContractService.editPayIncomeContractInput(input);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证合同编号是否存在
|
||||
*
|
||||
* @param contractNum 合同编号
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="收入合同-验证合同编号是否存在", notes="收入合同-验证合同编号是否存在")
|
||||
@GetMapping(value = "/getContractNum")
|
||||
public Result<?> getContractNum(@RequestParam(name="contractNum") String contractNum) {
|
||||
if(StringUtils.isBlank(contractNum)){
|
||||
return Result.error("合同编号不能为空!");
|
||||
}
|
||||
try {
|
||||
LambdaQueryWrapper<PaySpendingContract> query = new LambdaQueryWrapper<>();
|
||||
query.eq(PaySpendingContract::getContractNum,contractNum);
|
||||
PaySpendingContract paySpendingContract = paySpendingContractService.getOne(query);
|
||||
if(!Objects.isNull(paySpendingContract)){
|
||||
return Result.OK("合同编号存在!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("支出合同-验证合同编号是否存在异常",e);
|
||||
return Result.OK("合同编号存在!");
|
||||
}
|
||||
return Result.error("合同编号不存在!");
|
||||
}
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
@@ -212,7 +225,7 @@ public class PaySpendingContractController extends JeroController<PaySpendingCon
|
||||
@ApiOperation(value="支出合同-模板下载", notes="支出合同-模板下载")
|
||||
@GetMapping(value = "/downloadExcelModel")
|
||||
public ModelAndView downloadExcelModel() {
|
||||
return super.exportTemplate(PaySpendingContractExcel.class,"支出合同导入模板");
|
||||
return super.exportTemplate(PaySpendingContractExcelModel.class,"支出合同导入模板");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,6 +311,7 @@ public class PaySpendingContractController extends JeroController<PaySpendingCon
|
||||
filedsList.add(new ExcelExportEntity("已收金额", "amountReceived"));
|
||||
filedsList.add(new ExcelExportEntity("未收金额", "outstandingAmount"));
|
||||
filedsList.add(new ExcelExportEntity("账款状态", "accountStatus"));
|
||||
filedsList.add(new ExcelExportEntity("合同约定付款次数", "contractPaymentTimes"));
|
||||
filedsList.add(new ExcelExportEntity("是否打包", "pack"));
|
||||
filedsList.add(new ExcelExportEntity("打包年份", "packYear"));
|
||||
int count = mapCount.get("count");
|
||||
@@ -334,248 +348,7 @@ public class PaySpendingContractController extends JeroController<PaySpendingCon
|
||||
@ApiOperation(value="支出合同-通过excel导入数据", notes="支出合同-通过excel导入数据")
|
||||
@Transactional
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
List<Map<Integer, String>> list = read(file);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
List<String> listSpendingContract = Arrays.asList("合同编号","合同名称","签订单位名称","签订单位联系人","是否开口","负责人",
|
||||
"部门名称","签订合同总金额","税率","未税金额","合同签订日期","合同终止日期","合同约定主要时点",
|
||||
"应收金额","已收金额","未收金额","账款状态","合同约定付款次数","是否打包","打包年份");
|
||||
List<String> listSpendingContractInstallment = Arrays.asList("阶段","期应收","期应收时间","期实收","期实收时间");
|
||||
// 校验表头
|
||||
Map<Integer, String> map = list.get(1);
|
||||
if(!Objects.isNull(map)){
|
||||
int count = map.size();
|
||||
// 合同信息字段为20个,分期信息为5个
|
||||
if(count < 20){
|
||||
throw new JeroBootException("excel表头错误!");
|
||||
}else {
|
||||
listSpendingContract.forEach(p->{
|
||||
if(!Objects.equals(map.get(listSpendingContract.indexOf(p)),p)){
|
||||
throw new JeroBootException("excel表头错误!");
|
||||
}
|
||||
});
|
||||
int count1 = count - 20;
|
||||
if(count1 != 0){
|
||||
Pattern p = Pattern.compile("[0-9]*");
|
||||
Matcher m = p.matcher(String.valueOf(count1 / 5));
|
||||
if (!m.matches()){
|
||||
throw new JeroBootException("excel表头错误!");
|
||||
}
|
||||
int count2 = count1/5;
|
||||
for (int i = 1; i <= count2; i++) {
|
||||
int finalI = i;
|
||||
listSpendingContractInstallment.forEach(item->{
|
||||
int n = listSpendingContractInstallment.indexOf(item) + 1;
|
||||
if(Objects.equals((n + 1) + item,map.get(20 + finalI * n))){
|
||||
throw new JeroBootException("excel表头错误!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, String> mapOpening = sysBaseAPI.queryDictItemsMapByCode("yn");
|
||||
Map<String, String> mapAccountStatus = sysBaseAPI.queryDictItemsMapByCode("revenue_contract_account_status");
|
||||
Map<String, String> mapPack = sysBaseAPI.queryDictItemsMapByCode("yn");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
list.forEach(sub->{
|
||||
int count = sub.size();
|
||||
int n = list.indexOf(sub);
|
||||
if(n < 2){
|
||||
return;
|
||||
}
|
||||
|
||||
if(count < 20){
|
||||
sb.append("第").append(n + 1).append("行,excel数据错误!");
|
||||
}else {
|
||||
PaySpendingContract paySpendingContract = setPaySpendingContract(sub,mapOpening,mapAccountStatus,mapPack,n,sb);
|
||||
paySpendingContractService.save(paySpendingContract);
|
||||
int count1 = count - 20;
|
||||
if(count > 0){
|
||||
Pattern p = Pattern.compile("[0-9]*");
|
||||
Matcher m = p.matcher(String.valueOf(count1 / 5));
|
||||
if (!m.matches()){
|
||||
throw new JeroBootException("excel数据错误!");
|
||||
}
|
||||
int count2 = count1/5;
|
||||
List<PaySpendingContractInstallment> listPaySpendingContractInstallment = new ArrayList<>();
|
||||
for (int i = 0; i < count2; i++) {
|
||||
PaySpendingContractInstallment paySpendingContractInstallment = new PaySpendingContractInstallment();
|
||||
paySpendingContractInstallment.setContractId(paySpendingContract.getId());
|
||||
paySpendingContractInstallment.setPhaseName(sub.get(20 + (i * 5) + 0));
|
||||
paySpendingContractInstallment.setAccountsReceivableAmount(new BigDecimal(sub.get(20 + (i * 5) + 1)));
|
||||
paySpendingContractInstallment.setAccountsReceivableTime(DateUtils.str2Date(sub.get(20 + (i * 5) + 2),new SimpleDateFormat("yyyy-MM-dd")));
|
||||
paySpendingContractInstallment.setPaidAmount(new BigDecimal(sub.get(20 + (i * 5) + 3)));
|
||||
paySpendingContractInstallment.setPaidTime(DateUtils.str2Date(sub.get(20 + (i * 5) + 4),new SimpleDateFormat("yyyy-MM-dd")));
|
||||
listPaySpendingContractInstallment.add(paySpendingContractInstallment);
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(listPaySpendingContractInstallment)){
|
||||
|
||||
}
|
||||
paySpendingContractInstallmentService.saveBatch(listPaySpendingContractInstallment);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
paySpendingContractService.importExcel(request);
|
||||
return Result.OK("文件导入成功!");
|
||||
}
|
||||
|
||||
private PaySpendingContract setPaySpendingContract(Map<Integer,String> map,Map<String, String> mapOpening,
|
||||
Map<String, String> mapAccountStatus,Map<String, String> mapPack,
|
||||
int n,StringBuilder sb){
|
||||
PaySpendingContract paySpendingContract = new PaySpendingContract();
|
||||
paySpendingContract.setContractNum(map.get(0));
|
||||
paySpendingContract.setContractName(map.get(1));
|
||||
paySpendingContract.setSignedCompanyTemporaryName(map.get(2));
|
||||
paySpendingContract.setSignedContactsTemporaryName(map.get(3));
|
||||
AtomicBoolean opening = new AtomicBoolean(false);
|
||||
mapOpening.forEach((k,v)->{
|
||||
if(Objects.equals(map.get(4),v)){
|
||||
opening.set(true);
|
||||
paySpendingContract.setOpening(Integer.parseInt(k));
|
||||
}
|
||||
});
|
||||
if(!opening.get()){
|
||||
sb.append("第").append(n + 1).append("行,是否开口错误!");
|
||||
}
|
||||
paySpendingContract.setPrincipalName(map.get(5));
|
||||
paySpendingContract.setDepartmentName(map.get(6));
|
||||
paySpendingContract.setContractAmount(map.get(7));
|
||||
paySpendingContract.setRate(new BigDecimal(map.get(8)));
|
||||
paySpendingContract.setNoTaxAmount(new BigDecimal(map.get(9)));
|
||||
paySpendingContract.setContractDate(DateUtils.str2Date(map.get(10),new SimpleDateFormat("yyyy-MM-dd")));
|
||||
paySpendingContract.setTerminationDate(DateUtils.str2Date(map.get(10),new SimpleDateFormat("yyyy-MM-dd")));
|
||||
paySpendingContract.setContractTimePoints(map.get(12));
|
||||
paySpendingContract.setAccountsReceivableAmount(new BigDecimal(map.get(13)));
|
||||
paySpendingContract.setAmountReceived(new BigDecimal(map.get(14)));
|
||||
paySpendingContract.setOutstandingAmount(new BigDecimal(map.get(15)));
|
||||
AtomicBoolean accountStatus = new AtomicBoolean(false);
|
||||
mapAccountStatus.forEach((k,v)->{
|
||||
if(Objects.equals(map.get(16),v)){
|
||||
accountStatus.set(true);
|
||||
paySpendingContract.setAccountStatus(Integer.parseInt(k));
|
||||
}
|
||||
});
|
||||
if(!accountStatus.get()){
|
||||
sb.append("第").append(n + 1).append("行,账款状态错误!");
|
||||
}
|
||||
paySpendingContract.setContractPaymentTimes(map.get(17));
|
||||
AtomicBoolean pack = new AtomicBoolean(false);
|
||||
mapPack.forEach((k,v)->{
|
||||
if(Objects.equals(map.get(18),v)){
|
||||
pack.set(true);
|
||||
paySpendingContract.setPack(Integer.parseInt(k));
|
||||
}
|
||||
});
|
||||
if(!pack.get()){
|
||||
sb.append("第").append(n + 1).append("行,是否打包错误!");
|
||||
}
|
||||
paySpendingContract.setPackYear(map.get(19));
|
||||
return paySpendingContract;
|
||||
}
|
||||
|
||||
/** 导入excel表格,返回的List<Map<Integer, String>>数据结构.
|
||||
* @param
|
||||
* @return 返回list集合
|
||||
* @throws Exception
|
||||
*/
|
||||
private List<Map<Integer, String>> read(MultipartFile file) {
|
||||
//最终返回数据
|
||||
List<Map<Integer, String>> list = new ArrayList<>();
|
||||
try{
|
||||
Workbook workbook = null;
|
||||
InputStream is = file.getInputStream();
|
||||
String name = file.getOriginalFilename().toLowerCase();
|
||||
// 创建excel操作对象
|
||||
if (name.contains(".xlsx") || name.contains(".xls")) {
|
||||
workbook = WorkbookFactory.create(is);
|
||||
}
|
||||
//得到一个工作表
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
//获得数据的总行数
|
||||
int totalRowNum = sheet.getLastRowNum();
|
||||
|
||||
//获得总列数
|
||||
int cellLength = sheet.getRow(0).getPhysicalNumberOfCells();
|
||||
Map<Integer, String> map = null;
|
||||
//获得所有数据
|
||||
//从第x行开始获取
|
||||
for(int x = 0 ; x <= totalRowNum ; x++){
|
||||
map = new HashMap<>();
|
||||
//获得第i行对象
|
||||
Row row = sheet.getRow(x);
|
||||
//如果一行里的所有单元格都为空则不放进list里面
|
||||
int a = 0;
|
||||
for(int y=0;y<cellLength;y++){
|
||||
if (!(row==null)) {
|
||||
Cell cell = row.getCell(y);
|
||||
if (cell == null) {
|
||||
map.put(y, "");
|
||||
} else {
|
||||
map.put(y,getXCellVal(cell));
|
||||
}
|
||||
if (map.get(y) == null || "".equals(map.get(y))) {
|
||||
a++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(a!=cellLength && row!=null){
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cell
|
||||
* @return String
|
||||
* 获取单元格中的值
|
||||
*/
|
||||
|
||||
private String getXCellVal(Cell cell) {
|
||||
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
|
||||
DecimalFormat df = new DecimalFormat("0.0000");
|
||||
String val = "";
|
||||
switch (cell.getCellType()) {
|
||||
case XSSFCell.CELL_TYPE_NUMERIC:
|
||||
if (DateUtil.isCellDateFormatted(cell)) {
|
||||
val = fmt.format(cell.getDateCellValue()); //日期型
|
||||
} else {
|
||||
val = df.format(cell.getNumericCellValue()); //数字型
|
||||
// 去掉多余的0,如最后一位是.则去掉
|
||||
val = val.replaceAll("0+?$", "").replaceAll("[.]$","");
|
||||
}
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_STRING: //文本类型
|
||||
val = cell.getStringCellValue();
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_BOOLEAN: //布尔型
|
||||
val = String.valueOf(cell.getBooleanCellValue());
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_BLANK: //空白
|
||||
val = cell.getStringCellValue();
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_ERROR: //错误
|
||||
val = "";
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_FORMULA: //公式
|
||||
try {
|
||||
val = String.valueOf(cell.getStringCellValue());
|
||||
} catch (IllegalStateException e) {
|
||||
val = String.valueOf(cell.getNumericCellValue());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
val = cell.getRichStringCellValue() == null ? null : cell.getRichStringCellValue().toString();
|
||||
}
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -175,6 +175,7 @@ public class PayIncomeContract implements Serializable {
|
||||
/**是否打包(1:是,2:否)*/
|
||||
@Excel(name = "是否打包(1:是,2:否)", width = 15)
|
||||
@ApiModelProperty(value = "是否打包(1:是,2:否)")
|
||||
@NotNull(message = "是否打包不能为空")
|
||||
@Dict(dicCode = "yn")
|
||||
private java.lang.Integer pack;
|
||||
/**打包年份*/
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,7 @@ public class PayIncomeContractInstallment implements Serializable {
|
||||
/**应收金额*/
|
||||
@Excel(name = "应收金额", width = 15)
|
||||
@ApiModelProperty(value = "应收金额")
|
||||
@NotEmpty(message = "应收金额不能为空")
|
||||
@NotNull(message = "应收金额不能为空")
|
||||
@Max(value = 999999999,message = "应收金额格式错误")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal accountsReceivableAmount;
|
||||
|
||||
+26
-1
@@ -6,6 +6,7 @@ import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@@ -15,6 +16,11 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* @Description: pay_spending_contract
|
||||
* @Author: jeecg-boot
|
||||
@@ -36,10 +42,14 @@ public class PaySpendingContract implements Serializable {
|
||||
/**合同编号*/
|
||||
@Excel(name = "合同编号", width = 15)
|
||||
@ApiModelProperty(value = "合同编号")
|
||||
@NotEmpty(message = "合同编号不能为空!")
|
||||
@Size(max = 50, message = "合同编号长度不能大于50个字符")
|
||||
private String contractNum;
|
||||
/**合同名称*/
|
||||
@Excel(name = "合同名称", width = 15)
|
||||
@ApiModelProperty(value = "合同名称")
|
||||
@NotEmpty(message = "合同名称不能为空!")
|
||||
@Size(max = 50, message = "合同名称长度不能大于50个字符")
|
||||
private String contractName;
|
||||
/**签订单位id*/
|
||||
@Excel(name = "签订单位id", width = 15)
|
||||
@@ -52,6 +62,7 @@ public class PaySpendingContract implements Serializable {
|
||||
/**临时签订单位名称*/
|
||||
@Excel(name = "临时签订单位名称", width = 15)
|
||||
@ApiModelProperty(value = "临时签订单位名称")
|
||||
@Size(max = 50, message = "签订单位名称长度不能大于50个字符")
|
||||
private String signedCompanyTemporaryName;
|
||||
/**签订单位联系人id*/
|
||||
@Excel(name = "签订单位联系人id", width = 15)
|
||||
@@ -64,10 +75,12 @@ public class PaySpendingContract implements Serializable {
|
||||
/**临时签订单位联系人名称*/
|
||||
@Excel(name = "临时签订单位联系人名称", width = 15)
|
||||
@ApiModelProperty(value = "临时签订单位联系人名称")
|
||||
@Size(max = 50, message = "签订单位联系人名称长度不能大于50个字符")
|
||||
private String signedContactsTemporaryName;
|
||||
/**是否开口(1:是,0:否)*/
|
||||
@Excel(name = "是否开口(1:是,0:否)", width = 15)
|
||||
@ApiModelProperty(value = "是否开口(1:是,0:否)")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer opening;
|
||||
/**负责人id*/
|
||||
@Excel(name = "负责人id", width = 15)
|
||||
@@ -76,23 +89,30 @@ public class PaySpendingContract implements Serializable {
|
||||
/**负责人名称*/
|
||||
@Excel(name = "负责人名称", width = 15)
|
||||
@ApiModelProperty(value = "负责人名称")
|
||||
@Size(max = 50, message = "负责人名称长度不能大于50个字符")
|
||||
private String principalName;
|
||||
/**部门名称*/
|
||||
@Excel(name = "部门名称", width = 15)
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
@Size(max = 50, message = "部门名称长度不能大于50个字符")
|
||||
private String departmentName;
|
||||
/**签订合同总金额*/
|
||||
@Excel(name = "签订合同总金额", width = 15)
|
||||
@ApiModelProperty(value = "签订合同总金额")
|
||||
private String contractAmount;
|
||||
@NotNull(message = "签订合同金额不能为空!")
|
||||
@Max(value = 999999999,message = "签订合同金额格式错误")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal contractAmount;
|
||||
/**税率*/
|
||||
@Excel(name = "税率", width = 15)
|
||||
@ApiModelProperty(value = "税率")
|
||||
@NotNull(message = "税率不能为空!")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal rate;
|
||||
/**未税金额*/
|
||||
@Excel(name = "未税金额", width = 15)
|
||||
@ApiModelProperty(value = "未税金额")
|
||||
@NotNull(message = "未税金额不能为空!")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal noTaxAmount;
|
||||
/**合同签订日期*/
|
||||
@@ -114,11 +134,13 @@ public class PaySpendingContract implements Serializable {
|
||||
/**应收金额*/
|
||||
@Excel(name = "应收金额", width = 15)
|
||||
@ApiModelProperty(value = "应收金额")
|
||||
@NotNull(message = "应收金额不能为空!")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal accountsReceivableAmount;
|
||||
/**已收金额*/
|
||||
@Excel(name = "已收金额", width = 15)
|
||||
@ApiModelProperty(value = "已收金额")
|
||||
@NotNull(message = "已收金额不能为空!")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal amountReceived;
|
||||
/**未收金额*/
|
||||
@@ -129,6 +151,7 @@ public class PaySpendingContract implements Serializable {
|
||||
/**账款状态(1:未支付,2:部分支付,3:已付全款)*/
|
||||
@Excel(name = "账款状态(1:未支付,2:部分支付,3:已付全款)", width = 15)
|
||||
@ApiModelProperty(value = "账款状态(1:未支付,2:部分支付,3:已付全款)")
|
||||
@Dict(dicCode = "revenue_contract_account_status")
|
||||
private Integer accountStatus;
|
||||
/**合同约定付款次数*/
|
||||
@Excel(name = "合同约定付款次数", width = 15)
|
||||
@@ -137,6 +160,8 @@ public class PaySpendingContract implements Serializable {
|
||||
/**是否打包(1:是,0:否)*/
|
||||
@Excel(name = "是否打包(1:是,0:否)", width = 15)
|
||||
@ApiModelProperty(value = "是否打包(1:是,0:否)")
|
||||
@NotNull(message = "是否打包不能为空")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer pack;
|
||||
/**打包年份*/
|
||||
@Excel(name = "打包年份", width = 15)
|
||||
|
||||
+6
-1
@@ -16,6 +16,8 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
@@ -44,11 +46,13 @@ public class PaySpendingContractInstallment implements Serializable {
|
||||
/**阶段名称*/
|
||||
@Excel(name = "阶段名称", width = 15)
|
||||
@ApiModelProperty(value = "阶段名称")
|
||||
@Size(max = 50, message = "阶段名称长度不能大于50个字符")
|
||||
@NotEmpty(message = "阶段长度不能为空")
|
||||
@Size(max = 50, message = "阶段长度不能大于50个字符")
|
||||
private String phaseName;
|
||||
/**应收金额*/
|
||||
@Excel(name = "应收金额", width = 15)
|
||||
@ApiModelProperty(value = "应收金额")
|
||||
@NotNull(message = "应收金额不能为空")
|
||||
@Max(value = 999999999,message = "应收金额格式错误")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal accountsReceivableAmount;
|
||||
@@ -61,6 +65,7 @@ public class PaySpendingContractInstallment implements Serializable {
|
||||
/**实收金额*/
|
||||
@Excel(name = "实收金额", width = 15)
|
||||
@ApiModelProperty(value = "实收金额")
|
||||
@NotNull(message = "实收金额不能为空")
|
||||
@Max(value = 999999999,message = "应收金额格式错误")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal paidAmount;
|
||||
|
||||
+10
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.contract.entity.PaySpendingContract;
|
||||
import com.jero.contract.vo.PaySpendingContractInput;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -61,4 +62,13 @@ public interface IPaySpendingContractService extends IService<PaySpendingContrac
|
||||
* @Exception
|
||||
*/
|
||||
void deleteSpendingContractInputByIds(List<String> ids);
|
||||
/**
|
||||
* @Description 通过excel导入数据
|
||||
* @Author lqt
|
||||
* @Date 2021/9/9
|
||||
* @Param
|
||||
* @Return
|
||||
* @Exception
|
||||
*/
|
||||
void importExcel(HttpServletRequest req);
|
||||
}
|
||||
|
||||
+480
-4
@@ -6,7 +6,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.util.DateUtils;
|
||||
import com.jero.common.util.ValidUtil;
|
||||
import com.jero.company.entity.PayCompanyManagement;
|
||||
import com.jero.company.entity.PayContactsManagement;
|
||||
import com.jero.company.service.IPayCompanyManagementService;
|
||||
import com.jero.company.service.IPayContactsManagementService;
|
||||
import com.jero.contract.common.PayIncomeContractCommon;
|
||||
import com.jero.contract.entity.PayIncomeContract;
|
||||
import com.jero.contract.entity.PayIncomeContractInstallment;
|
||||
@@ -15,8 +21,11 @@ import com.jero.contract.entity.PaySpendingContractInstallment;
|
||||
import com.jero.contract.mapper.PaySpendingContractMapper;
|
||||
import com.jero.contract.service.IPaySpendingContractInstallmentService;
|
||||
import com.jero.contract.service.IPaySpendingContractService;
|
||||
import com.jero.contract.vo.PaySpendingContractImportExcel;
|
||||
import com.jero.contract.vo.PaySpendingContractInput;
|
||||
import com.jero.modules.system.entity.SysDepart;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import com.jero.temporary.entity.PayCompanyManagementTemporary;
|
||||
import com.jero.temporary.entity.PayContactsManagementTemporary;
|
||||
@@ -25,13 +34,25 @@ import com.jero.temporary.service.IPayContactsManagementTemporaryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -54,9 +75,16 @@ public class PaySpendingContractServiceImpl extends ServiceImpl<PaySpendingContr
|
||||
private IPayContactsManagementTemporaryService payContactsManagementTemporaryService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Resource
|
||||
private PaySpendingContractMapper paySpendingContractMapper;
|
||||
@Autowired
|
||||
private IPayCompanyManagementService payCompanyManagementService;
|
||||
@Autowired
|
||||
private IPayContactsManagementService payContactsManagementService;
|
||||
@Autowired
|
||||
private ISysDepartService sysDepartService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -202,6 +230,454 @@ public class PaySpendingContractServiceImpl extends ServiceImpl<PaySpendingContr
|
||||
paySpendingContractInstallmentService.remove(updatePaySpendingContractInstallment);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void importExcel(HttpServletRequest req) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) req;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
List<Map<Integer, String>> list = read(file);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
List<String> listSpendingContract = PayIncomeContractCommon.LIST_SPENDING_CONTRACT;
|
||||
List<String> listSpendingContractInstallment = PayIncomeContractCommon.LIST_SPENDING_CONTRACT_INSTALLMENT;
|
||||
// 校验表头
|
||||
Map<Integer, String> map = list.get(1);
|
||||
if(!Objects.isNull(map)){
|
||||
int count = map.size();
|
||||
// 合同信息字段为20个,分期信息为5个
|
||||
if(count < 17){
|
||||
throw new JeroBootException("excel表头错误!");
|
||||
}else {
|
||||
listSpendingContract.forEach(p->{
|
||||
if(!Objects.equals(map.get(listSpendingContract.indexOf(p)),p)){
|
||||
throw new JeroBootException("excel表头错误!");
|
||||
}
|
||||
});
|
||||
int count1 = count - 17;
|
||||
if(count1 != 0){
|
||||
Pattern p = Pattern.compile("[0-9]*");
|
||||
Matcher m = p.matcher(String.valueOf(count1 / 5));
|
||||
if (!m.matches()){
|
||||
throw new JeroBootException("excel表头错误!");
|
||||
}
|
||||
int count2 = count1/5;
|
||||
for (int i = 1; i <= count2; i++) {
|
||||
int finalI = i;
|
||||
listSpendingContractInstallment.forEach(item->{
|
||||
int n = listSpendingContractInstallment.indexOf(item) + 1;
|
||||
if(Objects.equals((n + 1) + item,map.get(17 + finalI * n))){
|
||||
throw new JeroBootException("excel表头错误!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, String> mapOpening = sysBaseAPI.queryDictItemsMapByCode("yn");
|
||||
// Map<String, String> mapAccountStatus = sysBaseAPI.queryDictItemsMapByCode("revenue_contract_account_status");
|
||||
Map<String, String> mapPack = sysBaseAPI.queryDictItemsMapByCode("yn");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<PaySpendingContractImportExcel> listPaySpendingContractImportExcel = new ArrayList<>();
|
||||
list.forEach(sub->{
|
||||
int count = sub.size();
|
||||
int n = list.indexOf(sub);
|
||||
if(n < 2){
|
||||
return;
|
||||
}
|
||||
if(count < 17){
|
||||
sb.append("第").append(n + 1).append("行,excel数据错误!");
|
||||
}else {
|
||||
PaySpendingContractImportExcel paySpendingContractImportExcel = new PaySpendingContractImportExcel();
|
||||
// 获取合同信息
|
||||
PaySpendingContract paySpendingContract = setPaySpendingContractExcel(sub,mapOpening,mapPack,n + 1,sb);
|
||||
if(!Objects.isNull(paySpendingContract)){
|
||||
paySpendingContractImportExcel.setSpendingContract(paySpendingContract);
|
||||
}
|
||||
int count1 = count - 17;
|
||||
if(count > 0){
|
||||
Pattern p = Pattern.compile("[0-9]*");
|
||||
Matcher m = p.matcher(String.valueOf(count1 / 5));
|
||||
if (!m.matches()){
|
||||
throw new JeroBootException("excel数据错误!");
|
||||
}
|
||||
int count2 = count1/5;
|
||||
List<PaySpendingContractInstallment> listPaySpendingContractInstallment = new ArrayList<>();
|
||||
Pattern pattern = Pattern.compile("[0-9]*\\.?[0-9]+");
|
||||
for (int i = 0; i < count2; i++) {
|
||||
if(StringUtils.isBlank(sub.get(17 + (i * 5) + 0))){
|
||||
continue;
|
||||
}
|
||||
int mm = 17 + (i * 5);
|
||||
PaySpendingContractInstallment paySpendingContractInstallment = new PaySpendingContractInstallment();
|
||||
paySpendingContractInstallment.setPhaseName(sub.get(mm + 0));
|
||||
if(!StringUtils.isBlank(sub.get(mm + 1))){
|
||||
if(!pattern.matcher(sub.get(mm + 1)).matches()){
|
||||
sb.append("第").append(n + 1).append("行,").append(i+1).append("期应收金额格式错误!");
|
||||
}else{
|
||||
paySpendingContractInstallment.setAccountsReceivableAmount(new BigDecimal(sub.get(mm + 1)));
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(sub.get(mm + 2))){
|
||||
if(!DateUtils.isValidDate(sub.get(mm + 2))){
|
||||
sb.append("第").append(n + 1).append("行,").append(i+1).append("期应收时间日期格式不正确 <br/>");
|
||||
}else{
|
||||
paySpendingContractInstallment.setAccountsReceivableTime(DateUtils.str2Date(sub.get(mm + 2),new SimpleDateFormat("yyyy-MM-dd")));
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(sub.get(mm + 3))){
|
||||
if(!pattern.matcher(sub.get(mm + 3)).matches()){
|
||||
sb.append("第").append(n + 1).append("行,").append(i+1).append("期实收金额格式错误!");
|
||||
}else{
|
||||
paySpendingContractInstallment.setPaidAmount(new BigDecimal(sub.get(mm + 3)));
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(sub.get(mm + 4))) {
|
||||
if (!DateUtils.isValidDate(sub.get(mm + 4))) {
|
||||
sb.append("第").append(n + 1).append("行,").append(i+1).append("期实收时间日期格式不正确 <br/>");
|
||||
} else {
|
||||
paySpendingContractInstallment.setPaidTime(DateUtils.str2Date(sub.get(mm + 4), new SimpleDateFormat("yyyy-MM-dd")));
|
||||
}
|
||||
}
|
||||
listPaySpendingContractInstallment.add(paySpendingContractInstallment);
|
||||
}
|
||||
if(!Objects.isNull(paySpendingContract) && !CollectionUtils.isEmpty(listPaySpendingContractInstallment)){
|
||||
paySpendingContractImportExcel.setListInstallment(listPaySpendingContractInstallment);
|
||||
}
|
||||
if(!Objects.isNull(paySpendingContract)){
|
||||
listPaySpendingContractImportExcel.add(paySpendingContractImportExcel);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if(!StringUtils.isBlank(sb)){
|
||||
throw new JeroBootException(sb.toString());
|
||||
}
|
||||
// 校验excel
|
||||
if(!CollectionUtils.isEmpty(listPaySpendingContractImportExcel)){
|
||||
List<PaySpendingContract> listPaySpendingContractData = listPaySpendingContractImportExcel.stream().map(PaySpendingContractImportExcel::getSpendingContract).collect(Collectors.toList());
|
||||
// 获取excel合同编号
|
||||
List<String> listContractNum = listPaySpendingContractData.stream().map(PaySpendingContract::getContractNum).collect(Collectors.toList());
|
||||
// 获取数据库里 合同编号
|
||||
LambdaQueryWrapper<PaySpendingContract> queryDBContractNum = new LambdaQueryWrapper<>();
|
||||
queryDBContractNum.in(PaySpendingContract::getContractNum,listContractNum);
|
||||
List<PaySpendingContract> listDBContractNum = paySpendingContractService.list(queryDBContractNum);
|
||||
|
||||
// 获取excel签订单位
|
||||
List<String> listSignedCompanyTemporaryName = listPaySpendingContractData.stream().map(PaySpendingContract::getSignedCompanyTemporaryName).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<PayCompanyManagement> queryDBSignedCompanyTemporaryName = new LambdaQueryWrapper<>();
|
||||
queryDBSignedCompanyTemporaryName.in(PayCompanyManagement::getCompanyName,listSignedCompanyTemporaryName);
|
||||
List<PayCompanyManagement> listDBSignedCompanyTemporaryName = payCompanyManagementService.list(queryDBSignedCompanyTemporaryName);
|
||||
|
||||
// 获取excel签订单位联系人
|
||||
List<String> listSignedContactsTemporaryName = listPaySpendingContractData.stream().map(PaySpendingContract::getSignedContactsTemporaryName).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<PayContactsManagement> queryDBSignedContactsTemporaryName = new LambdaQueryWrapper<>();
|
||||
queryDBSignedContactsTemporaryName.in(PayContactsManagement::getName,listSignedContactsTemporaryName);
|
||||
List<PayContactsManagement> listDBSignedContactsTemporaryName = payContactsManagementService.list(queryDBSignedContactsTemporaryName);
|
||||
|
||||
// 获取excel负责人
|
||||
List<SysUser> listDBPrincipalName = sysUserService.list();
|
||||
|
||||
// 获取excel部门名称
|
||||
List<SysDepart> listDepartmentName = sysDepartService.list();
|
||||
|
||||
// 校验excel中是否存在重复合同编号
|
||||
List<PaySpendingContract> listPaySpendingContract = new ArrayList<>();
|
||||
listPaySpendingContractImportExcel.forEach(p->{
|
||||
int n = listPaySpendingContractImportExcel.indexOf(p);
|
||||
// 校验合同信息
|
||||
PaySpendingContract paySpendingContract = p.getSpendingContract();
|
||||
// 校验excel中是否存在重复合同编号
|
||||
List<PaySpendingContract> listPaySpendingContractNew = listPaySpendingContract.stream().filter(item->
|
||||
Objects.equals(item.getContractNum(),paySpendingContract.getContractNum())).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listPaySpendingContractNew)){
|
||||
sb.append("第").append(n + 1).append("行,合同编号在excel中重复,请修改!");
|
||||
}
|
||||
listPaySpendingContract.add(paySpendingContract);
|
||||
if(!Objects.isNull(paySpendingContract)){
|
||||
StringBuilder msg = ValidUtil.validateExcel(paySpendingContract,n + 1);
|
||||
if(!StringUtils.isBlank(msg)){
|
||||
sb.append(msg.toString());
|
||||
}
|
||||
}
|
||||
// 验证数据库中是否存在合同编号
|
||||
if(!StringUtils.isBlank(paySpendingContract.getContractNum())){
|
||||
// 获取数据库中数据
|
||||
List<PaySpendingContract> listDB = listDBContractNum.stream().filter(item->
|
||||
Objects.equals(item.getContractNum(),paySpendingContract.getContractNum())).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listDB)){
|
||||
sb.append("第").append(n + 1).append("行,合同编号已存在,请修改!");
|
||||
}
|
||||
}else{
|
||||
sb.append("第").append(n + 1).append("行,合同编号不能为空,请修改!");
|
||||
}
|
||||
// 验证数据库中是否存在签订单位
|
||||
if(!StringUtils.isBlank(paySpendingContract.getSignedCompanyTemporaryName())){
|
||||
List<PayCompanyManagement> listDB = listDBSignedCompanyTemporaryName.stream().filter(item->
|
||||
Objects.equals(item.getCompanyName(),paySpendingContract.getSignedCompanyTemporaryName())).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(listDB)){
|
||||
sb.append("第").append(n + 1).append("行,签订单位不存在,请修改!");
|
||||
}else{
|
||||
paySpendingContract.setSignedCompanyId(listDB.get(0).getId());
|
||||
}
|
||||
}else{
|
||||
sb.append("第").append(n + 1).append("行,签订单位不能为空,请修改!");
|
||||
}
|
||||
// 验证数据库中是否存在签订单位联系人
|
||||
if(!StringUtils.isBlank(paySpendingContract.getSignedCompanyTemporaryName())){
|
||||
if(!StringUtils.isBlank(paySpendingContract.getSignedCompanyId())){
|
||||
List<PayContactsManagement> listDB = listDBSignedContactsTemporaryName.stream().filter(item->
|
||||
Objects.equals(item.getCompanyName(),paySpendingContract.getSignedCompanyTemporaryName())
|
||||
&& Objects.equals(item.getCompanyId(),paySpendingContract.getSignedCompanyId())).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(listDB)){
|
||||
sb.append("第").append(n + 1).append("行,签订企业下签订单位联系人不存在,请修改!");
|
||||
}else{
|
||||
paySpendingContract.setSignedContactsId(listDB.get(0).getId());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
sb.append("第").append(n + 1).append("行,签订单位联系人不能为空,请修改!");
|
||||
}
|
||||
// 验证数据库中是否存在负责人
|
||||
if(!StringUtils.isBlank(paySpendingContract.getContractName())){
|
||||
List<SysUser> listDB = listDBPrincipalName.stream().filter(item->
|
||||
Objects.equals(item.getUsername(),paySpendingContract.getPrincipalName())).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(listDB)){
|
||||
sb.append("第").append(n + 1).append("行,负责人不存在,请修改!");
|
||||
}else{
|
||||
paySpendingContract.setPrincipalId(listDB.get(0).getId());
|
||||
// 验证数据库中是否存在部门名称
|
||||
List<SysDepart> listDB1 = listDepartmentName.stream().filter(item->
|
||||
Objects.equals(listDB.get(0).getDepartIds(),item.getId())).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listDB1)){
|
||||
paySpendingContract.setDepartmentName(listDB1.get(0).getDepartName());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
sb.append("第").append(n + 1).append("行,负责人不能为空,请修改!");
|
||||
}
|
||||
if(!Objects.isNull(paySpendingContract.getPack()) && StringUtils.isBlank(paySpendingContract.getPackYear())){
|
||||
sb.append("第").append(n + 1).append("行,打包年份不能为空,请修改!");
|
||||
}
|
||||
List<PaySpendingContractInstallment> listPaySpendingContractInstallment = p.getListInstallment();
|
||||
if(!CollectionUtils.isEmpty(listPaySpendingContractInstallment)){
|
||||
listPaySpendingContractInstallment.forEach(item->{
|
||||
StringBuilder msg = ValidUtil.validateExcel(item,n + 1);
|
||||
if(!StringUtils.isBlank(msg)){
|
||||
sb.append(msg.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if(!StringUtils.isBlank(sb)){
|
||||
throw new JeroBootException(sb.toString());
|
||||
}
|
||||
// 更新数据
|
||||
listPaySpendingContractImportExcel.forEach(p->{
|
||||
PaySpendingContract paySpendingContract = p.getSpendingContract();
|
||||
paySpendingContract.setOutstandingAmount(paySpendingContract.getAccountsReceivableAmount().subtract(paySpendingContract.getAmountReceived()));
|
||||
|
||||
if(paySpendingContract.getAccountsReceivableAmount().compareTo(paySpendingContract.getAmountReceived()) == 1){
|
||||
paySpendingContract.setAccountStatus(PayIncomeContractCommon.ACCOUNT_STATUS2);
|
||||
}else if(paySpendingContract.getAccountsReceivableAmount().compareTo(paySpendingContract.getAmountReceived()) == 0){
|
||||
paySpendingContract.setAccountStatus(PayIncomeContractCommon.ACCOUNT_STATUS3);
|
||||
}else{
|
||||
paySpendingContract.setAccountStatus(PayIncomeContractCommon.ACCOUNT_STATUS1);
|
||||
}
|
||||
setPaySpendingContract(paySpendingContract);
|
||||
paySpendingContractService.save(paySpendingContract);
|
||||
List<PaySpendingContractInstallment> listPaySpendingContractInstallment = p.getListInstallment();
|
||||
if(!CollectionUtils.isEmpty(listPaySpendingContractInstallment)){
|
||||
listPaySpendingContractInstallment.forEach(item->{
|
||||
item.setContractId(paySpendingContract.getId());
|
||||
});
|
||||
paySpendingContractInstallmentService.saveBatch(listPaySpendingContractInstallment);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
throw new JeroBootException("没有数据可导入");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private PaySpendingContract setPaySpendingContractExcel(Map<Integer,String> map,Map<String, String> mapOpening,Map<String, String> mapPack,
|
||||
int n,StringBuilder sb){
|
||||
Pattern pattern = Pattern.compile("[0-9]*\\.?[0-9]+");
|
||||
PaySpendingContract paySpendingContract = new PaySpendingContract();
|
||||
paySpendingContract.setContractNum(map.get(0));
|
||||
paySpendingContract.setContractName(map.get(1));
|
||||
paySpendingContract.setSignedCompanyTemporaryName(map.get(2));
|
||||
paySpendingContract.setSignedContactsTemporaryName(map.get(3));
|
||||
mapOpening.forEach((k,v)->{
|
||||
if(Objects.equals(map.get(4),k)){
|
||||
paySpendingContract.setOpening(Integer.parseInt(v));
|
||||
}
|
||||
});
|
||||
paySpendingContract.setPrincipalName(map.get(5));
|
||||
if(!StringUtils.isBlank(map.get(6))){
|
||||
if(!pattern.matcher(map.get(6)).matches()){
|
||||
sb.append("第").append(n).append("行,签订合同总金额格式错误!");
|
||||
}else{
|
||||
paySpendingContract.setContractAmount(new BigDecimal(map.get(6)));
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(map.get(7))){
|
||||
if(!pattern.matcher(map.get(7)).matches()){
|
||||
sb.append("第").append(n).append("行,税率格式错误!");
|
||||
}else{
|
||||
paySpendingContract.setRate(new BigDecimal(map.get(7)));
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(map.get(8)) ){
|
||||
if(!pattern.matcher(map.get(8)).matches()){
|
||||
sb.append("第").append(n).append("行,未税金额格式错误!");
|
||||
}else{
|
||||
paySpendingContract.setNoTaxAmount(new BigDecimal(map.get(8)));
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(map.get(9)) ){
|
||||
if(!DateUtils.isValidDate(map.get(9))){
|
||||
sb.append("第").append(n).append("行,合同签订日期格式不正确 <br/>");
|
||||
}else{
|
||||
paySpendingContract.setContractDate(DateUtils.str2Date(map.get(9),new SimpleDateFormat("yyyy-MM-dd")));
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(map.get(10))){
|
||||
if(!DateUtils.isValidDate(map.get(10))) {
|
||||
sb.append("第").append(n).append("行,合同终止日期格式不正确 <br/>");
|
||||
}else{
|
||||
paySpendingContract.setTerminationDate(DateUtils.str2Date(map.get(10),new SimpleDateFormat("yyyy-MM-dd")));
|
||||
}
|
||||
}
|
||||
paySpendingContract.setContractTimePoints(map.get(11));
|
||||
if(!StringUtils.isBlank(map.get(12))){
|
||||
if(!pattern.matcher(map.get(12)).matches()){
|
||||
sb.append("第").append(n).append("行,应收金额格式错误!");
|
||||
}else{
|
||||
paySpendingContract.setAccountsReceivableAmount(new BigDecimal(map.get(12)));
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(map.get(13))){
|
||||
if(!pattern.matcher(map.get(13)).matches()){
|
||||
sb.append("第").append(n).append("行,已收金额格式错误!");
|
||||
}else{
|
||||
paySpendingContract.setAmountReceived(new BigDecimal(map.get(13)));
|
||||
}
|
||||
}
|
||||
|
||||
paySpendingContract.setContractPaymentTimes(map.get(14));
|
||||
mapPack.forEach((k,v)->{
|
||||
if(Objects.equals(map.get(15),k)){
|
||||
paySpendingContract.setPack(Integer.parseInt(v));
|
||||
}
|
||||
});
|
||||
paySpendingContract.setPackYear(map.get(16));
|
||||
return paySpendingContract;
|
||||
}
|
||||
|
||||
/** 导入excel表格,返回的List<Map<Integer, String>>数据结构.
|
||||
* @param
|
||||
* @return 返回list集合
|
||||
* @throws Exception
|
||||
*/
|
||||
private List<Map<Integer, String>> read(MultipartFile file) {
|
||||
//最终返回数据
|
||||
List<Map<Integer, String>> list = new ArrayList<>();
|
||||
try{
|
||||
Workbook workbook = null;
|
||||
InputStream is = file.getInputStream();
|
||||
String name = file.getOriginalFilename().toLowerCase();
|
||||
// 创建excel操作对象
|
||||
if (name.contains(".xlsx") || name.contains(".xls")) {
|
||||
workbook = WorkbookFactory.create(is);
|
||||
}
|
||||
//得到一个工作表
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
//获得数据的总行数
|
||||
int totalRowNum = sheet.getLastRowNum();
|
||||
|
||||
//获得总列数
|
||||
int cellLength = sheet.getRow(0).getPhysicalNumberOfCells();
|
||||
Map<Integer, String> map = null;
|
||||
//获得所有数据
|
||||
//从第x行开始获取
|
||||
for(int x = 0 ; x <= totalRowNum ; x++){
|
||||
map = new HashMap<>();
|
||||
//获得第i行对象
|
||||
Row row = sheet.getRow(x);
|
||||
//如果一行里的所有单元格都为空则不放进list里面
|
||||
int a = 0;
|
||||
for(int y=0;y<cellLength;y++){
|
||||
if (!(row==null)) {
|
||||
Cell cell = row.getCell(y);
|
||||
if (cell == null) {
|
||||
map.put(y, "");
|
||||
} else {
|
||||
map.put(y,getXCellVal(cell));
|
||||
}
|
||||
if (map.get(y) == null || "".equals(map.get(y))) {
|
||||
a++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(a!=cellLength && row!=null){
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cell
|
||||
* @return String
|
||||
* 获取单元格中的值
|
||||
*/
|
||||
|
||||
private String getXCellVal(Cell cell) {
|
||||
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
|
||||
DecimalFormat df = new DecimalFormat("0.0000");
|
||||
String val = "";
|
||||
switch (cell.getCellType()) {
|
||||
case XSSFCell.CELL_TYPE_NUMERIC:
|
||||
if (DateUtil.isCellDateFormatted(cell)) {
|
||||
val = fmt.format(cell.getDateCellValue()); //日期型
|
||||
} else {
|
||||
val = df.format(cell.getNumericCellValue()); //数字型
|
||||
// 去掉多余的0,如最后一位是.则去掉
|
||||
val = val.replaceAll("0+?$", "").replaceAll("[.]$","");
|
||||
}
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_STRING: //文本类型
|
||||
val = cell.getStringCellValue();
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_BOOLEAN: //布尔型
|
||||
val = String.valueOf(cell.getBooleanCellValue());
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_BLANK: //空白
|
||||
val = cell.getStringCellValue();
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_ERROR: //错误
|
||||
val = "";
|
||||
break;
|
||||
case XSSFCell.CELL_TYPE_FORMULA: //公式
|
||||
try {
|
||||
val = String.valueOf(cell.getStringCellValue());
|
||||
} catch (IllegalStateException e) {
|
||||
val = String.valueOf(cell.getNumericCellValue());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
val = cell.getRichStringCellValue() == null ? null : cell.getRichStringCellValue().toString();
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 插入企业信息,联系人信息到临时表,更新项目记录
|
||||
|
||||
+1
-10
@@ -6,7 +6,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@Data
|
||||
public class PaySpendingContractExcel implements Serializable {
|
||||
public class PaySpendingContractExcelModel implements Serializable {
|
||||
|
||||
/**合同编号*/
|
||||
@Excel(name = "合同编号", width = 15)
|
||||
@@ -26,9 +26,6 @@ public class PaySpendingContractExcel implements Serializable {
|
||||
/**负责人名称*/
|
||||
@Excel(name = "负责人", width = 15)
|
||||
private String principalName;
|
||||
/**部门名称*/
|
||||
@Excel(name = "部门名称", width = 15)
|
||||
private String departmentName;
|
||||
/**签订合同总金额*/
|
||||
@Excel(name = "签订合同总金额", width = 15)
|
||||
private String contractAmount;
|
||||
@@ -53,12 +50,6 @@ public class PaySpendingContractExcel implements Serializable {
|
||||
/**已收金额*/
|
||||
@Excel(name = "已收金额", width = 15)
|
||||
private String amountReceived;
|
||||
/**未收金额*/
|
||||
@Excel(name = "未收金额", width = 15)
|
||||
private String outstandingAmount;
|
||||
/**账款状态(1:未支付,2:部分支付,3:已付全款)*/
|
||||
@Excel(name = "账款状态", width = 15)
|
||||
private Integer accountStatus;
|
||||
/**合同约定付款次数*/
|
||||
@Excel(name = "合同约定付款次数", width = 15)
|
||||
private String contractPaymentTimes;
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.jero.contract.vo;
|
||||
|
||||
import com.jero.contract.entity.PaySpendingContract;
|
||||
import com.jero.contract.entity.PaySpendingContractInstallment;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PaySpendingContractImportExcel implements Serializable {
|
||||
/**
|
||||
* 支出合同信息
|
||||
*/
|
||||
private PaySpendingContract spendingContract;
|
||||
/**
|
||||
* 支出合同分期集合
|
||||
*/
|
||||
private List<PaySpendingContractInstallment> listInstallment;
|
||||
}
|
||||
+2
-2
@@ -97,7 +97,7 @@ public class PayDataFileController extends JeroController<PayDataFile, IPayDataF
|
||||
|
||||
) {
|
||||
QueryWrapper<QueryFileList2> queryWrapper = QueryGenerator.initQueryWrapper(queryFileList2, req.getParameterMap());
|
||||
queryWrapper.eq("pd.parent_id",id).or().eq("pd.id",id);
|
||||
queryWrapper.eq("pd.id",id);
|
||||
queryWrapper.eq("pd.type",1);
|
||||
queryWrapper.orderByDesc("pf.create_time");
|
||||
Page<PayDataFile> page = new Page<>(pageNo, pageSize);
|
||||
@@ -142,7 +142,7 @@ public class PayDataFileController extends JeroController<PayDataFile, IPayDataF
|
||||
Page<PayDataFile> page = new Page<>(pageNo, pageSize);
|
||||
queryWrapper.eq("pd.type",2);
|
||||
queryWrapper.orderByDesc("pf.create_time");
|
||||
queryWrapper.eq("pd.parent_id",id).or().eq("pd.id",id);
|
||||
queryWrapper.eq("pd.id",id);
|
||||
// QueryWrapper<Object> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.eq("pf.id",id);
|
||||
// queryWrapper.like(StringUtils.isNotBlank(fileName),"of.fileName",fileName);
|
||||
|
||||
@@ -14,6 +14,9 @@ public class QueryFileList {
|
||||
@ApiModelProperty(value = "资料id")
|
||||
private java.lang.String dataId;
|
||||
|
||||
@ApiModelProperty(value = "资料id")
|
||||
private java.lang.String fileId;
|
||||
|
||||
@ApiModelProperty(value = "资料名称")
|
||||
private java.lang.String fileName;
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ public class QueryFileList2 {
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private java.lang.String keyId;
|
||||
|
||||
@ApiModelProperty(value = "目录id")
|
||||
private java.lang.String fileId;
|
||||
|
||||
@ApiModelProperty(value = "资料id")
|
||||
private java.lang.String dataId;
|
||||
|
||||
|
||||
+2
@@ -4,6 +4,7 @@
|
||||
<select id="pageData" resultType="com.jero.data.entity.QueryFileList2">
|
||||
SELECT pf.id as keyId,
|
||||
pf.file_id as dataId,
|
||||
pf.data_id as fileId,
|
||||
pf.file_path as filePath,
|
||||
of.file_name as fileName,
|
||||
dt.downLodeTime,
|
||||
@@ -17,6 +18,7 @@
|
||||
<select id="pageDataMeeting" resultType="com.jero.data.entity.QueryFileList">
|
||||
SELECT pf.id as keyid,
|
||||
pf.file_id as dataId,
|
||||
pf.data_id as fileId,
|
||||
pf.file_path as filePath,
|
||||
of.file_name as fileName,
|
||||
pd.meeting_id as meetingId,
|
||||
|
||||
+20
-18
@@ -6,14 +6,21 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.meeting.entity.PayMeetingSituation;
|
||||
import com.jero.meeting.service.IPayMeetingSituationService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.meeting.vo.AddDockVO;
|
||||
import com.jero.meeting.vo.PayMeetingSituationVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -71,7 +78,7 @@ public class PayMeetingSituationController extends JeroController<PayMeetingSitu
|
||||
@AutoLog(value = "会议报名信息-添加")
|
||||
@ApiOperation(value="会议报名信息-添加", notes="会议报名信息-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody PayMeetingSituation payMeetingSituation) {
|
||||
public Result<?> add(@RequestBody PayMeetingSituation payMeetingSituation) {
|
||||
payMeetingSituationService.add(payMeetingSituation);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
@@ -82,8 +89,8 @@ public class PayMeetingSituationController extends JeroController<PayMeetingSitu
|
||||
@AutoLog(value = "会议报名信息-编辑")
|
||||
@ApiOperation(value="会议报名信息-编辑", notes="会议报名信息-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody PayMeetingSituation payMeetingSituation) {
|
||||
payMeetingSituationService.editById(payMeetingSituation);
|
||||
public Result<?> edit(@RequestBody PayMeetingSituationVO payMeetingSituationVO) {
|
||||
payMeetingSituationService.editById(payMeetingSituationVO);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@@ -131,20 +138,15 @@ public class PayMeetingSituationController extends JeroController<PayMeetingSitu
|
||||
return super.exportXls(request, payMeetingSituation, PayMeetingSituation.class, "会议报名信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel模板
|
||||
*/
|
||||
@GetMapping(value = "/exportTemplate")
|
||||
public ModelAndView exportTemplate() {
|
||||
return super.exportTemplate(PayMeetingSituation.class, "会议报名信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*/
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, PayMeetingSituation.class);
|
||||
}
|
||||
/**
|
||||
* 设置对接人
|
||||
*/
|
||||
@AutoLog(value = "设置对接人")
|
||||
@ApiOperation(value="设置对接人", notes="设置对接人")
|
||||
@PostMapping(value = "/addDock")
|
||||
public Result<?> addDock(@RequestBody AddDockVO addDockVO) {
|
||||
payMeetingSituationService.addDock(addDockVO);
|
||||
return Result.OK("设置对接人成功!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -176,11 +176,13 @@ public class PayMeeting implements Serializable {
|
||||
/**会议费用*/
|
||||
@Excel(name = "会议费用", width = 15)
|
||||
@ApiModelProperty(value = "会议费用")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal meetingCosts;
|
||||
|
||||
/**会议费用(标协会员)*/
|
||||
@Excel(name = "会议费用(标协会员)", width = 15)
|
||||
@ApiModelProperty(value = "会议费用(标协会员)")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal meetingCostsVip;
|
||||
|
||||
/**会议负责人id*/
|
||||
|
||||
+12
@@ -3,6 +3,7 @@ package com.jero.meeting.entity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.jero.meeting.valid.group.CommonPeople;
|
||||
@@ -302,12 +303,14 @@ public class PayMeetingSituation implements Serializable {
|
||||
* 应收金额
|
||||
*/
|
||||
@ApiModelProperty(value = "应收金额")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal amountReceivable;
|
||||
|
||||
/**
|
||||
* 实收金额
|
||||
*/
|
||||
@ApiModelProperty(value = "实收金额")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal paidAmount;
|
||||
|
||||
/**打包*/
|
||||
@@ -344,5 +347,14 @@ public class PayMeetingSituation implements Serializable {
|
||||
@ApiModelProperty(value = "对接人姓名")
|
||||
private String dockName;
|
||||
|
||||
/**审核状态*/
|
||||
@Excel(name = "审核状态", width = 15)
|
||||
@ApiModelProperty(value = "审核状态")
|
||||
@Dict(dicCode = "signup_status")
|
||||
private Integer checkResult;
|
||||
|
||||
/**审核状态*/
|
||||
@ApiModelProperty(value = "审核备注")
|
||||
@TableField(exist = false)
|
||||
private String checkRemark;
|
||||
}
|
||||
|
||||
+6
-1
@@ -2,6 +2,9 @@ package com.jero.meeting.service;
|
||||
|
||||
import com.jero.meeting.entity.PayMeetingSituation;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.meeting.vo.AddDockVO;
|
||||
import com.jero.meeting.vo.PayMeetingSituationVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -20,7 +23,7 @@ public interface IPayMeetingSituationService extends IService<PayMeetingSituatio
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
void editById(PayMeetingSituation payMeetingSituation);
|
||||
void editById(PayMeetingSituationVO payMeetingSituationVO);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
@@ -41,4 +44,6 @@ public interface IPayMeetingSituationService extends IService<PayMeetingSituatio
|
||||
* 列表查询
|
||||
*/
|
||||
List<PayMeetingSituation> queryList();
|
||||
|
||||
void addDock(AddDockVO addDockVO);
|
||||
}
|
||||
|
||||
+63
-15
@@ -1,8 +1,11 @@
|
||||
package com.jero.meeting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.ValidUtil;
|
||||
import com.jero.company.entity.PayContactsManagement;
|
||||
import com.jero.company.service.IPayContactsManagementService;
|
||||
@@ -22,12 +25,15 @@ import com.jero.temporary.entity.PayCompanyManagementTemporary;
|
||||
import com.jero.temporary.entity.PayContactsManagementTemporary;
|
||||
import com.jero.temporary.service.IPayCompanyManagementTemporaryService;
|
||||
import com.jero.temporary.service.IPayContactsManagementTemporaryService;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -38,6 +44,7 @@ import javax.annotation.Resource;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituationMapper, PayMeetingSituation> implements IPayMeetingSituationService {
|
||||
@Resource
|
||||
private IPayContactsManagementService contactsManagementService;
|
||||
@@ -49,17 +56,53 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
|
||||
private IPayMeetingService meetingService;
|
||||
@Resource
|
||||
private IMemberInfoService memberInfoService;
|
||||
@Resource
|
||||
private ISysBaseAPI iSysBaseApi;
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
public void add(PayMeetingSituation payMeetingSituation) {
|
||||
PayMeetingSituation payMeetingSituation1 = getPayMeetingSituation(payMeetingSituation);
|
||||
|
||||
payMeetingSituation1.setStatus(PayProjectCommon.NO);
|
||||
payMeetingSituation1.setCheckIn(PayProjectCommon.NO);
|
||||
payMeetingSituation1.setCheckResult(PayProjectCommon.NO);
|
||||
payMeetingSituation1.setPaidAmount(new BigDecimal("0"));
|
||||
//到账
|
||||
payMeetingSituation1.setInAccount(PayProjectCommon.IN_ACCOUNT0);
|
||||
//开票
|
||||
payMeetingSituation1.setMakeInvoice(PayProjectCommon.MAKE_INVOICE0);
|
||||
//邮寄
|
||||
payMeetingSituation1.setMail(PayProjectCommon.MAIL0);
|
||||
save(payMeetingSituation1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Override
|
||||
public void editById(PayMeetingSituationVO payMeetingSituationVO) {
|
||||
String id = payMeetingSituationVO.getId();
|
||||
PayMeetingSituation payMeetingSituation = getById(id);
|
||||
if (ObjectUtil.isNull(payMeetingSituation)){
|
||||
throw new JeroBootException("参会人错误!");
|
||||
}
|
||||
BeanUtils.copyProperties(payMeetingSituationVO,payMeetingSituation);
|
||||
PayMeetingSituation payMeetingSituation1 = getPayMeetingSituation(payMeetingSituation);
|
||||
|
||||
saveOrUpdate(payMeetingSituation1);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PayMeetingSituation getPayMeetingSituation(PayMeetingSituation payMeetingSituation) {
|
||||
String meetingId = payMeetingSituation.getMeetingId();
|
||||
PayMeeting payMeeting = meetingService.getById(meetingId);
|
||||
//会议类型
|
||||
Integer meetingType = payMeeting.getMeetingType();
|
||||
//要保存的对象
|
||||
PayMeetingSituation payMeetingSituation1 = new PayMeetingSituation();
|
||||
payMeetingSituation1.setAmountReceivable(new BigDecimal("0"));
|
||||
//会议校验基础类
|
||||
MeetingEntity meetingEntity = new MeetingEntity();
|
||||
BeanUtils.copyProperties(payMeetingSituation, meetingEntity);
|
||||
@@ -146,7 +189,7 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
|
||||
if (meetingType.equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))){
|
||||
//根据企业名称和会员类型不为null判断是否为标协会员
|
||||
LambdaQueryWrapper<MemberInfo> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MemberInfo::getCompanyName,payMeetingSituation.getCompanyName());
|
||||
wrapper.eq(MemberInfo::getCompanyName, payMeetingSituation.getCompanyName());
|
||||
wrapper.isNotNull(MemberInfo::getMemberType);
|
||||
int count = memberInfoService.count(wrapper);
|
||||
//如果是标协会员就存入会议费用(标协会员)
|
||||
@@ -179,22 +222,10 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
|
||||
ValidUtil.validate(commonGuestVO);
|
||||
BeanUtils.copyProperties(commonGuestVO, payMeetingSituation1);
|
||||
}
|
||||
//到账
|
||||
payMeetingSituation1.setInAccount(PayProjectCommon.IN_ACCOUNT0);
|
||||
//开票
|
||||
payMeetingSituation1.setMakeInvoice(PayProjectCommon.MAKE_INVOICE0);
|
||||
//邮寄
|
||||
payMeetingSituation1.setMail(PayProjectCommon.MAIL0);
|
||||
save(payMeetingSituation1);
|
||||
return payMeetingSituation1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Override
|
||||
public void editById(PayMeetingSituation payMeetingSituation) {
|
||||
saveOrUpdate(payMeetingSituation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
@@ -227,4 +258,21 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
|
||||
public List<PayMeetingSituation> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDock(AddDockVO addDockVO) {
|
||||
String dockId = addDockVO.getDockId();
|
||||
LoginUser user = iSysBaseApi.getUserById(dockId);
|
||||
if (ObjectUtil.isNull(user)){
|
||||
throw new JeroBootException("对接人不存在");
|
||||
}
|
||||
String username = user.getUsername();
|
||||
List<String> meetingSituationIds = addDockVO.getMeetingSituationIds();
|
||||
for (String meetingSituationId : meetingSituationIds) {
|
||||
PayMeetingSituation payMeetingSituation = getById(meetingSituationId);
|
||||
payMeetingSituation.setDockId(dockId);
|
||||
payMeetingSituation.setDockName(username);
|
||||
saveOrUpdate(payMeetingSituation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.jero.meeting.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设置对接人
|
||||
* @author liJiaRao
|
||||
* @date 2021-09-09 17:51
|
||||
*/
|
||||
@Data
|
||||
public class AddDockVO {
|
||||
private String dockId;
|
||||
private List<String> meetingSituationIds;
|
||||
}
|
||||
+291
@@ -0,0 +1,291 @@
|
||||
package com.jero.meeting.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import com.jero.meeting.valid.group.CommonPeople;
|
||||
import com.jero.meeting.valid.group.Guest;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
* @date 2021-09-09 17:25
|
||||
*/
|
||||
@Data
|
||||
public class PayMeetingSituationVO {
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**会议id*/
|
||||
@Excel(name = "会议id", width = 15)
|
||||
@ApiModelProperty(value = "会议id")
|
||||
@NotBlank(message = "会议项目不能为空")
|
||||
private String meetingId;
|
||||
|
||||
/**企业id*/
|
||||
@ApiModelProperty(value = "企业id")
|
||||
@NotBlank(message = "企业名称不能为空")
|
||||
@Size(max = 50, message = "企业名称最大为50字符")
|
||||
private String companyId;
|
||||
|
||||
/**
|
||||
* 企业临时id
|
||||
*/
|
||||
@Excel(name = "会员单位", width = 15, dictTable = "pay_company_management_temporary", dicText = "company_name", dicCode = "id",orderNum = "1")
|
||||
private String companyTemporaryId;
|
||||
|
||||
/**企业名称*/
|
||||
@Excel(name = "企业名称", width = 15)
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private String companyName;
|
||||
|
||||
/**企业联系人id*/
|
||||
@ApiModelProperty(value = "企业联系人id")
|
||||
@NotBlank(message = "企业联系人不能为空")
|
||||
@Size(max = 50, message = "企业联系人最大为50字符")
|
||||
private String companyContactId;
|
||||
|
||||
/**
|
||||
* 企业联系人临时id
|
||||
*/
|
||||
@Excel(name = "企业联系人名称", width = 15, dictTable = "pay_contacts_management_temporary", dicText = "name", dicCode = "id",orderNum = "2")
|
||||
private String companyContactTemporaryId;
|
||||
|
||||
/**企业联系人姓名*/
|
||||
@Excel(name = "企业联系人姓名", width = 15)
|
||||
@ApiModelProperty(value = "企业联系人姓名")
|
||||
private String companyContactName;
|
||||
|
||||
/**职务*/
|
||||
@ApiModelProperty(value = "职务")
|
||||
private String post;
|
||||
|
||||
/**手机号*/
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
/**邮箱*/
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
/**身份*/
|
||||
@ApiModelProperty(value = "身份")
|
||||
@Dict(dicCode = "meet_identify_type")
|
||||
private Integer identity;
|
||||
|
||||
/**嘉宾类型*/
|
||||
@ApiModelProperty(value = "嘉宾类型")
|
||||
@NotNull(message = "请选择嘉宾类型",groups = Guest.class)
|
||||
@Min(value = 1,groups = Guest.class)
|
||||
@Max(value = 4,groups = Guest.class)
|
||||
private Integer guestType;
|
||||
|
||||
/**演讲题目*/
|
||||
@Excel(name = "演讲题目", width = 15)
|
||||
@ApiModelProperty(value = "演讲题目")
|
||||
@NotBlank(message = "演讲题目不能为空",groups = Guest.class)
|
||||
@Size(max = 50, message = "演讲题目最大为50字符")
|
||||
private String speechTopic;
|
||||
|
||||
/**演讲ppt*/
|
||||
@Excel(name = "演讲ppt", width = 15)
|
||||
@ApiModelProperty(value = "演讲ppt")
|
||||
@NotBlank(message = "演讲ppt不能为空",groups = Guest.class)
|
||||
private String speechPpt;
|
||||
|
||||
/**照片*/
|
||||
@Excel(name = "照片", width = 15)
|
||||
@ApiModelProperty(value = "照片")
|
||||
private String photo;
|
||||
|
||||
/**个人简介*/
|
||||
@Excel(name = "个人简介", width = 15)
|
||||
@ApiModelProperty(value = "个人简介")
|
||||
private String profile;
|
||||
|
||||
/**是否用餐*/
|
||||
@Excel(name = "是否用餐", width = 15)
|
||||
@ApiModelProperty(value = "是否用餐")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer haveMeals;
|
||||
|
||||
/**是否回民*/
|
||||
@Excel(name = "是否回民", width = 15)
|
||||
@ApiModelProperty(value = "是否回民")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer huiPeople;
|
||||
|
||||
/**是否入住协议酒店*/
|
||||
@Excel(name = "是否入住协议酒店", width = 15)
|
||||
@ApiModelProperty(value = "是否入住协议酒店")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer checkInHotel;
|
||||
|
||||
/**入住酒店时间*/
|
||||
@Excel(name = "入住酒店时间", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "入住酒店时间")
|
||||
private java.util.Date inHotelTime;
|
||||
|
||||
/**离开酒店时间*/
|
||||
@Excel(name = "离开酒店时间", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "离开酒店时间")
|
||||
private java.util.Date outHotelTime;
|
||||
|
||||
/**房型*/
|
||||
@Excel(name = "房型", width = 15)
|
||||
@ApiModelProperty(value = "房型")
|
||||
private String roomLayout;
|
||||
|
||||
/**是否需要接站*/
|
||||
@Excel(name = "是否需要接站", width = 15)
|
||||
@ApiModelProperty(value = "是否需要接站")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer pickUp;
|
||||
|
||||
/**抵达时间*/
|
||||
@Excel(name = "抵达时间", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "抵达时间")
|
||||
private java.util.Date arrivalTime;
|
||||
|
||||
/**到达站*/
|
||||
@Excel(name = "到达站", width = 15)
|
||||
@ApiModelProperty(value = "到达站")
|
||||
private String destination;
|
||||
|
||||
/**到达班次*/
|
||||
@Excel(name = "到达班次", width = 15)
|
||||
@ApiModelProperty(value = "到达班次")
|
||||
private String arrivalShift;
|
||||
|
||||
/**是否需要送站*/
|
||||
@Excel(name = "是否需要送站", width = 15)
|
||||
@ApiModelProperty(value = "是否需要送站")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer deliveryStation;
|
||||
|
||||
/**离开时间*/
|
||||
@Excel(name = "离开时间", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "离开时间")
|
||||
private java.util.Date departureTime;
|
||||
|
||||
/**离开站*/
|
||||
@Excel(name = "离开站", width = 15)
|
||||
@ApiModelProperty(value = "离开站")
|
||||
private String departureStation;
|
||||
|
||||
/**离开班次*/
|
||||
@Excel(name = "离开班次", width = 15)
|
||||
@ApiModelProperty(value = "离开班次")
|
||||
private String departureShift;
|
||||
|
||||
/**同行人*/
|
||||
@Excel(name = "同行人", width = 15)
|
||||
@ApiModelProperty(value = "同行人")
|
||||
private String peer;
|
||||
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**是否签到*/
|
||||
@Excel(name = "是否签到", width = 15)
|
||||
@ApiModelProperty(value = "是否签到")
|
||||
@Dict(dicCode = "yn")
|
||||
private Integer checkIn;
|
||||
|
||||
/**邮寄联系人*/
|
||||
@Excel(name = "邮寄联系人", width = 15)
|
||||
@ApiModelProperty(value = "邮寄联系人")
|
||||
private String postContactId;
|
||||
|
||||
/**
|
||||
* 邮寄联系人临时id
|
||||
*/
|
||||
@Excel(name = "邮寄联系人姓名", width = 15, dictTable = "pay_contacts_management_temporary", dicText = "name", dicCode = "id",orderNum = "3")
|
||||
private String postContactTemporaryId;
|
||||
|
||||
/**
|
||||
* 邮寄联系人姓名
|
||||
*/
|
||||
@ApiModelProperty(value = "邮寄联系人姓名")
|
||||
private String postContactName;
|
||||
|
||||
/**邮寄联系人地址*/
|
||||
@Excel(name = "邮寄联系人地址", width = 15)
|
||||
@ApiModelProperty(value = "邮寄联系人地址")
|
||||
private String postContactAddress;
|
||||
|
||||
/**缴费方式*/
|
||||
@Excel(name = "缴费方式", width = 15)
|
||||
@ApiModelProperty(value = "缴费方式")
|
||||
@NotNull(message = "缴费方式不能为空",groups = CommonPeople.class)
|
||||
@Min(1)
|
||||
@Max(3)
|
||||
@Dict(dicCode = "meeting_pay_type")
|
||||
private Integer payMode;
|
||||
|
||||
/**需要发票*/
|
||||
@Excel(name = "需要发票", width = 15)
|
||||
@ApiModelProperty(value = "需要发票")
|
||||
@Min(0)
|
||||
@Max(2)
|
||||
@Dict(dicCode = "invoice_type")
|
||||
private Integer needInvoice;
|
||||
|
||||
/**付款凭证*/
|
||||
@Excel(name = "付款凭证", width = 15)
|
||||
@ApiModelProperty(value = "付款凭证")
|
||||
private String paymentRecord;
|
||||
|
||||
/**
|
||||
* 应收金额
|
||||
*/
|
||||
@ApiModelProperty(value = "应收金额")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private BigDecimal amountReceivable;
|
||||
|
||||
/**打包*/
|
||||
@Excel(name = "打包", width = 15)
|
||||
@ApiModelProperty(value = "打包")
|
||||
private Integer pack;
|
||||
|
||||
}
|
||||
@@ -14,11 +14,9 @@ import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -176,15 +174,15 @@ public class PayMeetingVO implements Serializable {
|
||||
@Excel(name = "会议费用", width = 15)
|
||||
@ApiModelProperty(value = "会议费用")
|
||||
@NotNull(message = "会议费用不能为空")
|
||||
@Max(value = 999999999,message = "会议费用格式错误")
|
||||
private Integer meetingCosts;
|
||||
@DecimalMax(value = "10000000000",message = "会议费用格式错误")
|
||||
private BigDecimal meetingCosts;
|
||||
|
||||
/**会议费用(标协会员)*/
|
||||
@Excel(name = "会议费用(标协会员)", width = 15)
|
||||
@ApiModelProperty(value = "会议费用(标协会员)")
|
||||
@NotNull(message = "会议费用(标协会员)不能为空",groups = StandardMeeting.class)
|
||||
@Max(value = 999999999,message = "会议费用(标协会员)格式错误",groups = StandardMeeting.class)
|
||||
private Integer meetingCostsVip;
|
||||
@DecimalMax(value = "10000000000",message = "会议费用(标协会员)格式错误",groups = StandardMeeting.class)
|
||||
private BigDecimal meetingCostsVip;
|
||||
|
||||
/**会议负责人id*/
|
||||
@ApiModelProperty(value = "会议负责人id")
|
||||
|
||||
+2
-12
@@ -1,22 +1,12 @@
|
||||
package com.jero.meeting.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.meeting.entity.PayMeetingHotelContacts;
|
||||
import com.jero.meeting.valid.group.InternationalMeeting;
|
||||
import com.jero.meeting.valid.group.StandardMeeting;
|
||||
import com.jero.meeting.valid.group.WorkingGroupMeeting;
|
||||
import com.jero.modules.system.volid.group.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
@@ -114,7 +104,7 @@ public class WorkingGroupMeetingExel {
|
||||
@Excel(name = "会议费用", width = 15)
|
||||
@ApiModelProperty(value = "会议费用")
|
||||
@NotNull(message = "会议费用不能为空")
|
||||
@Max(value = 999999999,message = "会议费用格式错误")
|
||||
@DecimalMax(value = "10000000000",message = "会议费用格式错误")
|
||||
private Integer meetingCosts;
|
||||
|
||||
/**会议负责人id*/
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ public class PayMemberProjectSubitem implements Serializable {
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@ApiModelProperty(value = "应收金额")
|
||||
@NotNull(message = "应收金额不能为空")
|
||||
@DecimalMax(value = "10000000000",message = "应收金额格式错误1")
|
||||
@DecimalMax(value = "10000000000",message = "应收金额格式错误")
|
||||
private BigDecimal amountReceivable;
|
||||
|
||||
/**
|
||||
|
||||
+46
-21
@@ -11,9 +11,11 @@ import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.ValidUtil;
|
||||
import com.jero.pack.entity.PayPackCompany;
|
||||
import com.jero.pack.service.IPayPackCompanyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
@@ -21,12 +23,12 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* @Description: pay_pack_company
|
||||
* @Description: 打包关联
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-09-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="pay_pack_company")
|
||||
@Api(tags="打包关联")
|
||||
@RestController
|
||||
@RequestMapping("/pack/payPackCompany")
|
||||
@Slf4j
|
||||
@@ -43,8 +45,8 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "pay_pack_company-分页列表查询")
|
||||
@ApiOperation(value="pay_pack_company-分页列表查询", notes="pay_pack_company-分页列表查询")
|
||||
@AutoLog(value = "打包关联-分页列表查询")
|
||||
@ApiOperation(value="打包关联-分页列表查询", notes="打包关联-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(PayPackCompany payPackCompany,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@@ -62,10 +64,14 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
|
||||
* @param payPackCompany
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "pay_pack_company-添加")
|
||||
@ApiOperation(value="pay_pack_company-添加", notes="pay_pack_company-添加")
|
||||
@AutoLog(value = "打包关联-添加")
|
||||
@ApiOperation(value="打包关联-添加", notes="打包关联-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody PayPackCompany payPackCompany) {
|
||||
StringBuilder msg = ValidUtil.validateAll(payPackCompany);
|
||||
if(!StringUtils.isBlank(msg)){
|
||||
return Result.error(msg.toString());
|
||||
}
|
||||
payPackCompanyService.save(payPackCompany);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
@@ -76,10 +82,14 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
|
||||
* @param payPackCompany
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "pay_pack_company-编辑")
|
||||
@ApiOperation(value="pay_pack_company-编辑", notes="pay_pack_company-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
@AutoLog(value = "打包关联-编辑")
|
||||
@ApiOperation(value="打包关联-编辑", notes="打包关联-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody PayPackCompany payPackCompany) {
|
||||
StringBuilder msg = ValidUtil.validateAll(payPackCompany);
|
||||
if(!StringUtils.isBlank(msg)){
|
||||
return Result.error(msg.toString());
|
||||
}
|
||||
payPackCompanyService.updateById(payPackCompany);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
@@ -90,10 +100,13 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "pay_pack_company-通过id删除")
|
||||
@ApiOperation(value="pay_pack_company-通过id删除", notes="pay_pack_company-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
@AutoLog(value = "打包关联-通过id删除")
|
||||
@ApiOperation(value="打包关联-通过id删除", notes="打包关联-通过id删除")
|
||||
@GetMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id") String id) {
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("id不能为空!");
|
||||
}
|
||||
payPackCompanyService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
@@ -104,10 +117,19 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "pay_pack_company-批量删除")
|
||||
@ApiOperation(value="pay_pack_company-批量删除", notes="pay_pack_company-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
@AutoLog(value = "打包关联-批量删除")
|
||||
@ApiOperation(value="打包关联-批量删除", notes="打包关联-批量删除")
|
||||
@GetMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids") String ids) {
|
||||
if(StringUtils.isBlank(ids)){
|
||||
return Result.error("id不能为空!");
|
||||
}
|
||||
String[] s = ids.split(",");
|
||||
for (String s1 : s) {
|
||||
if(StringUtils.isBlank(s1)){
|
||||
return Result.error("id不能为空!");
|
||||
}
|
||||
}
|
||||
this.payPackCompanyService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
@@ -118,10 +140,13 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "pay_pack_company-通过id查询")
|
||||
@ApiOperation(value="pay_pack_company-通过id查询", notes="pay_pack_company-通过id查询")
|
||||
@AutoLog(value = "打包关联-通过id查询")
|
||||
@ApiOperation(value="打包关联-通过id查询", notes="打包关联-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
public Result<?> queryById(@RequestParam(name="id") String id) {
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("id不能为空!");
|
||||
}
|
||||
PayPackCompany payPackCompany = payPackCompanyService.getById(id);
|
||||
if(payPackCompany==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
@@ -135,7 +160,7 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
|
||||
* @param request
|
||||
* @param payPackCompany
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
@GetMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, PayPackCompany payPackCompany) {
|
||||
return super.exportXls(request, payPackCompany, PayPackCompany.class, "pay_pack_company");
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* @Description: pay_pack_company
|
||||
* @Author: jeecg-boot
|
||||
|
||||
+8
-1
@@ -83,5 +83,12 @@ public class PayProjectCommon {
|
||||
* 来款用途 :1工作组是标准制定工作组经费
|
||||
*/
|
||||
public final static Integer CHARGE_USE1 = 1;
|
||||
|
||||
/**
|
||||
* 否
|
||||
*/
|
||||
public static final Integer NO = 0;
|
||||
/**
|
||||
* 是
|
||||
*/
|
||||
public static final Integer YES = 1;
|
||||
}
|
||||
|
||||
+32
-5
@@ -1,6 +1,7 @@
|
||||
package com.jero.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
@@ -124,10 +125,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
|
||||
log.info("工作组成员-添加异常",e);
|
||||
throw new JeroBootException("工作组成员单位已存在!");
|
||||
}
|
||||
// 来款方式为合同,校验合同编号
|
||||
if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){
|
||||
payIncomeContractService.checkContractNum(payWorkingGroupSubItem.getContractNum());
|
||||
}
|
||||
|
||||
payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem);
|
||||
payWorkingGroupSubItem.setPack(PayProjectCommon.PACKAGING0);
|
||||
payWorkingGroupSubItem.setInAccount(PayProjectCommon.IN_ACCOUNT0);
|
||||
@@ -135,6 +133,20 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
|
||||
payWorkingGroupSubItem.setMail(PayProjectCommon.MAIL0);
|
||||
payWorkingGroupSubItem.setChargeUse(PayProjectCommon.CHARGE_USE1);
|
||||
payWorkingGroupSubItemService.save(payWorkingGroupSubItem);
|
||||
|
||||
PayIncomeContract payIncomeContract = null;
|
||||
// 来款方式为合同,校验合同编号
|
||||
if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){
|
||||
payIncomeContract = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(),payWorkingGroupSubItem.getChargeCompanyId(),payWorkingGroupSubItem.getId());
|
||||
}
|
||||
// 关联了合同,判断合同是否打包,更新项目打包状态,添加打包
|
||||
if(!Objects.isNull(payIncomeContract) && Objects.equals(payIncomeContract.getPack(),PayProjectCommon.PACKAGING1)){
|
||||
LambdaUpdateWrapper<PayWorkingGroupSubItem> update = new LambdaUpdateWrapper<>();
|
||||
update.eq(PayWorkingGroupSubItem::getId,payWorkingGroupSubItem.getId());
|
||||
update.set(PayWorkingGroupSubItem::getPack,PayProjectCommon.PACKAGING1);
|
||||
payWorkingGroupSubItemService.update(update);
|
||||
// todo 缺少添加打包功能
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -176,9 +188,24 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
|
||||
log.info("工作组成员-编辑异常",e);
|
||||
throw new JeroBootException("工作组成员单位已存在!");
|
||||
}
|
||||
// 校验项目是否已关联合同
|
||||
PayIncomeContract payIncomeContract = payIncomeContractService.checkPayIncomeContractAssociated(payWorkingGroupSubItem.getId());
|
||||
if(!Objects.isNull(payIncomeContract) && !Objects.equals(payIncomeContract.getContractNum(),payWorkingGroupSubItem.getContractNum())){
|
||||
throw new JeroBootException("项目已关联合同,合同编号不可修改!");
|
||||
}
|
||||
|
||||
PayIncomeContract payIncomeContractAdd = null;
|
||||
// 来款方式为合同,校验合同编号
|
||||
if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){
|
||||
payIncomeContractService.checkContractNum(payWorkingGroupSubItem.getContractNum());
|
||||
payIncomeContractAdd = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(),payWorkingGroupSubItem.getChargeCompanyId(),payWorkingGroupSubItem.getId());
|
||||
}
|
||||
// 关联了合同,判断合同是否打包,更新项目打包状态,添加打包
|
||||
if(!Objects.isNull(payIncomeContractAdd) && Objects.equals(payIncomeContractAdd.getPack(),PayProjectCommon.PACKAGING1)){
|
||||
LambdaUpdateWrapper<PayWorkingGroupSubItem> update = new LambdaUpdateWrapper<>();
|
||||
update.eq(PayWorkingGroupSubItem::getId,payWorkingGroupSubItem.getId());
|
||||
update.set(PayWorkingGroupSubItem::getPack,PayProjectCommon.PACKAGING1);
|
||||
payWorkingGroupSubItemService.update(update);
|
||||
// todo 缺少添加打包功能
|
||||
}
|
||||
payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem);
|
||||
payWorkingGroupSubItem.setChargeUse(PayProjectCommon.CHARGE_USE1);
|
||||
|
||||
Reference in New Issue
Block a user