|
|
@@ -7,6 +7,7 @@ import com.dk.common.model.pojo.PageList;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
|
import com.dk.mdm.infrastructure.convert.mst.MoneyAccountConvert;
|
|
|
+import com.dk.mdm.infrastructure.util.AuthUtils;
|
|
|
import com.dk.mdm.mapper.mac.MacTransferItemMapper;
|
|
|
import com.dk.mdm.mapper.mac.MacTransferMapper;
|
|
|
import com.dk.mdm.mapper.mst.MoneyAccountItemMapper;
|
|
|
@@ -82,7 +83,8 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
|
|
|
@Autowired
|
|
|
private MoneyAccountConvert moneyAccountConvert;
|
|
|
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private AuthUtils authUtils;
|
|
|
/**
|
|
|
* @desc : 条件查询
|
|
|
* @author : 宋扬
|
|
|
@@ -137,6 +139,19 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
|
|
|
// 获取显示顺序
|
|
|
Integer displayNo = commonService.getMaxDisplayNo(Constant.DisplayNoTable.MONEYACCOUNT);
|
|
|
moneyAccount.setMacId(codeMap.get("outId").toString()).setMacCode(codeMap.get("outNote").toString()).setDisplayNo(displayNo);
|
|
|
+ if (moneyAccount.getFlgDefault()) { //如果新建的时候 这个设置成默认 那么把默认的 反写false
|
|
|
+ //查询本公司 默认的资金账户
|
|
|
+ List<MoneyAccountResponse> itemList = moneyAccountMapper.selectByCond(new MoneyAccountQuery().setFlgDefault(true).setCpId(authUtils.getStaff().getCpId()).setFlgValid(true));
|
|
|
+ if (itemList.size() > 0) { //说明有 且只有一条
|
|
|
+ MoneyAccountResponse moneyAccountResponse = itemList.get(0); //原先默认的资金账户
|
|
|
+ MoneyAccount moneyAccountDefault = new MoneyAccount();
|
|
|
+ moneyAccountDefault.setFlgDefault(false);
|
|
|
+ moneyAccountDefault.setMacId(moneyAccountResponse.getMacId());
|
|
|
+ //把原先默认的资金账户设置为false
|
|
|
+ super.update(moneyAccountDefault, new UpdateWrapper<MoneyAccount>().lambda().eq(MoneyAccount::getMacId,
|
|
|
+ UUID.fromString(moneyAccountDefault.getMacId())));
|
|
|
+ }
|
|
|
+ }
|
|
|
super.insert(moneyAccount);
|
|
|
|
|
|
// 插入资金转账表
|
|
|
@@ -174,6 +189,19 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
|
|
|
public ResponseResultVO<Boolean> update(MoneyAccountVO moneyAccountVO) {
|
|
|
// 转化实体
|
|
|
MoneyAccount moneyAccount = moneyAccountConvert.convertToPo(moneyAccountVO);
|
|
|
+ if (moneyAccount.getFlgDefault()) { //如果编辑的时候 这个设置成默认 那么把默认的 反写false
|
|
|
+ //查询本公司 默认的资金账户
|
|
|
+ List<MoneyAccountResponse> itemList = moneyAccountMapper.selectByCond(new MoneyAccountQuery().setFlgDefault(true).setCpId(authUtils.getStaff().getCpId()).setFlgValid(true));
|
|
|
+ if (itemList.size() > 0) { //说明有 且只有一条
|
|
|
+ MoneyAccountResponse moneyAccountResponse = itemList.get(0); //原先默认的资金账户
|
|
|
+ MoneyAccount moneyAccountDefault = new MoneyAccount();
|
|
|
+ moneyAccountDefault.setFlgDefault(false);
|
|
|
+ moneyAccountDefault.setMacId(moneyAccountResponse.getMacId());
|
|
|
+ //把原先默认的资金账户设置为false
|
|
|
+ super.update(moneyAccountDefault, new UpdateWrapper<MoneyAccount>().lambda().eq(MoneyAccount::getMacId,
|
|
|
+ UUID.fromString(moneyAccountDefault.getMacId())));
|
|
|
+ }
|
|
|
+ }
|
|
|
super.update(moneyAccount, new UpdateWrapper<MoneyAccount>().lambda().eq(MoneyAccount::getMacId,
|
|
|
UUID.fromString(moneyAccount.getMacId())));
|
|
|
|