|
@@ -38,6 +38,7 @@ import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.records.bo.CovenantCheckRecordAddBo;
|
|
|
import com.zhongzheng.modules.records.bo.CovenantCheckRecordQueryBo;
|
|
|
+import com.zhongzheng.modules.records.domain.CovenantCheckRecord;
|
|
|
import com.zhongzheng.modules.records.service.ICovenantCheckRecordService;
|
|
|
import com.zhongzheng.modules.records.vo.CovenantCheckRecordVo;
|
|
|
import com.zhongzheng.modules.system.domain.SysTenant;
|
|
@@ -101,6 +102,28 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
List<BsCovenantVo> covenantVoArrayList = new ArrayList<>();
|
|
|
if (!bsCovenantVos.isEmpty()) {
|
|
|
bsCovenantVos.forEach(bsCovenantVo -> {
|
|
|
+ SysTenant tenantId = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
|
|
|
+ String deliveryAddress = tenantId.getDeliveryAddress();
|
|
|
+ if (Validator.isNotEmpty(deliveryAddress)) {
|
|
|
+ List<TenantCovenantInfoAddBo> tenantCovenantInfoAddBos = JSONArray.parseArray(deliveryAddress, TenantCovenantInfoAddBo.class);
|
|
|
+ if (!tenantCovenantInfoAddBos.isEmpty()) {
|
|
|
+ TenantCovenantInfoAddBo tenantCovenantInfoAddBo = tenantCovenantInfoAddBos.get(0);
|
|
|
+ bsCovenantVo.setYiCompanyName(tenantId.getTenantName());
|
|
|
+ bsCovenantVo.setYiCompanyAddress(tenantCovenantInfoAddBo.getYiCompanyAddress());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ CovenantCheckRecord covenantCheckRecord = new CovenantCheckRecord();
|
|
|
+ if (bsCovenantVo.getStatus()==4){
|
|
|
+ covenantCheckRecord = iCovenantCheckRecordService.getOne(new LambdaQueryWrapper<CovenantCheckRecord>().eq(CovenantCheckRecord::getCovenantId, bsCovenantVo.getCovenantId())
|
|
|
+ .eq(CovenantCheckRecord::getUserId, bo.getUserId()).eq(CovenantCheckRecord::getStatus, 1).eq(CovenantCheckRecord::getCheckStatus,1));
|
|
|
+ }
|
|
|
+ if (bsCovenantVo.getStopStatus()==3){
|
|
|
+ covenantCheckRecord = iCovenantCheckRecordService.getOne(new LambdaQueryWrapper<CovenantCheckRecord>().eq(CovenantCheckRecord::getCovenantId, bsCovenantVo.getCovenantId())
|
|
|
+ .eq(CovenantCheckRecord::getUserId, bo.getUserId()).eq(CovenantCheckRecord::getStatus, 1).eq(CovenantCheckRecord::getCheckStatus,2));
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(covenantCheckRecord)){
|
|
|
+ bsCovenantVo.setCheckRecord(covenantCheckRecord.getCheckRecord());
|
|
|
+ }
|
|
|
bsCovenantVo.setCycleWarning(bo.getCycleWarning());
|
|
|
bsCovenantVo.setJiaCompanyName(iCompanyService.getById(bsCovenantVo.getCompanyId()).getCompanyName());
|
|
|
BsCovenantBusinessQueryBo bsCovenantBusinessQueryBo = new BsCovenantBusinessQueryBo();
|
|
@@ -122,7 +145,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
Goods goods = iGoodsService.getById(bsCovenantGoodsVo.getGoodsId());
|
|
|
bsCovenantGoodsVo.setGoodsName(goods.getGoodsName());
|
|
|
Long majorId = goods.getMajorId();
|
|
|
- if (ObjectUtils.isNotNull(majorId)){
|
|
|
+ if (ObjectUtils.isNotNull(majorId)) {
|
|
|
Major byId = iMajorService.getById(majorId);
|
|
|
bsCovenantGoodsVo.setMajorName(byId.getCategoryName());
|
|
|
}
|
|
@@ -209,10 +232,19 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean insertByAddBo(BsCovenantAddBo bo) {
|
|
|
+ List<BsCovenant> bsCovenants = this.list();
|
|
|
+ List<String> collect = bsCovenants.stream().map(BsCovenant::getCovenantNum).collect(Collectors.toList());
|
|
|
+ if (ObjectUtils.isNull(bo.getCovenantNum())) {
|
|
|
+ throw new CustomException("协议编号不能为空");
|
|
|
+ }
|
|
|
+ if (collect.contains(bo.getCovenantNum())) {
|
|
|
+ throw new CustomException("协议编号重复");
|
|
|
+ }
|
|
|
BsCovenant add = BeanUtil.toBean(bo, BsCovenant.class);
|
|
|
- add.setFormApp(2L);
|
|
|
String companyId = ServletUtils.getRequest().getHeader("companyId");
|
|
|
- add.setCompanyId(Long.valueOf(companyId));
|
|
|
+ if (Validator.isNotEmpty(companyId)){
|
|
|
+ add.setCompanyId(Long.valueOf(companyId));
|
|
|
+ }
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
SysTenant yiSysTenant = iSysTenantService.getOne(new LambdaQueryWrapper<SysTenant>().eq(SysTenant::getTenantId, ServletUtils.getRequest().getHeader("TenantId")));
|
|
@@ -223,12 +255,11 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
//写入协议审核流程
|
|
|
SysTenant sysTenant = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
|
|
|
if (ObjectUtils.isNotNull(sysTenant)) {
|
|
|
- List<String> list = Arrays.asList(sysTenant.getAppList());
|
|
|
- list.forEach(item -> {
|
|
|
- BsCovenantCheckAddBo bsCovenantCheckAddBo = new BsCovenantCheckAddBo();
|
|
|
- bsCovenantCheckAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
- bsCovenantCheckAddBo.setCompanyId(Long.valueOf(companyId));
|
|
|
- List<String> list1 = Arrays.asList(item.split(","));
|
|
|
+ BsCovenantCheckAddBo bsCovenantCheckAddBo = new BsCovenantCheckAddBo();
|
|
|
+ bsCovenantCheckAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
+ bsCovenantCheckAddBo.setCompanyId(Long.valueOf(companyId));
|
|
|
+ if (!sysTenant.getAppList().isEmpty()) {
|
|
|
+ List<String> list1 = Arrays.asList(sysTenant.getAppList().split(","));
|
|
|
List<Long> longList = list1.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
|
longList.forEach(num -> {
|
|
|
bsCovenantCheckAddBo.setAppId(num);
|
|
@@ -247,7 +278,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
bsCovenantCheckAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
iBsCovenantCheckService.insertByAddBo(bsCovenantCheckAddBo);
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
if (Validator.isNotEmpty(bo.getCopyCovenantNum())) {
|
|
|
BsCovenant bs = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCopyCovenantNum()).eq(BsCovenant::getStatus, 1));
|
|
@@ -273,13 +304,13 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
|
|
|
- if (!bsCovenantBusinessAddBo.getBsCovenantGoods().isEmpty()) {
|
|
|
+ if (!bsCovenantBusinessAddBo.getBsCovenantGoodsVos().isEmpty()) {
|
|
|
BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
|
|
|
.eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
|
|
|
.eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
|
|
|
.eq(BsCovenantBusiness::getStatus, 1));
|
|
|
//写入协议业务类型有关商品
|
|
|
- bsCovenantBusinessAddBo.getBsCovenantGoods().forEach(bsCovenantGoodsAddBo -> {
|
|
|
+ bsCovenantBusinessAddBo.getBsCovenantGoodsVos().forEach(bsCovenantGoodsAddBo -> {
|
|
|
bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
|
|
|
bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
|
|
@@ -290,7 +321,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new CustomException("请选择是否复制协议数据");
|
|
|
}
|
|
|
}
|
|
@@ -302,13 +333,13 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
|
|
|
- if (!bsCovenantBusinessAddBo.getBsCovenantGoods().isEmpty()) {
|
|
|
+ if (!bsCovenantBusinessAddBo.getBsCovenantGoodsVos().isEmpty()) {
|
|
|
BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
|
|
|
.eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
|
|
|
.eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
|
|
|
.eq(BsCovenantBusiness::getStatus, 1));
|
|
|
//写入协议业务类型有关商品
|
|
|
- bsCovenantBusinessAddBo.getBsCovenantGoods().forEach(bsCovenantGoodsAddBo -> {
|
|
|
+ bsCovenantBusinessAddBo.getBsCovenantGoodsVos().forEach(bsCovenantGoodsAddBo -> {
|
|
|
bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
|
|
|
bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
|
|
@@ -327,130 +358,141 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean insertYXTByAddBo(BsCovenantAddBo bo) {
|
|
|
- if (bo.getCovenantId() != null) {
|
|
|
+ if (bo.getFormApp()!=null&&bo.getFormApp()==3L){
|
|
|
+ if (bo.getUserId()==null){
|
|
|
+ throw new CustomException("创建用户不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (bo.getFormApp()!=null&&bo.getFormApp()==1L&&bo.getCovenantId() != null) {
|
|
|
BsCovenantVo bsCovenantVo = this.queryById(bo.getCovenantId());
|
|
|
this.update(new LambdaUpdateWrapper<BsCovenant>().set(BsCovenant::getStatus, 7).eq(BsCovenant::getCovenantId, bsCovenantVo.getCovenantId()));
|
|
|
iBsCovenantBusinessService.update(new LambdaUpdateWrapper<BsCovenantBusiness>().set(BsCovenantBusiness::getStatus, 0).eq(BsCovenantBusiness::getCovenantId, bsCovenantVo.getCovenantId()));
|
|
|
iBsCovenantGoodsService.update(new LambdaUpdateWrapper<BsCovenantGoods>().eq(BsCovenantGoods::getCovenantId, bsCovenantVo.getCovenantId()).set(BsCovenantGoods::getStatus, 0));
|
|
|
- } else {
|
|
|
- BsCovenant add = BeanUtil.toBean(bo, BsCovenant.class);
|
|
|
- if (ObjectUtils.isNotNull(bo.getCompanyId())) {
|
|
|
- Company byId = iCompanyService.getById(bo.getCompanyId());
|
|
|
- add.setJiaCompanyAddress(byId.getCompanyAddress());
|
|
|
- add.setJiaCompanyContract(byId.getCompanyContacts());
|
|
|
- add.setJiaCompanyPhone(byId.getContactPhone());
|
|
|
- }
|
|
|
- String companyId = ServletUtils.getRequest().getHeader("companyId");
|
|
|
- if (Validator.isNotEmpty(companyId)) {
|
|
|
- add.setCompanyId(Long.valueOf(companyId));
|
|
|
- }
|
|
|
- add.setCreateTime(DateUtils.getNowTime());
|
|
|
- add.setUpdateTime(DateUtils.getNowTime());
|
|
|
- this.baseMapper.insert(add);
|
|
|
- BsCovenant newBsCovenant = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCovenantNum()).eq(BsCovenant::getStatus, 1));
|
|
|
- //写入协议审核流程
|
|
|
- SysTenant sysTenant = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
|
|
|
- if (ObjectUtils.isNotNull(sysTenant)) {
|
|
|
- List<String> list = Arrays.asList(sysTenant.getAppList());
|
|
|
- list.forEach(item -> {
|
|
|
- BsCovenantCheckAddBo bsCovenantCheckAddBo = new BsCovenantCheckAddBo();
|
|
|
- bsCovenantCheckAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
- bsCovenantCheckAddBo.setCompanyId(bo.getCompanyId());
|
|
|
- List<String> list1 = Arrays.asList(item.split(","));
|
|
|
- List<Long> longList = list1.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
|
- longList.forEach(num -> {
|
|
|
- bsCovenantCheckAddBo.setAppId(num);
|
|
|
- if (num == 1L) {
|
|
|
- bsCovenantCheckAddBo.setSort(4);
|
|
|
- } else if (num == 2L) {
|
|
|
- bsCovenantCheckAddBo.setSort(1);
|
|
|
- } else if (num == 3L) {
|
|
|
- bsCovenantCheckAddBo.setSort(2);
|
|
|
- } else if (num == 4L) {
|
|
|
- bsCovenantCheckAddBo.setCurrentStatus(1);
|
|
|
- bsCovenantCheckAddBo.setSort(3);
|
|
|
- }
|
|
|
- bsCovenantCheckAddBo.setStatus(1);
|
|
|
- bsCovenantCheckAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
- bsCovenantCheckAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iBsCovenantCheckService.insertByAddBo(bsCovenantCheckAddBo);
|
|
|
- });
|
|
|
+ }
|
|
|
+ List<BsCovenant> bsCovenants = this.list(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getFormApp,bo.getFormApp()));
|
|
|
+ List<String> collect = bsCovenants.stream().map(BsCovenant::getCovenantNum).collect(Collectors.toList());
|
|
|
+ if (ObjectUtils.isNull(bo.getCovenantNum())) {
|
|
|
+ throw new CustomException("协议编号不能为空");
|
|
|
+ }
|
|
|
+ if (collect.contains(bo.getCovenantNum())) {
|
|
|
+ throw new CustomException("协议编号重复");
|
|
|
+ }
|
|
|
+ BsCovenant add = BeanUtil.toBean(bo, BsCovenant.class);
|
|
|
+ if (ObjectUtils.isNotNull(bo.getCompanyId())) {
|
|
|
+ Company byId = iCompanyService.getById(bo.getCompanyId());
|
|
|
+ add.setJiaCompanyAddress(byId.getCompanyAddress());
|
|
|
+ add.setJiaCompanyContract(byId.getCompanyContacts());
|
|
|
+ add.setJiaCompanyPhone(byId.getContactPhone());
|
|
|
+ }
|
|
|
+ String companyId = ServletUtils.getRequest().getHeader("companyId");
|
|
|
+ if (Validator.isNotEmpty(companyId)) {
|
|
|
+ add.setCompanyId(Long.valueOf(companyId));
|
|
|
+ }
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ this.baseMapper.insert(add);
|
|
|
+ BsCovenant newBsCovenant = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCovenantNum()).eq(BsCovenant::getStatus, 1));
|
|
|
+ //写入协议审核流程
|
|
|
+ SysTenant sysTenant = iSysTenantService.getById(ServletUtils.getRequest().getHeader("TenantId"));
|
|
|
+ if (ObjectUtils.isNotNull(sysTenant)) {
|
|
|
+ BsCovenantCheckAddBo bsCovenantCheckAddBo = new BsCovenantCheckAddBo();
|
|
|
+ bsCovenantCheckAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
+ bsCovenantCheckAddBo.setCompanyId(bo.getCompanyId());
|
|
|
+ if (!sysTenant.getAppList().isEmpty()) {
|
|
|
+ List<String> list1 = Arrays.asList(sysTenant.getAppList().split(","));
|
|
|
+ List<Long> longList = list1.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ longList.forEach(num -> {
|
|
|
+ bsCovenantCheckAddBo.setAppId(num);
|
|
|
+ if (num == 1L) {
|
|
|
+ bsCovenantCheckAddBo.setSort(4);
|
|
|
+ } else if (num == 2L) {
|
|
|
+ bsCovenantCheckAddBo.setSort(1);
|
|
|
+ } else if (num == 3L) {
|
|
|
+ bsCovenantCheckAddBo.setSort(2);
|
|
|
+ } else if (num == 4L) {
|
|
|
+ bsCovenantCheckAddBo.setCurrentStatus(1);
|
|
|
+ bsCovenantCheckAddBo.setSort(3);
|
|
|
+ }
|
|
|
+ bsCovenantCheckAddBo.setStatus(1);
|
|
|
+ bsCovenantCheckAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ bsCovenantCheckAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iBsCovenantCheckService.insertByAddBo(bsCovenantCheckAddBo);
|
|
|
});
|
|
|
}
|
|
|
- if (Validator.isNotEmpty(bo.getCopyCovenantNum())) {
|
|
|
- BsCovenant bs = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCopyCovenantNum()).eq(BsCovenant::getStatus, 1));
|
|
|
- if (ObjectUtils.isNotNull(bo.getCopyStatus())) {
|
|
|
- if (bo.getCopyStatus() == 1) {
|
|
|
- //复制协议时删除复制协议相关信息
|
|
|
- if (ObjectUtils.isNotNull(bs)) {
|
|
|
- bs.setStatus(0);
|
|
|
- this.updateById(bs);
|
|
|
- iBsCovenantBusinessService.update(new LambdaUpdateWrapper<BsCovenantBusiness>().set(BsCovenantBusiness::getStatus, 0).eq(BsCovenantBusiness::getCovenantId, bs.getCovenantId()));
|
|
|
- iBsCovenantGoodsService.update(new LambdaUpdateWrapper<BsCovenantGoods>().eq(BsCovenantGoods::getCovenantId, bs.getCovenantId()).set(BsCovenantGoods::getStatus, 0));
|
|
|
- } else {
|
|
|
- throw new CustomException("当前协议不存在");
|
|
|
- }
|
|
|
- } else if (bo.getCopyStatus() == 0) {
|
|
|
- if (!bo.getBsCovenantBusinessList().isEmpty()) {
|
|
|
- //写入协议业务类型
|
|
|
- bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
|
|
|
- CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessAddBo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
|
|
|
- bsCovenantBusinessAddBo.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
|
|
|
- bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
|
|
|
- bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
- bsCovenantBusinessAddBo.setCompanyId(bo.getCompanyId());
|
|
|
- bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
- bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
|
|
|
- if (!bsCovenantBusinessAddBo.getBsCovenantGoods().isEmpty()) {
|
|
|
- BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
|
|
|
- .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
|
|
|
- .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
|
|
|
- .eq(BsCovenantBusiness::getStatus, 1));
|
|
|
- //写入协议业务类型有关商品
|
|
|
- bsCovenantBusinessAddBo.getBsCovenantGoods().forEach(bsCovenantGoodsAddBo-> {
|
|
|
- bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
- bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
|
|
|
- bsCovenantGoodsAddBo.setCompanyId(bo.getCompanyId());
|
|
|
- bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
- bsCovenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iBsCovenantGoodsService.insertByAddBo(bsCovenantGoodsAddBo);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (Validator.isNotEmpty(bo.getCopyCovenantNum())) {
|
|
|
+ BsCovenant bs = this.getOne(new LambdaQueryWrapper<BsCovenant>().eq(BsCovenant::getCovenantNum, bo.getCopyCovenantNum()).eq(BsCovenant::getStatus, 1));
|
|
|
+ if (ObjectUtils.isNotNull(bo.getCopyStatus())) {
|
|
|
+ if (bo.getCopyStatus() == 1) {
|
|
|
+ //复制协议时删除复制协议相关信息
|
|
|
+ if (ObjectUtils.isNotNull(bs)) {
|
|
|
+ bs.setStatus(0);
|
|
|
+ this.updateById(bs);
|
|
|
+ iBsCovenantBusinessService.update(new LambdaUpdateWrapper<BsCovenantBusiness>().set(BsCovenantBusiness::getStatus, 0).eq(BsCovenantBusiness::getCovenantId, bs.getCovenantId()));
|
|
|
+ iBsCovenantGoodsService.update(new LambdaUpdateWrapper<BsCovenantGoods>().eq(BsCovenantGoods::getCovenantId, bs.getCovenantId()).set(BsCovenantGoods::getStatus, 0));
|
|
|
+ } else {
|
|
|
+ throw new CustomException("当前协议不存在");
|
|
|
+ }
|
|
|
+ } else if (bo.getCopyStatus() == 0) {
|
|
|
+ if (!bo.getBsCovenantBusinessList().isEmpty()) {
|
|
|
+ //写入协议业务类型
|
|
|
+ bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
|
|
|
+ CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessAddBo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
|
|
|
+ bsCovenantBusinessAddBo.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
|
|
|
+ bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
|
|
|
+ bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
+ bsCovenantBusinessAddBo.setCompanyId(bo.getCompanyId());
|
|
|
+ bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
|
|
|
+ if (!bsCovenantBusinessAddBo.getBsCovenantGoodsVos().isEmpty()) {
|
|
|
+ BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
|
|
|
+ .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
|
|
|
+ .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
|
|
|
+ .eq(BsCovenantBusiness::getStatus, 1));
|
|
|
+ //写入协议业务类型有关商品
|
|
|
+ bsCovenantBusinessAddBo.getBsCovenantGoodsVos().forEach(bsCovenantGoodsAddBo -> {
|
|
|
+ bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
+ bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
|
|
|
+ bsCovenantGoodsAddBo.setCompanyId(bo.getCompanyId());
|
|
|
+ bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ bsCovenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iBsCovenantGoodsService.insertByAddBo(bsCovenantGoodsAddBo);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- }else {
|
|
|
- throw new CustomException("请选择是否复制协议数据");
|
|
|
}
|
|
|
+ } else {
|
|
|
+ throw new CustomException("请选择是否复制协议数据");
|
|
|
}
|
|
|
- bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
|
|
|
- CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessAddBo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
|
|
|
- bsCovenantBusinessAddBo.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
|
|
|
- bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
|
|
|
- bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
- bsCovenantBusinessAddBo.setCompanyId(bo.getCompanyId());
|
|
|
- bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
- bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
|
|
|
- if (!bsCovenantBusinessAddBo.getBsCovenantGoods().isEmpty()) {
|
|
|
- BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
|
|
|
- .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
|
|
|
- .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
|
|
|
- .eq(BsCovenantBusiness::getCovenantId, newBsCovenant.getCovenantId())
|
|
|
- .eq(BsCovenantBusiness::getStatus, 1));
|
|
|
- //写入协议业务类型有关商品
|
|
|
- bsCovenantBusinessAddBo.getBsCovenantGoods().forEach(bsCovenantGoodsAddBo -> {
|
|
|
- bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
- bsCovenantGoodsAddBo.setCompanyId(bo.getCompanyId());
|
|
|
- bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
|
|
|
- bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
- bsCovenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
- iBsCovenantGoodsService.insertByAddBo(bsCovenantGoodsAddBo);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
+ bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessAddBo -> {
|
|
|
+ CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessAddBo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
|
|
|
+ bsCovenantBusinessAddBo.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
|
|
|
+ bsCovenantBusinessAddBo.setBusinessId(courseBusiness.getId());
|
|
|
+ bsCovenantBusinessAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
+ bsCovenantBusinessAddBo.setCompanyId(bo.getCompanyId());
|
|
|
+ bsCovenantBusinessAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ bsCovenantBusinessAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iBsCovenantBusinessService.insertByAddBo(bsCovenantBusinessAddBo);
|
|
|
+ if (!bsCovenantBusinessAddBo.getBsCovenantGoodsVos().isEmpty()) {
|
|
|
+ BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessAddBo.getBusinessId())
|
|
|
+ .eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessAddBo.getEducationTypeId())
|
|
|
+ .eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessAddBo.getProjectId())
|
|
|
+ .eq(BsCovenantBusiness::getCovenantId, newBsCovenant.getCovenantId())
|
|
|
+ .eq(BsCovenantBusiness::getStatus, 1));
|
|
|
+ //写入协议业务类型有关商品
|
|
|
+ bsCovenantBusinessAddBo.getBsCovenantGoodsVos().forEach(bsCovenantGoodsAddBo -> {
|
|
|
+ bsCovenantGoodsAddBo.setCovenantId(newBsCovenant.getCovenantId());
|
|
|
+ bsCovenantGoodsAddBo.setCompanyId(bo.getCompanyId());
|
|
|
+ bsCovenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
|
|
|
+ bsCovenantGoodsAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ bsCovenantGoodsAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iBsCovenantGoodsService.insertByAddBo(bsCovenantGoodsAddBo);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -523,9 +565,9 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
throw new CustomException("当前协议不存在");
|
|
|
}
|
|
|
} else if (bo.getCopyStatus() == 0) {
|
|
|
- if (!bo.getBsCovenantBusinessList().isEmpty()) {
|
|
|
+ if (!bo.getBsCovenantBusinessVos().isEmpty()) {
|
|
|
//写入协议业务类型
|
|
|
- bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
|
|
|
+ bo.getBsCovenantBusinessVos().forEach(bsCovenantBusinessVo -> {
|
|
|
CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessVo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
|
|
|
BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
|
|
|
covenantBusiness.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
|
|
@@ -533,13 +575,13 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
covenantBusiness.setCreateTime(DateUtils.getNowTime());
|
|
|
covenantBusiness.setUpdateTime(DateUtils.getNowTime());
|
|
|
iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
|
|
|
- if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
|
|
|
+ if (!bsCovenantBusinessVo.getBsCovenantGoodsVos().isEmpty()) {
|
|
|
BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, bsCovenantBusinessVo.getBusinessId())
|
|
|
.eq(BsCovenantBusiness::getEducationTypeId, bsCovenantBusinessVo.getEducationTypeId())
|
|
|
.eq(BsCovenantBusiness::getProjectId, bsCovenantBusinessVo.getProjectId())
|
|
|
.eq(BsCovenantBusiness::getStatus, 1));
|
|
|
//写入协议业务类型有关商品
|
|
|
- bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
|
|
|
+ bsCovenantBusinessVo.getBsCovenantGoodsVos().forEach(bsCovenantGoodsVo -> {
|
|
|
BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
|
|
|
covenantGoodsAddBo.setCovenantId(bo.getCovenantId());
|
|
|
covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
|
|
@@ -551,11 +593,11 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new CustomException("请选择是否复制协议数据");
|
|
|
}
|
|
|
}
|
|
|
- bo.getBsCovenantBusinessList().forEach(bsCovenantBusinessVo -> {
|
|
|
+ bo.getBsCovenantBusinessVos().forEach(bsCovenantBusinessVo -> {
|
|
|
CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, bsCovenantBusinessVo.getBusinessId()).eq(CourseBusiness::getStatus, 1));
|
|
|
BsCovenantBusinessAddBo covenantBusiness = BeanUtil.toBean(bsCovenantBusinessVo, BsCovenantBusinessAddBo.class);
|
|
|
covenantBusiness.setProjectId(Long.valueOf(courseBusiness.getProjectId()));
|
|
@@ -563,13 +605,13 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
covenantBusiness.setCreateTime(DateUtils.getNowTime());
|
|
|
covenantBusiness.setUpdateTime(DateUtils.getNowTime());
|
|
|
iBsCovenantBusinessService.insertByAddBo(covenantBusiness);
|
|
|
- if (!bsCovenantBusinessVo.getBsCovenantGoods().isEmpty()) {
|
|
|
+ if (!bsCovenantBusinessVo.getBsCovenantGoodsVos().isEmpty()) {
|
|
|
BsCovenantBusiness bsCovenantBusiness = iBsCovenantBusinessService.getOne(new LambdaQueryWrapper<BsCovenantBusiness>().eq(BsCovenantBusiness::getBusinessId, covenantBusiness.getBusinessId())
|
|
|
.eq(BsCovenantBusiness::getEducationTypeId, covenantBusiness.getEducationTypeId())
|
|
|
.eq(BsCovenantBusiness::getProjectId, covenantBusiness.getProjectId())
|
|
|
.eq(BsCovenantBusiness::getStatus, 1));
|
|
|
//写入协议业务类型有关商品
|
|
|
- bsCovenantBusinessVo.getBsCovenantGoods().forEach(bsCovenantGoodsVo -> {
|
|
|
+ bsCovenantBusinessVo.getBsCovenantGoodsVos().forEach(bsCovenantGoodsVo -> {
|
|
|
BsCovenantGoodsAddBo covenantGoodsAddBo = BeanUtil.toBean(bsCovenantGoodsVo, BsCovenantGoodsAddBo.class);
|
|
|
covenantGoodsAddBo.setCovenantId(bo.getCovenantId());
|
|
|
covenantGoodsAddBo.setCovenantBusinessId(bsCovenantBusiness.getCovenantBusinessId());
|
|
@@ -609,7 +651,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getJudgeBusiness(Long businessId,Long userId) {
|
|
|
+ public String getJudgeBusiness(Long businessId, Long userId) {
|
|
|
CourseBusiness courseBusiness = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getId, businessId).eq(CourseBusiness::getStatus, 1));
|
|
|
return iBsCovenantBusinessService.getCovenantNumByProjectId(Long.valueOf(courseBusiness.getProjectId()), userId, courseBusiness.getId());
|
|
|
|
|
@@ -632,7 +674,7 @@ public class BsCovenantServiceImpl extends ServiceImpl<BsCovenantMapper, BsCoven
|
|
|
}
|
|
|
BsCovenantExportVo bean = BeanUtil.toBean(bsCovenantVo, BsCovenantExportVo.class);
|
|
|
String zhiyuan = System.getProperty("user.dir");
|
|
|
- String toPath = zhiyuan + "/zhongzheng-admin-business/src/main/resources/" +DateUtils.getNowTime()+ "培训服务协议" + ".pdf";
|
|
|
+ String toPath = zhiyuan + "/zhongzheng-admin-business/src/main/resources/" + DateUtils.getNowTime() + "培训服务协议" + ".pdf";
|
|
|
String uploadPdf = null;
|
|
|
//生成协议pdf文件
|
|
|
PdfUtils.downloadPdf(bean, toPath, sysTenantAccountVo);
|