| | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.io.IOException; |
| | | import java.net.URLDecoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.eam.entity.OperationCertificateApplyDetail; |
| | | import org.jeecg.modules.eam.service.IdentityService; |
| | | import org.jeecg.modules.system.service.SysIdentityService; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | |
| | | private IOperationCertificateService operationCertificateService; |
| | | @Autowired |
| | | private IOperationCertificateDetailService operationCertificateDetailService; |
| | | |
| | | @Autowired |
| | | private IdentityService identityService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | operationCertificateService.saveMain(operationCertificate, operationCertificatePage.getOperationCertificateDetailList()); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | @PostMapping(value = "/addOperationCertificate") |
| | | public Result<String> addOperationCertificate(@RequestBody List<OperationCertificateApplyDetail> operationCertificateList) { |
| | | for(OperationCertificateApplyDetail operationCertificateApplyDetail : operationCertificateList){ |
| | | if("pass".equals(operationCertificateApplyDetail.getExaminationConclusion())){ |
| | | Date currentDate = new Date(); |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(currentDate); |
| | | c.add(Calendar.YEAR, 1); |
| | | currentDate = c.getTime(); |
| | | OperationCertificate operationCertificate = new OperationCertificate(); |
| | | operationCertificate.setNum(identityService.getNumByTypeAndLength("OperationCertificate", 4)); |
| | | operationCertificate.setUserId(operationCertificateApplyDetail.getUserId()); |
| | | operationCertificate.setEquipmentIds(operationCertificateApplyDetail.getEquipmentIds()); |
| | | operationCertificate.setCurrentCycleScore(12); |
| | | operationCertificate.setIssueDate(new Date()); |
| | | operationCertificate.setStartTime(new Date()); |
| | | operationCertificate.setEndTime(currentDate); |
| | | operationCertificate.setStatus("1"); |
| | | operationCertificateService.save(operationCertificate); |
| | | } |
| | | } |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | |
| | | } |
| | | return Result.OK("文件导入失败!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过主表ID查询 |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "操作证管理明细-通过主表ID查询") |
| | | @ApiOperation(value="操作证管理明细-通过主表ID查询", notes="操作证管理明细-通过主表ID查询") |
| | | @GetMapping(value = "/listOperationCertificateDetailByMainId") |
| | | public Result<IPage<OperationCertificateDetail>> listOperationCertificateDetailByMainId(OperationCertificateDetail operationCertificateDetail, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<OperationCertificateDetail> queryWrapper = QueryGenerator.initQueryWrapper(operationCertificateDetail, req.getParameterMap()); |
| | | Page<OperationCertificateDetail> page = new Page<OperationCertificateDetail>(pageNo, pageSize); |
| | | IPage<OperationCertificateDetail> pageList = operationCertificateDetailService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | } |