mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-25 06:44:33 +08:00
update 优化 规范DTO命名
This commit is contained in:
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class BillDto {
|
||||
public class BillDTO {
|
||||
|
||||
/**
|
||||
* 账单ID
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.job.entity.BillDto;
|
||||
import org.dromara.job.entity.BillDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -23,20 +23,20 @@ import java.math.BigDecimal;
|
||||
public class AlipayBillTask {
|
||||
|
||||
public ExecuteResult jobExecute(JobArgs jobArgs) throws InterruptedException {
|
||||
BillDto billDto = new BillDto();
|
||||
billDto.setBillId(23456789L);
|
||||
billDto.setBillChannel("alipay");
|
||||
BillDTO billDTO = new BillDTO();
|
||||
billDTO.setBillId(23456789L);
|
||||
billDTO.setBillChannel("alipay");
|
||||
// 设置清算日期
|
||||
String settlementDate = (String) jobArgs.getWfContext().get("settlementDate");
|
||||
if (StrUtil.equals(settlementDate, "sysdate")) {
|
||||
settlementDate = DateUtil.today();
|
||||
}
|
||||
billDto.setBillDate(settlementDate);
|
||||
billDto.setBillAmount(new BigDecimal("2345.67"));
|
||||
// 把billDto对象放入上下文进行传递
|
||||
jobArgs.appendContext("alipay", JsonUtils.toJsonString(billDto));
|
||||
billDTO.setBillDate(settlementDate);
|
||||
billDTO.setBillAmount(new BigDecimal("2345.67"));
|
||||
// 把billDTO对象放入上下文进行传递
|
||||
jobArgs.appendContext("alipay", JsonUtils.toJsonString(billDTO));
|
||||
SnailJobLog.REMOTE.info("上下文: {}", jobArgs.getWfContext());
|
||||
return ExecuteResult.success(billDto);
|
||||
return ExecuteResult.success(billDTO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.job.entity.BillDto;
|
||||
import org.dromara.job.entity.BillDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -26,15 +26,15 @@ public class SummaryBillTask {
|
||||
BigDecimal wechatAmount = BigDecimal.valueOf(0);
|
||||
String wechat = (String) jobArgs.getWfContext("wechat");
|
||||
if (StrUtil.isNotBlank(wechat)) {
|
||||
BillDto wechatBillDto = JsonUtils.parseObject(wechat, BillDto.class);
|
||||
wechatAmount = wechatBillDto.getBillAmount();
|
||||
BillDTO wechatBillDTO = JsonUtils.parseObject(wechat, BillDTO.class);
|
||||
wechatAmount = wechatBillDTO.getBillAmount();
|
||||
}
|
||||
// 获得支付宝账单
|
||||
BigDecimal alipayAmount = BigDecimal.valueOf(0);
|
||||
String alipay = (String) jobArgs.getWfContext("alipay");
|
||||
if (StrUtil.isNotBlank(alipay)) {
|
||||
BillDto alipayBillDto = JsonUtils.parseObject(alipay, BillDto.class);
|
||||
alipayAmount = alipayBillDto.getBillAmount();
|
||||
BillDTO alipayBillDTO = JsonUtils.parseObject(alipay, BillDTO.class);
|
||||
alipayAmount = alipayBillDTO.getBillAmount();
|
||||
}
|
||||
// 汇总账单
|
||||
BigDecimal totalAmount = wechatAmount.add(alipayAmount);
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import com.aizuda.snailjob.model.dto.ExecuteResult;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.job.entity.BillDto;
|
||||
import org.dromara.job.entity.BillDTO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -23,21 +23,21 @@ import java.math.BigDecimal;
|
||||
public class WechatBillTask {
|
||||
|
||||
public ExecuteResult jobExecute(JobArgs jobArgs) throws InterruptedException {
|
||||
BillDto billDto = new BillDto();
|
||||
billDto.setBillId(123456789L);
|
||||
billDto.setBillChannel("wechat");
|
||||
BillDTO billDTO = new BillDTO();
|
||||
billDTO.setBillId(123456789L);
|
||||
billDTO.setBillChannel("wechat");
|
||||
// 从上下文中获得清算日期并设置,如果上下文中清算日期
|
||||
// 是sysdate设置为当前日期;否则取管理页面设置的值
|
||||
String settlementDate = (String) jobArgs.getWfContext().get("settlementDate");
|
||||
if (StrUtil.equals(settlementDate, "sysdate")) {
|
||||
settlementDate = DateUtil.today();
|
||||
}
|
||||
billDto.setBillDate(settlementDate);
|
||||
billDto.setBillAmount(new BigDecimal("1234.56"));
|
||||
// 把billDto对象放入上下文进行传递
|
||||
jobArgs.appendContext("wechat", JsonUtils.toJsonString(billDto));
|
||||
billDTO.setBillDate(settlementDate);
|
||||
billDTO.setBillAmount(new BigDecimal("1234.56"));
|
||||
// 把billDTO对象放入上下文进行传递
|
||||
jobArgs.appendContext("wechat", JsonUtils.toJsonString(billDTO));
|
||||
SnailJobLog.REMOTE.info("上下文: {}", jobArgs.getWfContext());
|
||||
return ExecuteResult.success(billDto);
|
||||
return ExecuteResult.success(billDTO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user