Commit d1a5b19e by 吕明尚

修改小程序设备管理的操作间隙,取消保洁的短信发送,修改用户的操作响应时间

parent fb268abd
......@@ -2,28 +2,20 @@ package share.web.controller.system;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType;
import share.common.enums.OpTypeEnum;
import share.common.enums.PositionEnum;
import share.common.enums.RoleTypeEnum;
import share.common.utils.SecurityUtils;
import share.common.utils.poi.ExcelUtil;
import share.system.domain.Device;
import share.system.domain.SConsumer;
import share.system.domain.vo.DeviceParamVo;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.MqttxVo;
import share.system.mapper.SStoreConsumerMapper;
import share.system.mqtt.MqttGatewayComponent;
import share.system.service.*;
import share.system.service.DeviceOpService;
import share.system.service.SConsumerService;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -57,7 +49,7 @@ public class DeviceController extends BaseController {
if (CollectionUtils.isEmpty(longs)) {
throw new RuntimeException("当前用户不是管理员");
}
deviceOpService.openOrCloseDevice(deviceParam.getRoomId(), user.getPhone(), deviceParam.getOpType(), true, FIVE);
deviceOpService.openOrCloseDevice(deviceParam.getRoomId(), user.getPhone(), deviceParam.getOpType(), false, FIVE);
return toAjax(true);
}
......
package share.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import share.common.annotation.Log;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.domain.R;
import share.common.enums.BusinessType;
import share.system.domain.SConsumer;
import share.system.domain.vo.SConsumerVo;
import share.system.service.SConsumerService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
/**
* 会员用户Controller
......@@ -55,4 +48,24 @@ public class SConsumerController extends BaseController
return R.fail();
}
//解绑车牌号
@ApiOperation(value = "解绑车牌号")
@RequestMapping(value = "/unbind", method = RequestMethod.POST)
public R<Object> unbind(@RequestBody SConsumer request) {
if (sConsumerService.unbind(request)) {
return R.ok();
}
return R.fail();
}
//绑定车牌号
@ApiOperation(value = "绑定车牌号")
@RequestMapping(value = "/bind", method = RequestMethod.POST)
public R<Object> bind(@RequestBody SConsumer request) {
if (sConsumerService.bind(request)) {
return R.ok();
}
return R.fail();
}
}
......@@ -242,10 +242,10 @@ public class RedisTask {
//推送订单结束消息
wechatNewService.sendMiniSubscribeMessage(sOrder, MessageReminderEnum.END);
//通知保洁人员
sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生
smsService.sendSmsCleanRecordsRemind15(item.getPhone(), sStore, sRoom);
});
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// // 循环发送短信提示门店保洁打扫卫生
// smsService.sendSmsCleanRecordsRemind15(item.getPhone(), sStore, sRoom);
// });
return;
}
//判断时间是否在5分钟到4分钟
......
package share.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SConsumer;
import share.system.domain.vo.SConsumerVo;
import java.util.List;
/**
* 会员用户Mapper接口
*
......@@ -67,4 +67,6 @@ public interface SConsumerMapper extends BaseMapper<SConsumer>
List<SConsumer> selectUnallocatedList(SConsumerVo sConsumer);
List<SConsumer> selectListByStoreId(Long storeId);
boolean unbind(SConsumer request);
}
package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SConsumer;
import share.system.domain.vo.SConsumerVo;
import share.system.request.RegisterThirdSConsumerRequest;
import java.util.List;
/**
* 会员用户Service接口
*
......@@ -124,4 +124,8 @@ public interface SConsumerService extends IService<SConsumer>
int deleteCleanConsumerByIds(Long[] ids);
public List<SConsumer> selectListByStoreId(Long storeId);
boolean unbind(SConsumer request);
boolean bind(SConsumer request);
}
......@@ -152,11 +152,11 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
sCleanRecords.setStatus(0);
sCleanRecords.setCreateTime(DateUtils.getNowDate());
boolean b = 0 < baseMapper.insertSCleanRecords(sCleanRecords);
if (b) {
SStore store = sStoreMapper.selectSStoreById(storeId);
SRoom room = sRoomMapper.selectSRoomById(roomId);
sendSms(storeId, store, room);
}
// if (b) {
// SStore store = sStoreMapper.selectSStoreById(storeId);
// SRoom room = sRoomMapper.selectSRoomById(roomId);
// sendSms(storeId, store, room);
// }
return b;
}
......@@ -366,7 +366,7 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
if (consumer.getId().equals(item.getConsumerId())) {
room.setIsDirtyRoom(YesNoEnum.yes.getIndex());
dirtyRoomList.add(room);
smsService.sendSmsCleanRecords(consumer.getPhone(), store, room);
// smsService.sendSmsCleanRecords(consumer.getPhone(), store, room);
}
});
}
......@@ -492,10 +492,10 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
}
private void sendSms(Long storeId,SStore store, SRoom room) {
sConsumerMapper.selectListByStoreId(storeId).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生
smsService.sendSmsCleanRecords(item.getPhone(), store, room);
});
// sConsumerMapper.selectListByStoreId(storeId).stream().forEach(item -> {
// // 循环发送短信提示门店保洁打扫卫生
// smsService.sendSmsCleanRecords(item.getPhone(), store, room);
// });
}
}
package share.system.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
......@@ -16,16 +11,17 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import share.common.constant.Constants;
import share.common.constant.SmsConstants;
import share.common.enums.ConsumerCouponUseStatusEnum;
import share.common.enums.PayStatusEnum;
import share.common.enums.PositionEnum;
import share.common.enums.RoleTypeEnum;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
import share.common.utils.DateUtil;
import share.system.domain.*;
import share.system.domain.SConsumer;
import share.system.domain.SConsumerCoupon;
import share.system.domain.SConsumerToken;
import share.system.domain.SStoreConsumer;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SConsumerVo;
import share.system.mapper.SConsumerMapper;
......@@ -35,6 +31,8 @@ import share.system.service.ISConsumerCouponService;
import share.system.service.SConsumerService;
import share.system.service.SConsumerTokenService;
import java.util.List;
/**
* 会员用户Service业务层处理
*
......@@ -260,6 +258,20 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
return baseMapper.selectListByStoreId(storeId);
}
@Override
public boolean unbind(SConsumer request) {
return baseMapper.unbind(request);
}
@Override
public boolean bind(SConsumer request) {
Boolean flag = updateById(request);
if (flag) {
tokenComponet.refreshSConsumerByToken(request);
}
return flag;
}
@Override
public int addCleanConsumer(SConsumer sConsumer) {
......
......@@ -605,10 +605,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1");
SRoom sRoom = roomService.getById(sOrder.getRoomId());
//通知保洁人员
sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生
smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), stores.stream().filter(store -> store.getId().equals(request.getStoreId())).findFirst().get(), sRoom);
});
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// // 循环发送短信提示门店保洁打扫卫生
// smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), stores.stream().filter(store -> store.getId().equals(request.getStoreId())).findFirst().get(), sRoom);
// });
}
}
Map<String, String> map = new HashMap<>();
......@@ -1036,12 +1036,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.actionExecute(sOrder.getRoomId(), sOrder.getConsumerPhone(), VoiceEnum.RENEWAL_SUCCESS.getCode(),
cn.hutool.core.date.DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1");
SRoom sRoom = roomService.getById(sOrder.getRoomId());
// SRoom sRoom = roomService.getById(sOrder.getRoomId());
//通知保洁人员
sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生
smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), sStore, sRoom);
});
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// // 循环发送短信提示门店保洁打扫卫生
// smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), sStore, sRoom);
// });
}
sConsumptionRecordsService.insertSConsumptionRecords(sOrder);
}
......@@ -1301,7 +1301,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.asyncActionExecute(sOrder.getRoomId(), sOrder.getConsumerPhone(), VoiceEnum.OPEN.getCode(),
cn.hutool.core.date.DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1),
DatePattern.NORM_DATETIME_PATTERN), "1", 10L);
DatePattern.NORM_DATETIME_PATTERN), "1", 30L);
} else {
deviceOpService.openDoor(sRoomVo.getId(), sOrder.getConsumerPhone());
if (ObjectUtil.isEmpty(sOrder.getArrivalTime())) {
......@@ -1309,7 +1309,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
deviceOpService.asyncActionExecute(sOrder.getRoomId(), sOrder.getConsumerPhone(), VoiceEnum.OPEN.getCode(),
cn.hutool.core.date.DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1),
DatePattern.NORM_DATETIME_PATTERN), "1", 10L);
DatePattern.NORM_DATETIME_PATTERN), "1", 30L);
sOrder.setArrivalTime(new Date());
baseMapper.updateById(sOrder);
}
......
......@@ -186,6 +186,11 @@
</trim>
where id = #{id}
</update>
<update id="unbind">
update s_consumer
set numberplate = null
where id = #{id}
</update>
<delete id="deleteSConsumerById" parameterType="Long">
delete from s_consumer where id = #{id}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment