提交修改
This commit is contained in:
parent
21a14f14a9
commit
d914556d42
@ -39,6 +39,7 @@ public interface VvMySettlementDao extends BaseMapper<VvMySettlementEntity> {
|
||||
int deleteVvMySettlementById(@Param("id")Long id);
|
||||
|
||||
|
||||
@OrderBy(VvMySettlementEntity.id_)
|
||||
List<VvMySettlementEntity> selectByCondition(IPage page,
|
||||
@IF String status,
|
||||
@IF @Column(VvMySettlementEntity.amount_) @GE BigDecimal minAmount,
|
||||
|
||||
@ -21,46 +21,160 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvMySettlementEntity:";
|
||||
|
||||
public final static String all = CLASS_NAME + "*";
|
||||
public final static String amount_ = CLASS_NAME + "amount"; // 金额
|
||||
public final static String apply_reason = CLASS_NAME + "apply_reason"; // 原因
|
||||
public final static String apply_user_name = CLASS_NAME + "apply_user_name"; // 谁结算的
|
||||
public final static String approval_user_name = CLASS_NAME + "approval_user_name"; // 审批用户名
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间
|
||||
public final static String features_ = CLASS_NAME + "features"; // 特点
|
||||
public final static String id_ = CLASS_NAME + "id"; //
|
||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String user_name = CLASS_NAME + "user_name"; // 谁结算的
|
||||
public final static String operate_ = CLASS_NAME + "operate"; // 操作 + ,-
|
||||
public final static String amount_ = CLASS_NAME + "amount"; // 金额
|
||||
public final static String features_ = CLASS_NAME + "features"; // 特点
|
||||
public final static String status_ = CLASS_NAME + "status"; // apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
public final static String remain_amount = CLASS_NAME + "remain_amount"; // 剩下金额
|
||||
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间
|
||||
public final static String modify_timestamp = CLASS_NAME + "modify_timestamp"; // 修改时间
|
||||
public final static String operate_ = CLASS_NAME + "operate"; // 操作 + ,-
|
||||
public final static String reject_reason = CLASS_NAME + "reject_reason"; // 拒绝原因
|
||||
public final static String remain_amount = CLASS_NAME + "remain_amount"; // 剩下金额
|
||||
public final static String status_ = CLASS_NAME + "status"; // apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
public final static String type_ = CLASS_NAME + "type"; // common,公款
|
||||
//金额
|
||||
@TableId(value = "amount", type = IdType.AUTO)
|
||||
private BigDecimal amount;
|
||||
//原因
|
||||
private String applyReason;
|
||||
//谁结算的
|
||||
private String applyUserName;
|
||||
//审批用户名
|
||||
private String approvalUserName;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//创建时间
|
||||
private Long createTimestamp;
|
||||
//特点
|
||||
private String features;
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
//是否删除:0 否 1 删除
|
||||
private Integer isDelete;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//修改时间
|
||||
private Date modifyTime;
|
||||
//谁结算的
|
||||
private String userName;
|
||||
//操作 + , -
|
||||
private String operate;
|
||||
//金额
|
||||
private BigDecimal amount;
|
||||
//特点
|
||||
private String features;
|
||||
//apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
private String status;
|
||||
//剩下金额
|
||||
private BigDecimal remainAmount;
|
||||
//创建时间
|
||||
private Long createTimestamp;
|
||||
//修改时间
|
||||
private Long modifyTimestamp;
|
||||
//操作 + ,-
|
||||
private String operate;
|
||||
//拒绝原因
|
||||
private String rejectReason;
|
||||
//剩下金额
|
||||
private BigDecimal remainAmount;
|
||||
//apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
private String status;
|
||||
//common,公款
|
||||
private String type;
|
||||
/**
|
||||
* 金额
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
/**
|
||||
* 金额
|
||||
* @param amount
|
||||
*/
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 原因
|
||||
* @return
|
||||
*/
|
||||
public String getApplyReason() {
|
||||
return applyReason;
|
||||
}
|
||||
/**
|
||||
* 原因
|
||||
* @param applyReason
|
||||
*/
|
||||
public void setApplyReason(String applyReason) {
|
||||
this.applyReason = applyReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* 谁结算的
|
||||
* @return
|
||||
*/
|
||||
public String getApplyUserName() {
|
||||
return applyUserName;
|
||||
}
|
||||
/**
|
||||
* 谁结算的
|
||||
* @param applyUserName
|
||||
*/
|
||||
public void setApplyUserName(String applyUserName) {
|
||||
this.applyUserName = applyUserName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批用户名
|
||||
* @return
|
||||
*/
|
||||
public String getApprovalUserName() {
|
||||
return approvalUserName;
|
||||
}
|
||||
/**
|
||||
* 审批用户名
|
||||
* @param approvalUserName
|
||||
*/
|
||||
public void setApprovalUserName(String approvalUserName) {
|
||||
this.approvalUserName = approvalUserName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* @return
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
/**
|
||||
* 创建时间
|
||||
* @param createTime
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* @return
|
||||
*/
|
||||
public Long getCreateTimestamp() {
|
||||
return createTimestamp;
|
||||
}
|
||||
/**
|
||||
* 创建时间
|
||||
* @param createTimestamp
|
||||
*/
|
||||
public void setCreateTimestamp(Long createTimestamp) {
|
||||
this.createTimestamp = createTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 特点
|
||||
* @return
|
||||
*/
|
||||
public String getFeatures() {
|
||||
return features;
|
||||
}
|
||||
/**
|
||||
* 特点
|
||||
* @param features
|
||||
*/
|
||||
public void setFeatures(String features) {
|
||||
this.features = features;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -91,21 +205,6 @@ private static final long serialVersionUID = 1L;
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* @return
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
/**
|
||||
* 创建时间
|
||||
* @param createTime
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
* @return
|
||||
@ -122,18 +221,18 @@ private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* 谁结算的
|
||||
* 修改时间
|
||||
* @return
|
||||
*/
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
public Long getModifyTimestamp() {
|
||||
return modifyTimestamp;
|
||||
}
|
||||
/**
|
||||
* 谁结算的
|
||||
* @param userName
|
||||
* 修改时间
|
||||
* @param modifyTimestamp
|
||||
*/
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
public void setModifyTimestamp(Long modifyTimestamp) {
|
||||
this.modifyTimestamp = modifyTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,48 +251,18 @@ private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额
|
||||
* 拒绝原因
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
public String getRejectReason() {
|
||||
return rejectReason;
|
||||
}
|
||||
/**
|
||||
* 金额
|
||||
* @param amount
|
||||
* 拒绝原因
|
||||
* @param rejectReason
|
||||
*/
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 特点
|
||||
* @return
|
||||
*/
|
||||
public String getFeatures() {
|
||||
return features;
|
||||
}
|
||||
/**
|
||||
* 特点
|
||||
* @param features
|
||||
*/
|
||||
public void setFeatures(String features) {
|
||||
this.features = features;
|
||||
}
|
||||
|
||||
/**
|
||||
* apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
* @return
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
* @param status
|
||||
*/
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
public void setRejectReason(String rejectReason) {
|
||||
this.rejectReason = rejectReason;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -212,33 +281,18 @@ private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
* @return
|
||||
*/
|
||||
public Long getCreateTimestamp() {
|
||||
return createTimestamp;
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* 创建时间
|
||||
* @param createTimestamp
|
||||
* apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
* @param status
|
||||
*/
|
||||
public void setCreateTimestamp(Long createTimestamp) {
|
||||
this.createTimestamp = createTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
* @return
|
||||
*/
|
||||
public Long getModifyTimestamp() {
|
||||
return modifyTimestamp;
|
||||
}
|
||||
/**
|
||||
* 修改时间
|
||||
* @param modifyTimestamp
|
||||
*/
|
||||
public void setModifyTimestamp(Long modifyTimestamp) {
|
||||
this.modifyTimestamp = modifyTimestamp;
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,18 +313,21 @@ private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvMySettlementEntity{" +
|
||||
",amount=" + amount +
|
||||
",applyReason=" + applyReason +
|
||||
",applyUserName=" + applyUserName +
|
||||
",approvalUserName=" + approvalUserName +
|
||||
",createTime=" + createTime +
|
||||
",createTimestamp=" + createTimestamp +
|
||||
",features=" + features +
|
||||
",id=" + id +
|
||||
",isDelete=" + isDelete +
|
||||
",createTime=" + createTime +
|
||||
",modifyTime=" + modifyTime +
|
||||
",userName=" + userName +
|
||||
",operate=" + operate +
|
||||
",amount=" + amount +
|
||||
",features=" + features +
|
||||
",status=" + status +
|
||||
",remainAmount=" + remainAmount +
|
||||
",createTimestamp=" + createTimestamp +
|
||||
",modifyTimestamp=" + modifyTimestamp +
|
||||
",operate=" + operate +
|
||||
",rejectReason=" + rejectReason +
|
||||
",remainAmount=" + remainAmount +
|
||||
",status=" + status +
|
||||
",type=" + type +
|
||||
"}";
|
||||
}
|
||||
|
||||
@ -3,9 +3,10 @@ package com.heyu.api.data.enums;
|
||||
/****
|
||||
* apply_for_approval:同意审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
*/
|
||||
public enum SettlementStatusEnums {
|
||||
public enum MySettlementStatusEnums {
|
||||
// apply_for_approval:同意审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
apply_for_approval("apply_for_approval", "申请审批"),
|
||||
no_approval("no_approval", "不需要审批"),
|
||||
agree_approval("agree_approval", "同意审批"),
|
||||
reject_approval("reject_approval", "拒绝审批");
|
||||
|
||||
@ -14,7 +15,7 @@ public enum SettlementStatusEnums {
|
||||
private String desc;
|
||||
|
||||
|
||||
SettlementStatusEnums(String status, String desc) {
|
||||
MySettlementStatusEnums(String status, String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
@ -48,8 +48,8 @@ public class MysqlMain_update {
|
||||
}
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
|
||||
list.add(new TablesBean("vv_my_settlement"));
|
||||
list.add(new TablesBean("vv_my_account"));
|
||||
|
||||
//list.add(new TablesBean("vv_trade_order"));
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.heyu.api.alibaba.request.mm.order;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.alibaba.request.mm.AdminBaseDTO;
|
||||
import lombok.Data;
|
||||
|
||||
@ -10,7 +11,7 @@ public class VVMySettlementApprovalRequest extends AdminBaseDTO {
|
||||
|
||||
|
||||
// 结算状态
|
||||
// 'apply_for_approval:同意审批,agree_approval: 同意审批 ,reject_approval:拒绝审批 '
|
||||
//agree_approval: 同意审批 ,reject_approval:拒绝审批 '
|
||||
private String status;
|
||||
|
||||
|
||||
@ -19,6 +20,20 @@ public class VVMySettlementApprovalRequest extends AdminBaseDTO {
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
|
||||
/***
|
||||
* 拒绝原因
|
||||
*/
|
||||
private String rejectReason;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
VVMySettlementApprovalRequest vvMySettlementApprovalRequest = new VVMySettlementApprovalRequest();
|
||||
vvMySettlementApprovalRequest.setId(9L);
|
||||
vvMySettlementApprovalRequest.setStatus("agree_approval");
|
||||
System.out.println(JSON.toJSONString(vvMySettlementApprovalRequest));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ import com.heyu.api.data.entity.vv.VvMyAccountEntity;
|
||||
import com.heyu.api.data.entity.vv.VvMySettlementEntity;
|
||||
import com.heyu.api.data.enums.AccountOperateEnums;
|
||||
import com.heyu.api.data.enums.AccountTypeEnums;
|
||||
import com.heyu.api.data.enums.MySettlementStatusEnums;
|
||||
import com.heyu.api.data.utils.BigDecimalUtil;
|
||||
import com.heyu.api.data.utils.DingDingSettlementUtils;
|
||||
import com.heyu.api.data.utils.R;
|
||||
@ -39,6 +40,7 @@ public class AdminMySettlementController {
|
||||
|
||||
/***
|
||||
* 列表
|
||||
* http://localhost:8888/mm/my/settlement/list
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestBody VVMySettlementRequest vvMySettlementRequest) {
|
||||
@ -61,44 +63,90 @@ public class AdminMySettlementController {
|
||||
MyAccountDTO myAccountDTO = new MyAccountDTO();
|
||||
myAccountDTO.setVvMyAccountEntity(vvMyAccountEntity);
|
||||
myAccountDTO.setPageUtils(pageUtils);
|
||||
|
||||
return R.ok().setData(myAccountDTO);
|
||||
}
|
||||
|
||||
/***
|
||||
* 插入数据
|
||||
* http://localhost:8888/mm/my/settlement/add
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
public R add(@RequestBody VvMySettlementEntity vvMySettlementEntity) {
|
||||
vvMySettlementDao.insertOrUpdateVvMySettlement(vvMySettlementEntity);
|
||||
vvMySettlementEntity.setType(AccountTypeEnums.common.getType());
|
||||
if (AccountOperateEnums.plus.getSign().equals(vvMySettlementEntity.getOperate())) {
|
||||
VvMyAccountEntity vvMyAccountEntity = vvMyAccountDao.selectVvMyAccount(AccountTypeEnums.common.getType());
|
||||
vvMyAccountEntity.setAmount(vvMySettlementEntity.getAmount().add(vvMyAccountEntity.getAmount()));
|
||||
vvMyAccountEntity.setRechargeAmount(vvMySettlementEntity.getAmount().add(vvMyAccountEntity.getRechargeAmount()));
|
||||
vvMyAccountDao.updateVvMyAccountById(vvMyAccountEntity);
|
||||
String content = vvMySettlementEntity.getApplyUserName()
|
||||
+ ",充值了:" + vvMySettlementEntity.getAmount()
|
||||
+ ",账户余额:" +vvMyAccountEntity.getAmount() ;
|
||||
DingDingSettlementUtils.sendText(content, "账户充值");
|
||||
vvMySettlementEntity.setStatus(MySettlementStatusEnums.no_approval.getStatus());
|
||||
vvMySettlementEntity.setRemainAmount(vvMySettlementEntity.getAmount());
|
||||
} else {
|
||||
String content = vvMySettlementEntity.getUserName() + ",提交了报销单,报销金额:" + vvMySettlementEntity.getAmount();
|
||||
String content = vvMySettlementEntity.getApplyUserName()
|
||||
+ ",提交了报销单,报销金额:" + vvMySettlementEntity.getAmount()
|
||||
+ ",申请原因:" + vvMySettlementEntity.getApplyReason();
|
||||
DingDingSettlementUtils.sendText(content, "报销申请");
|
||||
vvMySettlementEntity.setStatus(MySettlementStatusEnums.apply_for_approval.getStatus());
|
||||
}
|
||||
vvMySettlementEntity.setCreateTimestamp(System.currentTimeMillis());
|
||||
vvMySettlementEntity.setModifyTimestamp(System.currentTimeMillis());
|
||||
vvMySettlementDao.insertVvMySettlement(vvMySettlementEntity);
|
||||
|
||||
return R.ok().setData(vvMySettlementEntity);
|
||||
}
|
||||
|
||||
/***
|
||||
* 审批
|
||||
* apply_for_approval:申请审批,agree_approval: 同意审批 ,reject_approval:拒绝审批
|
||||
*
|
||||
*
|
||||
*
|
||||
* http://localhost:8888/mm/my/settlement/approval
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RequestMapping("/approval")
|
||||
public R approval(@RequestBody VVMySettlementApprovalRequest vvMySettlementApprovalRequest) {
|
||||
|
||||
|
||||
VvMySettlementEntity vvMySettlement = vvMySettlementDao.selectVvMySettlementById(vvMySettlementApprovalRequest.getId());
|
||||
VvMyAccountEntity vvMyAccountEntity = vvMyAccountDao.selectVvMyAccount(AccountTypeEnums.common.getType());
|
||||
vvMySettlement.setApprovalUserName(vvMySettlementApprovalRequest.getUserName());
|
||||
|
||||
BigDecimal remainAmount = vvMySettlement.getRemainAmount();
|
||||
BigDecimal lastRemainAmount = BigDecimalUtil.subtract(remainAmount, vvMySettlement.getRemainAmount());
|
||||
|
||||
if(!MySettlementStatusEnums.apply_for_approval.getStatus().equals(vvMySettlement.getStatus())){
|
||||
return R.error("状态不对");
|
||||
}
|
||||
|
||||
if (MySettlementStatusEnums.agree_approval.getStatus().equals(vvMySettlementApprovalRequest.getStatus())) {
|
||||
BigDecimal acountAmount = vvMyAccountEntity.getAmount();
|
||||
BigDecimal lastRemainAmount = BigDecimalUtil.subtract(acountAmount, vvMySettlement.getAmount());
|
||||
vvMySettlement.setRemainAmount(lastRemainAmount);
|
||||
|
||||
vvMyAccountEntity.setAmount(lastRemainAmount);
|
||||
vvMyAccountEntity.setSubAmount(vvMyAccountEntity.getSubAmount().add(vvMySettlement.getAmount()));
|
||||
vvMyAccountDao.updateVvMyAccountById(vvMyAccountEntity);
|
||||
String content = vvMySettlementApprovalRequest.getUserName()
|
||||
+ ",同意了:" + vvMySettlement.getApplyUserName()
|
||||
+ ",申请的:" + vvMySettlement.getAmount()
|
||||
+ ",申请原因:" + vvMySettlement.getApplyReason()
|
||||
+ ",账户余额:" + vvMyAccountEntity.getAmount();
|
||||
DingDingSettlementUtils.sendText(content, "同意审批");
|
||||
} else if (MySettlementStatusEnums.reject_approval.getStatus().equals(vvMySettlementApprovalRequest.getStatus())) {
|
||||
String content = vvMySettlementApprovalRequest.getUserName()
|
||||
+ ",拒绝了:" + vvMySettlement.getApplyUserName()
|
||||
+ ",申请的" + vvMySettlement.getAmount()
|
||||
+ ",账户余额:" + vvMyAccountEntity.getAmount()
|
||||
+ ",拒绝原因:" + vvMySettlementApprovalRequest.getRejectReason();
|
||||
DingDingSettlementUtils.sendText(content, "拒绝审批");
|
||||
vvMySettlement.setRejectReason(vvMySettlementApprovalRequest.getRejectReason());
|
||||
vvMySettlement.setRemainAmount(vvMyAccountEntity.getAmount());
|
||||
}
|
||||
vvMySettlement.setModifyTimestamp(System.currentTimeMillis());
|
||||
vvMySettlement.setStatus(vvMySettlementApprovalRequest.getStatus());
|
||||
vvMySettlementDao.insertOrUpdateVvMySettlement(vvMySettlement);
|
||||
vvMySettlementDao.updateVvMySettlementById(vvMySettlement);
|
||||
return R.ok().setData(vvMySettlement);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user