| | |
| | | package com.ots.project.exam.controller; |
| | | |
| | | import com.ots.common.enums.UserTypeEnum; |
| | | import com.ots.common.utils.MessageUtils; |
| | | import com.ots.common.utils.StringUtils; |
| | |
| | | import com.ots.framework.web.page.TableDataInfo; |
| | | import com.ots.project.exam.domain.EntDemographyParam; |
| | | import com.ots.project.exam.domain.EntEmailTemplate; |
| | | import com.ots.project.exam.domain.EntTestMember; |
| | | import com.ots.project.exam.domain.EntTestPackage; |
| | | import com.ots.project.exam.domain.SysUserExtend; |
| | | import com.ots.project.exam.service.*; |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ots.common.enums.UserTypeEnum.SYS_USER; |
| | | |
| | | /** |
| | |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public AjaxResult export(EntTestPackage entTestPackage) { |
| | | User sysUser = ShiroUtils.getSysUser(); |
| | | String userType = sysUser.getUserType(); |
| | | List<Long> userIds = new ArrayList<>(); |
| | | userIds.add(sysUser.getUserId()); |
| | | |
| | | if (UserTypeEnum.DIS_USER.getUserType().equals(userType)) { |
| | | SysUserExtend sysUserExtend = new SysUserExtend(); |
| | | sysUserExtend.setParentUserId(sysUser.getUserId()); |
| | | List<SysUserExtend> sysUserExtends = sysUserExtendService.selectSysUserExtendList(sysUserExtend); |
| | | for (int i = 0; i < sysUserExtends.size(); i++) { |
| | | SysUserExtend extend = sysUserExtends.get(i); |
| | | userIds.add(extend.getUserId()); |
| | | } |
| | | } |
| | | List<EntTestPackage> list = entTestPackageService.selectEntTestPackageList(entTestPackage); |
| | | if (!SYS_USER.getUserType().equals(userType)) { |
| | | |
| | | list = list.stream().filter(p -> userIds.contains(p.getUserId())).collect(Collectors.toList()); |
| | | } |
| | | ExcelUtil<EntTestPackage> util = new ExcelUtil<EntTestPackage>(EntTestPackage.class); |
| | | return util.exportExcel(list, "test_package"); |
| | | } |
| | |
| | | public String edit(@PathVariable("id") Long id, ModelMap mmap) { |
| | | EntTestPackage entTestPackage = entTestPackageService.selectEntTestPackageById(id); |
| | | mmap.put("entTestPackage", entTestPackage); |
| | | |
| | | EntDemographyParam entDemographyParam = new EntDemographyParam(); |
| | | List<EntDemographyParam> list = entDemographyParamService.selectEntDemographyParamList(entDemographyParam); |
| | | |
| | | String paramCodes = entTestPackage.getParamCodes(); |
| | | /** |
| | | * 默认全部为false |