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 * @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 // Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); 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); mv.addObject(NormalExcelConstants.CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置-------------------- mv.addObject(NormalExcelConstants.PARAMS,new ExportParams(title, title));
ExportParams exportParams=new ExportParams(title, title); mv.addObject(NormalExcelConstants.DATA_LIST, object);
exportParams.setImageBasePath(upLoadPath);
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, null);
return mv; return mv;
} }
@@ -167,7 +164,7 @@ public class JeroController<T, S extends IService<T>> {
/** /**
* 导出Excel模板 * 导出Excel模板
*/ */
public ModelAndView exportTemplate(Class<T> exportClass, String title) { public ModelAndView exportTemplate(Class<?> exportClass, String title) {
// AutoPoi 导出Excel // AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下 //此处设置的filename无效 ,前端会重更新设置一下
@@ -228,6 +225,9 @@ public class JeroController<T, S extends IService<T>> {
try { try {
//导入Excel格式校验,看匹配的字段文本概率 //导入Excel格式校验,看匹配的字段文本概率
Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), clazz, params); Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), clazz, params);
if (t == null) {
throw new JeroBootException("导入数据为空!");
}
if(!t){ if(!t){
throw new JeroBootException("导入Excel校验失败 !"); 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.api.vo.Result;
import com.jero.common.system.base.controller.JeroController; import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator; 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.PasswordUtil;
import com.jero.common.util.ValidUtil; import com.jero.common.util.ValidUtil;
import com.jero.common.util.oConvertUtils; import com.jero.common.util.oConvertUtils;
import com.jero.company.common.PayCompanyManagementCommon;
import com.jero.company.common.PayContactsManagementCommon; import com.jero.company.common.PayContactsManagementCommon;
import com.jero.company.entity.PayCompanyManagement; import com.jero.company.entity.PayCompanyManagement;
import com.jero.company.entity.PayContactsManagement; import com.jero.company.entity.PayContactsManagement;
@@ -29,7 +27,6 @@ import com.jero.company.service.IPayContactsManagementService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecgframework.poi.excel.ExcelImportCheckUtil; import org.jeecgframework.poi.excel.ExcelImportCheckUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; 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 = "公司电话格式错误") @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; private String companyPhone;
/**邮编*/ /**邮编*/
@Excel(name = "邮编", width = 15) @Excel(name = "邮政编码", width = 15)
@ApiModelProperty(value = "邮编") @ApiModelProperty(value = "邮政编码")
@NotEmpty(message = "邮编不能为空!") @NotEmpty(message = "邮政编码不能为空!")
@Size(min=6,max = 6,message = "邮编长度必须为6个字符") @Size(min=6,max = 6,message = "邮政编码长度必须为6个字符")
@Pattern(regexp = "^[0-9]\\d{5}$",message = "邮编格式错误") @Pattern(regexp = "^[0-9]\\d{5}$",message = "邮政编码格式错误")
private String postalCode; private String postalCode;
/**银行户名*/ /**银行户名*/
@Excel(name = "银行户名", width = 15) @Excel(name = "银行户名", width = 15)
@@ -1,6 +1,7 @@
package com.jero.contract.controller; package com.jero.contract.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog; 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.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.query.QueryGenerator;
import com.jero.common.util.DateUtils; 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.def.MapExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; 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.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -76,6 +79,9 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
@Autowired @Autowired
private Environment env; 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="projectName",required = false) String projectName,
@RequestParam(name="startTime",required = false) String startTime, @RequestParam(name="startTime",required = false) String startTime,
@RequestParam(name="endTime",required = false) String endTime) { @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); Page<PayIncomeContractOutput> page = new Page<>(pageNo, pageSize);
IPage<PayIncomeContractOutput> pageList = payIncomeContractService.queryPageList(page, payIncomeContract,chargeStatus,projectName,startTime,endTime); IPage<PayIncomeContractOutput> pageList = payIncomeContractService.queryPageList(page, payIncomeContract,chargeStatus,projectName,startTime,endTime);
pageList.getRecords().forEach(p->{ pageList.getRecords().forEach(p->{
@@ -131,24 +146,45 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
return Result.OK("编辑成功!"); 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 * @return
*/ */
@AutoLog(value = "收入合同-关联") @AutoLog(value = "收入合同-关联")
@ApiOperation(value="收入合同-关联", notes="收入合同-关联") @ApiOperation(value="收入合同-关联", notes="收入合同-关联")
@PostMapping(value = "/associated") @PostMapping(value = "/associated")
public Result<?> associated(@RequestBody PayIncomeContractAssociatedInput input) { public Result<?> associated(@RequestBody List<PayIncomeContractAssociated> listPayIncomeContractAssociated) {
List<ProjectOutput> list = payIncomeContractService.associated(input); List<ProjectOutput> list = payIncomeContractService.associated(listPayIncomeContractAssociated);
return Result.OK("关联成功!",list); return Result.OK("关联成功!",list);
} }
/** /**
* 取消关联 * 取消关联
* *
* @param payIncomeContractAssociated * @param payIncomeContractAssociated 关联项目
* @return * @return
*/ */
@AutoLog(value = "收入合同-取消关联") @AutoLog(value = "收入合同-取消关联")
@@ -156,7 +192,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
@PostMapping(value = "/cancelAssociated") @PostMapping(value = "/cancelAssociated")
public Result<?> cancelAssociated(@RequestBody PayIncomeContractAssociated payIncomeContractAssociated) { public Result<?> cancelAssociated(@RequestBody PayIncomeContractAssociated payIncomeContractAssociated) {
payIncomeContractService.cancelAssociated(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 = "收入合同-归档") @AutoLog(value = "收入合同-归档")
@ApiOperation(value="收入合同-归档", notes="收入合同-归档") @ApiOperation(value="收入合同-归档", notes="收入合同-归档")
@PostMapping(value = "/archive") @PostMapping(value = "/archive")
public Result<?> archive(@RequestBody PayIncomeContract payIncomeContract) { public Result<?> archive(@RequestBody PayIncomeContractAudit payIncomeContractAudit) {
if(StringUtils.isBlank(payIncomeContract.getId())){ if(StringUtils.isBlank(payIncomeContractAudit.getContractId())){
return Result.error("id不能为空!"); return Result.error("id不能为空!");
} }
payIncomeContractService.updateArchive(payIncomeContract.getId()); payIncomeContractService.updateArchive(payIncomeContractAudit);
return Result.OK("归档成功!"); return Result.OK("归档成功!");
} }
@@ -258,77 +294,50 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
if(payIncomeContract==null) { if(payIncomeContract==null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
// 获取分期信息 // 获取分期信息
LambdaQueryWrapper<PayIncomeContractInstallment> queryPayIncomeContractInstallment = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PayIncomeContractInstallment> queryPayIncomeContractInstallment = new LambdaQueryWrapper<>();
queryPayIncomeContractInstallment.eq(PayIncomeContractInstallment::getContractId,payIncomeContract.getId()); queryPayIncomeContractInstallment.eq(PayIncomeContractInstallment::getContractId,payIncomeContract.getId());
List<PayIncomeContractInstallment> listPayIncomeContractInstallment = payIncomeContractInstallmentService.list(queryPayIncomeContractInstallment); List<PayIncomeContractInstallment> listPayIncomeContractInstallment = payIncomeContractInstallmentService.list(queryPayIncomeContractInstallment);
// 获取关联项目id // 获取关联项目id
List<ProjectOutput> listProject = new ArrayList<>(); List<ProjectOutput> listProject = payIncomeContractService.getAssociated(id);
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 会员项目
}
}
// 获取存档记录
LambdaQueryWrapper<PayIncomeContractAudit> queryPayIncomeContractAudit = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PayIncomeContractAudit> queryPayIncomeContractAudit = new LambdaQueryWrapper<>();
queryPayIncomeContractAudit.in(PayIncomeContractAudit::getContractId,id); queryPayIncomeContractAudit.in(PayIncomeContractAudit::getContractId,id);
List<PayIncomeContractAudit> listPayIncomeContractAudit = payIncomeContractAuditService.list(queryPayIncomeContractAudit); List<PayIncomeContractAudit> listPayIncomeContractAudit = payIncomeContractAuditService.list(queryPayIncomeContractAudit);
List<PayIncomeContractAudit> listArchive = 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());
// 获取审核记录 // 获取审核记录
List<PayIncomeContractAudit> listAudit = listPayIncomeContractAudit.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); String str = JSON.toJSONString(payIncomeContract);
PayIncomeContractDetailOutput payIncomeContractDetailOutput = JSONObject.parseObject(str,PayIncomeContractDetailOutput.class); 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)){ if(!CollectionUtils.isEmpty(listPayIncomeContractInstallment)){
payIncomeContractDetailOutput.setListInstallment(listPayIncomeContractInstallment); payIncomeContractDetailOutput.setListInstallment(listPayIncomeContractInstallment);
} }
if(!CollectionUtils.isEmpty(listProject)){ 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); payIncomeContractDetailOutput.setListProject(listProject);
} }
if(!CollectionUtils.isEmpty(listArchive)){ if(!CollectionUtils.isEmpty(listArchive)){
@@ -365,7 +374,6 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
} }
List<Map<String,String>> list = new ArrayList<>(); List<Map<String,String>> list = new ArrayList<>();
// excel字段长度 // excel字段长度
// todo 缺少字典转换
Map<String,Integer> mapCount = new HashMap<>(); Map<String,Integer> mapCount = new HashMap<>();
mapCount.put("count",0); mapCount.put("count",0);
if(!CollectionUtils.isEmpty(exportList)){ if(!CollectionUtils.isEmpty(exportList)){
@@ -377,6 +385,9 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
exportList.forEach(p->{ exportList.forEach(p->{
String str = JSON.toJSONString(p); String str = JSON.toJSONString(p);
Map<String,String> map = JSONObject.parseObject(str,Map.class); 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-> List<PayIncomeContractInstallment> listSub = listPayIncomeContractInstallment.stream().filter(item->
Objects.equals(p.getId(),item.getContractId())).collect(Collectors.toList()); Objects.equals(p.getId(),item.getContractId())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listSub)){ if(!CollectionUtils.isEmpty(listSub)){
@@ -385,7 +396,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
mapCount.put("count",listSub.size()); mapCount.put("count",listSub.size());
} }
listSub.forEach(p1->{ listSub.forEach(p1->{
int n = listSub.indexOf(p1); int n = listSub.indexOf(p1) + 1;
map.put("phaseName" + n,p1.getPhaseName()); map.put("phaseName" + n,p1.getPhaseName());
map.put("accountsReceivableAmount" + n,p1.getAccountsReceivableAmount()); map.put("accountsReceivableAmount" + n,p1.getAccountsReceivableAmount());
map.put("accountsReceivableTime" + n, DateUtils.date2Str(p1.getAccountsReceivableTime(),new SimpleDateFormat("yyyy-MM-dd"))); 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); list.add(map);
}); });
} }
}else{
throw new JeroBootException("数据为空!");
} }
// 设置表头样式 // 设置表头样式
List<ExcelExportEntity> filedsList = new ArrayList<>(); List<ExcelExportEntity> filedsList = new ArrayList<>();
@@ -412,6 +425,8 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
filedsList.add(new ExcelExportEntity("合同签订日期", "contractDate")); filedsList.add(new ExcelExportEntity("合同签订日期", "contractDate"));
filedsList.add(new ExcelExportEntity("合同终止日期", "terminationDate")); filedsList.add(new ExcelExportEntity("合同终止日期", "terminationDate"));
filedsList.add(new ExcelExportEntity("合同约定主要时点", "contractTimePoints")); filedsList.add(new ExcelExportEntity("合同约定主要时点", "contractTimePoints"));
filedsList.add(new ExcelExportEntity("是否打包", "pack"));
filedsList.add(new ExcelExportEntity("打包年份", "packYear"));
int count = mapCount.get("count"); int count = mapCount.get("count");
if(count > 0){ if(count > 0){
for (int i = 1; i <= count; i++){ for (int i = 1; i <= count; i++){
@@ -423,7 +438,7 @@ public class PayIncomeContractController extends JeroController<PayIncomeContrac
} }
} }
// Step.3 AutoPoi 导出Excel // 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.FILE_NAME, "收入合同"); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(MapExcelConstants.ENTITY_LIST, filedsList); mv.addObject(MapExcelConstants.ENTITY_LIST, filedsList);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置-------------------- //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.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@@ -79,10 +80,11 @@ public class PayIncomeContract implements Serializable {
@ApiModelProperty(value = "临时签订单位联系人名称") @ApiModelProperty(value = "临时签订单位联系人名称")
@Size(max = 50, message = "临时签订单位联系人名称长度不能大于50个字符") @Size(max = 50, message = "临时签订单位联系人名称长度不能大于50个字符")
private java.lang.String signedContactsTemporaryName; private java.lang.String signedContactsTemporaryName;
/**是否开口(1为是,2为否)*/ /**是否开口(1为是,0为否)*/
@Excel(name = "是否开口(1为是,2为否)", width = 15) @Excel(name = "是否开口(1为是,0为否)", width = 15)
@ApiModelProperty(value = "是否开口(1为是,2为否)") @ApiModelProperty(value = "是否开口(1为是,0为否)")
@Max(2) @Max(2)
@Dict(dicCode = "yn")
private java.lang.Integer opening; private java.lang.Integer opening;
/**负责人id*/ /**负责人id*/
@Excel(name = "负责人id", width = 15) @Excel(name = "负责人id", width = 15)
@@ -156,6 +158,7 @@ public class PayIncomeContract implements Serializable {
@Excel(name = "账款状态(1:未支付,2:部分支付,3:已付全款)", width = 15) @Excel(name = "账款状态(1:未支付,2:部分支付,3:已付全款)", width = 15)
@ApiModelProperty(value = "账款状态(1:未支付,2:部分支付,3:已付全款)") @ApiModelProperty(value = "账款状态(1:未支付,2:部分支付,3:已付全款)")
@Max(value = 3,message = "账款状态格式错误") @Max(value = 3,message = "账款状态格式错误")
@Dict(dicCode = "revenue_contract_account_status")
private java.lang.Integer accountStatus; private java.lang.Integer accountStatus;
/**合同约定付款次数*/ /**合同约定付款次数*/
@Excel(name = "合同约定付款次数", width = 15) @Excel(name = "合同约定付款次数", width = 15)
@@ -164,6 +167,7 @@ public class PayIncomeContract implements Serializable {
/**是否打包(1:是,2:否)*/ /**是否打包(1:是,2:否)*/
@Excel(name = "是否打包(1:是,2:否)", width = 15) @Excel(name = "是否打包(1:是,2:否)", width = 15)
@ApiModelProperty(value = "是否打包(1:是,2:否)") @ApiModelProperty(value = "是否打包(1:是,2:否)")
@Dict(dicCode = "yn")
private java.lang.Integer pack; private java.lang.Integer pack;
/**打包年份*/ /**打包年份*/
@Excel(name = "打包年份", width = 15) @Excel(name = "打包年份", width = 15)
@@ -172,6 +176,7 @@ public class PayIncomeContract implements Serializable {
/**合同状态(1:草稿,2:已通过,3:未通过,4:已归档)*/ /**合同状态(1:草稿,2:已通过,3:未通过,4:已归档)*/
@Excel(name = "合同状态(1:草稿,2:已通过,3:未通过,4:已归档)", width = 15) @Excel(name = "合同状态(1:草稿,2:已通过,3:未通过,4:已归档)", width = 15)
@ApiModelProperty(value = "合同状态(1:草稿,2:已通过,3:未通过,4:已归档)") @ApiModelProperty(value = "合同状态(1:草稿,2:已通过,3:未通过,4:已归档)")
@Dict(dicCode = "revenue_contract_status")
private java.lang.Integer status; private java.lang.Integer status;
/**创建人*/ /**创建人*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
@@ -4,6 +4,7 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.jero.common.aspect.annotation.Dict;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@@ -35,9 +36,10 @@ public class PayIncomeContractAudit implements Serializable {
@Excel(name = "合同id", width = 15) @Excel(name = "合同id", width = 15)
@ApiModelProperty(value = "合同id") @ApiModelProperty(value = "合同id")
private java.lang.String contractId; private java.lang.String contractId;
/**合同状态(2:已通过,3:未通过,4:已归档)*/ /**合同状态(1:草稿,2:待审核,3:已通过,4:未通过,5:已归档)*/
@Excel(name = "合同状态(2:已通过,3:未通过,4:已归档)", width = 15) @Excel(name = "合同状态(1:草稿,2:待审核,3:已通过,4:未通过,5:已归档)", width = 15)
@ApiModelProperty(value = "合同状态(2:已通过,3:未通过,4:已归档)") @ApiModelProperty(value = "合同状态(1:草稿,2:待审核,3:已通过,4:未通过,5:已归档)")
@Dict(dicCode = "revenue_contract_status")
private java.lang.Integer contractStatus; private java.lang.Integer contractStatus;
/**拒绝说明*/ /**拒绝说明*/
@Excel(name = "拒绝说明", width = 15) @Excel(name = "拒绝说明", width = 15)
@@ -44,8 +44,8 @@ public class PayIncomeContractInstallment implements Serializable {
@ApiModelProperty(value = "应收金额") @ApiModelProperty(value = "应收金额")
private java.lang.String accountsReceivableAmount; private java.lang.String accountsReceivableAmount;
/**应收时间*/ /**应收时间*/
@Excel(name = "应收时间", width = 15, format = "yyyy-MM-dd HH:mm:ss") @Excel(name = "应收时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "应收时间") @ApiModelProperty(value = "应收时间")
private java.util.Date accountsReceivableTime; private java.util.Date accountsReceivableTime;
@@ -54,8 +54,8 @@ public class PayIncomeContractInstallment implements Serializable {
@ApiModelProperty(value = "实收金额") @ApiModelProperty(value = "实收金额")
private java.lang.String paidAmount; private java.lang.String paidAmount;
/**实收时间*/ /**实收时间*/
@Excel(name = "实收时间", width = 15, format = "yyyy-MM-dd HH:mm:ss") @Excel(name = "实收时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "实收时间") @ApiModelProperty(value = "实收时间")
private java.util.Date paidTime; 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.contract.entity.PayIncomeContract; import com.jero.contract.entity.PayIncomeContract;
import com.jero.contract.vo.PayIncomeContractOutput; import com.jero.contract.vo.PayIncomeContractOutput;
import com.jero.contract.vo.ProjectOutput;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @Description: pay_income_contract * @Description: pay_income_contract
* @Author: jeecg-boot * @Author: jeecg-boot
@@ -27,4 +30,15 @@ public interface PayIncomeContractMapper extends BaseMapper<PayIncomeContract> {
IPage<PayIncomeContractOutput> queryPageList(Page<PayIncomeContractOutput> page, @Param("payIncomeContract") PayIncomeContract payIncomeContract, IPage<PayIncomeContractOutput> queryPageList(Page<PayIncomeContractOutput> page, @Param("payIncomeContract") PayIncomeContract payIncomeContract,
@Param("chargeStatus") String chargeStatus,@Param("projectName") String projectName, @Param("chargeStatus") String chargeStatus,@Param("projectName") String projectName,
@Param("startTime") String startTime, @Param("endTime") String endTime); @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> </where>
GROUP BY pic.id ORDER BY pic.create_time desc GROUP BY pic.id ORDER BY pic.create_time desc
</select> </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> </mapper>
@@ -42,6 +42,15 @@ public interface IPayIncomeContractService extends IService<PayIncomeContract> {
*/ */
void addPayIncomeContractInput(PayIncomeContractInput input); void addPayIncomeContractInput(PayIncomeContractInput input);
/** /**
* @Description 关联项目列表
* @Author lqt
* @Date 2021/9/6
* @Param contractId 合同id
* @Return
* @Exception
*/
List<ProjectOutput> getAssociated(String contractId);
/**
* @Description 编辑 * @Description 编辑
* @Author lqt * @Author lqt
* @Date 2021/9/3 * @Date 2021/9/3
@@ -54,11 +63,11 @@ public interface IPayIncomeContractService extends IService<PayIncomeContract> {
* @Description 收入合同-关联 * @Description 收入合同-关联
* @Author lqt * @Author lqt
* @Date 2021/9/5 * @Date 2021/9/5
* @Param input 关联项目 * @Param list 关联项目
* @Return * @Return
* @Exception * @Exception
*/ */
List<ProjectOutput> associated(PayIncomeContractAssociatedInput input); List<ProjectOutput> associated(List<PayIncomeContractAssociated> listPayIncomeContractAssociated);
/** /**
* @Description 取消关联 * @Description 取消关联
* @Author lqt * @Author lqt
@@ -90,11 +99,11 @@ public interface IPayIncomeContractService extends IService<PayIncomeContract> {
* @Description 归档 * @Description 归档
* @Author lqt * @Author lqt
* @Date 2021/9/5 * @Date 2021/9/5
* @Param id 合同id * @Param payIncomeContractAudit 审核记录
* @Return * @Return
* @Exception * @Exception
*/ */
void updateArchive(String id); void updateArchive(PayIncomeContractAudit payIncomeContractAudit);
/** /**
* @Description 删除 * @Description 删除
* @Author lqt * @Author lqt
@@ -1,14 +1,12 @@
package com.jero.contract.service.impl; 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.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.ValidUtil; import com.jero.common.util.ValidUtil;
import com.jero.contract.common.PayIncomeContractCommon; import com.jero.contract.common.PayIncomeContractCommon;
import com.jero.contract.entity.PayIncomeContract; 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.IPayIncomeContractAuditService;
import com.jero.contract.service.IPayIncomeContractInstallmentService; import com.jero.contract.service.IPayIncomeContractInstallmentService;
import com.jero.contract.service.IPayIncomeContractService; import com.jero.contract.service.IPayIncomeContractService;
import com.jero.contract.vo.PayIncomeContractAssociatedInput;
import com.jero.contract.vo.PayIncomeContractInput; import com.jero.contract.vo.PayIncomeContractInput;
import com.jero.contract.vo.PayIncomeContractOutput; import com.jero.contract.vo.PayIncomeContractOutput;
import com.jero.contract.vo.ProjectOutput; import com.jero.contract.vo.ProjectOutput;
@@ -39,12 +36,14 @@ import com.jero.temporary.service.IPayContactsManagementTemporaryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -93,10 +92,7 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(input)){ if(Objects.isNull(input)){
throw new JeroBootException("收入合同信息不能为空!"); throw new JeroBootException("收入合同信息不能为空!");
} }
if(StringUtils.isBlank(input.getContract())){ PayIncomeContract payIncomeContract = input.getContract();
throw new JeroBootException("收入合同信息不能为空!");
}
PayIncomeContract payIncomeContract = JSONObject.parseObject(input.getContract(),PayIncomeContract.class);
if(Objects.isNull(payIncomeContract)){ if(Objects.isNull(payIncomeContract)){
throw new JeroBootException("收入合同信息不能为空!"); throw new JeroBootException("收入合同信息不能为空!");
} }
@@ -105,8 +101,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException(msgPayIncomeContract.toString()); throw new JeroBootException(msgPayIncomeContract.toString());
} }
List<PayIncomeContractInstallment> listPayIncomeContractInstallment = new ArrayList<>(); List<PayIncomeContractInstallment> listPayIncomeContractInstallment = new ArrayList<>();
if(!StringUtils.isBlank(input.getInstallment())){ if(!CollectionUtils.isEmpty(input.getInstallment())){
listPayIncomeContractInstallment = JSONArray.parseArray(input.getInstallment(),PayIncomeContractInstallment.class); listPayIncomeContractInstallment = input.getInstallment();
} }
try { try {
LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>();
@@ -142,7 +138,6 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(!StringUtils.isBlank(sb)){ if(!StringUtils.isBlank(sb)){
msgPayIncomeContractInstallment.append("第").append(finalListPayIncomeContractInstallment.indexOf(p)).append("阶段:").append(sb); msgPayIncomeContractInstallment.append("第").append(finalListPayIncomeContractInstallment.indexOf(p)).append("阶段:").append(sb);
} }
}); });
payIncomeContractInstallmentService.saveBatch(listPayIncomeContractInstallment); payIncomeContractInstallmentService.saveBatch(listPayIncomeContractInstallment);
} }
@@ -152,17 +147,19 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
// todo 缺少发送消息 // todo 缺少发送消息
} }
@Override
public List<ProjectOutput> getAssociated(String contractId) {
return payIncomeContractMapper.getAssociated(contractId);
}
@Override @Override
@Transactional @Transactional
public void editPayIncomeContractInput(PayIncomeContractInput input) { public void editPayIncomeContractInput(PayIncomeContractInput input) {
if(Objects.isNull(input)){ if(Objects.isNull(input)){
throw new JeroBootException("收入合同信息不能为空!"); throw new JeroBootException("收入合同信息不能为空!");
} }
if(StringUtils.isBlank(input.getContract())){ PayIncomeContract payIncomeContract = input.getContract();
throw new JeroBootException("收入合同信息不能为空!"); if(Objects.isNull(input.getContract())){
}
PayIncomeContract payIncomeContract = JSONObject.parseObject(input.getContract(),PayIncomeContract.class);
if(Objects.isNull(payIncomeContract)){
throw new JeroBootException("收入合同信息不能为空!"); throw new JeroBootException("收入合同信息不能为空!");
} }
StringBuilder msgPayIncomeContract = ValidUtil.validateAll(payIncomeContract); StringBuilder msgPayIncomeContract = ValidUtil.validateAll(payIncomeContract);
@@ -181,8 +178,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("收入合同不可编辑!"); throw new JeroBootException("收入合同不可编辑!");
} }
List<PayIncomeContractInstallment> listPayIncomeContractInstallment = new ArrayList<>(); List<PayIncomeContractInstallment> listPayIncomeContractInstallment = new ArrayList<>();
if(!StringUtils.isBlank(input.getInstallment())){ if(!CollectionUtils.isEmpty(input.getInstallment())){
listPayIncomeContractInstallment = JSONArray.parseArray(input.getInstallment(),PayIncomeContractInstallment.class); listPayIncomeContractInstallment = input.getInstallment();
} }
try { try {
LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PayIncomeContract> query = new LambdaQueryWrapper<>();
@@ -236,14 +233,11 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
@Override @Override
@Transactional @Transactional
public List<ProjectOutput> associated(PayIncomeContractAssociatedInput input) { public List<ProjectOutput> associated(List<PayIncomeContractAssociated> listPayIncomeContractAssociated) {
if(StringUtils.isBlank(input.getAssociated())){
throw new JeroBootException("关联项目不能为空!");
}
List<PayIncomeContractAssociated> listPayIncomeContractAssociated = JSONArray.parseArray(input.getAssociated(),PayIncomeContractAssociated.class);
if(CollectionUtils.isEmpty(listPayIncomeContractAssociated)){ if(CollectionUtils.isEmpty(listPayIncomeContractAssociated)){
throw new JeroBootException("关联项目不能为空!"); throw new JeroBootException("关联项目不能为空!");
} }
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProjectOutput> listProjectOutput = new ArrayList<>(); List<ProjectOutput> listProjectOutput = new ArrayList<>();
listPayIncomeContractAssociated.forEach(p->{ listPayIncomeContractAssociated.forEach(p->{
ProjectOutput projectOutput = new ProjectOutput(); ProjectOutput projectOutput = new ProjectOutput();
@@ -255,13 +249,7 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payIncomeContract)){ if(Objects.isNull(payIncomeContract)){
throw new JeroBootException("合同不存在!"); 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())){ switch (String.valueOf(p.getProjectType())){
case PayIncomeContractCommon.PROJECT_TYPE1: case PayIncomeContractCommon.PROJECT_TYPE1:
@@ -271,11 +259,19 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payCommonProject)){ if(Objects.isNull(payCommonProject)){
throw new JeroBootException("项目不存在!"); 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)){ if(Objects.equals(payIncomeContract.getPack(),PayIncomeContractCommon.PACK1)){
LambdaUpdateWrapper<PayCommonProject> updatePayCommonProject = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<PayCommonProject> updatePayCommonProject = new LambdaUpdateWrapper<>();
updatePayCommonProject.eq(PayCommonProject::getPack,PayIncomeContractCommon.PACK1);
updatePayCommonProject.eq(PayCommonProject::getId,p.getProjectId()); 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); payCommonProjectService.update(updatePayCommonProject);
// todo 添加打包企业 // todo 添加打包企业
} }
@@ -301,13 +297,25 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){ if(CollectionUtils.isEmpty(listPayWorkingGroupSubItem)){
throw new JeroBootException("工作组成员单位不存在!"); throw new JeroBootException("工作组成员单位不存在!");
} }
// 更新项目id // 验证企业是否正确
p.setProjectId(listPayWorkingGroupSubItem.get(0).getId()); 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<>(); LambdaUpdateWrapper<PayWorkingGroupSubItem> updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>();
updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getPack,PayIncomeContractCommon.PACK1); 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()); updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId,listPayWorkingGroupSubItem.get(0).getId());
payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem); payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem);
// todo 添加打包企业
}
// 更新项目id
p.setProjectId(listPayWorkingGroupSubItem.get(0).getId());
projectOutput.setProjectId(listPayWorkingGroupSubItem.get(0).getId()); projectOutput.setProjectId(listPayWorkingGroupSubItem.get(0).getId());
projectOutput.setProjectType(PayIncomeContractCommon.PROJECT_TYPE2); projectOutput.setProjectType(PayIncomeContractCommon.PROJECT_TYPE2);
projectOutput.setChargeProject(payWorkingGroup.getWorkingGroupProject()); projectOutput.setChargeProject(payWorkingGroup.getWorkingGroupProject());
@@ -330,6 +338,28 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
}); });
return listProjectOutput; 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 @Override
@Transactional @Transactional
@@ -338,6 +368,7 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payIncomeContract)){ if(Objects.isNull(payIncomeContract)){
throw new JeroBootException("合同不存在!"); throw new JeroBootException("合同不存在!");
} }
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// 查看项目类型 // 查看项目类型
switch (String.valueOf(payIncomeContractAssociated.getProjectType())){ switch (String.valueOf(payIncomeContractAssociated.getProjectType())){
case PayIncomeContractCommon.PROJECT_TYPE1: case PayIncomeContractCommon.PROJECT_TYPE1:
@@ -347,10 +378,12 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payCommonProject)){ if(Objects.isNull(payCommonProject)){
throw new JeroBootException("项目不存在!"); throw new JeroBootException("项目不存在!");
} }
// 将关联项目取消打包 // todo 缺少查询项目是否为打包企业,是:保持不变,不是:取消打包 将关联项目取消打包
if(Objects.equals(payIncomeContract.getPack(),PayIncomeContractCommon.PACK1) ){ if(Objects.equals(payIncomeContract.getPack(),PayIncomeContractCommon.PACK1) ){
LambdaUpdateWrapper<PayCommonProject> updatePayCommonProject = new LambdaUpdateWrapper<>(); 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()); updatePayCommonProject.eq(PayCommonProject::getId,payIncomeContractAssociated.getProjectId());
payCommonProjectService.update(updatePayCommonProject); payCommonProjectService.update(updatePayCommonProject);
} }
@@ -370,9 +403,11 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
} }
// 更新项目id // 更新项目id
payIncomeContractAssociated.setProjectId(listPayWorkingGroupSubItem.get(0).getId()); payIncomeContractAssociated.setProjectId(listPayWorkingGroupSubItem.get(0).getId());
// 将关联项目取消打包 // todo 不是打包企业 取消打包 将关联项目取消打包
LambdaUpdateWrapper<PayWorkingGroupSubItem> updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>(); 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()); updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId,listPayWorkingGroupSubItem.get(0).getId());
payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem); payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem);
break; break;
@@ -384,15 +419,12 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
break; break;
default:break; default:break;
} }
payIncomeContractAssociatedService.save(payIncomeContractAssociated); payIncomeContractAssociatedService.removeById(payIncomeContractAssociated.getId());
} }
@Override @Override
public void submitAudit(PayIncomeContract payIncomeContract) { public void submitAudit(PayIncomeContract payIncomeContract) {
StringBuilder msgPayIncomeContractAudit = ValidUtil.validateAll(payIncomeContract); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!StringUtils.isBlank(msgPayIncomeContractAudit)){
throw new JeroBootException(msgPayIncomeContractAudit.toString());
}
if(StringUtils.isBlank(payIncomeContract.getId())){ if(StringUtils.isBlank(payIncomeContract.getId())){
throw new JeroBootException("合同id不能为空!"); throw new JeroBootException("合同id不能为空!");
} }
@@ -400,9 +432,17 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(Objects.isNull(payIncomeContractNew)){ if(Objects.isNull(payIncomeContractNew)){
throw new JeroBootException("合同不存在!"); 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<>(); 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::getId,payIncomeContract.getId());
updatePayIncomeContract.eq(PayIncomeContract::getStatus,PayIncomeContractCommon.STATUS3); updatePayIncomeContract.set(PayIncomeContract::getStatus,PayIncomeContractCommon.STATUS2);
payIncomeContractService.update(updatePayIncomeContract); payIncomeContractService.update(updatePayIncomeContract);
} }
@@ -446,21 +486,25 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
throw new JeroBootException("收入合同不存在!"); throw new JeroBootException("收入合同不存在!");
} }
// 校验合同状态是否为待审核 // 校验合同状态是否为待审核
if(!Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS2)){ if(Objects.isNull(payIncomeContractAudit.getContractStatus()) || !Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS2)
throw new JeroBootException("收入合同不可审核!"); || (!Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS3) && !Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS4))){
} 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.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS4) if(Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS4)
&& StringUtils.isBlank(payIncomeContractAudit.getExplainRemarks())){ && StringUtils.isBlank(payIncomeContractAudit.getExplainRemarks())){
throw new JeroBootException("请输入拒绝说明!"); throw new JeroBootException("请输入拒绝说明!");
} }
if(Objects.equals(payIncomeContractAudit.getContractStatus(),PayIncomeContractCommon.STATUS3)){
payIncomeContractAudit.setExplainRemarks("");
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
LambdaUpdateWrapper<PayIncomeContract> update = new LambdaUpdateWrapper(); 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::getId,payIncomeContractAudit.getContractId());
update.eq(PayIncomeContract::getStatus, payIncomeContractAudit.getContractStatus()); update.set(PayIncomeContract::getStatus, payIncomeContractAudit.getContractStatus());
payIncomeContractService.update(update); payIncomeContractService.update(update);
// 添加审核记录 // 添加审核记录
payIncomeContractAuditService.save(payIncomeContractAudit); payIncomeContractAuditService.save(payIncomeContractAudit);
@@ -468,8 +512,8 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
@Override @Override
@Transactional @Transactional
public void updateArchive(String id) { public void updateArchive(PayIncomeContractAudit payIncomeContractAudit) {
PayIncomeContract payIncomeContractStatus = payIncomeContractService.getById(id); PayIncomeContract payIncomeContractStatus = payIncomeContractService.getById(payIncomeContractAudit.getContractId());
if(Objects.isNull(payIncomeContractStatus)){ if(Objects.isNull(payIncomeContractStatus)){
throw new JeroBootException("收入合同不存在!"); throw new JeroBootException("收入合同不存在!");
} }
@@ -477,13 +521,17 @@ public class PayIncomeContractServiceImpl extends ServiceImpl<PayIncomeContractM
if(!Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS3)){ if(!Objects.equals(payIncomeContractStatus.getStatus(),PayIncomeContractCommon.STATUS3)){
throw new JeroBootException("收入合同不可归档!"); 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(); LambdaUpdateWrapper<PayIncomeContract> update = new LambdaUpdateWrapper();
update.eq(PayIncomeContract::getId,id); update.set(PayIncomeContract::getUpdateBy,sysUser.getUsername());
update.eq(PayIncomeContract::getStatus, PayIncomeContractCommon.STATUS5); update.set(PayIncomeContract::getUpdateTime,new Date());
update.eq(PayIncomeContract::getId,payIncomeContractAudit.getContractId());
update.set(PayIncomeContract::getStatus, PayIncomeContractCommon.STATUS5);
payIncomeContractService.update(update); payIncomeContractService.update(update);
// 添加归档记录 // 添加归档记录
PayIncomeContractAudit payIncomeContractAudit = new PayIncomeContractAudit();
payIncomeContractAudit.setContractId(id);
payIncomeContractAudit.setContractStatus(PayIncomeContractCommon.STATUS5); payIncomeContractAudit.setContractStatus(PayIncomeContractCommon.STATUS5);
payIncomeContractAuditService.save(payIncomeContractAudit); 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 @Data
public class PayIncomeContractDetailOutput extends PayIncomeContract implements Serializable { 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 = "归档记录") @ApiModelProperty(value = "归档记录")
private List<PayIncomeContractAudit> listArchive; private List<PayIncomeContractAuditOutput> listArchive;
/** /**
* 审核记录 * 审核记录
*/ */
@ApiModelProperty(value = "审核记录") @ApiModelProperty(value = "审核记录")
private List<PayIncomeContractAudit> listAudit; private List<PayIncomeContractAuditOutput> listAudit;
} }
@@ -1,9 +1,12 @@
package com.jero.contract.vo; package com.jero.contract.vo;
import com.jero.contract.entity.PayIncomeContract;
import com.jero.contract.entity.PayIncomeContractInstallment;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
@Data @Data
public class PayIncomeContractInput implements Serializable { public class PayIncomeContractInput implements Serializable {
@@ -11,10 +14,10 @@ public class PayIncomeContractInput implements Serializable {
* 合同数据 * 合同数据
*/ */
@ApiModelProperty(value = "合同数据") @ApiModelProperty(value = "合同数据")
private String contract; private PayIncomeContract contract;
/** /**
* 分期信息 * 分期信息
*/ */
@ApiModelProperty(value = "分期信息") @ApiModelProperty(value = "分期信息")
private String installment; private List<PayIncomeContractInstallment> installment;
} }
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
@Data @Data
@ApiModel(value="关联项目", description="关联项目") @ApiModel(value="关联项目", description="关联项目")
@@ -30,6 +31,11 @@ public class ProjectOutput implements Serializable {
*/ */
@ApiModelProperty(value = "来款用途") @ApiModelProperty(value = "来款用途")
private String chargeUse; private String chargeUse;
/**
* 来款用途
*/
@ApiModelProperty(value = "来款用途")
private String chargeUse_dictText;
/** /**
* 来款单位 * 来款单位
*/ */
@@ -59,5 +65,5 @@ public class ProjectOutput implements Serializable {
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private String createTime; private Date createTime;
} }
@@ -1,7 +1,10 @@
package com.jero.meeting.controller; package com.jero.meeting.controller;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; 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.system.vo.LoginUser;
import com.jero.common.util.PasswordUtil; import com.jero.common.util.PasswordUtil;
import com.jero.common.util.ValidUtil; import com.jero.common.util.ValidUtil;
import com.jero.common.util.oConvertUtils;
import com.jero.meeting.common.MeetingCommon; import com.jero.meeting.common.MeetingCommon;
import com.jero.meeting.entity.PayMeeting; import com.jero.meeting.entity.PayMeeting;
import com.jero.meeting.entity.PayMeetingHotelContacts; 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.meeting.vo.PayMeetingVO; import com.jero.meeting.vo.PayMeetingVO;
import com.jero.modules.system.volid.group.UpdateGroup; 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 lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController; 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.beans.BeanUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
@@ -51,6 +62,8 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
private ISysBaseAPI sysBaseApi; private ISysBaseAPI sysBaseApi;
@Resource @Resource
private IPayMeetingHotelContactsService meetingHotelContactsService; private IPayMeetingHotelContactsService meetingHotelContactsService;
@Resource
private IPayWorkingGroupService payWorkingGroupService;
/** /**
* 分页列表查询 * 分页列表查询
@@ -148,22 +161,38 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
@ApiOperation(value = "会议管理-通过id查询", notes = "会议管理-通过id查询") @ApiOperation(value = "会议管理-通过id查询", notes = "会议管理-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name = "id") String id) { public Result<?> queryById(@RequestParam(name = "id") String id) {
PayMeeting payMeeting = payMeetingService.queryById(id); PayMeeting meeting = payMeetingService.queryById(id);
if(payMeeting==null) { if (meeting == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
//查询会议负责人 //查询会议负责人
LoginUser user = sysBaseApi.getUserById(payMeeting.getDirectorId()); LoginUser user = sysBaseApi.getUserById(meeting.getDirectorId());
payMeeting.setDirectorName(user.getUsername()); meeting.setDirectorName(user.getUsername());
payMeeting.setDirectorPhone(PasswordUtil.decrypt(user.getPhone())); meeting.setDirectorPhone(PasswordUtil.decrypt(user.getPhone()));
PayMeetingVO payMeetingVO = new PayMeetingVO(); PayMeetingVO payMeetingVO = new PayMeetingVO();
BeanUtils.copyProperties(payMeetingVO,payMeeting); 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<>(); LambdaQueryWrapper<PayMeetingHotelContacts> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PayMeetingHotelContacts::getMeetingId,payMeeting.getId()); wrapper.eq(PayMeetingHotelContacts::getMeetingId, meeting.getId());
List<PayMeetingHotelContacts> payMeetingHotelContactsList = meetingHotelContactsService.list(wrapper); List<PayMeetingHotelContacts> payMeetingHotelContactsList = meetingHotelContactsService.list(wrapper);
payMeeting.setHotelContactsList(payMeetingHotelContactsList); payMeetingVO.setHotelContactsList(payMeetingHotelContactsList);
return Result.OK(payMeeting); //标协会议类型
//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);
} }
/** /**
@@ -171,7 +200,45 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
*/ */
@GetMapping(value = "/exportXls") @GetMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, PayMeeting payMeeting) { 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, "会议管理");
} }
/** /**
@@ -179,7 +246,7 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
*/ */
@GetMapping(value = "/exportTemplate") @GetMapping(value = "/exportTemplate")
public ModelAndView exportTemplate() { public ModelAndView exportTemplate() {
return super.exportTemplate(PayMeeting.class, "会议管理"); return super.exportTemplate(PayMeetingVO.class, "会议管理");
} }
/** /**
@@ -190,4 +257,17 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
return super.importExcel(request, response, PayMeeting.class); 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; private String id;
/**会议id*/ /**会议id*/
@Excel(name = "会议id", width = 15)
@ApiModelProperty(value = "会议id") @ApiModelProperty(value = "会议id")
private String meetingId; 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.StandardMeeting;
import com.jero.meeting.valid.group.WorkingGroupMeeting; import com.jero.meeting.valid.group.WorkingGroupMeeting;
import com.jero.meeting.vo.PayMeetingVO; 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.apache.shiro.util.CollectionUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@@ -23,6 +25,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -42,7 +45,8 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
private ISysBaseAPI sysBaseApi; private ISysBaseAPI sysBaseApi;
@Resource @Resource
private IPayMeetingHotelContactsService meetingHotelContactsService; private IPayMeetingHotelContactsService meetingHotelContactsService;
@Resource
private IPayWorkingGroupService payWorkingGroupService;
/** /**
* 新增会议 * 新增会议
*/ */
@@ -118,15 +122,29 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
} }
//根据会议类型进行校验 //根据会议类型进行校验
if (meetingType.equals(MeetingCommon.WORKING_GROUP_MEETING)){ switch (meetingType) {
case MeetingCommon.WORKING_GROUP_MEETING:
ValidUtil.validate(payMeetingVO, WorkingGroupMeeting.class); ValidUtil.validate(payMeetingVO, WorkingGroupMeeting.class);
}else if (meetingType.equals(MeetingCommon.STANDARD_MEETING)){ 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); 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(); hotelContactsList = payMeetingVO.getHotelContactsList();
for (PayMeetingHotelContacts hotelContacts : hotelContactsList) { for (PayMeetingHotelContacts hotelContacts : hotelContactsList) {
ValidUtil.validate(hotelContacts, StandardMeeting.class); ValidUtil.validate(hotelContacts, StandardMeeting.class);
} }
}else if (meetingType.equals(MeetingCommon.INTERNATIONAL_MEETING)){ break;
case MeetingCommon.INTERNATIONAL_MEETING:
ValidUtil.validate(payMeetingVO, InternationalMeeting.class); ValidUtil.validate(payMeetingVO, InternationalMeeting.class);
//邀请码不能有重复的 //邀请码不能有重复的
List<String> codeList = new ArrayList<>(); List<String> codeList = new ArrayList<>();
@@ -151,6 +169,8 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
throw new JeroBootException("邀请码不能重复"); throw new JeroBootException("邀请码不能重复");
} }
codeList.add(cooperativeInvitationCode); codeList.add(cooperativeInvitationCode);
break;
default:
} }
@@ -1,6 +1,7 @@
package com.jero.meeting.vo; package com.jero.meeting.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.util.PasswordUtil;
import com.jero.meeting.entity.PayMeetingHotelContacts; import com.jero.meeting.entity.PayMeetingHotelContacts;
import com.jero.meeting.valid.group.InternationalMeeting; import com.jero.meeting.valid.group.InternationalMeeting;
import com.jero.meeting.valid.group.StandardMeeting; import com.jero.meeting.valid.group.StandardMeeting;
@@ -10,6 +11,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Max; import javax.validation.constraints.Max;
@@ -43,24 +45,24 @@ public class PayMeetingVO implements Serializable {
private String meetingName; private String meetingName;
/**会议类型*/ /**会议类型*/
@Excel(name = "会议类型", width = 15,dicCode = "meeting_type") @Excel(name = "会议类型", width = 15)
@ApiModelProperty(value = "会议类型") @ApiModelProperty(value = "会议类型")
@NotBlank(message = "会议类型不能为空") @NotBlank(message = "会议类型不能为空")
private String meetingType; private String meetingType;
/**标协会议类型*/ /**标协会议类型*/
@Excel(name = "标协会议类型", width = 15,dicCode = "standard_meeting_type") @Excel(name = "标协会议类型", width = 15)
@ApiModelProperty(value = "标协会议类型") @ApiModelProperty(value = "标协会议类型")
@NotBlank(message = "标协会议类型不能为空", groups = StandardMeeting.class) @NotBlank(message = "标协会议类型不能为空", groups = StandardMeeting.class)
private String tbMeetingType; private String tbMeetingType;
/**工作组项目id*/ /**工作组项目id*/
@Excel(name = "工作组项目名称", width = 15, dictTable = "pay_working_group",dicText = "working_group_project",dicCode = "id")
@ApiModelProperty(value = "工作组项目id") @ApiModelProperty(value = "工作组项目id")
@NotBlank(message = "工作组项目名称不能为空", groups = WorkingGroupMeeting.class) @NotBlank(message = "工作组项目名称不能为空", groups = WorkingGroupMeeting.class)
private String workingGroupId; private String workingGroupId;
/**工作组项目名称*/ /**工作组项目名称*/
@Excel(name = "工作组项目名称", width = 15)
@ApiModelProperty(value = "工作组项目名称") @ApiModelProperty(value = "工作组项目名称")
private String workingGroupName; private String workingGroupName;
@@ -185,17 +187,17 @@ public class PayMeetingVO implements Serializable {
private Integer meetingCostsVip; private Integer meetingCostsVip;
/**会议负责人id*/ /**会议负责人id*/
@Excel(name = "会议负责人", width = 15,dictTable = "sys_user",dicText = "username",dicCode = "id")
@ApiModelProperty(value = "会议负责人id") @ApiModelProperty(value = "会议负责人id")
@NotBlank(message = "会议负责人不能为空") @NotBlank(message = "会议负责人不能为空")
private String directorId; private String directorId;
/**会议负责人*/ /**会议负责人*/
@Excel(name = "会议负责人", width = 15)
@ApiModelProperty(value = "会议负责人") @ApiModelProperty(value = "会议负责人")
private String directorName; private String directorName;
/**会议负责人手机号*/ /**会议负责人手机号*/
@Excel(name = "会议负责人手机号", width = 15,exportConvert = true) @Excel(name = "会议负责人手机号", width = 15)
@ApiModelProperty(value = "会议负责人手机号") @ApiModelProperty(value = "会议负责人手机号")
private String directorPhone; private String directorPhone;
@@ -216,6 +218,7 @@ public class PayMeetingVO implements Serializable {
/** /**
* 会议关联酒店联系人列表 * 会议关联酒店联系人列表
*/ */
@ExcelCollection(name = "酒店联系人列表")
@NotNull(message = "酒店联系人不能为空",groups = StandardMeeting.class) @NotNull(message = "酒店联系人不能为空",groups = StandardMeeting.class)
@Size(max = 5, message = "酒店联系人最多为5个",groups = StandardMeeting.class) @Size(max = 5, message = "酒店联系人最多为5个",groups = StandardMeeting.class)
private List<PayMeetingHotelContacts> hotelContactsList; private List<PayMeetingHotelContacts> hotelContactsList;
@@ -1,5 +1,6 @@
package com.jero.member.service.impl; package com.jero.member.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.common.util.ValidUtil; import com.jero.common.util.ValidUtil;
import com.jero.company.entity.PayContactsManagement; import com.jero.company.entity.PayContactsManagement;
@@ -54,6 +55,14 @@ public class PayPayMemberProjectSubitemServiceImpl extends ServiceImpl<PayMember
if (memberProject == null){ if (memberProject == null){
throw new JeroBootException("会员项目不存在"); 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); validMemberProjectSubitem(payMemberProjectSubitem);
//实收金额 //实收金额
payMemberProjectSubitem.setPaidAmount(0); payMemberProjectSubitem.setPaidAmount(0);
@@ -80,7 +89,7 @@ public class PayPayMemberProjectSubitemServiceImpl extends ServiceImpl<PayMember
} }
//无法更改状态 //无法更改状态
payMemberProjectSubitem.setPack(payMemberProjectSubitem1.getPack()); payMemberProjectSubitem.setPack(payMemberProjectSubitem1.getPack());
payMemberProjectSubitem.setNeedInvoice(payMemberProjectSubitem1.getNeedInvoice()); //payMemberProjectSubitem.setNeedInvoice(payMemberProjectSubitem1.getNeedInvoice());
payMemberProjectSubitem.setInAccount(payMemberProjectSubitem1.getInAccount()); payMemberProjectSubitem.setInAccount(payMemberProjectSubitem1.getInAccount());
payMemberProjectSubitem.setMakeInvoice(payMemberProjectSubitem1.getMakeInvoice()); payMemberProjectSubitem.setMakeInvoice(payMemberProjectSubitem1.getMakeInvoice());
payMemberProjectSubitem.setMail(payMemberProjectSubitem1.getMail()); payMemberProjectSubitem.setMail(payMemberProjectSubitem1.getMail());
@@ -73,7 +73,62 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
if(!Objects.isNull(pageList)){ if(!Objects.isNull(pageList)){
List<PayWorkingGroupVO> listPayWorkingGroupVO = pageList.getRecords(); List<PayWorkingGroupVO> listPayWorkingGroupVO = pageList.getRecords();
if(!CollectionUtils.isEmpty(listPayWorkingGroupVO)){ if(!CollectionUtils.isEmpty(listPayWorkingGroupVO)){
listPayWorkingGroupVO.forEach(p->{ setPayWorkingGroupSubItem(listPayWorkingGroupVO);
pageList.setRecords(listPayWorkingGroupVO);
}
}
return Result.OK(pageList);
}
/**
* 列表查询
*
* @param payWorkingGroup 工作组项目
* @param req
* @return
*/
@AutoLog(value = "工作组项目-列表查询")
@ApiOperation(value="工作组项目-列表查询", notes="工作组项目-列表查询")
@GetMapping(value = "/listAll")
public Result<?> queryList(PayWorkingGroup payWorkingGroup,HttpServletRequest req) {
QueryWrapper<PayWorkingGroup> queryWrapper = QueryGenerator.initQueryWrapper(payWorkingGroup, req.getParameterMap());
List<PayWorkingGroup> list = payWorkingGroupService.list(queryWrapper);
return Result.OK(list);
}
/**
* 根据成员单位列表查询
*
* @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<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<>(); LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,p.getId()); query.eq(PayWorkingGroupSubItem::getWorkingGroupId,p.getId());
List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query); List<PayWorkingGroupSubItem> listPayWorkingGroupSubItem = payWorkingGroupSubItemService.list(query);
@@ -104,44 +159,6 @@ public class PayWorkingGroupController extends JeroController<PayWorkingGroup, I
p.setObj(payWorkingGroupPayment); p.setObj(payWorkingGroupPayment);
} }
}); });
pageList.setRecords(listPayWorkingGroupVO);
}
}
return Result.OK(pageList);
}
/**
* 列表查询
*
* @param payWorkingGroup 工作组项目
* @param req
* @return
*/
@AutoLog(value = "工作组项目-列表查询")
@ApiOperation(value="工作组项目-列表查询", notes="工作组项目-列表查询")
@GetMapping(value = "/listAll")
public Result<?> queryList(PayWorkingGroup payWorkingGroup,HttpServletRequest req) {
QueryWrapper<PayWorkingGroup> queryWrapper = QueryGenerator.initQueryWrapper(payWorkingGroup, req.getParameterMap());
List<PayWorkingGroup> list = payWorkingGroupService.list(queryWrapper);
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)){
return Result.error("企业id不能为空!");
}
List<PayWorkingGroup> list = payWorkingGroupService.queryListByCompany(companyId,year);
return Result.OK(list);
} }
/** /**
@@ -145,11 +145,12 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
* 查询工作组成员是否收费通知 * 查询工作组成员是否收费通知
* *
* @param ids 工作组成员ids 逗号分隔 * @param ids 工作组成员ids 逗号分隔
* @param workingGroupId 工作组id
* @return * @return
*/ */
@ApiOperation(value="工作组成员-查询工作组成员是否收费通知", notes="工作组成员-查询工作组成员是否收费通知") @ApiOperation(value="工作组成员-查询工作组成员是否收费通知", notes="工作组成员-查询工作组成员是否收费通知")
@GetMapping(value = "/getCharge") @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)){ if(StringUtils.isBlank(ids)){
return Result.error("id不能为空!"); return Result.error("id不能为空!");
} }
@@ -161,6 +162,7 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
} }
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.in(PayWorkingGroupSubItem::getId,Arrays.asList(ids.split(","))); query.in(PayWorkingGroupSubItem::getId,Arrays.asList(ids.split(",")));
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,workingGroupId);
List<PayWorkingGroupSubItem> list = payWorkingGroupSubItemService.list(); List<PayWorkingGroupSubItem> list = payWorkingGroupSubItemService.list();
if(!CollectionUtils.isEmpty(list)){ if(!CollectionUtils.isEmpty(list)){
List<PayWorkingGroupSubItem> listNew = list.stream().filter(p->!Objects.equals(p.getChargeWay(),PayProjectCommon.CHARGE_WAY3)).collect(Collectors.toList()); 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 * @Return
* @Exception * @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> </where>
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="queryListByCompany" resultType="com.jero.project.entity.PayWorkingGroup"> <select id="queryListByCompany" resultType="com.jero.project.vo.PayWorkingGroupVO">
SELECT SELECT
pwg.id, pwg.id,
pwg.working_group_project AS workingGroupProject, pwg.working_group_project AS workingGroupProject,
@@ -64,6 +64,9 @@
FROM pay_working_group pwg FROM pay_working_group pwg
LEFT JOIN pay_working_group_subitem pwgs ON pwg.id = pwgs.working_group_id LEFT JOIN pay_working_group_subitem pwgs ON pwg.id = pwgs.working_group_id
<where> <where>
<if test="workingGroupProject != null and workingGroupProject != ''">
AND pwg.working_group_project = #{workingGroupProject}
</if>
<if test="companyId != null and companyId != ''"> <if test="companyId != null and companyId != ''">
AND pwgs.charge_company_id = #{companyId} AND pwgs.charge_company_id = #{companyId}
</if> </if>
@@ -32,5 +32,5 @@ public interface IPayWorkingGroupService extends IService<PayWorkingGroup> {
* @Return * @Return
* @Exception * @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 @Override
public List<PayWorkingGroup> queryListByCompany(String companyId, String year) { public List<PayWorkingGroupVO> queryListByCompany(String companyId,String workingGroupProject, String year) {
return payWorkingGroupMapper.queryListByCompany(companyId,year); return payWorkingGroupMapper.queryListByCompany(companyId,workingGroupProject,year);
} }
} }
@@ -37,6 +37,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -83,24 +84,24 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
public void addPayWorkingGroupSubItem(PayWorkingGroupSubItem payWorkingGroupSubItem) { public void addPayWorkingGroupSubItem(PayWorkingGroupSubItem payWorkingGroupSubItem) {
if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY2){ if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY2){
if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){
throw new RuntimeException("应收金额不能为空"); throw new JeroBootException("应收金额不能为空");
} }
if(StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())){ if(StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())){
throw new RuntimeException("合同号不能为空"); throw new JeroBootException("合同号不能为空");
} }
} }
if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY3){ if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY3){
if(Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())){ if(Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())){
throw new RuntimeException("收费通知号不能为空"); throw new JeroBootException("收费通知号不能为空");
} }
if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){
throw new RuntimeException("应收金额不能为空"); throw new JeroBootException("应收金额不能为空");
} }
} }
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId()); PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){ if(Objects.isNull(payWorkingGroup)){
throw new RuntimeException("工作组不存在!"); throw new JeroBootException("工作组不存在!");
} }
try { try {
@@ -112,11 +113,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
PayWorkingGroupSubItem payWorkingGroupSubItemNew = payWorkingGroupSubItemService.getOne(queryWrapper); PayWorkingGroupSubItem payWorkingGroupSubItemNew = payWorkingGroupSubItemService.getOne(queryWrapper);
// 企业和联系人同时存在,则校验不通过 // 企业和联系人同时存在,则校验不通过
if(!Objects.isNull(payWorkingGroupSubItemNew)) { if(!Objects.isNull(payWorkingGroupSubItemNew)) {
throw new RuntimeException("工作组成员单位已存在!"); throw new JeroBootException("工作组成员单位已存在!");
} }
}catch (Exception e){ }catch (Exception e){
log.info("工作组成员-添加异常",e); log.info("工作组成员-添加异常",e);
throw new RuntimeException("工作组成员单位已存在!"); throw new JeroBootException("工作组成员单位已存在!");
} }
payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem); payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem);
@@ -132,23 +133,23 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
public void editPayWorkingGroupSubItem(PayWorkingGroupSubItem payWorkingGroupSubItem) { public void editPayWorkingGroupSubItem(PayWorkingGroupSubItem payWorkingGroupSubItem) {
if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY2){ if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY2){
if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){
throw new RuntimeException("应收金额不能为空"); throw new JeroBootException("应收金额不能为空");
} }
if(StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())){ if(StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())){
throw new RuntimeException("合同号不能为空"); throw new JeroBootException("合同号不能为空");
} }
} }
if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY3){ if(payWorkingGroupSubItem.getChargeWay() == PayProjectCommon.CHARGE_WAY3){
if(Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())){ if(Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())){
throw new RuntimeException("收费通知号不能为空"); throw new JeroBootException("收费通知号不能为空");
} }
if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){
throw new RuntimeException("应收金额不能为空"); throw new JeroBootException("应收金额不能为空");
} }
} }
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId()); PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId());
if(Objects.isNull(payWorkingGroup)){ if(Objects.isNull(payWorkingGroup)){
throw new RuntimeException("工作组不存在!"); throw new JeroBootException("工作组不存在!");
} }
try { try {
// 编辑保存前再次校验来款项目是否存在 // 编辑保存前再次校验来款项目是否存在
@@ -160,11 +161,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
// 来款项目存在,并且编辑id与查询不同,则校验不通过 // 来款项目存在,并且编辑id与查询不同,则校验不通过
if(!Objects.isNull(payWorkingGroupSubItemNew) if(!Objects.isNull(payWorkingGroupSubItemNew)
&& !Objects.equals(payWorkingGroupSubItemNew.getId(),payWorkingGroupSubItem.getId())) { && !Objects.equals(payWorkingGroupSubItemNew.getId(),payWorkingGroupSubItem.getId())) {
throw new RuntimeException("工作组成员单位已存在!"); throw new JeroBootException("工作组成员单位已存在!");
} }
}catch (Exception e){ }catch (Exception e){
log.info("工作组成员-编辑异常",e); log.info("工作组成员-编辑异常",e);
throw new RuntimeException("工作组成员单位已存在!"); throw new JeroBootException("工作组成员单位已存在!");
} }
payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem); payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem);
@@ -180,29 +181,33 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
workGroupId = multipartRequest.getParameter("workGroupId"); workGroupId = multipartRequest.getParameter("workGroupId");
}catch (Exception e){ }catch (Exception e){
log.error("获取工作组id异常",e); log.error("获取工作组id异常",e);
throw new RuntimeException("工作组id不能为空 !"); throw new JeroBootException("工作组id不能为空 !");
} }
if(StringUtils.isBlank(workGroupId)){ if(StringUtils.isBlank(workGroupId)){
throw new RuntimeException("工作组id不能为空 !"); throw new JeroBootException("工作组id不能为空 !");
} }
StringBuilder msg = new StringBuilder();
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setTitleRows(1); params.setTitleRows(1);
params.setHeadRows(1); params.setHeadRows(1);
try {
//导入Excel格式校验,看匹配的字段文本概率 //导入Excel格式校验,看匹配的字段文本概率
try {
Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), PayWorkingGroupSubItem.class, params); Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), PayWorkingGroupSubItem.class, params);
if(!t){ 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); List<PayWorkingGroupSubItem> list = ExcelImportUtil.importExcel(file.getInputStream(), PayWorkingGroupSubItem.class, params);
if(!CollectionUtils.isEmpty(list)){ if(!CollectionUtils.isEmpty(list)){
// 校验重复成员的集合 // 校验重复成员的集合
List<PayWorkingGroupSubItem> listCompanyAndContacts = new ArrayList<>(); List<PayWorkingGroupSubItem> listCompanyAndContacts = new ArrayList<>();
StringBuilder msg = new StringBuilder();
// 获取excel中的企业名称 // 获取excel中的企业名称
List<String> listCompanyName = list.stream().map(PayWorkingGroupSubItem::getChargeCompanyTemporaryName).collect(Collectors.toList()); List<String> listCompanyName = list.stream().map(PayWorkingGroupSubItem::getChargeCompanyTemporaryName).collect(Collectors.toList());
// 获取excel企业信息 // 获取excel企业信息
@@ -210,7 +215,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
companyWrapper.in(PayCompanyManagement::getCompanyName,listCompanyName); companyWrapper.in(PayCompanyManagement::getCompanyName,listCompanyName);
List<PayCompanyManagement> listCompanyInfo = payCompanyManagementService.list(companyWrapper); List<PayCompanyManagement> listCompanyInfo = payCompanyManagementService.list(companyWrapper);
if(CollectionUtils.isEmpty(listCompanyInfo)){ if(CollectionUtils.isEmpty(listCompanyInfo)){
throw new RuntimeException("excel中企业不存在 !"); msg.append("excel中企业不存在 !");
} }
List<String> listContactsName = new ArrayList<>(); List<String> listContactsName = new ArrayList<>();
// 获取excel中联系人一名称 // 获取excel中联系人一名称
@@ -238,14 +243,14 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
contactsWrapper.in(PayContactsManagement::getName,listContactsName); contactsWrapper.in(PayContactsManagement::getName,listContactsName);
List<PayContactsManagement> listContactsInfo = payContactsManagementService.list(contactsWrapper); List<PayContactsManagement> listContactsInfo = payContactsManagementService.list(contactsWrapper);
if(CollectionUtils.isEmpty(listContactsInfo)){ if(CollectionUtils.isEmpty(listContactsInfo)){
throw new RuntimeException("excel中联系人不存在 !"); msg.append("excel中联系人不存在 !");
} }
// 获取工作组信息 // 获取工作组信息
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(workGroupId); PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(workGroupId);
if(Objects.isNull(payWorkingGroup)){ if(Objects.isNull(payWorkingGroup)){
throw new RuntimeException("工作组不存在 !"); msg.append("工作组不存在 !");
} }
if(StringUtils.isBlank(msg)) {
// 获取工作组成员 // 获取工作组成员
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId, workGroupId); query.eq(PayWorkingGroupSubItem::getWorkingGroupId, workGroupId);
@@ -379,9 +384,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
msg.append(s); msg.append(s);
} }
}); });
if(!StringUtils.isBlank(msg)){ if (StringUtils.isBlank(msg)) {
throw new RuntimeException(msg.toString());
}
// 拷贝企业,联系人 // 拷贝企业,联系人
list.forEach(p -> { list.forEach(p -> {
setPayWorkingGroupSubItem(p); setPayWorkingGroupSubItem(p);
@@ -389,9 +392,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
// 更新数据 // 更新数据
payWorkingGroupSubItemService.saveBatch(list); payWorkingGroupSubItemService.saveBatch(list);
} }
}
}
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(),e);
throw new RuntimeException("文件导入失败!"); throw new JeroBootException("文件导入失败!");
} finally { } finally {
try { try {
file.getInputStream().close(); file.getInputStream().close();
@@ -399,6 +404,9 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
e.printStackTrace(); e.printStackTrace();
} }
} }
if(!StringUtils.isBlank(msg)){
throw new JeroBootException(msg.toString());
}
} }
} }
@@ -1,6 +1,8 @@
package com.jero.modules.system.controller; package com.jero.modules.system.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.SysConfusion;
import com.jero.modules.system.entity.SysDepartRolePermission; import com.jero.modules.system.entity.SysDepartRolePermission;
import com.jero.modules.system.mapper.SysConfusionMapper; import com.jero.modules.system.mapper.SysConfusionMapper;
@@ -52,6 +54,11 @@ public class DuplicateCheckController {
duplicateCheckVo.setTableName(sysConfusion.getTableName()); duplicateCheckVo.setTableName(sysConfusion.getTableName());
duplicateCheckVo.setFieldName(sysConfusion.getFieldName()); duplicateCheckVo.setFieldName(sysConfusion.getFieldName());
//如果加密字段有值,则把校验数据进行加密后在判断
String encrypt = duplicateCheckVo.getEncrypt();
if (StrUtil.isNotBlank(encrypt)){
duplicateCheckVo.setFieldVal(PasswordUtil.encrypt(duplicateCheckVo.getFieldVal()));
}
log.info("----duplicate check------:" + duplicateCheckVo.toString()); log.info("----duplicate check------:" + duplicateCheckVo.toString());
//关联表字典(举例:sys_user,realname,id) //关联表字典(举例:sys_user,realname,id)
//SQL注入校验(只限制非法串改数据库) //SQL注入校验(只限制非法串改数据库)
@@ -50,4 +50,10 @@ public class DuplicateCheckVo implements Serializable {
@ApiModelProperty(value="数据ID",name="dataId",example="2000") @ApiModelProperty(value="数据ID",name="dataId",example="2000")
private String dataId; private String dataId;
/**
* 是否加密
*/
@ApiModelProperty(value="是否加密",name="encrypt")
private String encrypt;
} }
@@ -144,7 +144,7 @@ spring:
#redis 配置 #redis 配置
redis: redis:
database: 14 database: 14
host: 192.168.18.254 host: 121.36.69.172
lettuce: lettuce:
pool: pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制 max-active: 8 #最大连接数据库连接数,设 0 为没有限制
@@ -153,7 +153,7 @@ spring:
min-idle: 0 #最小等待连接中的数量,设 0 为没有限制 min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
shutdown-timeout: 100ms shutdown-timeout: 100ms
password: hzwlsoft.com password: hzwlsoft.com
port: 6379 port: 4780
#mybatis plus 设置 #mybatis plus 设置
mybatis-plus: mybatis-plus: