|
@@ -0,0 +1,221 @@
|
|
|
+package com.iotechn.unimall.app.api.pinche.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
+import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
+import com.iotechn.unimall.app.api.pinche.IPincheMakeAppointmentAppService;
|
|
|
+import com.iotechn.unimall.core.exception.ServiceException;
|
|
|
+import com.iotechn.unimall.data.domain.PincheMakeAppointment;
|
|
|
+import com.iotechn.unimall.data.mapper.PincheMakeAppointmentMapper;
|
|
|
+import com.iotechn.unimall.data.model.Page;
|
|
|
+import com.iotechn.unimall.data.util.ExcelUtil;
|
|
|
+import org.apache.ibatis.session.RowBounds;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 预约信息Service业务层处理
|
|
|
+ *
|
|
|
+ * @author jlb
|
|
|
+ * @date 2022-11-30
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class PincheMakeAppointmentAppServiceImpl implements IPincheMakeAppointmentAppService {
|
|
|
+ @Autowired
|
|
|
+ private PincheMakeAppointmentMapper pincheMakeAppointmentMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean add(PincheMakeAppointment pincheMakeAppointment, Long adminId) throws ServiceException {
|
|
|
+ Date now = new Date();
|
|
|
+ pincheMakeAppointment.setGmtCreate(now);
|
|
|
+ pincheMakeAppointment.setGmtUpdate(now);
|
|
|
+ pincheMakeAppointment.setAdminId(adminId);
|
|
|
+ return pincheMakeAppointmentMapper.insert(pincheMakeAppointment) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<PincheMakeAppointment> list(Long companyId, String appointedBy, String carpoolingType, String route, String phone, String startPlace, String endPlace, String departureLatitude, String latitudeArrival, Date departureTime, String numberPeople, String explain, Double unitPrice, Double price, String status, String remark1, String remark2, String remark3, Long deleteFlag, Date gmtCreate, Date gmtUpdate, Long userId, Long adminId, Integer page, Integer limit) throws ServiceException {
|
|
|
+ Wrapper<PincheMakeAppointment> wrapper = new EntityWrapper<PincheMakeAppointment>();
|
|
|
+ if (!StringUtils.isEmpty(companyId)) {
|
|
|
+ wrapper.eq("company_id", companyId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(appointedBy)) {
|
|
|
+ wrapper.eq("appointed_by", appointedBy);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(carpoolingType)) {
|
|
|
+ wrapper.eq("carpooling_type", carpoolingType);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(route)) {
|
|
|
+ wrapper.eq("route", route);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(phone)) {
|
|
|
+ wrapper.eq("phone", phone);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(startPlace)) {
|
|
|
+ wrapper.eq("start_place", startPlace);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(endPlace)) {
|
|
|
+ wrapper.eq("end_place", endPlace);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(departureLatitude)) {
|
|
|
+ wrapper.eq("departure_latitude", departureLatitude);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(latitudeArrival)) {
|
|
|
+ wrapper.eq("latitude_arrival", latitudeArrival);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(departureTime)) {
|
|
|
+ wrapper.eq("departure_time", departureTime);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(numberPeople)) {
|
|
|
+ wrapper.eq("number_people", numberPeople);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(explain)) {
|
|
|
+ wrapper.eq("explain", explain);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(unitPrice)) {
|
|
|
+ wrapper.eq("unit_price", unitPrice);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(price)) {
|
|
|
+ wrapper.eq("price", price);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(status)) {
|
|
|
+ wrapper.eq("status", status);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(remark1)) {
|
|
|
+ wrapper.eq("remark1", remark1);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(remark2)) {
|
|
|
+ wrapper.eq("remark2", remark2);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(remark3)) {
|
|
|
+ wrapper.eq("remark3", remark3);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(deleteFlag)) {
|
|
|
+ wrapper.eq("delete_flag", deleteFlag);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(gmtCreate)) {
|
|
|
+ wrapper.eq("gmt_create", gmtCreate);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(gmtUpdate)) {
|
|
|
+ wrapper.eq("gmt_update", gmtUpdate);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(userId)) {
|
|
|
+ wrapper.eq("user_id", userId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(adminId)) {
|
|
|
+ wrapper.eq("admin_id", adminId);
|
|
|
+ }
|
|
|
+ wrapper.eq("delete_flag", 0);
|
|
|
+ List<PincheMakeAppointment> list = pincheMakeAppointmentMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
|
+ Integer count = pincheMakeAppointmentMapper.selectCount(wrapper);
|
|
|
+ return new Page<PincheMakeAppointment>(list, page, limit, count);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean delete(String id) {
|
|
|
+ String[] ids = String.valueOf(id).split(",");
|
|
|
+ for (String tt : ids) {
|
|
|
+ PincheMakeAppointment tmp = pincheMakeAppointmentMapper.selectById(Long.parseLong(tt));
|
|
|
+ if (tmp != null) {
|
|
|
+ tmp.setDeleteFlag(1l);
|
|
|
+ pincheMakeAppointmentMapper.updateById(tmp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean update(PincheMakeAppointment pincheMakeAppointment, Long adminId) throws ServiceException {
|
|
|
+ Date now = new Date();
|
|
|
+ pincheMakeAppointment.setGmtUpdate(now);
|
|
|
+ pincheMakeAppointment.setAdminId(adminId);
|
|
|
+ return pincheMakeAppointmentMapper.updateById(pincheMakeAppointment) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PincheMakeAppointment get(Long id) throws ServiceException {
|
|
|
+ return pincheMakeAppointmentMapper.selectById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String export(Long companyId, String appointedBy, String carpoolingType, String route, String phone, String startPlace, String endPlace, String departureLatitude, String latitudeArrival, Date departureTime, String numberPeople, String explain, Double unitPrice, Double price, String status, String remark1, String remark2, String remark3, Long deleteFlag, Date gmtCreate, Date gmtUpdate, Long userId, Long adminId, Integer page, Integer limit) throws ServiceException {
|
|
|
+ Wrapper<PincheMakeAppointment> wrapper = new EntityWrapper<PincheMakeAppointment>();
|
|
|
+ if (!StringUtils.isEmpty(companyId)) {
|
|
|
+ wrapper.eq("company_id", companyId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(appointedBy)) {
|
|
|
+ wrapper.eq("appointed_by", appointedBy);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(carpoolingType)) {
|
|
|
+ wrapper.eq("carpooling_type", carpoolingType);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(route)) {
|
|
|
+ wrapper.eq("route", route);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(phone)) {
|
|
|
+ wrapper.eq("phone", phone);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(startPlace)) {
|
|
|
+ wrapper.eq("start_place", startPlace);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(endPlace)) {
|
|
|
+ wrapper.eq("end_place", endPlace);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(departureLatitude)) {
|
|
|
+ wrapper.eq("departure_latitude", departureLatitude);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(latitudeArrival)) {
|
|
|
+ wrapper.eq("latitude_arrival", latitudeArrival);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(departureTime)) {
|
|
|
+ wrapper.eq("departure_time", departureTime);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(numberPeople)) {
|
|
|
+ wrapper.eq("number_people", numberPeople);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(explain)) {
|
|
|
+ wrapper.eq("explain", explain);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(unitPrice)) {
|
|
|
+ wrapper.eq("unit_price", unitPrice);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(price)) {
|
|
|
+ wrapper.eq("price", price);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(status)) {
|
|
|
+ wrapper.eq("status", status);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(remark1)) {
|
|
|
+ wrapper.eq("remark1", remark1);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(remark2)) {
|
|
|
+ wrapper.eq("remark2", remark2);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(remark3)) {
|
|
|
+ wrapper.eq("remark3", remark3);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(deleteFlag)) {
|
|
|
+ wrapper.eq("delete_flag", deleteFlag);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(gmtCreate)) {
|
|
|
+ wrapper.eq("gmt_create", gmtCreate);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(gmtUpdate)) {
|
|
|
+ wrapper.eq("gmt_update", gmtUpdate);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(userId)) {
|
|
|
+ wrapper.eq("user_id", userId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(adminId)) {
|
|
|
+ wrapper.eq("admin_id", adminId);
|
|
|
+ }
|
|
|
+ List<PincheMakeAppointment> list = pincheMakeAppointmentMapper.selectList(wrapper);
|
|
|
+ ExcelUtil<PincheMakeAppointment> util = new ExcelUtil<PincheMakeAppointment>(PincheMakeAppointment.class);
|
|
|
+ return util.exportExcel(list, "操作日志");
|
|
|
+ }
|
|
|
+}
|