Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhangqinlin
2021-09-06 18:17:22 +08:00
31 changed files with 1182 additions and 775 deletions
+318 -230
View File
File diff suppressed because it is too large Load Diff
@@ -85,17 +85,14 @@ public class JeroController<T, S extends IService<T>> {
*
* @param
*/
protected ModelAndView exportListXls(List<T> object, Class<T> clazz, String title) {
protected ModelAndView exportListXls(List<?> object, Class<?> clazz, String title) {
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(title, title);
exportParams.setImageBasePath(upLoadPath);
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, null);
mv.addObject(NormalExcelConstants.PARAMS,new ExportParams(title, title));
mv.addObject(NormalExcelConstants.DATA_LIST, object);
return mv;
}
@@ -167,7 +164,7 @@ public class JeroController<T, S extends IService<T>> {
/**
* 导出Excel模板
*/
public ModelAndView exportTemplate(Class<T> exportClass, String title) {
public ModelAndView exportTemplate(Class<?> exportClass, String title) {
// AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
@@ -228,6 +225,9 @@ public class JeroController<T, S extends IService<T>> {
try {
//导入Excel格式校验,看匹配的字段文本概率
Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), clazz, params);
if (t == null) {
throw new JeroBootException("导入数据为空!");
}
if(!t){
throw new JeroBootException("导入Excel校验失败 ");
}
@@ -16,11 +16,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.PasswordUtil;
import com.jero.common.util.ValidUtil;
import com.jero.common.util.oConvertUtils;
import com.jero.company.common.PayCompanyManagementCommon;
import com.jero.company.common.PayContactsManagementCommon;
import com.jero.company.entity.PayCompanyManagement;
import com.jero.company.entity.PayContactsManagement;
@@ -29,7 +27,6 @@ import com.jero.company.service.IPayContactsManagementService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.ExcelImportCheckUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -54,11 +54,11 @@ public class PayCompanyManagement implements Serializable {
@Pattern(regexp = "^(([0-9]{3,4}-)?[0-9]{7,8})|(((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(17[0135678])|(18[0-9])|(19[8|9])|(16[6]))\\d{8})$",message = "公司电话格式错误")
private String companyPhone;
/**邮编*/
@Excel(name = "", width = 15)
@ApiModelProperty(value = "")
@NotEmpty(message = "不能为空!")
@Size(min=6,max = 6,message = "长度必须为6个字符")
@Pattern(regexp = "^[0-9]\\d{5}$",message = "格式错误")
@Excel(name = "政编码", width = 15)
@ApiModelProperty(value = "政编码")
@NotEmpty(message = "政编码不能为空!")
@Size(min=6,max = 6,message = "政编码长度必须为6个字符")
@Pattern(regexp = "^[0-9]\\d{5}$",message = "政编码格式错误")
private String postalCode;
/**银行户名*/
@Excel(name = "银行户名", width = 15)
@@ -1,6 +1,7 @@
package com.jero.contract.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -8,6 +9,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.util.DateUtils;
@@ -36,7 +39,7 @@ import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.def.MapExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecgframework.poi.excel.view.JeecgMapExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
@@ -75,6 +78,9 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
private IPayIncomeContractAuditService payIncomeContractAuditService;
@Autowired
private Environment env;
@Autowired
private ISysBaseAPI sysBaseAPI;
/**
* 分页列表查询
@@ -96,7 +102,16 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
@RequestParam(name="projectName",required = false) String projectName,
@RequestParam(name="startTime",required = false) String startTime,
@RequestParam(name="endTime",required = false) String endTime) {
// todo 缺少验证,缺少会议,会员项目
if(!StringUtils.isBlank(payIncomeContract.getContractNum()) && payIncomeContract.getContractNum().length() > 50){
return Result.error("合同编号长度不能大于50个字符!");
}
if(!StringUtils.isBlank(payIncomeContract.getContractName()) && payIncomeContract.getContractName().length() > 50){
return Result.error("合同名称长度不能大于50个字符!");
}
if(!StringUtils.isBlank(projectName) && projectName.length() > 50){
return Result.error("关联项目长度不能大于50个字符!");
}
// todo 缺少会议,会员项目
Page<PayIncomeContractOutput> page = new Page<>(pageNo, pageSize);
IPage<PayIncomeContractOutput> pageList = payIncomeContractService.queryPageList(page, payIncomeContract,chargeStatus,projectName,startTime,endTime);
pageList.getRecords().forEach(p->{
@@ -131,24 +146,45 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
return Result.OK("编辑成功!");
}
/**
* 关联项目列表
*
* @param contractId 合同id
* @return
*/
@AutoLog(value = "收入合同-关联")
@ApiOperation(value="收入合同-关联", notes="收入合同-关联")
@GetMapping(value = "/getAssociated")
public Result<?> getAssociated(@RequestParam("contractId") String contractId) {
List<ProjectOutput> list = payIncomeContractService.getAssociated(contractId);
if(!CollectionUtils.isEmpty(list)){
list.forEach(p->{
if(!StringUtils.isBlank(p.getChargeUse())){
p.setChargeUse_dictText(sysBaseAPI.translateDict("payment_charge_use",p.getChargeUse()));
}
});
}
return Result.OK(list);
}
/**
* 关联
*
* @param input
* @param listPayIncomeContractAssociated 关联项目集合
* @return
*/
@AutoLog(value = "收入合同-关联")
@ApiOperation(value="收入合同-关联", notes="收入合同-关联")
@PostMapping(value = "/associated")
public Result<?> associated(@RequestBody PayIncomeContractAssociatedInput input) {
List<ProjectOutput> list = payIncomeContractService.associated(input);
public Result<?> associated(@RequestBody List<PayIncomeContractAssociated> listPayIncomeContractAssociated) {
List<ProjectOutput> list = payIncomeContractService.associated(listPayIncomeContractAssociated);
return Result.OK("关联成功!",list);
}
/**
* 取消关联
*
* @param payIncomeContractAssociated
* @param payIncomeContractAssociated 关联项目
* @return
*/
@AutoLog(value = "收入合同-取消关联")
@@ -156,7 +192,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
@PostMapping(value = "/cancelAssociated")
public Result<?> cancelAssociated(@RequestBody PayIncomeContractAssociated payIncomeContractAssociated) {
payIncomeContractService.cancelAssociated(payIncomeContractAssociated);
return Result.OK("关联成功!");
return Result.OK("取消关联成功!");
}
/**
@@ -191,16 +227,16 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
/**
* 归档
*
* @param payIncomeContract 收入合同
* @param payIncomeContractAudit 审核记录
*/
@AutoLog(value = "收入合同-归档")
@ApiOperation(value="收入合同-归档", notes="收入合同-归档")
@PostMapping(value = "/archive")
public Result<?> archive(@RequestBody PayIncomeContract payIncomeContract) {
if(StringUtils.isBlank(payIncomeContract.getId())){
public Result<?> archive(@RequestBody PayIncomeContractAudit payIncomeContractAudit) {
if(StringUtils.isBlank(payIncomeContractAudit.getContractId())){
return Result.error("id不能为空!");
}
payIncomeContractService.updateArchive(payIncomeContract.getId());
payIncomeContractService.updateArchive(payIncomeContractAudit);
return Result.OK("归档成功!");
}
@@ -258,77 +294,50 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
if(payIncomeContract==null) {
return Result.error("未找到对应数据");
}
// 获取分期信息
LambdaQueryWrapper<PayIncomeContractInstallment> queryPayIncomeContractInstallment = new LambdaQueryWrapper<>();
queryPayIncomeContractInstallment.eq(PayIncomeContractInstallment::getContractId,payIncomeContract.getId());
List<PayIncomeContractInstallment> listPayIncomeContractInstallment = payIncomeContractInstallmentService.list(queryPayIncomeContractInstallment);
// 获取关联项目id
List<ProjectOutput> listProject = new ArrayList<>();
LambdaQueryWrapper<PayIncomeContractAssociated> queryPayIncomeContractAssociated = new LambdaQueryWrapper<>();
queryPayIncomeContractAssociated.eq(PayIncomeContractAssociated::getContractId,id);
List<PayIncomeContractAssociated> listPayIncomeContractAssociated = payIncomeContractAssociatedService.list(queryPayIncomeContractAssociated);
if(!CollectionUtils.isEmpty(listPayIncomeContractAssociated)){
List<String> listId = listPayIncomeContractAssociated.stream().map(PayIncomeContractAssociated::getProjectId).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listId)){
// 普通项目
LambdaQueryWrapper<PayCommonProject> queryPayCommonProject = new LambdaQueryWrapper<>();
queryPayCommonProject.in(PayCommonProject::getId,listId);
List<PayCommonProject> listPayCommonProject = payCommonProjectService.list(queryPayCommonProject);
if(!CollectionUtils.isEmpty(listPayCommonProject)){
listPayCommonProject.forEach(p->{
ProjectOutput projectOutput = new ProjectOutput();
projectOutput.setProjectId(p.getId());
projectOutput.setProjectType(PayIncomeContractCommon.PROJECT_TYPE1);
projectOutput.setChargeProject(p.getChargeProject());
projectOutput.setChargeUse(p.getChargeUse());
projectOutput.setChargeCompanyName(p.getChargeCompanyTemporaryName());
projectOutput.setContactsName(p.getChargeCompanyTemporaryName());
projectOutput.setPaidAmount(p.getPaidAmount());
projectOutput.setReceivableAmount(p.getReceivableAmount());
listProject.add(projectOutput);
});
}
// 工作组项目
LambdaQueryWrapper<PayWorkingGroupSubItem> queryPayWorkingGroupSubItem = new LambdaQueryWrapper<>();
queryPayWorkingGroupSubItem.in(PayWorkingGroupSubItem::getId,listId);
List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(queryPayWorkingGroupSubItem);
if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){
listPayWorkingGroupSubItem.forEach(p->{
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(p.getWorkingGroupId());
ProjectOutput projectOutput = new ProjectOutput();
projectOutput.setProjectId(p.getId());
projectOutput.setProjectType(PayIncomeContractCommon.PROJECT_TYPE2);
if(Objects.isNull(payWorkingGroup)){
projectOutput.setChargeProject(payWorkingGroup.getWorkingGroupProject());
}
projectOutput.setChargeProject(p.getChargeProject());
projectOutput.setChargeCompanyName(p.getChargeCompanyTemporaryName());
projectOutput.setContactsName(p.getChargeCompanyTemporaryName());
projectOutput.setPaidAmount(p.getPaidAmount());
projectOutput.setReceivableAmount(p.getReceivableAmount());
listProject.add(projectOutput);
});
}
// todo 会议项目
// todo 会员项目
}
}
// 获取存档记录
List<ProjectOutput> listProject = payIncomeContractService.getAssociated(id);
LambdaQueryWrapper<PayIncomeContractAudit> queryPayIncomeContractAudit = new LambdaQueryWrapper<>();
queryPayIncomeContractAudit.in(PayIncomeContractAudit::getContractId,id);
List<PayIncomeContractAudit> listPayIncomeContractAudit = payIncomeContractAuditService.list(queryPayIncomeContractAudit);
List<PayIncomeContractAudit> listArchive = listPayIncomeContractAudit.stream().filter(p->Objects.equals(p.getContractStatus(), PayIncomeContractCommon.STATUS5)).collect(Collectors.toList());
// 获取审核记录
List<PayIncomeContractAudit> listAudit = listPayIncomeContractAudit.stream().filter(p->!Objects.equals(p.getContractStatus(), PayIncomeContractCommon.STATUS5)).collect(Collectors.toList());
List<PayIncomeContractAuditOutput> listArchive = new ArrayList<>();
List<PayIncomeContractAuditOutput> listAudit = new ArrayList<>();
if(!CollectionUtils.isEmpty(listPayIncomeContractAudit)){
String str = JSON.toJSONString(listPayIncomeContractAudit);
List<PayIncomeContractAuditOutput> listAll = JSONArray.parseArray(str,PayIncomeContractAuditOutput.class);
listAll.forEach(p->{
if(!Objects.isNull(p.getContractStatus())){
p.setContractStatus_dictText(sysBaseAPI.translateDict("revenue_contract_status",String.valueOf(p.getContractStatus())));
}
});
// 获取存档记录
listArchive = listAll.stream().filter(p->Objects.equals(p.getContractStatus(), PayIncomeContractCommon.STATUS5)).collect(Collectors.toList());
// 获取审核记录
listAudit = listAll.stream().filter(p->!Objects.equals(p.getContractStatus(), PayIncomeContractCommon.STATUS5)).collect(Collectors.toList());
}
String str = JSON.toJSONString(payIncomeContract);
PayIncomeContractDetailOutput payIncomeContractDetailOutput = JSONObject.parseObject(str,PayIncomeContractDetailOutput.class);
// 字典翻译
payIncomeContractDetailOutput.setOpening_dictText(sysBaseAPI.translateDict("yn",String.valueOf(payIncomeContract.getOpening())));
payIncomeContractDetailOutput.setAccountStatus_dictText(sysBaseAPI.translateDict("revenue_contract_account_status",String.valueOf(payIncomeContract.getAccountStatus())));
payIncomeContractDetailOutput.setPack_dictText(sysBaseAPI.translateDict("yn",String.valueOf(payIncomeContract.getPack())));
payIncomeContractDetailOutput.setContractStatus_dictText(sysBaseAPI.translateDict("revenue_contract_status",String.valueOf(payIncomeContract.getStatus())));
if(!CollectionUtils.isEmpty(listPayIncomeContractInstallment)){
payIncomeContractDetailOutput.setListInstallment(listPayIncomeContractInstallment);
}
if(!CollectionUtils.isEmpty(listProject)){
listProject.sort((m1,m2)->m2.getCreateTime().compareToIgnoreCase(m1.getCreateTime()));
listProject.forEach(p->{
if(!StringUtils.isBlank(p.getChargeUse())){
p.setChargeUse_dictText(sysBaseAPI.translateDict("payment_charge_use",p.getChargeUse()));
}
});
payIncomeContractDetailOutput.setListProject(listProject);
}
if(!CollectionUtils.isEmpty(listArchive)){
@@ -365,7 +374,6 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
}
List<Map<String,String>> list = new ArrayList<>();
// excel字段长度
// todo 缺少字典转换
Map<String,Integer> mapCount = new HashMap<>();
mapCount.put("count",0);
if(!CollectionUtils.isEmpty(exportList)){
@@ -377,6 +385,9 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
exportList.forEach(p->{
String str = JSON.toJSONString(p);
Map<String,String> map = JSONObject.parseObject(str,Map.class);
map.put("opening",sysBaseAPI.translateDict("yn",String.valueOf(p.getOpening())));
map.put("accountStatus",sysBaseAPI.translateDict("revenue_contract_account_status",String.valueOf(p.getAccountStatus())));
map.put("pack",sysBaseAPI.translateDict("yn",String.valueOf(p.getPack())));
List<PayIncomeContractInstallment> listSub = listPayIncomeContractInstallment.stream().filter(item->
Objects.equals(p.getId(),item.getContractId())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listSub)){
@@ -385,7 +396,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
mapCount.put("count",listSub.size());
}
listSub.forEach(p1->{
int n = listSub.indexOf(p1);
int n = listSub.indexOf(p1) + 1;
map.put("phaseName" + n,p1.getPhaseName());
map.put("accountsReceivableAmount" + n,p1.getAccountsReceivableAmount());
map.put("accountsReceivableTime" + n, DateUtils.date2Str(p1.getAccountsReceivableTime(),new SimpleDateFormat("yyyy-MM-dd")));
@@ -396,6 +407,8 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
list.add(map);
});
}
}else{
throw new JeroBootException("数据为空!");
}
// 设置表头样式
List<ExcelExportEntity> filedsList = new ArrayList<>();
@@ -412,6 +425,8 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
filedsList.add(new ExcelExportEntity("合同签订日期", "contractDate"));
filedsList.add(new ExcelExportEntity("合同终止日期", "terminationDate"));
filedsList.add(new ExcelExportEntity("合同约定主要时点", "contractTimePoints"));
filedsList.add(new ExcelExportEntity("是否打包", "pack"));
filedsList.add(new ExcelExportEntity("打包年份", "packYear"));
int count = mapCount.get("count");
if(count > 0){
for (int i = 1; i <= count; i++){
@@ -423,7 +438,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
}
}
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
ModelAndView mv = new ModelAndView(new JeecgMapExcelView());
mv.addObject(MapExcelConstants.FILE_NAME, "收入合同"); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(MapExcelConstants.ENTITY_LIST, filedsList);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
@@ -4,6 +4,7 @@ import java.io.Serializable;
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;
@@ -79,10 +80,11 @@ public class PayIncomeContract implements Serializable {
@ApiModelProperty(value = "临时签订单位联系人名称")
@Size(max = 50, message = "临时签订单位联系人名称长度不能大于50个字符")
private java.lang.String signedContactsTemporaryName;
/**是否开口(1为是,2为否)*/
@Excel(name = "是否开口(1为是,2为否)", width = 15)
@ApiModelProperty(value = "是否开口(1为是,2为否)")
/**是否开口(1为是,0为否)*/
@Excel(name = "是否开口(1为是,0为否)", width = 15)
@ApiModelProperty(value = "是否开口(1为是,0为否)")
@Max(2)
@Dict(dicCode = "yn")
private java.lang.Integer opening;
/**负责人id*/
@Excel(name = "负责人id", width = 15)
@@ -156,6 +158,7 @@ public class PayIncomeContract implements Serializable {
@Excel(name = "账款状态(1:未支付,2:部分支付,3:已付全款)", width = 15)
@ApiModelProperty(value = "账款状态(1:未支付,2:部分支付,3:已付全款)")
@Max(value = 3,message = "账款状态格式错误")
@Dict(dicCode = "revenue_contract_account_status")
private java.lang.Integer accountStatus;
/**合同约定付款次数*/
@Excel(name = "合同约定付款次数", width = 15)
@@ -164,6 +167,7 @@ public class PayIncomeContract implements Serializable {
/**是否打包(1:是,2:否)*/
@Excel(name = "是否打包(1:是,2:否)", width = 15)
@ApiModelProperty(value = "是否打包(1:是,2:否)")
@Dict(dicCode = "yn")
private java.lang.Integer pack;
/**打包年份*/
@Excel(name = "打包年份", width = 15)
@@ -172,6 +176,7 @@ public class PayIncomeContract implements Serializable {
/**合同状态(1:草稿,2:已通过,3:未通过,4:已归档)*/
@Excel(name = "合同状态(1:草稿,2:已通过,3:未通过,4:已归档)", width = 15)
@ApiModelProperty(value = "合同状态(1:草稿,2:已通过,3:未通过,4:已归档)")
@Dict(dicCode = "revenue_contract_status")
private java.lang.Integer status;
/**创建人*/
@ApiModelProperty(value = "创建人")
@@ -4,6 +4,7 @@ import java.io.Serializable;
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;
@@ -35,9 +36,10 @@ public class PayIncomeContractAudit implements Serializable {
@Excel(name = "合同id", width = 15)
@ApiModelProperty(value = "合同id")
private java.lang.String contractId;
/**合同状态(2:已通过,3:未通过,4:已归档)*/
@Excel(name = "合同状态(2:已通过,3:未通过,4:已归档)", width = 15)
@ApiModelProperty(value = "合同状态(2:已通过,3:未通过,4:已归档)")
/**合同状态(1:草稿,2:待审核,3:已通过,4:未通过,5:已归档)*/
@Excel(name = "合同状态(1:草稿,2:待审核,3:已通过,4:未通过,5:已归档)", width = 15)
@ApiModelProperty(value = "合同状态(1:草稿,2:待审核,3:已通过,4:未通过,5:已归档)")
@Dict(dicCode = "revenue_contract_status")
private java.lang.Integer contractStatus;
/**拒绝说明*/
@Excel(name = "拒绝说明", width = 15)
@@ -44,8 +44,8 @@ public class PayIncomeContractInstallment implements Serializable {
@ApiModelProperty(value = "应收金额")
private java.lang.String accountsReceivableAmount;
/**应收时间*/
@Excel(name = "应收时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "应收时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "应收时间")
private java.util.Date accountsReceivableTime;
@@ -54,8 +54,8 @@ public class PayIncomeContractInstallment implements Serializable {
@ApiModelProperty(value = "实收金额")
private java.lang.String paidAmount;
/**实收时间*/
@Excel(name = "实收时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "实收时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "实收时间")
private java.util.Date paidTime;
@@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.contract.entity.PayIncomeContract;
import com.jero.contract.vo.PayIncomeContractOutput;
import com.jero.contract.vo.ProjectOutput;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: pay_income_contract
* @Author: jeecg-boot
@@ -27,4 +30,15 @@ public interface PayIncomeContractMapper extends BaseMapper<PayIncomeContract> {
IPage<PayIncomeContractOutput> queryPageList(Page<PayIncomeContractOutput> page, @Param("payIncomeContract") PayIncomeContract payIncomeContract,
@Param("chargeStatus") String chargeStatus,@Param("projectName") String projectName,
@Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* @Description 关联项目列表
* @Author lqt
* @Date 2021/9/6
* @Param contractId 合同id
* @Return
* @Exception
*/
// todo 缺少会议,会员项目数据
List<ProjectOutput> getAssociated(@Param("contractId") String contractId);
}
@@ -75,4 +75,39 @@
</where>
GROUP BY pic.id ORDER BY pic.create_time desc
</select>
<select id="getAssociated" resultType="com.jero.contract.vo.ProjectOutput">
SELECT * FROM (
SELECT
pcp.id AS projectId,
'1' AS projectType,
pcp.charge_project AS chargeProject,
pcp.charge_use AS chargeUse,
pcp.charge_company_temporary_name AS chargeCompanyName,
pcp.receivable_amount AS receivableAmount,
pcp.paid_amount AS paidAmount,
pcp.principal_name AS principalName,
pcp.contacts_temporary_name AS contactsName,
pica.create_time AS createTime
FROM pay_income_contract_associated pica
JOIN pay_common_project pcp ON pica.project_id = pcp.id
WHERE pica.contract_id = #{contractId}
UNION ALL
SELECT
pwgs.id AS projectId,
'2' AS projectType,
pwg.working_group_project AS chargeProject,
'' AS chargeUse,
pwgs.charge_company_temporary_name AS chargeCompanyName,
pwgs.receivable_amount AS receivableAmount,
pwgs.paid_amount AS paidAmount,
pwg.principal_name_a AS principalName,
pwgs.contacts_temporary_name_one AS contactsName,
pica.create_time AS createTime
FROM pay_income_contract_associated pica
JOIN pay_working_group_subitem pwgs ON pica.project_id = pwgs.id
LEFT JOIN pay_working_group pwg ON pwgs.working_group_id = pwg.id
WHERE pica.contract_id = #{contractId}
) a
ORDER BY createTime,projectId DESC
</select>
</mapper>
@@ -42,6 +42,15 @@ public interface IPayIncomeContractService extends IService<PayIncomeContract> {
*/
void addPayIncomeContractInput(PayIncomeContractInput input);
/**
* @Description 关联项目列表
* @Author lqt
* @Date 2021/9/6
* @Param contractId 合同id
* @Return
* @Exception
*/
List<ProjectOutput> getAssociated(String contractId);
/**
* @Description 编辑
* @Author lqt
* @Date 2021/9/3
@@ -54,11 +63,11 @@ public interface IPayIncomeContractService extends IService<PayIncomeContract> {
* @Description 收入合同-关联
* @Author lqt
* @Date 2021/9/5
* @Param input 关联项目
* @Param list 关联项目
* @Return
* @Exception
*/
List<ProjectOutput> associated(PayIncomeContractAssociatedInput input);
List<ProjectOutput> associated(List<PayIncomeContractAssociated> listPayIncomeContractAssociated);
/**
* @Description 取消关联
* @Author lqt
@@ -90,11 +99,11 @@ public interface IPayIncomeContractService extends IService<PayIncomeContract> {
* @Description 归档
* @Author lqt
* @Date 2021/9/5
* @Param id 合同id
* @Param payIncomeContractAudit 审核记录
* @Return
* @Exception
*/
void updateArchive(String id);
void updateArchive(PayIncomeContractAudit payIncomeContractAudit);
/**
* @Description 删除
* @Author lqt
@@ -1,14 +1,12 @@
package com.jero.contract.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.ValidUtil;
import com.jero.contract.common.PayIncomeContractCommon;
import com.jero.contract.entity.PayIncomeContract;
@@ -20,7 +18,6 @@ import com.jero.contract.service.IPayIncomeContractAssociatedService;
import com.jero.contract.service.IPayIncomeContractAuditService;
import com.jero.contract.service.IPayIncomeContractInstallmentService;
import com.jero.contract.service.IPayIncomeContractService;
import com.jero.contract.vo.PayIncomeContractAssociatedInput;
import com.jero.contract.vo.PayIncomeContractInput;
import com.jero.contract.vo.PayIncomeContractOutput;
import com.jero.contract.vo.ProjectOutput;
@@ -39,12 +36,14 @@ 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.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -93,10 +92,7 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(input)){
throw new JeroBootException("收入合同信息不能为空!");
}
if(StringUtils.isBlank(input.getContract())){
throw new JeroBootException("收入合同信息不能为空!");
}
PayIncomeContract payIncomeContract = JSONObject.parseObject(input.getContract(),PayIncomeContract.class);
PayIncomeContract payIncomeContract = input.getContract();
if(Objects.isNull(payIncomeContract)){
throw new JeroBootException("收入合同信息不能为空!");
}
@@ -105,8 +101,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException(msgPayIncomeContract.toString());
}
List<PayIncomeContractInstallment> listPayIncomeContractInstallment = new ArrayList<>();
if(!StringUtils.isBlank(input.getInstallment())){
listPayIncomeContractInstallment = JSONArray.parseArray(input.getInstallment(),PayIncomeContractInstallment.class);
if(!CollectionUtils.isEmpty(input.getInstallment())){
listPayIncomeContractInstallment = input.getInstallment();
}
try {
LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>();
@@ -142,7 +138,6 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(!StringUtils.isBlank(sb)){
msgPayIncomeContractInstallment.append("").append(finalListPayIncomeContractInstallment.indexOf(p)).append("阶段:").append(sb);
}
});
payIncomeContractInstallmentService.saveBatch(listPayIncomeContractInstallment);
}
@@ -152,17 +147,19 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
// todo 缺少发送消息
}
@Override
public List<ProjectOutput> getAssociated(String contractId) {
return payIncomeContractMapper.getAssociated(contractId);
}
@Override
@Transactional
public void editPayIncomeContractInput(PayIncomeContractInput input) {
if(Objects.isNull(input)){
throw new JeroBootException("收入合同信息不能为空!");
}
if(StringUtils.isBlank(input.getContract())){
throw new JeroBootException("收入合同信息不能为空!");
}
PayIncomeContract payIncomeContract = JSONObject.parseObject(input.getContract(),PayIncomeContract.class);
if(Objects.isNull(payIncomeContract)){
PayIncomeContract payIncomeContract = input.getContract();
if(Objects.isNull(input.getContract())){
throw new JeroBootException("收入合同信息不能为空!");
}
StringBuilder msgPayIncomeContract = ValidUtil.validateAll(payIncomeContract);
@@ -181,8 +178,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("收入合同不可编辑!");
}
List<PayIncomeContractInstallment> listPayIncomeContractInstallment = new ArrayList<>();
if(!StringUtils.isBlank(input.getInstallment())){
listPayIncomeContractInstallment = JSONArray.parseArray(input.getInstallment(),PayIncomeContractInstallment.class);
if(!CollectionUtils.isEmpty(input.getInstallment())){
listPayIncomeContractInstallment = input.getInstallment();
}
try {
LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>();
@@ -236,14 +233,11 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
@Override
@Transactional
public List<ProjectOutput> associated(PayIncomeContractAssociatedInput input) {
if(StringUtils.isBlank(input.getAssociated())){
throw new JeroBootException("关联项目不能为空!");
}
List<PayIncomeContractAssociated> listPayIncomeContractAssociated = JSONArray.parseArray(input.getAssociated(),PayIncomeContractAssociated.class);
public List<ProjectOutput> associated(List<PayIncomeContractAssociated> listPayIncomeContractAssociated) {
if(CollectionUtils.isEmpty(listPayIncomeContractAssociated)){
throw new JeroBootException("关联项目不能为空!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProjectOutput> listProjectOutput = new ArrayList<>();
listPayIncomeContractAssociated.forEach(p->{
ProjectOutput projectOutput = new ProjectOutput();
@@ -255,13 +249,7 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payIncomeContract)){
throw new JeroBootException("合同不存在!");
}
LambdaQueryWrapper<PayIncomeContractAssociated> queryPayIncomeContractAssociated = new LambdaQueryWrapper<>();
queryPayIncomeContractAssociated.eq(PayIncomeContractAssociated::getContractId,p.getContractId());
queryPayIncomeContractAssociated.eq(PayIncomeContractAssociated::getProjectId,p.getProjectId());
List<PayIncomeContractAssociated> listPayIncomeContractAssociatedNew = payIncomeContractAssociatedService.list(queryPayIncomeContractAssociated);
if(!CollectionUtils.isEmpty(listPayIncomeContractAssociatedNew)){
throw new JeroBootException("项目已被其他合同关联!");
}
// 查看项目类型
switch (String.valueOf(p.getProjectType())){
case PayIncomeContractCommon.PROJECT_TYPE1:
@@ -271,11 +259,19 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payCommonProject)){
throw new JeroBootException("项目不存在!");
}
// 验证企业是否正确
if(!Objects.equals(payCommonProject.getChargeCompanyId(),payIncomeContract.getSignedCompanyId())){
throw new JeroBootException("企业不匹配!");
}
// 验证项目是否已被关联
getIncomeContractAssociated(p.getContractId(),p.getProjectId());
// 合同选择打包,运行年份不是打包企业,添加打包企业
if(Objects.equals(payIncomeContract.getPack(),PayIncomeContractCommon.PACK1)){
LambdaUpdateWrapper<PayCommonProject> updatePayCommonProject = new LambdaUpdateWrapper<>();
updatePayCommonProject.eq(PayCommonProject::getPack,PayIncomeContractCommon.PACK1);
updatePayCommonProject.eq(PayCommonProject::getId,p.getProjectId());
updatePayCommonProject.set(PayCommonProject::getPack,PayIncomeContractCommon.PACK1);
updatePayCommonProject.set(PayCommonProject::getUpdateBy,sysUser.getUsername());
updatePayCommonProject.set(PayCommonProject::getUpdateTime,new Date());
payCommonProjectService.update(updatePayCommonProject);
// todo 添加打包企业
}
@@ -301,13 +297,25 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){
throw new JeroBootException("工作组成员单位不存在!");
}
// 验证企业是否正确
if(!Objects.equals(listPayWorkingGroupSubItem.get(0).getChargeCompanyId(),payIncomeContract.getSignedCompanyId())){
throw new JeroBootException("企业不匹配!");
}
// 验证项目是否已被关联
getIncomeContractAssociated(p.getContractId(),listPayWorkingGroupSubItem.get(0).getId());
// 合同选择打包,运行年份不是打包企业,添加打包企业
if(Objects.equals(payIncomeContract.getPack(),PayIncomeContractCommon.PACK1)){
// 打包,将关联项目设置成打包
LambdaUpdateWrapper<PayWorkingGroupSubItem> updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>();
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateBy,sysUser.getUsername());
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateTime,new Date());
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getPack,PayIncomeContractCommon.PACK1);
updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId,listPayWorkingGroupSubItem.get(0).getId());
payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem);
// todo 添加打包企业
}
// 更新项目id
p.setProjectId(listPayWorkingGroupSubItem.get(0).getId());
// 打包,将关联项目设置成打包
LambdaUpdateWrapper<PayWorkingGroupSubItem> updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>();
updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getPack,PayIncomeContractCommon.PACK1);
updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId,listPayWorkingGroupSubItem.get(0).getId());
payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem);
projectOutput.setProjectId(listPayWorkingGroupSubItem.get(0).getId());
projectOutput.setProjectType(PayIncomeContractCommon.PROJECT_TYPE2);
projectOutput.setChargeProject(payWorkingGroup.getWorkingGroupProject());
@@ -330,6 +338,28 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
});
return listProjectOutput;
}
/**
* @Description 验证项目是否被合同关联
* @Author lqt
* @Date 2021/9/6
* @Param contractId 合同id
* @Param projectId 项目id
* @Return
* @Exception
*/
private void getIncomeContractAssociated(String contractId,String projectId){
LambdaQueryWrapper<PayIncomeContractAssociated> query = new LambdaQueryWrapper<>();
query.eq(PayIncomeContractAssociated::getProjectId,projectId);
List<PayIncomeContractAssociated> list = payIncomeContractAssociatedService.list(query);
if(!CollectionUtils.isEmpty(list)){
List<PayIncomeContractAssociated> listNew = list.stream().filter(p->Objects.equals(p.getContractId(),contractId)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listNew)){
throw new JeroBootException("项目已关联!");
}
throw new JeroBootException("项目已被其他合同关联!");
}
}
@Override
@Transactional
@@ -338,6 +368,7 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payIncomeContract)){
throw new JeroBootException("合同不存在!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// 查看项目类型
switch (String.valueOf(payIncomeContractAssociated.getProjectType())){
case PayIncomeContractCommon.PROJECT_TYPE1:
@@ -347,10 +378,12 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payCommonProject)){
throw new JeroBootException("项目不存在!");
}
// 将关联项目取消打包
if(Objects.equals(payIncomeContract.getPack(),PayIncomeContractCommon.PACK1)){
// todo 缺少查询项目是否为打包企业,是:保持不变,不是:取消打包 将关联项目取消打包
if(Objects.equals(payIncomeContract.getPack(),PayIncomeContractCommon.PACK1) ){
LambdaUpdateWrapper<PayCommonProject> updatePayCommonProject = new LambdaUpdateWrapper<>();
updatePayCommonProject.eq(PayCommonProject::getPack,PayIncomeContractCommon.PACK0);
updatePayCommonProject.set(PayCommonProject::getUpdateBy,sysUser.getUsername());
updatePayCommonProject.set(PayCommonProject::getUpdateTime,new Date());
updatePayCommonProject.set(PayCommonProject::getPack,PayIncomeContractCommon.PACK0);
updatePayCommonProject.eq(PayCommonProject::getId,payIncomeContractAssociated.getProjectId());
payCommonProjectService.update(updatePayCommonProject);
}
@@ -370,9 +403,11 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
}
// 更新项目id
payIncomeContractAssociated.setProjectId(listPayWorkingGroupSubItem.get(0).getId());
// 将关联项目取消打包
// todo 不是打包企业 取消打包 将关联项目取消打包
LambdaUpdateWrapper<PayWorkingGroupSubItem> updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>();
updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getPack,PayIncomeContractCommon.PACK0);
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateBy,sysUser.getUsername());
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateTime,new Date());
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getPack,PayIncomeContractCommon.PACK0);
updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId,listPayWorkingGroupSubItem.get(0).getId());
payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem);
break;
@@ -384,15 +419,12 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
break;
default:break;
}
payIncomeContractAssociatedService.save(payIncomeContractAssociated);
payIncomeContractAssociatedService.removeById(payIncomeContractAssociated.getId());
}
@Override
public void submitAudit(PayIncomeContract payIncomeContract) {
StringBuilder msgPayIncomeContractAudit = ValidUtil.validateAll(payIncomeContract);
if(!StringUtils.isBlank(msgPayIncomeContractAudit)){
throw new JeroBootException(msgPayIncomeContractAudit.toString());
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(StringUtils.isBlank(payIncomeContract.getId())){
throw new JeroBootException("合同id不能为空!");
}
@@ -400,9 +432,17 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payIncomeContractNew)){
throw new JeroBootException("合同不存在!");
}
// 验证合同状态是否为草稿或者未通过
if(!Objects.equals(payIncomeContract.getStatus(),PayIncomeContractCommon.STATUS2)
|| (!Objects.equals(payIncomeContractNew.getStatus(),PayIncomeContractCommon.STATUS1)
&& !Objects.equals(payIncomeContractNew.getStatus(),PayIncomeContractCommon.STATUS4))){
throw new JeroBootException("收入合同审核状态不正确!");
}
LambdaUpdateWrapper<PayIncomeContract> updatePayIncomeContract = new LambdaUpdateWrapper<>();
updatePayIncomeContract.set(PayIncomeContract::getUpdateBy,sysUser.getUsername());
updatePayIncomeContract.set(PayIncomeContract::getUpdateTime,new Date());
updatePayIncomeContract.eq(PayIncomeContract::getId,payIncomeContract.getId());
updatePayIncomeContract.eq(PayIncomeContract::getStatus,PayIncomeContractCommon.STATUS3);
updatePayIncomeContract.set(PayIncomeContract::getStatus,PayIncomeContractCommon.STATUS2);
payIncomeContractService.update(updatePayIncomeContract);
}
@@ -446,21 +486,25 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("收入合同不存在!");
}
// 校验合同状态是否为待审核
if(!Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS2)){
throw new JeroBootException("收入合同不可审核!");
}
if(Objects.isNull(payIncomeContractAudit.getContractStatus()) ||
(!Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS3)
&& !Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS4))){
throw new JeroBootException("收入合同审核状态不正确!");
if(Objects.isNull(payIncomeContractAudit.getContractStatus()) || !Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS2)
|| (!Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS3) && !Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS4))){
throw new JeroBootException("收入合同状态不正确!");
}
if(Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS4)
&& StringUtils.isBlank(payIncomeContractAudit.getExplainRemarks())){
throw new JeroBootException("请输入拒绝说明!");
}
if(Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS3)){
payIncomeContractAudit.setExplainRemarks("");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
LambdaUpdateWrapper<PayIncomeContract> update = new LambdaUpdateWrapper();
update.set(PayIncomeContract::getUpdateBy,sysUser.getUsername());
update.set(PayIncomeContract::getUpdateTime,new Date());
update.eq(PayIncomeContract::getId,payIncomeContractAudit.getContractId());
update.eq(PayIncomeContract::getStatus, payIncomeContractAudit.getContractStatus());
update.set(PayIncomeContract::getStatus, payIncomeContractAudit.getContractStatus());
payIncomeContractService.update(update);
// 添加审核记录
payIncomeContractAuditService.save(payIncomeContractAudit);
@@ -468,8 +512,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
@Override
@Transactional
public void updateArchive(String id) {
PayIncomeContract payIncomeContractStatus = payIncomeContractService.getById(id);
public void updateArchive(PayIncomeContractAudit payIncomeContractAudit) {
PayIncomeContract payIncomeContractStatus = payIncomeContractService.getById(payIncomeContractAudit.getContractId());
if(Objects.isNull(payIncomeContractStatus)){
throw new JeroBootException("收入合同不存在!");
}
@@ -477,13 +521,17 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(!Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS3)){
throw new JeroBootException("收入合同不可归档!");
}
if(Objects.isNull(payIncomeContractAudit.getContractStatus()) || !Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS5)){
throw new JeroBootException("收入合同状态不正确!");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
LambdaUpdateWrapper<PayIncomeContract> update = new LambdaUpdateWrapper();
update.eq(PayIncomeContract::getId,id);
update.eq(PayIncomeContract::getStatus, PayIncomeContractCommon.STATUS5);
update.set(PayIncomeContract::getUpdateBy,sysUser.getUsername());
update.set(PayIncomeContract::getUpdateTime,new Date());
update.eq(PayIncomeContract::getId,payIncomeContractAudit.getContractId());
update.set(PayIncomeContract::getStatus, PayIncomeContractCommon.STATUS5);
payIncomeContractService.update(update);
// 添加归档记录
PayIncomeContractAudit payIncomeContractAudit = new PayIncomeContractAudit();
payIncomeContractAudit.setContractId(id);
payIncomeContractAudit.setContractStatus(PayIncomeContractCommon.STATUS5);
payIncomeContractAuditService.save(payIncomeContractAudit);
}
@@ -0,0 +1,14 @@
package com.jero.contract.vo;
import com.jero.contract.entity.PayIncomeContractAudit;
import lombok.Data;
import java.io.Serializable;
@Data
public class PayIncomeContractAuditOutput extends PayIncomeContractAudit implements Serializable {
/**
* 合同状态(1:草稿,2:待审核,3:已通过,4:未通过,5:已归档)
*/
private String contractStatus_dictText;
}
@@ -11,6 +11,23 @@ import java.util.List;
@Data
public class PayIncomeContractDetailOutput extends PayIncomeContract implements Serializable {
/**
* 是否开口(1为是,0为否)
*/
private String opening_dictText;
/**
* 账款状态(1:未支付,2:部分支付,3:已付全款)
*/
private String accountStatus_dictText;
/**
* 是否打包(1:是,2:否)
*/
private String pack_dictText;
/**
* 合同状态(1:草稿,2:已通过,3:未通过,4:已归档)
*/
private String contractStatus_dictText;
/**
* 分期记录
*/
@@ -25,10 +42,10 @@ public class PayIncomeContractDetailOutput extends PayIncomeContract implements
* 归档记录
*/
@ApiModelProperty(value = "归档记录")
private List<PayIncomeContractAudit> listArchive;
private List<PayIncomeContractAuditOutput> listArchive;
/**
* 审核记录
*/
@ApiModelProperty(value = "审核记录")
private List<PayIncomeContractAudit> listAudit;
private List<PayIncomeContractAuditOutput> listAudit;
}
@@ -1,9 +1,12 @@
package com.jero.contract.vo;
import com.jero.contract.entity.PayIncomeContract;
import com.jero.contract.entity.PayIncomeContractInstallment;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class PayIncomeContractInput implements Serializable {
@@ -11,10 +14,10 @@ public class PayIncomeContractInput implements Serializable {
* 合同数据
*/
@ApiModelProperty(value = "合同数据")
private String contract;
private PayIncomeContract contract;
/**
* 分期信息
*/
@ApiModelProperty(value = "分期信息")
private String installment;
private List<PayIncomeContractInstallment> installment;
}
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@ApiModel(value="关联项目", description="关联项目")
@@ -30,6 +31,11 @@ public class ProjectOutput implements Serializable {
*/
@ApiModelProperty(value = "来款用途")
private String chargeUse;
/**
* 来款用途
*/
@ApiModelProperty(value = "来款用途")
private String chargeUse_dictText;
/**
* 来款单位
*/
@@ -59,5 +65,5 @@ public class ProjectOutput implements Serializable {
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private String createTime;
private Date createTime;
}
@@ -1,7 +1,10 @@
package com.jero.meeting.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -14,6 +17,7 @@ import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.PasswordUtil;
import com.jero.common.util.ValidUtil;
import com.jero.common.util.oConvertUtils;
import com.jero.meeting.common.MeetingCommon;
import com.jero.meeting.entity.PayMeeting;
import com.jero.meeting.entity.PayMeetingHotelContacts;
@@ -24,8 +28,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.meeting.vo.PayMeetingVO;
import com.jero.modules.system.volid.group.UpdateGroup;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.service.IPayWorkingGroupService;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.poi.ss.formula.functions.T;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -34,160 +45,229 @@ import io.swagger.annotations.ApiOperation;
import com.jero.common.aspect.annotation.AutoLog;
/**
/**
* @description: 会议管理
* @author: jero-boot
* @date: 2021-09-02
* @date: 2021-09-02
* @version: V1.0
*/
@Api(tags="会议管理")
@Api(tags = "会议管理")
@RestController
@RequestMapping("/meeting/payMeeting")
@Slf4j
public class PayMeetingController extends JeroController<PayMeeting, IPayMeetingService> {
@Resource
private IPayMeetingService payMeetingService;
@Resource
private ISysBaseAPI sysBaseApi;
@Resource
private IPayMeetingHotelContactsService meetingHotelContactsService;
/**
* 分页列表查询
*/
@AutoLog(value = "会议管理-分页列表查询")
@ApiOperation(value="会议管理-分页列表查询", notes="会议管理-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(PayMeeting payMeeting,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<PayMeeting> queryWrapper = QueryGenerator.initQueryWrapper(payMeeting, req.getParameterMap());
Page<PayMeeting> page = new Page<>(pageNo, pageSize);
IPage<PayMeeting> pageList = payMeetingService.page(page, queryWrapper);
for (PayMeeting meeting : pageList.getRecords()) {
//查询会议负责人
LoginUser user = sysBaseApi.getUserById(meeting.getDirectorId());
meeting.setDirectorName(user.getUsername());
meeting.setDirectorPhone(PasswordUtil.decrypt(user.getPhone()));
PayMeetingVO payMeetingVO = new PayMeetingVO();
BeanUtils.copyProperties(payMeetingVO,payMeeting);
//查询酒店联系人列表
if (meeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
LambdaQueryWrapper<PayMeetingHotelContacts> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingHotelContacts::getMeetingId,meeting.getId());
List<PayMeetingHotelContacts> payMeetingHotelContactsList = meetingHotelContactsService.list(wrapper);
meeting.setHotelContactsList(payMeetingHotelContactsList);
}
}
return Result.OK(pageList);
}
@Resource
private IPayMeetingService payMeetingService;
@Resource
private ISysBaseAPI sysBaseApi;
@Resource
private IPayMeetingHotelContactsService meetingHotelContactsService;
@Resource
private IPayWorkingGroupService payWorkingGroupService;
/**
* 列表查询
*/
@AutoLog(value = "会议管理-列表查询")
@ApiOperation(value="会议管理-列表查询", notes="会议管理-列表查询")
@GetMapping(value = "/list")
public Result<List<PayMeeting>> queryList() {
* 分页列表查询
*/
@AutoLog(value = "会议管理-分页列表查询")
@ApiOperation(value = "会议管理-分页列表查询", notes = "会议管理-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(PayMeeting payMeeting,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<PayMeeting> queryWrapper = QueryGenerator.initQueryWrapper(payMeeting, req.getParameterMap());
Page<PayMeeting> page = new Page<>(pageNo, pageSize);
IPage<PayMeeting> pageList = payMeetingService.page(page, queryWrapper);
for (PayMeeting meeting : pageList.getRecords()) {
//查询会议负责人
LoginUser user = sysBaseApi.getUserById(meeting.getDirectorId());
meeting.setDirectorName(user.getUsername());
meeting.setDirectorPhone(PasswordUtil.decrypt(user.getPhone()));
PayMeetingVO payMeetingVO = new PayMeetingVO();
BeanUtils.copyProperties(payMeetingVO, payMeeting);
//查询酒店联系人列表
if (meeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
LambdaQueryWrapper<PayMeetingHotelContacts> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingHotelContacts::getMeetingId, meeting.getId());
List<PayMeetingHotelContacts> payMeetingHotelContactsList = meetingHotelContactsService.list(wrapper);
meeting.setHotelContactsList(payMeetingHotelContactsList);
}
}
return Result.OK(pageList);
}
/**
* 列表查询
*/
@AutoLog(value = "会议管理-列表查询")
@ApiOperation(value = "会议管理-列表查询", notes = "会议管理-列表查询")
@GetMapping(value = "/list")
public Result<List<PayMeeting>> queryList() {
List<PayMeeting> list = payMeetingService.queryList();
return Result.OK(list);
}
/**
* 添加
*/
@AutoLog(value = "会议管理-添加")
@ApiOperation(value="会议管理-添加", notes="会议管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody PayMeetingVO payMeetingVO) {
ValidUtil.validate(payMeetingVO);
payMeetingService.add(payMeetingVO);
return Result.OK("添加成功!");
}
/**
* 编辑
*/
@AutoLog(value = "会议管理-编辑")
@ApiOperation(value="会议管理-编辑", notes="会议管理-编辑")
@PostMapping(value = "/edit")
public Result<?> edit(@RequestBody PayMeetingVO payMeetingVO) {
ValidUtil.validate(payMeetingVO, UpdateGroup.class);
payMeetingService.editById(payMeetingVO);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*/
@AutoLog(value = "会议管理-通过id删除")
@ApiOperation(value="会议管理-通过id删除", notes="会议管理-通过id删除")
@GetMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id") String id) {
payMeetingService.deleteById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*/
@AutoLog(value = "会议管理-批量删除")
@ApiOperation(value="会议管理-批量删除", notes="会议管理-批量删除")
@GetMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids") String ids) {
this.payMeetingService.deleteByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*/
@AutoLog(value = "会议管理-通过id查询")
@ApiOperation(value="会议管理-通过id查询", notes="会议管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id") String id) {
PayMeeting payMeeting = payMeetingService.queryById(id);
if(payMeeting==null) {
return Result.error("未找到对应数据");
}
//查询会议负责人
LoginUser user = sysBaseApi.getUserById(payMeeting.getDirectorId());
payMeeting.setDirectorName(user.getUsername());
payMeeting.setDirectorPhone(PasswordUtil.decrypt(user.getPhone()));
PayMeetingVO payMeetingVO = new PayMeetingVO();
BeanUtils.copyProperties(payMeetingVO,payMeeting);
//查询酒店联系人列表
LambdaQueryWrapper<PayMeetingHotelContacts> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingHotelContacts::getMeetingId,payMeeting.getId());
List<PayMeetingHotelContacts> payMeetingHotelContactsList = meetingHotelContactsService.list(wrapper);
payMeeting.setHotelContactsList(payMeetingHotelContactsList);
return Result.OK(payMeeting);
}
}
/**
* 导出excel
*/
* 添加
*/
@AutoLog(value = "会议管理-添加")
@ApiOperation(value = "会议管理-添加", notes = "会议管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody PayMeetingVO payMeetingVO) {
ValidUtil.validate(payMeetingVO);
payMeetingService.add(payMeetingVO);
return Result.OK("添加成功!");
}
/**
* 编辑
*/
@AutoLog(value = "会议管理-编辑")
@ApiOperation(value = "会议管理-编辑", notes = "会议管理-编辑")
@PostMapping(value = "/edit")
public Result<?> edit(@RequestBody PayMeetingVO payMeetingVO) {
ValidUtil.validate(payMeetingVO, UpdateGroup.class);
payMeetingService.editById(payMeetingVO);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*/
@AutoLog(value = "会议管理-通过id删除")
@ApiOperation(value = "会议管理-通过id删除", notes = "会议管理-通过id删除")
@GetMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id") String id) {
payMeetingService.deleteById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*/
@AutoLog(value = "会议管理-批量删除")
@ApiOperation(value = "会议管理-批量删除", notes = "会议管理-批量删除")
@GetMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name = "ids") String ids) {
this.payMeetingService.deleteByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*/
@AutoLog(value = "会议管理-通过id查询")
@ApiOperation(value = "会议管理-通过id查询", notes = "会议管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name = "id") String id) {
PayMeeting meeting = payMeetingService.queryById(id);
if (meeting == null) {
return Result.error("未找到对应数据");
}
//查询会议负责人
LoginUser user = sysBaseApi.getUserById(meeting.getDirectorId());
meeting.setDirectorName(user.getUsername());
meeting.setDirectorPhone(PasswordUtil.decrypt(user.getPhone()));
PayMeetingVO payMeetingVO = new PayMeetingVO();
BeanUtils.copyProperties(meeting, payMeetingVO);
String meetingType = meeting.getMeetingType().toString();
//String meetingType1 = sysBaseApi.translateDict("meeting_type", meetingType);
payMeetingVO.setMeetingType(meetingType);
payMeetingVO.setTbMeetingType(meeting.getMeetingType().toString());
//payMeetingVO.setHotelContactsList(new ArrayList<>());
//标协会议查询酒店联系人列表
if (meetingType.equals(MeetingCommon.STANDARD_MEETING)) {
LambdaQueryWrapper<PayMeetingHotelContacts> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingHotelContacts::getMeetingId, meeting.getId());
List<PayMeetingHotelContacts> payMeetingHotelContactsList = meetingHotelContactsService.list(wrapper);
payMeetingVO.setHotelContactsList(payMeetingHotelContactsList);
//标协会议类型
//String tbMeetingType = meeting.getTbMeetingType().toString();
//String type = sysBaseApi.translateDict("standard_meeting_type", tbMeetingType);
//payMeetingVO.setTbMeetingType(type);
// 工作组项目查询工作组项目名
} else if (meetingType.equals(MeetingCommon.WORKING_GROUP_MEETING)) {
String workingGroupId = meeting.getWorkingGroupId();
PayWorkingGroup workingGroup = payWorkingGroupService.getById(workingGroupId);
payMeetingVO.setWorkingGroupName(workingGroup.getWorkingGroupProject());
}
return Result.OK(payMeetingVO);
}
/**
* 导出excel
*/
@GetMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, PayMeeting payMeeting) {
return super.exportXls(request, payMeeting, PayMeeting.class, "会议管理");
QueryWrapper<PayMeeting> queryWrapper = QueryGenerator.initQueryWrapper(payMeeting, request.getParameterMap());
List<PayMeeting> pageList = payMeetingService.list(queryWrapper);
List<PayMeetingVO> exportList = new ArrayList<>();
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
pageList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
}
for (PayMeeting meeting : pageList) {
//查询会议负责人
LoginUser user = sysBaseApi.getUserById(meeting.getDirectorId());
meeting.setDirectorName(user.getUsername());
meeting.setDirectorPhone(PasswordUtil.decrypt(user.getPhone()));
PayMeetingVO payMeetingVO = new PayMeetingVO();
BeanUtils.copyProperties(meeting, payMeetingVO);
String meetingType = meeting.getMeetingType().toString();
String meetingType1 = sysBaseApi.translateDict("meeting_type", meetingType);
payMeetingVO.setMeetingType(meetingType1);
payMeetingVO.setHotelContactsList(new ArrayList<>());
//标协会议查询酒店联系人列表
if (meetingType.equals(MeetingCommon.STANDARD_MEETING)) {
LambdaQueryWrapper<PayMeetingHotelContacts> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingHotelContacts::getMeetingId, meeting.getId());
List<PayMeetingHotelContacts> payMeetingHotelContactsList = meetingHotelContactsService.list(wrapper);
payMeetingVO.setHotelContactsList(payMeetingHotelContactsList);
//标协会议类型
String tbMeetingType = meeting.getTbMeetingType().toString();
String type = sysBaseApi.translateDict("standard_meeting_type", tbMeetingType);
payMeetingVO.setTbMeetingType(type);
// 工作组项目查询工作组项目名
} else if (meetingType.equals(MeetingCommon.WORKING_GROUP_MEETING)) {
String workingGroupId = meeting.getWorkingGroupId();
PayWorkingGroup workingGroup = payWorkingGroupService.getById(workingGroupId);
payMeetingVO.setWorkingGroupName(workingGroup.getWorkingGroupProject());
}
exportList.add(payMeetingVO);
}
return super.exportListXls(exportList, PayMeetingVO.class, "会议管理");
}
/**
* 导出excel模板
*/
* 导出excel模板
*/
@GetMapping(value = "/exportTemplate")
public ModelAndView exportTemplate() {
return super.exportTemplate(PayMeeting.class, "会议管理");
return super.exportTemplate(PayMeetingVO.class, "会议管理");
}
/**
* 通过excel导入数据
*/
* 通过excel导入数据
*/
@PostMapping(value = "/importExcel")
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, PayMeeting.class);
}
/**
* 获取对象ID
*
* @return
*/
private String getId(PayMeeting item) {
try {
return PropertyUtils.getProperty(item, "id").toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
@@ -35,7 +35,6 @@ public class PayMeetingHotelContacts implements Serializable {
private String id;
/**会议id*/
@Excel(name = "会议id", width = 15)
@ApiModelProperty(value = "会议id")
private String meetingId;
@@ -16,6 +16,8 @@ import com.jero.meeting.valid.group.InternationalMeeting;
import com.jero.meeting.valid.group.StandardMeeting;
import com.jero.meeting.valid.group.WorkingGroupMeeting;
import com.jero.meeting.vo.PayMeetingVO;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.service.IPayWorkingGroupService;
import org.apache.shiro.util.CollectionUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
@@ -23,6 +25,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -42,7 +45,8 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
private ISysBaseAPI sysBaseApi;
@Resource
private IPayMeetingHotelContactsService meetingHotelContactsService;
@Resource
private IPayWorkingGroupService payWorkingGroupService;
/**
* 新增会议
*/
@@ -118,39 +122,55 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
}
//根据会议类型进行校验
if (meetingType.equals(MeetingCommon.WORKING_GROUP_MEETING)){
ValidUtil.validate(payMeetingVO, WorkingGroupMeeting.class);
}else if (meetingType.equals(MeetingCommon.STANDARD_MEETING)){
ValidUtil.validate(payMeetingVO, StandardMeeting.class);
hotelContactsList = payMeetingVO.getHotelContactsList();
for (PayMeetingHotelContacts hotelContacts : hotelContactsList) {
ValidUtil.validate(hotelContacts, StandardMeeting.class);
}
}else if (meetingType.equals(MeetingCommon.INTERNATIONAL_MEETING)){
ValidUtil.validate(payMeetingVO, InternationalMeeting.class);
//邀请码不能有重复的
List<String> codeList = new ArrayList<>();
//VIP邀请码
String vipInvitationCode = payMeetingVO.getVipInvitationCode();
codeList.add(vipInvitationCode);
//演讲嘉宾邀请码
String speakerInvitationCode = payMeetingVO.getSpeakerInvitationCode();
if (codeList.contains(speakerInvitationCode)) {
throw new JeroBootException("邀请码不能重复");
}
codeList.add(speakerInvitationCode);
//特邀嘉宾邀请码
String guestInvitationCode = payMeetingVO.getGuestInvitationCode();
if (codeList.contains(guestInvitationCode)) {
throw new JeroBootException("邀请码不能重复");
}
codeList.add(guestInvitationCode);
//合作伙伴邀请码
String cooperativeInvitationCode = payMeetingVO.getCooperativeInvitationCode();
if (codeList.contains(cooperativeInvitationCode)) {
throw new JeroBootException("邀请码不能重复");
}
codeList.add(cooperativeInvitationCode);
switch (meetingType) {
case MeetingCommon.WORKING_GROUP_MEETING:
ValidUtil.validate(payMeetingVO, WorkingGroupMeeting.class);
String workingGroupId = payMeetingVO.getWorkingGroupId();
PayWorkingGroup workingGroup = payWorkingGroupService.getById(workingGroupId);
if (workingGroup == null){
throw new JeroBootException("工作组项目不存在");
}
break;
case MeetingCommon.STANDARD_MEETING:
ValidUtil.validate(payMeetingVO, StandardMeeting.class);
//标协会议类型
Map<String, String> standardMeetingType = sysBaseApi.queryDictItemsMapByCode("standard_meeting_type");
String tbMeetingType = payMeetingVO.getTbMeetingType();
if (!standardMeetingType.containsKey(tbMeetingType)){
throw new JeroBootException("标协会议类型不存在");
}
hotelContactsList = payMeetingVO.getHotelContactsList();
for (PayMeetingHotelContacts hotelContacts : hotelContactsList) {
ValidUtil.validate(hotelContacts, StandardMeeting.class);
}
break;
case MeetingCommon.INTERNATIONAL_MEETING:
ValidUtil.validate(payMeetingVO, InternationalMeeting.class);
//邀请码不能重复
List<String> codeList = new ArrayList<>();
//VIP邀请码
String vipInvitationCode = payMeetingVO.getVipInvitationCode();
codeList.add(vipInvitationCode);
//演讲嘉宾邀请码
String speakerInvitationCode = payMeetingVO.getSpeakerInvitationCode();
if (codeList.contains(speakerInvitationCode)) {
throw new JeroBootException("邀请码不能重复");
}
codeList.add(speakerInvitationCode);
//特邀嘉宾邀请码
String guestInvitationCode = payMeetingVO.getGuestInvitationCode();
if (codeList.contains(guestInvitationCode)) {
throw new JeroBootException("邀请码不能重复");
}
codeList.add(guestInvitationCode);
//合作伙伴邀请码
String cooperativeInvitationCode = payMeetingVO.getCooperativeInvitationCode();
if (codeList.contains(cooperativeInvitationCode)) {
throw new JeroBootException("邀请码不能重复");
}
codeList.add(cooperativeInvitationCode);
break;
default:
}
@@ -1,6 +1,7 @@
package com.jero.meeting.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.util.PasswordUtil;
import com.jero.meeting.entity.PayMeetingHotelContacts;
import com.jero.meeting.valid.group.InternationalMeeting;
import com.jero.meeting.valid.group.StandardMeeting;
@@ -10,6 +11,7 @@ import io.swagger.annotations.ApiModel;
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;
@@ -43,24 +45,24 @@ public class PayMeetingVO implements Serializable {
private String meetingName;
/**会议类型*/
@Excel(name = "会议类型", width = 15,dicCode = "meeting_type")
@Excel(name = "会议类型", width = 15)
@ApiModelProperty(value = "会议类型")
@NotBlank(message = "会议类型不能为空")
private String meetingType;
/**标协会议类型*/
@Excel(name = "标协会议类型", width = 15,dicCode = "standard_meeting_type")
@Excel(name = "标协会议类型", width = 15)
@ApiModelProperty(value = "标协会议类型")
@NotBlank(message = "标协会议类型不能为空", groups = StandardMeeting.class)
private String tbMeetingType;
/**工作组项目id*/
@Excel(name = "工作组项目名称", width = 15, dictTable = "pay_working_group",dicText = "working_group_project",dicCode = "id")
@ApiModelProperty(value = "工作组项目id")
@NotBlank(message = "工作组项目名称不能为空", groups = WorkingGroupMeeting.class)
private String workingGroupId;
/**工作组项目名称*/
@Excel(name = "工作组项目名称", width = 15)
@ApiModelProperty(value = "工作组项目名称")
private String workingGroupName;
@@ -185,17 +187,17 @@ public class PayMeetingVO implements Serializable {
private Integer meetingCostsVip;
/**会议负责人id*/
@Excel(name = "会议负责人", width = 15,dictTable = "sys_user",dicText = "username",dicCode = "id")
@ApiModelProperty(value = "会议负责人id")
@NotBlank(message = "会议负责人不能为空")
private String directorId;
/**会议负责人*/
@Excel(name = "会议负责人", width = 15)
@ApiModelProperty(value = "会议负责人")
private String directorName;
/**会议负责人手机号*/
@Excel(name = "会议负责人手机号", width = 15,exportConvert = true)
@Excel(name = "会议负责人手机号", width = 15)
@ApiModelProperty(value = "会议负责人手机号")
private String directorPhone;
@@ -216,6 +218,7 @@ public class PayMeetingVO implements Serializable {
/**
* 会议关联酒店联系人列表
*/
@ExcelCollection(name = "酒店联系人列表")
@NotNull(message = "酒店联系人不能为空",groups = StandardMeeting.class)
@Size(max = 5, message = "酒店联系人最多为5个",groups = StandardMeeting.class)
private List<PayMeetingHotelContacts> hotelContactsList;
@@ -1,5 +1,6 @@
package com.jero.member.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.ValidUtil;
import com.jero.company.entity.PayContactsManagement;
@@ -54,6 +55,14 @@ public class PayPayMemberProjectSubitemServiceImpl extends ServiceImpl<PayMember
if (memberProject == null){
throw new JeroBootException("会员项目不存在");
}
String companyId = payMemberProjectSubitem.getCompanyId();
LambdaQueryWrapper<PayMemberProjectSubitem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMemberProjectSubitem::getProjectId,projectId);
wrapper.eq(PayMemberProjectSubitem::getCompanyId,companyId);
int count = count(wrapper);
if (count>0){
throw new JeroBootException("会员单位已经存在");
}
validMemberProjectSubitem(payMemberProjectSubitem);
//实收金额
payMemberProjectSubitem.setPaidAmount(0);
@@ -80,7 +89,7 @@ public class PayPayMemberProjectSubitemServiceImpl extends ServiceImpl<PayMember
}
//无法更改状态
payMemberProjectSubitem.setPack(payMemberProjectSubitem1.getPack());
payMemberProjectSubitem.setNeedInvoice(payMemberProjectSubitem1.getNeedInvoice());
//payMemberProjectSubitem.setNeedInvoice(payMemberProjectSubitem1.getNeedInvoice());
payMemberProjectSubitem.setInAccount(payMemberProjectSubitem1.getInAccount());
payMemberProjectSubitem.setMakeInvoice(payMemberProjectSubitem1.getMakeInvoice());
payMemberProjectSubitem.setMail(payMemberProjectSubitem1.getMail());
@@ -73,37 +73,7 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
if(!Objects.isNull(pageList)){
List<PayWorkingGroupVO> listPayWorkingGroupVO = pageList.getRecords();
if(!CollectionUtils.isEmpty(listPayWorkingGroupVO)){
listPayWorkingGroupVO.forEach(p->{
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,p.getId());
List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query);
if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){
PayWorkingGroupPayment payWorkingGroupPayment = new PayWorkingGroupPayment();
// 已付全款
List<PayWorkingGroupSubItem> listAllPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount())
== (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount())).collect(Collectors.toList());
payWorkingGroupPayment.setAllPayment(listAllPayment.size());
// 部分付款
List<PayWorkingGroupSubItem> listPartPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount())
< (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount())).collect(Collectors.toList());
payWorkingGroupPayment.setPartPayment(listPartPayment.size());
// 未付款
List<PayWorkingGroupSubItem> listNotPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount()) == 0
&& (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount()) != 0 )
.collect(Collectors.toList());
payWorkingGroupPayment.setNotPayment(listNotPayment.size());
p.setObj(payWorkingGroupPayment);
}else{
PayWorkingGroupPayment payWorkingGroupPayment = new PayWorkingGroupPayment();
payWorkingGroupPayment.setAllPayment(0);
payWorkingGroupPayment.setPartPayment(0);
payWorkingGroupPayment.setNotPayment(0);
p.setObj(payWorkingGroupPayment);
}
});
setPayWorkingGroupSubItem(listPayWorkingGroupVO);
pageList.setRecords(listPayWorkingGroupVO);
}
}
@@ -126,23 +96,70 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
return Result.OK(list);
}
/**
* 根据成员单位列表查询
*
* @param companyId 成员id
* @return
*/
@AutoLog(value = "工作组项目-根据成员单位列表查询")
@ApiOperation(value="工作组项目-根据成员单位列表查询", notes="工作组项目-根据单位列表查询")
@GetMapping(value = "/queryListByCompany")
public Result<?> queryListByCompany(@RequestParam(name = "companyId") String companyId,
@RequestParam(name = "year",required = false) String year) {
if(StringUtils.isBlank(companyId)){
/**
* 根据成员单位列表查询
*
* @param companyId 企业id
* @param workingGroupProject 工作组项目
* @param year 运行年份
* @return
*/
@AutoLog(value = "工作组项目-根据成员单位列表查询")
@ApiOperation(value="工作组项目-根据成员单位列表查询", notes="工作组项目-根据单位列表查询")
@GetMapping(value = "/queryListByCompany")
public Result<?> queryListByCompany(@RequestParam(name = "companyId") String companyId,
@RequestParam(name = "workingGroupProject") String workingGroupProject,
@RequestParam(name = "year",required = false) String year) {
if(StringUtils.isBlank(companyId)){
return Result.error("企业id不能为空!");
}
List<PayWorkingGroup> list = payWorkingGroupService.queryListByCompany(companyId,year);
List<PayWorkingGroupVO> list = payWorkingGroupService.queryListByCompany(companyId,workingGroupProject,year);
if(CollectionUtils.isEmpty(list)){
setPayWorkingGroupSubItem(list);
}
return Result.OK(list);
}
}
/**
* @Description 获取进度
* @Author lqt
* @Date 2021/9/6
* @Param list 集合
* @Return
* @Exception
*/
private void setPayWorkingGroupSubItem(List<PayWorkingGroupVO> list){
list.forEach(p->{
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,p.getId());
List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query);
if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){
PayWorkingGroupPayment payWorkingGroupPayment = new PayWorkingGroupPayment();
// 已付全款
List<PayWorkingGroupSubItem> listAllPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount())
== (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount())).collect(Collectors.toList());
payWorkingGroupPayment.setAllPayment(listAllPayment.size());
// 部分付款
List<PayWorkingGroupSubItem> listPartPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount())
< (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount())).collect(Collectors.toList());
payWorkingGroupPayment.setPartPayment(listPartPayment.size());
// 未付款
List<PayWorkingGroupSubItem> listNotPayment = listPayWorkingGroupSubItem.stream()
.filter(p1->(Objects.isNull(p1.getPaidAmount()) ? 0 : p1.getPaidAmount()) == 0
&& (Objects.isNull(p1.getReceivableAmount()) ? 0 : p1.getReceivableAmount()) != 0 )
.collect(Collectors.toList());
payWorkingGroupPayment.setNotPayment(listNotPayment.size());
p.setObj(payWorkingGroupPayment);
}else{
PayWorkingGroupPayment payWorkingGroupPayment = new PayWorkingGroupPayment();
payWorkingGroupPayment.setAllPayment(0);
payWorkingGroupPayment.setPartPayment(0);
payWorkingGroupPayment.setNotPayment(0);
p.setObj(payWorkingGroupPayment);
}
});
}
/**
* 添加
@@ -145,11 +145,12 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
* 查询工作组成员是否收费通知
*
* @param ids 工作组成员ids 逗号分隔
* @param workingGroupId 工作组id
* @return
*/
@ApiOperation(value="工作组成员-查询工作组成员是否收费通知", notes="工作组成员-查询工作组成员是否收费通知")
@GetMapping(value = "/getCharge")
public Result<?> getCharge(@RequestParam(name = "ids") String ids) {
public Result<?> getCharge(@RequestParam(name = "ids") String ids,@RequestParam(name = "workingGroupId") String workingGroupId) {
if(StringUtils.isBlank(ids)){
return Result.error("id不能为空!");
}
@@ -161,6 +162,7 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
}
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.in(PayWorkingGroupSubItem::getId,Arrays.asList(ids.split(",")));
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,workingGroupId);
List<PayWorkingGroupSubItem> list = payWorkingGroupSubItemService.list();
if(!CollectionUtils.isEmpty(list)){
List<PayWorkingGroupSubItem> listNew = list.stream().filter(p->!Objects.equals(p.getChargeWay(),PayProjectCommon.CHARGE_WAY3)).collect(Collectors.toList());
@@ -34,6 +34,6 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
* @Return
* @Exception
*/
List<PayWorkingGroup> queryListByCompany(@Param("companyId") String companyId,@Param("year") String year);
List<PayWorkingGroupVO> queryListByCompany(@Param("companyId") String companyId,@Param("workingGroupProject") String workingGroupProject, @Param("year") String year);
}
@@ -38,7 +38,7 @@
</where>
ORDER BY create_time DESC
</select>
<select id="queryListByCompany" resultType="com.jero.project.entity.PayWorkingGroup">
<select id="queryListByCompany" resultType="com.jero.project.vo.PayWorkingGroupVO">
SELECT
pwg.id,
pwg.working_group_project AS workingGroupProject,
@@ -64,6 +64,9 @@
FROM pay_working_group pwg
LEFT JOIN pay_working_group_subitem pwgs ON pwg.id = pwgs.working_group_id
<where>
<if test="workingGroupProject != null and workingGroupProject != ''">
AND pwg.working_group_project = #{workingGroupProject}
</if>
<if test="companyId != null and companyId != ''">
AND pwgs.charge_company_id = #{companyId}
</if>
@@ -32,5 +32,5 @@ public interface IPayWorkingGroupService extends IService<PayWorkingGroup> {
* @Return
* @Exception
*/
List<PayWorkingGroup> queryListByCompany(String companyId,String year);
List<PayWorkingGroupVO> queryListByCompany(String companyId,String workingGroupProject,String year);
}
@@ -31,7 +31,7 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl<PayWorkingGroupMappe
}
@Override
public List<PayWorkingGroup> queryListByCompany(String companyId, String year) {
return payWorkingGroupMapper.queryListByCompany(companyId,year);
public List<PayWorkingGroupVO> queryListByCompany(String companyId,String workingGroupProject, String year) {
return payWorkingGroupMapper.queryListByCompany(companyId,workingGroupProject,year);
}
}
@@ -37,6 +37,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -83,24 +84,24 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
public void addPayWorkingGroupSubItem(PayWorkingGroupSubItem payWorkingGroupSubItem) {
if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY2){
if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){
throw new RuntimeException("应收金额不能为空");
throw new JeroBootException("应收金额不能为空");
}
if(StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())){
throw new RuntimeException("合同号不能为空");
throw new JeroBootException("合同号不能为空");
}
}
if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY3){
if(Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())){
throw new RuntimeException("收费通知号不能为空");
throw new JeroBootException("收费通知号不能为空");
}
if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){
throw new RuntimeException("应收金额不能为空");
throw new JeroBootException("应收金额不能为空");
}
}
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){
throw new RuntimeException("工作组不存在!");
throw new JeroBootException("工作组不存在!");
}
try {
@@ -112,11 +113,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
PayWorkingGroupSubItem payWorkingGroupSubItemNew = payWorkingGroupSubItemService.getOne(queryWrapper);
// 企业和联系人同时存在,则校验不通过
if(!Objects.isNull(payWorkingGroupSubItemNew)) {
throw new RuntimeException("工作组成员单位已存在!");
throw new JeroBootException("工作组成员单位已存在!");
}
}catch (Exception e){
log.info("工作组成员-添加异常",e);
throw new RuntimeException("工作组成员单位已存在!");
throw new JeroBootException("工作组成员单位已存在!");
}
payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem);
@@ -132,23 +133,23 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
public void editPayWorkingGroupSubItem(PayWorkingGroupSubItem payWorkingGroupSubItem) {
if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY2){
if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){
throw new RuntimeException("应收金额不能为空");
throw new JeroBootException("应收金额不能为空");
}
if(StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())){
throw new RuntimeException("合同号不能为空");
throw new JeroBootException("合同号不能为空");
}
}
if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY3){
if(Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())){
throw new RuntimeException("收费通知号不能为空");
throw new JeroBootException("收费通知号不能为空");
}
if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){
throw new RuntimeException("应收金额不能为空");
throw new JeroBootException("应收金额不能为空");
}
}
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){
throw new RuntimeException("工作组不存在!");
throw new JeroBootException("工作组不存在!");
}
try {
// 编辑保存前再次校验来款项目是否存在
@@ -160,11 +161,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
// 来款项目存在,并且编辑id与查询不同,则校验不通过
if(!Objects.isNull(payWorkingGroupSubItemNew)
&& !Objects.equals(payWorkingGroupSubItemNew.getId(),payWorkingGroupSubItem.getId())) {
throw new RuntimeException("工作组成员单位已存在!");
throw new JeroBootException("工作组成员单位已存在!");
}
}catch (Exception e){
log.info("工作组成员-编辑异常",e);
throw new RuntimeException("工作组成员单位已存在!");
throw new JeroBootException("工作组成员单位已存在!");
}
payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem);
@@ -180,29 +181,33 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
workGroupId = multipartRequest.getParameter("workGroupId");
}catch (Exception e){
log.error("获取工作组id异常",e);
throw new RuntimeException("工作组id不能为空 ");
throw new JeroBootException("工作组id不能为空 ");
}
if(StringUtils.isBlank(workGroupId)){
throw new RuntimeException("工作组id不能为空 ");
throw new JeroBootException("工作组id不能为空 ");
}
StringBuilder msg = new StringBuilder();
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(1);
params.setHeadRows(1);
//导入Excel格式校验,看匹配的字段文本概率
try {
//导入Excel格式校验,看匹配的字段文本概率
Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), PayWorkingGroupSubItem.class, params);
if(!t){
throw new RuntimeException("导入Excel校验失败 ");
throw new JeroBootException("导入Excel校验失败 ");
}
} catch (IOException e) {
e.printStackTrace();
throw new JeroBootException("导入Excel校验失败 ");
}
try {
List<PayWorkingGroupSubItem> list = ExcelImportUtil.importExcel(file.getInputStream(), PayWorkingGroupSubItem.class, params);
if(!CollectionUtils.isEmpty(list)){
// 校验重复成员的集合
List<PayWorkingGroupSubItem> listCompanyAndContacts = new ArrayList<>();
StringBuilder msg = new StringBuilder();
// 获取excel中的企业名称
List<String> listCompanyName = list.stream().map(PayWorkingGroupSubItem::getChargeCompanyTemporaryName).collect(Collectors.toList());
// 获取excel企业信息
@@ -210,7 +215,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
companyWrapper.in(PayCompanyManagement::getCompanyName,listCompanyName);
List<PayCompanyManagement> listCompanyInfo = payCompanyManagementService.list(companyWrapper);
if(CollectionUtils.isEmpty(listCompanyInfo)){
throw new RuntimeException("excel中企业不存在 ");
msg.append("excel中企业不存在 ");
}
List<String> listContactsName = new ArrayList<>();
// 获取excel中联系人一名称
@@ -238,160 +243,160 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
contactsWrapper.in(PayContactsManagement::getName,listContactsName);
List<PayContactsManagement> listContactsInfo = payContactsManagementService.list(contactsWrapper);
if(CollectionUtils.isEmpty(listContactsInfo)){
throw new RuntimeException("excel中联系人不存在 ");
msg.append("excel中联系人不存在 ");
}
// 获取工作组信息
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(workGroupId);
if(Objects.isNull(payWorkingGroup)){
throw new RuntimeException("工作组不存在 ");
msg.append("工作组不存在 ");
}
// 获取工作组成员
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,workGroupId);
List<PayWorkingGroupSubItem> listData = payWorkingGroupSubItemService.list(query);
list.forEach(p->{
p.setWorkingGroupId(workGroupId);
int count = list.indexOf(p);
// 校验企业名称
List<PayCompanyManagement> listCompany = new ArrayList<>();
if(StringUtils.isBlank(p.getChargeCompanyTemporaryName())){
msg.append("").append(count + 3).append(" 行:企业名称不能为空,请修改。</br>");
}else{
// 通过企业名称获取企业id
listCompany = listCompanyInfo.stream().filter(item->
Objects.equals(item.getCompanyName(),p.getChargeCompanyTemporaryName())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listCompany)){
msg.append("").append(count + 3).append(" 行:企业名称不存在,请修改。</br>");
}else{
p.setChargeCompanyId(listCompany.get(0).getId());
}
}
// 校验联系人一
if(StringUtils.isBlank(p.getContactsTemporaryNameOne())){
msg.append("").append(count + 3).append(" 行:联系人不能为空,请修改。</br>");
}else{
if(!CollectionUtils.isEmpty(listCompany)){
// 通过联系人获取联系人id
List<PayCompanyManagement> finalListCompany = listCompany;
List<PayContactsManagement> listContacts = listContactsInfo.stream().filter(item->
Objects.equals(item.getName(),p.getContactsTemporaryNameOne())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listContacts)){
msg.append("").append(count + 3).append(" 行:该企业下不存在该联系人一,请修改。</br>");
}else{
p.setContactsIdOne(listContacts.get(0).getId());
if(StringUtils.isBlank(msg)) {
// 获取工作组成员
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId, workGroupId);
List<PayWorkingGroupSubItem> listData = payWorkingGroupSubItemService.list(query);
list.forEach(p -> {
p.setWorkingGroupId(workGroupId);
int count = list.indexOf(p);
// 校验企业名称
List<PayCompanyManagement> listCompany = new ArrayList<>();
if (StringUtils.isBlank(p.getChargeCompanyTemporaryName())) {
msg.append("").append(count + 3).append(" 行:企业名称不能为空,请修改。</br>");
} else {
// 通过企业名称获取企业id
listCompany = listCompanyInfo.stream().filter(item ->
Objects.equals(item.getCompanyName(), p.getChargeCompanyTemporaryName())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(listCompany)) {
msg.append("").append(count + 3).append(" 行:企业名称不存在,请修改。</br>");
} else {
p.setChargeCompanyId(listCompany.get(0).getId());
}
}
}
// 校验工作组成员单位是否已存在
if(!StringUtils.isBlank(p.getChargeCompanyId())){
List<PayWorkingGroupSubItem> listDateNew = listData.stream().filter(item->Objects.equals(p.getChargeCompanyId(),item.getChargeCompanyId())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listDateNew)){
msg.append("").append(count + 3).append(" 行:工作组成员单位已存在,请修改。</br>");
}
}
// 校验联系人二
if(!StringUtils.isBlank(p.getContactsTemporaryNameTwo()) && !CollectionUtils.isEmpty(listCompany)){
if(!CollectionUtils.isEmpty(listCompany)){
// 通过联系人获取联系人id
List<PayCompanyManagement> finalListCompany = listCompany;
List<PayContactsManagement> listContacts = listContactsInfo.stream().filter(item->
Objects.equals(item.getName(),p.getContactsTemporaryNameTwo())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listContacts)){
msg.append("").append(count + 3).append(" 行:该企业下不存在该联系人二,请修改。</br>");
}else{
p.setContactsIdTwo(listContacts.get(0).getId());
// 校验联系人一
if (StringUtils.isBlank(p.getContactsTemporaryNameOne())) {
msg.append("").append(count + 3).append(" 行:联系人不能为空,请修改。</br>");
} else {
if (!CollectionUtils.isEmpty(listCompany)) {
// 通过联系人获取联系人id
List<PayCompanyManagement> finalListCompany = listCompany;
List<PayContactsManagement> listContacts = listContactsInfo.stream().filter(item ->
Objects.equals(item.getName(), p.getContactsTemporaryNameOne())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(listContacts)) {
msg.append("").append(count + 3).append(" 行:该企业下不存在该联系人一,请修改。</br>");
} else {
p.setContactsIdOne(listContacts.get(0).getId());
}
}
}
}
// 校验联系人三
if(!StringUtils.isBlank(p.getContactsTemporaryNameThree()) && !CollectionUtils.isEmpty(listCompany)){
if(!CollectionUtils.isEmpty(listCompany)){
// 通过联系人获取联系人id
List<PayCompanyManagement> finalListCompany = listCompany;
List<PayContactsManagement> listContacts = listContactsInfo.stream().filter(item->
Objects.equals(item.getName(),p.getContactsTemporaryNameThree())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listContacts)){
msg.append("").append(count + 3).append(" 行:该企业下不存在该联系人三,请修改。</br>");
}else{
p.setContactsIdThree(listContacts.get(0).getId());
// 校验工作组成员单位是否已存在
if (!StringUtils.isBlank(p.getChargeCompanyId())) {
List<PayWorkingGroupSubItem> listDateNew = listData.stream().filter(item -> Objects.equals(p.getChargeCompanyId(), item.getChargeCompanyId())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(listDateNew)) {
msg.append("").append(count + 3).append(" 行:工作组成员单位已存在,请修改。</br>");
}
}
}
// 校验邮寄联系人
if(StringUtils.isBlank(p.getMailContactsTemporaryName())){
msg.append("").append(count + 3).append(" 行:邮寄联系人不能为空,请修改。</br>");
}else{
if(!CollectionUtils.isEmpty(listCompany)){
// 通过联系人获取联系人id
List<PayCompanyManagement> finalListCompany = listCompany;
List<PayContactsManagement> listContacts = listContactsInfo.stream().filter(item->
Objects.equals(item.getName(),p.getMailContactsTemporaryName())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listContacts)){
msg.append("").append(count + 3).append(" 行:该企业下不存在该邮寄联系人,请修改。</br>");
}else{
p.setMailContactsId(listContacts.get(0).getId());
// 校验联系人二
if (!StringUtils.isBlank(p.getContactsTemporaryNameTwo()) && !CollectionUtils.isEmpty(listCompany)) {
if (!CollectionUtils.isEmpty(listCompany)) {
// 通过联系人获取联系人id
List<PayCompanyManagement> finalListCompany = listCompany;
List<PayContactsManagement> listContacts = listContactsInfo.stream().filter(item ->
Objects.equals(item.getName(), p.getContactsTemporaryNameTwo())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(listContacts)) {
msg.append("").append(count + 3).append(" 行:该企业下不存在该联系人二,请修改。</br>");
} else {
p.setContactsIdTwo(listContacts.get(0).getId());
}
}
}
}
// 校验成员唯一性
List<PayWorkingGroupSubItem> listCompanyAndContactsNew = listCompanyAndContacts.stream().filter(item->Objects.equals(p.getChargeCompanyTemporaryName(),item.getChargeCompanyTemporaryName())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listCompanyAndContactsNew)){
msg.append("").append(count + 3).append(" 行:工作组成员单位重复出现,请修改。</br>");
}
listCompanyAndContacts.add(p);
// 校验
if(Objects.equals(p.getChargeWay(), PayProjectCommon.CHARGE_WAY2)){
if(Objects.isNull(p.getReceivableAmount())){
msg.append("").append(count + 3).append(" 行:应收金额不能为空,请修改。</br>");
}
if(StringUtils.isBlank(p.getContractNum())){
msg.append("").append(count + 3).append(" 行:合同号不能为空,请修改。</br>");
}
}
if(Objects.equals(p.getChargeWay(),PayProjectCommon.CHARGE_WAY3)){
if(Objects.isNull(p.getChargeNoticeNo())){
msg.append("").append(count + 3).append(" 行:收费通知号不能为空,请修改。</br>");
}else{
if(Objects.equals(payWorkingGroup.getChargeNoticeNoA(),p.getChargeNoticeNo())) {
p.setChargeNoticeId(payWorkingGroup.getChargeNoticeAId());
}else if(Objects.equals(payWorkingGroup.getChargeNoticeNoB(),p.getChargeNoticeNo()) ){
p.setChargeNoticeId(payWorkingGroup.getChargeNoticeBId());
}else{
msg.append("").append(count + 3).append(" 行:收费通知号不存在,请修改。</br>");
// 校验联系人三
if (!StringUtils.isBlank(p.getContactsTemporaryNameThree()) && !CollectionUtils.isEmpty(listCompany)) {
if (!CollectionUtils.isEmpty(listCompany)) {
// 通过联系人获取联系人id
List<PayCompanyManagement> finalListCompany = listCompany;
List<PayContactsManagement> listContacts = listContactsInfo.stream().filter(item ->
Objects.equals(item.getName(), p.getContactsTemporaryNameThree())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(listContacts)) {
msg.append("").append(count + 3).append(" 行:该企业下不存在该联系人三,请修改。</br>");
} else {
p.setContactsIdThree(listContacts.get(0).getId());
}
}
}
if(Objects.isNull(p.getReceivableAmount())){
msg.append("").append(count + 3).append(" 行:应收金额不能为空,请修改。</br>");
// 校验邮寄联系人
if (StringUtils.isBlank(p.getMailContactsTemporaryName())) {
msg.append("").append(count + 3).append(" 行:邮寄联系人不能为空,请修改。</br>");
} else {
if (!CollectionUtils.isEmpty(listCompany)) {
// 通过联系人获取联系人id
List<PayCompanyManagement> finalListCompany = listCompany;
List<PayContactsManagement> listContacts = listContactsInfo.stream().filter(item ->
Objects.equals(item.getName(), p.getMailContactsTemporaryName())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(listContacts)) {
msg.append("").append(count + 3).append(" 行:该企业下不存在该邮寄联系人,请修改。</br>");
} else {
p.setMailContactsId(listContacts.get(0).getId());
}
}
}
// 校验成员唯一性
List<PayWorkingGroupSubItem> listCompanyAndContactsNew = listCompanyAndContacts.stream().filter(item -> Objects.equals(p.getChargeCompanyTemporaryName(), item.getChargeCompanyTemporaryName())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(listCompanyAndContactsNew)) {
msg.append("").append(count + 3).append(" 行:工作组成员单位重复出现,请修改。</br>");
}
listCompanyAndContacts.add(p);
// 校验
if (Objects.equals(p.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) {
if (Objects.isNull(p.getReceivableAmount())) {
msg.append("").append(count + 3).append(" 行:应收金额不能为空,请修改。</br>");
}
if (StringUtils.isBlank(p.getContractNum())) {
msg.append("").append(count + 3).append(" 行:合同号不能为空,请修改。</br>");
}
}
if (Objects.equals(p.getChargeWay(), PayProjectCommon.CHARGE_WAY3)) {
if (Objects.isNull(p.getChargeNoticeNo())) {
msg.append("").append(count + 3).append(" 行:收费通知号不能为空,请修改。</br>");
} else {
if (Objects.equals(payWorkingGroup.getChargeNoticeNoA(), p.getChargeNoticeNo())) {
p.setChargeNoticeId(payWorkingGroup.getChargeNoticeAId());
} else if (Objects.equals(payWorkingGroup.getChargeNoticeNoB(), p.getChargeNoticeNo())) {
p.setChargeNoticeId(payWorkingGroup.getChargeNoticeBId());
} else {
msg.append("").append(count + 3).append(" 行:收费通知号不存在,请修改。</br>");
}
}
if (Objects.isNull(p.getReceivableAmount())) {
msg.append("").append(count + 3).append(" 行:应收金额不能为空,请修改。</br>");
}
}
p.setPack(PayProjectCommon.PACKAGING0);
p.setInAccount(PayProjectCommon.IN_ACCOUNT0);
p.setMakeInvoice(PayProjectCommon.MAKE_INVOICE0);
p.setMail(PayProjectCommon.MAIL0);
// 校验字段值
StringBuilder s = ValidUtil.validateExcel(p, (count + 3));
if (!StringUtils.isBlank(s)) {
msg.append(s);
}
});
if (StringUtils.isBlank(msg)) {
// 拷贝企业,联系人
list.forEach(p -> {
setPayWorkingGroupSubItem(p);
});
// 更新数据
payWorkingGroupSubItemService.saveBatch(list);
}
p.setPack(PayProjectCommon.PACKAGING0);
p.setInAccount(PayProjectCommon.IN_ACCOUNT0);
p.setMakeInvoice(PayProjectCommon.MAKE_INVOICE0);
p.setMail(PayProjectCommon.MAIL0);
// 校验字段值
StringBuilder s = ValidUtil.validateExcel(p,(count+3));
if(!StringUtils.isBlank(s)){
msg.append(s);
}
});
if(!StringUtils.isBlank(msg)){
throw new RuntimeException(msg.toString());
}
// 拷贝企业,联系人
list.forEach(p->{
setPayWorkingGroupSubItem(p);
});
// 更新数据
payWorkingGroupSubItemService.saveBatch(list);
}
} catch (Exception e) {
log.error(e.getMessage(),e);
throw new RuntimeException("文件导入失败!");
throw new JeroBootException("文件导入失败!");
} finally {
try {
file.getInputStream().close();
@@ -399,6 +404,9 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
e.printStackTrace();
}
}
if(!StringUtils.isBlank(msg)){
throw new JeroBootException(msg.toString());
}
}
}
@@ -1,6 +1,8 @@
package com.jero.modules.system.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.util.PasswordUtil;
import com.jero.modules.system.entity.SysConfusion;
import com.jero.modules.system.entity.SysDepartRolePermission;
import com.jero.modules.system.mapper.SysConfusionMapper;
@@ -52,6 +54,11 @@ public class DuplicateCheckController {
duplicateCheckVo.setTableName(sysConfusion.getTableName());
duplicateCheckVo.setFieldName(sysConfusion.getFieldName());
//如果加密字段有值,则把校验数据进行加密后在判断
String encrypt = duplicateCheckVo.getEncrypt();
if (StrUtil.isNotBlank(encrypt)){
duplicateCheckVo.setFieldVal(PasswordUtil.encrypt(duplicateCheckVo.getFieldVal()));
}
log.info("----duplicate check------" + duplicateCheckVo.toString());
//关联表字典(举例:sys_user,realname,id
//SQL注入校验(只限制非法串改数据库)
@@ -50,4 +50,10 @@ public class DuplicateCheckVo implements Serializable {
@ApiModelProperty(value="数据ID",name="dataId",example="2000")
private String dataId;
/**
* 是否加密
*/
@ApiModelProperty(value="是否加密",name="encrypt")
private String encrypt;
}
@@ -137,14 +137,14 @@ spring:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# 多数据源配置
#multi-datasource1:
#url: jdbc:mysql://localhost:3306/jero-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
#username: root
#password: root
#driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/jero-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# username: root
# password: root
# driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
redis:
database: 14
host: 192.168.18.254
host: 121.36.69.172
lettuce:
pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制
@@ -153,7 +153,7 @@ spring:
min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
shutdown-timeout: 100ms
password: hzwlsoft.com
port: 6379
port: 4780
#mybatis plus 设置
mybatis-plus: