打包管理

This commit is contained in:
梁琦涛
2021-09-13 09:31:12 +08:00
parent 33784ef5bf
commit 4933ad59cd
23 changed files with 714 additions and 135 deletions
@@ -0,0 +1,40 @@
package com.jero.common.common;
public class ProjectCommon {
/**
* 打包(1:是,0:否)
*/
public final static Integer PACKAGING0 = 0;
/**
* 打包(1:是,0:否)
*/
public final static Integer PACKAGING1 = 1;
/**
* 项目类型(1:普通项目,2:工作组项目,3:会议项目,4:会员项目,5:标协会员项目)
*/
public final static String PROJECT_TYPE1 = "1";
/**
* 项目类型(1:普通项目,2:工作组项目,3:会议项目,4:会员项目,5:标协会员项目)
*/
public final static String PROJECT_TYPE2 = "2";
/**
* 项目类型(1:普通项目,2:工作组项目,3:会议项目,4:会员项目,5:标协会员项目)
*/
public final static String PROJECT_TYPE3 = "3";
/**
* 项目类型(1:普通项目,2:工作组项目,3:会议项目,4:会员项目,5:标协会员项目)
*/
public final static String PROJECT_TYPE4 = "4";
/**
* 项目类型(1:普通项目,2:工作组项目,3:会议项目,4:会员项目,5:标协会员项目)
*/
public final static String PROJECT_TYPE5 = "5";
/**
* 来源(1:收入合同,2:打包管理)
*/
public final static Integer COME1 = 1;
/**
* 来源(1:收入合同,2:打包管理)
*/
public final static Integer COME2 = 2;
}
@@ -0,0 +1,16 @@
package com.jero.common.service;
public interface ProjectPackService {
/**
* @Description 更新项目状态
* @Author lqt
* @Date 2021/9/12
* @Param projectId 项目id
* @Param projectType 项目类型(1:普通项目,2:工作组项目,3:会议项目,4:会员项目,5:标协会员项目)
* @Param packStatus 打包(1:是,0:否)
* @Param packId 打包id
* @Return
* @Exception
*/
void updateProjectStatus(String projectId,String projectType,String packStatus,String packId);
}
@@ -6,6 +6,7 @@ import com.jero.common.exception.JeroBootException;
import com.jero.common.service.ProjectDetailService;
import com.jero.mail.entity.PayMailBill;
import com.jero.mail.service.IPayMailBillService;
import com.jero.pack.common.PackCommon;
import com.jero.payment.entity.PayPaymentRecord;
import com.jero.payment.service.IPayPaymentRecordService;
import com.jero.temporary.entity.PayCompanyManagementTemporary;
@@ -17,6 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
@Service
public class ProjectDetailServiceImpl implements ProjectDetailService {
@@ -0,0 +1,148 @@
package com.jero.common.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.common.service.ProjectPackService;
import com.jero.common.system.vo.LoginUser;
import com.jero.meeting.entity.PayMeetingSituation;
import com.jero.meeting.service.IPayMeetingSituationService;
import com.jero.member.entity.PayMemberProjectSubitem;
import com.jero.member.entity.TbMemberProjectSubitem;
import com.jero.member.service.IPayMemberProjectSubitemService;
import com.jero.member.service.ITbMemberProjectSubitemService;
import com.jero.pack.common.PackCommon;
import com.jero.pack.entity.PayPackCompany;
import com.jero.pack.service.IPayPackCompanyService;
import com.jero.project.entity.PayCommonProject;
import com.jero.project.entity.PayWorkingGroupSubItem;
import com.jero.project.service.IPayCommonProjectService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;
@Service
public class ProjectPackServiceImpl implements ProjectPackService {
@Autowired
private IPayCommonProjectService payCommonProjectService;
@Autowired
private IPayWorkingGroupSubItemService payWorkingGroupSubItemService;
@Resource
private IPayMeetingSituationService payMeetingSituationService;
@Resource
private IPayMemberProjectSubitemService payMemberProjectSubitemService;
@Resource
private ITbMemberProjectSubitemService tbMemberProjectSubitemService;
@Autowired
private IPayPackCompanyService payPackCompanyService;
@Override
public void updateProjectStatus(String projectId, String projectType, String packStatus,String packId) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
PayPackCompany payPackCompany = payPackCompanyService.getById(packId);
if(Objects.isNull(payPackCompany)){
throw new JeroBootException("打包企业不存在!");
}
switch (projectType){
// 普通项目
case PackCommon.PROJECT_TYPE1:
// 验证项目是否存在
PayCommonProject payCommonProjectOld = payCommonProjectService.getById(projectId);
if(Objects.isNull(payCommonProjectOld)){
throw new JeroBootException("项目不存在!");
}
// 验证企业是否正确
if(!Objects.equals(payCommonProjectOld.getChargeCompanyId(),payPackCompany.getCompanyId())){
throw new JeroBootException("企业不匹配!");
}
LambdaUpdateWrapper<PayCommonProject> payCommonProject = new LambdaUpdateWrapper<>();
payCommonProject.eq(PayCommonProject::getId,projectId);
payCommonProject.set(PayCommonProject::getPack,packStatus);
payCommonProject.set(PayCommonProject::getUpdateBy,sysUser.getUsername());
payCommonProject.set(PayCommonProject::getUpdateTime,new Date());
payCommonProjectService.update(payCommonProject);
break;
// 工作组项目
case PackCommon.PROJECT_TYPE2:
// 验证项目是否存在
PayWorkingGroupSubItem payWorkingGroupSubItemOld = payWorkingGroupSubItemService.getById(projectId);
if(Objects.isNull(payWorkingGroupSubItemOld)){
throw new JeroBootException("项目不存在!");
}
// 验证企业是否正确
if(!Objects.equals(payWorkingGroupSubItemOld.getChargeCompanyId(),payPackCompany.getCompanyId())){
throw new JeroBootException("企业不匹配!");
}
LambdaUpdateWrapper<PayWorkingGroupSubItem> payWorkingGroupSubItem = new LambdaUpdateWrapper<>();
payWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId,projectId);
payWorkingGroupSubItem.set(PayWorkingGroupSubItem::getPack,packStatus);
payWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateBy,sysUser.getUsername());
payWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateTime,new Date());
payWorkingGroupSubItemService.update(payWorkingGroupSubItem);
break;
// 会议项目
case PackCommon.PROJECT_TYPE3:
// 验证项目是否存在
PayMeetingSituation payMeetingSituationOld = payMeetingSituationService.getById(projectId);
if(Objects.isNull(payMeetingSituationOld)){
throw new JeroBootException("项目不存在!");
}
// 验证企业是否正确
if(!Objects.equals(payMeetingSituationOld.getCompanyId(),payPackCompany.getCompanyId())){
throw new JeroBootException("企业不匹配!");
}
LambdaUpdateWrapper<PayMeetingSituation> payMeetingSituation = new LambdaUpdateWrapper<>();
payMeetingSituation.eq(PayMeetingSituation::getId,projectId);
payMeetingSituation.set(PayMeetingSituation::getPack,packStatus);
payMeetingSituation.set(PayMeetingSituation::getAmountReceivable,new BigDecimal("0.00"));
payMeetingSituation.set(PayMeetingSituation::getPaidAmount,new BigDecimal("0.00"));
payMeetingSituation.set(PayMeetingSituation::getUpdateBy,sysUser.getUsername());
payMeetingSituation.set(PayMeetingSituation::getUpdateTime,new Date());
payMeetingSituationService.update(payMeetingSituation);
break;
// 会员项目
case PackCommon.PROJECT_TYPE4:
// 验证项目是否存在
PayMemberProjectSubitem payMemberProjectSubitemOld = payMemberProjectSubitemService.getById(projectId);
if(Objects.isNull(payMemberProjectSubitemOld)){
throw new JeroBootException("项目不存在!");
}
// 验证企业是否正确
if(!Objects.equals(payMemberProjectSubitemOld.getCompanyId(),payPackCompany.getCompanyId())){
throw new JeroBootException("企业不匹配!");
}
LambdaUpdateWrapper<PayMemberProjectSubitem> payMemberProjectSubitem = new LambdaUpdateWrapper<>();
payMemberProjectSubitem.eq(PayMemberProjectSubitem::getId,projectId);
payMemberProjectSubitem.set(PayMemberProjectSubitem::getPack,packStatus);
payMemberProjectSubitem.set(PayMemberProjectSubitem::getUpdateBy,sysUser.getUsername());
payMemberProjectSubitem.set(PayMemberProjectSubitem::getUpdateTime,new Date());
payMemberProjectSubitemService.update(payMemberProjectSubitem);
break;
// 标协会员
case PackCommon.PROJECT_TYPE5:
// 验证项目是否存在
TbMemberProjectSubitem tbMemberProjectSubitemOld = tbMemberProjectSubitemService.getById(projectId);
if(Objects.isNull(tbMemberProjectSubitemOld)){
throw new JeroBootException("项目不存在!");
}
// 验证企业是否正确
if(!Objects.equals(tbMemberProjectSubitemOld.getCompanyId(),payPackCompany.getCompanyId())){
throw new JeroBootException("企业不匹配!");
}
LambdaUpdateWrapper<TbMemberProjectSubitem> tbMemberProjectSubitem = new LambdaUpdateWrapper<>();
tbMemberProjectSubitem.eq(TbMemberProjectSubitem::getId,projectId);
tbMemberProjectSubitem.set(TbMemberProjectSubitem::getPack,packStatus);
tbMemberProjectSubitem.set(TbMemberProjectSubitem::getUpdateBy,sysUser.getUsername());
tbMemberProjectSubitem.set(TbMemberProjectSubitem::getUpdateTime,new Date());
tbMemberProjectSubitemService.update(tbMemberProjectSubitem);
break;
default:break;
}
}
}