| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.google.common.base.Joiner; |
| | | import com.ltkj.common.annotation.RepeatSubmit; |
| | | import com.ltkj.common.excelConfig.ExcelUtils; |
| | | import com.ltkj.common.task.TaskService; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | |
| | | /** |
| | | * 导入团体体检预约列表 |
| | | */ |
| | | @PostMapping("/excelImport") |
| | | @ApiOperation(value = "团体导入 (旧版本)") |
| | | public AjaxResult excelImport(@RequestPart(value = "file") @ApiParam(value = "Excel文件") MultipartFile file) { |
| | | List<TjReservation> tjReservations = null; |
| | | try { |
| | | tjReservations = ExcelUtils.readMultipartFile(file, TjReservation.class); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("导入文件有误请检查导入文件!"); |
| | | } |
| | | List<String> wrongList = new ArrayList<>(); |
| | | List<TjReservation> rightList = new ArrayList<>(); |
| | | for (TjReservation tjReservation : tjReservations) { |
| | | String idCard = tjReservation.getIdCard(); |
| | | String phoe = tjReservation.getPhoe(); |
| | | if (null != idCard && null != phoe) { |
| | | if (!MatchUtils.isIdCard(idCard) || !MatchUtils.isMobileNO(phoe)) { |
| | | wrongList.add(tjReservation.getName()); |
| | | } else { |
| | | rightList.add(tjReservation); |
| | | } |
| | | } else { |
| | | wrongList.add(tjReservation.getName()); |
| | | } |
| | | } |
| | | if (wrongList.size() > 0) { |
| | | return AjaxResult.success("操作失败", wrongList); |
| | | } else { |
| | | return AjaxResult.success("操作成功",rightList); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导入团体体检预约列表 |
| | | */ |
| | | @PostMapping("/newExcelImport") |
| | | @ApiOperation(value = "团体导入 (新版本)") |
| | | @Transactional |
| | |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("导入文件有误请检查导入文件!"); |
| | | } |
| | | int grouping = dwGroupingService.selectTjDwGroupingByDwDeptId(dwDeptId); |
| | | |
| | | if(grouping==0){ |
| | | return AjaxResult.error("请检查部门中是否存在分组或分组中是否存在项目!"); |
| | | } |
| | | |
| | | List<String> wrongList = new ArrayList<>(); |
| | | List<TjReservation> rightList = new ArrayList<>(); |
| | | List<TjReservation> yyList = new ArrayList<>(); |
| | |
| | | map.put("woManMoney", woManMoney); |
| | | return AjaxResult.success("操作成功", map); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/reservationConfirm") |
| | | @ApiOperation(value = "团体预约确认接口 (旧版本)") |
| | | public AjaxResult reservationConfirm(@RequestBody Map<String, Object> map) { |
| | | List<TjReservation> rightLists = (List<TjReservation>) map.get("rightList"); |
| | | String pacId = map.get("pacId").toString(); |
| | | String copeWith = map.get("copeWith").toString(); |
| | | String[] proIds = (String[]) map.get("proIds"); |
| | | Object compId1 = map.get("compId"); |
| | | if (null == compId1 || compId1.equals("")) { |
| | | return AjaxResult.error("请选择单位信息"); |
| | | } |
| | | String compId = map.get("compId").toString(); |
| | | Object reservationTime1 = map.get("reservationTime"); |
| | | if (null == reservationTime1) { |
| | | return AjaxResult.error("请选择预约时间!"); |
| | | } |
| | | String reservationTime = map.get("reservationTime").toString(); |
| | | String payType = map.get("payType").toString(); |
| | | String jsonString = JSON.toJSONString(rightLists); |
| | | List<TjReservation> rightList = JSON.parseArray(jsonString, TjReservation.class); |
| | | |
| | | if (null != rightList) { |
| | | if (null != pacId || null != proIds && proIds.length > 0) { |
| | | String teamNo = PinyinUtil.getFirstLetter(compService.getById(compId).getCnName(), "") + DateUtil.format(new Date(), "yyMMddHHmmss"); |
| | | for (TjReservation reservation : rightList) { |
| | | LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjReservation::getIdCard, reservation.getIdCard()); |
| | | wq.eq(TjReservation::getIsExpire, 2); |
| | | TjReservation one = tjReservationService.getOne(wq); |
| | | if (null != one) { |
| | | continue; |
| | | } |
| | | if (null != pacId) { |
| | | reservation.setPacId(pacId); |
| | | } |
| | | if (null != proIds && proIds.length > 0) { |
| | | reservation.setProIds(Joiner.on(",").join(proIds)); |
| | | } |
| | | reservation.setReservationTime(DateUtil.parse(reservationTime, "yyyy-MM-dd")); |
| | | reservation.setCompanyId(compId); |
| | | reservation.setCompany(compService.getById(compId).getCnName()); |
| | | reservation.setPayType(Long.valueOf(payType)); |
| | | reservation.setTjType(String.valueOf(1)); |
| | | reservation.setTeamNo(teamNo); |
| | | tjReservationService.save(reservation); |
| | | // delayService.reservation(reservation.getId()); |
| | | } |
| | | LambdaQueryWrapper<TjCompPay> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.eq(TjCompPay::getCompId, compId); |
| | | wq0.eq(TjCompPay::getTeamNo, teamNo); |
| | | TjCompPay one = compPayService.getOne(wq0); |
| | | if (null != one) { |
| | | one.setCopeWith(new BigDecimal(copeWith)); |
| | | one.setSerialNumber(SecurityUtils.getUsername() + DateUtil.format(new Date(), "yyMMddHHmmssSSS")); |
| | | one.setInvoiceNo("FP" + DateUtil.format(new Date(), "yyMMddHHmmssSSS")); |
| | | one.setPaidIn(new BigDecimal("0.00")); |
| | | compPayService.updateById(one); |
| | | } else { |
| | | TjCompPay tjCompPay = new TjCompPay(); |
| | | tjCompPay.setCompId(compId); |
| | | tjCompPay.setTeamNo(teamNo); |
| | | tjCompPay.setCopeWith(new BigDecimal(copeWith)); |
| | | tjCompPay.setSerialNumber(SecurityUtils.getUsername() + DateUtil.format(new Date(), "yyMMddHHmmssSSS")); |
| | | tjCompPay.setInvoiceNo("FP" + DateUtil.format(new Date(), "yyMMddHHmmssSSS")); |
| | | tjCompPay.setPaidIn(new BigDecimal("0.00")); |
| | | tjCompPay.setDifference(tjCompPay.getCopeWith().subtract(BigDecimal.valueOf(0.00))); |
| | | compPayService.save(tjCompPay); |
| | | } |
| | | LambdaQueryWrapper<TjTeamSelectRecord> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjTeamSelectRecord::getTeamNo, teamNo); |
| | | wq.eq(TjTeamSelectRecord::getCompId, compId); |
| | | TjTeamSelectRecord recordServiceOne = selectRecordService.getOne(wq); |
| | | if (null != recordServiceOne) { |
| | | if (null != pacId) recordServiceOne.setPacId(pacId); |
| | | recordServiceOne.setProIds(Joiner.on(";").join(proIds != null ? proIds : new String[0])); |
| | | recordServiceOne.setTeamNo(teamNo); |
| | | recordServiceOne.setTransactionAmount(new BigDecimal("0.00")); |
| | | recordServiceOne.setCount(rightList.size()); |
| | | selectRecordService.updateById(recordServiceOne); |
| | | } |
| | | TjTeamSelectRecord selectRecord = new TjTeamSelectRecord(); |
| | | selectRecord.setCompId(compId); |
| | | if (null != pacId) selectRecord.setPacId(pacId); |
| | | selectRecord.setProIds(Joiner.on(";").join(proIds != null ? proIds : new String[0])); |
| | | selectRecord.setTeamNo(teamNo); |
| | | selectRecord.setTransactionAmount(new BigDecimal("0.00")); |
| | | selectRecord.setCount(rightList.size()); |
| | | selectRecordService.save(selectRecord); |
| | | return AjaxResult.success("预约成功"); |
| | | } |
| | | return AjaxResult.error("请选择体检内容"); |
| | | } |
| | | return AjaxResult.error("请选择预约对象"); |
| | | } |
| | | |
| | | |
| | |
| | | for (TjGroupingPro groupingPro : proList) { |
| | | TjProject project = projectService.getById(groupingPro.getProId()); |
| | | if(null !=project){ |
| | | if (project.getProType().equals("") || project.getProType()==null) { |
| | | if (project.getProType()==null || project.getProType().equals("")) { |
| | | groupingPro.setProType("2"); |
| | | }else { |
| | | groupingPro.setProType(project.getProType()); |
| | |
| | | @PostMapping("/newReservationConfirm") |
| | | @ApiOperation(value = "团体预约确认接口 (新版本)") |
| | | @Transactional |
| | | @RepeatSubmit |
| | | public AjaxResult newReservationConfirm(@RequestBody ConfirmDto dto) { |
| | | //预约的所有人 |
| | | List<TjReservation> rightList = dto.getReservations(); |
| | |
| | | reservation.setProIds(Joiner.on(",").join(proIds)); |
| | | reservation.setReservationTime(DateUtil.parse(reservationTime, "yyyy-MM-dd")); |
| | | reservation.setCompanyId(dwGrouping.getDwId()); |
| | | reservation.setCompany(dwGrouping.getDwName()); |
| | | reservation.setCompany(dwGrouping.getDwDeptName()); |
| | | reservation.setPayType(Long.valueOf(dwGrouping.getPayType())); |
| | | reservation.setPacId(dwDept.getId()); |
| | | // if(dwGrouping.getPayType().equals("1")){ |