代码结构
parent
712e1dc737
commit
dcaa9039df
@ -0,0 +1,61 @@
|
|||||||
|
package com.weaver.seconddev.jcl.organization.controller;
|
||||||
|
|
||||||
|
import com.weaver.common.authority.annotation.WeaPermission;
|
||||||
|
import com.weaver.seconddev.jcl.organization.service.EmployeeRelationService;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/secondev/jcl/employeeRelation")
|
||||||
|
public class EmployeeRelationController {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(EmployeeRelationController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmployeeRelationService employeeRelationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结果回写数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@WeaPermission(publicPermission = true)
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@GetMapping("/writeBackRecord")
|
||||||
|
public Map<String, Object> writeBackRecord(
|
||||||
|
@RequestParam("yearMonth") String yearMonth){
|
||||||
|
log.error("writeBackRecord.yearMonth:"+yearMonth);
|
||||||
|
Map<String, Object> actionMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
//查询干部绩效评定结果
|
||||||
|
List<Map<String, Object>> leaderPdInfo = employeeRelationService.queryLeaderPdByYear(yearMonth);
|
||||||
|
log.error("resultCalculAtion.leaderPdInfo:{}", leaderPdInfo);
|
||||||
|
//循环计算干部总分及等级
|
||||||
|
if(CollectionUtils.isNotEmpty(leaderPdInfo)){
|
||||||
|
for (Map<String, Object> map : leaderPdInfo) {
|
||||||
|
//将得分、等级回写到干部考核备案表
|
||||||
|
employeeRelationService.updateLeaderDaInfo(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
actionMap.put("code","200");
|
||||||
|
actionMap.put("msg","接口调用成功!");
|
||||||
|
}catch(Exception e){
|
||||||
|
log.error("接口调用失败-e:{}",e);
|
||||||
|
actionMap.put("code","201");
|
||||||
|
actionMap.put("msg","接口调用失败!");
|
||||||
|
}
|
||||||
|
return actionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.weaver.seconddev.jcl.organization.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface EmployeeRelationService {
|
||||||
|
|
||||||
|
List<Map<String, Object>> queryLeaderPdByYear(String yearMonth);
|
||||||
|
|
||||||
|
void updateLeaderDaInfo(Map<String, Object> map);
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.weaver.seconddev.jcl.organization.service.impl;
|
||||||
|
|
||||||
|
import com.weaver.seconddev.jcl.organization.controller.EmployeeRelationController;
|
||||||
|
import com.weaver.seconddev.jcl.organization.service.EmployeeRelationService;
|
||||||
|
import com.weaver.seconddev.jcl.organization.util.DatabaseUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class EmployeeRelationServiceImpl implements EmployeeRelationService {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(EmployeeRelationController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DatabaseUtils databaseUtils;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> queryLeaderPdByYear(String yearMonth) {
|
||||||
|
String sql="select a.khny,b.* from uf_gbkhpd a left join uf_gbkhpd_mxb1 b on a.id = b.form_data_id where a.khny = '" + yearMonth + "' and a.IS_DELETE = 0 and a.delete_type = 0 and a.TENANT_KEY = 'tscemvfpqg' " ;
|
||||||
|
log.error("queryLeaderPdByYear.sql:{}",sql);
|
||||||
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
||||||
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
||||||
|
log.error("queryLeaderPdByYear.recordList:{}",recordList);
|
||||||
|
return recordList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLeaderDaInfo(Map<String, Object> map) {
|
||||||
|
String khny = String.valueOf(map.get("khny"));
|
||||||
|
String xm = String.valueOf(map.get("xm"));
|
||||||
|
String df = String.valueOf(map.get("df"));
|
||||||
|
String dj = String.valueOf(map.get("dj"));
|
||||||
|
log.error("updateLeaderDaInfo.map:{}",map);
|
||||||
|
String sql="update uf_jcl_gbkhba set ndzhjxkhdf = '" + df + "',ndzhjxkhdj ='" + dj + "' where nd = '" + khny.substring(0, 4) + "' and bkhr = '" + xm + "' ";
|
||||||
|
log.error("updateLeaderDaInfo.sql:{}",sql);
|
||||||
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
||||||
|
log.error("updateEmployeeDjInfo.rs:{}",rs);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue