|
@@ -1,24 +1,18 @@
|
|
|
package com.usky.fire.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.usky.common.core.util.HttpUtils;
|
|
|
-import com.usky.common.core.util.StringUtils;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
-import com.usky.fire.domain.MhPostInspect;
|
|
|
+import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.PostInspect;
|
|
|
import com.usky.fire.mapper.PostInspectMapper;
|
|
|
import com.usky.fire.service.BaseUserCompanyService;
|
|
|
-import com.usky.fire.service.MhPostInspectService;
|
|
|
import com.usky.fire.service.PostInspectService;
|
|
|
import com.usky.fire.service.util.OnlineMethod;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneOffset;
|
|
@@ -40,9 +34,6 @@ public class PostInspectServiceImpl extends AbstractCrudService<PostInspectMappe
|
|
|
@Autowired
|
|
|
private BaseUserCompanyService baseUserCompanyService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private MhPostInspectService mhPostInspectService;
|
|
|
-
|
|
|
@Override
|
|
|
public void postInspectRecept(PostInspect postInspect) {
|
|
|
this.save(postInspect);
|
|
@@ -96,23 +87,19 @@ public class PostInspectServiceImpl extends AbstractCrudService<PostInspectMappe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void postInspectAnswerRequest() {
|
|
|
- String url = "http://172.16.120.165:13200/prod-api/service-fire/postInspect/postInspectAnswerRecept";
|
|
|
- String res = null;
|
|
|
- try {
|
|
|
- res = HttpUtils.get(url, null);
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(res)) {
|
|
|
- JSONObject jsonObj = JSONObject.parseObject(res);
|
|
|
- String userStr = jsonObj.getString("data");
|
|
|
- if(StringUtils.isNotBlank(userStr)&&!userStr.equals("[]")){
|
|
|
- List<MhPostInspect> mhPostInspectList = JSON.parseArray(userStr, MhPostInspect.class);
|
|
|
- for (int i = 0; i < mhPostInspectList.size(); i++) {
|
|
|
-// mhPostInspectService.updateById(mhPostInspectList.get(i));
|
|
|
- }
|
|
|
- }
|
|
|
+ public void postInspectAnswerUpdate(PostInspect postInspect) {
|
|
|
+ LambdaQueryWrapper<PostInspect> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(PostInspect::getId, postInspect.getId());
|
|
|
+ List<PostInspect> postInspectMap = this.list(queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(postInspectMap)) {
|
|
|
+ long data1 = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
|
|
|
+ long data2 = postInspectMap.get(0).getInspectTime().toEpochSecond(ZoneOffset.of("+8"));
|
|
|
+ long time = data1 - data2;
|
|
|
+ postInspect.setSpentTime((int) time);
|
|
|
+ postInspect.setReplyTime(LocalDateTime.now());
|
|
|
+ postInspect.setUpdatePerson(SecurityUtils.getUsername());
|
|
|
+ postInspect.setUpdateTime(LocalDateTime.now());
|
|
|
+ this.updateById(postInspect);
|
|
|
}
|
|
|
}
|
|
|
|