| | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.model.Workorder; |
| | | import com.doumee.dao.business.vo.WorkorderDbhDto; |
| | | import com.doumee.dao.business.vo.WorkorderDcaChildDto; |
| | | import com.doumee.dao.business.vo.WorkorderDcaDto; |
| | | import com.doumee.dao.business.vo.WorkorderSheDto; |
| | | import com.doumee.service.business.WorkorderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("business:workorder:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<Workorder> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(Workorder.class).exportData(workorderService.findPage(pageWrap).getRecords(), "工单信息表", response); |
| | | //0SHE事件 1DCA事件提交记录 2DCA工单 3跌绊滑事件 |
| | | long index = 1; |
| | | if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.ZERO)){ |
| | | List<Workorder> records = workorderService.findPage(pageWrap).getRecords(); |
| | | List<WorkorderSheDto> list = new ArrayList<>(); |
| | | if(records!=null){ |
| | | for(Workorder model : records){ |
| | | WorkorderSheDto t = new WorkorderSheDto(); |
| | | t.setIndex(index++); |
| | | BeanUtils.copyProperties(model,t); |
| | | if(Constants.equalsInteger(model.getOutJiuyi(),Constants.ONE)){ |
| | | t.setJiuyiInfo("外部就医"); |
| | | }else{ |
| | | t.setJiuyiInfo("非外部就医"); |
| | | if(Constants.equalsInteger(model.getIsYiwushi(),Constants.ONE)){ |
| | | t.setJiuyiInfo(t.getJiuyiInfo() + "-医务室"); |
| | | }else{ |
| | | t.setJiuyiInfo(t.getJiuyiInfo() + "-非医务室"); |
| | | if(Constants.equalsInteger(model.getIsHurted(),Constants.ONE)){ |
| | | t.setJiuyiInfo(t.getJiuyiInfo() + "-受伤"); |
| | | }else{ |
| | | t.setJiuyiInfo(t.getJiuyiInfo() + "-未受伤"); |
| | | } |
| | | } |
| | | } |
| | | t.setMemberNames("本人"); |
| | | t.setMemberNames(t.getMemberNames()+"-"+StringUtils.defaultString(model.getMemberNames(),"")); |
| | | list.add(t); |
| | | } |
| | | } |
| | | ExcelExporter.build(WorkorderSheDto.class).export(list, "SHE事件工单报表_"+ DateUtil.formatDate(new Date(),"yyyyMMddHHmmss"), response); |
| | | }else if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.ONE)){ |
| | | List<Workorder> records = workorderService.findPage(pageWrap).getRecords(); |
| | | List<WorkorderDcaDto> list = new ArrayList<>(); |
| | | if(records!=null){ |
| | | for(Workorder model : records){ |
| | | WorkorderDcaDto t = new WorkorderDcaDto(); |
| | | t.setIndex(index++); |
| | | BeanUtils.copyProperties(model,t); |
| | | list.add(t); |
| | | } |
| | | } |
| | | ExcelExporter.build(WorkorderDcaDto.class).export(list, "DCA事件工单提交记录报表_"+ DateUtil.formatDate(new Date(),"yyyyMMddHHmmss"), response); |
| | | }else if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.TWO)){ |
| | | List<Workorder> records = workorderService.findPage(pageWrap).getRecords(); |
| | | List<WorkorderDcaChildDto> list = new ArrayList<>(); |
| | | if(records!=null){ |
| | | for(Workorder model : records){ |
| | | WorkorderDcaChildDto t = new WorkorderDcaChildDto(); |
| | | t.setIndex(index++); |
| | | BeanUtils.copyProperties(model,t); |
| | | list.add(t); |
| | | } |
| | | } |
| | | ExcelExporter.build(WorkorderDcaChildDto.class).export(list, "DCA事件工单报表_"+ DateUtil.formatDate(new Date(),"yyyyMMddHHmmss"), response); |
| | | }else if(Constants.equalsInteger(pageWrap.getModel().getType(),Constants.THREE)){ |
| | | List<Workorder> records = workorderService.findPage(pageWrap).getRecords(); |
| | | List<WorkorderDbhDto> list = new ArrayList<>(); |
| | | if(records!=null){ |
| | | for(Workorder model : records){ |
| | | WorkorderDbhDto t = new WorkorderDbhDto(); |
| | | t.setIndex(index++); |
| | | BeanUtils.copyProperties(model,t); |
| | | list.add(t); |
| | | } |
| | | } |
| | | ExcelExporter.build(WorkorderDbhDto.class).export(list, "跌绊滑事件工单报表_"+ DateUtil.formatDate(new Date(),"yyyyMMddHHmmss"), response); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |