自动生成job
This commit is contained in:
@@ -78,4 +78,8 @@ public interface BmsServiceFeign {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/settlementCustomersParametersApi/getListBySettlementCustomersId")
|
@GetMapping("/settlementCustomersParametersApi/getListBySettlementCustomersId")
|
||||||
AjaxResult getListBySettlementCustomersId(@RequestParam("settlementCustomersId") Long settlementCustomersId);
|
AjaxResult getListBySettlementCustomersId(@RequestParam("settlementCustomersId") Long settlementCustomersId);
|
||||||
|
|
||||||
|
@PostMapping("/settlementCustomersApi/updatePushContractManageJobId")
|
||||||
|
AjaxResult updatePushContractManageJobId(@RequestParam("settlementCustomersId") Long settlementCustomersId,
|
||||||
|
@RequestParam("jobId") Integer jobId);
|
||||||
}
|
}
|
||||||
+5
@@ -77,6 +77,11 @@ public class RemoteBmsFeignFallbackFactory implements FallbackFactory<BmsService
|
|||||||
public AjaxResult getListBySettlementCustomersId(Long settlementCustomersId) {
|
public AjaxResult getListBySettlementCustomersId(Long settlementCustomersId) {
|
||||||
return AjaxResult.error(throwable.getMessage());
|
return AjaxResult.error(throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult updatePushContractManageJobId(Long settlementCustomersId, Integer jobId) {
|
||||||
|
return AjaxResult.error(throwable.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-1
@@ -88,5 +88,10 @@ public class SettlementCustomersPO extends BaseVOEntity{
|
|||||||
|
|
||||||
private String settlementObject;
|
private String settlementObject;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
|
||||||
|
private Integer pushBillingRecordJobId;
|
||||||
|
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
|
||||||
|
private Integer pushContractManageToBmsJobId;
|
||||||
|
@ApiModelProperty(name = "生成应收账单任务id")
|
||||||
|
private Integer pushBillManageJobId;
|
||||||
}
|
}
|
||||||
+56
@@ -13,6 +13,7 @@ import com.mhd.basic.domain.contractManage.repository.mapper.ContractManageMappe
|
|||||||
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
|
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
|
||||||
import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
|
import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
|
||||||
import com.mhd.basic.domain.contractManage.repository.util.HttpWebServiceUtil;
|
import com.mhd.basic.domain.contractManage.repository.util.HttpWebServiceUtil;
|
||||||
|
import com.mhd.basic.domain.contractManage.repository.util.XxlJobOpenApiUtil;
|
||||||
import com.mhd.basic.domain.contractManage.service.ContractManageDomainService;
|
import com.mhd.basic.domain.contractManage.service.ContractManageDomainService;
|
||||||
import com.mhd.basic.domain.contractManageDetail.entity.ContractManageDetail;
|
import com.mhd.basic.domain.contractManageDetail.entity.ContractManageDetail;
|
||||||
import com.mhd.basic.domain.contractManageDetail.repository.mapper.ContractManageDetailMapper;
|
import com.mhd.basic.domain.contractManageDetail.repository.mapper.ContractManageDetailMapper;
|
||||||
@@ -50,6 +51,7 @@ import com.mhd.system.service.ISysDictTypeService;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -97,6 +99,9 @@ public class ContractManageApplicationService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IContractManageParametersService contractManageParametersService;
|
private IContractManageParametersService contractManageParametersService;
|
||||||
|
|
||||||
|
@Value("${xxl.job.admin.addresses}")
|
||||||
|
private String adminAddresses;
|
||||||
|
private static final String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozNTYzLCJ0b3BPcmdhbml6YXRpb25JZCI6MjgyNywidXNlcl9rZXkiOiI0N2MzY2U4My0wMmFjLTQ0NTQtOTdiYS1lYmQwMDc2MzNiNDMiLCJ1c2VybmFtZSI6ImNhbmdtYSJ9.tnZyywwburfBo3Kizdhfk5eYdXbrrZ9976Z0W7GrS6UqSpKwfI2RwdRwfYx7DbD7Ri1Fdj_eOVxBkjvdFF226Q";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询合同管理列表
|
* 分页查询合同管理列表
|
||||||
@@ -953,9 +958,60 @@ public class ContractManageApplicationService {
|
|||||||
dto.setTopOrganizationId(contractManageDO.getTopOrganizationId());
|
dto.setTopOrganizationId(contractManageDO.getTopOrganizationId());
|
||||||
ContractManageParametersDO parametersDO = contractManageParametersAssembler.toDO(dto);
|
ContractManageParametersDO parametersDO = contractManageParametersAssembler.toDO(dto);
|
||||||
contractManageParametersDomainService.insert(parametersDO);
|
contractManageParametersDomainService.insert(parametersDO);
|
||||||
|
if(StringUtils.isNotEmpty(contractManageDO.getSettlementCustomersCode())){
|
||||||
|
AjaxResult ajaxResult = bmsServiceFeign.getCustomersInfoByCode(contractManageDO.getSettlementCustomersCode());
|
||||||
|
if (!"200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||||
|
throw new ServiceException("获取结算客户信息失败");
|
||||||
|
}
|
||||||
|
SettlementCustomersPO settlementCustomersPO = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), SettlementCustomersPO.class);
|
||||||
|
if(null == settlementCustomersPO){
|
||||||
|
throw new ServiceException("结算客户信息未找到");
|
||||||
|
}
|
||||||
|
Long settlementEntityId = settlementCustomersPO.getSettlementEntityId();
|
||||||
|
if(null != settlementEntityId){
|
||||||
|
Integer pushContractManageToBmsJobId = settlementCustomersPO.getPushContractManageToBmsJobId();
|
||||||
|
if (null != pushContractManageToBmsJobId) {
|
||||||
|
stopXxlJob(pushContractManageToBmsJobId);
|
||||||
|
}
|
||||||
|
Integer jobId = addXxlJob(settlementEntityId.toString());
|
||||||
|
settlementCustomersPO.setPushContractManageToBmsJobId(jobId);
|
||||||
|
AjaxResult updateResult = bmsServiceFeign.updatePushContractManageJobId(settlementCustomersPO.getSettlementCustomersId(), jobId);
|
||||||
|
if (!"200".equals(String.valueOf(updateResult.get("code")))) {
|
||||||
|
throw new ServiceException("更新结算对象定时任务ID失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer addXxlJob(String shipperId) {
|
||||||
|
//1.实例化工具类,建议交给Spring管理
|
||||||
|
XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token);
|
||||||
|
|
||||||
|
//2.构建新增任务参数
|
||||||
|
XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq();
|
||||||
|
req.setJobGroup(5); //你的执行器组id
|
||||||
|
req.setJobDesc("整租推送计费单据/流水任务,结算对象id:" + shipperId);
|
||||||
|
req.setJobCron("0 0 1 * * ?");
|
||||||
|
req.setExecutorHandler("pushContractManageToBms");
|
||||||
|
req.setExecutorParam(shipperId); //传入业务单号
|
||||||
|
|
||||||
|
//3.调用创建任务接口 ,返回任务ID
|
||||||
|
Integer xxlJobId = apiUtil.addJob(req);
|
||||||
|
if(xxlJobId == null){
|
||||||
|
// 创建定时任务失败,抛异常/重试,不要让单据直接保存成功
|
||||||
|
throw new RuntimeException("创建夜间定时任务失败");
|
||||||
|
}
|
||||||
|
return xxlJobId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopXxlJob(Integer shipperId) {
|
||||||
|
//1.实例化工具类,建议交给Spring管理
|
||||||
|
XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token);
|
||||||
|
//3.调用创建任务接口 ,返回任务ID
|
||||||
|
apiUtil.pauseJob(shipperId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改合同管理
|
* 修改合同管理
|
||||||
*/
|
*/
|
||||||
|
|||||||
+138
@@ -0,0 +1,138 @@
|
|||||||
|
package com.mhd.basic.domain.contractManage.repository.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XXL‑JOB OpenApi 工具类
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class XxlJobOpenApiUtil {
|
||||||
|
|
||||||
|
/** xxl‑job admin地址,例:http://127.0.0.1:8080/xxl‑job‑admin */
|
||||||
|
private final String adminUrl;
|
||||||
|
/** 系统配置里的AccessToken */
|
||||||
|
private final String accessToken;
|
||||||
|
|
||||||
|
public XxlJobOpenApiUtil(String adminUrl, String accessToken) {
|
||||||
|
this.adminUrl = adminUrl.endsWith("/") ? adminUrl.substring(0, adminUrl.length() -1) : adminUrl;
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增定时任务
|
||||||
|
* @param addReq 请求参数
|
||||||
|
* @return jobId 任务ID,返回null代表调用失败
|
||||||
|
*/
|
||||||
|
public Integer addJob(JobInfoAddReq addReq) {
|
||||||
|
String url = adminUrl + "/api/jobinfo/add";
|
||||||
|
try {
|
||||||
|
// 实体对象转map,解决form不能传bean的爆红
|
||||||
|
Map<String, Object> formMap = BeanUtil.beanToMap(addReq);
|
||||||
|
|
||||||
|
HttpResponse response = HttpRequest.post(url)
|
||||||
|
.header("Authorization", accessToken)
|
||||||
|
.form(formMap) //传入map,不再传实体
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
String body = response.body();
|
||||||
|
log.info("xxl‑job addJob resp:{}", body);
|
||||||
|
XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class);
|
||||||
|
if (resp != null && resp.getCode() == 200) {
|
||||||
|
return Integer.valueOf(resp.getContent().toString());
|
||||||
|
}
|
||||||
|
log.error("新增xxl‑job任务失败,resp:{}", body);
|
||||||
|
return null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("调用xxl‑job addJob异常", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务
|
||||||
|
* @param jobId 任务id
|
||||||
|
* @return true成功
|
||||||
|
*/
|
||||||
|
public boolean removeJob(Integer jobId) {
|
||||||
|
String url = adminUrl + "/api/jobinfo/remove";
|
||||||
|
try (HttpResponse response = HttpRequest.post(url)
|
||||||
|
.header("Authorization", accessToken)
|
||||||
|
.form("id", jobId)
|
||||||
|
.execute()) {
|
||||||
|
String body = response.body();
|
||||||
|
XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class);
|
||||||
|
if (resp != null && resp.getCode() == 200) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
log.error("删除xxl‑job任务失败 jobId:{},resp:{}", jobId, body);
|
||||||
|
return false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("调用xxl‑job removeJob异常", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂停任务
|
||||||
|
*/
|
||||||
|
public boolean pauseJob(Integer jobId) {
|
||||||
|
String url = adminUrl + "/api/jobinfo/pause";
|
||||||
|
try (HttpResponse response = HttpRequest.post(url)
|
||||||
|
.header("Authorization", accessToken)
|
||||||
|
.form("id", jobId)
|
||||||
|
.execute()) {
|
||||||
|
String body = response.body();
|
||||||
|
XxlApiResp resp = JSONUtil.toBean(body, XxlApiResp.class);
|
||||||
|
return resp != null && resp.getCode() == 200;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("pauseJob异常", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------- 实体 ----------------
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class JobInfoAddReq {
|
||||||
|
/** 执行器组ID xxl_job_group.id */
|
||||||
|
private Integer jobGroup;
|
||||||
|
/** 任务描述 */
|
||||||
|
private String jobDesc;
|
||||||
|
/** 路由策略 ROUND:轮询 */
|
||||||
|
private String executorRouteStrategy = "ROUND";
|
||||||
|
/** cron表达式 23点 0 0 23 * * ? */
|
||||||
|
private String jobCron;
|
||||||
|
/** @XxlJob 注解handler名称 */
|
||||||
|
private String executorHandler;
|
||||||
|
/** 任务参数,这里存业务单号 */
|
||||||
|
private String executorParam;
|
||||||
|
/** 阻塞策略 SERIAL_EXECUTION单机串行 */
|
||||||
|
private String executorBlockStrategy = "SERIAL_EXECUTION";
|
||||||
|
/** 超时时间 0不限制 */
|
||||||
|
private Integer executorTimeout = 0;
|
||||||
|
/** 失败重试次数 */
|
||||||
|
private Integer executorFailRetryCount = 0;
|
||||||
|
/** BEAN模式 */
|
||||||
|
private String glueType = "BEAN";
|
||||||
|
private String glueSource = "";
|
||||||
|
private String glueRemark = "";
|
||||||
|
/** 1启用 0停止 */
|
||||||
|
private Integer triggerStatus = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class XxlApiResp {
|
||||||
|
private Integer code;
|
||||||
|
private Object content;
|
||||||
|
private String msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
+70
@@ -10,6 +10,7 @@ import com.mhd.bms.domain.settlementCustomers.repository.mapper.SettlementCustom
|
|||||||
import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO;
|
import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO;
|
||||||
import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO;
|
import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO;
|
||||||
import com.mhd.bms.domain.settlementCustomers.repository.persistence.SettlementCustomersImpl;
|
import com.mhd.bms.domain.settlementCustomers.repository.persistence.SettlementCustomersImpl;
|
||||||
|
import com.mhd.bms.domain.settlementCustomers.repository.util.XxlJobOpenApiUtil;
|
||||||
import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService;
|
import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService;
|
||||||
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
|
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
|
||||||
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService;
|
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService;
|
||||||
@@ -38,6 +39,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -73,6 +75,9 @@ public class SettlementCustomersApplicationService {
|
|||||||
private ISettlementCustomersNcConfigService settlementCustomersNcConfigService;
|
private ISettlementCustomersNcConfigService settlementCustomersNcConfigService;
|
||||||
|
|
||||||
private static final int SYNC_BATCH_SIZE = 500;
|
private static final int SYNC_BATCH_SIZE = 500;
|
||||||
|
@Value("${xxl.job.admin.addresses}")
|
||||||
|
private String adminAddresses;
|
||||||
|
private static final String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozNTYzLCJ0b3BPcmdhbml6YXRpb25JZCI6MjgyNywidXNlcl9rZXkiOiI0N2MzY2U4My0wMmFjLTQ0NTQtOTdiYS1lYmQwMDc2MzNiNDMiLCJ1c2VybmFtZSI6ImNhbmdtYSJ9.tnZyywwburfBo3Kizdhfk5eYdXbrrZ9976Z0W7GrS6UqSpKwfI2RwdRwfYx7DbD7Ri1Fdj_eOVxBkjvdFF226Q";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询结算对象列表
|
* 分页查询结算对象列表
|
||||||
@@ -328,6 +333,15 @@ public class SettlementCustomersApplicationService {
|
|||||||
if (paramResult == null || !"200".equals(String.valueOf(paramResult.get("code")))) {
|
if (paramResult == null || !"200".equals(String.valueOf(paramResult.get("code")))) {
|
||||||
throw new ServiceException("保存合同参数失败");
|
throw new ServiceException("保存合同参数失败");
|
||||||
}
|
}
|
||||||
|
Long settlementEntityId = settlementCustomersDO.getSettlementEntityId();
|
||||||
|
if (settlementEntityId != null) {
|
||||||
|
stopXxlJob(settlementCustomersDO.getPushBillingRecordJobId());
|
||||||
|
stopXxlJob(settlementCustomersDO.getPushBillManageJobId());
|
||||||
|
Integer jobId = addXxlJob(String.valueOf(settlementEntityId));
|
||||||
|
Integer jobId1 = addXxlJob1(String.valueOf(settlementEntityId));
|
||||||
|
settlementCustomersDO.setPushBillingRecordJobId(jobId);
|
||||||
|
settlementCustomersDO.setPushBillManageJobId(jobId1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceException("创建临时合同失败");
|
throw new ServiceException("创建临时合同失败");
|
||||||
}
|
}
|
||||||
@@ -338,6 +352,55 @@ public class SettlementCustomersApplicationService {
|
|||||||
return settlementCustomersDomainService.update(settlementCustomersDO);
|
return settlementCustomersDomainService.update(settlementCustomersDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer addXxlJob(String shipperId) {
|
||||||
|
//1.实例化工具类,建议交给Spring管理
|
||||||
|
XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token);
|
||||||
|
|
||||||
|
//2.构建新增任务参数
|
||||||
|
XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq();
|
||||||
|
req.setJobGroup(3); //你的执行器组id
|
||||||
|
req.setJobDesc("散租推送计费单据/流水任务,结算对象id:" + shipperId);
|
||||||
|
req.setJobCron("0 0 1 * * ?");
|
||||||
|
req.setExecutorHandler("pushBillingRecord");
|
||||||
|
req.setExecutorParam(shipperId); //传入业务单号
|
||||||
|
|
||||||
|
//3.调用创建任务接口 ,返回任务ID
|
||||||
|
Integer xxlJobId = apiUtil.addJob(req);
|
||||||
|
if(xxlJobId == null){
|
||||||
|
// 创建定时任务失败,抛异常/重试,不要让单据直接保存成功
|
||||||
|
throw new RuntimeException("创建夜间定时任务失败");
|
||||||
|
}
|
||||||
|
return xxlJobId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer addXxlJob1(String shipperId) {
|
||||||
|
//1.实例化工具类,建议交给Spring管理
|
||||||
|
XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token);
|
||||||
|
|
||||||
|
//2.构建新增任务参数
|
||||||
|
XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq();
|
||||||
|
req.setJobGroup(6); //你的执行器组id
|
||||||
|
req.setJobDesc("计费单据/流水生成发票任务,结算对象id:" + shipperId);
|
||||||
|
req.setJobCron("0 0 1 * * ?");
|
||||||
|
req.setExecutorHandler("pushBillManage");
|
||||||
|
req.setExecutorParam(shipperId); //传入业务单号
|
||||||
|
|
||||||
|
//3.调用创建任务接口 ,返回任务ID
|
||||||
|
Integer xxlJobId = apiUtil.addJob(req);
|
||||||
|
if(xxlJobId == null){
|
||||||
|
// 创建定时任务失败,抛异常/重试,不要让单据直接保存成功
|
||||||
|
throw new RuntimeException("创建夜间定时任务失败");
|
||||||
|
}
|
||||||
|
return xxlJobId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopXxlJob(Integer shipperId) {
|
||||||
|
//1.实例化工具类,建议交给Spring管理
|
||||||
|
XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token);
|
||||||
|
//3.调用创建任务接口 ,返回任务ID
|
||||||
|
apiUtil.pauseJob(shipperId);
|
||||||
|
}
|
||||||
|
|
||||||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyMMdd");
|
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyMMdd");
|
||||||
private static final Random RANDOM = new Random();
|
private static final Random RANDOM = new Random();
|
||||||
|
|
||||||
@@ -573,6 +636,13 @@ public class SettlementCustomersApplicationService {
|
|||||||
return saveEntity;
|
return saveEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean updatePushContractManageToBmsJobId(Long settlementCustomersId, Integer jobId) {
|
||||||
|
return settlementCustomersImpl.lambdaUpdate()
|
||||||
|
.eq(SettlementCustomers::getSettlementCustomersId, settlementCustomersId)
|
||||||
|
.set(SettlementCustomers::getPushContractManageToBmsJobId, jobId)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
private SettlementCustomersDO buildDriverSettlementCustomerDO(UserDriverPo userDriverPo, LoginUser loginUser, Long organizationId) {
|
private SettlementCustomersDO buildDriverSettlementCustomerDO(UserDriverPo userDriverPo, LoginUser loginUser, Long organizationId) {
|
||||||
SettlementCustomersDO saveEntity = new SettlementCustomersDO();
|
SettlementCustomersDO saveEntity = new SettlementCustomersDO();
|
||||||
saveEntity.setSettlementEntityId(userDriverPo.getUserId());
|
saveEntity.setSettlementEntityId(userDriverPo.getUserId());
|
||||||
|
|||||||
+6
@@ -96,5 +96,11 @@ public class SettlementCustomers extends BaseVOEntity{
|
|||||||
private String settlementCurrency;
|
private String settlementCurrency;
|
||||||
@ApiModelProperty(name = "组织代码")
|
@ApiModelProperty(name = "组织代码")
|
||||||
private String orgCode;
|
private String orgCode;
|
||||||
|
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
|
||||||
|
private Integer pushBillingRecordJobId;
|
||||||
|
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
|
||||||
|
private Integer pushContractManageToBmsJobId;
|
||||||
|
@ApiModelProperty(name = "生成应收账单任务id")
|
||||||
|
private Integer pushBillManageJobId;
|
||||||
|
|
||||||
}
|
}
|
||||||
+6
@@ -132,6 +132,12 @@ public class SettlementCustomersPO extends BaseVOEntity{
|
|||||||
private Date businessCreateTime;
|
private Date businessCreateTime;
|
||||||
@ApiModelProperty(name = "组织代码")
|
@ApiModelProperty(name = "组织代码")
|
||||||
private String orgCode;
|
private String orgCode;
|
||||||
|
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
|
||||||
|
private Integer pushBillingRecordJobId;
|
||||||
|
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
|
||||||
|
private Integer pushContractManageToBmsJobId;
|
||||||
|
@ApiModelProperty(name = "生成应收账单任务id")
|
||||||
|
private Integer pushBillManageJobId;
|
||||||
|
|
||||||
List<SettlementCustomersNcConfig> settlementCustomersNcConfigs;
|
List<SettlementCustomersNcConfig> settlementCustomersNcConfigs;
|
||||||
List<SettlementCustomersParameters> settlementCustomersParameters;
|
List<SettlementCustomersParameters> settlementCustomersParameters;
|
||||||
|
|||||||
+6
@@ -135,6 +135,12 @@ public class SettlementCustomersDO extends BaseVOEntity{
|
|||||||
private String documentTypeCode;
|
private String documentTypeCode;
|
||||||
@ApiModelProperty(name = "组织代码")
|
@ApiModelProperty(name = "组织代码")
|
||||||
private String orgCode;
|
private String orgCode;
|
||||||
|
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
|
||||||
|
private Integer pushBillingRecordJobId;
|
||||||
|
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
|
||||||
|
private Integer pushContractManageToBmsJobId;
|
||||||
|
@ApiModelProperty(name = "生成应收账单任务id")
|
||||||
|
private Integer pushBillManageJobId;
|
||||||
@ApiModelProperty("结算对象参数")
|
@ApiModelProperty("结算对象参数")
|
||||||
private List<SettlementCustomersParametersDTO> settlementCustomersParameters;
|
private List<SettlementCustomersParametersDTO> settlementCustomersParameters;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -38,7 +38,7 @@ public class XxlJobOpenApiUtil {
|
|||||||
Map<String, Object> formMap = BeanUtil.beanToMap(addReq);
|
Map<String, Object> formMap = BeanUtil.beanToMap(addReq);
|
||||||
|
|
||||||
HttpResponse response = HttpRequest.post(url)
|
HttpResponse response = HttpRequest.post(url)
|
||||||
.header("XXL-JOB-ACCESS-TOKEN", accessToken)
|
.header("Authorization", accessToken)
|
||||||
.form(formMap) //传入map,不再传实体
|
.form(formMap) //传入map,不再传实体
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ public class XxlJobOpenApiUtil {
|
|||||||
public boolean removeJob(Integer jobId) {
|
public boolean removeJob(Integer jobId) {
|
||||||
String url = adminUrl + "/api/jobinfo/remove";
|
String url = adminUrl + "/api/jobinfo/remove";
|
||||||
try (HttpResponse response = HttpRequest.post(url)
|
try (HttpResponse response = HttpRequest.post(url)
|
||||||
.header("XXL‑JOB‑ACCESS‑TOKEN", accessToken)
|
.header("Authorization", accessToken)
|
||||||
.form("id", jobId)
|
.form("id", jobId)
|
||||||
.execute()) {
|
.execute()) {
|
||||||
String body = response.body();
|
String body = response.body();
|
||||||
@@ -87,7 +87,7 @@ public class XxlJobOpenApiUtil {
|
|||||||
public boolean pauseJob(Integer jobId) {
|
public boolean pauseJob(Integer jobId) {
|
||||||
String url = adminUrl + "/api/jobinfo/pause";
|
String url = adminUrl + "/api/jobinfo/pause";
|
||||||
try (HttpResponse response = HttpRequest.post(url)
|
try (HttpResponse response = HttpRequest.post(url)
|
||||||
.header("XXL‑JOB‑ACCESS‑TOKEN", accessToken)
|
.header("Authorization", accessToken)
|
||||||
.form("id", jobId)
|
.form("id", jobId)
|
||||||
.execute()) {
|
.execute()) {
|
||||||
String body = response.body();
|
String body = response.body();
|
||||||
|
|||||||
+6
@@ -135,6 +135,12 @@ public class SettlementCustomersDTO extends BaseVOEntity{
|
|||||||
private String documentTypeCode;
|
private String documentTypeCode;
|
||||||
@ApiModelProperty(name = "组织代码")
|
@ApiModelProperty(name = "组织代码")
|
||||||
private String orgCode;
|
private String orgCode;
|
||||||
|
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
|
||||||
|
private Integer pushBillingRecordJobId;
|
||||||
|
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
|
||||||
|
private Integer pushContractManageToBmsJobId;
|
||||||
|
@ApiModelProperty(name = "生成应收账单任务id")
|
||||||
|
private Integer pushBillManageJobId;
|
||||||
|
|
||||||
@ApiModelProperty("结算对象参数")
|
@ApiModelProperty("结算对象参数")
|
||||||
private List<SettlementCustomersParametersDTO> settlementCustomersParameters;
|
private List<SettlementCustomersParametersDTO> settlementCustomersParameters;
|
||||||
|
|||||||
@@ -137,6 +137,14 @@ public class SettlementCustomersApi extends BaseController{
|
|||||||
return AjaxResult.success(settlementCustomersApplicationService.getFirstBySettlementEntityId(settlementEntityId, topOrganizationId));
|
return AjaxResult.success(settlementCustomersApplicationService.getFirstBySettlementEntityId(settlementEntityId, topOrganizationId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据结算对象ID更新整租推送任务ID")
|
||||||
|
@PostMapping("/updatePushContractManageJobId")
|
||||||
|
public AjaxResult updatePushContractManageJobId(@RequestParam("settlementCustomersId") Long settlementCustomersId,
|
||||||
|
@RequestParam("jobId") Integer jobId) {
|
||||||
|
Boolean result = settlementCustomersApplicationService.updatePushContractManageToBmsJobId(settlementCustomersId, jobId);
|
||||||
|
return toAjax(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,9 @@
|
|||||||
<result property="documentTypeCode" column="document_type_code" />
|
<result property="documentTypeCode" column="document_type_code" />
|
||||||
<result property="businessCreateTime" column="business_create_time" />
|
<result property="businessCreateTime" column="business_create_time" />
|
||||||
<result property="orgCode" column="org_code" />
|
<result property="orgCode" column="org_code" />
|
||||||
|
<result property="pushBillingRecordJobId" column="push_billing_record_job_id" />
|
||||||
|
<result property="pushContractManageToBmsJobId" column="push_contract_manage_to_bms_job_id" />
|
||||||
|
<result property="pushBillManageJobId" column="push_bill_manage_job_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="business_document_where">
|
<sql id="business_document_where">
|
||||||
@@ -117,6 +120,9 @@
|
|||||||
bd.document_type,
|
bd.document_type,
|
||||||
bd.document_type_code,
|
bd.document_type_code,
|
||||||
a.org_code,
|
a.org_code,
|
||||||
|
a.push_billing_record_job_id,
|
||||||
|
a.push_contract_manage_to_bms_job_id,
|
||||||
|
a.push_bill_manage_job_id,
|
||||||
bd.create_time as business_create_time
|
bd.create_time as business_create_time
|
||||||
from settlement_customers a
|
from settlement_customers a
|
||||||
left join "NGWL_TEST_USER"."USER_SHIPPER" b on a.settlement_entity_id = b.user_id
|
left join "NGWL_TEST_USER"."USER_SHIPPER" b on a.settlement_entity_id = b.user_id
|
||||||
|
|||||||
Reference in New Issue
Block a user