增加账户

localizer
ljw 2025-09-29 12:06:37 +08:00
parent 8c1372e23c
commit 6f26e0acb8
4 changed files with 26 additions and 9 deletions

View File

@ -60,7 +60,7 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
}
@Transactional(rollbackFor = Exception.class)
public void add(AddBizCompanyParam addBizCompanyParam) {
public Long add(AddBizCompanyParam addBizCompanyParam) {
AppProperties.DefaultPlace defaultPlace = appProperties.getDefaultPlace();
BizCompanyEntity bizCompanyEntity = BeanUtil.copyProperties(addBizCompanyParam, BizCompanyEntity.class)
.setAuditStatus(AuditStatus.DaiShenHe)
@ -69,6 +69,7 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
.setProvinceName(defaultPlace.getProvinceName())
.setCityName(defaultPlace.getCityName());
this.save(bizCompanyEntity);
return bizCompanyEntity.getId();
}
/**

View File

@ -897,8 +897,15 @@ public class OrderInfoService extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
extraItems.add(0, productItem);
for (OrderExpenseItemsEntity item : extraItems) {
// total_money = quantity * unit_price
BigDecimal totalMoney = item.getUnitPrice().multiply(new BigDecimal(item.getQuantity() == null ? 0 : item.getQuantity()));
// total_money = quantity * unit_price 如果计费策略是按吨总金额计算时数量需要÷1000
BigDecimal quantity = new BigDecimal(item.getQuantity() == null ? 0 : item.getQuantity());
// 如果计费策略是按吨数量需要除以1000
if (MoneyStrategy.Dun.getVal().equals(item.getMoneyStrategy())) {
quantity = quantity.divide(new BigDecimal("1000"), 6, BigDecimal.ROUND_HALF_UP);
}
BigDecimal totalMoney = item.getUnitPrice().multiply(quantity);
// settle_money = total_money + discount_money + revise_moneydiscount、revise 可为正负)
BigDecimal discount = item.getDiscountMoney() == null ? BigDecimal.ZERO : item.getDiscountMoney();
BigDecimal revise = item.getReviseMoney() == null ? BigDecimal.ZERO : item.getReviseMoney();

View File

@ -15,6 +15,8 @@ import com.njzscloud.common.security.util.SecurityUtil;
import com.njzscloud.supervisory.biz.constant.BizObj;
import com.njzscloud.supervisory.biz.pojo.param.AddBizCompanyParam;
import com.njzscloud.supervisory.biz.service.BizCompanyService;
import com.njzscloud.supervisory.money.pojo.entity.MoneyAccountEntity;
import com.njzscloud.supervisory.money.service.MoneyAccountService;
import com.njzscloud.supervisory.sys.role.pojo.entity.RoleEntity;
import com.njzscloud.supervisory.sys.role.pojo.result.RoleDetailResult;
import com.njzscloud.supervisory.sys.user.contant.Gender;
@ -43,6 +45,7 @@ public class UserService extends ServiceImpl<UserMapper, UserEntity> implements
private final UserAccountService userAccountService;
private final UserRoleService userRoleService;
private final BizCompanyService bizCompanyService;
private final MoneyAccountService moneyAccountService;
/**
*
@ -143,7 +146,6 @@ public class UserService extends ServiceImpl<UserMapper, UserEntity> implements
public void register(UserRegisterParam userRegisterParam) {
UserRegisterParam.Account account = userRegisterParam.getAccount();
Assert.notNull(account, () -> Exceptions.clierr("账号信息不能为空"));
BizObj bizObj = userRegisterParam.getBizObj();
if (bizObj == BizObj.GeRen) {
Assert.notBlank(account.getPhone(), () -> Exceptions.clierr("手机号不能为空"));
@ -181,15 +183,22 @@ public class UserService extends ServiceImpl<UserMapper, UserEntity> implements
AddUserParam addUserParam = BeanUtil.copyProperties(userRegisterParam, AddUserParam.class);
addUserParam.setAccount(BeanUtil.copyProperties(account, AddUserAccountParam.class));
Long userId = this.add(addUserParam);
if (bizObj == BizObj.GeRen) return;
MoneyAccountEntity entity = new MoneyAccountEntity();
if (bizObj == BizObj.GeRen) {
entity.setUserId(userId);
moneyAccountService.add(entity);
return;
}
UserRegisterParam.Company company = userRegisterParam.getCompany();
Assert.notNull(company, "公司信息不能为空");
AddBizCompanyParam addBizCompanyParam = BeanUtil
.copyProperties(company, AddBizCompanyParam.class)
.setUserId(userId);
bizCompanyService.add(addBizCompanyParam);
Long companyId = bizCompanyService.add(addBizCompanyParam);
// 添加账户信息
entity.setStationId(companyId);
moneyAccountService.add(entity);
}
/**

View File

@ -22,7 +22,7 @@
END as moneyType
FROM money_account ma
LEFT JOIN sys_user u ON ma.user_id = u.id
LEFT JOIN biz_company bc ON ma.station_id = bc.id AND bc.station = 1
LEFT JOIN biz_company bc ON ma.station_id = bc.id
<where>
<if test="entity.name != null and entity.name != ''">
AND (
@ -64,7 +64,7 @@
END as moneyType
FROM money_account ma
LEFT JOIN sys_user u ON ma.user_id = u.id
LEFT JOIN biz_company bc ON ma.station_id = bc.id AND bc.station = 1
LEFT JOIN biz_company bc ON ma.station_id = bc.id
WHERE ma.id = #{id}
</select>