From a2ac03b97399fd334f75ed0ea6e8a3f851d101be Mon Sep 17 00:00:00 2001
From: jiaosong <jiaosong6760@dingtalk.com>
Date: 星期一, 23 十月 2023 09:47:03 +0800
Subject: [PATCH] #用户修改
---
server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java | 50 +++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java
index a77d0db..e196d52 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/PricingParamServiceImpl.java
@@ -1,11 +1,15 @@
package com.doumee.service.business.impl;
import com.doumee.core.constants.Constants;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.PricingDetailMapper;
import com.doumee.dao.business.PricingParamMapper;
+import com.doumee.dao.business.model.PricingDetail;
import com.doumee.dao.business.model.PricingParam;
import com.doumee.service.business.PricingParamService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -19,6 +23,7 @@
import java.util.Date;
import java.util.List;
+import java.util.Objects;
/**
* 瀹氫环鏂规閰嶇疆Service瀹炵幇
@@ -30,6 +35,9 @@
@Autowired
private PricingParamMapper pricingParamMapper;
+
+ @Autowired
+ private PricingDetailMapper pricingDetailMapper;
@Override
public String create(PricingParam pricingParam) {
@@ -45,9 +53,10 @@
insert.setStartDate(pricingParam.getStartDate());
insert.setEndDate(pricingParam.getEndDate());
insert.setSortnum(pricingParam.getSortnum());
- insert.setStatus(Constants.ZERO);
- pricingParamMapper.insert(pricingParam);
- return pricingParam.getId();
+ insert.setStatus(Constants.ONE);
+ insert.setInfo(pricingParam.getInfo());
+ pricingParamMapper.insert(insert);
+ return insert.getId();
}
@Override
@@ -78,12 +87,46 @@
.eq(PricingParam::getId,pricingParam.getId())
.set(PricingParam::getEditor,principal.getId())
.set(PricingParam::getName,pricingParam.getName())
+// .set(PricingParam::getStatus,pricingParam.getStatus())
.set(PricingParam::getStartDate,pricingParam.getStartDate())
.set(PricingParam::getEndDate,pricingParam.getEndDate())
.set(PricingParam::getSortnum,pricingParam.getSortnum());
pricingParamMapper.update(null,wrapper);
}
+ @Override
+ public void updateStatus(PricingParam pricingParam) {
+
+ if (Objects.nonNull(pricingParam.getStatus()) && pricingParam.getStatus().equals(Constants.ZERO)){
+ QueryWrapper<PricingDetail> wrapper = new QueryWrapper<>();
+ wrapper.lambda()
+ .eq(PricingDetail::getIsdeleted,Constants.ZERO)
+ .eq(PricingDetail::getPricePramId,pricingParam.getId());
+ Integer integer = pricingDetailMapper.selectCount(wrapper);
+ if (integer < 0 ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇ュ畾浠锋柟妗堜笅娌℃湁閰嶇疆浠锋牸");
+ }
+ PricingParam pricingParam1 = new PricingParam();
+ pricingParam1.setId(pricingParam.getId());
+ pricingParam1.setStatus(pricingParam.getStatus());
+ pricingParamMapper.updateById(pricingParam1);
+ }else if (Objects.nonNull(pricingParam.getStatus()) && pricingParam.getStatus().equals(Constants.ONE)){
+
+ QueryWrapper<PricingParam> wrapper = new QueryWrapper<>();
+ wrapper.lambda()
+ .eq(PricingParam::getIsdeleted,Constants.ZERO)
+ .eq(PricingParam::getStatus,Constants.ZERO);
+ Integer integer = pricingParamMapper.selectCount(wrapper);
+ if (integer <= 1 ){
+ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇ュ畾浠锋柟妗堝繀椤婚厤缃�");
+ }
+ PricingParam pricingParam1 = new PricingParam();
+ pricingParam1.setId(pricingParam.getId());
+ pricingParam1.setStatus(pricingParam.getStatus());
+ pricingParamMapper.updateById(pricingParam1);
+ }
+
+ }
@Override
public void updateById(PricingParam pricingParam) {
@@ -162,6 +205,7 @@
if (pageWrap.getModel().getInfo() != null) {
queryWrapper.lambda().eq(PricingParam::getInfo, pageWrap.getModel().getInfo());
}
+ queryWrapper.lambda().orderByAsc(PricingParam::getStatus);
queryWrapper.lambda().orderByAsc(PricingParam::getSortnum);
return PageData.from(pricingParamMapper.selectPage(page, queryWrapper));
}
--
Gitblit v1.9.3