|
@@ -18,6 +18,7 @@ import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MtRecordRes
|
|
|
import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper;
|
|
|
import cn.com.ty.lift.common.constants.CommonEnum;
|
|
|
import cn.com.ty.lift.common.utils.MapHelper;
|
|
|
+import cn.com.ty.lift.common.verify.VerifyUtils;
|
|
|
import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
import cn.hutool.core.collection.IterUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
@@ -128,13 +129,23 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
|
|
|
Long planId = record.getMtPlanId();
|
|
|
Long mtCompanyId = record.getMtCompanyId();
|
|
|
Long workerId = record.getWorkerId();
|
|
|
- String liftCoordinate = getCoordinate(record.getLiftId());
|
|
|
+ Long liftId = record.getLiftId();
|
|
|
+ //校验电梯是否定位
|
|
|
+ String liftCoordinate = getCoordinate(liftId);
|
|
|
if (StrUtil.isEmpty(liftCoordinate)) return RestResponse.fail(MessageUtils.get("msg.lift.not.position"));
|
|
|
+ //查询该电梯是否有保养记录
|
|
|
boolean count = count(planId, mtCompanyId, workerId);
|
|
|
- if (count) return RestResponse.fail(MessageUtils.get("msg.exist.record"));
|
|
|
- boolean result = calc(liftCoordinate, request.getCoordinate());
|
|
|
- if (result) return RestResponse.fail(MessageUtils.get("msg.error.person.scope"));
|
|
|
- Long liftId = record.getLiftId();
|
|
|
+ if (count)
|
|
|
+ return RestResponse.fail(MessageUtils.get("msg.exist.record"));
|
|
|
+ String coordinate = request.getCoordinate();
|
|
|
+ //校验是否为经纬度
|
|
|
+ boolean verifyResult = VerifyUtils.preJudgment(coordinate);
|
|
|
+ if (!verifyResult)
|
|
|
+ return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
|
|
|
+ //维保工是否在电梯附近
|
|
|
+ boolean result = calc(liftCoordinate, coordinate);
|
|
|
+ if (result)
|
|
|
+ return RestResponse.fail(MessageUtils.get("msg.error.person.scope"));
|
|
|
Optional<Lift> lift = liftService.getOne(null, liftId);
|
|
|
if (lift.isPresent()) {
|
|
|
Lift l = lift.get();
|
|
@@ -224,6 +235,7 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
|
|
|
* @description 查看保养信息详情
|
|
|
* @date 2020/1/13 2:39 下午
|
|
|
*/
|
|
|
+ @Deprecated
|
|
|
public MaintenanceRecordDetailResponse queryById(Long id) {
|
|
|
MaintenanceRecord record = getById(id);
|
|
|
List<MtRecordImg> imgList = mtRecordImgService.listByRecord(id);
|