wrj hai 9 meses
pai
achega
56f7b32e1d

+ 9 - 0
nightFragrance-admin/src/main/java/com/ylx/web/controller/massage/TCommentController.java

@@ -3,9 +3,11 @@ package com.ylx.web.controller.massage;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ylx.common.annotation.Log;
 import com.ylx.common.core.controller.BaseController;
 import com.ylx.common.core.domain.R;
 import com.ylx.common.core.domain.model.WxLoginUser;
+import com.ylx.common.enums.BusinessType;
 import com.ylx.common.utils.StringUtils;
 
 import com.ylx.massage.domain.TComment;
@@ -67,4 +69,11 @@ public class TCommentController extends BaseController {
                 orderByDesc(TComment::getdTime);
         return commentService.page(page, objectLambdaQueryWrapper);
     }
+
+    @PostMapping("delete")
+    @ApiOperation("删除数据")
+    @Log(title = "评论删除数据", businessType = BusinessType.DELETE)
+    public R delete(@RequestBody List<Long> idList) {
+        return R.ok(this.commentService.removeByIds(idList));
+    }
 }

+ 11 - 1
nightFragrance-massage/src/main/java/com/ylx/massage/domain/TSign.java

@@ -25,7 +25,7 @@ public class TSign extends Model<TSign> {
     private String id;
     //上岗状态 -1下岗  0上岗
     @ApiModelProperty("上岗状态 -1下岗  0上岗")
-    private Integer dutyStatus;
+    private Date layoffTime;
     //技师id
     @ApiModelProperty("技师id")
     private String jsId;
@@ -38,6 +38,16 @@ public class TSign extends Model<TSign> {
     //技师姓名
     @ApiModelProperty("技师姓名")
     private String name;
+
+    @ApiModelProperty("在线时长(分)")
+    private Integer onlineTime;
+
+    @ApiModelProperty("部门id")
+    private String deptId;
+
+    @ApiModelProperty("部门名称")
+    private String deptName;
+
     //系统创建时间
     @ApiModelProperty("系统创建时间")
     private Date createTime;

+ 38 - 15
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TJsServiceImpl.java

@@ -140,15 +140,16 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
 
         return update;
     }
+
     @Override
     public void jsNotification(TJs js) {
 
         cn.hutool.json.JSONObject param = JSONUtil.createObj();
         //是否审核通过
 
-        if(JsStatusEnum.JS_PASS.getCode().equals(js.getnTong())){
+        if (JsStatusEnum.JS_PASS.getCode().equals(js.getnTong())) {
             param.set("const1", JSONUtil.createObj().set("value", "审核通过可以接单"));
-        }else{
+        } else {
             param.set("const1", JSONUtil.createObj().set("value", "审核驳回请重新提交"));
         }
 
@@ -173,7 +174,7 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
 //        JSONObject jsonObject = new JSONObject(js.getcAddress());
 //        Object latitude = jsonObject.get("latitude");
 //        Object longitude = jsonObject.get("longitude");
-        locationUtil.geoAdd(LocationUtil.GEO_KEY,js.getcOpenId(), Double.parseDouble(js.getLongitude().toString()), Double.parseDouble(js.getLatitude().toString()));
+        locationUtil.geoAdd(LocationUtil.GEO_KEY, js.getcOpenId(), Double.parseDouble(js.getLongitude().toString()), Double.parseDouble(js.getLatitude().toString()));
         LambdaQueryWrapper<TJs> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
         objectLambdaQueryWrapper.eq(TJs::getcOpenId, js.getcOpenId());
         return this.update(js, objectLambdaQueryWrapper);
@@ -193,13 +194,14 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
         //订单号
         param.set("character_string9", JSONUtil.createObj().set("value", "23010000010101"));
         //点话
-        param.set("phone_number14",JSONUtil.createObj().set("value", "18360233903"));
-        param.set("thing18",JSONUtil.createObj().set("value", "李四"));
-        param.set("time6",JSONUtil.createObj().set("value", "2022年11月11日 22:22"));
-        param.set("thing27",JSONUtil.createObj().set("value", "湖南长沙岳麓"));
+        param.set("phone_number14", JSONUtil.createObj().set("value", "18360233903"));
+        param.set("thing18", JSONUtil.createObj().set("value", "李四"));
+        param.set("time6", JSONUtil.createObj().set("value", "2022年11月11日 22:22"));
+        param.set("thing27", JSONUtil.createObj().set("value", "湖南长沙岳麓"));
 //        weChatUtil.notification(openId, param);
 
     }
+
     @Override
     public boolean upPost(TJs js) {
 
@@ -217,7 +219,6 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
             //岗位状态为1时,设置nStatus为1
             js.setnStatus(JsStatusEnum.JS_SERVICEABLE.getCode());
             //记录签到信息
-            tSign.setDutyStatus(JsStatusEnum.POST_ON_DUTY.getCode());
             tSign.setSingTime(new Date());
             tSign.setOpenId(js2.getcOpenId());
             tSign.setJsId(js2.getId());
@@ -232,17 +233,38 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
                 throw new ServiceException("您有服务中的订单,不能下岗");
             }
             js.setnStatus(JsStatusEnum.JS_NO_SERVICE.getCode());
-            //记录签退信息
-            tSign.setDutyStatus(JsStatusEnum.POST_NOT_ON_DUTY.getCode());
-            tSign.setSingTime(new Date());
-            tSign.setOpenId(js2.getcOpenId());
-            tSign.setJsId(js2.getId());
-            tSign.setName(js2.getcName());
-            signService.save(tSign);
+            LambdaQueryWrapper<TSign> signLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            signLambdaQueryWrapper.eq(TSign::getJsId, js.getId()).isNull(TSign::getLayoffTime).orderByAsc(TSign::getSingTime).last("LIMIT 1");
+            TSign singn = signService.getOne(signLambdaQueryWrapper);
+
+            if (null != singn) {
+                singn.setLayoffTime(new Date());
+                Long time = getaTime(singn);
+                singn.setOnlineTime(time.intValue());
+                signService.updateById(singn);
+            } else {
+                tSign.setSingTime(DateTimeUtils.getStartDate(new Date()));
+                tSign.setLayoffTime(new Date());
+                tSign.setOpenId(js2.getcOpenId());
+                tSign.setJsId(js2.getId());
+                tSign.setName(js2.getcName());
+                Long time = getaTime(tSign);
+                tSign.setOnlineTime(time.intValue());
+                signService.save(tSign);
+            }
         }
         return this.updateById(js);
     }
 
