| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.net.URL; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.druid.sql.visitor.functions.Isnull; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.core.domain.entity.SysDictData; |
| | | import com.ltkj.common.excelConfig.ExcelUtils; |
| | | import com.ltkj.common.task.TaskService; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.common.utils.StringUtils; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | |
| | | import com.ltkj.hosp.dto.ConfirmDto; |
| | | import com.ltkj.hosp.dto.ExcelImportDto; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.mall.mallOrderUtils.TjConstants; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDictDataService; |
| | | import com.ltkj.web.config.pdfutils.PDFBinaryUtil; |
| | | import com.ltkj.web.config.redis.OrderDelayService; |
| | | import com.ltkj.web.config.task.TjReservationTask; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ltkj.common.core.controller.BaseController; |
| | | import com.ltkj.common.core.domain.AjaxResult; |
| | |
| | | @RestController |
| | | @RequestMapping("/reservation/reservation") |
| | | @Api(tags = "体检预约管理接口") |
| | | @Slf4j |
| | | public class TjReservationController extends BaseController { |
| | | @Resource |
| | | private ITjReservationService tjReservationService; |
| | |
| | | private ITjGroupingProService groupingProService; |
| | | @Resource |
| | | private TjAsyncService asyncService; |
| | | @Resource |
| | | private OrderDelayService delayService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private ISysDictDataService dictDataService; |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | @Value("${path.filePath}") |
| | | private String value; |
| | | |
| | | @PostMapping("/importTemplate") |
| | | @ApiOperation(value = "导出excel表模板") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtils.exportTemplate(response, "体检预约Excel模板", TjReservation.class); |
| | | //原来的下载模板调用接口 |
| | | String base64String = PDFBinaryUtil.getPDFBinary(configService.selectConfigByKey("default_excelTemplate")); |
| | | if (null != base64String) { |
| | | PDFBinaryUtil.base64StringToPDF(base64String, FileUtil.mkdir(value).getPath() + File.separator + "团体预约Excel模版.xls"); |
| | | String filePath = value + File.separator + "团体预约Excel模版.xls"; |
| | | File f = new File(filePath); |
| | | BufferedInputStream br = null; |
| | | OutputStream out = null; |
| | | FileInputStream fileInputStream = null; |
| | | try { |
| | | fileInputStream = new FileInputStream(f); |
| | | br = new BufferedInputStream(fileInputStream); |
| | | byte[] bs = new byte[1024]; |
| | | int len = 0; |
| | | response.reset(); // 非常重要 |
| | | if (true) { |
| | | // 在线打开方式 |
| | | URL u = new URL("file:///" + filePath); |
| | | //System.out.println(u); |
| | | String contentType = u.openConnection().getContentType(); |
| | | response.setContentType(contentType); |
| | | response.setHeader("Content-Disposition", "inline;filename=团体预约Excel模版.xls"); |
| | | } else { |
| | | // 纯下载方式 |
| | | response.setContentType("application/x-msdownload"); |
| | | response.setContentType("application/pdf;charset=utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=团体预约Excel模版.xls"); |
| | | } |
| | | out = response.getOutputStream(); |
| | | while ((len = br.read(bs)) > 0) { |
| | | out.write(bs, 0, len); |
| | | } |
| | | out.flush(); |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | //System.out.println("pdf处理文件异常" + e); |
| | | } finally { |
| | | if (out != null) { |
| | | try { |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | @ApiOperation(value = "查询体检预约列表接口(默认)") |
| | | public TableDataInfo list(TjReservation tjReservation) { |
| | | startPage(); |
| | | tjReservation.setIsExpire(2); |
| | | List<TjReservation> list = tjReservationService.selectTjReservationList(tjReservation); |
| | | if(null !=list && list.size()>0){ |
| | | for (TjReservation reservation : list) { |
| | | reservation.setName(MatchUtils.hideCusName(reservation.getName())); |
| | | reservation.setPhoe(MatchUtils.hidePhoneNum(reservation.getPhoe())); |
| | | reservation.setIdCard(MatchUtils.hideIdCardNum(reservation.getIdCard())); |
| | | } |
| | | } |
| | | // if(null !=list && list.size()>0){ |
| | | // for (TjReservation reservation : list) { |
| | | // reservation.setName(MatchUtils.hideCusName(reservation.getName())); |
| | | // reservation.setPhoe(MatchUtils.hidePhoneNum(reservation.getPhoe())); |
| | | // reservation.setIdCard(MatchUtils.hideIdCardNum(reservation.getIdCard())); |
| | | // } |
| | | // } |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | public TableDataInfo selectTjReservationByDelete(TjReservation tjReservation) { |
| | | startPage(); |
| | | List<TjReservation> list = tjReservationService.selectTjReservationByDelete(tjReservation); |
| | | if(null !=list && list.size()>0){ |
| | | for (TjReservation reservation : list) { |
| | | reservation.setName(MatchUtils.hideCusName(reservation.getName())); |
| | | reservation.setPhoe(MatchUtils.hidePhoneNum(reservation.getPhoe())); |
| | | reservation.setIdCard(MatchUtils.hideIdCardNum(reservation.getIdCard())); |
| | | } |
| | | if (null != list && !list.isEmpty()) { |
| | | // for (TjReservation reservation : list) { |
| | | // reservation.setName(MatchUtils.hideCusName(reservation.getName())); |
| | | // reservation.setPhoe(MatchUtils.hidePhoneNum(reservation.getPhoe())); |
| | | // reservation.setIdCard(MatchUtils.hideIdCardNum(reservation.getIdCard())); |
| | | // } |
| | | } |
| | | return getDataTable(list); |
| | | } |
| | |
| | | /** |
| | | * 导入团体体检预约列表 |
| | | */ |
| | | @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 = "团体导入 (新版本)") |
| | | @ApiOperation(value = "团体excel表导入") |
| | | @Transactional |
| | | public AjaxResult newExcelImport(@RequestPart(value = "file") @ApiParam(value = "Excel文件") MultipartFile file, |
| | | @RequestParam @ApiParam(value = "单位id") String dwId, |
| | | @RequestParam @ApiParam(value = "单位部门id") String dwDeptId) { |
| | |
| | | } 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<>(); |
| | |
| | | TjDwGrouping groupingWoMan = null;//女 |
| | | TjDwGrouping groupingWz = null;//未知(不分性别) |
| | | try { |
| | | groupingMan = dwGroupingService.getOne(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId,dwId) |
| | | .eq(TjDwGrouping::getDwDeptId,dwDeptId).eq(TjDwGrouping::getSex, 0)); |
| | | groupingWoMan = dwGroupingService.getOne(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId,dwId) |
| | | .eq(TjDwGrouping::getDwDeptId,dwDeptId).eq(TjDwGrouping::getSex, 1)); |
| | | groupingWz = dwGroupingService.getOne(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId,dwId) |
| | | .eq(TjDwGrouping::getDwDeptId,dwDeptId).eq(TjDwGrouping::getSex, 2)); |
| | | groupingMan = dwGroupingService.getOne(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId, dwId) |
| | | .eq(TjDwGrouping::getDwDeptId, dwDeptId).eq(TjDwGrouping::getSex, 0)); |
| | | groupingWoMan = dwGroupingService.getOne(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId, dwId) |
| | | .eq(TjDwGrouping::getDwDeptId, dwDeptId).eq(TjDwGrouping::getSex, 1)); |
| | | groupingWz = dwGroupingService.getOne(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId, dwId) |
| | | .eq(TjDwGrouping::getDwDeptId, dwDeptId).eq(TjDwGrouping::getSex, 2)); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("分组信息有误请重新分组!"); |
| | | } |
| | |
| | | BigDecimal manMoney = new BigDecimal("0.00"); |
| | | //女组金额 |
| | | BigDecimal woManMoney = new BigDecimal("0.00"); |
| | | int count=0;//总计人数 |
| | | int manCount=0;//男组人数 |
| | | int woManCount=0;//女组人数 |
| | | int count = 0;//总计人数 |
| | | int manCount = 0;//男组人数 |
| | | int woManCount = 0;//女组人数 |
| | | for (TjReservation tjReservation : tjReservations) { |
| | | String idCard = tjReservation.getIdCard(); |
| | | String phoe = tjReservation.getPhoe(); |
| | | if (null != idCard && null != phoe) { |
| | | if (!MatchUtils.isIdCard(idCard) || !MatchUtils.isMobileNO(phoe)) { |
| | | // if (!MatchUtils.isIdCard(idCard) || !MatchUtils.isMobileNO(phoe)); |
| | | if (idCard.isEmpty() || phoe.isEmpty()) { |
| | | wrongList.add(tjReservation.getName()); |
| | | } else { |
| | | String str = MatchUtils.translateToPlainStr(tjReservation.getPhoe()); |
| | | |
| | | tjReservation.setPhoe(str); |
| | | //年龄 |
| | | tjReservation.setAge(String.valueOf(MatchUtils.getAgeByIdCard(tjReservation.getIdCard()))); |
| | | //出生日期 |
| | | tjReservation.setBirthday(DateUtil.parse(MatchUtils.getBirthDayByIdCard(tjReservation.getIdCard()), "yyyy-MM-dd")); |
| | | |
| | | if (null != groupingMan && groupingMan.getSex().equals(String.valueOf(tjReservation.getSex()))) { |
| | | |
| | | tjReservation.setGroupingId(groupingMan.getId()); |
| | | tjReservation.setGroupingName(groupingMan.getGroupingName()); |
| | | tjReservation.setYsPrice(groupingMan.getYsPrice()); |
| | | //合计 |
| | | hjMoney = hjMoney.add(groupingMan.getYsPrice()); count+=1; |
| | | hjMoney = hjMoney.add(groupingMan.getYsPrice()); |
| | | count += 1; |
| | | //男组人数 |
| | | manMoney=manMoney.add(groupingMan.getYsPrice()); manCount+=1; |
| | | manMoney = manMoney.add(groupingMan.getYsPrice()); |
| | | manCount += 1; |
| | | |
| | | } else if (null != groupingWoMan && groupingWoMan.getSex().equals(String.valueOf(tjReservation.getSex()))) { |
| | | |
| | |
| | | tjReservation.setGroupingName(groupingWoMan.getGroupingName()); |
| | | tjReservation.setYsPrice(groupingWoMan.getYsPrice()); |
| | | //合计 |
| | | hjMoney = hjMoney.add(groupingWoMan.getYsPrice()); count+=1; |
| | | woManMoney=woManMoney.add(groupingWoMan.getYsPrice());woManCount+=1; |
| | | hjMoney = hjMoney.add(groupingWoMan.getYsPrice()); |
| | | count += 1; |
| | | woManMoney = woManMoney.add(groupingWoMan.getYsPrice()); |
| | | woManCount += 1; |
| | | |
| | | } else if (null != groupingWz && groupingWz.getSex().equals(String.valueOf(tjReservation.getSex()))) { |
| | | |
| | |
| | | tjReservation.setGroupingName(groupingWz.getGroupingName()); |
| | | tjReservation.setYsPrice(groupingWz.getYsPrice()); |
| | | //合计 |
| | | hjMoney = hjMoney.add(groupingWz.getYsPrice()); count+=1; |
| | | hjMoney = hjMoney.add(groupingWz.getYsPrice()); |
| | | count += 1; |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @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("请选择单位信息"); |
| | | /** |
| | | * 导入团体体检预约列表 |
| | | */ |
| | | @PostMapping("/newExcelImportNotDwDeptId") |
| | | @ApiOperation(value = "团体excel表导入 (新版本不传单位部门id)") |
| | | @Transactional |
| | | public AjaxResult newExcelImportNotDwDeptId(@RequestPart(value = "file") @ApiParam(value = "Excel文件") MultipartFile file, |
| | | @RequestParam @ApiParam(value = "单位id") String dwId) { |
| | | List<TjReservation> tjReservations = null; |
| | | try { |
| | | tjReservations = ExcelUtils.readMultipartFile(file, TjReservation.class); |
| | | } catch (Exception e) { |
| | | 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); |
| | | int grouping = dwGroupingService.selectTjDwGroupingByDwId(dwId); |
| | | |
| | | 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("请选择体检内容"); |
| | | if (grouping == 0) { |
| | | return AjaxResult.error("请检查该单位是否存否存在项目!"); |
| | | } |
| | | return AjaxResult.error("请选择预约对象"); |
| | | |
| | | List<String> wrongList = new ArrayList<>(); |
| | | List<TjReservation> rightList = new ArrayList<>(); |
| | | List<TjReservation> yyList = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<TjDwGrouping> groupingMans = null;//男 |
| | | List<TjDwGrouping> groupingWoMans = null;//女 |
| | | List<TjDwGrouping> groupingWzs = null;//未知(不分性别) |
| | | try { |
| | | groupingMans = dwGroupingService.list(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId, dwId) |
| | | .eq(TjDwGrouping::getSex, 0)); |
| | | groupingWoMans = dwGroupingService.list(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId, dwId) |
| | | .eq(TjDwGrouping::getSex, 1)); |
| | | groupingWzs = dwGroupingService.list(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId, dwId) |
| | | .eq(TjDwGrouping::getSex, 2)); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("分组信息有误请重新分组!"); |
| | | } |
| | | |
| | | String sfjysfzh = configService.selectConfigByKey("sfjysfzh"); |
| | | String sfjysjh = configService.selectConfigByKey("sfjysjh"); |
| | | |
| | | //计算合计 |
| | | BigDecimal hjMoney = new BigDecimal("0.00"); |
| | | //男组金额 |
| | | BigDecimal manMoney = new BigDecimal("0.00"); |
| | | //女组金额 |
| | | BigDecimal woManMoney = new BigDecimal("0.00"); |
| | | int count = 0;//总计人数 |
| | | int manCount = 0;//男组人数 |
| | | int woManCount = 0;//女组人数 |
| | | List<String> ids=new ArrayList<>(); |
| | | |
| | | for (TjReservation tjReservation : tjReservations) { |
| | | String idCard = tjReservation.getIdCard(); |
| | | String phoe = tjReservation.getPhoe(); |
| | | idCard= idCard.replaceAll("[',,;.。 ‘“]",""); |
| | | |
| | | if (!StringUtils.isBlank(idCard) || !StringUtils.isBlank(phoe) || null != tjReservation.getDwxm()) { |
| | | //将科学计数的手机号转换成文本形式 |
| | | phoe = MatchUtils.translateToPlainStr(tjReservation.getPhoe()); |
| | | |
| | | if(!ids.isEmpty() && ids.contains(tjReservation.getIdCard())){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("此身份证号: "+tjReservation.getIdCard()+" 重复,请核对后上传!"); |
| | | } |
| | | |
| | | ids.add(tjReservation.getIdCard()); |
| | | |
| | | // if (sfjysfzh.equalsIgnoreCase("Y") || sfjysjh.equalsIgnoreCase("Y")) { |
| | | if ((sfjysfzh.equalsIgnoreCase("Y") && !MatchUtils.isIdCard(idCard)) || |
| | | (sfjysjh.equalsIgnoreCase("Y") && !MatchUtils.isMobileNO(phoe))) { |
| | | wrongList.add(tjReservation.getName()); |
| | | log.info(tjReservation.getName()+idCard+MatchUtils.isIdCard(idCard)+MatchUtils.isMobileNO(phoe)); |
| | | }else { |
| | | |
| | | |
| | | tjReservation.setPhoe(phoe); |
| | | |
| | | //年龄 |
| | | tjReservation.setAge(String.valueOf(MatchUtils.getAgeByIdCard(tjReservation.getIdCard()))); |
| | | //出生日期 |
| | | tjReservation.setBirthday(DateUtil.parse(MatchUtils.getBirthDayByIdCard(tjReservation.getIdCard()), "yyyy-MM-dd")); |
| | | |
| | | TjDwDept dwDept = dwDeptService.getOne(new LambdaQueryWrapper<TjDwDept>().eq(TjDwDept::getDwDeptName, tjReservation.getDwxm())); |
| | | if (null != dwDept) { |
| | | for (TjDwGrouping groupingMan : groupingMans) { |
| | | if (null != groupingMan && groupingMan.getSex().equals(String.valueOf(tjReservation.getSex())) && groupingMan.getDwDeptId().equals(dwDept.getId())) { |
| | | tjReservation.setGroupingId(groupingMan.getId()); |
| | | tjReservation.setGroupingName(groupingMan.getGroupingName()); |
| | | tjReservation.setYsPrice(groupingMan.getYsPrice()); |
| | | //合计 |
| | | hjMoney = hjMoney.add(groupingMan.getYsPrice()); |
| | | count += 1; |
| | | //男组人数 |
| | | manMoney = manMoney.add(groupingMan.getYsPrice()); |
| | | manCount += 1; |
| | | } |
| | | } |
| | | |
| | | for (TjDwGrouping groupingWoMan : groupingWoMans) { |
| | | if (null != groupingWoMan && groupingWoMan.getSex().equals(String.valueOf(tjReservation.getSex())) && groupingWoMan.getDwDeptId().equals(dwDept.getId())) { |
| | | tjReservation.setGroupingId(groupingWoMan.getId()); |
| | | tjReservation.setGroupingName(groupingWoMan.getGroupingName()); |
| | | tjReservation.setYsPrice(groupingWoMan.getYsPrice()); |
| | | //合计 |
| | | hjMoney = hjMoney.add(groupingWoMan.getYsPrice()); |
| | | count += 1; |
| | | woManMoney = woManMoney.add(groupingWoMan.getYsPrice()); |
| | | woManCount += 1; |
| | | } |
| | | } |
| | | for (TjDwGrouping groupingWz : groupingWzs) { |
| | | if (null != groupingWz && groupingWz.getDwDeptId().equals(dwDept.getId())) { |
| | | tjReservation.setGroupingId(groupingWz.getId()); |
| | | tjReservation.setGroupingName(groupingWz.getGroupingName()); |
| | | tjReservation.setYsPrice(groupingWz.getYsPrice()); |
| | | //合计 |
| | | hjMoney = hjMoney.add(groupingWz.getYsPrice()); |
| | | count += 1; |
| | | if (tjReservation.getSex() == 0) { |
| | | manMoney = manMoney.add(groupingWz.getYsPrice()); |
| | | manCount += 1; |
| | | } |
| | | if (tjReservation.getSex() == 1) { |
| | | woManMoney = woManMoney.add(groupingWz.getYsPrice()); |
| | | woManCount += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjReservation::getIdCard, tjReservation.getIdCard()); |
| | | wq.eq(TjReservation::getIsExpire, 2); |
| | | TjReservation one = tjReservationService.getOne(wq); |
| | | if (null != one) { |
| | | yyList.add(one); |
| | | } |
| | | rightList.add(tjReservation); |
| | | } else { |
| | | wrongList.add(tjReservation.getName()); |
| | | } |
| | | } |
| | | // } |
| | | // else { |
| | | // //将科学计数的手机号转换成文本形式 |
| | | // String str = MatchUtils.translateToPlainStr(tjReservation.getPhoe()); |
| | | // tjReservation.setPhoe(str); |
| | | // |
| | | // //年龄 |
| | | // tjReservation.setAge(String.valueOf(MatchUtils.getAgeByIdCard(tjReservation.getIdCard()))); |
| | | // //出生日期 |
| | | // tjReservation.setBirthday(DateUtil.parse(MatchUtils.getBirthDayByIdCard(tjReservation.getIdCard()), "yyyy-MM-dd")); |
| | | // |
| | | // TjDwDept dwDept = dwDeptService.getOne(new LambdaQueryWrapper<TjDwDept>().eq(TjDwDept::getDwDeptName, tjReservation.getDwxm())); |
| | | // if (null != dwDept) { |
| | | // for (TjDwGrouping groupingMan : groupingMans) { |
| | | // if (null != groupingMan && groupingMan.getSex().equals(String.valueOf(tjReservation.getSex())) && groupingMan.getDwDeptId().equals(dwDept.getId())) { |
| | | // tjReservation.setGroupingId(groupingMan.getId()); |
| | | // tjReservation.setGroupingName(groupingMan.getGroupingName()); |
| | | // tjReservation.setYsPrice(groupingMan.getYsPrice()); |
| | | // //合计 |
| | | // hjMoney = hjMoney.add(groupingMan.getYsPrice()); |
| | | // count += 1; |
| | | // //男组人数 |
| | | // manMoney = manMoney.add(groupingMan.getYsPrice()); |
| | | // manCount += 1; |
| | | // } |
| | | // } |
| | | // |
| | | // for (TjDwGrouping groupingWoMan : groupingWoMans) { |
| | | // if (null != groupingWoMan && groupingWoMan.getSex().equals(String.valueOf(tjReservation.getSex())) && groupingWoMan.getDwDeptId().equals(dwDept.getId())) { |
| | | // tjReservation.setGroupingId(groupingWoMan.getId()); |
| | | // tjReservation.setGroupingName(groupingWoMan.getGroupingName()); |
| | | // tjReservation.setYsPrice(groupingWoMan.getYsPrice()); |
| | | // //合计 |
| | | // hjMoney = hjMoney.add(groupingWoMan.getYsPrice()); |
| | | // count += 1; |
| | | // woManMoney = woManMoney.add(groupingWoMan.getYsPrice()); |
| | | // woManCount += 1; |
| | | // } |
| | | // } |
| | | // for (TjDwGrouping groupingWz : groupingWzs) { |
| | | // if (null != groupingWz && groupingWz.getDwDeptId().equals(dwDept.getId())) { |
| | | // tjReservation.setGroupingId(groupingWz.getId()); |
| | | // tjReservation.setGroupingName(groupingWz.getGroupingName()); |
| | | // tjReservation.setYsPrice(groupingWz.getYsPrice()); |
| | | // //合计 |
| | | // hjMoney = hjMoney.add(groupingWz.getYsPrice()); |
| | | // count += 1; |
| | | // if (tjReservation.getSex() == 0) { |
| | | // manMoney = manMoney.add(groupingWz.getYsPrice()); |
| | | // manCount += 1; |
| | | // } |
| | | // if (tjReservation.getSex() == 1) { |
| | | // woManMoney = woManMoney.add(groupingWz.getYsPrice()); |
| | | // woManCount += 1; |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjReservation::getIdCard, tjReservation.getIdCard()); |
| | | // wq.eq(TjReservation::getIsExpire, 2); |
| | | // TjReservation one = tjReservationService.getOne(wq); |
| | | // if (null != one) { |
| | | // yyList.add(one); |
| | | // } |
| | | // rightList.add(tjReservation); |
| | | // } else { |
| | | // wrongList.add(tjReservation.getName()); |
| | | // } |
| | | // } |
| | | |
| | | } else { |
| | | wrongList.add(tjReservation.getName()); |
| | | } |
| | | } |
| | | if (!yyList.isEmpty()) { |
| | | map.put("list", yyList); |
| | | map.put("hjMoney", hjMoney); |
| | | return AjaxResult.error("操作失败,以上人员已经预约无需导入!!!", map); |
| | | } |
| | | |
| | | if (!wrongList.isEmpty()) { |
| | | map.put("list", wrongList); |
| | | map.put("hjMoney", hjMoney); |
| | | return AjaxResult.error("操作失败, 请认真核对信息后重新导入!!!", map); |
| | | } else { |
| | | map.put("list", rightList); |
| | | map.put("count", count); |
| | | map.put("hjMoney", hjMoney); |
| | | map.put("manCount", manCount); |
| | | map.put("manMoney", manMoney); |
| | | map.put("woManCount", woManCount); |
| | | map.put("woManMoney", woManMoney); |
| | | return AjaxResult.success("操作成功", map); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | if (null == tjReservation) return AjaxResult.error(); |
| | | if (null == tjReservation.getName()) return AjaxResult.error("姓名不能为空"); |
| | | if (null == tjReservation.getReservationTime()) return AjaxResult.error("请选择预约时间"); |
| | | boolean b=true; |
| | | if(null !=tjReservation.getIdType()){ |
| | | if(tjReservation.getIdType().equals("1")){ |
| | | b = MatchUtils.isIdCard(tjReservation.getIdCard()); |
| | | }else { |
| | | b = MatchUtils.cardValidate(tjReservation.getIdCard(), tjReservation.getIdType()); |
| | | boolean b = true; |
| | | if (null != tjReservation.getIdType()) { |
| | | if (tjReservation.getIdType().equals("1")) { |
| | | b = MatchUtils.isIdCard(tjReservation.getIdCard()); |
| | | } else { |
| | | b = MatchUtils.cardValidate(tjReservation.getIdCard(), tjReservation.getIdType()); |
| | | } |
| | | }else { |
| | | } else { |
| | | return AjaxResult.error("请选择证件类型"); |
| | | } |
| | | |
| | | if(!b) return AjaxResult.error("证件号有误"); |
| | | if (!b) return AjaxResult.error("证件号有误"); |
| | | LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjReservation::getIdCard, tjReservation.getIdCard()); |
| | | wq.eq(TjReservation::getIsExpire, 2); |
| | |
| | | tjReservation.setIsExpire(2); |
| | | tjReservation.setTjType(String.valueOf(2)); |
| | | if (tjReservationService.save(tjReservation)) { |
| | | delayService.reservation(tjReservation.getId()); |
| | | // delayService.reservation(tjReservation.getId()); |
| | | taskService.addTask(new TjReservationTask(tjReservation.getId(), |
| | | DateUtil.between(new Date(), DateUtil.endOfDay(tjReservation.getReservationTime()), DateUnit.MS))); |
| | | return AjaxResult.success("预约成功!!!"); |
| | | } |
| | | LambdaQueryWrapper<TbTransition> remove=new LambdaQueryWrapper<>(); |
| | | remove.between(TbTransition::getCreateTime,DateUtil.offsetMinute(transitionService.getTbTransitionCreateTimeByCusId(tjReservation.getIdCard()),-1),new Date()); |
| | | remove.eq(TbTransition::getCusId,tjReservation.getIdCard()); |
| | | LambdaQueryWrapper<TbTransition> remove = new LambdaQueryWrapper<>(); |
| | | remove.between(TbTransition::getCreateTime, DateUtil.offsetMinute(transitionService.getTbTransitionCreateTimeByCusId(tjReservation.getIdCard()), -1), new Date()); |
| | | remove.eq(TbTransition::getCusId, tjReservation.getIdCard()); |
| | | transitionService.remove(remove); |
| | | return AjaxResult.error("预约失败"); |
| | | } |
| | |
| | | TjReservation tjReservation = tjReservationService.selectTjReservationById(id); |
| | | if (null != tjReservation) { |
| | | if (null != tjReservation.getPacId()) { |
| | | tjReservation.setPacName(packageService.getById(tjReservation.getPacId()).getPacName()); |
| | | TjPackage aPackage = packageService.getById(tjReservation.getPacId()); |
| | | if (null != aPackage) { |
| | | tjReservation.setPacName(aPackage.getPacName()); |
| | | } |
| | | TjDwDept dwDept = dwDeptService.getById(tjReservation.getPacId()); |
| | | |
| | | if (null != dwDept) { |
| | | tjReservation.setPacName(dwDept.getDwName()); |
| | | } |
| | | |
| | | } |
| | | if (null != tjReservation.getProIds()) { |
| | | List<String> proNames = new ArrayList<>(); |
| | |
| | | if (null != reservation && reservation.getIsExpire() == 2) { |
| | | if (tjReservationService.removeById(id)) { |
| | | transitionService.remove(new LambdaQueryWrapper<TbTransition>().eq(TbTransition::getCusId, reservation.getIdCard())); |
| | | taskService.removeTask(new TjReservationTask(id)); |
| | | return AjaxResult.success("撤销成功"); |
| | | } |
| | | return AjaxResult.error("撤销失败"); |
| | |
| | | TjReservation reservation = tjReservationService.getById(id); |
| | | if (null != reservation && reservation.getIsExpire() == 2) { |
| | | if (tjReservationService.removeById(id)) { |
| | | transitionService.remove(new LambdaQueryWrapper<TbTransition>().eq(TbTransition::getCusId, reservation.getIdCard())); |
| | | transitionService.remove(new LambdaQueryWrapper<TbTransition>().eq(TbTransition::getCusId, reservation.getIdCard()) |
| | | .isNull(TbTransition::getTjNum)); |
| | | taskService.removeTask(new TjReservationTask(id)); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/tjReappoint") |
| | | @ApiOperation(value = "体检预约修改接口") |
| | | @Transactional |
| | | public AjaxResult tjReappoint(@RequestBody TjReservation tjReservation) { |
| | | TjReservation reservation = tjReservationService.getById(tjReservation.getId()); |
| | | |
| | |
| | | tjReservation.setPhoe(reservation.getPhoe()); |
| | | tjReservation.setName(reservation.getName()); |
| | | if (tjReservationService.updateById(tjReservation)) { |
| | | taskService.removeTask(new TjReservationTask(tjReservation.getId())); |
| | | taskService.addTask(new TjReservationTask(tjReservation.getId(), |
| | | DateUtil.between(new Date(), DateUtil.endOfDay(DateUtil.offsetDay(tjReservation.getReservationTime(), reservation.getYxts())), DateUnit.MS))); |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | | return AjaxResult.error("操作失败"); |
| | |
| | | @ApiOperation(value = "根据单位id和团队编号获取预约详情") |
| | | public AjaxResult getSelectRecordByTeamNo(@RequestParam @ApiParam(value = "分组id") String groupingId) { |
| | | LambdaQueryWrapper<TjGroupingPro> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjGroupingPro::getGroupingId,groupingId); |
| | | wq.eq(TjGroupingPro::getGroupingId, groupingId); |
| | | List<TjGroupingPro> proList = groupingProService.list(wq); |
| | | if(null !=proList && proList.size()>0){ |
| | | if (null != proList && proList.size() > 0) { |
| | | for (TjGroupingPro groupingPro : proList) { |
| | | TjProject project = projectService.getById(groupingPro.getProId()); |
| | | if(null !=project){ |
| | | if (project.getProType().equals("") || project.getProType()==null) { |
| | | if (null != project) { |
| | | if (project.getProType() == null || project.getProType().equals("")) { |
| | | groupingPro.setProType("2"); |
| | | }else { |
| | | } else { |
| | | groupingPro.setProType(project.getProType()); |
| | | } |
| | | groupingPro.setProCheckMethod(project.getProCheckMethod()); |
| | |
| | | |
| | | |
| | | @PostMapping("/newReservationConfirm") |
| | | @ApiOperation(value = "团体预约确认接口 (新版本)") |
| | | @ApiOperation(value = "团体预约确认接口") |
| | | @Transactional |
| | | @RepeatSubmit |
| | | public AjaxResult newReservationConfirm(@RequestBody ConfirmDto dto) { |
| | | //预约的所有人 |
| | | List<TjReservation> rightList = dto.getReservations(); |
| | | |
| | | |
| | | |
| | | //预约时间 |
| | | String reservationTime = dto.getReservationTime(); |
| | |
| | | asyncService.saveNewReservationConfirm(rightList); |
| | | |
| | | //团体人数合计价格 |
| | | BigDecimal compPay=new BigDecimal("0.00"); |
| | | BigDecimal compPay = new BigDecimal("0.00"); |
| | | |
| | | //团体人数 |
| | | int tramNum=0; |
| | | int tramNum = 0; |
| | | if (null != rightList && rightList.size() > 0) { |
| | | String teamNo = PinyinUtil.getFirstLetter(dwDept.getDwName(), "") + DateUtil.format(new Date(), "yyMMddHHmmss"); |
| | | for (TjReservation reservation : rightList) { |
| | |
| | | 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")){ |
| | | compPay=compPay.add(dwGrouping.getYsPrice()); |
| | | tramNum+=1; |
| | | reservation.setTjType(String.valueOf(1)); |
| | | reservation.setTeamNo(teamNo); |
| | | }else { |
| | | reservation.setTjType(String.valueOf(2)); |
| | | } |
| | | // if(dwGrouping.getPayType().equals("1")){ |
| | | // compPay=compPay.add(dwGrouping.getYsPrice()); |
| | | // tramNum+=1; |
| | | // reservation.setTjType(String.valueOf(1)); |
| | | // reservation.setTeamNo(teamNo); |
| | | // }else { |
| | | // reservation.setTjType(String.valueOf(2)); |
| | | // } |
| | | compPay = compPay.add(dwGrouping.getYsPrice()); |
| | | tramNum += 1; |
| | | reservation.setTjType(String.valueOf(1)); |
| | | reservation.setTeamNo(teamNo); |
| | | reservation.setYxts(dto.getYxts()); |
| | | tjReservationService.save(reservation); |
| | | delayService.reservation(reservation.getId()); |
| | | taskService.addTask(new TjReservationTask(reservation.getId(), DateUtil.between(new Date(), DateUtil.endOfDay(DateUtil.offsetDay(reservation.getReservationTime(), dto.getYxts())), DateUnit.MS))); |
| | | } |
| | | LambdaQueryWrapper<TjCompPay> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.eq(TjCompPay::getCompId, dwDept.getDwId()); |
| | |
| | | recordServiceOne.setCount(tramNum); |
| | | recordServiceOne.setDifference(compPay); |
| | | selectRecordService.updateById(recordServiceOne); |
| | | }else { |
| | | } else { |
| | | TjTeamSelectRecord selectRecord = new TjTeamSelectRecord(); |
| | | selectRecord.setCompId(dwDept.getDwId()); |
| | | selectRecord.setPacId(dwDept.getId()); |
| | |
| | | return AjaxResult.error("请选择预约对象"); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/newReservationConfirmxbb") |
| | | @ApiOperation(value = "团体预约确认接口 (新版本)") |
| | | @Transactional |
| | | @RepeatSubmit |
| | | public AjaxResult newReservationConfirmxbb(@RequestBody ConfirmDto dto) { |
| | | //预约的所有人 |
| | | List<TjReservation> rightList = dto.getReservations(); |
| | | |
| | | //预约时间 |
| | | String reservationTime = dto.getReservationTime(); |
| | | if (null == reservationTime) { |
| | | return AjaxResult.error("请选择预约时间!"); |
| | | } |
| | | |
| | | Date date = new Date(); |
| | | |
| | | //异步数据 |
| | | // asyncService.addNewReservationConfirm(rightList); |
| | | asyncService.saveNewReservationConfirm(rightList); |
| | | |
| | | //体检单位部门 |
| | | DictComp comp = compService.getById(dto.getDwId()); |
| | | |
| | | String teamNo = PinyinUtil.getFirstLetter(comp.getCnName(), "") + DateUtil.format(date, "yyMMddHHmmss"); |
| | | |
| | | //团体人数合计价格 |
| | | BigDecimal compPay = new BigDecimal("0.00"); |
| | | |
| | | String payTypeGlTjType = configService.selectConfigByKey("reservation_pay_type_gl_tj_type"); |
| | | JSONObject parseObj = JSONUtil.parseObj(payTypeGlTjType); |
| | | if (null != rightList && !rightList.isEmpty()) { |
| | | |
| | | List<String> ids=new ArrayList<>(); |
| | | |
| | | for (TjReservation reservation : rightList) { |
| | | |
| | | if(!ids.isEmpty() && ids.contains(reservation.getIdCard())){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("此身份证号: "+reservation.getIdCard()+" 重复,请核对后上传!"); |
| | | |
| | | } |
| | | reservation.setName(reservation.getName().replaceAll(" ","").replaceAll(" ","")); |
| | | ids.add(reservation.getIdCard()); |
| | | |
| | | TjDwGrouping dwGrouping = dwGroupingService.getById(reservation.getGroupingId()); |
| | | |
| | | TjDwDept dwDept = dwDeptService.getById(dwGrouping.getDwDeptId()); |
| | | |
| | | 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; |
| | | } |
| | | LambdaQueryWrapper<TjGroupingPro> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjGroupingPro::getGroupingId, reservation.getGroupingId()); |
| | | List<String> proIds = groupingProService.list(wq1).stream().map(TjGroupingPro::getProId).collect(Collectors.toList()); |
| | | reservation.setProIds(Joiner.on(",").join(proIds)); |
| | | reservation.setReservationTime(DateUtil.parse(reservationTime, "yyyy-MM-dd")); |
| | | reservation.setCompanyId(dwGrouping.getDwId()); |
| | | reservation.setCompany(dwGrouping.getDwName()); |
| | | reservation.setPayType(Long.valueOf(dwGrouping.getPayType())); |
| | | LambdaQueryWrapper<SysDictData> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(SysDictData::getDictType, "reservation_pay_type"); |
| | | wrapper.eq(SysDictData::getDictValue, reservation.getPayType()); |
| | | SysDictData dictData = dictDataService.getOne(wrapper); |
| | | for (Map.Entry<String, Object> entry : parseObj.entrySet()) { |
| | | String[] split = entry.getValue().toString().split("-"); |
| | | if (split[0].equals(String.valueOf(dictData.getDictCode()))) { |
| | | reservation.setTjType(dictDataService.selectDictDataById(Long.valueOf(split[1])).getDictValue()); |
| | | } |
| | | } |
| | | |
| | | |
| | | reservation.setPacId(dwDept.getId()); |
| | | compPay = compPay.add(dwGrouping.getYsPrice()); |
| | | // reservation.setTjType(String.valueOf(1)); |
| | | reservation.setTeamNo(teamNo); |
| | | reservation.setYxts(dto.getYxts()); |
| | | tjReservationService.save(reservation); |
| | | taskService.addTask(new TjReservationTask(reservation.getId(), |
| | | DateUtil.between(date, DateUtil.endOfDay(DateUtil.offsetDay(reservation.getReservationTime(), dto.getYxts())), DateUnit.MS))); |
| | | } |
| | | |
| | | LambdaQueryWrapper<TjCompPay> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.eq(TjCompPay::getCompId, dto.getDwId()); |
| | | wq0.eq(TjCompPay::getTeamNo, teamNo); |
| | | TjCompPay one = compPayService.getOne(wq0); |
| | | if (null != one) { |
| | | one.setCopeWith(compPay); |
| | | one.setSerialNumber(SecurityUtils.getUsername() + DateUtil.format(date, "yyMMddHHmmssSSS")); |
| | | one.setInvoiceNo("FP" + DateUtil.format(date, "yyMMddHHmmssSSS")); |
| | | one.setPaidIn(new BigDecimal("0.00")); |
| | | compPayService.updateById(one); |
| | | } else { |
| | | TjCompPay tjCompPay = new TjCompPay(); |
| | | tjCompPay.setCompId(dto.getDwId()); |
| | | tjCompPay.setTeamNo(teamNo); |
| | | tjCompPay.setCopeWith(compPay); |
| | | tjCompPay.setSerialNumber(SecurityUtils.getUsername() + DateUtil.format(date, "yyMMddHHmmssSSS")); |
| | | tjCompPay.setInvoiceNo("FP" + DateUtil.format(date, "yyMMddHHmmssSSS")); |
| | | tjCompPay.setPaidIn(new BigDecimal("0.00")); |
| | | tjCompPay.setDifference(tjCompPay.getCopeWith().subtract(BigDecimal.valueOf(0.00))); |
| | | compPayService.save(tjCompPay); |
| | | } |
| | | |
| | | // .filter(a-> null != a.getPacId()) |
| | | |
| | | Map<String, List<TjReservation>> collect = rightList.stream().collect(Collectors.groupingBy(TjReservation::getPacId)); |
| | | |
| | | if (!collect.isEmpty()) { |
| | | for (Map.Entry<String, List<TjReservation>> entry : collect.entrySet()) { |
| | | LambdaQueryWrapper<TjTeamSelectRecord> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjTeamSelectRecord::getTeamNo, teamNo); |
| | | wq.eq(TjTeamSelectRecord::getCompId, dto.getDwId()); |
| | | TjTeamSelectRecord recordServiceOne = selectRecordService.getOne(wq); |
| | | if (null != recordServiceOne) { |
| | | recordServiceOne.setPacId(entry.getKey()); |
| | | recordServiceOne.setCompId(dto.getDwId()); |
| | | recordServiceOne.setTeamNo(teamNo); |
| | | recordServiceOne.setTransactionAmount(new BigDecimal("0.00")); |
| | | recordServiceOne.setCount(entry.getValue().size()); |
| | | recordServiceOne.setDifference(compPay); |
| | | selectRecordService.updateById(recordServiceOne); |
| | | } else { |
| | | TjTeamSelectRecord selectRecord = new TjTeamSelectRecord(); |
| | | selectRecord.setCompId(dto.getDwId()); |
| | | selectRecord.setPacId(entry.getKey()); |
| | | selectRecord.setTeamNo(teamNo); |
| | | selectRecord.setTransactionAmount(new BigDecimal("0.00")); |
| | | selectRecord.setCount(entry.getValue().size()); |
| | | selectRecord.setDifference(compPay); |
| | | selectRecordService.save(selectRecord); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success("预约成功"); |
| | | } |
| | | return AjaxResult.error("请选择预约对象"); |
| | | } |
| | | |
| | | } |