|
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
import com.aliyun.dts.subscribe.clients.record.OperationType;
|
|
import com.aliyun.dts.subscribe.clients.record.OperationType;
|
|
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.kxs.product.api.model.KxsMachine;
|
|
import com.kxs.product.api.model.KxsMachine;
|
|
@@ -26,11 +27,13 @@ import com.kxs.user.api.model.KxsUserAmount;
|
|
|
import com.kxs.user.api.model.KxsUserReal;
|
|
import com.kxs.user.api.model.KxsUserReal;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 客小爽仓库表(KxsWarehouse)表服务实现类
|
|
* 客小爽仓库表(KxsWarehouse)表服务实现类
|
|
|
*
|
|
*
|
|
@@ -255,6 +258,7 @@ public class KxsWarehouseServiceImpl extends ServiceImpl<KxsWarehouseMapper, Kxs
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @DSTransactional
|
|
|
public void changeAccountData(DMLData dmlData) {
|
|
public void changeAccountData(DMLData dmlData) {
|
|
|
//修改的字段值
|
|
//修改的字段值
|
|
|
Map<String, Object> validFieldDataMap = dmlData.getValidFieldDataMap();
|
|
Map<String, Object> validFieldDataMap = dmlData.getValidFieldDataMap();
|
|
@@ -264,13 +268,8 @@ public class KxsWarehouseServiceImpl extends ServiceImpl<KxsWarehouseMapper, Kxs
|
|
|
List<String> changeFieldList = dmlData.getChangeFieldList();
|
|
List<String> changeFieldList = dmlData.getChangeFieldList();
|
|
|
//操作的主键
|
|
//操作的主键
|
|
|
int id = Integer.parseInt(dmlData.getId());
|
|
int id = Integer.parseInt(dmlData.getId());
|
|
|
- Integer userId = null;
|
|
|
|
|
-
|
|
|
|
|
KxsWarehouseLimit warehouseLimit = new KxsWarehouseLimit();
|
|
KxsWarehouseLimit warehouseLimit = new KxsWarehouseLimit();
|
|
|
|
|
|
|
|
- if(fieldDataMap.get("UserId").getValue() != null){
|
|
|
|
|
- userId = Integer.valueOf(fieldDataMap.get("UserId").getValue().toString());
|
|
|
|
|
- }
|
|
|
|
|
for (String field : changeFieldList) {
|
|
for (String field : changeFieldList) {
|
|
|
|
|
|
|
|
switch (field) {
|
|
switch (field) {
|
|
@@ -297,12 +296,35 @@ public class KxsWarehouseServiceImpl extends ServiceImpl<KxsWarehouseMapper, Kxs
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (BeanUtil.isNotEmpty(warehouseLimit, "entityClass") && userId != null) {
|
|
|
|
|
|
|
+ if (BeanUtil.isNotEmpty(warehouseLimit, "entityClass")) {
|
|
|
|
|
+ //更新全部字段
|
|
|
|
|
+ if(fieldDataMap.get("ValidAmount").getValue() != null){
|
|
|
|
|
+ warehouseLimit.setValidAmount(new BigDecimal(fieldDataMap.get("ValidAmount").getValue().toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(fieldDataMap.get("FixedAmount").getValue() != null){
|
|
|
|
|
+ warehouseLimit.setFixedAmount(new BigDecimal(fieldDataMap.get("FixedAmount").getValue().toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(fieldDataMap.get("TempAmount").getValue() != null){
|
|
|
|
|
+ warehouseLimit.setForAmount(new BigDecimal(fieldDataMap.get("TempAmount").getValue().toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(fieldDataMap.get("TempAmountForBalance").getValue() != null){
|
|
|
|
|
+ warehouseLimit.setYueForAmount(new BigDecimal(fieldDataMap.get("TempAmountForBalance").getValue().toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ //仓库担保金额
|
|
|
|
|
+ KxsWarehouseCreditAmount kxsWarehouseCreditAmount = kxsWarehouseCreditAmountMapper.selectOne(Wrappers.<KxsWarehouseCreditAmount>query()
|
|
|
|
|
+ .select("sum(credit_amount) as creditAmount")
|
|
|
|
|
+ .eq("to_credit_user_id", id)
|
|
|
|
|
+ .groupBy("to_credit_user_id"));
|
|
|
|
|
+ if(kxsWarehouseCreditAmount != null){
|
|
|
|
|
+ warehouseLimit.setCreditAmount(kxsWarehouseCreditAmount.getCreditAmount());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
KxsWarehouseLimit kxsWarehouseLimit = kxsWarehouseLimitMapper.selectOne(Wrappers.<KxsWarehouseLimit>lambdaQuery()
|
|
KxsWarehouseLimit kxsWarehouseLimit = kxsWarehouseLimitMapper.selectOne(Wrappers.<KxsWarehouseLimit>lambdaQuery()
|
|
|
.eq(KxsWarehouseLimit::getWarehouseType, 0)
|
|
.eq(KxsWarehouseLimit::getWarehouseType, 0)
|
|
|
- .eq(KxsWarehouseLimit::getUserId, userId));
|
|
|
|
|
|
|
+ .eq(KxsWarehouseLimit::getUserId, id));
|
|
|
if (kxsWarehouseLimit == null) {
|
|
if (kxsWarehouseLimit == null) {
|
|
|
- warehouseLimit.setUserId(userId);
|
|
|
|
|
|
|
+ warehouseLimit.setUserId(id);
|
|
|
kxsWarehouseLimitMapper.insert(warehouseLimit);
|
|
kxsWarehouseLimitMapper.insert(warehouseLimit);
|
|
|
}else{
|
|
}else{
|
|
|
warehouseLimit.setId(kxsWarehouseLimit.getId());
|
|
warehouseLimit.setId(kxsWarehouseLimit.getId());
|
|
@@ -312,6 +334,7 @@ public class KxsWarehouseServiceImpl extends ServiceImpl<KxsWarehouseMapper, Kxs
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @DSTransactional
|
|
|
public void changeAccountMinData(DMLData dmlData) {
|
|
public void changeAccountMinData(DMLData dmlData) {
|
|
|
//修改的字段值
|
|
//修改的字段值
|
|
|
Map<String, Object> validFieldDataMap = dmlData.getValidFieldDataMap();
|
|
Map<String, Object> validFieldDataMap = dmlData.getValidFieldDataMap();
|
|
@@ -321,13 +344,9 @@ public class KxsWarehouseServiceImpl extends ServiceImpl<KxsWarehouseMapper, Kxs
|
|
|
List<String> changeFieldList = dmlData.getChangeFieldList();
|
|
List<String> changeFieldList = dmlData.getChangeFieldList();
|
|
|
//操作的主键
|
|
//操作的主键
|
|
|
int id = Integer.parseInt(dmlData.getId());
|
|
int id = Integer.parseInt(dmlData.getId());
|
|
|
- Integer userId = null;
|
|
|
|
|
|
|
|
|
|
KxsWarehouseLimit warehouseLimit = new KxsWarehouseLimit();
|
|
KxsWarehouseLimit warehouseLimit = new KxsWarehouseLimit();
|
|
|
|
|
|
|
|
- if(fieldDataMap.get("UserId").getValue() != null){
|
|
|
|
|
- userId = Integer.valueOf(fieldDataMap.get("UserId").getValue().toString());
|
|
|
|
|
- }
|
|
|
|
|
for (String field : changeFieldList) {
|
|
for (String field : changeFieldList) {
|
|
|
|
|
|
|
|
switch (field) {
|
|
switch (field) {
|
|
@@ -354,12 +373,29 @@ public class KxsWarehouseServiceImpl extends ServiceImpl<KxsWarehouseMapper, Kxs
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (BeanUtil.isNotEmpty(warehouseLimit, "entityClass") && userId != null) {
|
|
|
|
|
|
|
+ if (BeanUtil.isNotEmpty(warehouseLimit, "entityClass")) {
|
|
|
|
|
+ //更新全部字段
|
|
|
|
|
+ if(fieldDataMap.get("ValidPreAmount").getValue() != null){
|
|
|
|
|
+ warehouseLimit.setValidAmount(new BigDecimal(fieldDataMap.get("ValidPreAmount").getValue().toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(fieldDataMap.get("ThisMonthPreAmount").getValue() != null){
|
|
|
|
|
+ warehouseLimit.setFixedAmount(new BigDecimal(fieldDataMap.get("ThisMonthPreAmount").getValue().toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(fieldDataMap.get("PreTempAmount").getValue() != null){
|
|
|
|
|
+ warehouseLimit.setForAmount(new BigDecimal(fieldDataMap.get("PreTempAmount").getValue().toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if(fieldDataMap.get("PreTempAmountForBalance").getValue() != null){
|
|
|
|
|
+ warehouseLimit.setYueForAmount(new BigDecimal(fieldDataMap.get("PreTempAmountForBalance").getValue().toString()));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
KxsWarehouseLimit kxsWarehouseLimit = kxsWarehouseLimitMapper.selectOne(Wrappers.<KxsWarehouseLimit>lambdaQuery()
|
|
KxsWarehouseLimit kxsWarehouseLimit = kxsWarehouseLimitMapper.selectOne(Wrappers.<KxsWarehouseLimit>lambdaQuery()
|
|
|
.eq(KxsWarehouseLimit::getWarehouseType, 1)
|
|
.eq(KxsWarehouseLimit::getWarehouseType, 1)
|
|
|
- .eq(KxsWarehouseLimit::getUserId, userId));
|
|
|
|
|
|
|
+ .eq(KxsWarehouseLimit::getUserId, id));
|
|
|
if (kxsWarehouseLimit == null) {
|
|
if (kxsWarehouseLimit == null) {
|
|
|
- warehouseLimit.setUserId(userId);
|
|
|
|
|
|
|
+ warehouseLimit.setUserId(id);
|
|
|
|
|
+ //小分仓
|
|
|
|
|
+ warehouseLimit.setWarehouseType(1);
|
|
|
kxsWarehouseLimitMapper.insert(warehouseLimit);
|
|
kxsWarehouseLimitMapper.insert(warehouseLimit);
|
|
|
}else{
|
|
}else{
|
|
|
warehouseLimit.setId(kxsWarehouseLimit.getId());
|
|
warehouseLimit.setId(kxsWarehouseLimit.getId());
|