This commit is contained in:
张秉卓
2026-01-20 18:02:02 +08:00
18 changed files with 177 additions and 113 deletions

View File

@ -1,5 +1,6 @@
package com.pictc.utils; package com.pictc.utils;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.shaded.com.google.common.collect.Lists; import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
@ -58,6 +59,8 @@ public class DataLogTools {
private static Map<String,Class<?>> entitys = Maps.newHashMap(); private static Map<String,Class<?>> entitys = Maps.newHashMap();
private static final String REDIS_CACHE_KEY = "TABLE_INFO:";
private static Set<String> logTables = null; private static Set<String> logTables = null;
private static Object lock = new Object(); private static Object lock = new Object();
@ -609,21 +612,23 @@ public class DataLogTools {
Object joinValue = tabInfo.getFieldValue(entity, join.getField()); Object joinValue = tabInfo.getFieldValue(entity, join.getField());
if(joinValue!=null && joinValue instanceof List) { if(joinValue!=null && joinValue instanceof List) {
List listValue = (List) joinValue; List listValue = (List) joinValue;
for (LogJoinColumn joinColumn : columns) { for (Object item : listValue) {
if (joinColumn.valueType() == JoinValueType.FEILD Long idValue2 = joinTable.getIdValue(item);
&& joinColumn.valueDirection() == ValueDirectionType.RIGHT) { if(idValue2==null || idValue2 <=0) {
Object joinFieldValue = tabInfo.getFieldValue(entity, joinColumn.field()); joinTable.setIdValue(item, IdWorker.getId());
for (Object item : listValue) { }
Long idValue2 = joinTable.getIdValue(item); for (LogJoinColumn joinColumn : columns) {
if(idValue2==null || idValue2 <=0) { if (joinColumn.valueType() == JoinValueType.FEILD
joinTable.setIdValue(item, IdWorker.getId()); && joinColumn.valueDirection() == ValueDirectionType.RIGHT) {
} Object joinFieldValue = tabInfo.getFieldValue(entity, joinColumn.field());
joinTable.setFieldValue(item, joinColumn.relatedField(), joinFieldValue);
}else if(joinColumn.valueType()==JoinValueType.STATIC){
Object joinFieldValue = Convert.convert(joinColumn.staticType(), joinColumn.staticValue());
joinTable.setFieldValue(item, joinColumn.relatedField(), joinFieldValue); joinTable.setFieldValue(item, joinColumn.relatedField(), joinFieldValue);
Set<Class<?>> joinClasses = SetUtils.ofCollection(classes);
initJoinValue(item,joinTable,joinClasses);
} }
} }
Set<Class<?>> joinClasses = SetUtils.ofCollection(classes);
initJoinValue(item,joinTable,joinClasses);
} }
}else { }else {
Long idValue2 = joinTable.getIdValue(joinValue); Long idValue2 = joinTable.getIdValue(joinValue);
@ -634,9 +639,16 @@ public class DataLogTools {
if(joinColumn.valueType()==JoinValueType.FEILD && joinColumn.valueDirection()==ValueDirectionType.LEFT) { if(joinColumn.valueType()==JoinValueType.FEILD && joinColumn.valueDirection()==ValueDirectionType.LEFT) {
Object joinFieldValue = joinTable.getFieldValue(joinValue, joinColumn.relatedField()); Object joinFieldValue = joinTable.getFieldValue(joinValue, joinColumn.relatedField());
tabInfo.setFieldValue(entity, joinColumn.field(),joinFieldValue); tabInfo.setFieldValue(entity, joinColumn.field(),joinFieldValue);
}else { }else if(joinColumn.valueType()==JoinValueType.FEILD){
Object joinFieldValue = tabInfo.getFieldValue(entity, joinColumn.field()); Object joinFieldValue = tabInfo.getFieldValue(entity, joinColumn.field());
joinTable.setFieldValue(joinValue, joinColumn.relatedField(), joinFieldValue); joinTable.setFieldValue(joinValue, joinColumn.relatedField(), joinFieldValue);
}else {
Object joinFieldValue = Convert.convert(joinColumn.staticType(), joinColumn.staticValue());
if(joinColumn.valueDirection()==ValueDirectionType.LEFT) {
tabInfo.setFieldValue(entity, joinColumn.field(),joinFieldValue);
}else {
joinTable.setFieldValue(joinValue, joinColumn.relatedField(), joinFieldValue);
}
} }
} }
Set<Class<?>> joinClasses = SetUtils.ofCollection(classes); Set<Class<?>> joinClasses = SetUtils.ofCollection(classes);

View File

@ -0,0 +1,46 @@
package com.pictc.utils;
import java.util.Enumeration;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.HandlerMapping;
public class RequestUtils {
private RequestUtils() {
super();
}
public static HttpServletRequest getRequest() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
return servletRequestAttributes.getRequest();
}
@SuppressWarnings("unchecked")
public static Map<String, String> getPathValues(){
HttpServletRequest request = getRequest();
return (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
}
public static String getPathValue(String name){
return getPathValues().get(name);
}
public static Map<String,Object> getParameters(HttpServletRequest request) {
Map<String,Object> parameters = CollectionUtils.newHashMap();
Enumeration<String> names = request.getParameterNames();
if(names!=null) {
while (names.hasMoreElements()) {
String name = names.nextElement();
parameters.put(name, request.getParameter(name));
}
}
return parameters;
}
}

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.mdm.vo.LngBRegionVo;
/** /**
* @author: ksy * @author: ksy
@ -19,6 +20,6 @@ public interface ICountryRegionClient {
Map<String,String> getAllTranData(); Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngBRegionVo getTranById(@RequestParam("id")String id);
} }

View File

@ -1,6 +1,6 @@
package com.xjrsoft.module.mdm.client; package com.xjrsoft.module.mdm.client;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto; import com.xjrsoft.module.mdm.vo.LngBCurrencyVo;
/** /**
* @author: ksy * @author: ksy
@ -21,7 +21,7 @@ public interface ICurrencyClient {
Map<String,String> getAllTranData(); Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngBCurrencyVo getTranById(@RequestParam("id")String id);
} }

View File

@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto; import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.vo.LngBBankVo;
/** /**
* @author: ksy * @author: ksy
@ -21,7 +22,7 @@ public interface ILngBankClient {
Map<String,String> getAllTranData(); Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngBBankVo getTranById(@RequestParam("id")String id);
@GetMapping("/getTranByCodes") @GetMapping("/getTranByCodes")
List<UpdateLngBBankDto> getTranByCodes(@RequestParam("codes") List<String> codes); List<UpdateLngBBankDto> getTranByCodes(@RequestParam("codes") List<String> codes);

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.mdm.vo.LngBStationLngVo;
/** /**
* @author: ksy * @author: ksy
@ -15,10 +16,7 @@ import com.xjrsoft.common.constant.GlobalConstant;
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.MDM_MODULE_PREFIX + "/tran/lngStation") @FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.MDM_MODULE_PREFIX + "/tran/lngStation")
public interface ILngStationClient { public interface ILngStationClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngBStationLngVo getTranById(@RequestParam("id")String id);
} }

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.sales.vo.LngCustomerVo;
/** /**
* @author: ksy * @author: ksy
@ -15,10 +16,7 @@ import com.xjrsoft.common.constant.GlobalConstant;
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/customer") @FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/customer")
public interface ICustomerClient { public interface ICustomerClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngCustomerVo getTranById(@RequestParam("id")String id);
} }

View File

@ -1,12 +1,11 @@
package com.xjrsoft.module.sales.client; package com.xjrsoft.module.sales.client;
import java.util.Map;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.sales.vo.LngGradeSystemVo;
/** /**
* @author: ksy * @author: ksy
@ -15,10 +14,7 @@ import com.xjrsoft.common.constant.GlobalConstant;
@FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/gradeSystem") @FeignClient(value = GlobalConstant.CLIENT_PCITC_MDM_NAME, path = GlobalConstant.CLIENT_API_PRE + GlobalConstant.SALES_MODULE_PREFIX + "/tran/gradeSystem")
public interface IGradeSystemClient { public interface IGradeSystemClient {
@GetMapping("/getAllTranData")
Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngGradeSystemVo getTranById(@RequestParam("id")String id);
} }

View File

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
/** /**
* @author: ksy * @author: ksy
@ -19,6 +20,6 @@ public interface ISupplierClient {
Map<String,String> getAllTranData(); Map<String,String> getAllTranData();
@GetMapping("/getTranById") @GetMapping("/getTranById")
String getTranById(@RequestParam("id")String id); LngSupplierVo getTranById(@RequestParam("id")String id);
} }

View File

@ -178,7 +178,21 @@ public class DemandController {
pdp.setAddSign("N"); pdp.setAddSign("N");
} }
} }
return this.add(temp); return R.ok(dataService.insert(temp,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
lngPngDemand.setLastVerSign("N");
demandService.updateById(lngPngDemand);
return null;
}
}));
} }
@GetMapping(value="/compare") @GetMapping(value="/compare")

View File

@ -14,7 +14,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.mdm.entity.LngBRegion; import com.xjrsoft.module.mdm.entity.LngBRegion;
import com.xjrsoft.module.mdm.service.ICountryRegionService; import com.xjrsoft.module.mdm.service.ICountryRegionService;
import com.xjrsoft.module.mdm.vo.LngBRegionVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -43,9 +45,11 @@ public class CountryRegionClientImpl implements ICountryRegionClient {
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngBRegionVo getTranById(@RequestParam("id")String code) {
LngBRegion region = countryRegionService.getByCode(code); return TenantUtil.ignoreR(()->{
return region!=null?region.getFullPath():null; LngBRegion region = countryRegionService.getByCode(code);
return Convert.convert(LngBRegionVo.class, region);
});
} }
} }

View File

@ -9,16 +9,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.xjrsoft.common.constant.GlobalConstant; import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.mdm.dto.UpdateLngBBankDto;
import com.xjrsoft.module.mdm.entity.LngBBank;
import com.xjrsoft.module.mdm.entity.LngBCurrency; import com.xjrsoft.module.mdm.entity.LngBCurrency;
import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.service.IBankService;
import com.xjrsoft.module.mdm.service.ICurrencyService; import com.xjrsoft.module.mdm.service.ICurrencyService;
import com.xjrsoft.module.mdm.service.ILNGStationService; import com.xjrsoft.module.mdm.vo.LngBCurrencyVo;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -33,23 +31,22 @@ public class CurrencyClientImpl implements ICurrencyClient {
private final ICurrencyService currencyService; private final ICurrencyService currencyService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngBCurrency> list = currencyService.list();
return list.stream().collect(Collectors.toMap(LngBCurrency::getCode,LngBCurrency::getFullName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngBCurrencyVo getTranById(@RequestParam("id")String code) {
LngBCurrency currency = currencyService.getByCode(code); return TenantUtil.ignoreR(()->{
return currency!=null?currency.getFullName():null; LngBCurrency currency = currencyService.getByCode(code);
return Convert.convert(LngBCurrencyVo.class, currency);
});
}
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
return TenantUtil.ignoreR(()->{
List<LngBCurrency> list = currencyService.list();
return list.stream().collect(Collectors.toMap(LngBCurrency::getCode,LngBCurrency::getFullName));
});
} }

View File

@ -16,7 +16,9 @@ import com.xjrsoft.module.mdm.entity.LngBBank;
import com.xjrsoft.module.mdm.entity.LngBStationLng; import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.service.IBankService; import com.xjrsoft.module.mdm.service.IBankService;
import com.xjrsoft.module.mdm.service.ILNGStationService; import com.xjrsoft.module.mdm.service.ILNGStationService;
import com.xjrsoft.module.mdm.vo.LngBBankVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -45,9 +47,12 @@ public class LngBankClientImpl implements ILngBankClient {
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngBBankVo getTranById(@RequestParam("id")String code) {
LngBBank bank = lngBankService.getByCode(code);
return bank!=null?bank.getFullName():null; return TenantUtil.ignoreR(()->{
LngBBank bank = lngBankService.getByCode(code);
return Convert.convert(LngBBankVo.class,bank);
});
} }
@Override @Override

View File

@ -13,7 +13,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.mdm.entity.LngBStationLng; import com.xjrsoft.module.mdm.entity.LngBStationLng;
import com.xjrsoft.module.mdm.service.ILNGStationService; import com.xjrsoft.module.mdm.service.ILNGStationService;
import com.xjrsoft.module.mdm.vo.LngBStationLngVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -28,23 +30,13 @@ public class LngStationClientImpl implements ILngStationClient {
private final ILNGStationService lngStationService; private final ILNGStationService lngStationService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngBStationLng> list = lngStationService.list();
return list.stream().collect(Collectors.toMap(LngBStationLng::getCode,LngBStationLng::getFullName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngBStationLngVo getTranById(@RequestParam("id")String code) {
LngBStationLng region = lngStationService.getByCode(code); return TenantUtil.ignoreR(()->{
return region!=null?region.getFullName():null; LngBStationLng region = lngStationService.getByCode(code);
return Convert.convert(LngBStationLngVo.class, region);
});
} }
} }

View File

@ -1,9 +1,5 @@
package com.xjrsoft.module.sales.client; package com.xjrsoft.module.sales.client;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -13,7 +9,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.sales.entity.LngCustomer; import com.xjrsoft.module.sales.entity.LngCustomer;
import com.xjrsoft.module.sales.service.ICustomerService; import com.xjrsoft.module.sales.service.ICustomerService;
import com.xjrsoft.module.sales.vo.LngCustomerVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -28,23 +26,13 @@ public class CustomerClientImpl implements ICustomerClient {
private final ICustomerService customerService; private final ICustomerService customerService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngCustomer> list = customerService.list();
return list.stream().collect(Collectors.toMap(LngCustomer::getCuCode,LngCustomer::getCuName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngCustomerVo getTranById(@RequestParam("id")String code) {
LngCustomer cu = customerService.getByCode(code); return TenantUtil.ignoreR(()->{
return cu!=null?cu.getCuName():null; LngCustomer cu = customerService.getByCode(code);
return Convert.convert(LngCustomerVo.class, cu);
});
} }
} }

View File

@ -13,7 +13,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.sales.entity.LngGradeSystem; import com.xjrsoft.module.sales.entity.LngGradeSystem;
import com.xjrsoft.module.sales.service.IGradeSystemService; import com.xjrsoft.module.sales.service.IGradeSystemService;
import com.xjrsoft.module.sales.vo.LngGradeSystemVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -28,23 +30,13 @@ public class GradeSystemClientImpl implements IGradeSystemClient {
private final IGradeSystemService gradeSystemService; private final IGradeSystemService gradeSystemService;
@GetMapping("/getAllTranData")
@Override
public Map<String, String> getAllTranData() {
try {
TenantUtil.ignore(true);
List<LngGradeSystem> list = gradeSystemService.list();
return list.stream().collect(Collectors.toMap(e -> String.valueOf(e.getId()),LngGradeSystem::getGsName));
}finally {
TenantUtil.clear();
}
}
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngGradeSystemVo getTranById(@RequestParam("id")String code) {
LngGradeSystem gs = gradeSystemService.getById(code); return TenantUtil.ignoreR(()->{
return gs!=null?gs.getGsName():null; return Convert.convert(LngGradeSystemVo.class, gradeSystemService.getById(code));
});
} }
} }

View File

@ -13,7 +13,9 @@ import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.utils.TenantUtil; import com.xjrsoft.common.utils.TenantUtil;
import com.xjrsoft.module.supplier.entity.LngSupplier; import com.xjrsoft.module.supplier.entity.LngSupplier;
import com.xjrsoft.module.supplier.service.ISupplierService; import com.xjrsoft.module.supplier.service.ISupplierService;
import com.xjrsoft.module.supplier.vo.LngSupplierVo;
import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
/** /**
@ -42,9 +44,11 @@ public class SupplierClientImpl implements ISupplierClient {
@GetMapping("/getTranById") @GetMapping("/getTranById")
@Override @Override
public String getTranById(@RequestParam("id")String code) { public LngSupplierVo getTranById(@RequestParam("id")String code) {
LngSupplier su = supplierService.getByCode(code); return TenantUtil.ignoreR(()->{
return su!=null?su.getSuName():null; LngSupplier su = supplierService.getByCode(code);
return Convert.convert(LngSupplierVo.class, su);
});
} }
} }

View File

@ -0,0 +1,15 @@
package com.xjrsoft.test;
import java.util.Map;
import cn.hutool.json.JSONUtil;
public class JsonTest {
public static void main(String[] args) {
String json = "{\"name\":\"John\",\"age\":30,\"city\":\"New York\"}";
Map<String,Object> bean = JSONUtil.toBean(json, Map.class, true);
System.out.println(bean);
}
}