|
|
|
package com.epmet.controller;
|
|
|
|
|
|
|
|
import com.epmet.commons.tools.annotation.MaskResponse;
|
|
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit;
|
|
|
|
import com.epmet.commons.tools.page.PageData;
|
|
|
|
import com.epmet.commons.tools.utils.ExcelUtils;
|
|
|
|
import com.epmet.commons.tools.utils.Result;
|
|
|
|
import com.epmet.commons.tools.validator.AssertUtils;
|
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
|
|
|
import com.epmet.commons.tools.validator.group.AddGroup;
|
|
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup;
|
|
|
|
import com.epmet.commons.tools.validator.group.UpdateGroup;
|
|
|
|
import com.epmet.dto.ChangeWelfareDTO;
|
|
|
|
import com.epmet.dto.CheckWelfareByIdCardDTO;
|
|
|
|
import com.epmet.excel.ChangeWelfareExcel;
|
|
|
|
import com.epmet.service.ChangeWelfareService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 福利表
|
|
|
|
*
|
|
|
|
* @author generator generator@elink-cn.com
|
|
|
|
* @since v1.0.0 2022-05-09
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("changeWelfare")
|
|
|
|
public class ChangeWelfareController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private ChangeWelfareService changeWelfareService;
|
|
|
|
|
|
|
|
@RequestMapping("page")
|
|
|
|
@MaskResponse(fieldNames = {"mobile", "idCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD})
|
|
|
|
public Result<PageData<ChangeWelfareDTO>> page(@RequestParam Map<String, Object> params){
|
|
|
|
PageData<ChangeWelfareDTO> page = changeWelfareService.page(params);
|
|
|
|
return new Result<PageData<ChangeWelfareDTO>>().ok(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET})
|
|
|
|
public Result<ChangeWelfareDTO> get(@PathVariable("id") String id){
|
|
|
|
ChangeWelfareDTO data = changeWelfareService.get(id);
|
|
|
|
return new Result<ChangeWelfareDTO>().ok(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("save")
|
|
|
|
public Result save(@RequestBody ChangeWelfareDTO dto){
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
|
|
return changeWelfareService.save(dto);
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("update")
|
|
|
|
public Result update(@RequestBody ChangeWelfareDTO dto){
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
|
|
changeWelfareService.update(dto);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE})
|
|
|
|
public Result delete(@RequestBody String[] ids){
|
|
|
|
//效验数据
|
|
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
|
|
changeWelfareService.delete(ids);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@GetMapping("export")
|
|
|
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
|
|
|
List<ChangeWelfareDTO> list = changeWelfareService.list(params);
|
|
|
|
ExcelUtils.exportEpmetExcel(response, null, list, ChangeWelfareExcel.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @describe: 移除福利人员
|
|
|
|
* @author wangtong
|
|
|
|
* @date 2022/5/9 11:11
|
|
|
|
* @params [dto]
|
|
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
|
|
*/
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("removeWelfare")
|
|
|
|
public Result removeWelfare(@RequestBody ChangeWelfareDTO dto){
|
|
|
|
return changeWelfareService.removeWelfare(dto);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @describe: 通过身份证号查询是否属于福利人员,是-true,否-false
|
|
|
|
* @author wangtong
|
|
|
|
* @date 2022/5/9 13:52
|
|
|
|
* @params [dto]
|
|
|
|
* @return com.epmet.commons.tools.utils.Result
|
|
|
|
*/
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@GetMapping("checkWelfareByIdCard")
|
|
|
|
public Boolean checkWelfareByIdCard(CheckWelfareByIdCardDTO dto){
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
|
|
return changeWelfareService.checkWelfareByIdCard(dto);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|