|
|
@@ -9,6 +9,8 @@ import com.template.common.exception.MyCustomException;
|
|
|
import com.template.common.result.ResponseStatusEnum;
|
|
|
import com.template.common.utils.BeanUtil;
|
|
|
import com.template.common.utils.IPageUtil;
|
|
|
+import com.template.component.ParkingFeeSystemComponent;
|
|
|
+import com.template.component.bo.AddVisitorCarBO;
|
|
|
import com.template.mapper.WelcomeVisitorMapper;
|
|
|
import com.template.model.pojo.WelcomeVisitor;
|
|
|
import com.template.model.query.WelcomeVisitorQuery;
|
|
|
@@ -16,15 +18,21 @@ import com.template.model.request.WelcomeVisitorRequest;
|
|
|
import com.template.model.result.PageUtils;
|
|
|
import com.template.model.vo.WelcomeVisitorVO;
|
|
|
import com.template.services.WelcomeVisitorService;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
|
+@RequiredArgsConstructor
|
|
|
public class WelcomeVisitorServiceImpl extends ServiceImpl<WelcomeVisitorMapper, WelcomeVisitor> implements WelcomeVisitorService {
|
|
|
|
|
|
+ private final ParkingFeeSystemComponent parkingFeeSystemComponent;
|
|
|
+
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public void addVisitor(WelcomeVisitorRequest visitorRequest) {
|
|
|
// TODO 获取studyCard
|
|
|
String studyCard = "";
|
|
|
@@ -44,6 +52,9 @@ public class WelcomeVisitorServiceImpl extends ServiceImpl<WelcomeVisitorMapper,
|
|
|
visitor.setStudentCard(studyCard);
|
|
|
|
|
|
save(visitor);
|
|
|
+
|
|
|
+ // 新增车辆信息
|
|
|
+ addVisitorCar(visitor);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -106,6 +117,9 @@ public class WelcomeVisitorServiceImpl extends ServiceImpl<WelcomeVisitorMapper,
|
|
|
BeanUtils.copyProperties(visitorRequest, visitor);
|
|
|
|
|
|
save(visitor);
|
|
|
+
|
|
|
+ // 新增车辆信息
|
|
|
+ addVisitorCar(visitor);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -119,4 +133,22 @@ public class WelcomeVisitorServiceImpl extends ServiceImpl<WelcomeVisitorMapper,
|
|
|
List<WelcomeVisitorVO> welcomeVisitorVOS = BeanUtil.copyListProperties(page.getRecords(), WelcomeVisitorVO::new);
|
|
|
return new PageUtils<>(welcomeVisitorVOS, (int) page.getTotal(), (int) page.getSize(), (int) page.getCurrent());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增车辆信息
|
|
|
+ * @param visitor 访客信息
|
|
|
+ */
|
|
|
+ private void addVisitorCar(WelcomeVisitor visitor) {
|
|
|
+ // 新增车辆信息
|
|
|
+ AddVisitorCarBO addVisitorCarBO = new AddVisitorCarBO();
|
|
|
+ addVisitorCarBO.setCarNumber(visitor.getCarNumber());
|
|
|
+ addVisitorCarBO.setBeginTime(visitor.getStartTime());
|
|
|
+ addVisitorCarBO.setMobile(visitor.getPhone());
|
|
|
+ addVisitorCarBO.setEndTime(visitor.getEndTime());
|
|
|
+ if (StrUtil.equals(visitor.getSchool(), "墨轩湖校区")) {
|
|
|
+ parkingFeeSystemComponent.addVisitorCarOfMxh(addVisitorCarBO);
|
|
|
+ } else {
|
|
|
+ // TODO 黄家湖校区
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|