package cn.autoform.log.service.impl;
|
|
import cn.autoform.log.mapper.SystemMathMapper;
|
import cn.autoform.log.service.SystemMathService;
|
import com.iemsoft.framework.cloud.core.thread.Keys;
|
import com.iemsoft.framework.cloud.core.thread.ThreadData;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 系统变量业务层
|
*
|
* @author liush
|
*/
|
@Service("systemMathServiceImpl")
|
@Slf4j
|
public class SystemMathServiceImpl implements SystemMathService {
|
|
@Resource
|
private SystemMathMapper systemMathMapper;
|
|
|
@Override
|
public Map<String,String> getCostTypeByFormId(String formId) {
|
String tenantId = ThreadData.get(Keys.TENANT_ID);
|
String companyId = ThreadData.get(Keys.COMPANY_ID);
|
|
List<Map<String,String>> list = systemMathMapper.getCostTypeByFormId(tenantId, companyId, formId);
|
/**
|
费用类型 表名
|
SQ 通用申请单智泽SQa-----------> 需要
|
SQ 通用申请单智泽SQa486
|
筛选出长度最短的表名,同时返回此bean
|
*/
|
Map costFromMapping1 = null;
|
if(!CollectionUtils.isEmpty(list)){
|
log.debug("查询出的费用类型为:{}", list.toString());
|
int length = list.get(0).get("f_name").length();
|
for (int i = 0; i < list.size(); i++) {
|
int lengthNew = list.get(i).get("f_name").length();
|
if (length > lengthNew){
|
length = list.get(i).get("f_name").length();
|
costFromMapping1 = list.get(i);
|
}
|
}
|
return costFromMapping1;
|
}
|
return null;
|
}
|
|
}
|