From 6548996bfac9dd02e21e1fd9519109fc8b5dfeb2 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期六, 11 五月 2024 18:48:47 +0800
Subject: [PATCH] 提交一把
---
server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java | 34 +++++++++++++++++++++++++++++-----
1 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
index dea6695..84e20a6 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl;
+import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
@@ -38,6 +39,8 @@
public class SolutionsServiceImpl implements SolutionsService {
@Autowired
+ private SystemDictDataBiz systemDictDataBiz;
+ @Autowired
private MultifileMapper multifileMapper;
@Autowired
private SolutionsMapper solutionsMapper;
@@ -68,7 +71,11 @@
)>Constants.ZERO){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鏂规鍚嶇О宸插瓨鍦�");
}
-
+ solutions.setCanAdd(Constants.formatIntegerNum(solutions.getCanAdd()));
+ solutions.setCanReduce(Constants.formatIntegerNum(solutions.getCanReduce()));
+ solutions.setCanChangeUnit(Constants.formatIntegerNum(solutions.getCanChangeUnit()));
+ solutions.setAddValidDays(Constants.formatIntegerNum(solutions.getAddValidDays()));
+ solutions.setDelValidDays(Constants.formatIntegerNum(solutions.getDelValidDays()));
solutions.setIsdeleted(Constants.ZERO);
solutions.setCreator(user.getId());
solutions.setCreateDate(new Date());
@@ -98,6 +105,8 @@
file.setObjId(solutions.getId());
file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
file.setType(Constants.formatIntegerNum(file.getType()));
+ multifileMapper.insert(file);
+ file.setObjId(newModel.getId());
multifileMapper.insert(file);
}
return solutions.getId();
@@ -151,7 +160,7 @@
// ||Constants.formatIntegerNum(solutions.getPriceCycleUnit()) < 0
||Constants.formatIntegerNum(solutions.getInsureCycle()) < 0
||Constants.formatIntegerNum(solutions.getInsureCycleUnit()) < 0
- || solutions.getMinAge() >solutions.getMaxAge()
+ ||Constants.formatIntegerNum( solutions.getMinAge()) >Constants.formatIntegerNum(solutions.getMaxAge())
|| Constants.formatBigdecimal(solutions.getPrice()).compareTo(new BigDecimal(0)) !=1
){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
@@ -189,6 +198,7 @@
}
//鏁版嵁鏈夋晥鎬ф牎楠�
initCreateParam(solutions);
+ solutions.setType(null);//涓嶆敮鎸佷慨鏀规姇淇濇柟妗�
if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda()
.eq(Solutions::getName,solutions.getName())
.eq(Solutions::getIsdeleted,Constants.ZERO)
@@ -209,7 +219,6 @@
.last("limit 1")
);
-
if(Objects.isNull(oldVersion)){
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鍘嗗彶鐗堟湰鏁版嵁");
}
@@ -229,8 +238,9 @@
.lambda()
.eq(SolutionWorktype::getSolutionId,solutions.getId())
);
- if(Constants.equalsObject(solutions.getType(),Constants.ONE) ){
+ if(Constants.equalsObject(model.getType(),Constants.ONE) ){
if (solutions.getFanganFile()!=null && StringUtils.isNotBlank(solutions.getFanganFile().getFileurl())){
+
multifileMapper.update(null,new UpdateWrapper<Multifile>().lambda()
.set(Multifile::getIsdeleted,Constants.ONE)
.set(Multifile::getEditDate,solutions.getEditDate())
@@ -238,6 +248,7 @@
.eq(Multifile::getObjId,solutions.getId())
.eq(Multifile::getIsdeleted,Constants.ZERO)
.eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()));
+
Multifile file = solutions.getFanganFile();
file.setIsdeleted(Constants.ZERO);
file.setCreateDate(solutions.getEditDate());
@@ -245,6 +256,8 @@
file.setObjId(solutions.getId());
file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
file.setType(Constants.formatIntegerNum(file.getType()));
+ multifileMapper.insert(file);
+ file.setObjId(newModel.getId());
multifileMapper.insert(file);
}
}
@@ -339,7 +352,11 @@
.eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey())
.eq(Multifile::getIsdeleted,Constants.ZERO)
.last("limit 1"));
- model.setFanganFile(f);//鏂规纭涔�
+ if(f!=null && StringUtils.isNotBlank(f.getFileurl())){
+ String url = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode()+f.getFileurl();
+ f.setFileurlFull(url);
+ model.setFanganFile(f);//鏂规纭涔�
+ }
return model;
}
@@ -351,12 +368,19 @@
@Override
public List<Solutions> findList(Solutions solutions) {
+ LoginUserInfo user = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
solutions.setIsdeleted(Constants.ZERO);
solutions.setStatus(Constants.ZERO);
if(solutions.getDataType() == null){
solutions.setDataType(Constants.TWO);
}
QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions);
+ if(Constants.equalsObject(user.getType(),Constants.TWO)){
+ //濡傛灉鏄垹闄�
+// wrapper.lambda().exists("select c.id from company_solution c left join solutions d on c.solution_id=d.id where c.isdeleted=0 and d.base_id=solutions.base_id and c.shop_id="+user.getCompanyId());//璁剧疆鏃犳晥璁块棶
+ wrapper.apply("((solutions.type=0 and exists(select cs.id from company_solution cs left join solutions s on cs.solution_id=s.id where cs.isdeleted=0 and s.base_id=solutions.base_id and cs.shop_id="+user.getCompanyId()+")) or (" +
+ "solutions.type=1 and solutions.shop_id="+user.getCompanyId()+"))") ;
+ }
return solutionsMapper.selectList(wrapper);
}
--
Gitblit v1.9.3