package com.imed.costaccount.web; import com.imed.costaccount.common.util.PageUtils; import com.imed.costaccount.common.util.Result; import com.imed.costaccount.common.util.UserContext; import com.imed.costaccount.model.CostIncomeFile; import com.imed.costaccount.model.vo.IncomeErrorMessage; import com.imed.costaccount.service.CostIncomeFileService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; /** * 文件上传记录 * * @author KCYG * @date 2021-08-10 14:42:20 */ @RestController @RequestMapping("/costAccount/costincomefile") @Api(tags = "文件记录") public class CostIncomeFileController { @Autowired private CostIncomeFileService costIncomeFileService; /** * 分页查询列表 * 查询的是 */ @GetMapping("/list") @ApiOperation("分页查询记录数据") public Result list(@RequestParam(value = "current", defaultValue = "1") Integer current, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(value = "fileName",required = false) String fileName, @RequestParam(value = "dateTime",required = false) String dateTime){ Long hospId = UserContext.getHospId(); PageUtils pageUtils = costIncomeFileService.queryList(current,pageSize,fileName,dateTime,hospId); return Result.ok(pageUtils); } /** * 撤销导入 * 这个文件的Id */ @PostMapping("/deleteImport") @ApiOperation("撤销导入") public Result deleteImport(Long id){ Long hospId = UserContext.getHospId(); costIncomeFileService.deleteImport(id,hospId); return Result.ok(); } @GetMapping("/getErrorList") @ApiOperation("查看错误详情") public Result getErrorList(Long id){ Long hospId = UserContext.getHospId(); List incomeErrorMessageList = costIncomeFileService.getErrorList(id,hospId); return Result.ok(incomeErrorMessageList); } /** * 信息 */ @RequestMapping("/info/{id}") public Result info(@PathVariable("id") Long id){ CostIncomeFile costIncomeFile = costIncomeFileService.getById(id); return Result.ok(costIncomeFile); } /** * 保存 */ @RequestMapping("/save") public Result save(@RequestBody CostIncomeFile costIncomeFile){ costIncomeFileService.save(costIncomeFile); return Result.ok(); } /** * 修改 */ @RequestMapping("/update") public Result update(@RequestBody CostIncomeFile costIncomeFile){ costIncomeFileService.updateById(costIncomeFile); return Result.ok(); } /** * 删除 */ @PostMapping("/delete") public Result delete(@RequestBody Long[] ids){ costIncomeFileService.deleteByIds(Arrays.asList(ids)); return Result.ok(); } }