花名册

This commit is contained in:
liuliang 2025-06-10 10:50:25 +08:00
parent 8aa2645440
commit 24baccf2ae
3 changed files with 93 additions and 23 deletions

View File

@ -151,14 +151,11 @@ public class EmployeeInformationController extends BaseCommonController {
@WeaPermission(publicPermission = true)
@PostMapping("/saveQueryCondition")
@ResponseBody
public WeaResult<Map<String, Object>> saveQueryCondition(@RequestParam("rootdata") String rootdata,@RequestParam("apid") String apid,
@RequestParam("formid") String formid,@RequestParam("objId") String objId){
public WeaResult<Map<String, Object>> saveQueryCondition(@RequestParam("rootdata") String rootdata,@RequestParam("sqltj") String sqltj){
Map<String, Object> actionMap = new HashMap<>();
Map<String,String> params = Maps.newHashMap();
params.put("rootdata",rootdata);
params.put("apid",apid);
params.put("formid",formid);
params.put("objId",objId);
params.put("sqltj",sqltj);
try {
List<Map<Object, Object>> errorMessage = employeeInformationService.saveQueryCondition(this.getCurrentUser(),params);
}catch (Exception e){
@ -185,17 +182,30 @@ public class EmployeeInformationController extends BaseCommonController {
}
/**
* 花名册查询
* 全部员工筛选条件
* @return
*/
@WeaPermission(publicPermission = true)
@PostMapping("/testApi")
@PostMapping("/allEmployeeConditon")
@ResponseBody
public WeaResult<Map<String, Object>> testApi(@RequestParam("formId") String formId){
public WeaResult allEmployeeConditon(){
Map<String,Object> resultMap = Maps.newHashMap();
Map<Long, FormField> formFieldMap = formFieldRest.getFieldMapByFormId(Long.valueOf(formId),this.getCurrentUser());
resultMap.put("formFieldMap",formFieldMap);
return WeaResult.success(resultMap);
return WeaResult.success(employeeInformationService.getallEmployeeConditon(getCurrentUser()));
}
/**
* 全部员工筛选条件初始化数据
* @return
*/
@WeaPermission(publicPermission = true)
@PostMapping("/getinitCondition")
@ResponseBody
public WeaResult getinitCondition(){
Map<String,Object> resultMap = Maps.newHashMap();
return WeaResult.success(employeeInformationService.getinitCondition(getCurrentUser()));
}
}

View File

@ -1,5 +1,6 @@
package com.weaver.seconddev.jcl.organization.service;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.common.component.table.AbstractWeaTable;
import com.weaver.common.form.param.FieldManageParam;
import com.weaver.seconddev.jcl.organization.entity.Employee;
@ -53,4 +54,8 @@ public interface EmployeeInformationService {
*/
AbstractWeaTable queryTableData(SimpleEmployee simpleEmployee,Map<String, Object> params);
String getallEmployeeConditon(SimpleEmployee simpleEmployee);
Map<String,String> getinitCondition(SimpleEmployee simpleEmployee);
}

View File

@ -33,6 +33,7 @@ import com.weaver.seconddev.jcl.organization.service.EmployeeInformationService;
import com.weaver.seconddev.jcl.organization.util.CommonUtils;
import com.weaver.seconddev.jcl.organization.util.Constants;
import com.weaver.seconddev.jcl.organization.util.DatabaseUtils;
import com.weaver.seconddev.jcl.organization.util.DateUtil;
import com.weaver.teams.domain.user.SimpleEmployee;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@ -40,10 +41,8 @@ import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -611,22 +610,47 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
public List<Map<Object, Object>> saveQueryCondition(SimpleEmployee simpleEmployee,Map<String,String> params) {
String rootdata = params.get("rootdata");
String sqltj = CommonUtils.null2String(params.get("sqltj"));
Map<String,Object> param = Maps.newHashMap();
Map<String,String> dataMap = Maps.newHashMap();
Map<String,Object> dataMap = Maps.newHashMap();
param.put("tableName","uf_jcl_querycondition");
param.put("dataMap",dataMap);
dataMap.put("ry",String.valueOf(simpleEmployee.getId()));
dataMap.put("sxtj",rootdata);
dataMap.put("bm","uf_jcl_employee_information");
String sql = "select ry from uf_jcl_querycondition where ry=?";
List<Map<String, Object>> dataList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(String.valueOf(simpleEmployee.getId())));
String sql = "select id,ry from uf_jcl_querycondition where ry=? and bm=? and delete_type='0'";
List<Map<String, Object>> dataList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(String.valueOf(simpleEmployee.getId()),"uf_jcl_employee_information"));
if (dataList.size() > 0){
sql = "update uf_jcl_querycondition set sxtj=? where ry=?";
databaseUtils.execute(sql,CommonUtils.getParamList(rootdata,String.valueOf(simpleEmployee.getId())));
}else {
sql = "insert into uf_jcl_querycondition (id,ry,sxtj) values ("+idGeneratorService.generatorIds(1)[0]+","+simpleEmployee.getId()+",'"+rootdata+"' )";
if (!sqltj.equals("")){
sql = "update uf_jcl_querycondition set sqltj=? where id=?";
databaseUtils.execute(sql,CommonUtils.getParamList(sqltj,String.valueOf(dataList.get(0).get("id"))));
}else {
sql = "update uf_jcl_querycondition set sxtj=? where id=?";
databaseUtils.execute(sql,CommonUtils.getParamList(rootdata,String.valueOf(dataList.get(0).get("id"))));
}
databaseUtils.execute(sql);
}else {
String id= idGeneratorService.generatorIds(1)[0];
dataMap.put("id",id);
dataMap.put("form_data_id",id);
dataMap.put("data_index","0.0");
dataMap.put("create_time", DateUtil.getCurrentTime());
dataMap.put("update_time",DateUtil.getCurrentTime());
dataMap.put("tenant_key",simpleEmployee.getTenantKey());
dataMap.put("is_delete","0");
dataMap.put("creator",String.valueOf(simpleEmployee.getId()));
dataMap.put("updater",String.valueOf(simpleEmployee.getId()));
dataMap.put("delete_type","0");
dataMap.put("data_status","1");
dataMap.put("is_top","0");
dataMap.put("classification","4");
dataMap.put("dn_first","0");
commonService.insertCommon(param);
// sql = "insert into uf_jcl_querycondition (id,form_data_id,data_index,create_time,update_time,tenant_key,is_delete,creator,updater,delete_type,data_status,ry,sxtj) values ("+idGeneratorService.generatorIds(1)[0]+","+simpleEmployee.getId()+",'"+rootdata+"' )";
// databaseUtils.execute(sql);
}
return null;
@ -800,6 +824,32 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
}
@Override
public String getallEmployeeConditon(SimpleEmployee simpleEmployee) {
StringJoiner andCondition = new StringJoiner("");
String sql = "select sqltj from uf_jcl_querycondition where ry=? and bm=? and delete_type='0'";
List<Map<String, Object>> conditionSqlList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(String.valueOf(simpleEmployee.getId()),"uf_jcl_employee_information"));
if (conditionSqlList.size() > 0){
andCondition.add(String.valueOf(conditionSqlList.get(0).get("sqltj")));
}
return andCondition.toString();
}
@Override
public Map<String,String> getinitCondition(SimpleEmployee simpleEmployee) {
String sql = "select sqltj,sxtj from uf_jcl_querycondition where ry=? and bm=? and delete_type='0'";
List<Map<String, Object>> conditionSqlList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(String.valueOf(simpleEmployee.getId()),"uf_jcl_employee_information"));
Map<String,String> resultMap = Maps.newHashMap();
if (conditionSqlList.size() > 0){
resultMap.put("sqltj",CommonUtils.null2String(conditionSqlList.get(0).get("sqltj")));
resultMap.put("sxtj",CommonUtils.null2String(conditionSqlList.get(0).get("sxtj")));
}
return resultMap;
}
/**
* 批量保存
* @param entity
@ -885,6 +935,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
}
}
public List<String> getJsonObjList(List<Map<Object, Object>> list){
Gson gson = new Gson();
List<String> josnObjList = Lists.newArrayList();
@ -1077,6 +1128,9 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
return resultList;
}
/**
* 组装批量保存参数
* @param packageList
@ -1388,4 +1442,5 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
}
}