Commit 3055d260 by Guojunfeng

PowerJob相关代码更新,调通线上侦查专项关联四种状态更新

parent e1b88338
package com.founder.commonutils.model;
import lombok.Data;
/**
* @author Godffy
* @create 2023-09-21 15:27
*/
@Data
public class PowerJobParams {
private int limit;
}
...@@ -243,4 +243,10 @@ public class ZczxDto extends BaseDto { ...@@ -243,4 +243,10 @@ public class ZczxDto extends BaseDto {
@ApiModelProperty(value = "侦查专项状态") @ApiModelProperty(value = "侦查专项状态")
private String zczxState; private String zczxState;
@ApiModelProperty(value = "powerJob定时任务开始num")
private int begin;
@ApiModelProperty(value = "powerJob定时任务结束num")
private int end;
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<artifactId>powerjob-server</artifactId> <artifactId>powerjob-server</artifactId>
<groupId>tech.powerjob</groupId> <groupId>tech.powerjob</groupId>
<version>4.3.0</version> <version>4.3.0</version>
<relativePath>../pom.xml</relativePath> <relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -8,7 +8,6 @@ import lombok.RequiredArgsConstructor; ...@@ -8,7 +8,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import tech.powerjob.common.OmsConstant; import tech.powerjob.common.OmsConstant;
import tech.powerjob.common.exception.PowerJobException; import tech.powerjob.common.exception.PowerJobException;
import tech.powerjob.common.utils.NetUtils; import tech.powerjob.common.utils.NetUtils;
...@@ -29,7 +28,7 @@ import java.util.Set; ...@@ -29,7 +28,7 @@ import java.util.Set;
* @since 2020/8/6 * @since 2020/8/6
*/ */
@Slf4j @Slf4j
@Service //@Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class DingTalkAlarmService implements Alarmable { public class DingTalkAlarmService implements Alarmable {
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<!-- SpringBoot maven plugin --> <!-- SpringBoot maven plugin -->
<build> <build>
<finalName>powerjob7700</finalName> <finalName>powerjob</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
...@@ -3,9 +3,9 @@ logging.config=classpath:logback-dev.xml ...@@ -3,9 +3,9 @@ logging.config=classpath:logback-dev.xml
####### \u5916\u90E8\u6570\u636E\u5E93\u914D\u7F6E\uFF08\u9700\u8981\u7528\u6237\u66F4\u6539\u4E3A\u81EA\u5DF1\u7684\u6570\u636E\u5E93\u914D\u7F6E\uFF09 ####### ####### \u5916\u90E8\u6570\u636E\u5E93\u914D\u7F6E\uFF08\u9700\u8981\u7528\u6237\u66F4\u6539\u4E3A\u81EA\u5DF1\u7684\u6570\u636E\u5E93\u914D\u7F6E\uFF09 #######
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.core.jdbc-url=jdbc:mysql://47.92.48.137:3900/skyp?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai spring.datasource.core.jdbc-url=jdbc:mysql://68.174.69.120:4306/WSWX?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
spring.datasource.core.username=root spring.datasource.core.username=XZXT
spring.datasource.core.password=gkptCcYy123 spring.datasource.core.password=XZXT#44
spring.datasource.core.maximum-pool-size=20 spring.datasource.core.maximum-pool-size=20
spring.datasource.core.minimum-idle=5 spring.datasource.core.minimum-idle=5
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<artifactId>publicapi</artifactId> <artifactId>publicapi</artifactId>
<build> <build>
<finalName>publicapi1003</finalName> <finalName>publicapi</finalName>
<!--添加标签,防止编译时excel损坏--> <!--添加标签,防止编译时excel损坏-->
<resources> <resources>
......
package com.founder.publicapi.controller.DgServiceController; package com.founder.publicapi.controller.DgServiceController;
import com.founder.publicapi.service.PowerJobService; import com.alibaba.fastjson.JSONObject;
import com.founder.commonutils.model.PowerJobParams;
import com.founder.publicapi.service.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -21,7 +23,11 @@ public class PowerJobController implements BasicProcessor { ...@@ -21,7 +23,11 @@ public class PowerJobController implements BasicProcessor {
@Override @Override
public ProcessResult process(TaskContext context) { public ProcessResult process(TaskContext context) {
System.out.println("定时测试----------------------------------------相关业务"); String jobParams = context.getJobParams();
PowerJobParams powerJobParams = JSONObject.parseObject(jobParams, PowerJobParams.class);
powerJobService.updateZczxRelate(powerJobParams);
return new ProcessResult(true, "服务概述执行成功"); return new ProcessResult(true, "服务概述执行成功");
} }
} }
package com.founder.publicapi.service; package com.founder.publicapi.service;
import com.founder.commonutils.model.PowerJobParams;
import com.founder.commonutils.model.zczxEntity.XjCount; import com.founder.commonutils.model.zczxEntity.XjCount;
import java.util.List; import java.util.List;
...@@ -12,4 +13,5 @@ public interface PowerJobService { ...@@ -12,4 +13,5 @@ public interface PowerJobService {
List<XjCount> selectSfxjByAsjbh(String asjbh); List<XjCount> selectSfxjByAsjbh(String asjbh);
void updateZczxRelate(PowerJobParams powerJobParams);
} }
package com.founder.publicapi.service.serviceimpl; package com.founder.publicapi.service.serviceimpl;
import com.founder.commonutils.model.zczxEntity.XjCount; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.founder.publicapi.mapper.mysqlMapper.PowerJobMapper; import com.founder.commonutils.model.PowerJobParams;
import com.founder.commonutils.model.zczxEntity.*;
import com.founder.publicapi.mapper.mysqlMapper.*;
import com.founder.publicapi.service.PowerJobService; import com.founder.publicapi.service.PowerJobService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* @author Godffy * @author Godffy
...@@ -18,9 +24,118 @@ public class PowerJobServiceImpl implements PowerJobService { ...@@ -18,9 +24,118 @@ public class PowerJobServiceImpl implements PowerJobService {
@Autowired @Autowired
private PowerJobMapper powerJobMapper; private PowerJobMapper powerJobMapper;
@Autowired
private ZczxMapper zczxMapper;
@Autowired
private TbStAsjMapper tbStAsjMapper;
@Autowired
private TbXwZbfzxyrMapper tbXwZbfzxyrMapper;
@Resource
private TbYwXszCbajMapper tbYwXszCbajMapper;
@Override @Override
public List<XjCount> selectSfxjByAsjbh(String asjbh) { public List<XjCount> selectSfxjByAsjbh(String asjbh) {
List<XjCount> xjCounts = this.powerJobMapper.selectSfxjByAsjbh(asjbh); List<XjCount> xjCounts = this.powerJobMapper.selectSfxjByAsjbh(asjbh);
return xjCounts; return xjCounts;
} }
@Override
public void updateZczxRelate(PowerJobParams powerJobParams) {
int limit = powerJobParams.getLimit();
QueryWrapper<Zczx> qw = new QueryWrapper<>();
qw.isNotNull("asjbh");
qw.eq("xxsc_pdbz", "0");
int size = zczxMapper.selectCount(qw);
long threadNum = size / limit;
int startnum = 0;
int endnum = 0;
ExecutorService executorService = Executors.newCachedThreadPool();//按需分配线程池,其实最好自定义线程池
for (int i = 0; i < threadNum + 1; i++) {
startnum = i * limit + 1;
endnum = ((i + 1) * limit);
if (startnum > size) {
break;
}
if (endnum > size) {
endnum = size;
}
if (startnum == endnum) {
break;
}
ZczxDto zczxDto = new ZczxDto();
//分页查侦查专项
zczxDto.setBegin(startnum);
zczxDto.setEnd(endnum);
System.out.println("批量分流===========开始" + startnum + "===结束===" + endnum);
List<Zczx> syrkList = zczxMapper.selectZczxList(zczxDto);
System.out.println("批量分流===========开始" + startnum + "===结束===" + endnum + "====总数" + syrkList.size());
HandleThreadZczx thread = new HandleThreadZczx(syrkList);
executorService.execute(thread);
}
}
class HandleThreadZczx extends Thread {
private List<Zczx> data;
public HandleThreadZczx(List<Zczx> data) {
this.data = data;
}
public void run() {
for (Zczx zczx : data) {
String asjbh = zczx.getAsjbh();
//如果有案件编号,关联图侦、刑技、抓捕、串并状态
if (StringUtils.isNotBlank(asjbh)) {
//关联图侦
QueryWrapper<TbStAsj> tbStAsjQueryWrapper = new QueryWrapper<>();
tbStAsjQueryWrapper.eq("asjbh", asjbh);
tbStAsjQueryWrapper.eq("xxsc_pdbz", "0");
TbStAsj asj = tbStAsjMapper.selectOne(tbStAsjQueryWrapper);
if (asj != null) {
String tzPdbzDg = asj.getTzPdbzDg();//是否图侦
if (StringUtils.isNotBlank(tzPdbzDg) && tzPdbzDg.equals("1")) {
zczx.setSftzPdbz("1");//图侦状态设为"1"
}
}
//关联刑技(勘验信息queryXckcInfo、现场指纹getXcZwbzList、指纹比中getZwbzList、DNA比中getDnabzList)
List<XjCount> xjCounts = powerJobMapper.selectSfxjByAsjbh(asjbh);
int counts = 0;//刑技能关联出来的数量
for (int i = 0; i < xjCounts.size(); i++) {
XjCount xjCount = xjCounts.get(i);
counts = counts + xjCount.getCounts();
}
if (counts > 0) {//如果上面4个条件,只要有数据返回,则认为有刑技数据
zczx.setSfxjPdbz("1");//刑技状态设为"1"
}
//关联抓捕
QueryWrapper<TbXwZbfzxyr> tbXwZbfzxyrQueryWrapper = new QueryWrapper<>();
tbXwZbfzxyrQueryWrapper.eq("asjbh", asjbh);
tbXwZbfzxyrQueryWrapper.eq("xxsc_pdbz", "0");
TbXwZbfzxyr zbfzxyr = tbXwZbfzxyrMapper.selectOne(tbXwZbfzxyrQueryWrapper);
if (zbfzxyr != null) {
String zhfzxyrFzxyrdaztdm = zbfzxyr.getZhfzxyrFzxyrdaztdm();//到案状态
if (StringUtils.isNotBlank(zhfzxyrFzxyrdaztdm) && zhfzxyrFzxyrdaztdm.equals("1")) {
zczx.setSfzbPdbz("1");//抓捕状态设为"1"
}
}
//关联串并
QueryWrapper<TbYwXszCbaj> tbYwXszCbajQueryWrapper = new QueryWrapper<>();
tbYwXszCbajQueryWrapper.eq("asjbh", asjbh);
tbYwXszCbajQueryWrapper.eq("xxsc_pdbz", "0");
TbYwXszCbaj tbYwXszCbaj = tbYwXszCbajMapper.selectOne(tbYwXszCbajQueryWrapper);
if (tbYwXszCbaj != null) {
zczx.setSfcbaPdbz("1");//串并案状态设为"1"
}
//更新一下侦查专项关联的状态
zczxMapper.updateById(zczx);
}
}
}
}
} }
...@@ -115,7 +115,7 @@ management.endpoint.logfile.enabled=true ...@@ -115,7 +115,7 @@ management.endpoint.logfile.enabled=true
management.endpoint.logfile.external-file= /data2/skglpt/publicapi1003.log management.endpoint.logfile.external-file= /data2/skglpt/publicapi1003.log
#\uFFFD\u01F7\uFFFD\uFFFD\uFFFDpowerjob #\uFFFD\u01F7\uFFFD\uFFFD\uFFFDpowerjob
powerjob.worker.enabled=false powerjob.worker.enabled=true
# akka \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u02FF\u06A3\uFFFD\uFFFD\uFFFD\u0461\uFFFD\uFFFD\u012C\uFFFD\uFFFD 27778 # akka \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u02FF\u06A3\uFFFD\uFFFD\uFFFD\u0461\uFFFD\uFFFD\u012C\uFFFD\uFFFD 27778
powerjob.worker.akka-port=27778 powerjob.worker.akka-port=27778
# \uFFFD\uFFFD\uFFFD\uFFFD\u04E6\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u01A3\uFFFD\uFFFD\uFFFD\uFFFD\u06B7\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uB8EC\uFFFD\u01BC\uFFFD\uFFFD\uFFFD\u0434 \uFFFD\uFFFD Java \uFFFD\uFFFD\u013F\uFFFD\uFFFD\uFFFD\uFFFD # \uFFFD\uFFFD\uFFFD\uFFFD\u04E6\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u01A3\uFFFD\uFFFD\uFFFD\uFFFD\u06B7\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uB8EC\uFFFD\u01BC\uFFFD\uFFFD\uFFFD\u0434 \uFFFD\uFFFD Java \uFFFD\uFFFD\u013F\uFFFD\uFFFD\uFFFD\uFFFD
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment