| | |
| | | //最大人数 |
| | | int maxPeople = MapUtils.getIntValue(map, "maxPeople"); |
| | | //预约时间 |
| | | String appointmments = JSONArray.toJSONString(map.get("appointments")); |
| | | List<AppointmentTime> appointmments = JSONArray.parseArray(JSONArray.toJSONString(map.get("appointments")), AppointmentTime.class); |
| | | |
| | | AdvisoryDoctorInfo advisoryDoctorInfo = baseMapper.selectById(Long.parseLong(id)); |
| | | if (advisoryDoctorInfo == null) { |
| | | return ResultBody.failed().msg("查询医生信息失败"); |
| | | } |
| | | |
| | | AdvisoryDoctorInfo adi = new AdvisoryDoctorInfo(); |
| | | adi.setId(Long.parseLong(id)); |
| | | adi.setPrice(price); |
| | | adi.setMaxPeople(maxPeople); |
| | | advisoryDoctorInfo.setPrice(price); |
| | | advisoryDoctorInfo.setMaxPeople(maxPeople); |
| | | |
| | | int b = baseMapper.updateById(adi); |
| | | int b = baseMapper.updateById(advisoryDoctorInfo); |
| | | if (b == 0) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return ResultBody.failed().msg("操作失败"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(appointmments)) { |
| | | if (appointmments != null && appointmments.size() > 0) { |
| | | appointmentTimeService.delByAdvisoryId(Long.parseLong(id)); |
| | | List<AppointmentTime> times = JSONArray.parseArray(appointmments, AppointmentTime.class); |
| | | for (AppointmentTime time : times) { |
| | | for (AppointmentTime time : appointmments) { |
| | | time.setAdvisoryId(Long.parseLong(id)); |
| | | appointmentTimeService.saveOrUpdate(time); |
| | | } |
| | | |
| | | } |
| | | |
| | | return ResultBody.ok().msg("操作成功"); |