| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ltkj.common.core.controller.BaseController; |
| | | import com.ltkj.common.core.domain.AjaxResult; |
| | |
| | | |
| | | @PostMapping("/newReservationConfirm") |
| | | @ApiOperation(value = "团体预约确认接口 (新版本)") |
| | | @Transactional |
| | | public AjaxResult newReservationConfirm(@RequestBody ConfirmDto dto) { |
| | | //预约的所有人 |
| | | List<TjReservation> rightList = dto.getReservations(); |
| | |
| | | TjDwDept dwDept = dwDeptService.getById(dto.getDwDeptId()); |
| | | |
| | | //异步数据 |
| | | asyncService.addNewReservationConfirm(rightList); |
| | | // asyncService.addNewReservationConfirm(rightList); |
| | | asyncService.saveNewReservationConfirm(rightList); |
| | | |
| | | //团体人数合计价格 |
| | | BigDecimal compPay=new BigDecimal("0.00"); |
| | |
| | | "WHERE\n" + |
| | | "\ta.pro_id = #{proId} ") |
| | | void saveRedisTransitionByProId(@Param("cusId")String cusId,@Param("proId") Long proId); |
| | | |
| | | |
| | | @Insert("INSERT INTO tb_transition(\n" + |
| | | " cus_id,\n" + |
| | | " pro_id,\n" + |
| | | " pro_name,\n" + |
| | | " parent_pro_id,\n" + |
| | | " parent_pro_name,\n" + |
| | | " ord_price,\n" + |
| | | " now_price,\n" + |
| | | " create_time,\n" + |
| | | " pro_check_method,\n" + |
| | | " pro_type\n" + |
| | | ")\n" + |
| | | "SELECT\n" + |
| | | "#{cusId},\n" + |
| | | "c.pro_id,\n" + |
| | | "c.pro_name,\n" + |
| | | "b.pro_id,\n" + |
| | | "b.pro_name,\n" + |
| | | "c.pro_price * (a.limits/10),\n" + |
| | | "c.pro_price * (a.limits/10),\n" + |
| | | "SYSDATE(),\n" + |
| | | "c.pro_check_method,\n" + |
| | | "c.pro_type\n" + |
| | | "FROM\n" + |
| | | "\ttj_grouping_pro a\n" + |
| | | "\tLEFT JOIN tj_project b ON a.pro_id = b.pro_id \n" + |
| | | "\tLEFT JOIN tj_project c ON c.pro_parent_id=b.pro_id\n" + |
| | | "WHERE 1=1 AND a.grouping_id =#{groupingId} ") |
| | | boolean saveTemoTransitionByGroupingId(@Param("cusId")String cusId,@Param("groupingId")String groupingId); |
| | | } |
| | |
| | | void saveRedisTransitionByPacId(String cusId, Long pacId); |
| | | |
| | | void saveRedisTransitionByProId(String cusId, Long proId); |
| | | |
| | | boolean saveTemoTransitionByGroupingId(String cusId,String groupingId); |
| | | } |
| | |
| | | //按照性别查询体检套餐列表 |
| | | void getTjPackageList(); |
| | | |
| | | |
| | | //团体预约时向临时表添加数据 |
| | | void addNewReservationConfirm(List<TjReservation> rightList); |
| | | void saveNewReservationConfirm(List<TjReservation> rightList); |
| | | } |
| | |
| | | public void saveRedisTransitionByProId(String cusId, Long proId) { |
| | | tbTransitionMapper.saveRedisTransitionByProId(cusId,proId); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveTemoTransitionByGroupingId(String cusId,String groupingId) { |
| | | return tbTransitionMapper.saveTemoTransitionByGroupingId(cusId,groupingId); |
| | | } |
| | | } |
| | |
| | | import java.math.RoundingMode; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.*; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Async("async") |
| | | public void saveNewReservationConfirm(List<TjReservation> rightList) { |
| | | long l = System.currentTimeMillis(); |
| | | if(null !=rightList && rightList.size()>0){ |
| | | //创建线程池 |
| | | ExecutorService threadPool = Executors.newFixedThreadPool(rightList.size()); |
| | | for (TjReservation reservation : rightList) { |
| | | //删除之前的数据 |
| | | transitionService.deletedTbTransitionByCusId(reservation.getIdCard()); |
| | | //获取线程 |
| | | threadPool.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | transitionService.saveTemoTransitionByGroupingId(reservation.getIdCard(),reservation.getGroupingId()); |
| | | |
| | | threadPool.shutdown(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | long ll = System.currentTimeMillis(); |
| | | |
| | | System.out.println("这段代码执行时间为"+ (ll-l)); |
| | | } |
| | | |
| | | private void getTjPackageListsByMan(List<TjPackage> tjPackageList) { |
| | | if (null != tjPackageList && tjPackageList.size() > 0) { |
| | | for (TjPackage aPackage : tjPackageList) { |