|
|
@@ -5,10 +5,12 @@ import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.domain.entity.SysDictData;
|
|
|
import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.enums.BusinessType;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
import com.fs.course.domain.FsUserCoursePeriod;
|
|
|
import com.fs.course.domain.FsUserCoursePeriodDays;
|
|
|
@@ -29,6 +31,8 @@ import com.fs.framework.service.TokenService;
|
|
|
import com.fs.his.vo.OptionsVO;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.hc.openapi.tool.fastjson.JSON;
|
|
|
+import com.hc.openapi.tool.fastjson.JSONObject;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -36,10 +40,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -72,6 +73,23 @@ public class FsUserCoursePeriodController extends BaseController {
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Description: 营期key value 值
|
|
|
+ * @Param:
|
|
|
+ * @Return:
|
|
|
+ * @Author xgb
|
|
|
+ * @Date 2025/11/18 14:59
|
|
|
+ */
|
|
|
+ @GetMapping("/listLabel")
|
|
|
+ public TableDataInfo listLabel(FsUserCoursePeriod fsUserCoursePeriod)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ fsUserCoursePeriod.setCompanyId(loginUser.getCompany().getCompanyId().toString());
|
|
|
+ List<SysDictData> list = fsUserCoursePeriodService.selectFsUserCoursePeriodListLabel(fsUserCoursePeriod);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/page")
|
|
|
@ApiOperation("自定义查询主列表分页")
|
|
|
public R pageList(@RequestBody FsUserCoursePeriod fsUserCoursePeriod)
|
|
|
@@ -84,6 +102,33 @@ public class FsUserCoursePeriodController extends BaseController {
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
fsUserCoursePeriod.setCompanyIdList(Collections.singletonList(loginUser.getCompany().getCompanyId()));
|
|
|
List<FsUserCoursePeriodVO> list = fsUserCoursePeriodService.selectFsUserCoursePeriodPage(fsUserCoursePeriod);
|
|
|
+ Long currentCompanyId = loginUser.getCompany().getCompanyId();
|
|
|
+ for (FsUserCoursePeriodVO vo : list) {
|
|
|
+ String isNeedRegisterMember = vo.getIsNeedRegisterMember();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(isNeedRegisterMember)) {
|
|
|
+ boolean containsCurrentCompany = Arrays.stream(isNeedRegisterMember.split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .anyMatch(id -> id.equals(String.valueOf(currentCompanyId)));
|
|
|
+ vo.setIsNeedRegisterMember(containsCurrentCompany ? "1" : "0");
|
|
|
+ } else {
|
|
|
+ vo.setIsNeedRegisterMember("0");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(vo.getIsOpenRestFlag())) {
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(vo.getIsOpenRestFlag());
|
|
|
+ Integer restReminder = jsonObject.getInteger(currentCompanyId.toString());
|
|
|
+ vo.setIsOpenRestReminder(restReminder);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("解析休息标志失败, isOpenRestFlag: {}, companyId: {}",
|
|
|
+ vo.getIsOpenRestFlag(), currentCompanyId, e);
|
|
|
+ vo.setIsOpenRestReminder(null);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ vo.setIsOpenRestReminder(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
PageInfo<FsUserCoursePeriodVO> pageInfo = new PageInfo<>(list);
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("rows", pageInfo.getList());
|
|
|
@@ -145,6 +190,33 @@ public class FsUserCoursePeriodController extends BaseController {
|
|
|
fsUserCoursePeriod.setCompanyId(loginUser.getCompany().getCompanyId().toString());
|
|
|
return toAjax(fsUserCoursePeriodService.updateFsUserCoursePeriod(fsUserCoursePeriod));
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 修改会员营期单独注册状态
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:period:edit')")
|
|
|
+ @Log(title = "会员营期", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/editIsNeedRegisterMember")
|
|
|
+ public AjaxResult editIsNeedRegisterMember(@RequestBody FsUserCoursePeriod fsUserCoursePeriod)
|
|
|
+ {
|
|
|
+ FsUserCoursePeriod fsUserCoursePeriod1 = fsUserCoursePeriodService.selectFsUserCoursePeriodById(fsUserCoursePeriod.getPeriodId());
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ if (ObjectUtil.isEmpty(fsUserCoursePeriod.getIsNeedRegisterMember())){
|
|
|
+ throw new CustomException("修改失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ return toAjax(fsUserCoursePeriodService.editIsNeedRegisterMember(fsUserCoursePeriod,loginUser.getCompany().getCompanyId().toString()));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('course:period:edit')")
|
|
|
+ @Log(title = "会员营期", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/updatePeriodIsOpenRestReminder")
|
|
|
+ public AjaxResult updatePeriodIsOpenRestReminder(@RequestBody FsUserCoursePeriod fsUserCoursePeriod)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ return toAjax(fsUserCoursePeriodService.updatePeriod(fsUserCoursePeriod,loginUser.getCompany().getCompanyId()));
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 删除会员营期
|
|
|
@@ -229,6 +301,8 @@ public class FsUserCoursePeriodController extends BaseController {
|
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
FsUserCoursePeriod period = fsUserCoursePeriodService.selectFsUserCoursePeriodById(param.getPeriodId());
|
|
|
param.setMaxDate(LocalDate.now().plusDays(period.getMaxViewNum()));
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ param.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
List<FsPeriodCountVO> list = fsUserCoursePeriodDaysService.periodCourseCount(param);
|
|
|
long count = fsUserCoursePeriodDaysService.periodCourseByCount(param);
|
|
|
PageInfo<FsPeriodCountVO> pageInfo = new PageInfo<>(list);
|