|
@@ -4,30 +4,26 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
-import org.jeecg.modules.system.app.dto.*;
|
|
|
+import org.jeecg.modules.system.app.dto.AppSiteDTO;
|
|
|
+import org.jeecg.modules.system.app.dto.AppSitePageDTO;
|
|
|
import org.jeecg.modules.system.app.entity.AppSite;
|
|
|
import org.jeecg.modules.system.app.mapper.AppSiteMapper;
|
|
|
import org.jeecg.modules.system.app.mapper.AppSitePriceRulesMapper;
|
|
|
import org.jeecg.modules.system.app.service.IAppSiteService;
|
|
|
-import org.jeecg.modules.system.app.vo.AppSiteListVO;
|
|
|
import org.jeecg.modules.system.entity.SysDepart;
|
|
|
import org.jeecg.modules.system.mapper.SysDepartMapper;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
import static org.jeecg.common.constant.CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
|
|
|
|
|
|
/**
|
|
@@ -55,10 +51,13 @@ public class AppSiteServiceImpl extends ServiceImpl<AppSiteMapper, AppSite> impl
|
|
|
if (null == departById) throw new JeecgBootException("商户部门不存在", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
if (!(departById.getOrgCategory().equals("30")||departById.getOrgCategory().equals("20"))) throw new JeecgBootException("商户部门类型错误", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
BeanUtils.copyProperties(siteCuDTO, site);
|
|
|
- if (null == site.getOrgCode())
|
|
|
+ if (null == departById.getOrgCode())
|
|
|
throw new JeecgBootException("商户部门编码不能为空", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- if (null == site.getTenantId())
|
|
|
+ if (null == departById.getTenantId())
|
|
|
throw new JeecgBootException("商户部门id不能为空", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+
|
|
|
+ site.setOrgCode(departById.getOrgCode());
|
|
|
+ site.setTenantId(departById.getTenantId()+"");
|
|
|
int saveSiteResult = baseMapper.insert(site);
|
|
|
// 如果插入失败,抛出自定义异常提示“场地信息保存失败”
|
|
|
if (saveSiteResult < 1) {
|
|
@@ -97,13 +96,14 @@ public class AppSiteServiceImpl extends ServiceImpl<AppSiteMapper, AppSite> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<AppSiteListVO> querySiteListByOrgCode(String orgCode) {
|
|
|
- List<AppSite> siteList = baseMapper.selectList(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, orgCode));
|
|
|
- return siteList.stream().map(dbSite -> {
|
|
|
- AppSiteListVO siteVO = new AppSiteListVO();
|
|
|
- BeanUtils.copyProperties(dbSite, siteVO);
|
|
|
- return siteVO;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ public AppSiteDTO querySiteByOrgCode(String orgCode) {
|
|
|
+ AppSite site = baseMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, orgCode));
|
|
|
+ AppSiteDTO siteVO = new AppSiteDTO();
|
|
|
+ if (site!=null){
|
|
|
+ BeanUtils.copyProperties(site, siteVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return siteVO;
|
|
|
}
|
|
|
|
|
|
@Override
|