公共方法改造

main
liuliang 1 month ago
parent 4dbbaf4aed
commit f7ab9128cb

@ -37,7 +37,7 @@ public class EmployeeInformationController {
@Produces(MediaType.APPLICATION_JSON)
@PostMapping("/getInformation")
public Map<String, Object> getInformation(@RequestBody Employee employee){
log.info("getInformation Employee[{}]",employee);
log.error("getInformation Employee[{}]",employee);
Map<String, Object> actionMap = new HashMap<>();
List<Map<String, Object>> resultList = employeeInformationService.getInformation(employee);
actionMap.put("resultList",resultList);

@ -3,6 +3,7 @@ package com.weaver.seconddev.jcl.organization.service.impl;
import com.google.common.collect.Lists;
import com.weaver.seconddev.jcl.organization.entity.Employee;
import com.weaver.seconddev.jcl.organization.service.EmployeeInformationService;
import com.weaver.seconddev.jcl.organization.util.CommonUtils;
import com.weaver.seconddev.jcl.organization.util.DatabaseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -33,8 +34,30 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
paramList.add(employee.getSfz_1mhf());
}
List<Map<String, Object>> recordList = databaseUtils.getSqlList("LOGIC", "weaver-ebuilder-form-service",sql,paramList);
List<Map<String, Object>> recordList = databaseUtils.getSqlList(sql,paramList);
if (recordList.size() > 0){
Map<String, Object> userMap = recordList.get(0);
String ssbm= recordList.get(0).get("ssbm").toString();
String ygzt = CommonUtils.null2String(userMap.get("ygzt"));
if (ygzt.equals("5")){
//离职
sql = "select zhgzr,lzqbm from uf_jcl_lzxxjl where glyg=? ";
List<Map<String, Object>> resignList = databaseUtils.getSqlList(sql, CommonUtils.getParamList(userMap.get("id").toString()));
}else if (ygzt.equals("6")){
//退休
sql = "select zhgzr,txqbm from uf_jcl_txxxjl where glyg=? ";
List<Map<String, Object>> retireList = databaseUtils.getSqlList(sql, CommonUtils.getParamList(userMap.get("id").toString()));
}
sql = "select id,name from department where id=?";
List<Map<String, Object>> departmentList = databaseUtils.getSqlList(sql, CommonUtils.getParamList(ssbm));
userMap.put("departname",departmentList.get(0).get("name"));
}
return recordList;
}

@ -8,9 +8,12 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class EmployeeRelationServiceImpl implements EmployeeRelationService {
private static final Logger log = LoggerFactory.getLogger(EmployeeRelationController.class);

@ -2,6 +2,7 @@ package com.weaver.seconddev.jcl.organization.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
@ -417,6 +418,13 @@ public class CommonUtils {
return returnMap;
}
public static List<String> getParamList(String... strs){
List<String> list = Lists.newArrayList();
for (String str:strs){
list.add(str);
}
return list;
}
}

@ -0,0 +1,6 @@
package com.weaver.seconddev.jcl.organization.util;
public class Constants {
public static final String SOURCE_TYPE="LOGIC";
public static final String GROUP_ID="weaver-ebuilder-form-service";
}

@ -305,6 +305,18 @@ public class DatabaseUtils {
List<Map<String, Object>> recordList = getDataSourceList(result);
return recordList;
}
/***
*
* @param dataSql
* @param paramList
* @return
*/
public List<Map<String, Object>> getSqlList(String dataSql,List<String> paramList){
List<SqlParamEntity> sqlParamList = querySqlParamEntity(paramList);
Map<String, Object> result = executeForQuery(Constants.SOURCE_TYPE, Constants.GROUP_ID, dataSql, sqlParamList);
List<Map<String, Object>> recordList = getDataSourceList(result);
return recordList;
}
/***
*
@ -324,5 +336,21 @@ public class DatabaseUtils {
}
return recordMap;
}
/***
*
* @param dataSql
* @param paramList
* @return
*/
public Map<String, Object> getSqlMap(String dataSql,List<String> paramList){
Map<String, Object> recordMap = new HashMap<>();
List<SqlParamEntity> sqlParamList = querySqlParamEntity(paramList);
Map<String, Object> result = executeForQuery(Constants.SOURCE_TYPE, Constants.GROUP_ID, dataSql, sqlParamList);
List<Map<String, Object>> recordList = getDataSourceList(result);
if(recordList.size() > 0){
recordMap = recordList.get(0);
}
return recordMap;
}
}

Loading…
Cancel
Save