|
@@ -1,5 +1,6 @@
|
|
package com.zcxk.rmcp.pay.service.impl.pay;
|
|
package com.zcxk.rmcp.pay.service.impl.pay;
|
|
|
|
|
|
|
|
+import com.zcxk.rmcp.pay.commom.exception.ServiceException;
|
|
import com.zcxk.rmcp.pay.commom.model.Pagination;
|
|
import com.zcxk.rmcp.pay.commom.model.Pagination;
|
|
import com.zcxk.rmcp.pay.commom.util.SnowflakeIdWorker;
|
|
import com.zcxk.rmcp.pay.commom.util.SnowflakeIdWorker;
|
|
|
|
|
|
@@ -58,12 +59,12 @@ public class BaseWaterPropertyServiceImpl implements BaseWaterPropertyService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Transactional
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public int add(BaseWaterPropertyFormDto baseWaterPropertyFormDto) {
|
|
public int add(BaseWaterPropertyFormDto baseWaterPropertyFormDto) {
|
|
BaseWaterPropertyDto baseWaterPropertyDto = new BaseWaterPropertyDto();
|
|
BaseWaterPropertyDto baseWaterPropertyDto = new BaseWaterPropertyDto();
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
BigInteger id = BigInteger.valueOf(idWorker.nextId());
|
|
BigInteger id = BigInteger.valueOf(idWorker.nextId());
|
|
-
|
|
|
|
|
|
+ isExistData(baseWaterPropertyFormDto);
|
|
baseWaterPropertyDto.setId(id);
|
|
baseWaterPropertyDto.setId(id);
|
|
baseWaterPropertyDto.setName(baseWaterPropertyFormDto.getName());
|
|
baseWaterPropertyDto.setName(baseWaterPropertyFormDto.getName());
|
|
baseWaterPropertyDto.setCategoryId(baseWaterPropertyFormDto.getCategoryId());
|
|
baseWaterPropertyDto.setCategoryId(baseWaterPropertyFormDto.getCategoryId());
|
|
@@ -133,10 +134,17 @@ public class BaseWaterPropertyServiceImpl implements BaseWaterPropertyService {
|
|
public int getCustomerCountByPropertyId(BigInteger id) {
|
|
public int getCustomerCountByPropertyId(BigInteger id) {
|
|
return baseWaterPropertyMapper.getCustomerCountByPropertyId(id);
|
|
return baseWaterPropertyMapper.getCustomerCountByPropertyId(id);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ private void isExistData(BaseWaterPropertyFormDto baseWaterPropertyFormDto){
|
|
|
|
+ Integer count=baseWaterPropertyMapper.existData(baseWaterPropertyFormDto.getId(),
|
|
|
|
+ baseWaterPropertyFormDto.getCompanyOrgId(),baseWaterPropertyFormDto.getName());
|
|
|
|
+ if(count>0){
|
|
|
|
+ throw new ServiceException(-716,"该名称已存在,请修改。");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
@Override
|
|
@Override
|
|
public int edit(BaseWaterPropertyFormDto baseWaterPropertyFormDto) {
|
|
public int edit(BaseWaterPropertyFormDto baseWaterPropertyFormDto) {
|
|
BigInteger id = baseWaterPropertyFormDto.getId();
|
|
BigInteger id = baseWaterPropertyFormDto.getId();
|
|
|
|
+ isExistData(baseWaterPropertyFormDto);
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
BaseWaterPropertyDto baseWaterPropertyDto =baseWaterPropertyMapper.get(id,loginUser.getTenantId());
|
|
BaseWaterPropertyDto baseWaterPropertyDto =baseWaterPropertyMapper.get(id,loginUser.getTenantId());
|
|
baseWaterPropertyDto.setName(baseWaterPropertyFormDto.getName());
|
|
baseWaterPropertyDto.setName(baseWaterPropertyFormDto.getName());
|