| | |
| | | package com.ots.project.exam.controller; |
| | | |
| | | import com.ots.common.enums.UserTypeEnum; |
| | | import com.ots.common.utils.poi.ExcelUtil; |
| | | import com.ots.common.utils.security.ShiroUtils; |
| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 人口学变量定义Controller |
| | | * |
| | | * @author ots |
| | | * @date 2019-12-11 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/exam/demographyParam") |
| | | public class EntDemographyParamController extends BaseController { |
| | | private String prefix = "exam/demographyParam"; |
| | | |
| | | @Autowired |
| | | private IEntDemographyParamService entDemographyParamService; |
| | | |
| | | @RequiresPermissions("exam:demographyParam:view") |
| | | @GetMapping() |
| | | public String demographyParam() { |
| | | return prefix + "/demographyParam"; |
| | | } |
| | | |
| | | /** |
| | | * 查询人口学变量定义列表 |
| | | */ |
| | | @RequiresPermissions("exam:demographyParam:list") |
| | | @PostMapping("/list") |
| | | @ResponseBody |
| | |
| | | if (Objects.isNull(entDemographyParam.getUserId()) && !Objects.equals(UserTypeEnum.SYS_USER.getUserType(), sysUser.getUserType())) { |
| | | entDemographyParam.setUserId(sysUser.getUserId()); |
| | | } |
| | | |
| | | |
| | | |
| | | //人口学不区分用户 |
| | | //已经修改为企业用户的人口学不能设置,只有一份人口学。管理员和代理商可以修改。(当前需求),而代理商个性化人口学,不支持。 |
| | | //一份管理员,改成一份通用 |
| | | entDemographyParam.setUserId(null); |
| | | List<EntDemographyParam> list = entDemographyParamService.selectEntDemographyParamList(entDemographyParam); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询人口学多语言列表 |
| | | */ |
| | | @RequiresPermissions("exam:demographyParam:list") |
| | | @PostMapping("/listCodes") |
| | | @ResponseBody |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询人口学多语言列表 |
| | | */ |
| | | @RequiresPermissions("exam:demographyParam:list") |
| | | @PostMapping("/addListCodes") |
| | | @ResponseBody |
| | |
| | | return getDataTable(new ArrayList<EntDemographyParam>()); |
| | | } |
| | | |
| | | /** |
| | | * 导出人口学变量定义列表 |
| | | */ |
| | | @RequiresPermissions("exam:demographyParam:export") |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | |
| | | return util.exportExcel(list, "demographyParam"); |
| | | } |
| | | |
| | | /** |
| | | * 新增人口学变量定义 |
| | | */ |
| | | @GetMapping("/add") |
| | | public String add(ModelMap mmap) { |
| | | User sysUser = ShiroUtils.getSysUser(); |
| | |
| | | return prefix + "/add"; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存人口学变量定义 |
| | | */ |
| | | @RequiresPermissions("exam:demographyParam:add") |
| | | @Log(title = "人口学变量定义", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | public AjaxResult addSave(EntDemographyParam entDemographyParam) { |
| | | |
| | | User sysUser = ShiroUtils.getSysUser(); |
| | | if (!Objects.equals(UserTypeEnum.SYS_USER.getUserType(), sysUser.getUserType())) { |
| | | return error("只有系统用户才允许添加人口学变量!"); |
| | | } |
| | | |
| | | EntDemographyParam param = new EntDemographyParam(); |
| | | param.setParamCode(entDemographyParam.getParamCode()); |
| | | List<EntDemographyParam> entDemographyParams = entDemographyParamService.selectEntDemographyParamList(param); |
| | |
| | | return toAjax(entDemographyParamService.insertEntDemographyParam(entDemographyParam)); |
| | | } |
| | | |
| | | /** |
| | | * 修改人口学变量定义 |
| | | */ |
| | | @GetMapping("/edit/{paramId}") |
| | | public String edit(@PathVariable("paramId") Long paramId, ModelMap mmap) { |
| | | EntDemographyParam entDemographyParam = entDemographyParamService.selectEntDemographyParamById(paramId); |
| | |
| | | return prefix + "/edit"; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存人口学变量定义 |
| | | */ |
| | | @RequiresPermissions("exam:demographyParam:edit") |
| | | @Log(title = "人口学变量定义", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | |
| | | return toAjax(entDemographyParamService.updateEntDemographyParam(entDemographyParam)); |
| | | } |
| | | |
| | | /** |
| | | * 删除人口学变量定义 |
| | | */ |
| | | @RequiresPermissions("exam:demographyParam:remove") |
| | | @Log(title = "人口学变量定义", businessType = BusinessType.DELETE) |
| | | @PostMapping("/remove") |