From c92f77ac03a1bbe3009891ce1d1f57f2d1091572 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期二, 24 八月 2021 15:00:25 +0800 Subject: [PATCH] 提交预约登记小程序相关代码 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveRecordServiceImpl.java | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveRecordServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveRecordServiceImpl.java index 4fc2491..c05fcb8 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveRecordServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveRecordServiceImpl.java @@ -1,11 +1,19 @@ package com.panzhihua.service_community.service.impl; +import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.panzhihua.common.model.dtos.community.CancelRecordDTO; +import com.panzhihua.common.model.vos.R; +import com.panzhihua.service_community.dao.ComActReserveOperationRecordMapper; import com.panzhihua.service_community.dao.ComActReserveRecordMapper; +import com.panzhihua.service_community.model.dos.ComActReserveOperationRecordDO; import com.panzhihua.service_community.model.dos.ComActReserveRecordDO; import com.panzhihua.service_community.service.ComActReserveRecordService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; /** * @auther lyq @@ -15,5 +23,38 @@ @Slf4j @Service public class ComActReserveRecordServiceImpl extends ServiceImpl<ComActReserveRecordMapper, ComActReserveRecordDO> implements ComActReserveRecordService { + @Resource + private ComActReserveRecordMapper comActReserveRecordMapper; + @Resource + private ComActReserveOperationRecordMapper comActReserveOperationRecordMapper; + private final static String CANCEL="用户取消"; + @Override + @Transactional + public R cancel(CancelRecordDTO comActReserveRecord) { + if(comActReserveRecord!=null&&comActReserveRecord.getId()!=null){ + ComActReserveRecordDO comActReserveRecordDO=comActReserveRecordMapper.selectById(comActReserveRecord.getId()); + if(comActReserveRecordDO!=null&&comActReserveRecordDO.getStatus()!=ComActReserveRecordDO.status.yqx){ + comActReserveRecordDO.setStatus(ComActReserveRecordDO.status.yqx); + comActReserveRecordDO.setContent(comActReserveRecord.getContent()); + int result =comActReserveRecordMapper.updateById(comActReserveRecordDO); + if(result>0){ + ComActReserveOperationRecordDO comActReserveOperationRecordDO=new ComActReserveOperationRecordDO(); + comActReserveOperationRecordDO.setReserveId(comActReserveRecordDO.getReserveId()); + comActReserveOperationRecordDO.setReserveRecordId(comActReserveRecordDO.getId()); + comActReserveOperationRecordDO.setType(ComActReserveOperationRecordDO.type.br); + comActReserveOperationRecordDO.setReserveTime(DateUtil.date()); + comActReserveOperationRecordDO.setReserveContent(CANCEL); + comActReserveOperationRecordDO.setPhone(comActReserveRecordDO.getPhone()); + comActReserveOperationRecordDO.setStatus(ComActReserveOperationRecordDO.status.qx); + comActReserveOperationRecordDO.setUserId(comActReserveRecordDO.getUserId()); + comActReserveOperationRecordMapper.insert(comActReserveOperationRecordDO); + return R.ok(); + } + } + return R.fail("无法重复取消"); + } + + return R.fail("参数异常"); + } } -- Gitblit v1.7.1