创建Thread线程

 @ResponseBody
    @PostMapping("/check")
    @RequiresPermissions("incident:menu")
    @OperationLogAnnotation("风险点批量审核")
    public Result check(IncidentQuery query, HttpServletRequest request) {
        FxIncident point = new FxIncident();
        Arrays.asList(query.getFxIncidentIds()).forEach(id -> {
            point.setFxIncidentId(id);
            point.setFxCheckStatus("1");
            incidentService.updateRiskPoint(point);
        });
        return Result.success();
    }
@Override
    public void updateRiskPoint(FxIncident point) {
	    Long id = point.getFxIncidentId();
        point.setDisposalUuid(StringUtils.getUuid());
        point.setDisposalDate(new Date());
        incidentMapper.updateByPrimaryKeySelective(point);
        new FirstThreadTest(id).start();

    }
 public class FirstThreadTest extends Thread{
        private Long id;
	    public FirstThreadTest(Long id){
          this.id=id;
        }
        public long getId(){
	        return this.id;
        }
        //重写run方法,run方法的方法体就是现场执行体
        public void run()
        {
            FxIncident fxIncident = incidentMapper.getIncidentDetail(this.id);
//            String url="http://148.70.208.105:9598/uoimccp/http/syncEvent/";
            String url = "http://192.168.252.230:8081/uoimccp/http/syncEvent/";
            Map<String,Object> result=new HashMap<>();
            result.put("mobile",fxIncident.getMobilephone());
            result.put("upload_type","1");
            result.put("event_add",fxIncident.getFxIncidentAddress());
            result.put("event_coordinate",fxIncident.getFxIncidentX()+","+fxIncident.getFxIncidentY());
            result.put("event_describe",fxIncident.getFxIncidentContent());
            String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
            String format11 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(fxIncident.getFxIncidentReportDate());
            result.put("event_time",format11);
            result.put("chuzhi_time", format);
            result.put("event_type_one","ee396d5a003f4ebbb26e6b821b82e0f0");
            result.put("id",fxIncident.getIncidentUuid());

            if (!StringUtils.isEmpty(fxIncident.getIncidentTypeDict())) {
                if (fxIncident.getIncidentTypeDict().equals("寒潮霜冻")) {
                    result.put("event_type_two", "b59c9d443a084440875bc76cd7b4bf44");
                }
                if (fxIncident.getIncidentTypeDict().equals("公共设施缺损")) {
                    result.put("event_type_two", "dc60a7aac4344fe7b0c7e55d91066937");
                }
                if (fxIncident.getIncidentTypeDict().equals("危棚简屋")) {
                    result.put("event_type_two", "c24dabf6087147538ff59fceca2f8601");
                }
                if (fxIncident.getIncidentTypeDict().equals("高空坠物")) {
                    result.put("event_type_two", "5ec029af13e74128952827d4560c13f4");
                }
                if (fxIncident.getIncidentTypeDict().equals("树木倒折")) {
                    result.put("event_type_two", "c57bce02b7cf46aba892810cf7c97a9c");
                }
                if (fxIncident.getIncidentTypeDict().equals("路面积水")) {
                    result.put("event_type_two", "d1d5a30f610a4114bdfb08a63b9d2dbf");
                }
                if (fxIncident.getIncidentTypeDict().equals("应急避难场所倒灌")) {
                    result.put("event_type_two", "18996a7208134a76a3337259ce74b798");
                }
                if (fxIncident.getIncidentTypeDict().equals("其它")) {
                    result.put("event_type_two", "c258df1ea9a14113a5395791a06424d8");
                }
            }

            List<Map<String, Object>> imgList = new ArrayList<>();

            if (StringUtils.isNotEmpty(fxIncident.getFxIncidentReportPic())){
                List<String> reportPicList = new ArrayList<>();
                fxUploadFileMapper.selectFilesForAsso(fxIncident.getFxIncidentReportPic()).forEach(
                        reportImg -> {
                            Map<String,Object> reportPic=new HashMap<>();
                            reportPic.put("id",StringUtils.getUuid());
                            reportPic.put("event_id",fxIncident.getIncidentUuid());
                            reportPic.put("img_url","http://media.jqout.wiseljz.com:6003" + reportImg.getFxFileUri());
                            imgList.add(reportPic);
                        });
            }
            result.put("imgList",imgList);

            List<Map<String, Object>> disposalList = new ArrayList<>();
            Map<String,Object> disposal=new HashMap<>();
            Map<String,Object> disposal1=new HashMap<>();
            disposal.put("event_status","0");
            disposal.put("chuzhi_time",format);
            disposal.put("handle_status","0");
            disposal.put("event_id",fxIncident.getIncidentUuid());
            disposal.put("id",StringUtils.getUuid());
            disposalList.add(disposal);

            disposal1.put("event_status","2");
            disposal1.put("chuzhi_time",format);
            disposal1.put("handle_status","1");
            disposal1.put("event_id",fxIncident.getIncidentUuid());
            disposal1.put("id",StringUtils.getUuid());
            disposalList.add(disposal1);

            if (fxIncident.getFxIncidentStatusDict().equals("1")){
                result.put("event_status","2");
                result.put("handle_status","1");


            }

            if (fxIncident.getFxIncidentStatusDict().equals("2")){
                result.put("event_status","2");
                result.put("handle_status","4");

                List<Map<String, Object>> disposalImgList = new ArrayList<>();
                if (StringUtils.isNotEmpty(fxIncident.getFxIncidentAccessPic())){
                    fxUploadFileMapper.selectFilesForAsso(fxIncident.getFxIncidentAccessPic()).forEach(
                            reportImg -> {
                                Map<String,Object> reportPic=new HashMap<>();
                                reportPic.put("disposal_id",fxIncident.getDisposalUuid());
                                reportPic.put("id",StringUtils.getUuid());
                                reportPic.put("event_id",fxIncident.getIncidentUuid());
                                reportPic.put("img_url","http://media.jqout.wiseljz.com:6003" + reportImg.getFxFileUri());
                                disposalImgList.add(reportPic);
                            });
                }
                result.put("disposalImgList",disposalImgList);
                Map<String,Object> disposal2=new HashMap<>();
                disposal2.put("event_status","2");
                disposal2.put("chuzhi_time",format);
                disposal2.put("handle_status","3");
                disposal2.put("event_id",fxIncident.getIncidentUuid());
                disposal2.put("id",StringUtils.getUuid());
                disposalList.add(disposal2);

                Map<String,Object> disposal3=new HashMap<>();
                disposal3.put("event_status","2");
                disposal3.put("chuzhi_time",format);
                disposal3.put("handle_status","4");
                disposal3.put("event_id",fxIncident.getIncidentUuid());
                disposal3.put("id",fxIncident.getDisposalUuid());
                disposalList.add(disposal3);

            }

            result.put("disposalList",disposalList);
            String s = JSONObject.toJSONString(result);
            try {
                commonHttpClient.sendHttpPost(url, s);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }


    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值