增加默认账户的功能

This commit is contained in:
季圣华
2017-12-10 23:13:37 +08:00
parent ad74d8057b
commit 9f18f0bc75
8 changed files with 152 additions and 28 deletions

View File

@@ -220,6 +220,41 @@ public class AccountAction extends BaseAction<AccountModel>
, tipType, "更新结算账户ID为 "+ model.getAccountID() + " " + tipMsg + "", "更新结算账户" + tipMsg));
}
/**
* 更新结算账户-设置是否默认
* @return
*/
public void updateAmountIsDefault() {
Boolean flag = false;
try {
Account Account = accountService.get(model.getAccountID());
Account.setIsDefault(model.getIsDefault());
accountService.update(Account);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e) {
Log.errorFileSync(">>>>>>>>>>>>>修改结算账户ID为 " + model.getAccountID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally {
try {
toClient(flag.toString());
}
catch (IOException e) {
Log.errorFileSync(">>>>>>>>>>>>修改结算账户回写客户端结果异常", e);
}
}
//如果改为默认账户时记录日志
if(model.getIsDefault()) {
logService.create(new Logdetails(getUser(), "更新默认账户", model.getClientIp(), new Timestamp(System.currentTimeMillis()),
tipType, "更新账户ID"+ model.getAccountID() + "为默认账户" + tipMsg + "", "更新默认账户" + tipMsg));
}
}
/**
* 批量删除指定ID结算账户
* @return
@@ -314,6 +349,7 @@ public class AccountAction extends BaseAction<AccountModel>
Double currentAmount = getAccountSum(account.getId(),"") + getAccountSumByHead(account.getId(), "") + getAccountSumByDetail(account.getId(), "") + getManyAccountSum(account.getId(), "") + account.getInitialAmount();
String currentAmountFmt=df.format(currentAmount);
item.put("currentAmount", currentAmountFmt); //当前余额
item.put("isDefault", account.getIsDefault()); //是否默认
item.put("remark", account.getRemark());
item.put("op", 1);
dataArray.add(item);

View File

@@ -8,6 +8,7 @@ public class Account implements java.io.Serializable
private String SerialNo;
private Double InitialAmount;
private Double CurrentAmount;
private Boolean IsDefault;
private String Remark;
public Account()
@@ -20,11 +21,12 @@ public class Account implements java.io.Serializable
this.Id = Id;
}
public Account(String name, String serialNo, Double initialAmount, Double currentAmount, String remark) {
public Account(String name, String serialNo, Double initialAmount, Double currentAmount, Boolean isDefault, String remark) {
Name = name;
SerialNo = serialNo;
InitialAmount = initialAmount;
CurrentAmount = currentAmount;
IsDefault = isDefault;
Remark = remark;
}
@@ -78,6 +80,14 @@ public class Account implements java.io.Serializable
return CurrentAmount;
}
public Boolean getIsDefault() {
return IsDefault;
}
public void setIsDefault(Boolean isDefault) {
IsDefault = isDefault;
}
public void setRemark(String remark)
{
Remark = remark;

View File

@@ -28,6 +28,11 @@ public class AccountModel implements Serializable
*/
private Double currentAmount;
/**
* 是否设为默认
*/
private Boolean isDefault;
/**
* 备注
*/
@@ -108,6 +113,14 @@ public class AccountModel implements Serializable
return currentAmount;
}
public Boolean getIsDefault() {
return isDefault;
}
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
public void setRemark(String remark)
{
this.remark = remark;