集成bms服务模块
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.mhd.bms.infrastructure.constant;
|
||||
|
||||
/**
|
||||
* 账单消息通知模板常量
|
||||
*
|
||||
*/
|
||||
public class BillLogsConstants
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
创建账单
|
||||
账单编号:{},账单金额:{}元
|
||||
*/
|
||||
public static final String create_bill_title = "创建账单";
|
||||
public static final String create_bill_text = "账单编号:{},账单金额:{}元";
|
||||
|
||||
/**
|
||||
* 调整账单
|
||||
* 账单金额:{}元
|
||||
*/
|
||||
public static final String change_bill_title = "调整账单";
|
||||
public static final String change_bill_text = "账单金额:{}元";
|
||||
|
||||
/**
|
||||
* 确认账单
|
||||
*
|
||||
*/
|
||||
public static final String confirm_bill_title = "确认账单";
|
||||
public static final String confirm_bill_text = "";
|
||||
|
||||
/**
|
||||
* 发起账单
|
||||
*
|
||||
*/
|
||||
public static final String initiate_bill_title = "发起账单";
|
||||
public static final String initiate_bill_text = "";
|
||||
|
||||
/**
|
||||
* 客户确认
|
||||
* 确认结果:核对无误
|
||||
* 确认结果:申请调账({意见描述}),期望金额:{}元
|
||||
*/
|
||||
public static final String customer_confirm_title = "客户确认";
|
||||
public static final String customer_confirm_text_one = "确认结果:核对无误";
|
||||
public static final String customer_confirm_text_two = "确认结果:申请调账({}),期望金额:{}元";
|
||||
|
||||
|
||||
/**
|
||||
* 财务审核
|
||||
* 审核结果:同意,账单金额:{}元
|
||||
* 审核结果:拒绝({意见描述}),账单金额:{}元
|
||||
*/
|
||||
public static final String financial_review_title = "客户确认";
|
||||
public static final String financial_review_text_one = "审核结果:同意({}),账单金额:{}元";
|
||||
public static final String financial_review_text_two = "审核结果:拒绝({}),账单金额:{}元";
|
||||
|
||||
|
||||
/**
|
||||
* 作废账单
|
||||
*
|
||||
*/
|
||||
public static final String nullify_bill_title = "作废账单";
|
||||
public static final String nullify_bill_text = "";
|
||||
|
||||
|
||||
/**
|
||||
* 删除账单
|
||||
*
|
||||
*/
|
||||
public static final String delete_bill_title = "删除账单";
|
||||
public static final String delete_bill_text = "";
|
||||
|
||||
|
||||
/**
|
||||
* 收款
|
||||
* 收款单号:{},收款金额:{}元
|
||||
*/
|
||||
public static final String collection_bill_title = "收款";
|
||||
public static final String collection_bill_text = "收款单号:{},收款金额:{}元(实收{}元,优惠{}元)";
|
||||
|
||||
|
||||
/**
|
||||
* 退款
|
||||
* 收款单号:{},退款金额:{}元
|
||||
*/
|
||||
public static final String refund_bill_title = "退款";
|
||||
public static final String refund_bill_text = "退款单号:{},退款金额:{}元";
|
||||
|
||||
|
||||
/**
|
||||
* 付款
|
||||
* 付款单号:{},付款金额:{}元
|
||||
*/
|
||||
public static final String payment_bill_title = "付款";
|
||||
public static final String payment_bill_text = "付款单号:{},付款金额:{}元";
|
||||
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.mhd.bms.infrastructure.feign.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 合同管理详情对象 contract_manage_detail
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "合同管理详情对象", description = "合同管理详情响应对象")
|
||||
public class ContractManageDetailPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("合同管理详情id")
|
||||
private Long contractManageDetailId;
|
||||
|
||||
@ApiModelProperty("合同管理id")
|
||||
@Excel(name = "合同管理id")
|
||||
private Long contractManageId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("结算科目类型(1-通用,2-临时)")
|
||||
@Excel(name = "结算科目类型", readConverterExp = "1=-通用,2-临时")
|
||||
private Integer subjectType;
|
||||
|
||||
@ApiModelProperty("一级费用科目code")
|
||||
@Excel(name = "一级费用科目code")
|
||||
private String firstSubjectCode;
|
||||
|
||||
@ApiModelProperty("一级费用科目")
|
||||
@Excel(name = "一级费用科目")
|
||||
private String firstSubjectName;
|
||||
|
||||
@ApiModelProperty("二级费用科目code")
|
||||
@Excel(name = "二级费用科目code")
|
||||
private String secondSubjectCode;
|
||||
|
||||
@ApiModelProperty("二级费用科目")
|
||||
@Excel(name = "二级费用科目")
|
||||
private String secondSubjectName;
|
||||
|
||||
@ApiModelProperty("计费策略id")
|
||||
@Excel(name = "计费策略id")
|
||||
private Long accountingStrategyId;
|
||||
|
||||
@ApiModelProperty("计费策略")
|
||||
@Excel(name = "计费策略")
|
||||
private String accountingStrategy;
|
||||
|
||||
@ApiModelProperty("计费策略编码")
|
||||
@Excel(name = "计费策略编码")
|
||||
private String accountingStrategyCode;
|
||||
|
||||
@ApiModelProperty("计费周期")
|
||||
@Excel(name = "计费周期")
|
||||
private String billingAttributes;
|
||||
|
||||
@ApiModelProperty("计费周期编码")
|
||||
@Excel(name = "计费周期编码")
|
||||
private String billingAttributesCode;
|
||||
|
||||
@ApiModelProperty("合同有效日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "合同有效日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date subjectEffectiveDate;
|
||||
|
||||
@ApiModelProperty("合同到期日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date subjectExpirationDate;
|
||||
|
||||
@ApiModelProperty("单据类型code")
|
||||
private String documentTypeCode;
|
||||
|
||||
@ApiModelProperty("单据类型")
|
||||
private String documentType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.mhd.bms.infrastructure.feign.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 合同管理对象 contract_manage
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-07
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "合同管理对象", description = "合同管理响应对象")
|
||||
public class ContractManagePO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("合同管理id")
|
||||
private Long contractManageId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("合同编号")
|
||||
@Excel(name = "合同编号")
|
||||
private String contractNumber;
|
||||
|
||||
@ApiModelProperty("原始合同编号")
|
||||
@Excel(name = "原始合同编号")
|
||||
private String originalContractNumber;
|
||||
|
||||
@ApiModelProperty("合同名称")
|
||||
@Excel(name = "合同名称")
|
||||
private String contractName;
|
||||
|
||||
@ApiModelProperty("是否通用合同(1-是,2-否)")
|
||||
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
|
||||
private Integer commonContractFlag;
|
||||
|
||||
@ApiModelProperty("合同类型(1-仓储,2-运输)")
|
||||
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
|
||||
private Integer contractType;
|
||||
|
||||
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
|
||||
@Excel(name = "合同状态", readConverterExp = "1=-未生效,2-使用中,3-已过期,4-已作废")
|
||||
private Integer contractState;
|
||||
|
||||
@ApiModelProperty("签订单位")
|
||||
@Excel(name = "签订单位")
|
||||
private String signingUnit;
|
||||
|
||||
@ApiModelProperty("结算主体")
|
||||
@Excel(name = "结算主体")
|
||||
private String settlementCustomers;
|
||||
|
||||
@ApiModelProperty("结算主体id")
|
||||
@Excel(name = "结算主体id")
|
||||
private Long settlementCustomersId;
|
||||
|
||||
@ApiModelProperty("结算主体code")
|
||||
@Excel(name = "结算主体code")
|
||||
private String settlementCustomersCode;
|
||||
|
||||
@ApiModelProperty("我司身份(1-甲方,2-乙方)")
|
||||
@Excel(name = "我司身份", readConverterExp = "1=-甲方,2-乙方")
|
||||
private Integer ourIdentity;
|
||||
|
||||
@ApiModelProperty("账期(1-每月,2-双月,3-季度)")
|
||||
@Excel(name = "账期", readConverterExp = "1=-每月,2-双月,3-季度")
|
||||
private Integer accountingPeriod;
|
||||
|
||||
@ApiModelProperty("合同签订日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "合同签订日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date signingDate;
|
||||
|
||||
@ApiModelProperty("合同生效日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "合同生效日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date effectiveDate;
|
||||
|
||||
@ApiModelProperty("合同到期日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date expirationDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("合同正本附件地址")
|
||||
@Excel(name = "合同正本附件地址")
|
||||
private String contractOriginalUrl;
|
||||
|
||||
@ApiModelProperty("廉政协议附件地址")
|
||||
@Excel(name = "廉政协议附件地址")
|
||||
private String integrityAgreementUrl;
|
||||
|
||||
@ApiModelProperty("安全协议附件地址")
|
||||
@Excel(name = "安全协议附件地址")
|
||||
private String securityProtocolUrl;
|
||||
|
||||
@ApiModelProperty("其他附件地址")
|
||||
@Excel(name = "其他附件地址")
|
||||
private String otherAttachmentsUrl;
|
||||
|
||||
@ApiModelProperty("我司签订人")
|
||||
@Excel(name = "我司签订人")
|
||||
private String ourSinged;
|
||||
|
||||
@ApiModelProperty("我司签订人联系方式")
|
||||
@Excel(name = "我司签订人联系方式")
|
||||
private String ourSingedPhone;
|
||||
|
||||
@ApiModelProperty("我司经办人")
|
||||
@Excel(name = "我司经办人")
|
||||
private String ourOperator;
|
||||
|
||||
@ApiModelProperty("我司经办人联系方式")
|
||||
@Excel(name = "我司经办人联系方式")
|
||||
private String ourOperatorPhone;
|
||||
|
||||
@ApiModelProperty("对方签订人")
|
||||
@Excel(name = "对方签订人")
|
||||
private String theySinged;
|
||||
|
||||
@ApiModelProperty("对方签订人联系方式")
|
||||
@Excel(name = "对方签订人联系方式")
|
||||
private String theySingedPhone;
|
||||
|
||||
@ApiModelProperty("对方经办人")
|
||||
@Excel(name = "对方经办人")
|
||||
private String theyOperator;
|
||||
|
||||
@ApiModelProperty("对方经办人联系方式")
|
||||
@Excel(name = "对方经办人联系方式")
|
||||
private String theyOperatorPhone;
|
||||
|
||||
@ApiModelProperty("合同详情列表")
|
||||
private List<ContractManageDetailPO> contractManageDetailPOList;
|
||||
|
||||
@ApiModelProperty(name = "结算主体基础数据id(可以是用户id也可以是企业id)")
|
||||
private String settlementId;
|
||||
|
||||
@ApiModelProperty(name = "是否自动出账(1-是,2-否)")
|
||||
private Integer automaticFlag;
|
||||
|
||||
@ApiModelProperty("出账日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date paymentDate;
|
||||
|
||||
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
|
||||
private Integer principalType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.mhd.bms.infrastructure.feign.vo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 费用科目对象 expense_account
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "费用科目对象", description = "费用科目响应对象")
|
||||
public class ExpenseAccountPO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("费用科目id")
|
||||
private Long expenseAccountId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("科目编码")
|
||||
@Excel(name = "科目编码")
|
||||
private String subjectCode;
|
||||
|
||||
@ApiModelProperty("科目名称")
|
||||
@Excel(name = "科目名称")
|
||||
private String subjectName;
|
||||
|
||||
@ApiModelProperty("计费属性编码")
|
||||
@Excel(name = "计费属性编码")
|
||||
private String billingAttributesCode;
|
||||
|
||||
@ApiModelProperty("计费属性")
|
||||
@Excel(name = "计费属性")
|
||||
private String billingAttributes;
|
||||
|
||||
@ApiModelProperty("所属模块编码")
|
||||
@Excel(name = "所属模块编码")
|
||||
private String belongModuleCode;
|
||||
|
||||
@ApiModelProperty("所属编码")
|
||||
@Excel(name = "所属编码")
|
||||
private String belongModule;
|
||||
|
||||
@ApiModelProperty("是否一级科目(1-是,2-否)")
|
||||
@Excel(name = "是否一级科目", readConverterExp = "1=-是,2-否")
|
||||
private Integer firstSubjectFlag;
|
||||
|
||||
@ApiModelProperty("上级科目编码")
|
||||
@Excel(name = "上级科目编码")
|
||||
private String upperSubjectCode;
|
||||
|
||||
@ApiModelProperty("上级科目名称")
|
||||
@Excel(name = "上级科目名称")
|
||||
private String upperSubject;
|
||||
|
||||
@ApiModelProperty("启用状态(1-启动,2-停用)")
|
||||
@Excel(name = "启用状态", readConverterExp = "1=-启动,2-停用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("关联服务项管理id")
|
||||
@Excel(name = "关联服务项管理id")
|
||||
private Long serviceItemsManageId;
|
||||
|
||||
/** 收支类型(1-收入,2-支出) */
|
||||
@ApiModelProperty(name = "收支类型")
|
||||
private Integer accountExpenseType;
|
||||
|
||||
private List<ExpenseAccountPO> expenseAccountPOList;
|
||||
|
||||
@ApiModelProperty("服务项编码")
|
||||
@Excel(name = "服务项编码")
|
||||
private String serviceItemsCode;
|
||||
|
||||
@ApiModelProperty("服务项名称")
|
||||
@Excel(name = "服务项名称")
|
||||
private String serviceItemsName;
|
||||
|
||||
@ApiModelProperty("服务项税率")
|
||||
@Excel(name = "服务项税率")
|
||||
private BigDecimal taxRate;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mhd.bms.infrastructure.feign.vo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 服务项管理对象 service_items_manage
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-06-03
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "服务项管理对象", description = "服务项管理响应对象")
|
||||
public class ServiceItemsManagePO extends BaseVOEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("服务项管理id")
|
||||
private Long serviceItemsManageId;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("服务项编码")
|
||||
@Excel(name = "服务项编码")
|
||||
private String serviceItemsCode;
|
||||
|
||||
@ApiModelProperty("服务项名称")
|
||||
@Excel(name = "服务项名称")
|
||||
private String serviceItemsName;
|
||||
|
||||
@ApiModelProperty("服务项税率")
|
||||
@Excel(name = "服务项税率")
|
||||
private BigDecimal taxRate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mhd.bms.infrastructure.utils;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
|
||||
import com.mhd.common.core.utils.AESUtil;
|
||||
import com.mhd.common.core.utils.SpringUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.common.security.utils.password.PasswordUtil;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 校验支付密码
|
||||
**/
|
||||
public class CheckPasswordUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 校验支付密码
|
||||
* @param payPassword 需要校验的密码 (前端加密后的)
|
||||
* @param userId 校验密码查询的用户id (不传默认当前登录用户)
|
||||
*/
|
||||
public static void checkPayPassword(String payPassword,Long userId) {
|
||||
//获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//获取校验人id
|
||||
userId = userId == null ? loginUser.getUserid() : userId;
|
||||
//解密支付密码
|
||||
payPassword = AESUtil.decrypt(payPassword);
|
||||
//此处不用缓存中的数据,用数据库实时查询
|
||||
UserPo userPo = new UserPo();
|
||||
UserServiceFeign userServiceFeign = SpringUtils.getBean(UserServiceFeign.class);
|
||||
AjaxResult ajaxResult = userServiceFeign.getInfo(userId);
|
||||
if("200".equals(String.valueOf(ajaxResult.get("code")))){
|
||||
userPo = JSONUtil.toBean(JSONObject.toJSONString(ajaxResult.get("data")), UserPo.class);
|
||||
if(null == userPo){
|
||||
throw new ServiceException("用户信息不存在");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isEmpty(userPo.getUserPayPassword())){
|
||||
throw new ServiceException("请设置支付密码");
|
||||
}
|
||||
//校验用户支付密码是否正确
|
||||
if (!PasswordUtil.matchesPassword(userPo.getUserAccount(), payPassword, userPo.getUserSalt(), userPo.getUserPayPassword())) {
|
||||
throw new ServiceException("密码错误");
|
||||
}
|
||||
//TODO 设置密码错误次数,并校验
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mhd.bms.infrastructure.utils;
|
||||
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nfunk.jep.JEP;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* JEP动态计算
|
||||
**/
|
||||
@Slf4j
|
||||
public class DynamicCalculationUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 动态计算
|
||||
* @param formula 计算公式
|
||||
* @return 计算结果
|
||||
*/
|
||||
public static BigDecimal calculate(String formula) {
|
||||
try {
|
||||
|
||||
// 创建 JEP 实例
|
||||
JEP jep = new JEP();
|
||||
// 设置要计算的表达式
|
||||
jep.parseExpression(formula);
|
||||
// 计算表达式的结果
|
||||
double result = jep.getValue();
|
||||
// 将结果转换为 BigDecimal
|
||||
return new BigDecimal(result);
|
||||
} catch (Exception e) {
|
||||
// 处理可能的异常
|
||||
log.error("动态计算失败:"+e.getMessage());
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mhd.bms.infrastructure.utils;
|
||||
|
||||
/**
|
||||
* @author ZhouGY
|
||||
* @title UniqueKeyUtil
|
||||
* @description: 分布式锁-获取唯一key值
|
||||
* @date 023/11/6 11:26
|
||||
**/
|
||||
public class UniqueKeyUtil {
|
||||
private final static String BILLING_KEY = "billing";// 生成账单 前缀
|
||||
|
||||
|
||||
public static String getBillingKey(String key){
|
||||
return String.format("%s:%s", BILLING_KEY , key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user