|
|
@@ -0,0 +1,102 @@
|
|
|
+package com.lc.ibps.hrm.service.imple;
|
|
|
+
|
|
|
+import com.lc.ibps.api.base.constants.StateEnum;
|
|
|
+import com.lc.ibps.base.core.constants.StringPool;
|
|
|
+import com.lc.ibps.base.core.util.AppUtil;
|
|
|
+import com.lc.ibps.base.core.util.BeanUtils;
|
|
|
+import com.lc.ibps.base.core.util.I18nUtil;
|
|
|
+import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
+import com.lc.ibps.base.web.context.ContextUtil;
|
|
|
+import com.lc.ibps.cloud.entity.APIPageList;
|
|
|
+import com.lc.ibps.cloud.entity.APIPageResult;
|
|
|
+import com.lc.ibps.cloud.entity.APIResult;
|
|
|
+import com.lc.ibps.cloud.provider.GenericProvider;
|
|
|
+import com.lc.ibps.hrm.dao.PersonnelManagementDao;
|
|
|
+import com.lc.ibps.hrm.service.PersonnelManagementService;
|
|
|
+import com.lc.ibps.org.api.IPartyPositionService;
|
|
|
+import com.lc.ibps.org.party.persistence.entity.PartyPositionPo;
|
|
|
+import com.lc.ibps.sysdata.dao.UpdateDataTableDao;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @title: xiexh
|
|
|
+ * @date 2025/08/11 14:37
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class PersonnelManagementServiceImpl extends GenericProvider implements PersonnelManagementService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PersonnelManagementDao personnelManagementDao;
|
|
|
+ @Autowired
|
|
|
+ UpdateDataTableDao updateDataTableDao;
|
|
|
+ @Resource
|
|
|
+ private ICommonDao<?> commonDao;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public APIResult<Object> queryDeptSnapshot(Map<String, Object> map) throws Exception {
|
|
|
+ APIResult<Object> result = new APIResult<>();
|
|
|
+ try {
|
|
|
+ int pageNo = Integer.parseInt(map.get("pageNo").toString());
|
|
|
+ int limit = Integer.parseInt(map.get("limit").toString());
|
|
|
+ int startPage = limit*(pageNo-1);
|
|
|
+ map.put("startPage",startPage);
|
|
|
+ Map mapDeal = getMapV2(map);
|
|
|
+ List<Map<String,Object>> list = personnelManagementDao.querySnapshoot(mapDeal);
|
|
|
+ APIPageList<Map<String,Object>> pageList = getAPIPageList(list);
|
|
|
+ APIPageResult pageResult = new APIPageResult();
|
|
|
+ pageResult.setTotalCount(1);
|
|
|
+ pageResult.setLimit(limit);
|
|
|
+ pageResult.setPage(pageNo);
|
|
|
+ pageList.setPageResult(pageResult);
|
|
|
+ result.setData(pageList);
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR_FORM_BO.getCode(), I18nUtil.getMessage(StateEnum.ERROR_FORM_BO.getCode()+""), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map getMapV2(Map<String, Object> map) {
|
|
|
+ HashMap<String, Object> stringObjectHashMap = new HashMap<>();
|
|
|
+
|
|
|
+ if (BeanUtils.isNotEmpty(map)) {
|
|
|
+ stringObjectHashMap.put("pageNo", map.get("pageNo"));
|
|
|
+ stringObjectHashMap.put("limit", map.get("limit"));
|
|
|
+ stringObjectHashMap.put("startPage", map.get("startPage"));
|
|
|
+ stringObjectHashMap.put("locationId", getDiDian());
|
|
|
+ if(BeanUtils.isNotEmpty(map.get("param"))){
|
|
|
+ Map param = (Map) map.get("param");
|
|
|
+ if(BeanUtils.isNotEmpty(param.get("gangWei"))){
|
|
|
+ // 将逗号分隔的字符串拆分为List
|
|
|
+ String gangweiStr= (String) param.get("gangWei");
|
|
|
+ List<String> gangweiList = Arrays.asList(gangweiStr.trim().split("\\s*,\\s*"));
|
|
|
+ stringObjectHashMap.put("gangWei",gangweiList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return stringObjectHashMap;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取当前用户地点,前端可以不用传
|
|
|
+ private String getDiDian() {
|
|
|
+ IPartyPositionService partyPositionService = AppUtil.getBean(IPartyPositionService.class);
|
|
|
+ APIResult<List<PartyPositionPo>> result = partyPositionService.findByUserId(ContextUtil.getCurrentUserId());
|
|
|
+ String diDian ="";
|
|
|
+ try {
|
|
|
+ diDian = result.getData().get(0).getPath().split(StringPool.BACK_SLASH + StringPool.DOT)[1];
|
|
|
+ }catch (Exception ex){
|
|
|
+ log.error("Can't get didian information",ex);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return diDian;
|
|
|
+ }
|
|
|
+}
|