+    private Long getaTime(TSign tSign) {
+        Long layoff = DateTimeUtils.dateToStamp(tSign.getLayoffTime());
+        Long sing = DateTimeUtils.dateToStamp(tSign.getSingTime());
+        Long time = layoff - sing;
+        time = time / 1000;
+        time = time / 60;
+        return time;
+    }
+
     @Override
     public boolean block(TJs js) {
         if (StringUtils.isBlank(js.getId())) {
@@ -268,6 +290,7 @@ public class TJsServiceImpl extends ServiceImpl<TJsMapper, TJs> implements TJsSe
         }
         return this.updateById(js);
     }
+
     @Override
     public TJs getByJsId(String jsId, String openId) {
         if (jsId == null || jsId.trim().isEmpty()) {

+ 0 - 1
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TOrderServiceImpl.java

@@ -247,7 +247,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
     public Object depart(TOrder order) {
 
         LambdaQueryWrapper<TOrder> wrapper = new LambdaQueryWrapper<>();
-
         wrapper.eq(TOrder::getcId,order.getcId()).eq(TOrder::getnStatus,OrderStatusEnum.RECEIVED_ORDER.getCode());
         order.setnStatus(OrderStatusEnum.DEPART.getCode());
         order.setReachTime(LocalDateTime.now());

+ 42 - 1
nightFragrance-massage/src/main/java/com/ylx/massage/task/massageTask.java

@@ -4,11 +4,15 @@ import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ylx.common.constant.MassageConstants;
+import com.ylx.common.utils.StringUtils;
 import com.ylx.massage.domain.TJs;
 import com.ylx.massage.domain.TOrder;
+import com.ylx.massage.domain.TSign;
+import com.ylx.massage.enums.JsStatusEnum;
 import com.ylx.massage.enums.OrderStatusEnum;
 import com.ylx.massage.service.TJsService;
 import com.ylx.massage.service.TOrderService;
+import com.ylx.massage.service.TSignService;
 import com.ylx.massage.utils.DateTimeUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
@@ -29,8 +33,13 @@ public class massageTask {
     @Resource
     private TOrderService orderService;
 
+    @Resource
     private TJsService jsService;
 
+    @Resource
+    private TSignService signService;
+
+
     public void cancelOrder() {
 
         Date nowDate = new Date();
@@ -42,7 +51,6 @@ public class massageTask {
         while (total > 0L) {
             total = extracted(date);
         }
-
     }
 
     private Long extracted(Date nowDate) {
@@ -132,4 +140,37 @@ public class massageTask {
         }
     }
 
+    /**
+     * 定时下岗
+     * 12:01 查询前一天 是否有上岗记录
+     * 如果有上岗记录 没有下岗记录
+     * 插入一条(前一天)下岗记录(并计算在线时长) 和当天上岗记录
+     *
+     * @param date yyyy-MM-dd
+     *
+     *
+    **/
+    public void RegularLayoff(String date) {
+
+        Date date2 = new Date();
+        if(StringUtils.isNotBlank(date)){
+            date2 = DateTimeUtils.parseDate(date, DateTimeUtils.DATE_FORMAT);
+        }else {
+            date2 = DateTimeUtils.addDays(date2, -1);
+        }
+
+        Page<TSign> signPage = new Page<>();
+        signPage.setSize(MassageConstants.TWO_HUNDRED);
+        LambdaQueryWrapper<TSign> signLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        //上岗
+        Date startDate = DateTimeUtils.getStartDate(date2);
+        Date endDate = DateTimeUtils.getEndDate(date2);
+
+//        signLambdaQueryWrapper.eq(TSign::getDutyStatus, JsStatusEnum.POST_ON_DUTY.getCode()).ge(TSign::getSingTime, startDate).le(TSign::getSingTime, endDate);
+//        Page<TSign> page = signService.page(signPage, signLambdaQueryWrapper);
+
+
+
+    }
+
 }

+ 6 - 0
nightFragrance-massage/src/main/resources/mapper/massage/TOrderMapper.xml

@@ -101,6 +101,12 @@
                t_order.acceptance_time,
                t_order.reach_time,
                t_order.start_time,
+               t_order.arrival_longitude,
+               t_order.arrival_latitude,
+               t_order.depart_longitude,
+               t_order.depart_latitude,
+               t_order.arrival_photo,
+               t_order.depart_time,
                t_order.end_time,
                t_order.reason_refusal,
                t_js.c_open_id        as jsc_open_id,

+ 3 - 0
nightFragrance-massage/src/main/resources/mapper/massage/TSignMapper.xml

@@ -9,6 +9,9 @@
         <result property="openId" column="open_id" jdbcType="VARCHAR"/>
         <result property="singTime" column="sing_time" jdbcType="TIMESTAMP"/>
         <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="onlineTime" column="online_time" jdbcType="VARCHAR"/>
+        <result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
+        <result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
         <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
         <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>