| | |
| | | */ |
| | | package org.springblade.modules.place.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.log.annotation.ApiLog; |
| | | import org.springblade.core.log.logger.BladeLogger; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.jackson.JsonUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.place.entity.PlacePractitionerEntity; |
| | | import org.springblade.modules.place.excel.ImportPractitionerExcel; |
| | | import org.springblade.modules.place.excel.PractitionerExcel; |
| | | import org.springblade.modules.place.service.IPlacePractitionerService; |
| | | import org.springblade.modules.place.vo.PlacePractitionerVO; |
| | | import org.springblade.modules.place.wrapper.PlacePractitionerWrapper; |
| | | import org.springblade.modules.place.service.IPlacePractitionerService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Date; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 场所从业人员 控制器 |
| | |
| | | @RequestMapping("blade-placePractitioner/placePractitioner") |
| | | @Api(value = "场所从业人员", tags = "场所从业人员接口") |
| | | public class PlacePractitionerController { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(PlacePractitionerController.class); |
| | | |
| | | |
| | | private final IPlacePractitionerService placePractitionerService; |
| | | private final BladeLogger bladeLogger; |
| | |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | bladeLogger.info("场所从业人员 删除", JsonUtil.toJson(ids)); |
| | | return R.status(placePractitionerService.removeByIds(Func.toLongList(ids))); |
| | | return R.status(placePractitionerService.removeBatchByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.data(placePractitionerService.countByType(placePractitioner)); |
| | | } |
| | | |
| | | /** |
| | | * 导入场所数据 |
| | | */ |
| | | @PostMapping("/import-practitioner") |
| | | public R importPractitioner(MultipartFile file, @RequestParam(value = "isCovered",defaultValue = "0") Integer isCovered) { |
| | | bladeLogger.info("从业人员信息批量导入", JsonUtil.toJson(isCovered)); |
| | | String data = null; |
| | | try { |
| | | List<ImportPractitionerExcel> read = ExcelUtil.read(file, ImportPractitionerExcel.class); |
| | | data = placePractitionerService.importPractitioner(read, isCovered == 1); |
| | | } catch (Exception e) { |
| | | logger.error("导入失败!", e); |
| | | } |
| | | return R.data(200, data, ""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出模板 |
| | | */ |
| | | @GetMapping("export-practitioner-template") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiLog("从业人员导出模板") |
| | | @ApiOperation(value = "从业人员导出模板", notes = "传入place") |
| | | public void exportPractitionerTemplate(HttpServletResponse response) { |
| | | List<PractitionerExcel> list = new ArrayList<>(); |
| | | PractitionerExcel importPlaceExcel = new PractitionerExcel(); |
| | | list.add(importPlaceExcel); |
| | | ExcelUtil.export(response, "从业人员数据" + DateUtil.time(), "从业人员数据表", list, PractitionerExcel.class); |
| | | } |
| | | |
| | | } |