|
@@ -1,30 +1,31 @@
|
|
|
package org.jeecg.modules.system.app.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
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.constant.CommonConstant;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
+import org.jeecg.modules.quartz.utils.HolidayUtil;
|
|
|
import org.jeecg.modules.system.app.dto.*;
|
|
|
-import org.jeecg.modules.system.app.entity.AppCategory;
|
|
|
-import org.jeecg.modules.system.app.entity.AppSite;
|
|
|
-import org.jeecg.modules.system.app.entity.AppSitePlace;
|
|
|
-import org.jeecg.modules.system.app.entity.AppSitePriceRules;
|
|
|
+import org.jeecg.modules.system.app.entity.*;
|
|
|
import org.jeecg.modules.system.app.enums.SitePlaceTypeEnum;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppCategoryMapper;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppSiteMapper;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppSitePlaceMapper;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppSitePriceRulesMapper;
|
|
|
+import org.jeecg.modules.system.app.mapper.*;
|
|
|
import org.jeecg.modules.system.app.service.IAppSitePlaceService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -41,6 +42,8 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
@Resource
|
|
|
private AppSitePriceRulesMapper appSitePriceRulesMapper;
|
|
|
@Resource
|
|
|
+ private AppTeachingTimeMapper appTeachingTimeMapper;
|
|
|
+ @Resource
|
|
|
private AppSiteMapper appSiteMapper;
|
|
|
@Resource
|
|
|
private AppCategoryMapper appCategoryMapper;
|
|
@@ -210,8 +213,8 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
Page<AppSitePlace> page = new Page<>(dto.getPageNum(), dto.getPageSize());
|
|
|
LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, dto.getType())
|
|
|
- .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName());
|
|
|
-// .eq(AppSitePlace::getOrgCode, loginUser.getOrgCode());
|
|
|
+ .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName())
|
|
|
+ .eq(AppSitePlace::getOrgCode, loginUser.getOrgCode());
|
|
|
IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper);
|
|
|
return resultPage.convert(record -> {
|
|
|
AppSitePlaceCuDTO cuDTO = new AppSitePlaceCuDTO();
|
|
@@ -224,21 +227,41 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean addUnfixed(AppSitePlaceUnfixedDTO unsetDTO) {
|
|
|
- if (null == unsetDTO.getSiteId()) throw new JeecgBootException("请选择商户门店", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
- AppSite site = appSiteMapper.selectById(unsetDTO.getSiteId());
|
|
|
+// if (null == unsetDTO.getSiteId()) throw new JeecgBootException("请选择商户门店", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, unsetDTO.getOrgCode()));
|
|
|
AppSitePlace appSitePlace = new AppSitePlace();
|
|
|
BeanUtils.copyProperties(unsetDTO, appSitePlace);
|
|
|
appSitePlace.setType(SitePlaceTypeEnum.UNFIXED.getCode());
|
|
|
appSitePlace.setOrgCode(site.getOrgCode());
|
|
|
appSitePlace.setTenantId(site.getTenantId());
|
|
|
+ appSitePlace.setSiteId(site.getId());
|
|
|
+ appSitePlace.setCategoryId(site.getCategoryId());
|
|
|
int insert = baseMapper.insert(appSitePlace);
|
|
|
if (insert < 1) throw new JeecgBootException("无固定场添加失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
- appSitePriceRules.setSitePlaceId(appSitePlace.getId());
|
|
|
- appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
|
|
|
- appSitePriceRules.setTenantId(appSitePlace.getTenantId());
|
|
|
- int insert1 = appSitePriceRulesMapper.insert(appSitePriceRules);
|
|
|
+ //每新增无固定场,对应增加(7-除外日期)条场地价格规则表数据
|
|
|
+ List<String> weekList = List.of("1", "2", "3", "4", "5", "6", "7");
|
|
|
+ String[] split = unsetDTO.getDownTime().split(",");
|
|
|
+ //"6,7"
|
|
|
+ List<String> downTimes = Arrays.stream(split).collect(Collectors.toList());
|
|
|
+ List<AppSitePriceRules> appSitePriceRulesList = new ArrayList<>();
|
|
|
+ weekList.forEach(week -> {
|
|
|
+ AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
+ appSitePriceRules
|
|
|
+ .setSitePlaceId(appSitePlace.getId())
|
|
|
+ .setOrgCode(appSitePlace.getOrgCode())
|
|
|
+ .setTenantId(appSitePlace.getTenantId())
|
|
|
+ .setType(SitePlaceTypeEnum.UNFIXED.getCode())
|
|
|
+ .setOriginalPrice(unsetDTO.getOriginalPrice())
|
|
|
+ .setSellingPrice(unsetDTO.getSellingPrice())
|
|
|
+ .setDayOfWeek(week);
|
|
|
+ ;
|
|
|
+ if (downTimes.contains(week)) {
|
|
|
+ appSitePriceRules.setStatus(1);
|
|
|
+ }
|
|
|
+ appSitePriceRulesList.add(appSitePriceRules);
|
|
|
+ });
|
|
|
+ int insert1 = appSitePriceRulesMapper.insertList(appSitePriceRulesList);
|
|
|
if (insert1 < 1) throw new JeecgBootException("无固定场价格添加失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
@@ -246,14 +269,14 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean updateUnfixed(AppSitePlaceUnfixedDTO unsetDTO) {
|
|
|
- if (null == unsetDTO.getSiteId())
|
|
|
- throw new JeecgBootException("商户门店不能为空", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// if (null == unsetDTO.getSiteId())
|
|
|
+// throw new JeecgBootException("商户门店不能为空", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
|
AppSitePlace dbSitePlace = baseMapper.selectById(unsetDTO.getId());
|
|
|
if (null == dbSitePlace) throw new JeecgBootException("数据不存在", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
// checkPermission(dbSitePlace,sysUser);
|
|
|
- AppSite site = appSiteMapper.selectById(unsetDTO.getSiteId());
|
|
|
+ AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, unsetDTO.getOrgCode()));
|
|
|
AppSitePlace appSitePlace = new AppSitePlace();
|
|
|
BeanUtils.copyProperties(unsetDTO, appSitePlace);
|
|
|
//固定
|
|
@@ -262,12 +285,24 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
appSitePlace.setTenantId(site.getTenantId());
|
|
|
int updateById = baseMapper.updateById(appSitePlace);
|
|
|
if (updateById < 1) throw new JeecgBootException("无固定场编辑失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
- appSitePriceRules.setSitePlaceId(appSitePlace.getId());
|
|
|
- appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
|
|
|
- appSitePriceRules.setTenantId(appSitePlace.getTenantId());
|
|
|
- int updateById1 = appSitePriceRulesMapper.updateById(appSitePriceRules);
|
|
|
- if (updateById1 < 1) throw new JeecgBootException("无固定场价格编辑失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+ //查询无固定场价格表对应数据,查询对应数据修改
|
|
|
+ List<AppSitePriceRules> appSitePriceRulesList = appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, unsetDTO.getId()));
|
|
|
+ String[] split = unsetDTO.getDownTime().split(",");
|
|
|
+ List<String> downTimes = Arrays.stream(split).collect(Collectors.toList());
|
|
|
+ appSitePriceRulesList.forEach(appSitePriceRules -> {
|
|
|
+ appSitePriceRules
|
|
|
+ .setSitePlaceId(appSitePlace.getId())
|
|
|
+ .setOrgCode(appSitePlace.getOrgCode())
|
|
|
+ .setTenantId(appSitePlace.getTenantId())
|
|
|
+ .setType(SitePlaceTypeEnum.UNFIXED.getCode())
|
|
|
+ .setOriginalPrice(unsetDTO.getOriginalPrice())
|
|
|
+ .setSellingPrice(unsetDTO.getSellingPrice())
|
|
|
+ ;
|
|
|
+ if (downTimes.contains(appSitePriceRules.getDayOfWeek())) {
|
|
|
+ appSitePriceRules.setStatus(1);
|
|
|
+ }
|
|
|
+ appSitePriceRulesMapper.updateById(appSitePriceRules);
|
|
|
+ });
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
@@ -290,18 +325,21 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
Page<AppSitePlace> page = new Page<>(dto.getPageNum(), dto.getPageSize());
|
|
|
LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, SitePlaceTypeEnum.UNFIXED.getCode())
|
|
|
- .eq(AppSitePlace::getSiteId, dto.getSiteId())
|
|
|
- .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName());
|
|
|
-// .eq(AppSitePlace::getOrgCode, loginUser.getOrgCode());
|
|
|
+// .eq(AppSitePlace::getSiteId, dto.getSiteId())
|
|
|
+ .eq(AppSitePlace::getOrgCode, loginUser.getOrgCode())
|
|
|
+ .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName())
|
|
|
+ ;
|
|
|
|
|
|
IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper);
|
|
|
return resultPage.convert(record -> {
|
|
|
AppSitePlaceUnfixedDTO appSitePlaceUnfixedDTO = new AppSitePlaceUnfixedDTO();
|
|
|
BeanUtils.copyProperties(record, appSitePlaceUnfixedDTO);
|
|
|
- AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectOne(
|
|
|
- Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, record.getId()));
|
|
|
- appSitePlaceUnfixedDTO.setOriginalPrice(appSitePriceRules.getOriginalPrice());
|
|
|
- appSitePlaceUnfixedDTO.setSellingPrice(appSitePriceRules.getSellingPrice());
|
|
|
+ List<AppSitePriceRules> appSitePriceRulesList = appSitePriceRulesMapper.selectList(
|
|
|
+ Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, record.getId()).eq(AppSitePriceRules::getStatus, CommonConstant.STATUS_0_INT));
|
|
|
+ if (CollUtil.isNotEmpty(appSitePriceRulesList)) {
|
|
|
+ appSitePlaceUnfixedDTO.setOriginalPrice(appSitePriceRulesList.get(0).getOriginalPrice());
|
|
|
+ appSitePlaceUnfixedDTO.setSellingPrice(appSitePriceRulesList.get(0).getSellingPrice());
|
|
|
+ }
|
|
|
return appSitePlaceUnfixedDTO;
|
|
|
});
|
|
|
}
|
|
@@ -327,6 +365,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
public Boolean savePack(AppSitePlaceDTO placeDTO) {
|
|
|
AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
|
|
|
List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
|
|
|
+// AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId,placeCuDTO.getSiteId()));
|
|
|
AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
|
|
|
placeDTO.getSiteCategoryDOTS().forEach(item -> {
|
|
|
AppCategory category = appCategoryMapper.selectById(item.getCategoryId());
|
|
@@ -562,6 +601,154 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean addSchoolPlace(SchoolPlaceAddDTO schoolPlaceAddDTO) {
|
|
|
+
|
|
|
+ //部门ID查询学校场地
|
|
|
+ AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId, schoolPlaceAddDTO.getTenantId()));
|
|
|
+
|
|
|
+ //根据学校查询场地
|
|
|
+ AppSitePlace appSitePlace = baseMapper.selectOne(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getTenantId, site.getTenantId()));
|
|
|
+
|
|
|
+ //判断当前教学日配置是否与原数据对应
|
|
|
+ if (ObjectUtils.notEqual(site.getTeachingDay(), schoolPlaceAddDTO.getTeachingDay()) || ObjectUtils.notEqual(site.getNoTeachingDay(), schoolPlaceAddDTO.getNoTeachingDay())) {
|
|
|
+
|
|
|
+ site.setTeachingDay(schoolPlaceAddDTO.getTeachingDay());
|
|
|
+
|
|
|
+ int year = DateUtils.getYear();
|
|
|
+
|
|
|
+ Map<String, List<String>> HolidayMap = HolidayUtil.getYearHoliday(String.valueOf(year));
|
|
|
+
|
|
|
+ //当前日期
|
|
|
+ Date currDate = DateUtils.str2Date(DateUtils.now(), new SimpleDateFormat("yyyy-MM-dd"));
|
|
|
+
|
|
|
+ // 设置开始日期和结束日期
|
|
|
+ Date beginDate = DateUtils.str2Date((year) + "-01-01 00:00:00", new SimpleDateFormat("yyyy-MM-dd"));
|
|
|
+ Date endDate = DateUtils.str2Date((year + 1) + "-01-01 00:00:00", new SimpleDateFormat("yyyy-MM-dd"));
|
|
|
+
|
|
|
+ // 获取开始日期和结束日期之间的所有日期
|
|
|
+ List<Date> dateList = HolidayUtil.getDaysBetweenDates(beginDate, endDate);
|
|
|
+ //当前日期之后的数据
|
|
|
+ List<Date> dates = dateList.stream().filter(date -> date.after(currDate)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //部门、场地、教学日(teaching)、
|
|
|
+ List<AppSitePriceRules> appSitePriceRulesList = new ArrayList<>();
|
|
|
+
|
|
|
+ // 遍历生成一对多教学时段
|
|
|
+ for (Date localDate : dates) {
|
|
|
+ //查询
|
|
|
+ AppTeachingTime appTeachingTime = appTeachingTimeMapper.selectOne(Wrappers.<AppTeachingTime>lambdaQuery()
|
|
|
+ .eq(AppTeachingTime::getTenantId, site.getTenantId()).eq(AppTeachingTime::getDay, localDate));
|
|
|
+
|
|
|
+ //如果开放时段列表不为空(教学日/非教学日),根据开放时段批量存储,开放时段记录
|
|
|
+ if (ObjectUtils.isNotEmpty(site.getTeachingDay()) && appTeachingTime.getIsTeaching() == 0) {
|
|
|
+
|
|
|
+ //解析Json 数据
|
|
|
+ List<TeachingDayDTO> data = JSONObject.parseObject(site.getTeachingDay()).getJSONArray("data").toJavaList(TeachingDayDTO.class);
|
|
|
+ data.forEach(item -> {
|
|
|
+
|
|
|
+ String startTime = item.getStartTime();
|
|
|
+ String endTime = item.getEndTime();
|
|
|
+
|
|
|
+ AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
+ appSitePriceRules
|
|
|
+ .setOrgCode(site.getOrgCode())
|
|
|
+ .setTenantId(site.getTenantId())
|
|
|
+ .setSitePlaceId(appSitePlace.getId())
|
|
|
+ .setType(0)
|
|
|
+ .setDateOfSale(localDate)
|
|
|
+ .setStartTime(DateUtils.str2Date(startTime, new SimpleDateFormat("HH:mm")))
|
|
|
+ .setEndTime(DateUtils.str2Date(endTime, new SimpleDateFormat("HH:mm")))
|
|
|
+ .setDayOfWeek(HolidayUtil.getWeekOfDate(localDate))
|
|
|
+ .setIsTeaching(appTeachingTime.getIsTeaching())
|
|
|
+ .setCategoryId(site.getCategoryId())
|
|
|
+ .setCreateBy("admin")
|
|
|
+ .setStatus(CommonConstant.STATUS_NORMAL)
|
|
|
+ .setDelFlag(CommonConstant.STATUS_NORMAL)
|
|
|
+ ;
|
|
|
+ appSitePriceRulesList.add(appSitePriceRules);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotEmpty(site.getNoTeachingDay()) && appTeachingTime.getIsTeaching() == 1) {
|
|
|
+
|
|
|
+ List<TeachingDayDTO> data = JSONObject.parseObject(site.getNoTeachingDay()).getJSONArray("data").toJavaList(TeachingDayDTO.class);
|
|
|
+ data.forEach(item -> {
|
|
|
+
|
|
|
+ String startTime = item.getStartTime();
|
|
|
+ String endTime = item.getEndTime();
|
|
|
+
|
|
|
+ AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
+ appSitePriceRules
|
|
|
+ .setOrgCode(site.getOrgCode())
|
|
|
+ .setTenantId(site.getTenantId())
|
|
|
+ .setSitePlaceId(appSitePlace.getId())
|
|
|
+ .setType(0)
|
|
|
+ .setDateOfSale(localDate)
|
|
|
+ .setStartTime(DateUtils.str2Date(startTime, new SimpleDateFormat("HH:mm")))
|
|
|
+ .setEndTime(DateUtils.str2Date(endTime, new SimpleDateFormat("HH:mm")))
|
|
|
+ .setDayOfWeek(HolidayUtil.getWeekOfDate(localDate))
|
|
|
+ .setIsTeaching(appTeachingTime.getIsTeaching())
|
|
|
+ .setCategoryId(site.getCategoryId())
|
|
|
+ .setCreateBy("admin")
|
|
|
+ .setStatus(CommonConstant.STATUS_NORMAL)
|
|
|
+ .setDelFlag(CommonConstant.STATUS_NORMAL)
|
|
|
+ ;
|
|
|
+ appSitePriceRulesList.add(appSitePriceRules);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //存放开放时段列表(删除再新增)
|
|
|
+ appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().gt(AppSitePriceRules::getDateOfSale,currDate).eq(AppSitePriceRules::getTenantId, site.getTenantId()));
|
|
|
+ appSitePriceRulesMapper.insertList(appSitePriceRulesList);
|
|
|
+
|
|
|
+ appSiteMapper.updateById(site);
|
|
|
+ }
|
|
|
+ //修改学校场地开放信息
|
|
|
+ appSitePlace
|
|
|
+ .setCover(schoolPlaceAddDTO.getCover())
|
|
|
+ //todo 设置意外保险字段
|
|
|
+ .setInsurance(schoolPlaceAddDTO.getInsurance())
|
|
|
+ .setReminder(schoolPlaceAddDTO.getReminder());
|
|
|
+ return this.updateById(appSitePlace);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public SchoolPlaceAddDTO querySchoolPlace(String orgCode) {
|
|
|
+
|
|
|
+ SchoolPlaceAddDTO schoolPlaceAddDTO = new SchoolPlaceAddDTO();
|
|
|
+
|
|
|
+ AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, orgCode));
|
|
|
+
|
|
|
+ if (ObjectUtils.isEmpty(site)) {return null;}
|
|
|
+
|
|
|
+ AppSitePlace appSitePlace = this.baseMapper.selectOne(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getOrgCode, orgCode));
|
|
|
+
|
|
|
+ LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+ schoolPlaceAddDTO
|
|
|
+ .setTenantId(site.getTenantId())
|
|
|
+ .setTeachingDay(site.getTeachingDay())
|
|
|
+ .setNoTeachingDay(site.getNoTeachingDay())
|
|
|
+
|
|
|
+ .setHavePermission(Boolean.FALSE)
|
|
|
+ ;
|
|
|
+
|
|
|
+ if (ObjectUtils.isNotEmpty(appSitePlace)) {
|
|
|
+ schoolPlaceAddDTO
|
|
|
+ .setCover(appSitePlace.getCover())
|
|
|
+ .setInsurance(appSitePlace.getInsurance())
|
|
|
+ .setReminder(appSitePlace.getReminder());
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("admin".equals(loginUser.getRoleCode())){
|
|
|
+ schoolPlaceAddDTO.setHavePermission(Boolean.TRUE);
|
|
|
+ }
|
|
|
+
|
|
|
+ return schoolPlaceAddDTO;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 权限校验
|
|
|
*
|