修改上线提醒功能
This commit is contained in:
parent
c69e8c1b7b
commit
c6eafec0f8
|
@ -674,7 +674,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|||
if (userByPhone == null) {
|
||||
return Result.error("手机号未注册");
|
||||
}
|
||||
}else if("gzg".equals(state) || "fh".equals(state) || "touSu".equals(state) || "send".equals(state) || "end".equals(state)){
|
||||
}else if("gzg".equals(state) || "fh".equals(state) || "touSu".equals(state) || "send".equals(state) || "end".equals(state)|| "qtsx".equals(state)){
|
||||
//不做校验手机号
|
||||
}else{
|
||||
UserEntity userByPhone = queryByPhone(phone);
|
||||
|
@ -814,9 +814,12 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|||
case "fh":
|
||||
req.setTemplateId(commonInfoService.findOne(404).getValue());
|
||||
break;
|
||||
case "touSu":
|
||||
case "qtsx":
|
||||
req.setTemplateId(commonInfoService.findOne(405).getValue());
|
||||
break;
|
||||
case "touSu":
|
||||
req.setTemplateId(commonInfoService.findOne(453).getValue());
|
||||
break;
|
||||
default:
|
||||
req.setTemplateId(commonInfoService.findOne(399).getValue());
|
||||
break;
|
||||
|
@ -902,6 +905,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|||
case "touSu":
|
||||
value = "【" + name.getValue() + "】您好,客户对您进行了投诉,平台对您的信誉分进行了扣除,请规范您的服务!";
|
||||
break;
|
||||
case "qtsx":
|
||||
value = "【" + name.getValue() + "】您好,有客户请您上线!";
|
||||
break;
|
||||
default:
|
||||
value = "【" + name.getValue() + "】验证码: " + code + ",此验证码可用于登录或注册,10分钟内有效,如非您本人操作,可忽略本条消息";
|
||||
break;
|
||||
|
|
|
@ -272,7 +272,187 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
|||
collectArtificer.setArtificerId(artificerId);
|
||||
collectArtificerService.insertCollect(collectArtificer);
|
||||
}
|
||||
return baseMapper.selectArtificerById(userId,artificerId,longitude,latitude);
|
||||
Artificer artificer = baseMapper.selectArtificerById(userId,artificerId,longitude,latitude);
|
||||
|
||||
String value = commonInfoService.findOne(392).getValue();
|
||||
if("30".equals(value)){
|
||||
SimpleDateFormat sdfHour=new SimpleDateFormat("HH");
|
||||
SimpleDateFormat sdfMinute=new SimpleDateFormat("mm");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat md = new SimpleDateFormat("MM-dd");
|
||||
Date dateTime = new Date();
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
String hour = sdfHour.format(dateTime);
|
||||
String minute = sdfMinute.format(dateTime);
|
||||
int minuteInt = Integer.parseInt(minute);
|
||||
int hourInt = Integer.parseInt(hour);
|
||||
StringBuilder stringBuilders=new StringBuilder();
|
||||
if(minuteInt>=30){
|
||||
if(hourInt==23){
|
||||
hourInt=0;
|
||||
minuteInt=30;
|
||||
}else{
|
||||
minuteInt=30;
|
||||
hourInt=hourInt+1;
|
||||
}
|
||||
}else{
|
||||
hourInt=hourInt+1;
|
||||
minuteInt=0;
|
||||
}
|
||||
|
||||
if(hourInt<10){
|
||||
stringBuilders.append("0").append(hourInt);
|
||||
}else{
|
||||
stringBuilders.append(hourInt);
|
||||
}
|
||||
stringBuilders.append(":");
|
||||
if(minuteInt<10){
|
||||
stringBuilders.append("0").append(minuteInt);
|
||||
}else{
|
||||
stringBuilders.append(minuteInt);
|
||||
}
|
||||
|
||||
calendar=Calendar.getInstance();
|
||||
String date = simpleDateFormat.format(dateTime);
|
||||
String oldDate = simpleDateFormat.format(dateTime);
|
||||
hour = sdfHour.format(dateTime);
|
||||
minute = sdfMinute.format(dateTime);
|
||||
minuteInt = Integer.parseInt(minute);
|
||||
hourInt = Integer.parseInt(hour);
|
||||
if(minuteInt>=30){
|
||||
if(hourInt==23){
|
||||
hourInt=0;
|
||||
minuteInt=30;
|
||||
calendar.add(Calendar.DAY_OF_MONTH,1);
|
||||
date = simpleDateFormat.format(calendar.getTime());
|
||||
}else{
|
||||
minuteInt=30;
|
||||
hourInt=hourInt+1;
|
||||
}
|
||||
}else{
|
||||
hourInt=hourInt+1;
|
||||
minuteInt=0;
|
||||
}
|
||||
while (true){
|
||||
StringBuilder stringBuilder=new StringBuilder();
|
||||
if(hourInt<10){
|
||||
stringBuilder.append("0").append(hourInt);
|
||||
}else{
|
||||
stringBuilder.append(hourInt);
|
||||
}
|
||||
stringBuilder.append(":");
|
||||
if(minuteInt<10){
|
||||
stringBuilder.append("0").append(minuteInt);
|
||||
}else{
|
||||
stringBuilder.append(minuteInt);
|
||||
}
|
||||
ArtificerTime artificerTime = artificerTimeService.getOne(new QueryWrapper<ArtificerTime>().eq("artificer_id", artificer.getArtificerId()).eq("artificer_date", date).eq("artificer_time", stringBuilder.toString()));
|
||||
if(artificerTime==null){
|
||||
if(oldDate.equals(date)){
|
||||
artificer.setTime(stringBuilder.toString());
|
||||
}else{
|
||||
artificer.setTime(md.format(calendar.getTime())+" "+stringBuilder.toString());
|
||||
}
|
||||
if(artificer.getStatus()!=null && artificer.getStatus()==2){
|
||||
artificer.setState(3);
|
||||
}else{
|
||||
if(stringBuilder.toString().equals(stringBuilders.toString())){
|
||||
artificer.setState(1);
|
||||
}else{
|
||||
artificer.setState(2);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
if(minuteInt==30){
|
||||
if(hourInt==23){
|
||||
hourInt=0;
|
||||
minuteInt=0;
|
||||
calendar.add(Calendar.DAY_OF_MONTH,1);
|
||||
date = simpleDateFormat.format(calendar.getTime());
|
||||
}else{
|
||||
minuteInt=0;
|
||||
hourInt=hourInt+1;
|
||||
}
|
||||
}else{
|
||||
minuteInt=30;
|
||||
}
|
||||
}
|
||||
//2.服务开始前及结束后预留出行时间
|
||||
//精油往后延30 分钟,中医往后延60 分钟
|
||||
if(artificer.getClassifyId()==95){
|
||||
String time = artificer.getTime();
|
||||
//在精油的基础上加30 分钟就是中医~~
|
||||
DateTime dateTime1 = DateUtil.offsetMinute(DateUtil.parse(time), 30);
|
||||
artificer.setTime(DateUtil.format(dateTime1,"HH:mm"));
|
||||
}
|
||||
}else{
|
||||
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("HH");
|
||||
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat md = new SimpleDateFormat("MM-dd");
|
||||
Date dateTime = new Date();
|
||||
String date = simpleDateFormat.format(dateTime);
|
||||
String oldDate = simpleDateFormat.format(dateTime);
|
||||
String time = sdf.format(dateTime);
|
||||
String times="";
|
||||
if("23".equals(time)){
|
||||
time="00";
|
||||
times=time+":30";
|
||||
}else{
|
||||
time=String.valueOf(Integer.parseInt(time)+1);
|
||||
times=time+":30";
|
||||
}
|
||||
String nowTimes=times;
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
date = simpleDateFormat.format(dateTime);
|
||||
oldDate = simpleDateFormat.format(dateTime);
|
||||
time = sdf.format(dateTime);
|
||||
times="";
|
||||
if("23".equals(time)){
|
||||
time="00";
|
||||
times=time+":30";
|
||||
calendar.add(Calendar.DAY_OF_MONTH,1);
|
||||
date = simpleDateFormat.format(calendar.getTime());
|
||||
}else{
|
||||
time=String.valueOf(Integer.parseInt(time)+1);
|
||||
times=time+":30";
|
||||
}
|
||||
while (true){
|
||||
ArtificerTime artificerTime = artificerTimeService.getOne(new QueryWrapper<ArtificerTime>().eq("artificer_id", artificer.getArtificerId()).eq("artificer_date", date).eq("artificer_time", times));
|
||||
if(artificerTime==null){
|
||||
if(oldDate.equals(date)){
|
||||
times=time+":00";
|
||||
artificer.setTime(times);
|
||||
}else{
|
||||
times=time+":00";
|
||||
artificer.setTime(md.format(calendar.getTime())+" "+times);
|
||||
}
|
||||
if(artificer.getStatus()!=null && artificer.getStatus()==2){
|
||||
artificer.setState(3);
|
||||
}else{
|
||||
if(times.equals(nowTimes)){
|
||||
artificer.setState(1);
|
||||
}else{
|
||||
artificer.setState(2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if("23".equals(time)){
|
||||
time="00";
|
||||
times=time+":30";
|
||||
calendar.add(Calendar.DAY_OF_MONTH,1);
|
||||
date = simpleDateFormat.format(calendar.getTime());
|
||||
}else{
|
||||
time=String.valueOf(Integer.parseInt(time)+1);
|
||||
times=time+":30";
|
||||
}
|
||||
}
|
||||
}
|
||||
return artificer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.sqx.modules.message.entity.MessageInfo;
|
|||
import com.sqx.modules.message.service.MessageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -116,9 +117,10 @@ public class AppMessageController {
|
|||
@Login
|
||||
@PostMapping("/insertUpMessage")
|
||||
@ApiOperation("通知技师上线")
|
||||
public Result insertUpMessage(@RequestBody MessageInfo messageInfo){
|
||||
public Result insertUpMessage(MessageInfo messageInfo){
|
||||
UserEntity userEntity = userService.queryByUserId(Long.valueOf(messageInfo.getByUserId()));
|
||||
Artificer artificer = artificerService.getById(Long.valueOf(messageInfo.getUserId()));
|
||||
UserEntity artificerUser = userService.queryByUserId(artificer.getUserId());
|
||||
String content = userEntity.getUserName()+"邀请您上线!";
|
||||
messageInfo.setContent(content);
|
||||
messageInfo.setIsSee("0");
|
||||
|
@ -127,6 +129,13 @@ public class AppMessageController {
|
|||
messageInfo.setByUserName(userEntity.getUserName());
|
||||
messageInfo.setUserName(artificer.getArtificerName());
|
||||
messageService.saveBody(messageInfo);
|
||||
|
||||
|
||||
if (StringUtils.isNotEmpty(artificerUser.getPhone())) {
|
||||
userService.sendMsg(userEntity.getPhone(), "qtsx");
|
||||
}
|
||||
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
|||
/**
|
||||
* 计算技师在线时长,每10分钟计算一积分
|
||||
*/
|
||||
// @Scheduled(cron = "0 * * * * ?")
|
||||
@Scheduled(cron = "0 * * * * ?")
|
||||
public void upJishiZxsc() throws ParseException {
|
||||
System.out.println("----------------计算技师在线时长,每10分钟计算一积分-------------");
|
||||
CommonInfo commonInfo = commonInfoDao.findOne(100000);
|
||||
|
@ -270,7 +270,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
|||
System.out.println("----------------每日积分汇总 定时任务-------------");
|
||||
//当前时间减一天
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String date = sdf.format(calendar.getTime());
|
||||
|
|
Loading…
Reference in New Issue