Compare commits
19 Commits
release
...
shilei-0722
| Author | SHA1 | Date |
|---|---|---|
|
|
fb9b786ba3 | |
|
|
43175f83ac | |
|
|
bb6edb96ad | |
|
|
0066d50237 | |
|
|
bfd5e4323b | |
|
|
8c50718c53 | |
|
|
f44db7cfc6 | |
|
|
835a39c4b5 | |
|
|
b0be700da4 | |
|
|
65161e83e0 | |
|
|
27732527f4 | |
|
|
71792ec032 | |
|
|
9816dbe468 | |
|
|
bbab8c7666 | |
|
|
9d16fd42d7 | |
|
|
87e19b2797 | |
|
|
58976e9142 | |
|
|
68d2203ada | |
|
|
02ee4d5840 |
|
|
@ -0,0 +1,9 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.constant;
|
||||
|
||||
|
||||
public class Constants {
|
||||
public static String TENANT_KEY = "t024j0gfn0";
|
||||
public static String SysUserId = "1167276462243069953";
|
||||
|
||||
public static String templatePath = "/nfs/data/weatempfiles/downloadtemp";
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.constant;
|
||||
|
||||
|
||||
public enum DownLoadTypeEnum {
|
||||
|
||||
INFORMATION("0","info", "info","人员附件下载","附件管理"),
|
||||
CONTRACT("1","contract", "contract","签署文件下载","人事合同"),
|
||||
INCOME("2","income", "income","签署文件下载","收入证明"),
|
||||
EMPLOYMENT("3","employment", "employment","签署文件下载","在职证明"),
|
||||
RESIGN("4","resign", "resign","签署文件下载","离职证明");
|
||||
|
||||
private String code;
|
||||
private String type;
|
||||
|
||||
private String path;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private String description;
|
||||
|
||||
private DownLoadTypeEnum(String code,String type, String path,String fileName,String description) {
|
||||
this.code = code;
|
||||
this.type = type;
|
||||
this.path = path;
|
||||
this.fileName = fileName;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.EstablishmentManagerService;
|
||||
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.RestController;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/chapanda/hrm/est")
|
||||
public class EstablishmentManagerController {
|
||||
private final Logger log = LoggerFactory.getLogger(EstablishmentManagerController.class);
|
||||
|
||||
@Autowired
|
||||
private EstablishmentManagerService establishmentManagerService;
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/quertEstId")
|
||||
public WeaResult<Object> quertEstId(HttpServletRequest request, HttpServletResponse response){
|
||||
String orgId = String.valueOf(request.getParameter("orgId"));
|
||||
log.error("orgId:{}",orgId);
|
||||
String planId = String.valueOf(request.getParameter("planId"));
|
||||
String year = String.valueOf(request.getParameter("year"));
|
||||
String month = String.valueOf(request.getParameter("month"));
|
||||
String orgName = String.valueOf(request.getParameter("orgName"));
|
||||
|
||||
String estCount = String.valueOf(request.getParameter("estCount"));
|
||||
String estCountWithSub = String.valueOf(request.getParameter("estCountWithSub"));
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
String id = establishmentManagerService.quertEstId(orgId,planId,year,month);
|
||||
dataMap.put("id",id);
|
||||
dataMap.put("orgId",orgId);
|
||||
dataMap.put("planId",planId);
|
||||
dataMap.put("year",year);
|
||||
dataMap.put("month",month);
|
||||
dataMap.put("overCtrl","STRONG");
|
||||
dataMap.put("estCount",estCount);
|
||||
dataMap.put("estCountWithSub",estCountWithSub);
|
||||
dataMap.put("syncToSup",true);
|
||||
dataMap.put("onlyCheck",true);
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("data",dataMap);
|
||||
dataJson.put("orgName",orgName);
|
||||
return WeaResult.success(dataJson);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryEstId4Check")
|
||||
public WeaResult<Object> queryEstId4Check(HttpServletRequest request, HttpServletResponse response){
|
||||
String orgId = String.valueOf(request.getParameter("orgId"));
|
||||
log.error("orgId:{}",orgId);
|
||||
String planId = String.valueOf(request.getParameter("planId"));
|
||||
String year = String.valueOf(request.getParameter("year"));
|
||||
String month = String.valueOf(request.getParameter("month"));
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
String id = establishmentManagerService.quertEstId(orgId,planId,year,month);
|
||||
dataMap.put("id",id);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryEstId4Save")
|
||||
public WeaResult<Object> queryEstId4Save(HttpServletRequest request, HttpServletResponse response){
|
||||
String orgId = String.valueOf(request.getParameter("orgId"));
|
||||
log.error("orgId:{}",orgId);
|
||||
String planId = String.valueOf(request.getParameter("planId"));
|
||||
String year = String.valueOf(request.getParameter("year"));
|
||||
String month = String.valueOf(request.getParameter("month"));
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
String id = establishmentManagerService.quertEstId(orgId,planId,year,month);
|
||||
String count = establishmentManagerService.queryEstTotalByOrgId(orgId,planId,year,month);
|
||||
dataMap.put("count",count);
|
||||
dataMap.put("id",id);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryEstTotalByOrgId")
|
||||
public WeaResult<Object> queryEstTotalByOrgId(HttpServletRequest request, HttpServletResponse response){
|
||||
String orgId = String.valueOf(request.getParameter("orgId"));
|
||||
log.error("orgId:{}",orgId);
|
||||
String planId = String.valueOf(request.getParameter("planId"));
|
||||
String year = String.valueOf(request.getParameter("year"));
|
||||
String month = String.valueOf(request.getParameter("month"));
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
String count = establishmentManagerService.queryEstTotalByOrgId(orgId,planId,year,month);
|
||||
dataMap.put("count",count);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryOrgOrderByOrgId")
|
||||
public WeaResult<Object> queryOrgOrderByOrgId(HttpServletRequest request, HttpServletResponse response){
|
||||
String orgIds = String.valueOf(request.getParameter("orgIds"));
|
||||
log.error("orgIds:{}",orgIds);
|
||||
List<Map<String, Object>> list = establishmentManagerService.queryOrgOrderByOrgId(orgIds);
|
||||
return WeaResult.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,464 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.DownLoadTypeEnum;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.HrmDownloadFilesService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/chapanda/hrm/cert")
|
||||
public class HrmCertificateFilesController {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(HrmCertificateFilesController.class);
|
||||
|
||||
@Autowired
|
||||
HrmDownloadFilesService hrmDownloadFilesService;
|
||||
|
||||
/***
|
||||
*
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getincomepath")
|
||||
public WeaResult<Object> getIncomePath(@RequestBody Map<String,Object> paramMap){
|
||||
String data = String.valueOf(paramMap.get("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
log.error("decodedData:{}",decodedData);
|
||||
if(StringUtils.isNotBlank(decodedData)){
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(decodedData);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.INCOME.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getincomepath2")
|
||||
public WeaResult<Object> getIncomePath2(@RequestBody JSONObject jsonObject){
|
||||
String data = String.valueOf(jsonObject.getString("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
// String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
// log.error("decodedData:{}",decodedData);
|
||||
// if(StringUtils.isNotBlank(decodedData)){
|
||||
// try{
|
||||
// dataArray = JSONArray.parseArray(decodedData);
|
||||
// }catch (Exception e){
|
||||
// log.error("{}",e);
|
||||
// }
|
||||
// }
|
||||
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.INCOME.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 离职证明下载接口
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getresignpath")
|
||||
public WeaResult<Object> getResignPath(@RequestBody Map<String,Object> paramMap){
|
||||
String data = String.valueOf(paramMap.get("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
log.error("decodedData:{}",decodedData);
|
||||
if(StringUtils.isNotBlank(decodedData)){
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(decodedData);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.RESIGN.getPath());
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getresignpath2")
|
||||
public WeaResult<Object> getResignPath2(@RequestBody JSONObject jsonObject){
|
||||
String data = String.valueOf(jsonObject.getString("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
// String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
// log.error("decodedData:{}",decodedData);
|
||||
// if(StringUtils.isNotBlank(decodedData)){
|
||||
// try{
|
||||
// dataArray = JSONArray.parseArray(decodedData);
|
||||
// }catch (Exception e){
|
||||
// log.error("{}",e);
|
||||
// }
|
||||
// }
|
||||
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.RESIGN.getPath());
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 在职证明下载接口
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getemploymentpath")
|
||||
public WeaResult<Object> getEmploymentPath(@RequestBody Map<String,Object> paramMap){
|
||||
String data = String.valueOf(paramMap.get("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
if(StringUtils.isNotBlank(decodedData)){
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(decodedData);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray,DownLoadTypeEnum.EMPLOYMENT.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getemploymentpath2")
|
||||
public WeaResult<Object> getEmploymentPath2(@RequestBody JSONObject jsonObject){
|
||||
String data = String.valueOf(jsonObject.getString("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
// String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
// if(StringUtils.isNotBlank(decodedData)){
|
||||
// try{
|
||||
// dataArray = JSONArray.parseArray(decodedData);
|
||||
// }catch (Exception e){
|
||||
// log.error("{}",e);
|
||||
// }
|
||||
// }
|
||||
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray,DownLoadTypeEnum.EMPLOYMENT.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getcontractpath")
|
||||
public WeaResult<Object> getContractPath(@RequestBody Map<String,Object> paramMap){
|
||||
String data = String.valueOf(paramMap.get("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
if(StringUtils.isNotBlank(decodedData)){
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(decodedData);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.CONTRACT.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getcontractpath2")
|
||||
public WeaResult<Object> getContractPath2(@RequestBody JSONObject jsonObject){
|
||||
String data = String.valueOf(jsonObject.getString("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
// String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
// if(StringUtils.isNotBlank(decodedData)){
|
||||
// try{
|
||||
// dataArray = JSONArray.parseArray(decodedData);
|
||||
// }catch (Exception e){
|
||||
// log.error("{}",e);
|
||||
// }
|
||||
// }
|
||||
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.CONTRACT.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
/***
|
||||
* 电子签名模板预览接口
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/downloadZip")
|
||||
public ResponseEntity downloadZip(HttpServletRequest request) throws IOException{
|
||||
String data = request.getParameter("data");
|
||||
String type = request.getParameter("type");
|
||||
log.error("data2:{}",data);
|
||||
log.error("typ2e:{}",type);
|
||||
String filename = "";
|
||||
try{
|
||||
DownLoadTypeEnum[] values = DownLoadTypeEnum.values();
|
||||
for (DownLoadTypeEnum item : values) {
|
||||
log.error("item.getCode():{}",item.getCode());
|
||||
if(item.getCode().equals(type)){
|
||||
filename = DownLoadTypeEnum.INCOME.getFileName();
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(filename)){
|
||||
filename = URLEncoder.encode(filename, "UTF-8"); // 使用UTF-8编码
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
|
||||
log.error("filename2:{}",filename);
|
||||
|
||||
if(StringUtils.isNotBlank(filename)){
|
||||
log.error("data:{}",data);
|
||||
String zipFilePath = "";
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
zipFilePath = hrmDownloadFilesService.convertBase64Data(data);
|
||||
}
|
||||
log.error("zipFilePath:{}",zipFilePath);
|
||||
if(StringUtils.isNotBlank(zipFilePath) && zipFilePath.contains(Constants.templatePath) && new File(zipFilePath).exists()){
|
||||
// 文件转成字节数组
|
||||
File file = ResourceUtils.getFile(zipFilePath);
|
||||
byte[] fileBytes = Files.readAllBytes(file.toPath());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String filename2 = filename+"-"+sdf.format(new Date())+".zip";
|
||||
log.error("filename2:{}",filename2);
|
||||
|
||||
return ResponseEntity.ok().contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + new String(filename2.getBytes(), "UTF-8") + "\"")
|
||||
.body(fileBytes);
|
||||
}else{
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new String("文件下载失败".getBytes(), "utf-8"));
|
||||
}
|
||||
}else{
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new String("文件下载失败".getBytes(), "utf-8"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 测试接口
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/test")
|
||||
public WeaResult<Object> test(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
Map<String, Object> recordMap = new HashMap<String,Object>();
|
||||
recordMap.put("test","test");
|
||||
return WeaResult.success(recordMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getcontractfile")
|
||||
public WeaResult<Object> getContractFilePath(@RequestBody Map<String,Object> paramMap){
|
||||
String data = String.valueOf(paramMap.get("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)) {
|
||||
try {
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
} catch (Exception e) {
|
||||
log.error("{}", e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.CONTRACT.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getcontractfile2")
|
||||
public WeaResult<Object> getContractFilePath2(@RequestBody JSONObject jsonObject){
|
||||
String data = String.valueOf(jsonObject.getString("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)) {
|
||||
try {
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
} catch (Exception e) {
|
||||
log.error("{}", e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.CONTRACT.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getcontractfile3")
|
||||
public WeaResult<Object> getContractFilePath3(@RequestParam("data") String data){
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)) {
|
||||
try {
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
} catch (Exception e) {
|
||||
log.error("{}", e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.CONTRACT.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getcontractfile4")
|
||||
public WeaResult<Object> getContractFilePath4(@RequestBody Map<String,String> paramMap){
|
||||
String data = String.valueOf(paramMap.get("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)) {
|
||||
try {
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
} catch (Exception e) {
|
||||
log.error("{}", e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = hrmDownloadFilesService.convertZipFile(dataArray, DownLoadTypeEnum.CONTRACT.getPath());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String data = "[{\"fileid\":\"1180268038345793538\"}]";
|
||||
if(StringUtils.isNotBlank(data)) {
|
||||
try {
|
||||
JSONArray dataArray = JSONArray.parseArray(data);
|
||||
System.out.println(dataArray);
|
||||
} catch (Exception e) {
|
||||
System.out.println( e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,401 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.eteams.file.client.file.FileData;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.DownLoadTypeEnum;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.HrmDownloadFilesService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import java.util.Base64;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/chapanda/hrm/info")
|
||||
public class HrmInformationFilesController {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(HrmInformationFilesController.class);
|
||||
|
||||
@Autowired
|
||||
private FileDownloadService fileDownloadService;
|
||||
|
||||
@Autowired
|
||||
HrmDownloadFilesService hrmDownloadFilesService;
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getinformationpath")
|
||||
public WeaResult<Object> getInformationPath(@RequestBody Map<String,Object> paramMap){
|
||||
String data = String.valueOf(paramMap.get("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
log.error("decodedData:{}",decodedData);
|
||||
if(StringUtils.isNotBlank(decodedData)){
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(decodedData);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = convertZipFile(dataArray, DownLoadTypeEnum.INFORMATION.getCode());
|
||||
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
// String filename = sdf.format(new Date())+".zip";
|
||||
//
|
||||
// String directoryPath = Constants.templatePath+File.separator+sdf.format(new Date());
|
||||
// // 将字符串路径转换为Path对象
|
||||
// Path path = Paths.get(directoryPath);
|
||||
// // 检查目录是否存在
|
||||
// if (Files.notExists(path)) {
|
||||
// try {
|
||||
// Files.createDirectories(path);
|
||||
// } catch (IOException e) {
|
||||
// log.error("e:{}",e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// String zipFilePath = directoryPath+File.separator+filename;
|
||||
// try {
|
||||
// log.error("path:{}",zipFilePath);
|
||||
// FileOutputStream fos = new FileOutputStream(zipFilePath);
|
||||
// ZipOutputStream zos = new ZipOutputStream(fos);
|
||||
// for(int i=0;i<dataArray.size();i++){
|
||||
// JSONObject dataObject = dataArray.getJSONObject(i);
|
||||
// String jobNum = dataObject.getString("jobnum");
|
||||
// String userName = dataObject.getString("username");
|
||||
// String fileId = dataObject.getString("fileid");
|
||||
//
|
||||
// log.error("fileId:{}",fileId);
|
||||
// log.error("userName:{}",userName);
|
||||
// log.error("jobNum:{}",jobNum);
|
||||
//
|
||||
// if(StringUtils.isNotBlank(fileId)){
|
||||
// try {
|
||||
// FileData fileData = fileDownloadService.downloadFile(Long.parseLong(fileId));
|
||||
// FileObj fileObj = fileData.getFileObj();
|
||||
// // 获取文件的输入流
|
||||
// InputStream inputStream = fileData.getInputStream();
|
||||
// log.error("inputStream:{}",inputStream.available());
|
||||
// String fileName = fileObj.getName();
|
||||
// log.error("fileName:{}",fileName);
|
||||
// byte[] filedata = hrmDownloadFilesService.convertInputStreamToBytes(inputStream);
|
||||
//
|
||||
// addFileToZip(zos, filedata, fileName,jobNum,userName);
|
||||
// } catch (IOException e) {
|
||||
// log.error("e:" , e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// zos.close();
|
||||
// fos.close();
|
||||
// }catch (IOException e){
|
||||
// log.error("e:{}",e);
|
||||
// }
|
||||
|
||||
// String newZipFilePath = "";
|
||||
// File zipFile = new File(zipFilePath);
|
||||
// if(zipFile.exists()){
|
||||
// newZipFilePath = zipFile.getPath();
|
||||
// }
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getinformationpath2")
|
||||
public WeaResult<Object> getInformationPath2(@RequestBody JSONObject jsonObject){
|
||||
String data = String.valueOf(jsonObject.getString("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
// String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
// log.error("decodedData:{}",decodedData);
|
||||
// if(StringUtils.isNotBlank(decodedData)){
|
||||
// try{
|
||||
// dataArray = JSONArray.parseArray(decodedData);
|
||||
// }catch (Exception e){
|
||||
// log.error("{}",e);
|
||||
// }
|
||||
// }
|
||||
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = convertZipFile(dataArray, DownLoadTypeEnum.INFORMATION.getCode());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getinformationpath3")
|
||||
public WeaResult<Object> getInformationPath3(@RequestBody JSONObject jsonObject){
|
||||
String data = String.valueOf(jsonObject.getString("data"));
|
||||
log.error("data:{}",data);
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
// String decodedData = hrmDownloadFilesService.convertBase64Data(data);
|
||||
// log.error("decodedData:{}",decodedData);
|
||||
// if(StringUtils.isNotBlank(decodedData)){
|
||||
// try{
|
||||
// dataArray = JSONArray.parseArray(decodedData);
|
||||
// }catch (Exception e){
|
||||
// log.error("{}",e);
|
||||
// }
|
||||
// }
|
||||
|
||||
try{
|
||||
dataArray = JSONArray.parseArray(data);
|
||||
}catch (Exception e){
|
||||
log.error("{}",e);
|
||||
}
|
||||
}
|
||||
log.error("dataArray:{}",dataArray.size());
|
||||
|
||||
String newZipFilePath = convertZipFile(dataArray, DownLoadTypeEnum.INFORMATION.getCode());
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
dataMap.put("filepath",newZipFilePath);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
/***
|
||||
* 转换为zip文件
|
||||
* @param dataArray
|
||||
* @param downloadType
|
||||
* @return
|
||||
*/
|
||||
public String convertZipFile(JSONArray dataArray,String downloadType) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String filename = sdf.format(new Date())+".zip";
|
||||
|
||||
String directoryPath = Constants.templatePath+ File.separator+downloadType+File.separator+sdf.format(new Date());
|
||||
// 将字符串路径转换为Path对象
|
||||
Path path = Paths.get(directoryPath);
|
||||
// 检查目录是否存在
|
||||
if (Files.notExists(path)) {
|
||||
try {
|
||||
Files.createDirectories(path);
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
}
|
||||
|
||||
String zipFilePath = directoryPath+File.separator+filename;
|
||||
FileOutputStream fos = null;
|
||||
ZipOutputStream zos = null;
|
||||
try {
|
||||
log.error("path:{}",zipFilePath);
|
||||
fos = new FileOutputStream(zipFilePath);
|
||||
zos = new ZipOutputStream(fos);
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject dataObject = dataArray.getJSONObject(i);
|
||||
String jobNum = dataObject.getString("jobnum");
|
||||
String userName = dataObject.getString("username");
|
||||
String fileId = dataObject.getString("fileid");
|
||||
|
||||
log.error("fileId:{}",fileId);
|
||||
log.error("userName:{}",userName);
|
||||
log.error("jobNum:{}",jobNum);
|
||||
|
||||
if(StringUtils.isNotBlank(fileId)){
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
|
||||
FileData fileData = fileDownloadService.downloadFile(Long.parseLong(fileId));
|
||||
FileObj fileObj = fileData.getFileObj();
|
||||
// 获取文件的输入流
|
||||
inputStream = fileData.getInputStream();
|
||||
log.error("inputStream:{}",inputStream.available());
|
||||
String fileName = fileObj.getName();
|
||||
log.error("fileName:{}",fileName);
|
||||
byte[] filedata = hrmDownloadFilesService.convertInputStreamToBytes(inputStream);
|
||||
|
||||
addFileToZip2(zos, filedata, fileName);
|
||||
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
log.error("e:" , e);
|
||||
}finally {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zos.close();
|
||||
fos.close();
|
||||
}catch (IOException e){
|
||||
log.error("e:{}",e);
|
||||
}finally {
|
||||
try {
|
||||
if (zos != null) {
|
||||
zos.close();
|
||||
}
|
||||
if (fos != null) {
|
||||
fos.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String newZipFilePath = "";
|
||||
File zipFile = new File(zipFilePath);
|
||||
if(zipFile.exists()){
|
||||
newZipFilePath = zipFile.getPath();
|
||||
}
|
||||
return newZipFilePath;
|
||||
}
|
||||
|
||||
/***
|
||||
* 电子签名模板预览接口
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/downloadZip")
|
||||
public ResponseEntity downloadZip(HttpServletRequest request) throws IOException{
|
||||
String data = request.getParameter("data");
|
||||
String type = request.getParameter("type");
|
||||
log.error("data2:{}",data);
|
||||
log.error("typ2e:{}",type);
|
||||
String filename = "";
|
||||
try{
|
||||
DownLoadTypeEnum[] values = DownLoadTypeEnum.values();
|
||||
for (DownLoadTypeEnum item : values) {
|
||||
log.error("item.getCode():{}",item.getCode());
|
||||
if(item.getCode().equals(type)){
|
||||
filename = DownLoadTypeEnum.INFORMATION.getFileName();
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(filename)){
|
||||
filename = URLEncoder.encode(filename, "UTF-8"); // 使用UTF-8编码
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
String zipFilePath = "";
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
zipFilePath = hrmDownloadFilesService.convertBase64Data(data);
|
||||
}
|
||||
if(StringUtils.isNotBlank(filename)){
|
||||
log.error("zipFilePath:{}",zipFilePath);
|
||||
if(StringUtils.isNotBlank(zipFilePath) && zipFilePath.contains(Constants.templatePath) && new File(zipFilePath).exists()){
|
||||
// 文件转成字节数组
|
||||
File file = ResourceUtils.getFile(zipFilePath);
|
||||
byte[] fileBytes = Files.readAllBytes(file.toPath());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String filename2 = filename+"-"+sdf.format(new Date())+".zip";
|
||||
return ResponseEntity.ok().contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + new String(filename2.getBytes(), "UTF-8") + "\"")
|
||||
.body(fileBytes);
|
||||
}else{
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new String("文件下载失败".getBytes(), "utf-8"));
|
||||
}
|
||||
}else{
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new String("文件下载失败".getBytes(), "utf-8"));
|
||||
}
|
||||
}
|
||||
|
||||
// 将文件添加到zip输出流
|
||||
private void addFileToZip(ZipOutputStream zos, byte[] fileData, String entryName,String jobNum,String fileName) throws IOException {
|
||||
ZipEntry entry = new ZipEntry(fileName+"_"+jobNum+"/"+entryName);
|
||||
zos.putNextEntry(entry);
|
||||
zos.write(fileData);
|
||||
zos.closeEntry();
|
||||
}
|
||||
|
||||
private void addFileToZip2(ZipOutputStream zos, byte[] fileData, String entryName) throws IOException {
|
||||
// ZipEntry entry = new ZipEntry(fileName+"_"+jobNum+"/"+entryName);
|
||||
ZipEntry entry = new ZipEntry(entryName);
|
||||
zos.putNextEntry(entry);
|
||||
zos.write(fileData);
|
||||
zos.closeEntry();
|
||||
}
|
||||
/**
|
||||
* 测试接口
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/test")
|
||||
public WeaResult<Object> test(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
Map<String, Object> recordMap = new HashMap<String,Object>();
|
||||
recordMap.put("test","test");
|
||||
return WeaResult.success(recordMap);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String originalString = "/nfs/data/weatempfiles/downloadtemp/1111/1111.zip";
|
||||
|
||||
//
|
||||
// String originalString = "[{\"fielid\":\"1169600692452909062\",\"jobnum\":\"10000000000\",\"username\":\"王文猛\"},{\"fielid\":\"1169600688166330369\",\"jobnum\":\"10000000000\",\"username\":\"王文猛\"},{\"fielid\":\"1167396240209780739\",\"jobnum\":\"1000002229\",\"username\":\"崔晓龙\"},{\"fielid\":\"1167650515133440001\",\"jobnum\":\"1000002805\",\"username\":\"刘琪琪\"},{\"fielid\":\"1167395969819779075\",\"jobnum\":\"1000003958\",\"username\":\"刘颖慧\"},{\"fielid\":\"1169538849218813953\",\"jobnum\":\"1000003958\",\"username\":\"刘颖慧\"},{\"fielid\":\"1169601053305659394\",\"jobnum\":\"1000003958\",\"username\":\"刘颖慧\"},{\"fielid\":\"1169543698203336705\",\"jobnum\":\"1000003958\",\"username\":\"刘颖慧\"},{\"fielid\":\"1169501139481452545\",\"jobnum\":\"1000004336\",\"username\":\"蒋欢\"},{\"fielid\":\"1167403559018602499\",\"jobnum\":\"1000004410\",\"username\":\"刘贤松\"},{\"fielid\":\"1167394818600771585\",\"jobnum\":\"1000004846\",\"username\":\"刘刚菊\"},{\"fielid\":\"1167389900896772097\",\"jobnum\":\"1000006146\",\"username\":\"周娟\"},{\"fielid\":\"1169540279359037441\",\"jobnum\":\"1000006146\",\"username\":\"周娟\"},{\"fielid\":\"1167718573191520257\",\"jobnum\":\"1000006146\",\"username\":\"周娟\"}]";
|
||||
// 将字符串转换为字节数组
|
||||
byte[] bytesToEncode = originalString.getBytes();
|
||||
|
||||
// 创建Base64编码器
|
||||
Base64.Encoder encoder = Base64.getEncoder();
|
||||
|
||||
// 编码字节数组
|
||||
String encodedString = encoder.encodeToString(bytesToEncode);
|
||||
|
||||
System.out.println("Encoded String: " + encodedString);
|
||||
|
||||
Base64.Decoder decoder = Base64.getDecoder();
|
||||
|
||||
// 解码Base64字符串
|
||||
byte[] bytesDecoded = decoder.decode(encodedString);
|
||||
|
||||
// 将字节数组转换回字符串
|
||||
String decodedString = new String(bytesDecoded);
|
||||
|
||||
System.out.println("Decoded String: " + decodedString);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.HrmShiftQueryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.hrm.controller
|
||||
*
|
||||
* @ClassName HrmShiftQueryController
|
||||
* @Author shil
|
||||
* @Date 2025/10/16 13:37
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/chapanda/hrm/shift")
|
||||
public class HrmShiftQueryController {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(HrmShiftQueryController.class);
|
||||
|
||||
@Autowired
|
||||
private HrmShiftQueryService hrmShiftQueryService;
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/queryShiftList")
|
||||
public WeaResult<Object> queryShiftList(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.queryShiftList(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/getShiftList")
|
||||
public WeaResult<Object> getShiftList(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.queryShiftList(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/querySchedulingList")
|
||||
public WeaResult<Object> querySchedulingList(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.querySchedulingList(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/getSchedulingList")
|
||||
public WeaResult<Object> getSchedulingList(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.querySchedulingList(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/operateScheduling")
|
||||
public WeaResult<Object> operateScheduling(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.operateScheduling(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.HrmShiftQueryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.hrm.controller
|
||||
*
|
||||
* @ClassName HrmShiftQueryController
|
||||
* @Author shil
|
||||
* @Date 2025/10/16 13:37
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sapi/secondev/cbd/hrm/shift")
|
||||
public class HrmShiftQueryOpenController {
|
||||
private final Logger log = LoggerFactory.getLogger(HrmShiftQueryOpenController.class);
|
||||
@Autowired
|
||||
private HrmShiftQueryService hrmShiftQueryService;
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/queryShiftList")
|
||||
public WeaResult<Object> queryShiftList(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.queryShiftList(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/getShiftList")
|
||||
public WeaResult<Object> getShiftList(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.queryShiftList(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/querySchedulingList")
|
||||
public WeaResult<Object> querySchedulingList(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.querySchedulingList(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/getSchedulingList")
|
||||
public WeaResult<Object> getSchedulingList(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.querySchedulingList(paramJson);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/operateScheduling")
|
||||
public WeaResult<Object> operateScheduling(@RequestBody JSONObject paramJson){
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = hrmShiftQueryService.operateScheduling(paramJson);
|
||||
|
||||
String schedulingids = "";
|
||||
for(int i= 0 ;i<dataList.size();i++){
|
||||
Map<String,Object> dataMap = dataList.get(i);
|
||||
if(dataMap.containsKey("schedulingid")){
|
||||
String schedulingid = dataMap.get("schedulingid").toString();
|
||||
schedulingids += StringUtils.isBlank(schedulingids) ? schedulingid : ","+schedulingid;
|
||||
}
|
||||
}
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("schedulingid",schedulingids);
|
||||
return WeaResult.success(result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.*;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.HrmTableFieldService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/chapanda/hrm/form")
|
||||
public class HrmTableFieldController {
|
||||
private final Logger log = LoggerFactory.getLogger(HrmTableFieldController.class);
|
||||
|
||||
@Autowired
|
||||
private HrmTableFieldService hrmTableFieldService;
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/getdetailfield")
|
||||
public WeaResult<Object> getDetailField(HttpServletRequest request, HttpServletResponse response){
|
||||
String tablename = String.valueOf(request.getParameter("tablename"));
|
||||
log.error("tablename:{}",tablename);
|
||||
String detailname = String.valueOf(request.getParameter("detailname"));
|
||||
log.error("detailname:{}",detailname);
|
||||
List<Map<String,Object>> dataList = hrmTableFieldService.queryTableDetailFieldByTableName(tablename,detailname);
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.framework.rpc.annotation.RpcReference;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.WorkflowCommonService;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import com.weaver.workflow.core.api.rest.flow.entity.operate.WfcRequestDeleteParamDataEntity;
|
||||
import com.weaver.workflow.core.api.rest.flow.entity.operate.WfcRequestOperationResultDto;
|
||||
import com.weaver.workflow.core.api.rest.publicapi.WfcRequestOperateRest;
|
||||
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.RestController;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/chapanda/hrm/request")
|
||||
public class WorkflowCommonController {
|
||||
private final Logger log = LoggerFactory.getLogger(WorkflowCommonController.class);
|
||||
|
||||
@Autowired
|
||||
private WorkflowCommonService workflowCommonService;
|
||||
|
||||
|
||||
@RpcReference
|
||||
WfcRequestOperateRest wfcRequestOperateRest;
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryRequestDraftCount")
|
||||
public WeaResult<Object> queryRequestDraftCount(HttpServletRequest request, HttpServletResponse response){
|
||||
String employeeid = String.valueOf(request.getParameter("employeeid"));
|
||||
log.error("employeeid:{}",employeeid);
|
||||
|
||||
String workflowid = String.valueOf(request.getParameter("workflowid"));
|
||||
log.error("workflowid:{}",workflowid);
|
||||
|
||||
Map<String,Object> dataMap = workflowCommonService.queryRequestDraftCount(employeeid,workflowid);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/deleteRequestDraft")
|
||||
public WeaResult<WfcRequestOperationResultDto> deleteRequestDraft(HttpServletRequest request, HttpServletResponse response){
|
||||
String requestid = String.valueOf(request.getParameter("requestid"));
|
||||
SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
|
||||
WfcRequestDeleteParamDataEntity wfcDeleteData = new WfcRequestDeleteParamDataEntity();
|
||||
wfcDeleteData.setRequestIds(requestid);
|
||||
WeaResult<WfcRequestOperationResultDto> result =wfcRequestOperateRest.deleteFlow(wfcDeleteData,simpleEmployee);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.WorkflowLeaveService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.RestController;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/chapanda/hrm/leave")
|
||||
public class WorkflowLeaveController {
|
||||
private final Logger log = LoggerFactory.getLogger(WorkflowLeaveController.class);
|
||||
|
||||
@Autowired
|
||||
private WorkflowLeaveService workflowLeaveService;
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryAttendanceTime")
|
||||
public WeaResult<Object> queryAttendanceTime(HttpServletRequest request, HttpServletResponse response){
|
||||
String employeeid = String.valueOf(request.getParameter("employeeid"));
|
||||
log.error("employeeid:{}",employeeid);
|
||||
String date = String.valueOf(request.getParameter("date"));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
if(StringUtils.isBlank(date)){
|
||||
date = sdf.format(new Date());
|
||||
}
|
||||
log.error("date:{}",date);
|
||||
Map<String,Object> dataMap = workflowLeaveService.queryAttendanceTime(employeeid,date);
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.hrm.util.DatabaseUtils;
|
||||
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.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class EstablishmentManagerDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(EstablishmentManagerDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
|
||||
/***
|
||||
* @return
|
||||
*/
|
||||
public String quertEstId(String orgId,String planId,String year,String month){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
|
||||
String id = "";
|
||||
try{
|
||||
String dataSql =" select id from hr_est_cfg \n" +
|
||||
" where org_id= ?\n" +
|
||||
" and plan_id = ? \n" +
|
||||
" and cfg_year = ? \n" +
|
||||
" and cfg_month = ? " +
|
||||
" and delete_type = 0 and tenant_key =?" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(orgId);
|
||||
paramList.add(planId);
|
||||
paramList.add(year);
|
||||
paramList.add(month);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
id = recordList.get(0).get("id").toString();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public String queryEstTotalByOrgId(String orgId,String planId,String year,String month){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
String count = "0";
|
||||
try{
|
||||
String dataSql =" select ifnull(sum(est_count),0) as count \n" +
|
||||
" from hr_est_cfg \n" +
|
||||
" where tenant_key = ? \n" +
|
||||
" and delete_type=0 \n" +
|
||||
" and cfg_year = ? \n" +
|
||||
" and cfg_month = ? \n" +
|
||||
" and org_plan_status = 1 \n" +
|
||||
" and org_id IN (\n" +
|
||||
" select cid from eteams.depart_link \n" +
|
||||
" where pid = ? \n" +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type=0 \n" +
|
||||
")" ;
|
||||
|
||||
// String dataSql =" select ifnull(sum(est_count_with_sub),0) as count \n" +
|
||||
// " from hr_est_cfg \n" +
|
||||
// " where tenant_key = ? \n" +
|
||||
// " and delete_type=0 \n" +
|
||||
// " and cfg_year = ? \n" +
|
||||
// " and cfg_month = ? \n" +
|
||||
// " and org_plan_status = 1 \n" +
|
||||
// " and org_id IN (\n" +
|
||||
// " select id from " +
|
||||
// " eteams.department \n" +
|
||||
// " where parent = ? \n" +
|
||||
// " and tenant_key = ? \n" +
|
||||
// " and delete_type=0 \n" +
|
||||
// ")" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(year);
|
||||
paramList.add(month);
|
||||
paramList.add(orgId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
count = recordList.get(0).get("count").toString();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> queryEstTotalByOrgId(String orgIds){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
orgIds = "'"+orgIds.replace(",","','")+"'";
|
||||
String dataSql =" select id,datarank,name \n" +
|
||||
" from eteams.department\n" +
|
||||
" where is_delete =0 \n" +
|
||||
" and `type` ='department'\n" +
|
||||
" and tenant_key= ?\n" +
|
||||
" and id in("+orgIds+") \n" +
|
||||
" order by datarank " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.weaver.seconddev.chapanda.hrm.util.DatabaseUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class HrmFormFieldDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmFormFieldDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
|
||||
/***
|
||||
* 获取eb表的appid和formid
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> queryTableFormId(String tableName){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataSql =" select id,app_id from ebdf_obj where table_name=? and delete_type=0 and tenant_key=?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(tableName);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
recordMap = recordList.get(0);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取Eb表的字段信息
|
||||
* @param dataKeyList
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryFromTableField(String formTable,List<String> dataKeyList){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> fieldMap = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataKey = dataKeyList.stream().collect(Collectors.joining(","));
|
||||
dataKey = "'"+dataKey.replace(",","','")+"'" ;
|
||||
|
||||
String dataSql =" select id,form_id,title,data_key " +
|
||||
" from form_field " +
|
||||
" where form_id in( select form_id from form_table where table_name=? and delete_type=0 and tenant_key=? ) \n" +
|
||||
" and data_key in("+dataKey+")\n" +
|
||||
" and sub_form_id is null " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(formTable);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String data_key = String.valueOf(recordMap.get("data_key"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
fieldMap.put(data_key,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return fieldMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取下拉框的名称
|
||||
* @param fieldId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryFieldOptionByFieldid(String fieldId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> optionMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select name,value_key from field_option where field_id=? " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(fieldId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String name = String.valueOf(recordMap.get("name"));
|
||||
String value_key = String.valueOf(recordMap.get("value_key"));
|
||||
optionMap.put(value_key,name);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return optionMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public String queryTableFormIdByTableName(String tableName){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String form_id = "";
|
||||
try{
|
||||
String dataSql =" select form_id from form_table where table_name=? and delete_type=0 and tenant_key=?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(tableName);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryTableFormId:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
Map<String, Object> recordMap = recordList.get(0);
|
||||
form_id = String.valueOf(recordMap.get("form_id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return form_id;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> queryTableDetailFieldByTableName(String tableName,String detailName){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
|
||||
// String dataSql =" select id,form_id,title,data_key\n" +
|
||||
// " from form_field\n" +
|
||||
// " where form_id in( select form_id from form_table where table_name='uf_xxbgcj' and delete_type=0 and tenant_key =?)\n" +
|
||||
// " and sub_form_id in(select id from sub_form where data_key='uf_jcl_empxxbg_work' and FORM_ID in(select form_id from form_table where table_name='uf_xxbgcj' and delete_type=0 and tenant_key=?) and delete_type=0 and tenant_key =? \n" +
|
||||
// " )\n" +
|
||||
// " and delete_type=0\n" +
|
||||
// " and tenant_key = ?" ;
|
||||
|
||||
String dataSql =" select id,form_id,title,data_key\n" +
|
||||
" from form_field\n" +
|
||||
" where form_id in( select form_id from form_table where table_name=? and delete_type=0 and tenant_key =?)\n" +
|
||||
" and sub_form_id in(select id from sub_form where data_key=? and form_id in(select form_id from form_table where table_name=? and delete_type=0 and tenant_key=?) and delete_type=0 and tenant_key =? \n" +
|
||||
" )\n" +
|
||||
" and delete_type=0\n" +
|
||||
" and tenant_key = ?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(tableName);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(detailName);
|
||||
paramList.add(tableName);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
}catch (Exception e){
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,377 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.dao;
|
||||
|
||||
import com.weaver.common.elog.util.DateUtils;
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.hrm.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class HrmShiftQueryDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmShiftQueryDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/***
|
||||
*
|
||||
* @param type
|
||||
* @param isStore
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> queryShiftList(String type,String isStore){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
String dataSql =" select \n" +
|
||||
" b.id, " +
|
||||
" b.name, " +
|
||||
" a.sfmdbc, " +
|
||||
" a.fdjjrbc " +
|
||||
" from e10_common.uf_kq_mdbcdy a\n" +
|
||||
" inner join (select * from e10_other_business.attend_shift where delete_type=0 and tenant_key = ?) b on a.bc=b.id\n" +
|
||||
" where a.sfmdbc = ? \n" +
|
||||
" and a.fdjjrbc = ? \n" +
|
||||
" and a.delete_type = 0 " +
|
||||
" and a.tenant_key=?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(isStore);
|
||||
paramList.add(type);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
|
||||
Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, Object> entry = iterator.next();
|
||||
log.error(" Key = " + entry.getKey() + ", Value = " + entry.getValue());
|
||||
}
|
||||
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
}catch (Exception e){
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param shiftid
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> queryShiftTimeList(String shiftid){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
|
||||
String dataSql =" select attend_start_time,attend_end_time\n" +
|
||||
" from attend_period \n" +
|
||||
" where delete_type=0 \n" +
|
||||
" and attend_shift_id=? " +
|
||||
" and tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(shiftid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
}catch (Exception e){
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param beginDate
|
||||
* @param endDate
|
||||
* @param empCode
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> querySchedulingList(String beginDate,String endDate,String empCode){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
String dataSql =" select \n" +
|
||||
" d.job_num, \n" +
|
||||
" d.username, \n" +
|
||||
" c.id bcid, \n" +
|
||||
" c.name bcname, \n" +
|
||||
" a.attend_date pbrq \n" +
|
||||
" from (select * from e10_other_business.attend_scheduling where delete_type=0 and tenant_key = ?) a\n" +
|
||||
" inner join (select * from e10_other_business.attend_config_range where delete_type=0 and entry_type='user' and tenant_key = ? ) b on a.range_id=b.id\n" +
|
||||
" inner join (select * from e10_other_business.attend_shift where delete_type=0 and tenant_key = ? ) c on a.shift_id=c.id\n" +
|
||||
" inner join (select * from eteams.employee where delete_type=0 and tenant_key = ? ) d on b.target_id=d.ID\n" +
|
||||
" where a.attend_date >= ? \n" +
|
||||
" and a.attend_date <= ? \n" +
|
||||
" and d.job_num = ? and d.tenant_key = ? and d.delete_type=0 " ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(beginDate);
|
||||
paramList.add(endDate);
|
||||
paramList.add(empCode);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
public String queryEmployeeIdByCode(String empCode){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String employeeId = "";
|
||||
try{
|
||||
String dataSql =" select id from eteams.employee where job_num= ? and tenant_key = ? and delete_type=0 " ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(empCode);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
employeeId = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return employeeId;
|
||||
}
|
||||
|
||||
|
||||
public String queryAttendConfig(String scId){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
String attendConfig = "";
|
||||
try{
|
||||
String dataSql =" select attend_config \n" +
|
||||
" from attend_scheduling_shift \n" +
|
||||
" where delete_type = 0 \n" +
|
||||
" and attend_shift = ? and tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(scId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:" + recordList.size());
|
||||
|
||||
if(recordList.size()>0){
|
||||
attendConfig = String.valueOf(recordList.get(0).get("attend_config"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return attendConfig;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String queryRangeIdByconfigId(String employeeId,String attendConfig){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
String rangeId = "";
|
||||
try{
|
||||
String dataSql =" select id \n" +
|
||||
" from attend_config_range\n" +
|
||||
" where delete_type=0\n" +
|
||||
" and target_id= ? \n" +
|
||||
" and entry_type='user' \n" +
|
||||
" and attend_config= ? and tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeId);
|
||||
paramList.add(attendConfig);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
rangeId = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return rangeId;
|
||||
}
|
||||
|
||||
public String queryRangeCount(){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
String count = "0";
|
||||
try{
|
||||
String dataSql =" select count(1) as cou \n" +
|
||||
" from attend_config_range\n" +
|
||||
" where delete_type=0\n" +
|
||||
" and entry_type='user' \n" +
|
||||
" and tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size()>0){
|
||||
count = String.valueOf(recordList.get(0).get("cou"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,Object> insertAttendConfigRange(Long id,String employeeId,String attendConfig,String sort_num){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
Map<String,Object> result = new HashMap<String,Object>();
|
||||
try{
|
||||
String create_time = DateUtils.getCurrentDateString() + " " + DateUtils.getOnlyCurrentTimeString();
|
||||
String dataSql =" insert into attend_config_range(id,target_id,entry_type,attend_config,tenant_key,create_time,update_time,delete_type,include_sub_dept,min_sec_level,max_sec_level,sort_num,creator) " +
|
||||
" values(?,?,'user',?,?,?,?,0,0,-999,999,?,?)" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(String.valueOf(id));
|
||||
paramList.add(employeeId);
|
||||
paramList.add(attendConfig);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(create_time);
|
||||
paramList.add(create_time);
|
||||
paramList.add(sort_num);
|
||||
paramList.add(Constants.SysUserId);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, Object> entry = iterator.next();
|
||||
log.error(" Key = " + entry.getKey() + ", Value = " + entry.getValue());
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Map<String, Object> insertAttendScheduling(Long id,String attendConfig,String attend_date,String range_id,String shift_id){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
try{
|
||||
String create_time = DateUtils.getCurrentDateString() + " " + DateUtils.getOnlyCurrentTimeString();
|
||||
String dataSql =" insert into attend_scheduling\n" +
|
||||
"(id,attend_config_id,attend_date,range_id,shift_id,tenant_key,update_time,delete_type,create_time,creator) " +
|
||||
"values(?,?,?,?,?,?,?,?,?,?)" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(String.valueOf(id));
|
||||
paramList.add(attendConfig);
|
||||
paramList.add(attend_date);
|
||||
|
||||
paramList.add(range_id);
|
||||
paramList.add(shift_id);
|
||||
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(create_time);
|
||||
paramList.add("0");
|
||||
paramList.add(create_time);
|
||||
paramList.add(Constants.SysUserId);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, Object> entry = iterator.next();
|
||||
log.error(" Key = " + entry.getKey() + ", Value = " + entry.getValue());
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<String, Object> deleteAttendScheduling(String attendDate,String shiftId,String attendConfig,String rangeId){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String update_time = DateUtils.getCurrentDateString() + " " + DateUtils.getOnlyCurrentTimeString();
|
||||
String dataSql =" update attend_scheduling\n" +
|
||||
" set delete_type = 3,update_time = ? \n" +
|
||||
" where ATTEND_DATE = ? \n" +
|
||||
" and ATTEND_CONFIG_ID=? \n" +
|
||||
" and RANGE_ID=? and tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(update_time);
|
||||
paramList.add(attendDate);
|
||||
paramList.add(attendConfig);
|
||||
paramList.add(rangeId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
Iterator<Map.Entry<String, Object>> iterator = result.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, Object> entry = iterator.next();
|
||||
log.error(" Key = " + entry.getKey() + ", Value = " + entry.getValue());
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.hrm.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class WorkflowCommonDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(WorkflowCommonDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/***
|
||||
* 获取eb表的appid和formid
|
||||
* @param employeeid
|
||||
* @param workflowid
|
||||
* @return
|
||||
*/
|
||||
public String queryRequestDraftCount(String employeeid,String workflowid){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-workflow-report-serviceworkflowreport";
|
||||
String requestid = "";
|
||||
try{
|
||||
|
||||
String dataSql =" select requestid \n" +
|
||||
" from wfc_requestbase \n" +
|
||||
" where flowstatus ='0'\n" +
|
||||
" and creator =? \n" +
|
||||
" and workflowid =? \n" +
|
||||
" and delete_type=0\n" +
|
||||
" and tenant_key =? \n" +
|
||||
" order by create_time desc " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeid);
|
||||
paramList.add(workflowid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
requestid = String.valueOf(recordList.get(0).get("requestid"));
|
||||
}
|
||||
log.error("requestid:{}",requestid);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return requestid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.hrm.util.DatabaseUtils;
|
||||
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.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class WorkflowLeaveDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(WorkflowLeaveDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
|
||||
/***
|
||||
* 获取eb表的appid和formid
|
||||
* @param employeeid
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> queryAttendanceTime(String employeeid,String date){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-hr-service";
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataSql =" select s.period_range_start,s.period_range_end " +
|
||||
" from attend_status_detail s \n" +
|
||||
" where s.delete_type=0 \n" +
|
||||
" and s.employee =? and s.attend_date =? " +
|
||||
" and s.tenant_key =?" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeid);
|
||||
paramList.add(date);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
recordMap = recordList.get(0);
|
||||
if(recordMap.containsKey("period_range_start")){
|
||||
String period_range_start = String.valueOf(recordMap.get("period_range_start"));
|
||||
if(StringUtils.isNotBlank(period_range_start) && period_range_start.length() == 19){
|
||||
String period_date = period_range_start.substring(0,10);
|
||||
String period_time = period_range_start.substring(11,19);
|
||||
recordMap.put("start_date",period_date);
|
||||
recordMap.put("start_time",period_time);
|
||||
}
|
||||
}
|
||||
|
||||
if(recordMap.containsKey("period_range_end")){
|
||||
String period_range_end = String.valueOf(recordMap.get("period_range_end"));
|
||||
if(StringUtils.isNotBlank(period_range_end) && period_range_end.length() == 19){
|
||||
String period_date = period_range_end.substring(0,10);
|
||||
String period_time = period_range_end.substring(11,19);
|
||||
recordMap.put("end_date",period_date);
|
||||
recordMap.put("end_time",period_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.entity;
|
||||
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/04
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
public class CustomSchedulingPo {
|
||||
private String jobNum;
|
||||
private String username;
|
||||
|
||||
private String bcid;
|
||||
|
||||
private String bcname;
|
||||
|
||||
private String pbrq;
|
||||
|
||||
public String getJobNum() {
|
||||
return jobNum;
|
||||
}
|
||||
|
||||
public void setJobNum(String jobNum) {
|
||||
this.jobNum = jobNum;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getBcid() {
|
||||
return bcid;
|
||||
}
|
||||
|
||||
public void setBcid(String bcid) {
|
||||
this.bcid = bcid;
|
||||
}
|
||||
|
||||
public String getBcname() {
|
||||
return bcname;
|
||||
}
|
||||
|
||||
public void setBcname(String bcname) {
|
||||
this.bcname = bcname;
|
||||
}
|
||||
|
||||
public String getPbrq() {
|
||||
return pbrq;
|
||||
}
|
||||
|
||||
public void setPbrq(String pbrq) {
|
||||
this.pbrq = pbrq;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.entity;
|
||||
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/04
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
public class CustomShiftPo {
|
||||
private String id;
|
||||
private String name;
|
||||
private String sfmdbc;
|
||||
private String fdjjrbc;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSfmdbc() {
|
||||
return sfmdbc;
|
||||
}
|
||||
|
||||
public void setSfmdbc(String sfmdbc) {
|
||||
this.sfmdbc = sfmdbc;
|
||||
}
|
||||
|
||||
public String getFdjjrbc() {
|
||||
return fdjjrbc;
|
||||
}
|
||||
|
||||
public void setFdjjrbc(String fdjjrbc) {
|
||||
this.fdjjrbc = fdjjrbc;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.entity;
|
||||
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/08/04
|
||||
* @version: 1.0
|
||||
*/
|
||||
|
||||
public class CustomShiftTimePo {
|
||||
private String beginTime;
|
||||
private String endTime;
|
||||
|
||||
public String getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(String beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.mapper;
|
||||
|
||||
import com.weaver.seconddev.chapanda.hrm.entity.CustomSchedulingPo;
|
||||
import com.weaver.seconddev.chapanda.hrm.entity.CustomShiftPo;
|
||||
import com.weaver.seconddev.chapanda.hrm.entity.CustomShiftTimePo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface HrmShiftQueryMapper {
|
||||
|
||||
/***
|
||||
* 查询班次列表
|
||||
* @param isStore
|
||||
* @param type
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
List<CustomShiftPo> queryShiftList(@Param("isStore") String isStore, @Param("type") String type, @Param("tenantKey") String tenantKey);
|
||||
|
||||
/***
|
||||
* 查询班次时间列表
|
||||
* @param shiftId
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
List<CustomShiftTimePo> queryShiftTimeList(@Param("shiftId") String shiftId, @Param("tenantKey") String tenantKey);
|
||||
|
||||
/***
|
||||
* 查询排班列表
|
||||
* @param beginDate
|
||||
* @param endDate
|
||||
* @param empCode
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
List<CustomSchedulingPo> querySchedulingList(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("empCode") String empCode, @Param("tenantKey") String tenantKey);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public interface EstablishmentManagerService {
|
||||
|
||||
String quertEstId(String orgId,String planId,String year,String month);
|
||||
|
||||
String queryEstTotalByOrgId(String orgId,String planId,String year,String month);
|
||||
|
||||
List<Map<String, Object>> queryOrgOrderByOrgId(String orgIds);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Component
|
||||
public interface HrmDownloadFilesService {
|
||||
|
||||
byte[] convertInputStreamToBytes(InputStream inputStream);
|
||||
|
||||
String convertBase64Data(String base64Data);
|
||||
|
||||
String convertZipFile(JSONArray dataArray, String downloadType);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public interface HrmShiftQueryService {
|
||||
|
||||
List<Map<String,Object>> queryShiftList(JSONObject paramJson);
|
||||
|
||||
|
||||
List<Map<String,Object>> querySchedulingList(JSONObject paramJson);
|
||||
|
||||
|
||||
List<Map<String,Object>> operateScheduling(JSONObject paramJson);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public interface HrmTableFieldService {
|
||||
|
||||
List<Map<String,Object>> queryTableDetailFieldByTableName(String tableName,String detailName);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public interface WorkflowCommonService {
|
||||
Map<String,Object>queryRequestDraftCount(String employeeid,String workflowid);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public interface WorkflowLeaveService {
|
||||
Map<String,Object>queryAttendanceTime(String employeeid,String date);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service.impl;
|
||||
|
||||
import com.weaver.seconddev.chapanda.hrm.dao.EstablishmentManagerDao;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.EstablishmentManagerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* author:shil
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class EstablishmentManagerServiceImpl implements EstablishmentManagerService {
|
||||
|
||||
@Autowired
|
||||
EstablishmentManagerDao establishmentManagerDao;
|
||||
@Override
|
||||
public String quertEstId(String orgId,String planId,String year,String month) {
|
||||
String id = establishmentManagerDao.quertEstId(orgId,planId,year,month);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String queryEstTotalByOrgId(String orgId,String planId,String year,String month) {
|
||||
String count = establishmentManagerDao.queryEstTotalByOrgId(orgId,planId,year,month);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> queryOrgOrderByOrgId(String orgIds) {
|
||||
List<Map<String, Object>> list = establishmentManagerDao.queryEstTotalByOrgId(orgIds);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.eteams.file.client.file.FileData;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.HrmDownloadFilesService;
|
||||
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.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/***
|
||||
* author:shil
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class HrmDownloadFilesServiceImpl implements HrmDownloadFilesService {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmDownloadFilesServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
HrmDownloadFilesService hrmDownloadFilesService;
|
||||
|
||||
@Autowired
|
||||
private FileDownloadService fileDownloadService;
|
||||
|
||||
/***
|
||||
* 将InputStream转换为byte[]
|
||||
* @param inputStream
|
||||
* @return
|
||||
*/
|
||||
public byte[] convertInputStreamToBytes(InputStream inputStream) {
|
||||
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
try{
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
byteStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
log.error("byteStream:{}",byteStream.toByteArray().length);
|
||||
}catch (IOException e) {
|
||||
log.error("io-e:{}",e.getMessage());
|
||||
}
|
||||
return byteStream.toByteArray();
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param base64Data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String convertBase64Data(String base64Data) {
|
||||
String decodedData = "";
|
||||
try{
|
||||
Base64.Decoder decoder = Base64.getDecoder();
|
||||
// 解码Base64字符串
|
||||
byte[] bytesDecoded = decoder.decode(base64Data);
|
||||
// 将字节数组转换回字符串
|
||||
decodedData = new String(bytesDecoded, StandardCharsets.UTF_8);
|
||||
}catch (Exception e){
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
return decodedData;
|
||||
}
|
||||
|
||||
|
||||
public String convertZipFile(JSONArray dataArray,String downloadType) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String filename = sdf.format(new Date())+".zip";
|
||||
|
||||
String directoryPath = Constants.templatePath+ File.separator+downloadType+File.separator+sdf.format(new Date());
|
||||
// 将字符串路径转换为Path对象
|
||||
Path path = Paths.get(directoryPath);
|
||||
// 检查目录是否存在
|
||||
if (Files.notExists(path)) {
|
||||
try {
|
||||
Files.createDirectories(path);
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
}
|
||||
|
||||
String zipFilePath = directoryPath+File.separator+filename;
|
||||
FileOutputStream fos = null;
|
||||
ZipOutputStream zos = null;
|
||||
try {
|
||||
log.error("path:{}",zipFilePath);
|
||||
fos = new FileOutputStream(zipFilePath);
|
||||
zos = new ZipOutputStream(fos);
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject dataObject = dataArray.getJSONObject(i);
|
||||
String fileId = dataObject.getString("fileid");
|
||||
log.error("fileId:{}",fileId);
|
||||
if(StringUtils.isNotBlank(fileId)){
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
FileData fileData = fileDownloadService.downloadFile(Long.parseLong(fileId));
|
||||
FileObj fileObj = fileData.getFileObj();
|
||||
// 获取文件的输入流
|
||||
inputStream = fileData.getInputStream();
|
||||
log.error("inputStream:{}",inputStream.available());
|
||||
String fileName = fileObj.getName();
|
||||
log.error("fileName:{}",fileName);
|
||||
byte[] filedata = hrmDownloadFilesService.convertInputStreamToBytes(inputStream);
|
||||
|
||||
addFileToZip(zos, filedata, fileName);
|
||||
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
log.error("io-e:" , e);
|
||||
}finally {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
zos.close();
|
||||
fos.close();
|
||||
}catch (IOException e){
|
||||
log.error("e:{}",e);
|
||||
}finally {
|
||||
try {
|
||||
if (zos != null) {
|
||||
zos.close();
|
||||
}
|
||||
if (fos != null) {
|
||||
fos.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
}
|
||||
|
||||
String newZipFilePath = "";
|
||||
File zipFile = new File(zipFilePath);
|
||||
if(zipFile.exists()){
|
||||
newZipFilePath = zipFile.getPath();
|
||||
}
|
||||
return newZipFilePath;
|
||||
}
|
||||
|
||||
// 将文件添加到zip输出流
|
||||
private void addFileToZip(ZipOutputStream zos, byte[] fileData, String entryName) throws IOException {
|
||||
// ZipEntry entry = new ZipEntry(fileName+"_"+jobNum+"/"+entryName);
|
||||
ZipEntry entry = new ZipEntry(entryName);
|
||||
zos.putNextEntry(entry);
|
||||
zos.write(fileData);
|
||||
zos.closeEntry();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String data = "L25mcy9kYXRhL3dlYXRlbXBmaWxlcy9kb3dubG9hZHRlbXAvcmVzaWduLzIwMjUwODI2MTczNjU3L+emu+iBjOivgeaYji0yMDI1MDgyNjE3MzY1Ny56aXA=";
|
||||
HrmDownloadFilesServiceImpl HrmDownloadFilesServiceImpl = new HrmDownloadFilesServiceImpl();
|
||||
String decodedData = HrmDownloadFilesServiceImpl.convertBase64Data(data);
|
||||
System.out.println(decodedData);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.distribution.genid.IdGenerator;
|
||||
import com.weaver.seconddev.chapanda.hrm.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.hrm.dao.HrmShiftQueryDao;
|
||||
import com.weaver.seconddev.chapanda.hrm.entity.CustomSchedulingPo;
|
||||
import com.weaver.seconddev.chapanda.hrm.entity.CustomShiftPo;
|
||||
import com.weaver.seconddev.chapanda.hrm.entity.CustomShiftTimePo;
|
||||
import com.weaver.seconddev.chapanda.hrm.mapper.HrmShiftQueryMapper;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.HrmShiftQueryService;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* author:shil
|
||||
*/
|
||||
@Service
|
||||
public class HrmShiftQueryServiceImpl implements HrmShiftQueryService {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(HrmShiftQueryServiceImpl.class);
|
||||
@Autowired
|
||||
HrmShiftQueryMapper hrmShiftQueryMapper;
|
||||
|
||||
@Autowired
|
||||
HrmShiftQueryDao hrmShiftQueryDao;
|
||||
|
||||
/***
|
||||
* 查询班次列表
|
||||
* @param paramJson
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String,Object>> queryShiftList(JSONObject paramJson) {
|
||||
List<Map<String,Object>> shiftList = new ArrayList<Map<String,Object>>();
|
||||
String type = paramJson.getString("type");
|
||||
String isStore = paramJson.getString("isStore");
|
||||
log.error("type:{}",type);
|
||||
log.error("isStore:{}",isStore);
|
||||
|
||||
List<CustomShiftPo> dataList = hrmShiftQueryMapper.queryShiftList(isStore,type,Constants.TENANT_KEY);
|
||||
log.error("dataList:{}",dataList.size());
|
||||
for(int i=0;i<dataList.size();i++){
|
||||
CustomShiftPo customShiftPo = dataList.get(i);
|
||||
String id = customShiftPo.getId();
|
||||
String name = customShiftPo.getName();
|
||||
String sfmdbc = customShiftPo.getSfmdbc();
|
||||
String fdjjrbc = customShiftPo.getFdjjrbc();
|
||||
|
||||
Map<String,Object> shiftMap = new HashMap<String,Object>();
|
||||
shiftMap.put("scID",id);
|
||||
shiftMap.put("scName",name);
|
||||
shiftMap.put("type",fdjjrbc);
|
||||
shiftMap.put("isStore",sfmdbc);
|
||||
|
||||
log.error("id:{}",id);
|
||||
String beginTime = "";
|
||||
String endTime = "";
|
||||
List<CustomShiftTimePo> attendList = hrmShiftQueryMapper.queryShiftTimeList(id,Constants.TENANT_KEY);
|
||||
if(attendList.size()>0){
|
||||
beginTime = attendList.get(0).getBeginTime();
|
||||
endTime = attendList.get(0).getEndTime();
|
||||
}
|
||||
shiftMap.put("beginTime",beginTime);
|
||||
shiftMap.put("endTime",endTime);
|
||||
shiftList.add(shiftMap);
|
||||
}
|
||||
return shiftList;
|
||||
}
|
||||
|
||||
/***
|
||||
* 查询排班列表
|
||||
* @param paramJson
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String,Object>> querySchedulingList(JSONObject paramJson) {
|
||||
List<Map<String,Object>> shiftList = new ArrayList<Map<String,Object>>();
|
||||
String beginDate = "";
|
||||
if(paramJson.containsKey("beginDate")){
|
||||
beginDate = paramJson.getString("beginDate");
|
||||
}
|
||||
String endDate = "";
|
||||
if(paramJson.containsKey("endDate")){
|
||||
endDate = paramJson.getString("endDate");
|
||||
}
|
||||
if(StringUtils.isBlank(endDate)){
|
||||
endDate = beginDate;
|
||||
}
|
||||
log.error("beginDate:{}",beginDate);
|
||||
log.error("endDate:{}",endDate);
|
||||
String empCodeStr = paramJson.getString("empCode");
|
||||
log.error("empCodeStr:{}",empCodeStr);
|
||||
JSONArray empCodeArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(empCodeStr)){
|
||||
empCodeArray = JSONArray.parseArray(empCodeStr);
|
||||
}
|
||||
log.error("empCodeArray:{}",empCodeArray.size());
|
||||
|
||||
for(int i=0;i<empCodeArray.size();i++){
|
||||
String empCode = empCodeArray.getString(i);
|
||||
log.error("empCode:{}",empCode);
|
||||
|
||||
List<CustomSchedulingPo> dataList = hrmShiftQueryMapper.querySchedulingList(beginDate,endDate,empCode,Constants.TENANT_KEY);
|
||||
log.error("dataList:{}",dataList.size());
|
||||
for(int k = 0;k<dataList.size();k++){
|
||||
|
||||
CustomSchedulingPo customSchedulingPo = dataList.get(k);
|
||||
String scID = customSchedulingPo.getBcid();
|
||||
String scName = customSchedulingPo.getBcname();
|
||||
String scDate = customSchedulingPo.getPbrq();
|
||||
String empCode_item = customSchedulingPo.getJobNum();
|
||||
String empName = customSchedulingPo.getUsername();
|
||||
|
||||
Map<String,Object> shiftMap = new HashMap<String,Object>();
|
||||
shiftMap.put("scID",scID);
|
||||
shiftMap.put("scName",scName);
|
||||
shiftMap.put("scDate",scDate);
|
||||
shiftMap.put("empCode",empCode_item);
|
||||
shiftMap.put("empName",empName);
|
||||
|
||||
List<CustomShiftTimePo> attendList = hrmShiftQueryMapper.queryShiftTimeList(scID,Constants.TENANT_KEY);
|
||||
shiftMap.put("scTimes",attendList);
|
||||
shiftList.add(shiftMap);
|
||||
}
|
||||
}
|
||||
return shiftList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String,Object>> operateScheduling(JSONObject paramJson) {
|
||||
|
||||
log.error("paramJson:{}",paramJson.toJSONString());
|
||||
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
|
||||
|
||||
// List<Map<String,Object>> shiftList = new ArrayList<Map<String,Object>>();
|
||||
String operType = paramJson.getString("operType");
|
||||
JSONArray dataArray = paramJson.getJSONArray("data");
|
||||
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||
String empCode = dataJson.getString("empCode");
|
||||
String scID = dataJson.getString("scID");
|
||||
String scDate = dataJson.getString("scDate");
|
||||
String employeeId = hrmShiftQueryDao.queryEmployeeIdByCode(empCode);
|
||||
log.error("employeeId:{}",employeeId);
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
String attendId = "";
|
||||
String datacode = "";
|
||||
if(StringUtils.isNotBlank(employeeId)){
|
||||
if(StringUtils.isNotBlank(scID)){
|
||||
String attendConfig = hrmShiftQueryDao.queryAttendConfig(scID);
|
||||
log.error("attendConfig:{}",attendConfig);
|
||||
if(StringUtils.isNotBlank(attendConfig)){
|
||||
String sort_num = hrmShiftQueryDao.queryRangeCount();
|
||||
log.error("sort_num:{}",sort_num);
|
||||
if(StringUtils.isNotBlank(sort_num)){
|
||||
String rangeId = hrmShiftQueryDao.queryRangeIdByconfigId(employeeId,attendConfig);
|
||||
log.error("rangeId:{}",rangeId);
|
||||
if(StringUtils.isBlank(rangeId)){
|
||||
Long attend_config_rangeId = IdGenerator.generate();
|
||||
log.error("attend_config_rangeId:{}",attend_config_rangeId);
|
||||
Map<String,Object> result2 = hrmShiftQueryDao.insertAttendConfigRange(attend_config_rangeId,employeeId,attendConfig,sort_num);
|
||||
if(result2.containsKey("code")){
|
||||
String code2 = result2.get("code").toString();
|
||||
if("200".equals(code2)){
|
||||
rangeId = String.valueOf(attend_config_rangeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("rangeId2:{}",rangeId);
|
||||
if(StringUtils.isNotBlank(rangeId)){
|
||||
// 添加排班
|
||||
if("1".equals(operType)){
|
||||
Long attendSchedulingId = IdGenerator.generate();
|
||||
log.error("attendSchedulingId:{}",attendSchedulingId);
|
||||
Map<String,Object> result = hrmShiftQueryDao.insertAttendScheduling(attendSchedulingId,attendConfig,scDate,rangeId,scID);
|
||||
if(result.containsKey("code")){
|
||||
datacode = result.get("code").toString();
|
||||
if("200".equals(datacode)){
|
||||
attendId = String.valueOf(attendSchedulingId);
|
||||
}
|
||||
}
|
||||
}else if("2".equals(operType)){ // 修改排班
|
||||
Map<String,Object> result = hrmShiftQueryDao.deleteAttendScheduling(scDate,scID,attendConfig,rangeId);
|
||||
if(result.containsKey("code")){
|
||||
String code = result.get("code").toString();
|
||||
if("200".equals(code)){
|
||||
Long attendSchedulingId = IdGenerator.generate();
|
||||
Map<String,Object> result2 = hrmShiftQueryDao.insertAttendScheduling(attendSchedulingId,attendConfig,scDate,rangeId,scID);
|
||||
if(result2.containsKey("code")){
|
||||
datacode = result.get("code").toString();
|
||||
}
|
||||
if("200".equals(datacode)){
|
||||
attendId = String.valueOf(attendSchedulingId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if("3".equals(operType)){ // 删除排班
|
||||
Map<String,Object> result = hrmShiftQueryDao.deleteAttendScheduling(scDate,scID,attendConfig,rangeId);
|
||||
if(result.containsKey("code")){
|
||||
datacode = result.get("code").toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataMap.put("schedulingid",attendId);
|
||||
dataMap.put("empCode",empCode);
|
||||
dataMap.put("scDate",scDate);
|
||||
dataMap.put("operType",operType);
|
||||
dataMap.put("code",datacode);
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service.impl;
|
||||
|
||||
import com.weaver.seconddev.chapanda.hrm.dao.HrmFormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.HrmTableFieldService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* author:shil
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class HrmTableFieldServiceImpl implements HrmTableFieldService{
|
||||
|
||||
@Autowired
|
||||
HrmFormFieldDao hrmFormFieldDao;
|
||||
@Override
|
||||
public List<Map<String,Object>> queryTableDetailFieldByTableName(String tableName, String detailName) {
|
||||
List<Map<String,Object>> dataList = hrmFormFieldDao.queryTableDetailFieldByTableName(tableName,detailName);
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service.impl;
|
||||
|
||||
import com.weaver.seconddev.chapanda.hrm.dao.WorkflowCommonDao;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.WorkflowCommonService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* author:shil
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class WorkflowCommonServiceImpl implements WorkflowCommonService {
|
||||
|
||||
@Autowired
|
||||
WorkflowCommonDao workflowCommonDao;
|
||||
@Override
|
||||
public Map<String,Object> queryRequestDraftCount(String employeeid, String workflowid) {
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
String requestid = workflowCommonDao.queryRequestDraftCount(employeeid,workflowid);
|
||||
dataMap.put("requestid",requestid);
|
||||
return dataMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.service.impl;
|
||||
|
||||
import com.weaver.seconddev.chapanda.hrm.dao.WorkflowLeaveDao;
|
||||
import com.weaver.seconddev.chapanda.hrm.service.WorkflowLeaveService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* author:shil
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class WorkflowLeaveServiceImpl implements WorkflowLeaveService {
|
||||
|
||||
@Autowired
|
||||
WorkflowLeaveDao workflowLeaveDao;
|
||||
@Override
|
||||
public Map<String,Object> queryAttendanceTime(String employeeid, String date) {
|
||||
Map<String,Object> dataList = workflowLeaveDao.queryAttendanceTime(employeeid,date);
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.test;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.hrm.test
|
||||
*
|
||||
* @ClassName test99
|
||||
* @Author shil
|
||||
* @Date 2025/9/3 13:16
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
public class test99 {
|
||||
public static void main(String[] args) {
|
||||
String period_range_start = "2025-09-03 15:00:00";
|
||||
System.out.println(period_range_start.length());
|
||||
if(StringUtils.isNotBlank(period_range_start) && period_range_start.length() == 19){
|
||||
String period_date = period_range_start.substring(0,10);
|
||||
|
||||
System.out.println(period_date);
|
||||
String period_time = period_range_start.substring(11,19);
|
||||
System.out.println(period_time);
|
||||
}
|
||||
|
||||
String data = "[\"10000065971\"]";
|
||||
JSONArray jsonArray = JSONArray.parseArray(data);
|
||||
System.out.println(jsonArray.size());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,430 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class CommonUtils {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(CommonUtils.class);
|
||||
|
||||
public static JSONObject toJSON(String data){
|
||||
if(!StringUtils.isEmpty(data)){
|
||||
try {
|
||||
return JSONObject.parseObject(data);
|
||||
}catch (Throwable t){
|
||||
log.error(t.getMessage(),t);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Long getJSONLong(JSONObject json,String key){
|
||||
if(json != null && json.containsKey(key)){
|
||||
try {
|
||||
return json.getLong(key);
|
||||
}catch (Throwable t){
|
||||
log.error(t.getMessage(),t);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Integer getJSONInteger(JSONObject json,String key){
|
||||
if(json != null && json.containsKey(key)){
|
||||
try {
|
||||
return json.getInteger(key);
|
||||
}catch (Throwable t){
|
||||
log.error(t.getMessage(),t);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static String getJSONString(JSONObject json,String key){
|
||||
if(json != null && json.containsKey(key)){
|
||||
try {
|
||||
return null2String(json.getString(key));
|
||||
}catch (Throwable t){
|
||||
log.error(t.getMessage(),t);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static JSONObject getJSONObject(JSONObject json,String key){
|
||||
if(json != null && json.containsKey(key)){
|
||||
try {
|
||||
return json.getJSONObject(key);
|
||||
}catch (Throwable t){
|
||||
log.error(t.getMessage(),t);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONArray getJSONArray(JSONObject json, String key){
|
||||
if(json != null && json.containsKey(key)){
|
||||
try {
|
||||
return json.getJSONArray(key);
|
||||
}catch (Throwable t){
|
||||
log.error(t.getMessage(),t);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONObject getJSONObject(JSONArray json, int idx){
|
||||
if(json != null && json.size() > idx){
|
||||
try {
|
||||
return json.getJSONObject(idx);
|
||||
}catch (Throwable t){
|
||||
log.error(t.getMessage(),t);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String mapToStrData(Map<String, Object> para){
|
||||
if(para != null) {
|
||||
return JSONObject.toJSON(para).toString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void strToLongList(List<Long> list,String strs){
|
||||
strToLongList(list,strs,true);
|
||||
}
|
||||
|
||||
public static void strToLongList(List<Long> list,String strs,boolean isDist){
|
||||
if(list == null){
|
||||
return;
|
||||
}
|
||||
if(StringUtils.isEmpty(strs)){
|
||||
return;
|
||||
}
|
||||
|
||||
String[] strList = StringUtils.split(strs, ",");
|
||||
for(String str:strList){
|
||||
if(StringUtils.isEmpty(str)){
|
||||
continue;
|
||||
}
|
||||
|
||||
long id = getLongValue(str);
|
||||
if(id > 0l && (isDist == false || !list.contains(id))){
|
||||
list.add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static long getLongValue(Object v){
|
||||
return getLongValue(null2String(v));
|
||||
}
|
||||
|
||||
public static long getLongValue(String v) {
|
||||
return getLongValue(v, -1);
|
||||
}
|
||||
|
||||
public static long getLongValue(String v, long def) {
|
||||
try {
|
||||
return Long.parseLong(v);
|
||||
} catch (Exception ex) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getIntValue(Object o){
|
||||
return getIntValue(null2String(o));
|
||||
}
|
||||
|
||||
public static int getIntValue(String s){
|
||||
return getIntValue(s,-1);
|
||||
}
|
||||
|
||||
public static int getIntValue(String s, int def){
|
||||
try {
|
||||
return NumberUtils.toInt(s);
|
||||
} catch (Exception ex) {
|
||||
return def;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String null2String(Object s) {
|
||||
return s == null ? "" : s.toString();
|
||||
}
|
||||
|
||||
public static String null2String(Object s, String def) {
|
||||
return s == null ? (def == null ? "" : def) : s.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String stringReplace(String sou, String s1, String s2) {
|
||||
//int idx = sou.indexOf(s1);
|
||||
//if (idx < 0) {
|
||||
// return sou;
|
||||
//}
|
||||
//return sou.substring(0, idx) + s2 + StringReplace(sou.substring(idx + s1.length()), s1, s2);
|
||||
sou = null2String(sou);
|
||||
s1 = null2String(s1);
|
||||
s2 = null2String(s2);
|
||||
try{
|
||||
sou = sou.replace(s1, s2);
|
||||
}catch(Exception e){
|
||||
//System.out.println(e);//将未知异常打印出来,便于检查错误。
|
||||
}
|
||||
return sou;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换特殊字符
|
||||
*
|
||||
* @param s 要替换特殊的字符串
|
||||
* @return 替换完成的字符串
|
||||
*/
|
||||
public static String toScreen(String s) {
|
||||
char c[] = s.toCharArray();
|
||||
char ch;
|
||||
int i = 0;
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
while (i < c.length) {
|
||||
ch = c[i++];
|
||||
|
||||
if (ch == '\r')
|
||||
buf.append("");
|
||||
else if (ch == '\n')
|
||||
buf.append("");
|
||||
else
|
||||
buf.append(ch);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换特殊字符
|
||||
*
|
||||
* @param s 要替换特殊的字符串
|
||||
* @return 替换完成的字符串
|
||||
*/
|
||||
public static String toExcel(String s) {
|
||||
if (s == null) return "";
|
||||
//因本方法会将字符串 &符号转换,故先将欧元符号转义符转换为其Unicode码
|
||||
s = s.replaceAll("€", "\u20AC");
|
||||
String str = toScreen(s);
|
||||
str = stringReplace(str, "∠", "∠");
|
||||
str = stringReplace(str, "φ", "φ");
|
||||
str = stringReplace(str, """, "\"");
|
||||
str = stringReplace(str, " ", "%nbsp");
|
||||
//str=Util.StringReplace(str,"'","‘");
|
||||
str = stringReplace(str, "<", "<");
|
||||
str = stringReplace(str, ">", ">");
|
||||
str = stringReplace(str, "&dt;&at;", "<br>");
|
||||
str = stringReplace(str, "&", "&");
|
||||
str = stringReplace(str, "<br>", "&dt;&at;");
|
||||
if ("&dt;&at;".equals(str)) {
|
||||
str = "";
|
||||
}
|
||||
//在方法最后,又将欧元符号置换为转义符
|
||||
str = str.replaceAll("\u20AC", "€");
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String delHtml(final String inputString) {
|
||||
String htmlStr = toExcel(inputString); // 含html标签的字符串
|
||||
|
||||
String textStr = "";
|
||||
java.util.regex.Pattern p_script;
|
||||
java.util.regex.Matcher m_script;
|
||||
java.util.regex.Pattern p_html;
|
||||
java.util.regex.Matcher m_html;
|
||||
|
||||
try {
|
||||
String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
|
||||
|
||||
String regEx_script = "<[/s]*?script[^>]*?>[/s/S]*?<[/s]*?//[/s]*?script[/s]*?>"; // 定义script的正则表达式{或<script[^>]*?>[/s/S]*?<//script>
|
||||
|
||||
p_script = java.util.regex.Pattern.compile(regEx_script, java.util.regex.Pattern.CASE_INSENSITIVE);
|
||||
m_script = p_script.matcher(htmlStr);
|
||||
htmlStr = m_script.replaceAll(""); // 过滤script标签
|
||||
|
||||
p_html = java.util.regex.Pattern.compile(regEx_html, java.util.regex.Pattern.CASE_INSENSITIVE);
|
||||
m_html = p_html.matcher(htmlStr);
|
||||
htmlStr = m_html.replaceAll(""); // 过滤html标签
|
||||
|
||||
textStr = htmlStr;
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Html2Text: " + e.getMessage());
|
||||
}
|
||||
|
||||
return htmlToTxt(textStr).trim();// 返回文本字符串
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字符串中的html格式
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String htmlToTxt(String input) {
|
||||
if (input == null || input.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
// 去掉所有html元素,
|
||||
String str = input.replaceAll("<[a-zA-Z]+[1-9]?[^><]*>", "");
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
//==new=
|
||||
|
||||
public static int getIntValue(Object s, int def){
|
||||
return getIntValue(null2String(s));
|
||||
}
|
||||
|
||||
public static List<Long> strToLongList(String strs){
|
||||
List<Long> list = new ArrayList<Long>();
|
||||
strToLongList(list,strs,true);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public static int dateInterval(String fromdate, String todate) {
|
||||
Calendar fromcalendar = getCalendar(fromdate);
|
||||
Calendar tocalendar = getCalendar(todate);
|
||||
|
||||
if (fromcalendar == null || tocalendar == null)
|
||||
return 0;
|
||||
|
||||
return (int) ((tocalendar.getTimeInMillis() - fromcalendar.getTimeInMillis()) / 3600 / 24 / 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param datetime - 给定的日期时间,格式为 '2004-05-12 12:00:23' 或者 '2004-05-12'
|
||||
* @return 返回给定日历, 如果格式不正确,返回null
|
||||
*/
|
||||
public static Calendar getCalendar(String datetime) {
|
||||
int datetimelength = datetime.length() ;
|
||||
|
||||
switch(datetimelength) {
|
||||
case 19 :
|
||||
return getCalendar(datetime , "yyyy'-'MM'-'dd' 'HH:mm:ss") ;
|
||||
case 10 :
|
||||
return getCalendar(datetime , "yyyy'-'MM'-'dd") ;
|
||||
default :
|
||||
return null ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param datetime - 给定的日期时间
|
||||
* @param formart - 给定的日期时间的格式
|
||||
* @return 返回给定日历, 如果格式不正确,返回null
|
||||
*/
|
||||
public static Calendar getCalendar(String datetime, String formart) {
|
||||
SimpleDateFormat SDF = new SimpleDateFormat(formart) ;
|
||||
|
||||
Calendar calendar = Calendar.getInstance() ;
|
||||
try {
|
||||
calendar.setTime(SDF.parse(datetime)) ;
|
||||
} catch (ParseException e) {
|
||||
return null ;
|
||||
}
|
||||
|
||||
return calendar ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 返回当前时间字符,格式为 yyyy'-'MM'-'dd
|
||||
*
|
||||
* 返回当前时间字符,默认格式为yyyy'-'MM'-'dd
|
||||
*
|
||||
* 如 2004-09-07
|
||||
*/
|
||||
public static String getCurrentDateString() {
|
||||
String timestrformart = "yyyy'-'MM'-'dd" ;
|
||||
SimpleDateFormat SDF = new SimpleDateFormat(timestrformart) ;
|
||||
Calendar calendar = Calendar.getInstance() ;
|
||||
|
||||
return SDF.format(calendar.getTime()) ;
|
||||
}
|
||||
|
||||
public static String getMessage(String msgMode,String key,String val){
|
||||
key = null2String(key).trim();
|
||||
val = null2String(val).trim();
|
||||
msgMode = null2String(msgMode).trim();
|
||||
if(!"".equals(msgMode) && !"".equals(key)) {
|
||||
msgMode = msgMode.replaceAll(key, val);
|
||||
}
|
||||
return msgMode;
|
||||
}
|
||||
|
||||
public static List<Long> tranStrToLongList(Object idListObj){
|
||||
List<Long> docIds = new ArrayList<Long>();
|
||||
if(idListObj != null) {
|
||||
try {
|
||||
JSONArray idObjs = JSONArray.parseArray(null2String(idListObj));
|
||||
for (Object idObj : idObjs) {
|
||||
long id = getLongValue(idObj);
|
||||
if (id > 0l) {
|
||||
docIds.add(id);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("trans error :{}", idListObj);
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return docIds;
|
||||
}
|
||||
|
||||
public Map<String, Object> requestToMap(HttpServletRequest request) {
|
||||
Map<String, String[]> properties = request.getParameterMap();//把请求参数封装到Map<String, String[]>中
|
||||
Map<String, Object> returnMap = new HashMap<String, Object>();
|
||||
Iterator<Map.Entry<String, String[]>> iter = properties.entrySet().iterator();
|
||||
String name = "";
|
||||
String value = "";
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry<String, String[]> entry = iter.next();
|
||||
name = entry.getKey();
|
||||
Object valueObj = entry.getValue();
|
||||
if (null == valueObj) {
|
||||
value = "";
|
||||
} else if (valueObj instanceof String[]) {
|
||||
String[] values = (String[]) valueObj;
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
value = values[i] + ",";
|
||||
}
|
||||
value = value.substring(0, value.length() - 1);
|
||||
} else {
|
||||
value = valueObj.toString();
|
||||
}
|
||||
returnMap.put(name, value);
|
||||
}
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
|
||||
public Long convertStringToLong(String str) {
|
||||
try {
|
||||
return Long.valueOf(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,366 @@
|
|||
package com.weaver.seconddev.chapanda.hrm.util;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.ebuilder.datasource.api.entity.ExecuteSqlEntity;
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.ebuilder.datasource.api.enums.SourceType;
|
||||
import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
|
||||
import com.weaver.ebuilder.datasource.api.query.dto.dw.DynamicParamDto;
|
||||
import com.weaver.ebuilder.datasource.api.query.dto.dw.FieldQuery;
|
||||
import com.weaver.ebuilder.datasource.api.query.dto.dw.GroupQuery;
|
||||
import com.weaver.ebuilder.datasource.api.query.dto.dw.TableQuery;
|
||||
import com.weaver.ebuilder.datasource.api.service.DataSetService;
|
||||
import com.weaver.ebuilder.datasource.api.service.impl.EbFormDataService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* DatabaseUtil 是一个数据库工具类,提供了一些执行 SQL 查询和操作的方法。
|
||||
*/
|
||||
|
||||
|
||||
@Component
|
||||
public class DatabaseUtils {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(DatabaseUtils.class);
|
||||
|
||||
@Autowired
|
||||
private DataSetService dataSetService;
|
||||
|
||||
@Autowired
|
||||
private EbFormDataService dataService;
|
||||
|
||||
|
||||
/**
|
||||
* 执行 SQL 并返回结果。
|
||||
*
|
||||
* @param entity 包含执行 SQL 的相关信息的对象
|
||||
* @return 包含查询结果的 Map 对象
|
||||
* @throws RuntimeException 当 SQL 执行失败时抛出异常
|
||||
*/
|
||||
public Map<String, Object> executeSql(ExecuteSqlEntity entity) {
|
||||
Map<String, Object> map = dataSetService.executeSql(entity);
|
||||
if ("FAIL".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT))) {
|
||||
log.error("sql执行失败=>{}", JSONObject.toJSONString(map));
|
||||
throw new RuntimeException("sql执行异常");
|
||||
} else {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行分页 SQL 查询并返回结果。
|
||||
*
|
||||
* @param entity 包含执行 SQL 和分页信息的对象
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 每页的数据条数
|
||||
* @return 包含查询结果的 Map 对象
|
||||
* @throws RuntimeException 当 SQL 执行失败时抛出异常
|
||||
*/
|
||||
public Map<String, Object> executeSql(ExecuteSqlEntity entity, int pageNo, int pageSize) {
|
||||
entity.setPageNo(pageNo);
|
||||
entity.setPageSize(pageSize);
|
||||
Map<String, Object> map = dataSetService.executeForQuery(entity);
|
||||
if ("FAIL".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT))) {
|
||||
log.error("sql执行失败=>{}", JSONObject.toJSONString(map));
|
||||
throw new RuntimeException("sql执行异常");
|
||||
} else {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个包含执行 SQL 的对象。
|
||||
*
|
||||
* @param sql 需要执行的 SQL
|
||||
* @param groupId 数据源分组的 ID
|
||||
* @paramDesc 数据源分组的 ID 获取方式 【select APPLICATION_MARK,APPLICATION_name from eteams.ds_mark_service_relation】
|
||||
* @return 包含执行 SQL 的对象
|
||||
*/
|
||||
public ExecuteSqlEntity getExecuteSqlEntity(String sql, String groupId) {
|
||||
log.error("sql=>{}", sql);
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(base64(sql));
|
||||
executeSqlEntity.setGroupId(groupId);
|
||||
executeSqlEntity.setSourceType(SourceType.LOGIC);
|
||||
executeSqlEntity.setGroupKey("0");
|
||||
return executeSqlEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对 SQL 进行 Base64 编码。
|
||||
*
|
||||
* @param sql 需要进行编码的 SQL
|
||||
* @return 编码后的字符串
|
||||
*/
|
||||
public String base64(String sql) {
|
||||
return Base64.encode(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据源列表。
|
||||
*
|
||||
* @param map 包含数据源列表信息的 Map 对象
|
||||
* @return 数据源列表的 Map 对象
|
||||
*/
|
||||
public List<Map<String, Object>> getDataSourceList(Map<String, Object> map) {
|
||||
List<Map<String, Object>> entity = new ArrayList();
|
||||
if ("OK".equals(CommonUtils.null2String(map.get("status")).toUpperCase(Locale.ROOT)) && map.get("count") != null && CommonUtils.getIntValue(map.get("count")) > 0) {
|
||||
entity = (List) map.get("records");
|
||||
}
|
||||
|
||||
return keyToLowerCase((List) entity);
|
||||
}
|
||||
|
||||
public Map<String, Object> getOneDataSource(Map<String, Object> map) {
|
||||
List<Map<String, Object>> entity = getDataSourceList(map);
|
||||
return (Map)(CollectionUtil.isNotEmpty(entity) ? (Map)entity.get(0) : new HashMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 Map 对象中的键转换为小写。
|
||||
*
|
||||
* @param orgMapList 需要转换键的 Map 对象列表
|
||||
* @return 转换后的 Map 对象列表
|
||||
*/
|
||||
public List<Map<String, Object>> keyToLowerCase(List<Map<String, Object>> orgMapList) {
|
||||
List<Map<String, Object>> resultList = new ArrayList();
|
||||
Iterator var2 = orgMapList.iterator();
|
||||
|
||||
while (var2.hasNext()) {
|
||||
Map<String, Object> stringObjectMap = (Map) var2.next();
|
||||
resultList.add(keyToLowerCase(stringObjectMap));
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 Map 对象中的键转换为小写。
|
||||
*
|
||||
* @param orgMap 需要转换键的 Map 对象
|
||||
* @return 转换后的 Map 对象
|
||||
*/
|
||||
public Map<String, Object> keyToLowerCase(Map<String, Object> orgMap) {
|
||||
Map<String, Object> resultMap = new HashMap();
|
||||
if (orgMap != null && !orgMap.isEmpty()) {
|
||||
Set<Map.Entry<String, Object>> entrySet = orgMap.entrySet();
|
||||
Iterator var3 = entrySet.iterator();
|
||||
|
||||
while (var3.hasNext()) {
|
||||
Map.Entry<String, Object> entry = (Map.Entry) var3.next();
|
||||
String key = (String) entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
resultMap.put(key.toLowerCase(), value);
|
||||
}
|
||||
return resultMap;
|
||||
} else {
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据数据库类型 找到对应数据库
|
||||
*
|
||||
* @param sourceType sourceType 枚举类
|
||||
* ETEAMS :数据仓库
|
||||
* FORM: ebuilder表单
|
||||
* LOGIC: 各模块提供业务数据(逻辑表)
|
||||
* EXTERNAL: 外部数据源
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getDataGroups(String sourceType, Boolean flag) {
|
||||
GroupQuery query = new GroupQuery();
|
||||
query.setSourceType(SourceType.valueOf(sourceType));
|
||||
query.setShowSqlDataset(flag);
|
||||
|
||||
|
||||
DynamicParamDto dynamicParamDto = new DynamicParamDto();
|
||||
dynamicParamDto.setUserId(10000L);
|
||||
dynamicParamDto.setTenantKey("tk");
|
||||
|
||||
query.setDynamicParamDto(dynamicParamDto);
|
||||
|
||||
return dataSetService.getDataGroups(query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取数据表
|
||||
*
|
||||
* @param sourceType
|
||||
* @param groupId
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getDataSets(String sourceType, String groupId, Integer pageNum, Integer pageSize) {
|
||||
|
||||
TableQuery tableQuery = new TableQuery();
|
||||
tableQuery.setSourceType(SourceType.valueOf(sourceType));
|
||||
tableQuery.setGroupId(groupId);
|
||||
//非必传
|
||||
//tableQuery.setName(name);
|
||||
tableQuery.setPageNo(pageNum);
|
||||
tableQuery.setPageSize(pageSize);
|
||||
return dataSetService.getDataSetsByPage(tableQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表字段
|
||||
* sourceType :LOGIC
|
||||
* sourceId : 8494845523559165780
|
||||
* groupId : weaver-crm-service
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getFields(String sourceType, String sourceId, String groupId) {
|
||||
FieldQuery query = new FieldQuery();
|
||||
query.setSourceType(SourceType.valueOf(sourceType));
|
||||
query.setSourceId(sourceId);
|
||||
query.setGroupId(groupId);
|
||||
return dataSetService.getFields(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行sql
|
||||
* sourceType :LOGIC
|
||||
* groupId : weaver-ebuilder-app-service
|
||||
* sql : select * from ebda_app limit 10
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> execute(String sourceType, String groupId, String sql) {
|
||||
//执行sql 参数sourceType groupId sql
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(base64(sql));
|
||||
executeSqlEntity.setGroupId(groupId);
|
||||
executeSqlEntity.setSourceType(SourceType.valueOf(sourceType));
|
||||
return dataSetService.executeSql(executeSqlEntity);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> executeUpdate(String sourceType, String groupId, String sql) {
|
||||
//执行sql 参数sourceType groupId sql
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(base64(sql));
|
||||
executeSqlEntity.setGroupId(groupId);
|
||||
executeSqlEntity.setSourceType(SourceType.valueOf(sourceType));
|
||||
return dataSetService.executeForUpdate(executeSqlEntity);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> executeForQuery(String sourceType, String groupId, String sql,List<SqlParamEntity> sqlparam) {
|
||||
//执行sql 参数sourceType groupId sql sqlparam
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(base64(sql));
|
||||
executeSqlEntity.setGroupId(groupId);
|
||||
executeSqlEntity.setSourceType(SourceType.valueOf(sourceType));
|
||||
executeSqlEntity.setParams(sqlparam);
|
||||
return dataSetService.executeSql(executeSqlEntity);
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param sourceType
|
||||
* @param groupId
|
||||
* @param sql
|
||||
* @param sqlparam
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> executeForUpdate(String sourceType, String groupId, String sql,List<SqlParamEntity> sqlparam) {
|
||||
//执行sql 参数sourceType groupId sql sqlparam
|
||||
ExecuteSqlEntity executeSqlEntity = new ExecuteSqlEntity();
|
||||
executeSqlEntity.setSql(base64(sql));
|
||||
executeSqlEntity.setGroupId(groupId);
|
||||
executeSqlEntity.setSourceType(SourceType.valueOf(sourceType));
|
||||
executeSqlEntity.setParams(sqlparam);
|
||||
return dataSetService.executeForUpdate(executeSqlEntity);
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param sql
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public String getMysqlPagedSql(String sql,int pageNo, int pageSize) {
|
||||
if(pageNo<=0){
|
||||
pageNo = 1;
|
||||
}
|
||||
|
||||
if(pageSize<=0){
|
||||
pageSize = 20;
|
||||
}
|
||||
|
||||
int start = (pageNo-1)*pageSize;
|
||||
int end = pageNo*pageSize;
|
||||
|
||||
return new StringBuffer().append(sql).append(
|
||||
" LIMIT "+start+","+(end-start)).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取sql入参
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public List<SqlParamEntity> querySqlParamEntity(List<String> list){
|
||||
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
||||
for (String str : list){
|
||||
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
||||
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
||||
sqlParamEntity.setValue(str);
|
||||
sqlparam.add(sqlParamEntity);
|
||||
}
|
||||
return sqlparam;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param sourceType
|
||||
* @param groupId
|
||||
* @param dataSql
|
||||
* @param paramList
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getSqlList(String sourceType,String groupId,String dataSql,List<String> paramList){
|
||||
List<SqlParamEntity> sqlParamList = querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = getDataSourceList(result);
|
||||
return recordList;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param sourceType
|
||||
* @param groupId
|
||||
* @param dataSql
|
||||
* @param paramList
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getSqlMap(String sourceType,String groupId,String dataSql,List<String> paramList){
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
List<SqlParamEntity> sqlParamList = querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = getDataSourceList(result);
|
||||
if(recordList.size() > 0){
|
||||
recordMap = recordList.get(0);
|
||||
}
|
||||
return recordMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.weaver.seconddev.chapanda.hrm.mapper.HrmShiftQueryMapper">
|
||||
|
||||
<select id="queryShiftList" resultType="com.weaver.seconddev.chapanda.hrm.entity.CustomShiftPo">
|
||||
select b.id,b.name,a.sfmdbc,a.fdjjrbc
|
||||
from e10_common.uf_kq_mdbcdy a
|
||||
inner join (select * from e10_other_business.attend_shift where delete_type=0 and tenant_key = #{tenantKey}) b on a.bc=b.id
|
||||
where a.delete_type = 0
|
||||
and a.tenant_key= #{tenantKey}
|
||||
<if test="isStore != null">
|
||||
and a.sfmdbc = #{isStore}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and a.fdjjrbc = #{type}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryShiftTimeList" resultType="com.weaver.seconddev.chapanda.hrm.entity.CustomShiftTimePo">
|
||||
select attend_start_time as beginTime,attend_end_time as endTime
|
||||
from e10_other_business.attend_period
|
||||
where delete_type=0
|
||||
and attend_shift_id = #{shiftId}
|
||||
and tenant_key = #{tenantKey}
|
||||
</select>
|
||||
|
||||
<select id="querySchedulingList" resultType="com.weaver.seconddev.chapanda.hrm.entity.CustomSchedulingPo">
|
||||
select d.job_num as jobNum,d.username,c.id bcid,c.name bcname,a.attend_date pbrq
|
||||
from (select * from e10_other_business.attend_scheduling where delete_type=0 and tenant_key = #{tenantKey}) a
|
||||
inner join (select * from e10_other_business.attend_config_range where delete_type=0 and entry_type='user' and tenant_key = #{tenantKey} ) b on a.range_id=b.id
|
||||
inner join (select * from e10_other_business.attend_shift where delete_type=0 and tenant_key = #{tenantKey} ) c on a.shift_id=c.id
|
||||
inner join (select * from eteams.employee where delete_type=0 and tenant_key = #{tenantKey} ) d on b.target_id=d.ID
|
||||
where a.attend_date >= #{beginDate}
|
||||
and a.attend_date <= #{endDate}
|
||||
and d.job_num = #{empCode} and d.tenant_key = #{tenantKey} and d.delete_type=0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,35 +1,368 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.constant;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class Constants {
|
||||
public static String TENANT_KEY = "t024j0gfn0";
|
||||
public static String SysUserId = "1147262704872284161";
|
||||
public static String TENANT_KEY;
|
||||
public static String SysUserId;
|
||||
public static String app_key;
|
||||
public static String app_secret;
|
||||
public static String tokenUrl;
|
||||
public static String beishenHost;
|
||||
public static String createBlackListUrl;
|
||||
public static String deleteBlackListUrl;
|
||||
public static String offerUrl;
|
||||
public static String activityManagerUrl;
|
||||
public static String assessmentItemUrl;
|
||||
public static String assessmentUrl;
|
||||
public static String userInfoUrl;
|
||||
public static String deppartmentUrl;
|
||||
public static String jobRequirementUrl;
|
||||
public static String assessmentFormTable;
|
||||
public static String assessmentFilterUrl;
|
||||
public static String beishenAssessHost;
|
||||
public static String tenantId;
|
||||
public static String queryAssessUrl;
|
||||
public static String beisenAccount;
|
||||
public static String consumerKey;
|
||||
public static String consumerSecret;
|
||||
public static String accessToken;
|
||||
public static String tokenSecret;
|
||||
public static String oauthSignatureMethod;
|
||||
public static String oauthVersion;
|
||||
public static String format;
|
||||
public static String nyyqzdm;
|
||||
public static String zwzd;
|
||||
public static String unRelateRequirementUrl;
|
||||
public static String positionUrl;
|
||||
public static String beisenPostionTable;
|
||||
public static String hrmPostionTable;
|
||||
public static String queryUserIdByEmailUrl;
|
||||
public static String queryUserIdByCodeUrl;
|
||||
public static String queryDeptIdByCodeUrl;
|
||||
public static String query360AssessmentUrl;
|
||||
public static String assessment360Table;
|
||||
public static String zpssyfzd;
|
||||
public static String jjcdzdm;
|
||||
public static String xbzdm;
|
||||
public static String TransferPositionUrl;
|
||||
public static String JobSequenceUrl;
|
||||
public static String JobLevelUrl;
|
||||
public static String JobGradeUrl;
|
||||
|
||||
public static String app_key = "0F0F2B3F6356464EB59FB651E8DAACBA";
|
||||
public static String app_secret = "AF4A2BFC6BB741FD9D80B7F56DA07F08F703AC14B40C453E8DA5BCABAF43A003";
|
||||
@Value("${secondev.beisen.transferPositionUrl}")
|
||||
public static void setTransferPositionUrl(String transferPositionUrl) {
|
||||
Constants.TransferPositionUrl = transferPositionUrl;
|
||||
}
|
||||
|
||||
public static String tokenUrl = "https://openapi.italent.cn/token";
|
||||
@Value("${secondev.beisen.JobSequenceUrl}")
|
||||
public static void setJobSequenceUrl(String jobSequenceUrl) {
|
||||
Constants.JobSequenceUrl = jobSequenceUrl;
|
||||
}
|
||||
|
||||
public static String beishenHost = "https://openapi.italent.cn";
|
||||
public static String createBlackListUrl = "/TenantBaseExternal/api/v5/BlackList/Create";
|
||||
public static String deleteBlackListUrl = "/TenantBaseExternal/api/v5/BlackList/BatchDelete";
|
||||
@Value("${secondev.beisen.JobLevelUrl}")
|
||||
public static void setJobLevelUrl(String jobLevelUrl) {
|
||||
Constants.JobLevelUrl = jobLevelUrl;
|
||||
}
|
||||
|
||||
public static String offerUrl = "/TenantBaseExternal/api/v5/Offer/GetByTimeWindow";
|
||||
@Value("${secondev.beisen.JobGradeUrl}")
|
||||
public static void setJobGradeUrl(String jobGradeUrl) {
|
||||
Constants.JobGradeUrl = jobGradeUrl;
|
||||
}
|
||||
|
||||
public static String activityManagerUrl = "/PerformanceCloudOpen/api/v5/ActivityManager/GetOrgActivityManagers";
|
||||
public static String assessmentItemUrl = "/PerformanceCloudOpen/api/v5/AssessmentItem/GetAssessmentItemCount";
|
||||
@Value("${secondev.beisen.tenant-key}")
|
||||
public void setTenantKey(String tenantKey) {
|
||||
Constants.TENANT_KEY = tenantKey;
|
||||
}
|
||||
|
||||
public static String assessmentUrl = "/PerformanceCloudOpen/api/v5/Assessment/GetAssessmentsByIds";
|
||||
@Value("${secondev.beisen.sys-user-id}")
|
||||
public void setSysUserId(String sysUserId) {
|
||||
Constants.SysUserId = sysUserId;
|
||||
}
|
||||
|
||||
public static String userInfoUrl = "/UserFrameworkApiV3/api/v1/staffs/Get";
|
||||
@Value("${secondev.beisen.app-key}")
|
||||
public void setAppKey(String appKey) {
|
||||
Constants.app_key = appKey;
|
||||
}
|
||||
|
||||
public static String deppartmentUrl = "/UserFrameworkApiV3/api/v1/departments/Get";
|
||||
@Value("${secondev.beisen.app-secret}")
|
||||
public void setAppSecret(String appSecret) {
|
||||
Constants.app_secret = appSecret;
|
||||
}
|
||||
|
||||
public static String jobRequirementUrl = "/RecruitV6/api/v1/Requirement/CreateRequirement";
|
||||
@Value("${secondev.beisen.token-url}")
|
||||
public void setTokenUrl(String tokenUrl) {
|
||||
Constants.tokenUrl = tokenUrl;
|
||||
}
|
||||
|
||||
public static String assessmentFormTable = "uf_jxsjtz";
|
||||
@Value("${secondev.beisen.beishen-host}")
|
||||
public void setBeishenHost(String beishenHost) {
|
||||
Constants.beishenHost = beishenHost;
|
||||
}
|
||||
|
||||
public static String assessmentFilterUrl = "/PerformanceCloudOpen/api/v5/Assessment/GetAssessmentsByFilters";
|
||||
@Value("${secondev.beisen.create-blacklist-url}")
|
||||
public void setCreateBlackListUrl(String createBlackListUrl) {
|
||||
Constants.createBlackListUrl = createBlackListUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.delete-blacklist-url}")
|
||||
public void setDeleteBlackListUrl(String deleteBlackListUrl) {
|
||||
Constants.deleteBlackListUrl = deleteBlackListUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.offer-url}")
|
||||
public void setOfferUrl(String offerUrl) {
|
||||
Constants.offerUrl = offerUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.activity-manager-url}")
|
||||
public void setActivityManagerUrl(String activityManagerUrl) {
|
||||
Constants.activityManagerUrl = activityManagerUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.assessment-item-url}")
|
||||
public void setAssessmentItemUrl(String assessmentItemUrl) {
|
||||
Constants.assessmentItemUrl = assessmentItemUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.assessment-url}")
|
||||
public void setAssessmentUrl(String assessmentUrl) {
|
||||
Constants.assessmentUrl = assessmentUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.user-info-url}")
|
||||
public void setUserInfoUrl(String userInfoUrl) {
|
||||
Constants.userInfoUrl = userInfoUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.department-url}")
|
||||
public void setDeppartmentUrl(String deppartmentUrl) {
|
||||
Constants.deppartmentUrl = deppartmentUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.job-requirement-url}")
|
||||
public void setJobRequirementUrl(String jobRequirementUrl) {
|
||||
Constants.jobRequirementUrl = jobRequirementUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.assessment-form-table}")
|
||||
public void setAssessmentFormTable(String assessmentFormTable) {
|
||||
Constants.assessmentFormTable = assessmentFormTable;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.assessment-filter-url}")
|
||||
public void setAssessmentFilterUrl(String assessmentFilterUrl) {
|
||||
Constants.assessmentFilterUrl = assessmentFilterUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.beishen-assess-host}")
|
||||
public void setBeishenAssessHost(String beishenAssessHost) {
|
||||
Constants.beishenAssessHost = beishenAssessHost;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.tenant-id}")
|
||||
public void setTenantId(String tenantId) {
|
||||
Constants.tenantId = tenantId;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.query-assess-url}")
|
||||
public void setQueryAssessUrl(String queryAssessUrl) {
|
||||
Constants.queryAssessUrl = queryAssessUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.beisen-account}")
|
||||
public void setBeisenAccount(String beisenAccount) {
|
||||
Constants.beisenAccount = beisenAccount;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.consumer-key}")
|
||||
public void setConsumerKey(String consumerKey) {
|
||||
Constants.consumerKey = consumerKey;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.consumer-secret}")
|
||||
public void setConsumerSecret(String consumerSecret) {
|
||||
Constants.consumerSecret = consumerSecret;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.access-token}")
|
||||
public void setAccessToken(String accessToken) {
|
||||
Constants.accessToken = accessToken;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.token-secret}")
|
||||
public void setTokenSecret(String tokenSecret) {
|
||||
Constants.tokenSecret = tokenSecret;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.oauth-signature-method}")
|
||||
public void setOauthSignatureMethod(String oauthSignatureMethod) {
|
||||
Constants.oauthSignatureMethod = oauthSignatureMethod;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.oauth-version}")
|
||||
public void setOauthVersion(String oauthVersion) {
|
||||
Constants.oauthVersion = oauthVersion;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.format}")
|
||||
public void setFormat(String format) {
|
||||
Constants.format = format;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.nyyqzdm}")
|
||||
public void setNyyqzdm(String nyyqzdm) {
|
||||
Constants.nyyqzdm = nyyqzdm;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.zwzd}")
|
||||
public void setZwzd(String zwzd) {
|
||||
Constants.zwzd = zwzd;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.unrelate-requirement-url}")
|
||||
public void setUnRelateRequirementUrl(String unRelateRequirementUrl) {
|
||||
Constants.unRelateRequirementUrl = unRelateRequirementUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.position-url}")
|
||||
public void setPositionUrl(String positionUrl) {
|
||||
Constants.positionUrl = positionUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.beisen-position-table}")
|
||||
public void setBeisenPostionTable(String beisenPostionTable) {
|
||||
Constants.beisenPostionTable = beisenPostionTable;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.hrm-position-table}")
|
||||
public void setHrmPostionTable(String hrmPostionTable) {
|
||||
Constants.hrmPostionTable = hrmPostionTable;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.query-userid-by-email-url}")
|
||||
public void setQueryUserIdByEmailUrl(String queryUserIdByEmailUrl) {
|
||||
Constants.queryUserIdByEmailUrl = queryUserIdByEmailUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.query-userid-by-code-url}")
|
||||
public void setQueryUserIdByCodeUrl(String queryUserIdByCodeUrl) {
|
||||
Constants.queryUserIdByCodeUrl = queryUserIdByCodeUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.query-deptid-by-code-url}")
|
||||
public void setQueryDeptIdByCodeUrl(String queryDeptIdByCodeUrl) {
|
||||
Constants.queryDeptIdByCodeUrl = queryDeptIdByCodeUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.query-360-assessment-url}")
|
||||
public void setQuery360AssessmentUrl(String query360AssessmentUrl) {
|
||||
Constants.query360AssessmentUrl = query360AssessmentUrl;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.assessment-360-table}")
|
||||
public void setAssessment360Table(String assessment360Table) {
|
||||
Constants.assessment360Table = assessment360Table;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.zpssyfzd}")
|
||||
public void setZpssyfzd(String zpssyfzd) {
|
||||
Constants.zpssyfzd = zpssyfzd;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.jjcdzdm}")
|
||||
public void setJjcdzdm(String jjcdzdm) {
|
||||
Constants.jjcdzdm = jjcdzdm;
|
||||
}
|
||||
|
||||
@Value("${secondev.beisen.xbzdm}")
|
||||
public void setXbzdm(String xbzdm) {
|
||||
Constants.xbzdm = xbzdm;
|
||||
}
|
||||
|
||||
// public static String TENANT_KEY = "t024j0gfn0";
|
||||
// public static String SysUserId = "1167276462243069953";
|
||||
// public static String SysUserId = "1147262704872284161";
|
||||
|
||||
// public static String app_key = "0F0F2B3F6356464EB59FB651E8DAACBA";
|
||||
// public static String app_secret = "AF4A2BFC6BB741FD9D80B7F56DA07F08F703AC14B40C453E8DA5BCABAF43A003";
|
||||
//
|
||||
// public static String tokenUrl = "https://openapi.italent.cn/token";
|
||||
//
|
||||
// public static String beishenHost = "https://openapi.italent.cn";
|
||||
// public static String createBlackListUrl = "/TenantBaseExternal/api/v5/BlackList/Create";
|
||||
// public static String deleteBlackListUrl = "/TenantBaseExternal/api/v5/BlackList/BatchDelete";
|
||||
//
|
||||
// public static String offerUrl = "/TenantBaseExternal/api/v5/Offer/GetByTimeWindow";
|
||||
// public static String transferPositionUrl = "/TenantBaseExternal/api/v5/Position/GetByOIds";
|
||||
// public static String JobSequenceUrl = "/TenantBaseExternal/api/v5/JobSequence/GetByTimeWindow";
|
||||
// public static String JobLevelUrl = "/TenantBaseExternal/api/v5/JobPost/GetByOIds";
|
||||
// public static String JobGradeUrl = "/TenantBaseExternal/api/v5/JobLevel/GetByTimeWindow";
|
||||
//
|
||||
// public static String activityManagerUrl = "/PerformanceCloudOpen/api/v5/ActivityManager/GetOrgActivityManagers";
|
||||
// public static String assessmentItemUrl = "/PerformanceCloudOpen/api/v5/AssessmentItem/GetAssessmentItemCount";
|
||||
//
|
||||
// public static String assessmentUrl = "/PerformanceCloudOpen/api/v5/Assessment/GetAssessmentsByIds";
|
||||
//
|
||||
// public static String userInfoUrl = "/UserFrameworkApiV3/api/v1/staffs/Get";
|
||||
//
|
||||
// public static String deppartmentUrl = "/UserFrameworkApiV3/api/v1/departments/Get";
|
||||
//
|
||||
// public static String jobRequirementUrl = "/RecruitV6/api/v1/Requirement/CreateRequirement";
|
||||
//
|
||||
// public static String assessmentFormTable = "uf_jxsjtz";
|
||||
//
|
||||
// public static String assessmentFilterUrl = "/PerformanceCloudOpen/api/v5/Assessment/GetAssessmentsByFilters";
|
||||
//
|
||||
// public static String beishenAssessHost = "http://api.beisenapp.com";
|
||||
//
|
||||
// public static String tenantId = "431582";
|
||||
// public static String queryAssessUrl = "/Assess/"+Constants.tenantId+"/activity/testee/result/email";
|
||||
//
|
||||
// public static String beisenAccount = "jiekou@test-chabaidao.com";
|
||||
//
|
||||
// public static String consumerKey = "594581d3d5444778a168bb511deb70f7"; // AppKey
|
||||
//
|
||||
// public static String consumerSecret = "6bdef18164794475ac38233c2af4ba01"; // AppSecret
|
||||
//
|
||||
// public static String accessToken = "ae32056b4f6d45199ab036e817dfd98f"; // Token
|
||||
//
|
||||
// public static String tokenSecret = "2e99b9da11cf4ce591a063457a23d5ed"; // Secret
|
||||
//
|
||||
// public static String oauthSignatureMethod = "HMAC-SHA1";
|
||||
//
|
||||
// public static String oauthVersion = "1.0";
|
||||
//
|
||||
// public static String format = "json";
|
||||
//
|
||||
// public static String nyyqzdm = "extnianlingyaoqiu_431582_2032843164";
|
||||
//
|
||||
// //职位(新)
|
||||
// public static String zwzd = "extzhiweixin_431582_698711961";
|
||||
// public static String unRelateRequirementUrl = "/RecruitV6/api/v1/Requirement/OperateRequirementBeforeCheck";
|
||||
//
|
||||
// public static String positionUrl = "/TenantBaseExternal/api/v5/Position/GetByTimeWindow";
|
||||
//
|
||||
// public static String beisenPostionTable = "uf_bs_gw";
|
||||
//
|
||||
// public static String hrmPostionTable = "eteams.ft_1155455711525494797";
|
||||
//
|
||||
// public static String queryUserIdByEmailUrl = "/TenantBaseExternal/api/v5/Employee/GetUserIDByEmail";
|
||||
//
|
||||
// public static String queryUserIdByCodeUrl = "/TenantBaseExternal/api/v5/Employee/GetUserIDsByJobNumbers";
|
||||
//
|
||||
// public static String queryDeptIdByCodeUrl = "/TenantBaseExternal/api/v5/Organization/GetOrganizationInfoByCodes";
|
||||
//
|
||||
//
|
||||
// public static String query360AssessmentUrl = "/I360API/api/opencustom/getpersonelscoredataapi";
|
||||
//
|
||||
// public static String assessment360Table = "uf_cpjg";
|
||||
//
|
||||
// public static String zpssyfzd = "extzhaoxushishiyuefen_431582_1686993167";
|
||||
// public static String jjcdzdm = "extzhaopinjinjidu_431582_1886847991";
|
||||
// public static String xbzdm = "extxingbieyaoqiu_431582_960838668";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import java.io.IOException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 离职年假转换 POC开发的
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/cbdhr/annual")
|
||||
public class ConversionResignController {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.beisen.service.ConvertOrganizationService;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.CommonUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sapi/secondev/cbdhr/hrm")
|
||||
public class ConvertOrganizationController {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(ConvertOrganizationController.class);
|
||||
|
||||
@Autowired
|
||||
ConvertOrganizationService convertOrganizationService;
|
||||
|
||||
@Autowired
|
||||
CommonUtils CommonUtils;
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/convStaffCode")
|
||||
public WeaResult<Object> convStaffCode(@RequestBody JSONObject params){
|
||||
Map<String,Object> recordMap = convertOrganizationService.convStaffCode(params);
|
||||
return WeaResult.success(recordMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/convtDepartmentCode")
|
||||
public WeaResult<Object> convtDepartmentCode(@RequestBody JSONObject params){
|
||||
Map<String,Object> recordMap = convertOrganizationService.convtDepartmentCode(params);
|
||||
return WeaResult.success(recordMap);
|
||||
}
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/convtPositionCode")
|
||||
public WeaResult<Object> convtPositionCode(@RequestBody JSONObject params){
|
||||
Map<String,Object> recordMap = convertOrganizationService.convtPositionCode(params);
|
||||
return WeaResult.success(recordMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.controller;
|
||||
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
|
|
@ -15,7 +14,6 @@ import com.weaver.seconddev.chapanda.beisen.dao.EmployeePointsDao;
|
|||
import com.weaver.seconddev.chapanda.beisen.service.ConversionResignService;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.CommonUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
|
@ -24,6 +22,11 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* 积分计算 POC开发的
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/cbdhr/points")
|
||||
public class EmployeePointsController {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
|||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/***
|
||||
* 离职年假转换 POC开发的
|
||||
*/
|
||||
@Component
|
||||
public class ConversionResignDao {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
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.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ConvertOrganizationDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(ConvertOrganizationDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
|
||||
public String queryEmployeeByCode(String staffcode){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String employeeId = "";
|
||||
try{
|
||||
if(StringUtils.isNotBlank(staffcode)){
|
||||
String dataSql =" select id,username " +
|
||||
" from eteams.employee " +
|
||||
" where job_num = ? \n" +
|
||||
" and delete_type = 0 \n" +
|
||||
" and tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(staffcode);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(!recordList.isEmpty()){
|
||||
employeeId =String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return employeeId;
|
||||
}
|
||||
|
||||
|
||||
public String queryDepartmentByCode(String departmentcode){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String departmentid = "";
|
||||
try{
|
||||
if(StringUtils.isNotBlank(departmentcode)){
|
||||
String dataSql =" select id " +
|
||||
" from eteams.department " +
|
||||
" where code = ? \n" +
|
||||
" and delete_type = 0 \n" +
|
||||
" and tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(departmentcode);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(!recordList.isEmpty()){
|
||||
departmentid = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return departmentid;
|
||||
}
|
||||
|
||||
|
||||
public String queryPositionByCode(String positioncode){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String positionId = "";
|
||||
try{
|
||||
if(StringUtils.isNotBlank(positioncode)){
|
||||
String dataSql =" select id " +
|
||||
" from eteams.POSITION " +
|
||||
" where code = ? \n" +
|
||||
" and delete_type = 0 \n" +
|
||||
" and tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(positioncode);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(!recordList.isEmpty()){
|
||||
positionId = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return positionId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -14,6 +14,11 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* 积分计算 POC开发的
|
||||
*/
|
||||
@Component
|
||||
public class EmployeePointsDao {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,123 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/***
|
||||
* 360测评
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class HrmAssessment360Dao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmAssessment360Dao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
* 判断360测评数据在Eb表是否存在
|
||||
* @return
|
||||
*/
|
||||
public String getAssessment360Data(String gh,String hdid,String wjid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String id = "";
|
||||
try{
|
||||
String dataSql =" select id from " +Constants.assessment360Table +
|
||||
" where gh = ? " +
|
||||
" and hdid = ? " +
|
||||
" and wjid = ? " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(gh);
|
||||
paramList.add(hdid);
|
||||
paramList.add(wjid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size()>0){
|
||||
id = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据工号获取人员ID
|
||||
* @param jobNum
|
||||
* @return
|
||||
*/
|
||||
public String queryEmployeeJobNumData(String jobNum){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String employeeId = "";
|
||||
try{
|
||||
String dataSql =" select id from eteams.employee where job_num = ? and tenant_key=? and delete_type = 0" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(jobNum);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
employeeId = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return employeeId;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> queryEmployeeEmail(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
|
||||
String dataSql =" select id,email from eteams.employee \n" +
|
||||
" where tenant_key=? \n" +
|
||||
" and delete_type=0 " ;
|
||||
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" ,e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,260 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class HrmAssessmentNewDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmAssessmentNewDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAssessmentData(String khnf,String khzq,String jxhdid,String bkhr){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String id = "";
|
||||
try{
|
||||
String dataSql =" select id from uf_jxsjtz " +
|
||||
" where khnf = ? " +
|
||||
" and khzq = ? " +
|
||||
" and jxhdid = ? " +
|
||||
" and bkhr = ? " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(khnf);
|
||||
paramList.add(khzq);
|
||||
paramList.add(jxhdid);
|
||||
paramList.add(bkhr);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size()>0){
|
||||
id = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public String queryTableFormId(String tableName){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String form_id = "";
|
||||
try{
|
||||
String dataSql =" select form_id from form_table where table_name=? and delete_type=0 and tenant_key=?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(tableName);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryTableFormId:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
Map<String, Object> recordMap = recordList.get(0);
|
||||
form_id = String.valueOf(recordMap.get("form_id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return form_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dataKeyList
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryFromTableField(String formTable,List<String> dataKeyList){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> fieldMap = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataKey = dataKeyList.stream().collect(Collectors.joining(","));
|
||||
|
||||
String dataSql =" select id,form_id,title,data_key " +
|
||||
" from eteams.form_field " +
|
||||
" where form_id in( select form_id from eteams.form_table where table_name=? and delete_type=0 and tenant_key=? ) \n" +
|
||||
" and data_key in("+dataKey+")\n" +
|
||||
" and sub_form_id is null " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("queryFromTableField--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(formTable);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryFromTableField:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String data_key = String.valueOf(recordMap.get("data_key"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
fieldMap.put(data_key,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("queryFromTableField:e:" + e);
|
||||
}
|
||||
return fieldMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String queryEmailByEmployeeId(String employeeId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String gryx = "";
|
||||
try{
|
||||
|
||||
String dataSql =" select k.gryx from eteams.employee t\n" +
|
||||
" inner join eteams.ft_1152026012537184302 k on k.id = t.formdata\n" +
|
||||
" where t.id=? " +
|
||||
" and t.tenant_key=? \n" +
|
||||
" and t.delete_type=0" +
|
||||
" and k.tenant_key=? \n" +
|
||||
" and k.delete_type=0";
|
||||
|
||||
log.error("queryEmailByEmployeeId--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryEmailByEmployeeId:"+recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
gryx = String.valueOf(recordList.get(0).get("gryx"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("queryEmailByEmployeeId:e:" + e);
|
||||
}
|
||||
return gryx;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,Object> queryDepartmentData(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
try{
|
||||
String dataSql =" select code,id from eteams.department where status = 1 " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0 " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
for(int i=0;i<recordList.size();i++){
|
||||
Map<String, Object> recordMap = recordList.get(i);
|
||||
String code = String.valueOf(recordMap.get("code"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
dataMap.put(code,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Map<String, Object> queryEmployeeAssessmentOtherInfo(String employeeid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> employeeMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select hiredate as rzrq,zhgzr as lzrq,zzrq,personnel_status as ryzt,subcompany as gs,yjbm as bm1,ejbm as bm2,sanjbm as bm3,sijbm as bm4,rylb,location as gzdd" +
|
||||
" from uf_jcl_employee_information \n" +
|
||||
" where id = ? " +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type = 0 " ;
|
||||
|
||||
log.error("dataSql:{}" , dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
employeeMap = recordList.get(0);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}", e);
|
||||
}
|
||||
return employeeMap;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> queryEmployeeEmail(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
|
||||
String dataSql =" select id,email from eteams.employee \n" +
|
||||
" where tenant_key=? \n" +
|
||||
" and delete_type=0 " ;
|
||||
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" ,e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 北森岗位数据同步
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class HrmBeisenPositionDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmBeisenPositionDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
* 根据北森岗位id获取ebid
|
||||
* @return
|
||||
*/
|
||||
public String getPositionIdByGwId(String gwid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String id = "";
|
||||
try{
|
||||
String dataSql =" select id from " +Constants.beisenPostionTable +
|
||||
" where bs_gwid = ? " +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(gwid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size()>0){
|
||||
id = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新岗位信息
|
||||
* @param code
|
||||
* @param objectId
|
||||
* @param oIdOrganization
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> updateHrmPositionByBensen(String code,String objectId,String oIdOrganization){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataSql =" update " +Constants.hrmPostionTable + " set oid=?,odeptid=? "+
|
||||
" where code = ? " +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(objectId);
|
||||
paramList.add(oIdOrganization);
|
||||
paramList.add(code);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
result = databaseUtils.executeForUpdate(sourceType, groupId, dataSql, sqlParamList);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,12 +7,10 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class HrmDepartmentDao {
|
||||
|
|
@ -54,113 +52,41 @@ public class HrmDepartmentDao {
|
|||
return code;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public String queryTableFormId(String tableName){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String form_id = "";
|
||||
try{
|
||||
String dataSql =" select form_id from form_table where table_name=? and delete_type=0 and tenant_key=?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(tableName);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryTableFormId:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
Map<String, Object> recordMap = recordList.get(0);
|
||||
form_id = String.valueOf(recordMap.get("form_id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return form_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dataKeyList
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryFromTableField(String formTable,List<String> dataKeyList){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> fieldMap = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataKey = dataKeyList.stream().collect(Collectors.joining(","));
|
||||
|
||||
String dataSql =" select id,form_id,title,data_key " +
|
||||
" from eteams.form_field " +
|
||||
" where form_id in( select form_id from eteams.form_table where table_name=? and delete_type=0 and tenant_key=? ) \n" +
|
||||
" and data_key in("+dataKey+")\n" +
|
||||
" and sub_form_id is null " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("queryFromTableField--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(formTable);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryFromTableField:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String data_key = String.valueOf(recordMap.get("data_key"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
fieldMap.put(data_key,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("queryFromTableField:e:" + e);
|
||||
}
|
||||
return fieldMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String queryEmailByEmployeeId(String employeeId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String gryx = "";
|
||||
try{
|
||||
|
||||
String dataSql =" select k.gryx from eteams.employee t\n" +
|
||||
" inner join eteams.ft_1152026012537184302 k on k.id = t.formdata\n" +
|
||||
" where t.id=? " +
|
||||
" and t.tenant_key=? \n" +
|
||||
" and t.delete_type=0" +
|
||||
" and k.tenant_key=? \n" +
|
||||
" and k.delete_type=0";
|
||||
|
||||
log.error("queryEmailByEmployeeId--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryEmailByEmployeeId:"+recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
gryx = String.valueOf(recordList.get(0).get("gryx"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("queryEmailByEmployeeId:e:" + e);
|
||||
}
|
||||
return gryx;
|
||||
}
|
||||
//
|
||||
//
|
||||
// public String queryEmailByEmployeeId(String employeeId){
|
||||
// String groupId = "weaver-ebuilder-form-service";
|
||||
// String sourceType = "LOGIC";
|
||||
// String gryx = "";
|
||||
// try{
|
||||
//
|
||||
// String dataSql =" select k.gryx from eteams.employee t\n" +
|
||||
// " inner join eteams.ft_1152026012537184302 k on k.id = t.formdata\n" +
|
||||
// " where t.id=? " +
|
||||
// " and t.tenant_key=? \n" +
|
||||
// " and t.delete_type=0" +
|
||||
// " and k.tenant_key=? \n" +
|
||||
// " and k.delete_type=0";
|
||||
//
|
||||
// log.error("queryEmailByEmployeeId--dataSql:" + dataSql);
|
||||
// List<String> paramList = new ArrayList<>(100);
|
||||
// paramList.add(employeeId);
|
||||
// paramList.add(Constants.TENANT_KEY);
|
||||
// paramList.add(Constants.TENANT_KEY);
|
||||
//
|
||||
// List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
// Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
// List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
// log.error("queryEmailByEmployeeId:"+recordList.size());
|
||||
// if(recordList.size() > 0){
|
||||
// gryx = String.valueOf(recordList.get(0).get("gryx"));
|
||||
// }
|
||||
// }catch (Exception e){
|
||||
// log.error("queryEmailByEmployeeId:e:" + e);
|
||||
// }
|
||||
// return gryx;
|
||||
// }
|
||||
|
||||
|
||||
public Map<String,Object> queryDepartmentData(){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class HrmEmployeeDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmEmployeeDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
public String queryPersonalEmailByEmployeeId(String employeeId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String gryx = "";
|
||||
try{
|
||||
|
||||
String dataSql =" select k.gryx from eteams.employee t\n" +
|
||||
" inner join eteams.ft_1152026012537184302 k on k.id = t.formdata\n" +
|
||||
" where t.id=? " +
|
||||
" and t.tenant_key=? \n" +
|
||||
" and t.delete_type=0" +
|
||||
" and k.tenant_key=? \n" +
|
||||
" and k.delete_type=0";
|
||||
|
||||
log.error("queryEmailByEmployeeId--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryEmailByEmployeeId:"+recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
gryx = String.valueOf(recordList.get(0).get("gryx"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("queryEmailByEmployeeId:e:" + e);
|
||||
}
|
||||
return gryx;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,Object> queryEmployeeData(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
|
||||
try{
|
||||
String dataSql =" select job_num,id from eteams.employee where tenant_key=? and delete_type = 0" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
for(int i=0;i<recordList.size();i++){
|
||||
Map<String, Object> recordMap = recordList.get(i);
|
||||
String job_num = String.valueOf(recordMap.get("job_num"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
dataMap.put(job_num,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -15,51 +15,16 @@ import java.util.Map;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class FormFieldDao {
|
||||
public class HrmFormFieldDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(FormFieldDao.class);
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmFormFieldDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fieldId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryFieldOptionByFieldid(String fieldId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> optionMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select name,value_key from field_option where field_id=? " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(fieldId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryFromTableField:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String name = String.valueOf(recordMap.get("name"));
|
||||
String value_key = String.valueOf(recordMap.get("value_key"));
|
||||
optionMap.put(value_key,name);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryFromTableField:e:" + e);
|
||||
}
|
||||
return optionMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* 获取eb表的appid和formid
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -90,7 +55,7 @@ public class FormFieldDao {
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取Eb表的字段信息
|
||||
* @param dataKeyList
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -132,64 +97,78 @@ public class FormFieldDao {
|
|||
return fieldMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
|
||||
/**
|
||||
* 获取下拉框的名称
|
||||
* @param fieldId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryDepartmentList(){
|
||||
public Map<String, Object> queryFieldOptionByFieldid(String fieldId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
Map<String, Object> optionMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select code,id from eteams.department and tenant_key=? and delete_type=0" ;
|
||||
log.error("queryDepartmentList--dataSql:" + dataSql);
|
||||
String dataSql =" select name,value_key from field_option where field_id=? " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(fieldId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryDepartmentList:"+recordList.size());
|
||||
log.error("queryFromTableField:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String code = String.valueOf(recordMap.get("code"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
dataMap.put(code,id);
|
||||
String name = String.valueOf(recordMap.get("name"));
|
||||
String value_key = String.valueOf(recordMap.get("value_key"));
|
||||
optionMap.put(value_key,name);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryDepartmentList:{} ", e);
|
||||
log.error("queryFromTableField:e:" + e);
|
||||
}
|
||||
return dataMap;
|
||||
return optionMap;
|
||||
}
|
||||
|
||||
|
||||
public String getGmvIdByCode(String code,String formTable,String dataKey){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
/***
|
||||
*
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public String queryTableFormIdByTableName(String tableName){
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
String dataId = "";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String form_id = "";
|
||||
try{
|
||||
|
||||
String dataSql =" select id from "+formTable+" and tenant_key=? and delete_type=0 and "+dataKey+"=?" ;
|
||||
log.error("dataSql:{}", dataSql);
|
||||
String dataSql =" select form_id from form_table where table_name=? and delete_type=0 and tenant_key=?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(code);
|
||||
paramList.add(tableName);
|
||||
paramList.add(com.weaver.seconddev.chapanda.beisen.constant.Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryDepartmentList:"+recordList.size());
|
||||
log.error("queryTableFormId:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
dataId = String.valueOf(recordList.get(0).get("id"));
|
||||
Map<String, Object> recordMap = recordList.get(0);
|
||||
form_id = String.valueOf(recordMap.get("form_id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryDepartmentList:{} ", e);
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return dataId;
|
||||
return form_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class HrmPerformanceDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmPerformanceDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAssessmentData(String khnf,String khzq,String jxhdid,String bkhr){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String id = "";
|
||||
try{
|
||||
String dataSql =" select id from uf_jxsjtz " +
|
||||
" where khnf = ? " +
|
||||
" and khzq = ? " +
|
||||
" and jxhdid = ? " +
|
||||
" and bkhr = ? " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(khnf);
|
||||
paramList.add(khzq);
|
||||
paramList.add(jxhdid);
|
||||
paramList.add(bkhr);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size()>0){
|
||||
id = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
public Map<String, Object> queryEmployeeAssessmentOtherInfo(String employeeid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> employeeMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select hiredate as rzrq,zhgzr as lzrq,zzrq,personnel_status as ryzt,subcompany as gs,yjbm as bm1,ejbm as bm2,sanjbm as bm3,sijbm as bm4,rylb,location as gzdd" +
|
||||
" from uf_jcl_employee_information \n" +
|
||||
" where glzzyg = ? " +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type = 0 " ;
|
||||
|
||||
log.error("dataSql:{}" , dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
employeeMap = recordList.get(0);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}", e);
|
||||
}
|
||||
return employeeMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.entity;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.esign.entity
|
||||
*
|
||||
* @ClassName OkHttpDto
|
||||
* @Author shil
|
||||
* @Date 2025/8/12 15:37
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class OkHttpDto {
|
||||
|
||||
int responseCode;
|
||||
String responseBody;
|
||||
|
||||
int dataCode;
|
||||
String dataMsg;
|
||||
|
||||
JSONObject dataJson;
|
||||
|
||||
public int getResponseCode() {
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
public void setResponseCode(int responseCode) {
|
||||
this.responseCode = responseCode;
|
||||
}
|
||||
|
||||
public String getResponseBody() {
|
||||
return responseBody;
|
||||
}
|
||||
|
||||
public void setResponseBody(String responseBody) {
|
||||
this.responseBody = responseBody;
|
||||
}
|
||||
|
||||
public int getDataCode() {
|
||||
return dataCode;
|
||||
}
|
||||
|
||||
public void setDataCode(int dataCode) {
|
||||
this.dataCode = dataCode;
|
||||
}
|
||||
|
||||
public String getDataMsg() {
|
||||
return dataMsg;
|
||||
}
|
||||
|
||||
public void setDataMsg(String dataMsg) {
|
||||
this.dataMsg = dataMsg;
|
||||
}
|
||||
|
||||
public JSONObject getDataJson() {
|
||||
return dataJson;
|
||||
}
|
||||
|
||||
public void setDataJson(JSONObject dataJson) {
|
||||
this.dataJson = dataJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OkHttpDto{" +
|
||||
"responseCode=" + responseCode +
|
||||
", responseBody='" + responseBody + '\'' +
|
||||
", dataCode=" + dataCode +
|
||||
", dataMsg='" + dataMsg + '\'' +
|
||||
", dataJson=" + dataJson +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeisenAssessUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenAssessCronJob")
|
||||
public class Esb2BeisenAssessCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenAssessCronJob.class);
|
||||
|
||||
@Autowired
|
||||
Esb2BeisenAssessUtil esb2BeisenAssessUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String emails = String.valueOf(params.get("emails"));
|
||||
log.error("emails:{}",emails);
|
||||
esb2BeisenAssessUtil.queryAssessData(emails);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.util.HrmCommonUtil;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmFormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmAssessment360Dao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenAssessment360Util;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenAssessment360Action")
|
||||
public class Esb2BeisenAssessment360Action implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenAssessment360Action.class);
|
||||
|
||||
@Autowired
|
||||
HrmFormFieldDao hrmFormFieldDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
|
||||
@Autowired
|
||||
Esb2BeiSenAssessment360Util esb2BeiSenAssessment360Util;
|
||||
|
||||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
@Autowired
|
||||
HrmAssessment360Dao hrmAssessment360Dao;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("ryid");
|
||||
fieldList.add("gsyx");
|
||||
fieldList.add("gh");
|
||||
fieldList.add("hdid");
|
||||
fieldList.add("hdmc");
|
||||
fieldList.add("wjid");
|
||||
fieldList.add("wjmc");
|
||||
fieldList.add("zzjg");
|
||||
fieldList.add("cjsj");
|
||||
fieldList.add("wcsj");
|
||||
|
||||
log.error("Esb2BeisenAssessment360Action");
|
||||
|
||||
String employeeid = String.valueOf(params.get("employeeid"));
|
||||
log.error("employeeid:{}",employeeid);
|
||||
if(StringUtils.isNotBlank(employeeid)){
|
||||
Long employeeId = Long.valueOf(employeeid);
|
||||
log.error("employeeId:{}",employeeId);
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(employeeId);
|
||||
String email = createByEmployee.getEmail();
|
||||
log.error("email:{}",email);
|
||||
JSONArray assessmentArray = esb2BeiSenAssessment360Util.convertAssessmentData(email);
|
||||
log.error("assessmentArray:{}",assessmentArray.size());
|
||||
|
||||
Map<String, Object> fieldMap = hrmFormFieldDao.queryFromTableField(Constants.assessment360Table,fieldList);
|
||||
log.error("fieldMap:{}",fieldMap.size());
|
||||
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
for(int i=0;i<assessmentArray.size();i++){
|
||||
JSONObject dataJson = assessmentArray.getJSONObject(i);
|
||||
log.error("dataJson:{}",dataJson.toJSONString());
|
||||
|
||||
if(dataJson.containsKey("gh") && dataJson.containsKey("hdid") && dataJson.containsKey("wjid")){
|
||||
String gh = dataJson.getString("gh");
|
||||
String hdid = dataJson.getString("hdid");
|
||||
String wjid = dataJson.getString("wjid");
|
||||
|
||||
log.error("gh:{}",gh);
|
||||
log.error("hdid:{}",hdid);
|
||||
log.error("wjid:{}",wjid);
|
||||
|
||||
String ryid = "";
|
||||
if(StringUtils.isNotBlank(gh)){
|
||||
ryid = hrmAssessment360Dao.queryEmployeeJobNumData(gh);
|
||||
}
|
||||
log.error("ryid:{}",ryid);
|
||||
|
||||
dataJson.put("ryid",ryid);
|
||||
|
||||
String ufId = hrmAssessment360Dao.getAssessment360Data(gh,hdid,wjid);
|
||||
log.error("ufId:{}",ufId);
|
||||
|
||||
if(StringUtils.isBlank(ufId)){
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
log.error("fieldid:{}",fieldList.get(n));
|
||||
log.error("fieldid2:{}",dataJson.containsKey(fieldList.get(n)));
|
||||
log.error("fieldid3:{}",fieldMap.containsKey(fieldList.get(n)));
|
||||
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
|
||||
Map<String,Object> recordMap = hrmFormFieldDao.queryTableFormId(Constants.assessment360Table);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
actionMap.put("ebList",ebList.size());
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmFormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmBeisenPositionDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenAssessment360Util;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenAssessment360FullCronJob")
|
||||
public class Esb2BeisenAssessment360FullCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenAssessment360FullCronJob.class);
|
||||
|
||||
@Autowired
|
||||
HrmFormFieldDao hrmFormFieldDao;
|
||||
|
||||
@Autowired
|
||||
HrmBeisenPositionDao hrmBeisenPositionDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
|
||||
@Autowired
|
||||
Esb2BeiSenAssessment360Util esb2BeiSenAssessment360Util;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
JSONArray assessmentArray = new JSONArray();
|
||||
|
||||
esb2BeiSenAssessment360Util.queryAssessment360Data();
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ import com.weaver.common.base.entity.result.WeaResult;
|
|||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.ebuilder.form.client.entity.data.*;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.framework.rpc.annotation.RpcReference;
|
||||
import com.weaver.publishkit.api.util.PublishKitRuntimeUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ package com.weaver.seconddev.chapanda.beisen.esb;
|
|||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.util.HrmCommonUtil;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.BeisenStaffDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.BeisenStaffInfoByStaffCodeUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.BlackList2BeiSenUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Token2BeiSenUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.*;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -29,8 +26,12 @@ public class Esb2BeisenCreateBlackListAction implements EsbServerlessRpcRemoteIn
|
|||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
// @Autowired
|
||||
// BeisenStaffInfoByStaffCodeUtil beisenStaffInfoByStaffCodeUtil;
|
||||
|
||||
|
||||
@Autowired
|
||||
BeisenStaffInfoByStaffCodeUtil beisenStaffInfoByStaffCodeUtil;
|
||||
BeisenQueryUseridUtil beisenQueryUseridUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
|
@ -41,7 +42,7 @@ public class Esb2BeisenCreateBlackListAction implements EsbServerlessRpcRemoteIn
|
|||
String userIdStr = String.valueOf(params.get("userid"));
|
||||
log.error("userIdStr:{}",userIdStr);
|
||||
if(StringUtils.isNotBlank(userIdStr)){
|
||||
userId = Long.parseLong(userIdStr);
|
||||
userId = Long.valueOf(userIdStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,15 +60,19 @@ public class Esb2BeisenCreateBlackListAction implements EsbServerlessRpcRemoteIn
|
|||
log.error("staffemail:{}",staffemail);
|
||||
int beisenUserId = -1;
|
||||
String jobNum = "";
|
||||
if(userId >0){
|
||||
if(userId.longValue() >0){
|
||||
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(userId);
|
||||
jobNum = simpleEmployee.getJobNum();
|
||||
}
|
||||
|
||||
log.error("jobNum:{}",jobNum);
|
||||
if(StringUtils.isNotBlank(jobNum)){
|
||||
BeisenStaffDto beisenStaffDto = beisenStaffInfoByStaffCodeUtil.getBeisenStaffInfoByStaffCode(jobNum);
|
||||
beisenUserId = beisenStaffDto.getUserId();
|
||||
|
||||
String beisenUser = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobNum);
|
||||
if(StringUtils.isNotBlank(beisenUser)){
|
||||
beisenUserId = Integer.valueOf(beisenUser);
|
||||
}
|
||||
// BeisenStaffDto beisenStaffDto = beisenStaffInfoByStaffCodeUtil.getBeisenStaffInfoByStaffCode(jobNum);
|
||||
}
|
||||
log.error("beisenUserId:{}",beisenUserId);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
|||
import com.weaver.seconddev.chapanda.beisen.dao.HrmDepartmentDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.BeisenDepartmentDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.BeisenStaffDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.*;
|
||||
import com.weaver.teams.domain.department.SimpleDepartment;
|
||||
import com.weaver.workflow.list.api.rest.publicapi.WflRequestListRest;
|
||||
|
|
@ -43,14 +44,17 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
@Autowired
|
||||
BeisenStaffInfoByStaffCodeUtil beisenStaffInfoByStaffCodeUtil ;
|
||||
|
||||
@Autowired
|
||||
BeisenDeptInfoByOriginalIdUtil beisenDeptInfoByOriginalIdUtil;
|
||||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
@Autowired
|
||||
private HrmDepartmentDao hrmDepartmentDao;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryUseridUtil beisenQueryUseridUtil;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryDeptIdUtil beisenQueryDeptIdUtil;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2BeisenJobRequirementAction start");
|
||||
|
|
@ -62,7 +66,6 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
String requestname = (String) params.get("requestname");
|
||||
String createDate = (String) params.get("createDate");
|
||||
|
||||
|
||||
int requirementCount = converInteger(params,"requirementCount") ;
|
||||
String arivalTime = (String) params.get("arivalTime");
|
||||
|
||||
|
|
@ -79,6 +82,8 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
|
||||
String originalId = String.valueOf(params.get("originalId"));
|
||||
|
||||
String nlyq = String.valueOf(params.get("nlyq"));
|
||||
|
||||
log.error("requirementStatus:" + requirementStatus);
|
||||
log.error("originalId:" + originalId);
|
||||
log.error("requirementType:" + requirementType);
|
||||
|
|
@ -93,6 +98,7 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
log.error("kind:" + kind);
|
||||
log.error("isSecrecy:" + isSecrecy);
|
||||
log.error("form_data_id:" + form_data_id);
|
||||
log.error("nlyq:" + nlyq);
|
||||
|
||||
String createBy = String.valueOf(params.get("createBy"));
|
||||
String dutyUserId = String.valueOf(params.get("dutyUserId"));
|
||||
|
|
@ -100,27 +106,13 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
log.error("dutyUserId:" + dutyUserId);
|
||||
|
||||
|
||||
int beisenUserId = -1;
|
||||
if(StringUtils.isNotBlank(createBy)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(createBy));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
BeisenStaffDto beisenStaffDto = beisenStaffInfoByStaffCodeUtil.getBeisenStaffInfoByStaffCode(jobnum);
|
||||
if(beisenStaffDto !=null){
|
||||
beisenUserId = beisenStaffDto.getUserId();
|
||||
}
|
||||
log.error("beisenUserId:" + beisenUserId);
|
||||
}
|
||||
}
|
||||
|
||||
String createByEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
log.error("createByEmail:" + createByEmail);
|
||||
String dutyUserEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
log.error("dutyUserEmail:" + dutyUserEmail);
|
||||
String zpgw = String.valueOf(params.get("zpgw"));
|
||||
String zwmc = String.valueOf(params.get("zwmc"));
|
||||
// String createByEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
// log.error("createByEmail:" + createByEmail);
|
||||
// String dutyUserEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
// log.error("dutyUserEmail:" + dutyUserEmail);
|
||||
|
||||
String originalCode = "";
|
||||
if(StringUtils.isNotBlank(originalId)){
|
||||
|
|
@ -128,18 +120,80 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
}
|
||||
log.error("originalCode:" + originalCode);
|
||||
|
||||
String createByEmail = "";
|
||||
int beisenCreateUserId = -1;
|
||||
if(StringUtils.isNotBlank(createBy)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(createBy));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
createByEmail = createByEmployee.getEmail();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenCreateUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenCreateUserId:" + beisenCreateUserId);
|
||||
}
|
||||
}
|
||||
log.error("createByEmail:" + createByEmail);
|
||||
|
||||
|
||||
String dutyUserEmail = "";
|
||||
int beisenDutyUserId = -1;
|
||||
if(StringUtils.isNotBlank(dutyUserId)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee dutyEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(dutyUserId));
|
||||
if(dutyEmployee !=null && dutyEmployee.getId() > 0){
|
||||
jobnum = dutyEmployee.getJobNum();
|
||||
dutyUserEmail = dutyEmployee.getEmail();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenDutyUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenDutyUserId:" + beisenDutyUserId);
|
||||
}
|
||||
}
|
||||
log.error("dutyUserEmail:" + dutyUserEmail);
|
||||
|
||||
int orgId = -1;
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
BeisenDepartmentDto beisenDepartmentDto = beisenDeptInfoByOriginalIdUtil.getBeisenDeptDataByOriginalId(originalId);
|
||||
log.error("beisenDepartmentDto:{}",beisenDepartmentDto.toString());
|
||||
orgId = beisenDepartmentDto.getOrgId();
|
||||
// BeisenDepartmentDto beisenDepartmentDto = beisenDeptInfoByOriginalIdUtil.getBeisenDeptDataByOriginalId(originalId);
|
||||
// log.error("beisenDepartmentDto:{}",beisenDepartmentDto.toString());
|
||||
String deptid = beisenQueryDeptIdUtil.queryBeisenDeptIdByCode(originalCode);
|
||||
if(StringUtils.isNotBlank(deptid)){
|
||||
orgId = Integer.valueOf(deptid);
|
||||
}
|
||||
// orgId = beisenDepartmentDto.getOrgId();
|
||||
}
|
||||
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:" + token);
|
||||
String xqmc = (String) params.get("xqmc");
|
||||
String gzzz = String.valueOf(params.get("gzzz"));
|
||||
String rzzg = String.valueOf(params.get("rzzg "));
|
||||
String zxssyf = String.valueOf(params.get("zxssyf"));
|
||||
String jjcd = String.valueOf(params.get("jjcd"));
|
||||
int gzdd = Integer.valueOf(String.valueOf(params.get("gzdd")));
|
||||
log.error("xqmc:" + xqmc);
|
||||
log.error("orgId:" + orgId);
|
||||
String dataId = jobRequirement2BeisenUtil.sendJobRequirement(token,requirementStatus,requirementType,
|
||||
requestname,beisenUserId,
|
||||
log.error("gzdd:" + gzdd);
|
||||
String xb_value = "";
|
||||
String xbyq = String.valueOf(params.get("xbyq"));
|
||||
if("1".equals(xbyq)){
|
||||
xb_value = "male";
|
||||
}else if("2".equals(xbyq)){
|
||||
xb_value = "female";
|
||||
}else if("3".equals(xbyq)){
|
||||
xb_value = "no";
|
||||
}
|
||||
log.error("xb_value:" + xb_value);
|
||||
|
||||
OkHttpDto okHttpDto = jobRequirement2BeisenUtil.sendJobRequirement(requirementStatus,requirementType,
|
||||
requestname,beisenCreateUserId,
|
||||
createDate,requirementCount,
|
||||
arivalTime,
|
||||
createByEmail,
|
||||
|
|
@ -151,9 +205,21 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
workExperience,
|
||||
kind,
|
||||
isSecrecy,
|
||||
originalCode);
|
||||
originalCode,nlyq,zpgw,zwmc,beisenDutyUserId,xqmc,gzzz,rzzg,zxssyf,jjcd,gzdd,xb_value);
|
||||
|
||||
if(okHttpDto.getResponseCode() !=200){
|
||||
return WeaResult.fail(500,"请求北森招聘需求接口异常");
|
||||
}
|
||||
|
||||
if(okHttpDto.getDataCode() !=200){
|
||||
return WeaResult.fail(500,"创建北森招聘需求接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
String dataId = okHttpDto.getDataJson().getString("dataId");
|
||||
if(StringUtils.isBlank(dataId)){
|
||||
return WeaResult.fail(500,"创建北森招聘需求接口失败,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
log.error("dataId:" + dataId);
|
||||
// if(StringUtils.isNotBlank(dataId)){
|
||||
// String sourceType = "";
|
||||
// String groupId = "";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,273 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.util.HrmCommonUtil;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmDepartmentDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.BeisenDepartmentDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.BeisenStaffDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.*;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* @author: shil
|
||||
* @date: 2025/8/7
|
||||
* @description: 招聘需求创建
|
||||
*/
|
||||
@Service("Esb2BeisenJobRequirementCreateAction")
|
||||
public class Esb2BeisenJobRequirementCreateAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenJobRequirementCreateAction.class);
|
||||
|
||||
@Autowired
|
||||
JobRequirement2BeisenUtil jobRequirement2BeisenUtil;
|
||||
|
||||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
@Autowired
|
||||
private HrmDepartmentDao hrmDepartmentDao;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryUseridUtil beisenQueryUseridUtil;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryDeptIdUtil beisenQueryDeptIdUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2BeisenJobRequirementAction start");
|
||||
|
||||
int requirementStatus = converInteger(params,"requirementStatus");
|
||||
String form_data_id = (String) params.get("form_data_id");
|
||||
int requirementType = converInteger(params,"requirementType");
|
||||
|
||||
String requestname = (String) params.get("requestname");
|
||||
String createDate = (String) params.get("createDate");
|
||||
String xqmc = (String) params.get("xqmc");
|
||||
|
||||
int requirementCount = converInteger(params,"requirementCount") ;
|
||||
String arivalTime = (String) params.get("arivalTime");
|
||||
|
||||
int salaryType = converInteger(params,"salaryType");
|
||||
int category = converInteger(params,"category");
|
||||
String educationInfo = (String) params.get("educationInfo");
|
||||
String workExperience = (String) params.get("workExperience");
|
||||
int kind = converInteger(params,"kind");
|
||||
boolean isSecrecy = false;
|
||||
String isSecrecyStr = (String) params.get("isSecrecy");
|
||||
if("1".equals(isSecrecyStr)){
|
||||
isSecrecy = true;
|
||||
}
|
||||
|
||||
String originalId = String.valueOf(params.get("originalId"));
|
||||
|
||||
String nlyq = String.valueOf(params.get("nlyq"));
|
||||
|
||||
|
||||
String zpgw = String.valueOf(params.get("zpgw"));
|
||||
String zwmc = String.valueOf(params.get("zwmc"));
|
||||
String zxssyf = String.valueOf(params.get("zxssyf"));
|
||||
String jjcd = String.valueOf(params.get("jjcd"));
|
||||
|
||||
log.error("requirementStatus:" + requirementStatus);
|
||||
log.error("originalId:" + originalId);
|
||||
log.error("requirementType:" + requirementType);
|
||||
log.error("requestname:" + requestname);
|
||||
log.error("createDate:" + createDate);
|
||||
log.error("requirementCount:" + requirementCount);
|
||||
log.error("arivalTime:" + arivalTime);
|
||||
log.error("salaryType:" + salaryType);
|
||||
log.error("category:" + category);
|
||||
log.error("educationInfo:" + educationInfo);
|
||||
log.error("workExperience:" + workExperience);
|
||||
log.error("kind:" + kind);
|
||||
log.error("isSecrecy:" + isSecrecy);
|
||||
log.error("form_data_id:{}" , form_data_id);
|
||||
log.error("nlyq:{}" , nlyq);
|
||||
log.error("zpgw:{}" , zpgw);
|
||||
|
||||
String createBy = String.valueOf(params.get("createBy"));
|
||||
String dutyUserId = String.valueOf(params.get("dutyUserId"));
|
||||
log.error("createBy:" + createBy);
|
||||
log.error("dutyUserId:" + dutyUserId);
|
||||
|
||||
String createByEmail = "";
|
||||
int beisenCreateUserId = -1;
|
||||
if(StringUtils.isNotBlank(createBy)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(createBy));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
createByEmail = createByEmployee.getEmail();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenCreateUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenCreateUserId:" + beisenCreateUserId);
|
||||
}
|
||||
}
|
||||
log.error("createByEmail:" + createByEmail);
|
||||
|
||||
String dutyUserEmail = "";
|
||||
int beisenDutyUserId = -1;
|
||||
if(StringUtils.isNotBlank(dutyUserId)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee dutyEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(dutyUserId));
|
||||
if(dutyEmployee !=null && dutyEmployee.getId() > 0){
|
||||
jobnum = dutyEmployee.getJobNum();
|
||||
dutyUserEmail = dutyEmployee.getEmail();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenDutyUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenDutyUserId:" + beisenDutyUserId);
|
||||
}
|
||||
}
|
||||
log.error("dutyUserEmail:" + dutyUserEmail);
|
||||
|
||||
// String createByEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
// log.error("createByEmail:" + createByEmail);
|
||||
// String dutyUserEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
// log.error("dutyUserEmail:" + dutyUserEmail);
|
||||
|
||||
String originalCode = "";
|
||||
if(StringUtils.isNotBlank(originalId)){
|
||||
originalCode = hrmDepartmentDao.getDepartmentCodeById(originalId);
|
||||
}
|
||||
log.error("originalCode:" + originalCode);
|
||||
|
||||
int orgId = -1;
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
// BeisenDepartmentDto beisenDepartmentDto = beisenDeptInfoByOriginalIdUtil.getBeisenDeptDataByOriginalId(originalId);
|
||||
// log.error("beisenDepartmentDto:{}",beisenDepartmentDto.toString());
|
||||
String deptid = beisenQueryDeptIdUtil.queryBeisenDeptIdByCode(originalCode);
|
||||
if(StringUtils.isNotBlank(deptid)){
|
||||
orgId = Integer.valueOf(deptid);
|
||||
}
|
||||
// orgId = beisenDepartmentDto.getOrgId();
|
||||
}
|
||||
|
||||
String gzzz = String.valueOf(params.get("gzzz"));
|
||||
String rzzg = String.valueOf(params.get("rzzg"));
|
||||
log.error("rzzg:" + rzzg);
|
||||
log.error("orgId:" + orgId);
|
||||
|
||||
int gzdd = 0;
|
||||
String gzddStr = String.valueOf(params.get("gzdd"));
|
||||
log.error("gzddStr:" + gzddStr);
|
||||
if(StringUtils.isNotBlank(gzddStr)){
|
||||
gzdd = Integer.valueOf(String.valueOf(params.get("gzdd")));
|
||||
}
|
||||
|
||||
// 性别要求extxingbieyaoqiu_431582_960838668
|
||||
// 男 1 male
|
||||
// 女 2 female
|
||||
// 不限 3 no
|
||||
String xb_value = "";
|
||||
String xbyq = String.valueOf(params.get("xbyq"));
|
||||
if("1".equals(xbyq)){
|
||||
xb_value = "male";
|
||||
}else if("2".equals(xbyq)){
|
||||
xb_value = "female";
|
||||
}else if("3".equals(xbyq)){
|
||||
xb_value = "no";
|
||||
}
|
||||
|
||||
OkHttpDto okHttpDto = jobRequirement2BeisenUtil.sendJobRequirement(requirementStatus,requirementType,
|
||||
requestname,beisenCreateUserId,
|
||||
createDate,requirementCount,
|
||||
arivalTime,
|
||||
createByEmail,
|
||||
dutyUserEmail,
|
||||
orgId,
|
||||
salaryType,
|
||||
category,
|
||||
educationInfo,
|
||||
workExperience,
|
||||
kind,
|
||||
isSecrecy,
|
||||
originalCode,
|
||||
nlyq,
|
||||
zpgw,
|
||||
zwmc,
|
||||
beisenDutyUserId,
|
||||
xqmc,
|
||||
gzzz,
|
||||
rzzg,zxssyf,jjcd,gzdd,xb_value
|
||||
);
|
||||
|
||||
|
||||
log.error("okHttpDto:" + okHttpDto.toString());
|
||||
log.error("getDataCode:" + okHttpDto.getDataCode());
|
||||
if(okHttpDto.getResponseCode() !=200){
|
||||
return WeaResult.fail(500,"请求北森招聘需求接口异常");
|
||||
}
|
||||
|
||||
if(okHttpDto.getDataCode() != 200){
|
||||
return WeaResult.fail(500,"创建北森招聘需求接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
String dataId = okHttpDto.getDataJson().getString("dataid");
|
||||
if(StringUtils.isBlank(dataId)){
|
||||
return WeaResult.fail(500,"创建北森招聘需求接口失败,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
// if(StringUtils.isNotBlank(dataId)){
|
||||
// String sourceType = "";
|
||||
// String groupId = "";
|
||||
//
|
||||
// String dataSql =" update uf_zpxqgl set bszxid = ? " +
|
||||
// " where form_data_id = ?\n" +
|
||||
// " and tenant_key=? \n" +
|
||||
// " and delete_type=0 \n" ;
|
||||
//
|
||||
// log.error("dataSql:" + dataSql);
|
||||
// List<String> paramList = new ArrayList<>(100);
|
||||
//
|
||||
// paramList.add(form_data_id);
|
||||
// paramList.add(Constants.TENANT_KEY);
|
||||
// List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
// result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
// }
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","创建招聘需求成功");
|
||||
actionMap.put("dataId",dataId);
|
||||
actionMap.put("form_data_id",form_data_id);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 转换为int
|
||||
* @param params
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public int converInteger(Map<String,Object> params,String key){
|
||||
int value = -1;
|
||||
try{
|
||||
String requirementStatusStr = (String) params.get(key);
|
||||
value = Integer.valueOf(requirementStatusStr);
|
||||
}catch (Exception e){
|
||||
log.error("key:{},e:{}",key,e.getMessage());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.*;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenJobRequirementUnRelateAction")
|
||||
public class Esb2BeisenJobRequirementUnRelateAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenJobRequirementUnRelateAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2BeisenUnRelateRequestUtil esb2BeisenUnRelateRequestUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String form_data_id = String.valueOf(params.get("form_data_id"));
|
||||
String requirementId = String.valueOf(params.get("requirementId"));
|
||||
|
||||
if(StringUtils.isBlank(requirementId)){
|
||||
return WeaResult.fail(500,"招聘需求信息获取为空");
|
||||
}
|
||||
|
||||
log.error("requirementId:" + requirementId);
|
||||
String code = esb2BeisenUnRelateRequestUtil.unRelateJobRequirement(requirementId);
|
||||
log.error("code:" + code);
|
||||
if(StringUtils.isBlank(code)){
|
||||
return WeaResult.fail(500,"取消招聘需求失败");
|
||||
}
|
||||
|
||||
if(!"200".equals(code)){
|
||||
return WeaResult.fail(500,"取消招聘需求失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","取消招聘需求成功");
|
||||
actionMap.put("datacode",code);
|
||||
actionMap.put("form_data_id",form_data_id);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.util.HrmCommonUtil;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmDepartmentDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.BeisenQueryDeptIdUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.BeisenQueryUseridUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.JobRequirement2BeisenUtil;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* @author: shil
|
||||
* @date: 2025/8/7
|
||||
* @description: 招聘需求创建
|
||||
*/
|
||||
@Service("Esb2BeisenJobRequirementUpdateAction")
|
||||
public class Esb2BeisenJobRequirementUpdateAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenJobRequirementUpdateAction.class);
|
||||
|
||||
@Autowired
|
||||
JobRequirement2BeisenUtil jobRequirement2BeisenUtil;
|
||||
|
||||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
@Autowired
|
||||
private HrmDepartmentDao hrmDepartmentDao;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryUseridUtil beisenQueryUseridUtil;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryDeptIdUtil beisenQueryDeptIdUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2BeisenJobRequirementUpdateAction start");
|
||||
|
||||
String form_data_id = (String) params.get("form_data_id");
|
||||
|
||||
String requirementId = (String) params.get("requirementId");
|
||||
int requirementStatus = converInteger(params,"requirementStatus");
|
||||
int requirementType = converInteger(params,"requirementType");
|
||||
String xqmc = (String) params.get("xqmc");
|
||||
String createDate = (String) params.get("createDate");
|
||||
String arivalTime = (String) params.get("arivalTime");
|
||||
String finishTime = String.valueOf(params.get("finishTime"));
|
||||
|
||||
log.error("requirementStatus:" + requirementStatus);
|
||||
log.error("requirementType:" + requirementType);
|
||||
log.error("requirementId:" + requirementId);
|
||||
log.error("finishTime:" + finishTime);
|
||||
|
||||
String createBy = String.valueOf(params.get("createBy"));
|
||||
String dutyUserId = String.valueOf(params.get("dutyUserId"));
|
||||
String originalId = String.valueOf(params.get("originalId"));
|
||||
|
||||
|
||||
log.error("createBy:" + createBy);
|
||||
log.error("dutyUserId:" + dutyUserId);
|
||||
|
||||
|
||||
String createByEmail = "";
|
||||
int beisenCreateUserId = -1;
|
||||
if(StringUtils.isNotBlank(createBy)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(createBy));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
createByEmail = createByEmployee.getEmail();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenCreateUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenCreateUserId:" + beisenCreateUserId);
|
||||
}
|
||||
}
|
||||
log.error("createByEmail:" + createByEmail);
|
||||
|
||||
|
||||
String dutyUserEmail = "";
|
||||
int beisenDutyUserId = -1;
|
||||
if(StringUtils.isNotBlank(dutyUserId)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee dutyEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(dutyUserId));
|
||||
if(dutyEmployee !=null && dutyEmployee.getId() > 0){
|
||||
jobnum = dutyEmployee.getJobNum();
|
||||
dutyUserEmail = dutyEmployee.getEmail();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenDutyUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenDutyUserId:" + beisenDutyUserId);
|
||||
}
|
||||
}
|
||||
log.error("dutyUserEmail:" + dutyUserEmail);
|
||||
|
||||
|
||||
|
||||
String originalCode = "";
|
||||
if(StringUtils.isNotBlank(originalId)){
|
||||
originalCode = hrmDepartmentDao.getDepartmentCodeById(originalId);
|
||||
}
|
||||
log.error("originalCode:" + originalCode);
|
||||
|
||||
int orgId = -1;
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
// BeisenDepartmentDto beisenDepartmentDto = beisenDeptInfoByOriginalIdUtil.getBeisenDeptDataByOriginalId(originalId);
|
||||
// log.error("beisenDepartmentDto:{}",beisenDepartmentDto.toString());
|
||||
String deptid = beisenQueryDeptIdUtil.queryBeisenDeptIdByCode(originalCode);
|
||||
if(StringUtils.isNotBlank(deptid)){
|
||||
orgId = Integer.valueOf(deptid);
|
||||
}
|
||||
// orgId = beisenDepartmentDto.getOrgId();
|
||||
}
|
||||
|
||||
|
||||
OkHttpDto okHttpDto = jobRequirement2BeisenUtil.updateJobRequirement(requirementStatus,requirementType,
|
||||
createDate, arivalTime, finishTime, xqmc,
|
||||
beisenCreateUserId,
|
||||
createByEmail,
|
||||
dutyUserEmail,
|
||||
orgId,
|
||||
originalCode,
|
||||
beisenDutyUserId
|
||||
);
|
||||
|
||||
|
||||
log.error("okHttpDto:" + okHttpDto.toString());
|
||||
log.error("getDataCode:" + okHttpDto.getDataCode());
|
||||
if(okHttpDto.getResponseCode() !=200){
|
||||
return WeaResult.fail(500,"调用北森招聘需求更新接口异常");
|
||||
}
|
||||
|
||||
if(okHttpDto.getDataCode() != 200){
|
||||
return WeaResult.fail(500,"北森招聘需求更新接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","森招聘需求更新成功");
|
||||
actionMap.put("form_data_id",form_data_id);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 转换为int
|
||||
* @param params
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public int converInteger(Map<String,Object> params,String key){
|
||||
int value = -1;
|
||||
try{
|
||||
String requirementStatusStr = (String) params.get(key);
|
||||
value = Integer.valueOf(requirementStatusStr);
|
||||
}catch (Exception e){
|
||||
log.error("key:{},e:{}",key,e.getMessage());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,17 +11,18 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 废弃,由雪峰重写了
|
||||
*/
|
||||
@Service("Esb2BeisenOfferCronJob")
|
||||
public class Esb2BeisenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenOfferCronJob.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil http2BenSenUtil ;
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
@Autowired
|
||||
Offer2BeiSenUtil offer2BeiSenUtil;
|
||||
|
|
@ -48,7 +49,7 @@ public class Esb2BeisenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
String endDate = String.valueOf(params.get("endDate"));
|
||||
String endTime = String.valueOf(params.get("endTime"));
|
||||
|
||||
String token = http2BenSenUtil.getToken();
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class Esb2BeisenPerformanceCronJob implements EsbServerlessRpcRemoteInter
|
|||
int pageCount = (int)Math.floor(activityTotal / Integer.valueOf(capacity));
|
||||
for(int i = 1; i < pageCount; i++){
|
||||
JSONArray itemArray = performance2BeiSenUtil.queryActivityManager(token,String.valueOf(i),capacity,year,period);
|
||||
activityManagerArray.add(itemArray);
|
||||
activityManagerArray.addAll(itemArray);
|
||||
}
|
||||
}
|
||||
return activityManagerArray;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
|||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.FormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmFormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmDepartmentDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmPerformanceDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenAssessmentUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Token2BeiSenUtil;
|
||||
|
|
@ -20,10 +21,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service("Esb2BeisenPerformanceCronJobNew")
|
||||
public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteInterface {
|
||||
|
|
@ -36,7 +34,7 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
Esb2BeiSenAssessmentUtil esb2BeiSenAssessmentUtil;
|
||||
|
||||
@Autowired
|
||||
FormFieldDao formFieldDao;
|
||||
HrmFormFieldDao hrmFormFieldDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
|
|
@ -44,6 +42,9 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
@Autowired
|
||||
HrmDepartmentDao hrmDepartmentDao;
|
||||
|
||||
@Autowired
|
||||
HrmPerformanceDao hrmPerformanceDao;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2BeisenPerformanceCronJobNew start");
|
||||
|
|
@ -74,11 +75,20 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
fieldList.add("jxxs");
|
||||
fieldList.add("bkhr");
|
||||
fieldList.add("khzqlx");
|
||||
fieldList.add("jxxs");
|
||||
|
||||
|
||||
|
||||
fieldList.add("ppdj");
|
||||
fieldList.add("jxhdid");
|
||||
|
||||
fieldList.add("rzrq");
|
||||
fieldList.add("lzrq");
|
||||
fieldList.add("zzrq");
|
||||
fieldList.add("ryzt");
|
||||
fieldList.add("gs");
|
||||
fieldList.add("bm1");
|
||||
fieldList.add("bm2");
|
||||
fieldList.add("bm3");
|
||||
fieldList.add("bm4");
|
||||
fieldList.add("gzdd");
|
||||
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
JSONArray assessmentArray = getAssessmentArray(token,page, capacity, modifiedAfter, modifiedBefore);
|
||||
|
|
@ -117,59 +127,115 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
int effectiveTotal = 0;
|
||||
int failTotal = 0;
|
||||
|
||||
if(assessmentArray.size() > 0){
|
||||
JSONArray dataArray = convertAssessmentList(assessmentArray);
|
||||
log.error("dataArray:"+dataArray.size());
|
||||
List<EBDataReqDto> datas = new ArrayList<EBDataReqDto>();
|
||||
Map<String, Object> fieldMap = formFieldDao.queryFromTableField(Constants.assessmentFormTable,fieldList);
|
||||
|
||||
Map<String, Object> fieldMap = hrmFormFieldDao.queryFromTableField(Constants.assessmentFormTable,fieldList);
|
||||
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
List<EBDataReqDto> updateDatas = new ArrayList<EBDataReqDto>();
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("bkhr") && StringUtils.isNotBlank(dataJson.getString("bkhr"))){
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
String khnf = dataJson.getString("khnf");
|
||||
String khzq = dataJson.getString("khzq");
|
||||
String bkhr = dataJson.getString("bkhr");
|
||||
String jxhdid = dataJson.getString("jxhdid");
|
||||
String ufId = hrmPerformanceDao.getAssessmentData(khnf,khzq,jxhdid,bkhr);
|
||||
log.error("ufId:{}",ufId);
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
effectiveTotal++;
|
||||
String zzdf = dataJson.getString("zzdf");
|
||||
log.error("zzdf:{}",zzdf);
|
||||
|
||||
if(StringUtils.isNotBlank(ufId)){
|
||||
log.error("修改");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
mainData.add(new EBDataReqDetailDto("id", ufId));
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
effectiveTotal++;
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
updateDatas.add(ebDataReqDto);
|
||||
}else{
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
effectiveTotal++;
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
datas.add(ebDataReqDto);
|
||||
}else{
|
||||
failTotal++;
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
log.error("updateDatas:{}",updateDatas.size());
|
||||
|
||||
log.error("datas:{}",datas.size());
|
||||
|
||||
Map<String,Object> recordMap = formFieldDao.queryTableFormId(Constants.assessmentFormTable);
|
||||
Map<String,Object> recordMap = hrmFormFieldDao.queryTableFormId(Constants.assessmentFormTable);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
EBDataChangeResult ebDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(datas,formId,appId);
|
||||
boolean isTrue = ebDataChangeResult.getStatus();
|
||||
log.error("isTrue:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList = ebDataChangeResult.getDataIds();
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
|
||||
if(updateDatas.size() > 0){
|
||||
|
||||
EBDataChangeResult updateEbDataChangeResult = ebuilderOperateUtils.bacthEditEbForm(updateDatas,formId,appId);
|
||||
boolean isTrue = updateEbDataChangeResult.getStatus();
|
||||
log.error("isTrue2:{}",isTrue);
|
||||
log.error("message2:{}",updateEbDataChangeResult.getMessage());
|
||||
if(isTrue){
|
||||
ebList.addAll(updateEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(String ebId:ebList){
|
||||
|
||||
String rylb = "";
|
||||
String bm1 = "";
|
||||
if("2".equals(rylb)){
|
||||
|
||||
}else if("".equals(bm1)){
|
||||
|
||||
}
|
||||
}
|
||||
log.error("ebList:{}", JSON.toJSONString(ebList));
|
||||
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
|
|
@ -220,7 +286,7 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
for (int i = 1; i < pageCount; i++) {
|
||||
int page2 = i + 1;
|
||||
JSONArray itemArray2 = esb2BeiSenAssessmentUtil.queryAssessmentsByPage(token, page2, capacity, modifiedAfter, modifiedBefore);
|
||||
assessmentArray.add(itemArray2);
|
||||
assessmentArray.addAll(itemArray2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -261,6 +327,7 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
|
||||
if("ActivityManagerId".equals(name)){
|
||||
dataJson.put("jxhdmc",text);
|
||||
dataJson.put("jxhdid",value);
|
||||
}
|
||||
|
||||
// if("Employee".equals(name)){
|
||||
|
|
@ -277,7 +344,7 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
dataJson.put("khzq",value);
|
||||
|
||||
if("-1".equals(value)){
|
||||
dataJson.put("khzqlx","年度考核");
|
||||
dataJson.put("khzqlx","4"); //年度考核
|
||||
}else if("1".equals(value) || "2".equals(value)
|
||||
|| "3".equals(value)
|
||||
|| "4".equals(value)
|
||||
|
|
@ -290,13 +357,13 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
|| "11".equals(value)
|
||||
|| "12".equals(value)
|
||||
){
|
||||
dataJson.put("khzqlx","月度考核");
|
||||
dataJson.put("khzqlx","1"); //月度考核
|
||||
}else if("31".equals(value) || "22".equals(value)
|
||||
){
|
||||
dataJson.put("khzqlx","半年度考核");
|
||||
dataJson.put("khzqlx","3"); //半年度考核
|
||||
}else if("21".equals(value) || "22".equals(value) || "23".equals(value) || "24".equals(value)
|
||||
){
|
||||
dataJson.put("khzqlx","季度考核");
|
||||
dataJson.put("khzqlx","2"); //季度考核
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -316,6 +383,18 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
String employeeid = String.valueOf(employeeMap.get(value));
|
||||
log.error("employeeid:{}",employeeid);
|
||||
dataJson.put("bkhr",employeeid);
|
||||
if(StringUtils.isNotBlank(employeeid)){
|
||||
Map<String,Object> otherMap = hrmPerformanceDao.queryEmployeeAssessmentOtherInfo(employeeid);
|
||||
Iterator<Map.Entry<String, Object>> iterator = otherMap.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, Object> entry = iterator.next();
|
||||
String emKey = entry.getKey();
|
||||
String emValue = entry.getValue().toString();
|
||||
log.error("emKey:{}",emKey);
|
||||
log.error("emValue:{}",emValue);
|
||||
dataJson.put(emKey,emValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -335,8 +414,9 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
}
|
||||
|
||||
if("TotalScoreRuleIdLookup".equals(name)){
|
||||
dataJson.put("jxxs",text);
|
||||
dataJson.put("ppdj",text);
|
||||
}
|
||||
|
||||
}
|
||||
dataArray.add(dataJson);
|
||||
log.error("dataJson:{}",dataJson.toJSONString());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,284 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmFormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmBeisenPositionDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenPositionUtil;
|
||||
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.*;
|
||||
|
||||
@Service("Esb2BeisenPositionFullCronJob")
|
||||
public class Esb2BeisenPositionFullCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenPositionFullCronJob.class);
|
||||
|
||||
@Autowired
|
||||
Esb2BeiSenPositionUtil esb2BeiSenPositionUtil;
|
||||
|
||||
@Autowired
|
||||
HrmFormFieldDao hrmFormFieldDao;
|
||||
|
||||
@Autowired
|
||||
HrmBeisenPositionDao hrmBeisenPositionDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
log.error("Esb2BeisenPositionFullCronJob");
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
JSONArray positionArray = new JSONArray();
|
||||
|
||||
String startDate = String.valueOf(params.get("startDate"));
|
||||
String endDate = String.valueOf(params.get("endDate"));
|
||||
int capacity = 100;
|
||||
int total = 0;
|
||||
String scrollId = "";
|
||||
JSONArray firstArray = new JSONArray();
|
||||
String msg = esb2BeiSenPositionUtil.queryPositionByDate(startDate, endDate,capacity);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("total")){
|
||||
total = msgJson.getInteger("total");
|
||||
}
|
||||
if(msgJson.containsKey("data")){
|
||||
firstArray = msgJson.getJSONArray("data");
|
||||
}
|
||||
|
||||
if(msgJson.containsKey("scrollId")){
|
||||
scrollId = msgJson.getString("scrollId");
|
||||
}
|
||||
}
|
||||
|
||||
log.error("total:{}",total);
|
||||
log.error("firstArray:{}",firstArray.size());
|
||||
log.error("scrollId:{}",scrollId);
|
||||
|
||||
if(total <= capacity){
|
||||
positionArray = firstArray;
|
||||
}else{
|
||||
if(firstArray.size() > 0){
|
||||
positionArray.addAll(firstArray);
|
||||
}
|
||||
int pageCount = (int)Math.floor(total / capacity*1.0);
|
||||
log.error("pageCount:{}",pageCount);
|
||||
int count = 0;
|
||||
while(StringUtils.isNotBlank(scrollId) && !"null".equals(scrollId)){
|
||||
String positionData = esb2BeiSenPositionUtil.queryPositionByscrollId(startDate, endDate,scrollId,capacity);
|
||||
if(StringUtils.isNotBlank(positionData)){
|
||||
JSONObject msgJson = JSONObject.parseObject(positionData);
|
||||
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONArray itemArray = msgJson.getJSONArray("data");
|
||||
log.error("itemArray:{}",itemArray.size());
|
||||
if(itemArray.size() > 0){
|
||||
positionArray.addAll(itemArray);
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
}
|
||||
|
||||
if(msgJson.containsKey("scrollId")){
|
||||
scrollId = msgJson.getString("scrollId");
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
|
||||
log.error("scrollId:{}",scrollId);
|
||||
log.error("count:{}",count);
|
||||
|
||||
count++;
|
||||
if(count > (pageCount+5)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("positionArray:{}",positionArray.size());
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("bs_gwid");
|
||||
fieldList.add("bs_gwmc");
|
||||
fieldList.add("bs_gwbm");
|
||||
|
||||
if(positionArray.size() > 0){
|
||||
updateHrmPosition(positionArray);
|
||||
doSavePositionData(positionArray);
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
public JSONArray convertPositionList(JSONArray positionArray){
|
||||
JSONArray dataArray = new JSONArray();
|
||||
|
||||
for(int i=0;i<positionArray.size();i++) {
|
||||
JSONObject positionJson = positionArray.getJSONObject(i);
|
||||
String name = positionJson.getString("name");
|
||||
String code = positionJson.getString("code");
|
||||
String objectId = positionJson.getString("objectId");
|
||||
|
||||
log.error("name:{}",name);
|
||||
log.error("objectId:{}",objectId);
|
||||
|
||||
if(StringUtils.isNotBlank(code) && StringUtils.isNotBlank(objectId)){
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("bs_gwid",objectId);
|
||||
dataJson.put("bs_gwmc",name);
|
||||
dataJson.put("bs_gwbm",code);
|
||||
dataArray.add(dataJson);
|
||||
}
|
||||
}
|
||||
return dataArray;
|
||||
}
|
||||
|
||||
public List<String> doSavePositionData(JSONArray positionArray){
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("bs_gwid");
|
||||
fieldList.add("bs_gwmc");
|
||||
fieldList.add("bs_gwbm");
|
||||
|
||||
if(positionArray.size() > 0){
|
||||
JSONArray dataArray = convertPositionList(positionArray);
|
||||
log.error("dataArray:"+dataArray.size());
|
||||
Map<String, Object> fieldMap = hrmFormFieldDao.queryFromTableField(Constants.beisenPostionTable,fieldList);
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
List<EBDataReqDto> updateDatas = new ArrayList<EBDataReqDto>();
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("bs_gwid") && StringUtils.isNotBlank(dataJson.getString("bs_gwid"))){
|
||||
String bs_gwid = dataJson.getString("bs_gwid");
|
||||
String bs_gwmc = dataJson.getString("bs_gwmc");
|
||||
String bs_gwbm = dataJson.getString("bs_gwbm");
|
||||
String ufId = hrmBeisenPositionDao.getPositionIdByGwId(bs_gwid);
|
||||
log.error("ufId:{}",ufId);
|
||||
|
||||
if(StringUtils.isNotBlank(ufId)){
|
||||
log.error("修改");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
mainData.add(new EBDataReqDetailDto("id", ufId));
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
updateDatas.add(ebDataReqDto);
|
||||
}else{
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
}else{
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
log.error("updateDatas:{}",updateDatas.size());
|
||||
|
||||
Map<String,Object> recordMap = hrmFormFieldDao.queryTableFormId(Constants.beisenPostionTable);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
|
||||
if(updateDatas.size() > 0){
|
||||
|
||||
EBDataChangeResult updateEbDataChangeResult = ebuilderOperateUtils.bacthEditEbForm(updateDatas,formId,appId);
|
||||
boolean isTrue = updateEbDataChangeResult.getStatus();
|
||||
log.error("isTrue2:{}",isTrue);
|
||||
log.error("message2:{}",updateEbDataChangeResult.getMessage());
|
||||
if(isTrue){
|
||||
ebList.addAll(updateEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ebList;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> updateHrmPosition(JSONArray positionArray){
|
||||
Map<String,String> resultMap = new HashMap<String,String>();
|
||||
int failCount = 0;
|
||||
int successCount = 0;
|
||||
int total = positionArray.size() ;
|
||||
if(positionArray.size() > 0){
|
||||
for(int i=0;i<positionArray.size();i++){
|
||||
JSONObject dataJson = positionArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("objectId") && StringUtils.isNotBlank(dataJson.getString("objectId"))){
|
||||
String objectId = dataJson.getString("objectId");
|
||||
String code = dataJson.getString("code");
|
||||
String oIdOrganization = dataJson.getString("oIdOrganization");
|
||||
Map<String, Object> result = hrmBeisenPositionDao.updateHrmPositionByBensen(code,objectId,oIdOrganization);
|
||||
if (result.containsKey("code")) {
|
||||
code = String.valueOf(result.get("code"));
|
||||
log.error("code:" + code);
|
||||
if ("200".equals(code)) {
|
||||
successCount++;
|
||||
}else{
|
||||
failCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("failCount",String.valueOf(failCount));
|
||||
resultMap.put("successCount",String.valueOf(successCount));
|
||||
resultMap.put("total",String.valueOf(total));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,277 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmFormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmBeisenPositionDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenPositionUtil;
|
||||
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.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenPositionTimeCronJob")
|
||||
public class Esb2BeisenPositionTimeCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenPositionTimeCronJob.class);
|
||||
|
||||
@Autowired
|
||||
Esb2BeiSenPositionUtil esb2BeiSenPositionUtil;
|
||||
|
||||
@Autowired
|
||||
HrmFormFieldDao hrmFormFieldDao;
|
||||
|
||||
@Autowired
|
||||
HrmBeisenPositionDao hrmBeisenPositionDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
JSONArray positionArray = new JSONArray();
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
// 获取当前日期的前一周
|
||||
LocalDate lastWeek = today.minusWeeks(1);
|
||||
|
||||
String startDate = lastWeek.toString();
|
||||
String endDate = today.toString();
|
||||
|
||||
log.error("startDate:{}",startDate);
|
||||
log.error("endDate:{}",endDate);
|
||||
|
||||
int capacity = 100;
|
||||
int total = 0;
|
||||
String scrollId = "";
|
||||
JSONArray firstArray = new JSONArray();
|
||||
String msg = esb2BeiSenPositionUtil.queryPositionByDate(startDate, endDate,capacity);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("total")){
|
||||
total = msgJson.getInteger("total");
|
||||
}
|
||||
if(msgJson.containsKey("data")){
|
||||
firstArray = msgJson.getJSONArray("data");
|
||||
}
|
||||
|
||||
if(msgJson.containsKey("scrollId")){
|
||||
scrollId = msgJson.getString("scrollId");
|
||||
}
|
||||
}
|
||||
|
||||
if(total <= capacity){
|
||||
positionArray = firstArray;
|
||||
}else{
|
||||
if(firstArray.size() > 0){
|
||||
positionArray.addAll(firstArray);
|
||||
}
|
||||
int pageCount = (int)Math.floor(total / capacity*1.0);
|
||||
int count = 0;
|
||||
while(StringUtils.isNotBlank(scrollId) && !"null".equals(scrollId)){
|
||||
String positionData = esb2BeiSenPositionUtil.queryPositionByscrollId(startDate, endDate,scrollId,capacity);
|
||||
if(StringUtils.isNotBlank(positionData)){
|
||||
JSONObject msgJson = JSONObject.parseObject(positionData);
|
||||
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONArray itemArray = msgJson.getJSONArray("data");
|
||||
if(itemArray.size() > 0){
|
||||
positionArray.add(itemArray);
|
||||
}
|
||||
}
|
||||
if(msgJson.containsKey("scrollId")){
|
||||
scrollId = msgJson.getString("scrollId");
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
count++;
|
||||
if(count > (pageCount+5)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("positionArray:{}",positionArray.size());
|
||||
|
||||
if(positionArray.size() > 0){
|
||||
updateHrmPosition(positionArray);
|
||||
doSavePositionData(positionArray);
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
actionMap.put("total",ebList.size());
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
public JSONArray convertPositionList(JSONArray positionArray){
|
||||
JSONArray dataArray = new JSONArray();
|
||||
for(int i=0;i<positionArray.size();i++) {
|
||||
JSONObject positionJson = positionArray.getJSONObject(i);
|
||||
String name = positionJson.getString("name");
|
||||
String code = positionJson.getString("code");
|
||||
String objectId = positionJson.getString("objectId");
|
||||
|
||||
if(StringUtils.isNotBlank(code) && StringUtils.isNotBlank(objectId)){
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("bs_gwid",objectId);
|
||||
dataJson.put("bs_gwmc",name);
|
||||
dataJson.put("bs_gwbm",code);
|
||||
dataArray.add(dataJson);
|
||||
}
|
||||
}
|
||||
return dataArray;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 保存职位数据
|
||||
* @param positionArray
|
||||
* @return
|
||||
*/
|
||||
public List<String> doSavePositionData(JSONArray positionArray){
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("bs_gwid");
|
||||
fieldList.add("bs_gwmc");
|
||||
fieldList.add("bs_gwbm");
|
||||
|
||||
if(positionArray.size() > 0){
|
||||
JSONArray dataArray = convertPositionList(positionArray);
|
||||
log.error("dataArray:"+dataArray.size());
|
||||
Map<String, Object> fieldMap = hrmFormFieldDao.queryFromTableField(Constants.beisenPostionTable,fieldList);
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
List<EBDataReqDto> updateDatas = new ArrayList<EBDataReqDto>();
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("bs_gwid") && StringUtils.isNotBlank(dataJson.getString("bs_gwid"))){
|
||||
String bs_gwid = dataJson.getString("bs_gwid");
|
||||
String bs_gwmc = dataJson.getString("bs_gwmc");
|
||||
String bs_gwbm = dataJson.getString("bs_gwbm");
|
||||
String ufId = hrmBeisenPositionDao.getPositionIdByGwId(bs_gwid);
|
||||
log.error("ufId:{}",ufId);
|
||||
|
||||
if(StringUtils.isNotBlank(ufId)){
|
||||
log.error("修改");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
mainData.add(new EBDataReqDetailDto("id", ufId));
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
updateDatas.add(ebDataReqDto);
|
||||
}else{
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
}else{
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
log.error("updateDatas:{}",updateDatas.size());
|
||||
|
||||
Map<String,Object> recordMap = hrmFormFieldDao.queryTableFormId(Constants.beisenPostionTable);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
|
||||
if(updateDatas.size() > 0){
|
||||
|
||||
EBDataChangeResult updateEbDataChangeResult = ebuilderOperateUtils.bacthEditEbForm(updateDatas,formId,appId);
|
||||
boolean isTrue = updateEbDataChangeResult.getStatus();
|
||||
log.error("isTrue2:{}",isTrue);
|
||||
log.error("message2:{}",updateEbDataChangeResult.getMessage());
|
||||
if(isTrue){
|
||||
ebList.addAll(updateEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ebList;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> updateHrmPosition(JSONArray positionArray){
|
||||
Map<String,String> resultMap = new HashMap<String,String>();
|
||||
int failCount = 0;
|
||||
int successCount = 0;
|
||||
int total = positionArray.size() ;
|
||||
if(positionArray.size() > 0){
|
||||
for(int i=0;i<positionArray.size();i++){
|
||||
JSONObject dataJson = positionArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("objectId") && StringUtils.isNotBlank(dataJson.getString("objectId"))){
|
||||
String objectId = dataJson.getString("objectId");
|
||||
String code = dataJson.getString("code");
|
||||
String oIdOrganization = dataJson.getString("oIdOrganization");
|
||||
Map<String, Object> result = hrmBeisenPositionDao.updateHrmPositionByBensen(code,objectId,oIdOrganization);
|
||||
if (result.containsKey("code")) {
|
||||
code = String.valueOf(result.get("code"));
|
||||
log.error("code:" + code);
|
||||
if ("200".equals(code)) {
|
||||
successCount++;
|
||||
}else{
|
||||
failCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("failCount",String.valueOf(failCount));
|
||||
resultMap.put("successCount",String.valueOf(successCount));
|
||||
resultMap.put("total",String.valueOf(total));
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public interface ConvertOrganizationService {
|
||||
Map<String,Object> convStaffCode(JSONObject params);
|
||||
|
||||
Map<String,Object> convtDepartmentCode(JSONObject params);
|
||||
|
||||
Map<String,Object> convtPositionCode(JSONObject params);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.ConvertOrganizationDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.service.ConvertOrganizationService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* author:shil
|
||||
*/
|
||||
@Service
|
||||
public class ConvertOrganizationServiceImpl implements ConvertOrganizationService {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(ConvertOrganizationServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ConvertOrganizationDao convertOrganizationDao;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> convStaffCode(JSONObject params) {
|
||||
String staffcode = String.valueOf(params.getString("staffcode"));
|
||||
log.error("staffcode:{}",staffcode);
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
String staffid = convertOrganizationDao.queryEmployeeByCode(staffcode);
|
||||
dataMap.put("staffid",staffid);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> convtDepartmentCode(JSONObject params) {
|
||||
String departmentcode = String.valueOf(params.getString("departmentcode"));
|
||||
log.error("departmentcode:{}",departmentcode);
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
String departmentid = convertOrganizationDao.queryDepartmentByCode(departmentcode);
|
||||
dataMap.put("departmentid",departmentid);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> convtPositionCode(JSONObject params) {
|
||||
String positioncode = String.valueOf(params.getString("positioncode"));
|
||||
log.error("positioncode:{}",positioncode);
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
String positionid = convertOrganizationDao.queryPositionByCode(positioncode);
|
||||
dataMap.put("positionid",positionid);
|
||||
return dataMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@Component
|
||||
public class BeisenQueryDeptIdUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(BeisenQueryDeptIdUtil.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
public String queryBeisenDeptIdByCode(String code){
|
||||
String deptid = "";
|
||||
if(StringUtils.isNotEmpty(code)) {
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
deptid = queryDeptIdByCode(token, code);
|
||||
}
|
||||
}
|
||||
return deptid;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param token
|
||||
* @param deptcode
|
||||
* @return
|
||||
*/
|
||||
private String queryDeptIdByCode(String token,String deptcode){
|
||||
String deptid = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType, "{\"codes\":[\""+deptcode+"\"]}");
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.queryDeptIdByCodeUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
if(code == 200) {
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("data")){
|
||||
JSONArray dataArray = bodyJson.getJSONArray("data");
|
||||
if(dataArray.size() > 0){
|
||||
JSONObject itemJson = dataArray.getJSONObject(0);
|
||||
if(itemJson.containsKey("oId")){
|
||||
deptid = itemJson.getString("oId");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
log.error("deptid:{}",deptid);
|
||||
return deptid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@Component
|
||||
public class BeisenQueryUseridUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(BeisenQueryUseridUtil.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
public String queryBeisenUserIdByEmail(String email){
|
||||
String userid = "";
|
||||
if(StringUtils.isNotEmpty(email)) {
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
userid = queryUserIdByEmail(token, email);
|
||||
}
|
||||
}
|
||||
return userid;
|
||||
}
|
||||
|
||||
|
||||
public String queryBeisenUserIdByJobNum(String jobNum){
|
||||
String userid = "";
|
||||
if(StringUtils.isNotEmpty(jobNum)) {
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
userid = queryUserIdByJobNum(token, jobNum);
|
||||
}
|
||||
}
|
||||
return userid;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param token
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
private String queryUserIdByEmail(String token,String email){
|
||||
String userid = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("email",email);
|
||||
RequestBody body = RequestBody.create(mediaType, dataJson.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.queryUserIdByEmailUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
if(code == 200) {
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("data")){
|
||||
userid = bodyJson.getString("data");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
log.error("userid:{}",userid);
|
||||
return userid;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param token
|
||||
* @param jobNum
|
||||
* @return
|
||||
*/
|
||||
private String queryUserIdByJobNum(String token,String jobNum){
|
||||
String userid = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, "{\n \"jobNumbers\":[\""+jobNum+"\"]\n}");
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.queryUserIdByCodeUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
log.error("code:{}",code);
|
||||
String msg = response.body().string();
|
||||
if(code == 200) {
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("data")){
|
||||
JSONArray dataArray = bodyJson.getJSONArray("data");
|
||||
if(dataArray.size() > 0){
|
||||
JSONObject itemJson = dataArray.getJSONObject(0);
|
||||
if(itemJson.containsKey("userId")){
|
||||
userid = itemJson.getString("userId");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
log.error("userid:{}",userid);
|
||||
return userid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmAssessment360Dao;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Component
|
||||
public class Esb2BeiSenAssessment360Util {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeiSenAssessment360Util.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
@Autowired
|
||||
HrmAssessment360Dao hrmAssessment360Dao;
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public JSONArray queryAssessment360Data(){
|
||||
JSONArray assessmentArray = new JSONArray();
|
||||
|
||||
List<Map<String, Object>> emailList = hrmAssessment360Dao.queryEmployeeEmail();
|
||||
for(int i=0;i<emailList.size();i++){
|
||||
Map<String, Object> emailMap = emailList.get(i);
|
||||
String email = emailMap.get("email").toString();
|
||||
if(StringUtils.isNotBlank(email)){
|
||||
JSONArray dataArray = convertAssessmentData(email);
|
||||
assessmentArray.addAll(dataArray);
|
||||
}
|
||||
}
|
||||
return assessmentArray;
|
||||
}
|
||||
|
||||
|
||||
public JSONArray convertAssessmentData(String email){
|
||||
JSONArray assessmentArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(email)){
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("email",email);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
String msg = doHttpPost(token,bodyJson.toJSONString());
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONObject dataJson = msgJson.getJSONObject("data");
|
||||
|
||||
String personnelStaffCode = "";
|
||||
String personnelMail = "";
|
||||
String personnelName = "";
|
||||
if(dataJson.containsKey("personInfo")){
|
||||
JSONObject personInfoJson = dataJson.getJSONObject("personInfo");
|
||||
if(personInfoJson.containsKey("personnelName")){
|
||||
personnelName = personInfoJson.getString("personnelName");
|
||||
}
|
||||
if(personInfoJson.containsKey("personnelMail")){
|
||||
personnelMail = personInfoJson.getString("personnelMail");
|
||||
}
|
||||
if(personInfoJson.containsKey("personnelStaffCode")){
|
||||
personnelStaffCode = personInfoJson.getString("personnelStaffCode");
|
||||
}
|
||||
}
|
||||
|
||||
log.error("personnelStaffCode:{}",personnelStaffCode);
|
||||
log.error("personnelMail:{}",personnelMail);
|
||||
|
||||
if(dataJson.containsKey("activityList")){
|
||||
JSONArray activityListArray = dataJson.getJSONArray("activityList");
|
||||
for (int i = 0; i < activityListArray.size(); i++) {
|
||||
JSONObject activityJson = activityListArray.getJSONObject(i);
|
||||
String activityID = "";
|
||||
if(activityJson.containsKey("activityID")){
|
||||
activityID = activityJson.getString("activityID");
|
||||
}
|
||||
String activityName = "";
|
||||
if(activityJson.containsKey("activityName")){
|
||||
activityName = activityJson.getString("activityName");
|
||||
}
|
||||
String createTime = "";
|
||||
if(activityJson.containsKey("createTime")){
|
||||
createTime = activityJson.getString("createTime");
|
||||
}
|
||||
JSONArray questionnaireInfoList = new JSONArray();
|
||||
if(activityJson.containsKey("questionnaireInfoList")){
|
||||
questionnaireInfoList = activityJson.getJSONArray("questionnaireInfoList");
|
||||
}
|
||||
|
||||
log.error("activityID:{}",personnelMail);
|
||||
log.error("createTime:{}",createTime);
|
||||
log.error("questionnaireInfoList:{}",questionnaireInfoList.size());
|
||||
|
||||
for(int n=0;n<questionnaireInfoList.size();n++){
|
||||
JSONObject questionnaireInfoJson = questionnaireInfoList.getJSONObject(n);
|
||||
String questionnaireID = questionnaireInfoJson.getString("questionnaireID");
|
||||
String questionnaireName = questionnaireInfoJson.getString("questionnaireName");
|
||||
String otherAvg = questionnaireInfoJson.getString("otherAvg");
|
||||
String lastUpdateTime = questionnaireInfoJson.getString("lastUpdateTime");
|
||||
log.error("questionnaireID:{}",questionnaireID);
|
||||
log.error("otherAvg:{}",otherAvg);
|
||||
log.error("lastUpdateTime:{}",lastUpdateTime);
|
||||
|
||||
JSONObject assessJson = new JSONObject();
|
||||
assessJson.put("gsyx",personnelMail);
|
||||
assessJson.put("gh",personnelStaffCode);
|
||||
assessJson.put("hdid",activityID);
|
||||
assessJson.put("hdmc",activityName);
|
||||
assessJson.put("wjid",questionnaireID);
|
||||
assessJson.put("wjmc",questionnaireName);
|
||||
assessJson.put("zzjg",otherAvg);
|
||||
assessJson.put("cjsj",createTime.replace("T"," "));
|
||||
assessJson.put("wcsj",lastUpdateTime.replace("T"," "));
|
||||
assessmentArray.add(assessJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return assessmentArray;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
*/
|
||||
public String doHttpPost(String token,String bodyJson){
|
||||
String bodyData = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson);
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost + Constants.query360AssessmentUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
if(code == 200){
|
||||
bodyData = msg;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return bodyData;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@Component
|
||||
public class Esb2BeiSenPositionUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeiSenPositionUtil.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
/***
|
||||
*
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public String queryPositionByDate(String startDate, String endDate,int capacity){
|
||||
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
String bodyData = "";
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("startTime",startDate);
|
||||
bodyJson.put("stopTime",endDate);
|
||||
bodyJson.put("timeWindowQueryType","1");
|
||||
bodyJson.put("capacity",capacity);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+ Constants.positionUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
if(code == 200){
|
||||
bodyData = msg;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
}
|
||||
|
||||
return bodyData;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
*/
|
||||
public String queryPositionByscrollId(String startDate, String endDate,String scrollId,int capacity){
|
||||
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
String bodyData = "";
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("startTime",startDate);
|
||||
bodyJson.put("stopTime",endDate);
|
||||
bodyJson.put("timeWindowQueryType","1");
|
||||
bodyJson.put("scrollId",scrollId);
|
||||
bodyJson.put("capacity",capacity);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost + Constants.positionUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
if(code == 200){
|
||||
bodyData = msg;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return bodyData;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Base64;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/***
|
||||
* 获取考核数据
|
||||
*/
|
||||
@Component
|
||||
public class Esb2BeisenAssessUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenAssessUtil.class);
|
||||
|
||||
/***
|
||||
*
|
||||
* @param emails
|
||||
* @param beisen_account
|
||||
* @param format
|
||||
* @param consumer_key
|
||||
* @param oauth_token
|
||||
* @param oauth_signature_method
|
||||
* @param oauth_timestamp
|
||||
* @param oauth_nonce
|
||||
* @param oauth_version
|
||||
* @param oauth_signature
|
||||
*/
|
||||
public String doHttpGet(String emails,String beisen_account,String format,String consumer_key,String oauth_token,String oauth_signature_method,String oauth_timestamp,String oauth_nonce,String oauth_version,String oauth_signature){
|
||||
String msg = "";
|
||||
String applyUrl = Constants.beishenAssessHost+Constants.queryAssessUrl+"?beisen_account="+beisen_account+"&emails="+emails+"&format="+format+"&oauth_consumer_key="+consumer_key+"&oauth_token="+oauth_token+"&oauth_signature_method="+oauth_signature_method+"&oauth_timestamp="+oauth_timestamp+"&oauth_nonce="+oauth_nonce+"&oauth_version="+oauth_version+"&oauth_signature="+oauth_signature;
|
||||
log.error("applyUrl:{}",applyUrl);
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("text/plain");
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(applyUrl)
|
||||
.method("GET", null)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
/***
|
||||
* 查询考核数据
|
||||
* @param emails
|
||||
*/
|
||||
public void queryAssessData(String emails){
|
||||
String applyUrl = Constants.beishenAssessHost+Constants.queryAssessUrl;
|
||||
String beisen_account = Constants.beisenAccount;
|
||||
String oauth_consumer_key = Constants.consumerKey;
|
||||
String oauth_token = Constants.accessToken;
|
||||
String oauth_version = Constants.oauthVersion;
|
||||
String oauth_nonce = randomString(11);
|
||||
String oauth_signature_method = Constants.oauthSignatureMethod;
|
||||
String format = Constants.format;
|
||||
String oauth_consumer_secret = Constants.consumerSecret;
|
||||
String oauth_token_secret = Constants.tokenSecret;
|
||||
|
||||
String oauth_signature = "";
|
||||
|
||||
long oauth_timestamp = System.currentTimeMillis()/1000;
|
||||
log.error("oauth_consumer_key:{}",oauth_consumer_key);
|
||||
log.error("oauth_nonce:{}",oauth_nonce);
|
||||
log.error("oauth_timestamp:{}",oauth_timestamp);
|
||||
log.error("oauth_token:{}",oauth_token);
|
||||
log.error("oauth_version:{}",oauth_version);
|
||||
|
||||
String key = oauth_consumer_secret+"&"+oauth_token_secret ;
|
||||
log.error("key:{}",key);
|
||||
try {
|
||||
String paramData = "beisen_account="+URLEncoder.encode(beisen_account, "UTF-8")+"&emails="+URLEncoder.encode(emails, "UTF-8")+"&format="+URLEncoder.encode(format, "UTF-8")+"&oauth_consumer_key="+URLEncoder.encode(oauth_consumer_key, "UTF-8")+"&oauth_nonce="+URLEncoder.encode(oauth_nonce, "UTF-8")+"&oauth_signature_method="+URLEncoder.encode(oauth_signature_method, "UTF-8")+"&oauth_timestamp="+URLEncoder.encode(oauth_timestamp+"", "UTF-8")+"&oauth_token="+URLEncoder.encode(oauth_token, "UTF-8")+"&oauth_version="+URLEncoder.encode(oauth_version, "UTF-8");
|
||||
log.error("paramData:{}",paramData);
|
||||
String encodeParamData = URLEncoder.encode(paramData, "UTF-8");
|
||||
log.error("encodeParamData:{}",encodeParamData);
|
||||
String concatData = "POST&"+URLEncoder.encode(applyUrl, "UTF-8")+"&"+encodeParamData;
|
||||
oauth_signature = calculateHmacSha1(key, concatData);
|
||||
log.error("oauth_signature:{}",oauth_signature);
|
||||
oauth_signature = URLEncoder.encode(oauth_signature, "UTF-8");
|
||||
log.error("oauth_signature2:{}",oauth_signature);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(oauth_signature)){
|
||||
String msg = doHttpGet(emails,beisen_account,format,oauth_consumer_key,oauth_token,oauth_signature_method,oauth_timestamp+"",oauth_nonce,oauth_version,oauth_signature);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* 计算HmacSHA1
|
||||
* @param key
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
public String calculateHmacSha1(String key, String message) {
|
||||
String data = "";
|
||||
try {
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "HmacSHA1");
|
||||
mac.init(secretKeySpec);
|
||||
byte[] digest = mac.doFinal(message.getBytes());
|
||||
data = Base64.getEncoder().encodeToString(digest);
|
||||
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
log.error("e:{}",e.getMessage());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String randomString(int length){
|
||||
String data = UUID.randomUUID().toString();
|
||||
// 定义可能的字符
|
||||
String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
StringBuilder sb = new StringBuilder(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
int index = ThreadLocalRandom.current().nextInt(characters.length());
|
||||
sb.append(characters.charAt(index));
|
||||
}
|
||||
data = sb.toString();
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
public class Esb2BeisenUnRelateRequestUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenUnRelateRequestUtil.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
public String unRelateJobRequirement(String requirementId){
|
||||
|
||||
String dataCode = "";
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
int operationType = 1;
|
||||
bodyJson.put("operationType",operationType);
|
||||
bodyJson.put("id",requirementId);
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.unRelateRequirementUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String bodyData = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("bodyData:{}",bodyData);
|
||||
if(code == 200){
|
||||
if(StringUtils.isNotBlank(bodyData)){
|
||||
JSONObject dataJson = JSONObject.parseObject(bodyData);
|
||||
if(dataJson.containsKey("code")){
|
||||
dataCode = dataJson.getString("code");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.error("bodyData:"+bodyData);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return dataCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.weaver.seconddev.chapanda.beisen.util;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.OkHttpDto;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -18,163 +19,212 @@ public class JobRequirement2BeisenUtil {
|
|||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
public String sendJobRequirement(String token,
|
||||
int requirementStatus,
|
||||
int requirementType,
|
||||
String requestname,
|
||||
int beisenCreateBy,
|
||||
String createDate,
|
||||
int requirementCount,
|
||||
String arivalTime,
|
||||
String createByEmail,
|
||||
String dutyUserEmail,
|
||||
int beisenDepartmentId,
|
||||
int salaryType,
|
||||
int category,
|
||||
String educationInfo,
|
||||
String workExperience,
|
||||
int kind,
|
||||
boolean isSecrecy,
|
||||
String originalCode
|
||||
public OkHttpDto sendJobRequirement(int requirementStatus,
|
||||
int requirementType,
|
||||
String requestname,
|
||||
int beisenCreateBy,
|
||||
String createDate,
|
||||
int requirementCount,
|
||||
String arivalTime,
|
||||
String createByEmail,
|
||||
String dutyUserEmail,
|
||||
int beisenDepartmentId,
|
||||
int salaryType,
|
||||
int category,
|
||||
String educationInfo,
|
||||
String workExperience,
|
||||
int kind,
|
||||
boolean isSecrecy,
|
||||
String originalCode,
|
||||
String nlyq,
|
||||
String zpgw,
|
||||
String zwmc,
|
||||
int beisenDutyUserId,
|
||||
String xqmc,
|
||||
String gzzz,
|
||||
String rzzg,
|
||||
String zxssyf,
|
||||
String jjcd, int gzdd,String xb_value
|
||||
){
|
||||
String data = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
/***
|
||||
* 需求状态
|
||||
* 10 草稿
|
||||
* 20 审批中
|
||||
* 30 审批未通过
|
||||
* 40 进行中
|
||||
* 50 已关闭
|
||||
* 60 已完成
|
||||
* 70 已暂停
|
||||
* 80 审批已终止
|
||||
*
|
||||
*/
|
||||
if(requirementStatus > -1){
|
||||
bodyJson.put("requirementStatus",requirementStatus);
|
||||
}
|
||||
OkHttpDto okHttpDto = new OkHttpDto();
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
||||
/***
|
||||
* 需求类型
|
||||
* 1 新增
|
||||
* 2 顶替
|
||||
* 3 储备
|
||||
*/
|
||||
if(requirementType > -1){
|
||||
bodyJson.put("requirementType",requirementType);
|
||||
}
|
||||
|
||||
|
||||
bodyJson.put("name",requestname);
|
||||
|
||||
if(beisenCreateBy > -1){
|
||||
bodyJson.put("createBy",beisenCreateBy);
|
||||
}
|
||||
|
||||
if(!createDate.contains("T")){
|
||||
createDate = createDate+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("createDate",createDate);
|
||||
|
||||
if(!arivalTime.contains("T")){
|
||||
arivalTime = arivalTime+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("arivalTime",arivalTime);
|
||||
|
||||
bodyJson.put("dutyUserEmail",dutyUserEmail);
|
||||
bodyJson.put("createByEmail",createByEmail);
|
||||
|
||||
if(beisenDepartmentId > -1){
|
||||
bodyJson.put("departmentId",beisenDepartmentId);
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
bodyJson.put("orgCode",originalCode);
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
/***
|
||||
* 需求状态
|
||||
* 10 草稿
|
||||
* 20 审批中
|
||||
* 30 审批未通过
|
||||
* 40 进行中
|
||||
* 50 已关闭
|
||||
* 60 已完成
|
||||
* 70 已暂停
|
||||
* 80 审批已终止
|
||||
*
|
||||
*/
|
||||
if(requirementStatus > -1){
|
||||
bodyJson.put("requirementStatus",requirementStatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 需求人数
|
||||
*/
|
||||
if(requirementCount > -1){
|
||||
bodyJson.put("requirementCount",requirementCount);
|
||||
}
|
||||
/***
|
||||
* 需求类型
|
||||
* 1 新增
|
||||
* 2 顶替
|
||||
* 3 储备
|
||||
*/
|
||||
if(requirementType > -1){
|
||||
bodyJson.put("requirementType",requirementType);
|
||||
}
|
||||
|
||||
|
||||
bodyJson.put("name",xqmc);
|
||||
log.error("beisenCreateBy:{}",beisenCreateBy);
|
||||
if(beisenCreateBy > -1){
|
||||
bodyJson.put("createBy",beisenCreateBy);
|
||||
}
|
||||
|
||||
if(!createDate.contains("T")){
|
||||
createDate = createDate+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("createDate",createDate);
|
||||
|
||||
if(!arivalTime.contains("T")){
|
||||
arivalTime = arivalTime+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("arivalTime",arivalTime);
|
||||
|
||||
bodyJson.put("dutyUserEmail",dutyUserEmail);
|
||||
bodyJson.put("createByEmail",createByEmail);
|
||||
|
||||
if(beisenDepartmentId > -1){
|
||||
bodyJson.put("departmentId",beisenDepartmentId);
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
bodyJson.put("orgCode",originalCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 需求人数
|
||||
*/
|
||||
if(requirementCount > -1){
|
||||
bodyJson.put("requirementCount",requirementCount);
|
||||
}
|
||||
|
||||
// if(salaryType >-1){
|
||||
// bodyJson.put("salaryType",salaryType);
|
||||
// }
|
||||
|
||||
// bodyJson.put("PositionIdCoreHR","d948d6ce-70cc-4265-975c-fea732759676");
|
||||
|
||||
/***
|
||||
* 招聘类别
|
||||
* 1 社会招聘
|
||||
* 2 校园招聘
|
||||
* 3 实习生招聘
|
||||
*/
|
||||
/***
|
||||
* 招聘类别
|
||||
* 1 社会招聘
|
||||
* 2 校园招聘
|
||||
* 3 实习生招聘
|
||||
*/
|
||||
|
||||
if(category > -1){
|
||||
bodyJson.put("category",category);
|
||||
if(category > -1){
|
||||
bodyJson.put("category",category);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 学历要求
|
||||
* 9 小学
|
||||
* 8 初中
|
||||
* 3 高中
|
||||
* 4 中技(中专/技校/职高)
|
||||
* 5 大专
|
||||
* 1 本科
|
||||
* 2 硕士研究生
|
||||
* 6 MBA
|
||||
* 7 博士研究生
|
||||
* 10 大专及以上
|
||||
* 11 本科及以上
|
||||
* 12 不限
|
||||
*/
|
||||
bodyJson.put("educationInfo",educationInfo);
|
||||
/***
|
||||
* 工作经验
|
||||
* 在读学生
|
||||
* 应届毕业生
|
||||
* 99 在读学生
|
||||
* 98 应届毕业生
|
||||
* 1 1年
|
||||
* 2 2年
|
||||
* 3 3年
|
||||
* 4 4年
|
||||
* 5 5年
|
||||
* 6 6年
|
||||
* 7 7年
|
||||
* 8 8年
|
||||
* 9 9年
|
||||
* 10 10年及以上
|
||||
*/
|
||||
bodyJson.put("workExperience",workExperience);
|
||||
|
||||
/***
|
||||
* 工作性质
|
||||
* 1 全职
|
||||
* 2 兼职
|
||||
* 3 实习
|
||||
* 4 其他
|
||||
*/
|
||||
|
||||
if(kind > -1){
|
||||
bodyJson.put("kind",kind);
|
||||
}
|
||||
|
||||
JSONObject customProperties = new JSONObject();
|
||||
if(StringUtils.isNotBlank(nlyq)){
|
||||
customProperties.put(Constants.nyyqzdm,nlyq);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(zwmc)){
|
||||
customProperties.put(Constants.zwzd,zwmc);
|
||||
}
|
||||
if(StringUtils.isNotBlank(zxssyf)){
|
||||
customProperties.put(Constants.zpssyfzd,zxssyf);
|
||||
}
|
||||
if(StringUtils.isNotBlank(jjcd)){
|
||||
customProperties.put(Constants.jjcdzdm,jjcd);
|
||||
}
|
||||
if(StringUtils.isNotBlank(xb_value)){
|
||||
customProperties.put(Constants.xbzdm,xb_value);
|
||||
}
|
||||
bodyJson.put("customProperties",customProperties);
|
||||
|
||||
log.error("beisenDutyUserId:{}",beisenDutyUserId);
|
||||
if(beisenDutyUserId>-1){
|
||||
bodyJson.put("dutyUser",beisenDutyUserId);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(gzzz)){
|
||||
bodyJson.put("jobDescription",gzzz);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(rzzg)){
|
||||
bodyJson.put("qualification",rzzg);
|
||||
}
|
||||
|
||||
bodyJson.put("placeCoreHR",gzdd);
|
||||
bodyJson.put("isSecrecy",isSecrecy);
|
||||
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
okHttpDto = doHttpPostCreate(token,bodyJson.toJSONString());
|
||||
}
|
||||
return okHttpDto;
|
||||
}
|
||||
|
||||
public OkHttpDto doHttpPostCreate(String token,String bodyJson){
|
||||
|
||||
/***
|
||||
* 学历要求
|
||||
* 9 小学
|
||||
* 8 初中
|
||||
* 3 高中
|
||||
* 4 中技(中专/技校/职高)
|
||||
* 5 大专
|
||||
* 1 本科
|
||||
* 2 硕士研究生
|
||||
* 6 MBA
|
||||
* 7 博士研究生
|
||||
* 10 大专及以上
|
||||
* 11 本科及以上
|
||||
* 12 不限
|
||||
*/
|
||||
bodyJson.put("educationInfo",educationInfo);
|
||||
/***
|
||||
* 工作经验
|
||||
* 在读学生
|
||||
* 应届毕业生
|
||||
* 99 在读学生
|
||||
* 98 应届毕业生
|
||||
* 1 1年
|
||||
* 2 2年
|
||||
* 3 3年
|
||||
* 4 4年
|
||||
* 5 5年
|
||||
* 6 6年
|
||||
* 7 7年
|
||||
* 8 8年
|
||||
* 9 9年
|
||||
* 10 10年及以上
|
||||
*/
|
||||
bodyJson.put("workExperience",workExperience);
|
||||
|
||||
/***
|
||||
* 工作性质
|
||||
* 1 全职
|
||||
* 2 兼职
|
||||
* 3 实习
|
||||
* 4 其他
|
||||
*/
|
||||
|
||||
if(kind > -1){
|
||||
bodyJson.put("kind",kind);
|
||||
}
|
||||
|
||||
bodyJson.put("isSecrecy",isSecrecy);
|
||||
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson.toJSONString());
|
||||
|
||||
// RequestBody body = RequestBody.create(mediaType, "{\n \"requirementStatus\":50,\n \"requirementType\":3,\n \"name\":\"测试招聘需求接口\",\n \"departmentId\":2335561,\n \"createBy\":402189433,\n \"createDate\":\"2025-07-01T10:05:45\",\n \"arivalTime\":\"2025-08-01T10:00:00\",\n \"dutyUserEmail\":\"yemintest@chabaidao.com\",\n \"createByEmail\":\"yemintest@chabaidao.com\"\n}");
|
||||
|
||||
OkHttpDto okHttpDto = new OkHttpDto();
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson);
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.jobRequirementUrl)
|
||||
|
|
@ -188,23 +238,224 @@ public class JobRequirement2BeisenUtil {
|
|||
String bodyData = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("bodyData:{}",bodyData);
|
||||
|
||||
okHttpDto.setResponseCode(code);
|
||||
okHttpDto.setResponseBody(bodyData);
|
||||
String dataCode = "0";
|
||||
String data = "";
|
||||
String message = "";
|
||||
if(code == 200){
|
||||
if(StringUtils.isNotBlank(bodyData)){
|
||||
JSONObject dataJson = JSONObject.parseObject(bodyData);
|
||||
if(dataJson.containsKey("code")){
|
||||
String dataCode = dataJson.getString("code");
|
||||
dataCode = dataJson.getString("code");
|
||||
if("200".equals(dataCode)){
|
||||
data = dataJson.getString("data");
|
||||
}else{
|
||||
message = dataJson.getString("message");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.error("bodyData:"+bodyData);
|
||||
|
||||
if(StringUtils.isNotBlank(bodyData)){
|
||||
JSONObject dataJson = JSONObject.parseObject(bodyData);
|
||||
if(dataJson.containsKey("message")){
|
||||
message = dataJson.getString("message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.error("message:{}",message);
|
||||
log.error("data:{}",data);
|
||||
log.error("dataCode:{}",Integer.valueOf(dataCode));
|
||||
|
||||
okHttpDto.setDataCode(Integer.valueOf(dataCode));
|
||||
okHttpDto.setDataMsg(message);
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("dataid",data);
|
||||
okHttpDto.setDataJson(dataJson);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
return data;
|
||||
return okHttpDto;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
int code = 200;
|
||||
String data = "";
|
||||
String message = "";
|
||||
String bodyData = "{\"data\":\"00000000-0000-0000-0000-000000000000\",\"code\":400,\"message\":\"requirementType参数必填\\\\r\\\\n未找到Email为 liugangju@chabaidao.com 的员工\"}";
|
||||
if(code == 200){
|
||||
if(StringUtils.isNotBlank(bodyData)){
|
||||
JSONObject dataJson = JSONObject.parseObject(bodyData);
|
||||
if(dataJson.containsKey("code")){
|
||||
int dataCode = dataJson.getInteger("code");
|
||||
if("200".equals(dataCode)){
|
||||
data = dataJson.getString("data");
|
||||
}else{
|
||||
message = dataJson.getString("message");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
if(StringUtils.isNotBlank(bodyData)){
|
||||
JSONObject dataJson = JSONObject.parseObject(bodyData);
|
||||
if(dataJson.containsKey("message")){
|
||||
message = dataJson.getString("message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(message);
|
||||
System.out.println(data);
|
||||
}
|
||||
|
||||
|
||||
public OkHttpDto updateJobRequirement(int requirementStatus,
|
||||
int requirementType,
|
||||
String createDate,
|
||||
String arivalTime,
|
||||
String finishTime,
|
||||
String xqmc,
|
||||
int beisenCreateBy,
|
||||
String createByEmail,
|
||||
String dutyUserEmail,
|
||||
int beisenDepartmentId,
|
||||
String originalCode,
|
||||
int beisenDutyUserId
|
||||
){
|
||||
OkHttpDto okHttpDto = new OkHttpDto();
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
/***
|
||||
* 需求状态
|
||||
* 10 草稿
|
||||
* 20 审批中
|
||||
* 30 审批未通过
|
||||
* 40 进行中
|
||||
* 50 已关闭
|
||||
* 60 已完成
|
||||
* 70 已暂停
|
||||
* 80 审批已终止
|
||||
*
|
||||
*/
|
||||
if(requirementStatus > -1){
|
||||
bodyJson.put("requirementStatus",requirementStatus);
|
||||
}
|
||||
|
||||
/***
|
||||
* 需求类型
|
||||
* 1 新增
|
||||
* 2 顶替
|
||||
* 3 储备
|
||||
*/
|
||||
if(requirementType > -1){
|
||||
bodyJson.put("requirementType",requirementType);
|
||||
}
|
||||
|
||||
log.error("beisenCreateBy:{}",beisenCreateBy);
|
||||
if(beisenCreateBy > -1){
|
||||
bodyJson.put("createBy",beisenCreateBy);
|
||||
}
|
||||
|
||||
bodyJson.put("dutyUserEmail",dutyUserEmail);
|
||||
bodyJson.put("createByEmail",createByEmail);
|
||||
|
||||
bodyJson.put("name",xqmc);
|
||||
|
||||
if(beisenDepartmentId > -1){
|
||||
bodyJson.put("departmentId",beisenDepartmentId);
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
bodyJson.put("orgCode",originalCode);
|
||||
}
|
||||
}
|
||||
|
||||
if(beisenDutyUserId>-1){
|
||||
bodyJson.put("dutyUser",beisenDutyUserId);
|
||||
}
|
||||
|
||||
if(!createDate.contains("T")){
|
||||
createDate = createDate+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("createDate",createDate);
|
||||
|
||||
if(!arivalTime.contains("T")){
|
||||
arivalTime = arivalTime+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("arivalTime",arivalTime);
|
||||
if(!finishTime.contains("T")){
|
||||
finishTime = finishTime+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("finishTime",finishTime);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
okHttpDto = doHttpPostUpdate(token,bodyJson.toJSONString());
|
||||
}
|
||||
return okHttpDto;
|
||||
}
|
||||
|
||||
public OkHttpDto doHttpPostUpdate(String token,String bodyJson){
|
||||
|
||||
OkHttpDto okHttpDto = new OkHttpDto();
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson);
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.jobRequirementUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String bodyData = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("bodyData:{}",bodyData);
|
||||
|
||||
okHttpDto.setResponseCode(code);
|
||||
okHttpDto.setResponseBody(bodyData);
|
||||
String dataCode = "0";
|
||||
String message = "";
|
||||
if(code == 200){
|
||||
if(StringUtils.isNotBlank(bodyData)){
|
||||
JSONObject dataJson = JSONObject.parseObject(bodyData);
|
||||
if(dataJson.containsKey("code")){
|
||||
dataCode = dataJson.getString("code");
|
||||
if(!"200".equals(dataCode)){
|
||||
message = dataJson.getString("message");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
if(StringUtils.isNotBlank(bodyData)){
|
||||
JSONObject dataJson = JSONObject.parseObject(bodyData);
|
||||
if(dataJson.containsKey("message")){
|
||||
message = dataJson.getString("message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.error("message:{}",message);
|
||||
log.error("dataCode:{}",Integer.valueOf(dataCode));
|
||||
|
||||
okHttpDto.setDataCode(Integer.valueOf(dataCode));
|
||||
okHttpDto.setDataMsg(message);
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
return okHttpDto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class Request2CostControlController {
|
|||
if(StringUtils.isNotBlank(staffcode)){
|
||||
String workflowId = String.valueOf(params.get("workflowId"));
|
||||
if(StringUtils.isNotBlank(workflowId)){
|
||||
Long workflowid = Long.parseLong(workflowId);
|
||||
Long workflowid = Long.valueOf(workflowId);
|
||||
Long employeeId = convertStaffCodeService.convEmployeeIdByCode(staffcode);
|
||||
if(employeeId > 0){
|
||||
dataMap = request2CostControlService.queryRequestByWorkflowType(params,workflowid,page_no,pageSize,employeeId);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class RequestInfoController {
|
|||
if(StringUtils.isNotBlank(staffcode)){
|
||||
String workflowId = String.valueOf(params.get("workflowId"));
|
||||
if(StringUtils.isNotBlank(workflowId)){
|
||||
Long workflowid = Long.parseLong(workflowId);
|
||||
Long workflowid = Long.valueOf(workflowId);
|
||||
Long employeeId = convertStaffCodeService.convEmployeeIdByCode(staffcode);
|
||||
if(employeeId > 0){
|
||||
dataMap = request2CostControlService.queryRequestByWorkflowType(params,workflowid,page_no,pageSize,employeeId);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class ConvertStaffCodeDao {
|
|||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(!recordList.isEmpty()){
|
||||
employeeId = Long.parseLong(String.valueOf(recordList.get(0).get("id")));
|
||||
employeeId = Long.valueOf(String.valueOf(recordList.get(0).get("id")));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
|
|
|||
|
|
@ -63,18 +63,18 @@ public class Request2CostControlServiceImpl implements Request2CostControlServic
|
|||
|
||||
String requestName = String.valueOf(params.get("requestName"));
|
||||
String requestmark = String.valueOf(params.get("requestRemark"));
|
||||
String staffCode = String.valueOf(params.get("staffCode"));
|
||||
// String staffCode = String.valueOf(params.get("staffCode"));
|
||||
|
||||
log.error("requestName:{}",requestName);
|
||||
log.error("requestmark:{}",requestmark);
|
||||
log.error("staffCode:{}",staffCode);
|
||||
// log.error("staffCode:{}",staffCode);
|
||||
|
||||
conditionEntity.setCreater(employeeId);
|
||||
|
||||
if(StringUtils.isNotBlank(requestName)){
|
||||
if(!"null".equals(requestName) && StringUtils.isNotBlank(requestName)){
|
||||
conditionEntity.setRequestname(requestName);
|
||||
}
|
||||
if(StringUtils.isNotBlank(requestmark)){
|
||||
if(!"null".equals(requestmark) && StringUtils.isNotBlank(requestmark)){
|
||||
conditionEntity.setRequestmark(requestmark);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.weaver.seconddev.chapanda.dmp.constant;
|
|||
|
||||
public class Constants {
|
||||
public static String TENANT_KEY = "t024j0gfn0";
|
||||
public static String SysUserId = "1147262704872284161";
|
||||
public static String SysUserId = "1167276462243069953";
|
||||
|
||||
public static String dmpHost = "http://internaldataservice-uat.shuxinyc.com";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,83 @@ package com.weaver.seconddev.chapanda.esign.constant;
|
|||
public class Constants {
|
||||
public static String TENANT_KEY = "t024j0gfn0";
|
||||
|
||||
public static String SysUserId = "1147262704872284161";
|
||||
public static String SysUserId = "1167276462243069953";
|
||||
|
||||
public static Long LongSysUserId = 1167276462243069953L;
|
||||
|
||||
public static String secretKey = "7f067a08f5c675137e6e72aa298e2c07";
|
||||
public static String xTimevaleProjectId = "1001003";
|
||||
public static String eSignHost = "http://110.185.172.132:8086";
|
||||
public static String queryTemplateUrl = "/esignpro/rest/template/api/getTemplateInfo";
|
||||
|
||||
/**
|
||||
* 模板详情接口
|
||||
*/
|
||||
public static String getTemplateInfoUrl = "/esignpro/rest/template/api/getTemplateInfo";
|
||||
|
||||
/**
|
||||
* 查询印章接口
|
||||
*/
|
||||
public static String querySealsUrl = "/V1/seals/innerOrgansSeals/list";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static String sealTable = "uf_yzgl";
|
||||
|
||||
/***
|
||||
* 获取模板预览接口
|
||||
*/
|
||||
public static String previewUrl = "/V1/signDocs/getPreviewUrl";
|
||||
|
||||
/***
|
||||
* 生成模板文件接口
|
||||
*/
|
||||
public static String templateDocUrl = "/esignpro/rest/template/api/buildTemplateDoc";
|
||||
|
||||
/***
|
||||
* 查询模板接口
|
||||
*/
|
||||
public static String queryTemplateUrl = "/V1/template/list";
|
||||
|
||||
|
||||
public static String templateTable = "uf_dzqmbgl";
|
||||
|
||||
public static String templateTableZdb = "uf_dzqmbgl_zdb";
|
||||
|
||||
public static String qrDocSwitcher = "false";
|
||||
|
||||
public static String signFileFormat = "PDF";
|
||||
|
||||
public static String partyBaccountType = "2";
|
||||
|
||||
public static String autoSign = "false";
|
||||
|
||||
public static int edgePosition = 1;
|
||||
|
||||
public static int edgeScope = 0;
|
||||
|
||||
public static int sealType = 0;
|
||||
|
||||
public static String partyAaccountType = "1";
|
||||
|
||||
public static String externalpersonUrl = "/V1/accounts/outerAccounts/simpleCreate";
|
||||
|
||||
|
||||
public static String signFlowsUrl = "/V1/signFlows/create";
|
||||
|
||||
public static String fileDownloadUrl = "/V1/files/getDownloadUrl";
|
||||
public static String getSignFlowDocUrls = "/V1/signFlows/getSignFlowDocUrls";
|
||||
|
||||
|
||||
public static String getDownloadUrl = "/esignproweb/rest/file-system/operation/download";
|
||||
|
||||
public static Long htwjFolderId = 3875375598175452527L;
|
||||
|
||||
public static String reminderRequestUrl = "/esignpro/rest/process/reminder";
|
||||
|
||||
|
||||
public static String callbackUrl = "https://hrtest.chabaidao.com/papi/secondev/cbd/signflow/doCallBack";
|
||||
|
||||
public static Long callbacFolderId = 2415515046193663118L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
package com.weaver.seconddev.chapanda.esign.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.esign.util.CommonUtils;
|
||||
import com.weaver.seconddev.chapanda.esign.service.SealTemplateService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.RestController;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/cbd/eseal")
|
||||
public class SealTemplateController {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(SealTemplateController.class);
|
||||
|
||||
@Autowired
|
||||
SealTemplateService sealTemplateService;
|
||||
|
||||
@Autowired
|
||||
CommonUtils CommonUtils;
|
||||
|
||||
/***
|
||||
* 电子签名模板预览接口
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryPreviewUrl")
|
||||
public WeaResult<Object> queryPreviewUrl(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
Map<String, Object> dataMap = new HashMap<String,Object>();
|
||||
String templateId = request.getParameter("templateId");
|
||||
Map<String,Object> paraMap = CommonUtils.requestToMap(request);
|
||||
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
dataMap = sealTemplateService.queryPreviewUrl(templateId,paraMap);
|
||||
}else{
|
||||
return WeaResult.fail(500,"模板ID为空");
|
||||
}
|
||||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryTemplateField")
|
||||
public WeaResult<Object> queryTemplateField(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
|
||||
String templateId = request.getParameter("templateId");
|
||||
Map<String,Object> paraMap = CommonUtils.requestToMap(request);
|
||||
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
dataList = sealTemplateService.queryTemplateField(templateId,paraMap);
|
||||
}else{
|
||||
return WeaResult.fail(500,"模板ID为空");
|
||||
}
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试接口
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/test")
|
||||
public WeaResult<Object> test(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
Map<String, Object> recordMap = new HashMap<String,Object>();
|
||||
recordMap.put("test","test");
|
||||
return WeaResult.success(recordMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.weaver.seconddev.chapanda.esign.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.CallbackUrlBean;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.FinishDocUrlBean;
|
||||
import com.weaver.seconddev.chapanda.esign.service.SignFlowsCallBackService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/papi/secondev/cbd/signflow")
|
||||
public class SignFlowsCallBackController {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(SignFlowsCallBackController.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
SignFlowsCallBackService signFlowsCallBackService;
|
||||
|
||||
/***
|
||||
* 回调接口
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/doCallBack")
|
||||
public JSONObject doCallBack(@RequestBody CallbackUrlBean callbackUrlBean) throws IOException {
|
||||
|
||||
String action = callbackUrlBean.getAction();
|
||||
log.error("action:{}",action);
|
||||
String flowId = String.valueOf(callbackUrlBean.getFlowId());
|
||||
log.error("flowId:{}",flowId);
|
||||
String flowType = callbackUrlBean.getFlowType();
|
||||
log.error("flowType:{}",flowType);
|
||||
int status = callbackUrlBean.getStatus();
|
||||
log.error("status:{}",status);
|
||||
String createTime = callbackUrlBean.getCreateTime();
|
||||
log.error("createTime:{}",createTime);
|
||||
String endTime = callbackUrlBean.getEndTime();
|
||||
log.error("endTime:{}",endTime);
|
||||
|
||||
List<FinishDocUrlBean> finishDocUrlBeans = callbackUrlBean.getFinishDocUrlBeans();
|
||||
for (int i = 0; i < finishDocUrlBeans.size(); i++) {
|
||||
FinishDocUrlBean finishDocUrlBean = finishDocUrlBeans.get(i);
|
||||
String docFileKey = finishDocUrlBean.getDocFileKey();
|
||||
log.error("docFileKey:{}",docFileKey);
|
||||
String downloadDocUrl = finishDocUrlBean.getDownloadDocUrl();
|
||||
log.error("downloadDocUrl:{}",downloadDocUrl);
|
||||
String finishFileKey = finishDocUrlBean.getFinishFileKey();
|
||||
log.error("finishFileKey:{}",finishFileKey);
|
||||
}
|
||||
|
||||
if("SIGN_FLOW_FINISH".equals(action)){
|
||||
log.error("action22:{}",action);
|
||||
if("Common".equals(flowType)){
|
||||
log.error("flowType22:{}",flowType);
|
||||
if(status == 2){
|
||||
log.error("status22:{}",status);
|
||||
if(StringUtils.isNotEmpty(flowId)){
|
||||
log.error("flowId22:{}",flowId);
|
||||
if(finishDocUrlBeans.size()>0){
|
||||
FinishDocUrlBean finishDocUrlBean = finishDocUrlBeans.get(0);
|
||||
String docFileKey = finishDocUrlBean.getDocFileKey();
|
||||
String downloadDocUrl = finishDocUrlBean.getDownloadDocUrl();
|
||||
String finishFileKey = finishDocUrlBean.getFinishFileKey();
|
||||
log.error("downloadDocUrl:{}",downloadDocUrl);
|
||||
log.error("finishFileKey:{}",finishFileKey);
|
||||
if(StringUtils.isNotBlank(downloadDocUrl)){
|
||||
signFlowsCallBackService.creatDocFile(flowId,downloadDocUrl,finishFileKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("errCode","0");
|
||||
dataJson.put("msg","成功");
|
||||
|
||||
return dataJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试接口
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/test")
|
||||
public WeaResult<Object> test(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
Map<String, Object> recordMap = new HashMap<String,Object>();
|
||||
recordMap.put("test","test");
|
||||
return WeaResult.success(recordMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,329 @@
|
|||
package com.weaver.seconddev.chapanda.esign.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.esign.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class FormFieldDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(FormFieldDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fieldId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryFieldOptionByFieldid(String fieldId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> optionMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select name,value_key from field_option where field_id=? " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(fieldId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryFromTableField:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String name = String.valueOf(recordMap.get("name"));
|
||||
String value_key = String.valueOf(recordMap.get("value_key"));
|
||||
optionMap.put(value_key,name);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryFromTableField:e:" + e);
|
||||
}
|
||||
return optionMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> queryTableFormId(String tableName){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
Map<String, Object> recordMap = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataSql =" select id,app_id from ebdf_obj where table_name=? and delete_type=0 and tenant_key=?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(tableName);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryTableFormId:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
recordMap = recordList.get(0);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return recordMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dataKeyList
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryFromTableField(String formTable,List<String> dataKeyList){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> fieldMap = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataKey = dataKeyList.stream().collect(Collectors.joining(","));
|
||||
dataKey = "'"+dataKey.replace(",","','")+"'" ;
|
||||
|
||||
String dataSql =" select id,form_id,title,data_key " +
|
||||
" from form_field " +
|
||||
" where form_id in( select form_id from form_table where table_name=? and delete_type=0 and tenant_key=? ) \n" +
|
||||
" and data_key in("+dataKey+")\n" +
|
||||
" and sub_form_id is null " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("queryFromTableField--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(formTable);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryFromTableField:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String data_key = String.valueOf(recordMap.get("data_key")).toLowerCase();
|
||||
String id = String.valueOf(recordMap.get("id")).toLowerCase();
|
||||
fieldMap.put(data_key,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryFromTableField:e:" + e);
|
||||
}
|
||||
return fieldMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryDepartmentList(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select code,id from eteams.department and tenant_key=? and delete_type=0" ;
|
||||
log.error("queryDepartmentList--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryDepartmentList:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String code = String.valueOf(recordMap.get("code"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
dataMap.put(code,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryDepartmentList:{} ", e);
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public String queryEmailByEmployeeId(String employeeId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String gryx = "";
|
||||
try{
|
||||
|
||||
String dataSql =" select k.gryx from eteams.employee t\n" +
|
||||
" inner join eteams.ft_1152026012537184302 k on k.id = t.formdata\n" +
|
||||
" where t.id=? " +
|
||||
" and t.tenant_key=? \n" +
|
||||
" and t.delete_type=0" +
|
||||
" and k.tenant_key=? \n" +
|
||||
" and k.delete_type=0";
|
||||
|
||||
log.error("queryEmailByEmployeeId--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryEmailByEmployeeId:"+recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
gryx = String.valueOf(recordList.get(0).get("gryx"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("queryEmailByEmployeeId:e:" + e);
|
||||
}
|
||||
return gryx;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,Object> queryDepartmentData(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
try{
|
||||
String dataSql =" select code,id from eteams.department where status = 1 " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0 " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
for(int i=0;i<recordList.size();i++){
|
||||
Map<String, Object> recordMap = recordList.get(i);
|
||||
String code = String.valueOf(recordMap.get("code"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
dataMap.put(code,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,Object> queryEmployeeData(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
|
||||
try{
|
||||
String dataSql =" select job_num,id from eteams.employee where tenant_key=? and delete_type = 0" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
for(int i=0;i<recordList.size();i++){
|
||||
Map<String, Object> recordMap = recordList.get(i);
|
||||
String job_num = String.valueOf(recordMap.get("job_num"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
dataMap.put(job_num,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
public Long queryTableFormIdByEb(String tableName){
|
||||
String sourceType = "LOGIC";
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
Long form_id = 0L;
|
||||
|
||||
try{
|
||||
String dataSql =" select form_id from form_table where table_name=? and delete_type=0 and tenant_key=?" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(tableName);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryTableFormId:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
Map<String, Object> recordMap = recordList.get(0);
|
||||
form_id = Long.valueOf(String.valueOf(recordMap.get("form_id")));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryTableFormId:e:" + e);
|
||||
}
|
||||
return form_id;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> queryDetailTableField(String mainTable,String detailTable,List<String> dataKeyList){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> fieldMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataKey = dataKeyList.stream().collect(Collectors.joining(","));
|
||||
dataKey = "'"+dataKey.replace(",","','")+"'" ;
|
||||
|
||||
String dataSql =" select id,form_id,title,data_key " +
|
||||
" from form_field " +
|
||||
" where form_id in(select form_id from form_table where table_name=? and delete_type=0 and tenant_key=? ) \n" +
|
||||
" and data_key in("+dataKey+")\n" +
|
||||
" and sub_form_id in(select form_id from form_table where table_name=? and delete_type=0 and tenant_key=? )\n"+
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("queryFromTableField--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(mainTable);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(detailTable);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryDetailTableField:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String data_key = String.valueOf(recordMap.get("data_key"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
fieldMap.put(data_key,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryFromTableField:e:" + e);
|
||||
}
|
||||
return fieldMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.weaver.seconddev.chapanda.esign.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.esign.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SealTemplateDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(SealTemplateDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String queryTemplateDataByTemplateId(String templateId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String dataid = "";
|
||||
try{
|
||||
String dataSql =" select id from "+Constants.templateTable+" where mbid=? and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(templateId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size() > 0){
|
||||
if(recordList.get(0).containsKey("id")){
|
||||
dataid = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return dataid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Map<String,Object>> queryTemplateFieldByTemplateId(String templateId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
String dataSql =" select k.zdm ,k.zdlx ,k.zdlx_obj ,k.zdz ,k.zdmc \n" +
|
||||
" from uf_dzqmbgl t\n" +
|
||||
" inner join uf_dzqmbgl_zdb k on k.form_data_id = t.form_data_id \n" +
|
||||
" where t.mbid=? and t.tenant_key=? and t.delete_type=0 and k.tenant_key=? and k.delete_type=0 " ;
|
||||
|
||||
log.error("dataSql:{}" , dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(templateId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}", recordList.size());
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String queryValueByConfig(String dataSql){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String dataid = "";
|
||||
try{
|
||||
|
||||
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, dataSql);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size() > 0){
|
||||
Map<String, Object> recordMap = recordList.get(0);
|
||||
dataid = String.valueOf(recordMap.values().stream().findFirst().orElse(null));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return dataid;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> queryTemplateFieldByType(String templateId,String type){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
String dataSql =" select k.zdm ,k.zdlx ,k.zdlx_obj ,k.zdz ,k.zdmc,k.zdz as rc \n" +
|
||||
" from uf_dzqmbgl t\n" +
|
||||
" inner join uf_dzqmbgl_zdb k on k.form_data_id = t.form_data_id \n" +
|
||||
" where t.mbid=? and t.tenant_key=? and k.zdlx in("+type+") " +
|
||||
" and t.delete_type=0 and k.tenant_key=? and k.delete_type=0 " ;
|
||||
|
||||
log.error("dataSql:{}" , dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(templateId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}", recordList.size());
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.weaver.seconddev.chapanda.esign.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.esign.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SealsManageDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(SealsManageDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> queryLegalEntityList(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
String dataSql =" select bh,mc from uf_legal_entity where tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param sealid
|
||||
* @return
|
||||
*/
|
||||
public String querySealsDataBySealId(String sealid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String dataid = "";
|
||||
try{
|
||||
String dataSql =" select id from " + Constants.sealTable+
|
||||
" where sealid = ? and tenant_key=? \n" +
|
||||
" and delete_type=0 " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(sealid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size() > 0){
|
||||
dataid = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return dataid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.weaver.seconddev.chapanda.esign.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.esign.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SignFlowCallBackDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(SignFlowCallBackDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String,Object> queryFlowInfo(String flowId){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
try{
|
||||
String dataSql =" select form_data_id,glhtlylc from uf_jcl_rshtgl where qslcid =? and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(flowId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size() > 0){
|
||||
dataMap = recordList.get(0);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
public String queryRequestName(String requestid){
|
||||
String groupId = "weaver-workflow-report-serviceworkflowreport";
|
||||
String sourceType = "LOGIC";
|
||||
String requestname = "";
|
||||
try{
|
||||
String dataSql =" select requestname from wfc_requestbase wr where requestid =? and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(requestid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size() > 0){
|
||||
requestname = String.valueOf(recordList.get(0).get("requestname"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return requestname;
|
||||
}
|
||||
|
||||
|
||||
public void updateFormTableInfo(String form_data_id,Long fileid,String finishFileKey){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
try{
|
||||
String dataSql =" update uf_jcl_rshtgl set wjid='"+finishFileKey+"',fj_6pgb='"+String.valueOf(fileid)+"',htzt='2' where form_data_id ='"+form_data_id+"' and tenant_key='"+Constants.TENANT_KEY+"' \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:{}" , dataSql);
|
||||
Map<String, Object> result = databaseUtils.executeUpdate(sourceType, groupId, dataSql);
|
||||
for (Map.Entry<String, Object> entry : result.entrySet()) {
|
||||
log.error(entry.getKey() + ": " + String.valueOf(entry.getValue()));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.weaver.seconddev.chapanda.esign.entity;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.esign.entity
|
||||
*
|
||||
* @ClassName AccountInfoBean
|
||||
* @Author shil
|
||||
* @Date 2025/8/13 14:43
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
public class AccountInfoBean {
|
||||
String accountId;
|
||||
String accountUid;
|
||||
String organizeNo;
|
||||
String authOrgId;
|
||||
String authOrgName;
|
||||
String name;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.weaver.seconddev.chapanda.esign.entity;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.esign.entity
|
||||
*
|
||||
* @ClassName CallBackDto
|
||||
* @Author shil
|
||||
* @Date 2025/8/13 10:13
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
public class CallBackBean {
|
||||
CallbackUrlBean callbackUrlBean;
|
||||
String url;
|
||||
|
||||
public CallbackUrlBean getCallbackUrlBean() {
|
||||
return callbackUrlBean;
|
||||
}
|
||||
|
||||
public void setCallbackUrlBean(CallbackUrlBean callbackUrlBean) {
|
||||
this.callbackUrlBean = callbackUrlBean;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CallBackBean{" +
|
||||
"callbackUrlBean=" + callbackUrlBean +
|
||||
", url='" + url + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.weaver.seconddev.chapanda.esign.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.esign.entity
|
||||
*
|
||||
* @ClassName CallBackDto
|
||||
* @Author shil
|
||||
* @Date 2025/8/13 10:13
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
public class CallbackUrlBean {
|
||||
String action;
|
||||
String createTime;
|
||||
String endTime;
|
||||
List<FinishDocUrlBean> finishDocUrlBeans;
|
||||
int flowId;
|
||||
String flowType;
|
||||
String resultDescription;
|
||||
int status;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public List<FinishDocUrlBean> getFinishDocUrlBeans() {
|
||||
return finishDocUrlBeans;
|
||||
}
|
||||
|
||||
public void setFinishDocUrlBeans(List<FinishDocUrlBean> finishDocUrlBeans) {
|
||||
this.finishDocUrlBeans = finishDocUrlBeans;
|
||||
}
|
||||
|
||||
public int getFlowId() {
|
||||
return flowId;
|
||||
}
|
||||
|
||||
public void setFlowId(int flowId) {
|
||||
this.flowId = flowId;
|
||||
}
|
||||
|
||||
public String getFlowType() {
|
||||
return flowType;
|
||||
}
|
||||
|
||||
public void setFlowType(String flowType) {
|
||||
this.flowType = flowType;
|
||||
}
|
||||
|
||||
public String getResultDescription() {
|
||||
return resultDescription;
|
||||
}
|
||||
|
||||
public void setResultDescription(String resultDescription) {
|
||||
this.resultDescription = resultDescription;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CallbackUrlBean{" +
|
||||
"action='" + action + '\'' +
|
||||
", createTime='" + createTime + '\'' +
|
||||
", endTime='" + endTime + '\'' +
|
||||
", finishDocUrlBeans=" + finishDocUrlBeans +
|
||||
", flowId=" + flowId +
|
||||
", flowType='" + flowType + '\'' +
|
||||
", resultDescription='" + resultDescription + '\'' +
|
||||
", status=" + status +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.weaver.seconddev.chapanda.esign.entity;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.esign.entity
|
||||
*
|
||||
* @ClassName finishDocUrlBeans
|
||||
* @Author shil
|
||||
* @Date 2025/8/13 10:13
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
public class FinishDocUrlBean {
|
||||
String docFileKey;
|
||||
String downloadDocUrl;
|
||||
String finishFileKey;
|
||||
|
||||
public String getDocFileKey() {
|
||||
return docFileKey;
|
||||
}
|
||||
|
||||
public void setDocFileKey(String docFileKey) {
|
||||
this.docFileKey = docFileKey;
|
||||
}
|
||||
|
||||
public String getDownloadDocUrl() {
|
||||
return downloadDocUrl;
|
||||
}
|
||||
|
||||
public void setDownloadDocUrl(String downloadDocUrl) {
|
||||
this.downloadDocUrl = downloadDocUrl;
|
||||
}
|
||||
|
||||
public String getFinishFileKey() {
|
||||
return finishFileKey;
|
||||
}
|
||||
|
||||
public void setFinishFileKey(String finishFileKey) {
|
||||
this.finishFileKey = finishFileKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FinishDocUrlBean{" +
|
||||
"docFileKey='" + docFileKey + '\'' +
|
||||
", downloadDocUrl='" + downloadDocUrl + '\'' +
|
||||
", finishFileKey='" + finishFileKey + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.weaver.seconddev.chapanda.esign.entity;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* packageName com.weaver.seconddev.chapanda.esign.entity
|
||||
*
|
||||
* @ClassName OkHttpDto
|
||||
* @Author shil
|
||||
* @Date 2025/8/12 15:37
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class OkHttpDto {
|
||||
|
||||
int responseCode;
|
||||
String responseBody;
|
||||
|
||||
int dataCode;
|
||||
String dataMsg;
|
||||
|
||||
JSONObject dataJson;
|
||||
|
||||
public int getResponseCode() {
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
public void setResponseCode(int responseCode) {
|
||||
this.responseCode = responseCode;
|
||||
}
|
||||
|
||||
public String getResponseBody() {
|
||||
return responseBody;
|
||||
}
|
||||
|
||||
public void setResponseBody(String responseBody) {
|
||||
this.responseBody = responseBody;
|
||||
}
|
||||
|
||||
public int getDataCode() {
|
||||
return dataCode;
|
||||
}
|
||||
|
||||
public void setDataCode(int dataCode) {
|
||||
this.dataCode = dataCode;
|
||||
}
|
||||
|
||||
public String getDataMsg() {
|
||||
return dataMsg;
|
||||
}
|
||||
|
||||
public void setDataMsg(String dataMsg) {
|
||||
this.dataMsg = dataMsg;
|
||||
}
|
||||
|
||||
public JSONObject getDataJson() {
|
||||
return dataJson;
|
||||
}
|
||||
|
||||
public void setDataJson(JSONObject dataJson) {
|
||||
this.dataJson = dataJson;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignApplyRequest4OrgainzeUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignCreateRequest4OrganizeAction")
|
||||
public class Esb2EsignCreateRequest4OrganizeAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateRequest4OrganizeAction.class);
|
||||
@Autowired
|
||||
Esb2EsignApplyRequest4OrgainzeUtil esb2EsignApplyRequest4OrgainzeUtil;
|
||||
|
||||
// @Autowired
|
||||
// private Esb2EsignPreviewUrlUtil esb2EsignPreviewUrlUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestname = String.valueOf(params.get("requestname"));
|
||||
String sealId = String.valueOf(params.get("sealId"));
|
||||
String docFilekey = String.valueOf(params.get("docFilekey"));
|
||||
String docName = String.valueOf(params.get("docName"));
|
||||
String creditCode = String.valueOf(params.get("creditCode"));
|
||||
String qsrJobNum = String.valueOf(params.get("qsrJobNum"));
|
||||
String templateId = String.valueOf(params.get("templateId"));
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestname:{}",requestname);
|
||||
log.error("sealId:{}",sealId);
|
||||
log.error("docFilekey:{}",docFilekey);
|
||||
log.error("docName:{}",docName);
|
||||
log.error("creditCode:{}",creditCode);
|
||||
log.error("qsrJobNum:{}",qsrJobNum);
|
||||
log.error("templateId:{}",templateId);
|
||||
|
||||
if(StringUtils.isBlank(templateId)){
|
||||
return WeaResult.fail(500,"参数模板ID为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(creditCode)){
|
||||
return WeaResult.fail(500,"参数统一社会信用代码为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(docFilekey)){
|
||||
return WeaResult.fail(500,"参数签署文件为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(sealId)){
|
||||
return WeaResult.fail(500,"参数签署文件印章为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(qsrJobNum)){
|
||||
return WeaResult.fail(500,"参数签署人工号为空");
|
||||
}
|
||||
|
||||
String signFlowId = "";
|
||||
String signUrls = "";
|
||||
String accountIds = "";
|
||||
String uniqueIds = "";
|
||||
String fileKeys = "";
|
||||
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
// JSONObject dataJson = esb2EsignApplyRequest4OrgainzeUtil.applyRequest(requestid,requestname,templateId,sealId,docFilekey,docName,creditCode,qsrJobNum);
|
||||
OkHttpDto okHttpDto = esb2EsignApplyRequest4OrgainzeUtil.applyRequest(requestid,requestname,templateId,sealId,docFilekey,docName,creditCode,qsrJobNum);
|
||||
if(okHttpDto.getResponseCode() == 200){
|
||||
if(okHttpDto.getDataCode() == 0){
|
||||
JSONObject dataJson = okHttpDto.getDataJson();
|
||||
log.error("dataJson:{}",dataJson.toJSONString());
|
||||
signFlowId = dataJson.getString("signFlowId");
|
||||
signUrls = dataJson.getString("signUrls");
|
||||
accountIds = dataJson.getString("accountIds");
|
||||
uniqueIds = dataJson.getString("uniqueIds");
|
||||
fileKeys = dataJson.getString("fileKeys");
|
||||
}else{
|
||||
return WeaResult.fail(500,"创建签署流程异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署流程接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
log.error("signFlowId:{}",signFlowId);
|
||||
log.error("signUrls:{}",signUrls);
|
||||
log.error("accountIds:{}",accountIds);
|
||||
log.error("uniqueIds:{}",uniqueIds);
|
||||
log.error("fileKeys:{}",fileKeys);
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(fileKeys)){
|
||||
return WeaResult.fail(500,"获取签署文件失败");
|
||||
}
|
||||
|
||||
// String preViewUrl = "";
|
||||
// if(StringUtils.isNotBlank(fileKeys)){
|
||||
//// preViewUrl = esb2EsignPreviewUrlUtil.queryPreviewUrl(fileKeys);
|
||||
// OkHttpDto preOkHttpDto = esb2EsignPreviewUrlUtil.queryPreviewUrl(fileKeys);
|
||||
// if(preOkHttpDto.getResponseCode() == 200){
|
||||
// if(preOkHttpDto.getDataCode() == 0){
|
||||
// JSONObject preJson = preOkHttpDto.getDataJson();
|
||||
// if(preJson.containsKey("preViewUrl")){
|
||||
// preViewUrl = preJson.getString("preViewUrl");
|
||||
// }
|
||||
// }else{
|
||||
// return WeaResult.fail(500,"获取预览地址异常,"+preOkHttpDto.getDataMsg());
|
||||
// }
|
||||
// }else{
|
||||
// return WeaResult.fail(500,"文件预览地址接口异常,"+preOkHttpDto.getDataMsg());
|
||||
// }
|
||||
// }
|
||||
// log.error("preViewUrl:{}",preViewUrl);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("signFlowId",signFlowId);
|
||||
actionMap.put("accountIds",accountIds);
|
||||
actionMap.put("signUrls",signUrls);
|
||||
actionMap.put("uniqueIds",uniqueIds);
|
||||
actionMap.put("fileKeys",fileKeys);
|
||||
// actionMap.put("preViewUrl",preViewUrl);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignApplyRequestUtil;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignPreviewUrlUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignCreateRequest4PartiesAction")
|
||||
public class Esb2EsignCreateRequest4PartiesAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateRequest4PartiesAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignApplyRequestUtil esb2EsignApplyRequestUtil;
|
||||
|
||||
@Autowired
|
||||
private Esb2EsignPreviewUrlUtil esb2EsignPreviewUrlUtil;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestname = String.valueOf(params.get("requestname"));
|
||||
String sealId = String.valueOf(params.get("sealId"));
|
||||
String docFilekey = String.valueOf(params.get("docFilekey"));
|
||||
String docName = String.valueOf(params.get("docName"));
|
||||
String creditCode = String.valueOf(params.get("creditCode"));
|
||||
|
||||
String employeeMobile = String.valueOf(params.get("employeeMobile"));
|
||||
String qsrJobNum = String.valueOf(params.get("qsrJobNum"));
|
||||
String templateId = String.valueOf(params.get("templateId"));
|
||||
|
||||
if(StringUtils.isBlank(templateId)){
|
||||
return WeaResult.fail(500,"参数模板ID为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(creditCode)){
|
||||
return WeaResult.fail(500,"参数统一社会信用代码为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(docFilekey)){
|
||||
return WeaResult.fail(500,"参数签署文件为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(sealId)){
|
||||
return WeaResult.fail(500,"参数签署文件印章为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(qsrJobNum)){
|
||||
return WeaResult.fail(500,"参数签署人工号为空");
|
||||
}
|
||||
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestname:{}",requestname);
|
||||
log.error("sealId:{}",sealId);
|
||||
log.error("docFilekey:{}",docFilekey);
|
||||
log.error("docName:{}",docName);
|
||||
log.error("creditCode:{}",creditCode);
|
||||
log.error("employeeMobile:{}",employeeMobile);
|
||||
log.error("qsrJobNum:{}",qsrJobNum);
|
||||
|
||||
String signFlowId = "";
|
||||
String signUrls = "";
|
||||
String accountIds = "";
|
||||
String uniqueIds = "";
|
||||
String fileKeys = "";
|
||||
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
OkHttpDto okHttpDto = esb2EsignApplyRequestUtil.applyRequest(requestid,requestname,employeeMobile,templateId,sealId,docFilekey,docName,creditCode,qsrJobNum);
|
||||
if(okHttpDto.getResponseCode() == 200){
|
||||
if(okHttpDto.getDataCode() == 0){
|
||||
JSONObject dataJson = okHttpDto.getDataJson();
|
||||
signFlowId = dataJson.getString("signFlowId");
|
||||
signUrls = dataJson.getString("signUrls");
|
||||
accountIds = dataJson.getString("accountIds");
|
||||
uniqueIds = dataJson.getString("uniqueIds");
|
||||
fileKeys = dataJson.getString("fileKeys");
|
||||
if(StringUtils.isBlank(signFlowId)){
|
||||
return WeaResult.fail(500,"创建签署流程异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"创建签署流程异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署流程接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
log.error("signFlowId:{}",signFlowId);
|
||||
log.error("signUrls:{}",signUrls);
|
||||
log.error("accountIds:{}",accountIds);
|
||||
log.error("uniqueIds:{}",uniqueIds);
|
||||
log.error("fileKeys:{}",fileKeys);
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(fileKeys)){
|
||||
return WeaResult.fail(500,"获取签署文件失败");
|
||||
}
|
||||
|
||||
String preViewUrl = "";
|
||||
if(StringUtils.isNotBlank(fileKeys)){
|
||||
OkHttpDto preOkHttpDto = esb2EsignPreviewUrlUtil.queryPreviewUrl(fileKeys);
|
||||
if(preOkHttpDto.getResponseCode() == 200){
|
||||
if(preOkHttpDto.getDataCode() == 0){
|
||||
JSONObject preJson = preOkHttpDto.getDataJson();
|
||||
if(preJson.containsKey("preViewUrl")){
|
||||
preViewUrl = preJson.getString("preViewUrl");
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"获取签署文件预览地址异常,"+preOkHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署文件预览地址接口异常,"+preOkHttpDto.getDataMsg());
|
||||
}
|
||||
}
|
||||
log.error("preViewUrl:{}",preViewUrl);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("signFlowId",signFlowId);
|
||||
actionMap.put("accountIds",accountIds);
|
||||
actionMap.put("signUrls",signUrls);
|
||||
actionMap.put("uniqueIds",uniqueIds);
|
||||
actionMap.put("fileKeys",fileKeys);
|
||||
actionMap.put("preViewUrl",preViewUrl);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignApplyRequestUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignCreateRequestAction")
|
||||
public class Esb2EsignCreateRequestAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateRequestAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignApplyRequestUtil esb2EsignApplyRequestUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestname = String.valueOf(params.get("requestname"));
|
||||
String sealId = String.valueOf(params.get("sealId"));
|
||||
String docFilekey = String.valueOf(params.get("docFilekey"));
|
||||
String docName = String.valueOf(params.get("docName"));
|
||||
String creditCode = String.valueOf(params.get("creditCode"));
|
||||
|
||||
String employeeMobile = String.valueOf(params.get("employeeMobile"));
|
||||
String qsrJobNum = String.valueOf(params.get("qsrJobNum"));
|
||||
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestname:{}",requestname);
|
||||
log.error("sealId:{}",sealId);
|
||||
log.error("docFilekey:{}",docFilekey);
|
||||
log.error("docName:{}",docName);
|
||||
log.error("creditCode:{}",creditCode);
|
||||
log.error("employeeMobile:{}",employeeMobile);
|
||||
log.error("qsrJobNum:{}",qsrJobNum);
|
||||
|
||||
String signFlowId = "";
|
||||
String signUrls = "";
|
||||
String accountIds = "";
|
||||
String uniqueIds = "";
|
||||
String fileKeys = "";
|
||||
String templateId = String.valueOf(params.get("templateId"));
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
OkHttpDto okHttpDto = esb2EsignApplyRequestUtil.applyRequest(requestid,requestname,employeeMobile,templateId,sealId,docFilekey,docName,creditCode,qsrJobNum);
|
||||
if(okHttpDto.getResponseCode() == 200){
|
||||
if(okHttpDto.getDataCode() == 0){
|
||||
JSONObject dataJson = okHttpDto.getDataJson();
|
||||
signFlowId = dataJson.getString("signFlowId");
|
||||
signUrls = dataJson.getString("signUrls");
|
||||
accountIds = dataJson.getString("accountIds");
|
||||
uniqueIds = dataJson.getString("uniqueIds");
|
||||
fileKeys = dataJson.getString("fileKeys");
|
||||
}else{
|
||||
return WeaResult.fail(500,"创建签署流程异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署流程接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
log.error("signFlowId:{}",signFlowId);
|
||||
log.error("signUrls:{}",signUrls);
|
||||
log.error("accountIds:{}",accountIds);
|
||||
log.error("uniqueIds:{}",uniqueIds);
|
||||
log.error("fileKeys:{}",fileKeys);
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(fileKeys)){
|
||||
return WeaResult.fail(500,"用印申请失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("signFlowId",signFlowId);
|
||||
actionMap.put("accountIds",accountIds);
|
||||
actionMap.put("signUrls",signUrls);
|
||||
actionMap.put("uniqueIds",uniqueIds);
|
||||
actionMap.put("fileKeys",fileKeys);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignCreateUserUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignCreateUserAction")
|
||||
public class Esb2EsignCreateUserAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateUserAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignCreateUserUtil esb2EsignCreateUserUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String mobile = String.valueOf(params.get("mobile"));
|
||||
String name = String.valueOf(params.get("name"));
|
||||
|
||||
log.error("mobile:{}",mobile);
|
||||
log.error("name:{}",name);
|
||||
|
||||
if(StringUtils.isBlank(mobile)){
|
||||
return WeaResult.fail(500,"入参手机号为空");
|
||||
}
|
||||
if(StringUtils.isBlank(name)){
|
||||
return WeaResult.fail(500,"入参姓名为空");
|
||||
}
|
||||
|
||||
String esignAccountId = "";
|
||||
String uniqueId = "";
|
||||
if(StringUtils.isNotBlank(mobile) && StringUtils.isNotBlank(name)){
|
||||
OkHttpDto okHttpDto = esb2EsignCreateUserUtil.createUser(name,mobile);
|
||||
if(okHttpDto.getResponseCode() == 200){
|
||||
if(okHttpDto.getDataCode() == 0){
|
||||
JSONObject dataJson = okHttpDto.getDataJson();
|
||||
if(dataJson.containsKey("esignAccountId")){
|
||||
esignAccountId = dataJson.getString("esignAccountId");
|
||||
}
|
||||
if(dataJson.containsKey("uniqueId")){
|
||||
uniqueId = dataJson.getString("uniqueId");
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"E签宝用户创建异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"E签宝用户创建接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(esignAccountId)){
|
||||
return WeaResult.fail(500,"e签宝创建用户失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("esignAccountId",esignAccountId);
|
||||
actionMap.put("mobile",mobile);
|
||||
actionMap.put("uniqueId",uniqueId);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignDownlUrlUtil;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignFileUploadUtil;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignPreviewUrlUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignFileUploadAction")
|
||||
public class Esb2EsignFileUploadAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignFileUploadAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignDownlUrlUtil esb2EsignDownlUrlUtil;
|
||||
|
||||
@Autowired
|
||||
Esb2EsignFileUploadUtil esb2EsignFileUploadUtil;
|
||||
|
||||
@Autowired
|
||||
private Esb2EsignPreviewUrlUtil esb2EsignPreviewUrlUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String signFlowId = String.valueOf(params.get("signFlowId"));
|
||||
String fileName = String.valueOf(params.get("fileName"));
|
||||
String folderid = String.valueOf(params.get("folderid"));
|
||||
log.error("signFlowId:{}",signFlowId);
|
||||
if(StringUtils.isBlank(signFlowId)){
|
||||
return WeaResult.fail(500,"入参申请流程为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(fileName)){
|
||||
return WeaResult.fail(500,"入参文件名称为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(folderid)){
|
||||
return WeaResult.fail(500,"入参附件目录为空");
|
||||
}
|
||||
|
||||
Long longSignFlowId = convertStringToLong(folderid);
|
||||
if(longSignFlowId == 0L){
|
||||
return WeaResult.fail(500,"入参附件目录转换失败");
|
||||
}
|
||||
|
||||
String downloadDocUrl = "";
|
||||
String docName = "";
|
||||
String docFileKey = "";
|
||||
String signDocId = "";
|
||||
OkHttpDto okHttpDto = esb2EsignDownlUrlUtil.queryDownlUrl(signFlowId);
|
||||
if(okHttpDto.getResponseCode() == 200){
|
||||
if(okHttpDto.getDataCode() == 0){
|
||||
JSONObject dataJson = okHttpDto.getDataJson();
|
||||
log.error("dataJson:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("downloadDocUrl")){
|
||||
downloadDocUrl = dataJson.getString("downloadDocUrl");
|
||||
}
|
||||
|
||||
if(dataJson.containsKey("docName")){
|
||||
docName = dataJson.getString("docName");
|
||||
}
|
||||
|
||||
if(dataJson.containsKey("downloadDocUrl")){
|
||||
docFileKey = dataJson.getString("docFileKey");
|
||||
}
|
||||
|
||||
if(dataJson.containsKey("downloadDocUrl")){
|
||||
signDocId = dataJson.getString("docId");
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署文件获取异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署文件获取接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
log.error("downloadDocUrl:{}",downloadDocUrl);
|
||||
if(StringUtils.isBlank(downloadDocUrl)){
|
||||
return WeaResult.fail(500,"获取文件下载地址失败");
|
||||
}
|
||||
|
||||
Long docId = 0L;
|
||||
Long fileid = 0L;
|
||||
if(StringUtils.isNotBlank(downloadDocUrl)){
|
||||
FileObj fileObj = esb2EsignFileUploadUtil.uploadFile(downloadDocUrl,fileName,longSignFlowId);
|
||||
log.error("fileObj:{}",fileObj.toString());
|
||||
docId = fileObj.getDocId();
|
||||
fileid = fileObj.getId();
|
||||
}
|
||||
log.error("docId:{}",docId);
|
||||
log.error("fileid:{}",fileid);
|
||||
|
||||
if(fileid <= 0){
|
||||
return WeaResult.fail(500,"创建文档失败");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(docFileKey)){
|
||||
return WeaResult.fail(500,"获取签署文件失败");
|
||||
}
|
||||
|
||||
String preViewUrl = "";
|
||||
if(StringUtils.isNotBlank(docFileKey)){
|
||||
OkHttpDto preOkHttpDto = esb2EsignPreviewUrlUtil.queryPreviewUrl(docFileKey);
|
||||
if(preOkHttpDto.getResponseCode() == 200){
|
||||
if(preOkHttpDto.getDataCode() == 0){
|
||||
JSONObject preJson = preOkHttpDto.getDataJson();
|
||||
if(preJson.containsKey("preViewUrl")){
|
||||
preViewUrl = preJson.getString("preViewUrl");
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"获取签署文件预览地址异常,"+preOkHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署文件预览地址接口异常,"+preOkHttpDto.getDataMsg());
|
||||
}
|
||||
}
|
||||
log.error("preViewUrl:{}",preViewUrl);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("docId",docId);
|
||||
actionMap.put("fileid",fileid);
|
||||
actionMap.put("downloadDocUrl",downloadDocUrl);
|
||||
actionMap.put("docName",docName);
|
||||
actionMap.put("docFileKey",docFileKey);
|
||||
actionMap.put("signDocId",signDocId);
|
||||
actionMap.put("preViewUrl",preViewUrl);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
public long convertStringToLong(String str) {
|
||||
try {
|
||||
return Long.parseLong(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.eteams.file.client.file.FileObj;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignDownlUrlUtil;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignFileUploadUtil;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignPreviewUrlUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignFileUploadForOrganizeAction")
|
||||
public class Esb2EsignFileUploadForOrganizeAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignFileUploadForOrganizeAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignDownlUrlUtil esb2EsignDownlUrlUtil;
|
||||
|
||||
@Autowired
|
||||
Esb2EsignFileUploadUtil esb2EsignFileUploadUtil;
|
||||
|
||||
@Autowired
|
||||
private Esb2EsignPreviewUrlUtil esb2EsignPreviewUrlUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String signFlowId = String.valueOf(params.get("signFlowId"));
|
||||
String fileName = String.valueOf(params.get("fileName"));
|
||||
String folderid = String.valueOf(params.get("folderid"));
|
||||
log.error("signFlowId:{}",signFlowId);
|
||||
if(StringUtils.isBlank(signFlowId)){
|
||||
return WeaResult.fail(500,"入参申请流程为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(fileName)){
|
||||
return WeaResult.fail(500,"入参文件名称为空");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(folderid)){
|
||||
return WeaResult.fail(500,"入参附件目录为空");
|
||||
}
|
||||
|
||||
Long longSignFlowId = convertStringToLong(folderid);
|
||||
if(longSignFlowId == 0L){
|
||||
return WeaResult.fail(500,"入参附件目录转换失败");
|
||||
}
|
||||
|
||||
String downloadDocUrl = "";
|
||||
String docName = "";
|
||||
String docFileKey = "";
|
||||
String signDocId = "";
|
||||
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
OkHttpDto okHttpDto = esb2EsignDownlUrlUtil.queryDownlUrl(signFlowId);
|
||||
if(okHttpDto.getResponseCode() == 200){
|
||||
if(okHttpDto.getDataCode() == 0){
|
||||
JSONObject dataJson = okHttpDto.getDataJson();
|
||||
log.error("dataJson:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("downloadDocUrl")){
|
||||
downloadDocUrl = dataJson.getString("downloadDocUrl");
|
||||
}
|
||||
|
||||
if(dataJson.containsKey("docName")){
|
||||
docName = dataJson.getString("docName");
|
||||
}
|
||||
|
||||
if(dataJson.containsKey("downloadDocUrl")){
|
||||
docFileKey = dataJson.getString("docFileKey");
|
||||
}
|
||||
|
||||
if(dataJson.containsKey("downloadDocUrl")){
|
||||
signDocId = dataJson.getString("docId");
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署文件获取异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署文件获取接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
log.error("downloadDocUrl:{}",downloadDocUrl);
|
||||
if(StringUtils.isBlank(downloadDocUrl)){
|
||||
return WeaResult.fail(500,"获取文件下载地址失败");
|
||||
}
|
||||
|
||||
Long docId = 0L;
|
||||
Long fileid = 0L;
|
||||
if(StringUtils.isNotBlank(downloadDocUrl)){
|
||||
FileObj fileObj = esb2EsignFileUploadUtil.uploadFile(downloadDocUrl,fileName,longSignFlowId);
|
||||
log.error("fileObj:{}",fileObj.toString());
|
||||
docId = fileObj.getDocId();
|
||||
fileid = fileObj.getId();
|
||||
}
|
||||
log.error("docId:{}",docId);
|
||||
log.error("fileid:{}",fileid);
|
||||
|
||||
if(fileid <= 0){
|
||||
return WeaResult.fail(500,"创建文档失败");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(docFileKey)){
|
||||
return WeaResult.fail(500,"获取签署文件失败");
|
||||
}
|
||||
|
||||
String preViewUrl = "";
|
||||
if(StringUtils.isNotBlank(docFileKey)){
|
||||
OkHttpDto preOkHttpDto = esb2EsignPreviewUrlUtil.queryPreviewUrl(docFileKey);
|
||||
if(preOkHttpDto.getResponseCode() == 200){
|
||||
if(preOkHttpDto.getDataCode() == 0){
|
||||
JSONObject preJson = preOkHttpDto.getDataJson();
|
||||
if(preJson.containsKey("preViewUrl")){
|
||||
preViewUrl = preJson.getString("preViewUrl");
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"获取签署文件预览地址异常,"+preOkHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"签署文件预览地址接口异常,"+preOkHttpDto.getDataMsg());
|
||||
}
|
||||
}
|
||||
log.error("preViewUrl:{}",preViewUrl);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("docId",docId);
|
||||
actionMap.put("fileid",fileid);
|
||||
actionMap.put("downloadDocUrl",downloadDocUrl);
|
||||
actionMap.put("docName",docName);
|
||||
actionMap.put("docFileKey",docFileKey);
|
||||
actionMap.put("signDocId",signDocId);
|
||||
actionMap.put("preViewUrl",preViewUrl);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
public long convertStringToLong(String str) {
|
||||
try {
|
||||
return Long.parseLong(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignBuildTemplatDoceUtil;
|
||||
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.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignQueryPreviewUrlAction")
|
||||
public class Esb2EsignQueryPreviewUrlAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignQueryPreviewUrlAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignBuildTemplatDoceUtil esb2EsignBuildTemplatDoceUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
Iterator<Map.Entry<String, Object>> it = params.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Object> entry = it.next();
|
||||
log.error("Key:{},Value:{}",entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
String preViewUrl = "";
|
||||
String fileKey = "";
|
||||
String templateId = String.valueOf(params.get("templateId"));
|
||||
String form_data_id = String.valueOf(params.get("form_data_id"));
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
OkHttpDto templateOkHttpDto = esb2EsignBuildTemplatDoceUtil.queryTemplateFileKey(templateId,params);
|
||||
if(templateOkHttpDto.getResponseCode() == 200){
|
||||
if(templateOkHttpDto.getDataCode() == 0 ){
|
||||
JSONObject dataJson = templateOkHttpDto.getDataJson();
|
||||
if(dataJson.containsKey("fileKey")){
|
||||
fileKey = dataJson.getString("fileKey");
|
||||
}
|
||||
log.error("fileKey:{}",fileKey);
|
||||
if(StringUtils.isNotBlank(fileKey)){
|
||||
OkHttpDto preOkHttpDto = esb2EsignBuildTemplatDoceUtil.queryPreviewUrl(fileKey);
|
||||
if(preOkHttpDto.getResponseCode() == 200){
|
||||
if(preOkHttpDto.getDataCode() == 0){
|
||||
JSONObject preJson = preOkHttpDto.getDataJson();
|
||||
log.error("preJson:{}",preJson.toJSONString());
|
||||
if(preJson.containsKey("preViewUrl")){
|
||||
preViewUrl = preJson.getString("preViewUrl");
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"获取预览地址异常,"+preOkHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"文件预览地址接口异常,"+preOkHttpDto.getDataMsg());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"模板生成文件异常,"+templateOkHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"调用模板生产文件接口址异常,"+templateOkHttpDto.getDataMsg());
|
||||
}
|
||||
|
||||
// dataMap = sealTemplateService.queryPreviewUrl(templateId,params);
|
||||
// String fileKey = String.valueOf(dataMap.get("filekey"));
|
||||
// String preViewUrl = String.valueOf(dataMap.get("previewurl"));
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("filekey",fileKey);
|
||||
actionMap.put("previewurl",preViewUrl);
|
||||
actionMap.put("form_data_id",form_data_id);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.entity.OkHttpDto;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignReminderRequestUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignReminderRequestAction")
|
||||
public class Esb2EsignReminderRequestAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignReminderRequestAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignReminderRequestUtil esb2EsignReminderRequestUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String form_data_id = String.valueOf(params.get("form_data_id"));
|
||||
String flowId = String.valueOf(params.get("flowId"));
|
||||
|
||||
log.error("flowId:{}",flowId);
|
||||
log.error("requestid:{}",requestid);
|
||||
|
||||
if(StringUtils.isBlank(flowId)){
|
||||
return WeaResult.fail(500,"入参参数flowId为空");
|
||||
}
|
||||
|
||||
int errCode = 0;
|
||||
if(StringUtils.isNotBlank(flowId)){
|
||||
OkHttpDto okHttpDto = esb2EsignReminderRequestUtil.reminderRequest(flowId);
|
||||
|
||||
if(okHttpDto.getResponseCode() == 200){
|
||||
errCode = okHttpDto.getDataCode();
|
||||
if(errCode != 0){
|
||||
return WeaResult.fail(500,"流程催办失败,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}else{
|
||||
return WeaResult.fail(500,"流程催办接口异常,"+okHttpDto.getDataMsg());
|
||||
}
|
||||
}
|
||||
|
||||
// if(!"0".equals(errCode)){
|
||||
// return WeaResult.fail(500,"流程催办失败");
|
||||
// }
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("requestid",requestid);
|
||||
actionMap.put("form_data_id",form_data_id);
|
||||
actionMap.put("flowId",flowId);
|
||||
actionMap.put("errCode",errCode);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,305 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.esign.dao.FormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.esign.dao.SealsManageDao;
|
||||
import com.weaver.seconddev.chapanda.esign.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignSyncSealsUtil;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/***
|
||||
* 同步印章数据
|
||||
*/
|
||||
@Service("Esb2EsignSyncSealsCron")
|
||||
public class Esb2EsignSyncSealsCron implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignSyncSealsCron.class);
|
||||
|
||||
@Autowired
|
||||
SealsManageDao sealsManageDao;
|
||||
|
||||
@Autowired
|
||||
Esb2EsignSyncSealsUtil esb2EsignSyncSealsUtil;
|
||||
|
||||
@Autowired
|
||||
FormFieldDao formFieldDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
JSONArray sealsArray = new JSONArray();
|
||||
List<Map<String,Object>> organizeList = sealsManageDao.queryLegalEntityList();
|
||||
log.error("organizeList:{}",organizeList.size());
|
||||
for(int i=0;i<organizeList.size();i++){
|
||||
String organizeNo = organizeList.get(i).get("bh").toString();
|
||||
log.error("organizeNo:{}",organizeNo);
|
||||
JSONArray itemArray = querySealData(organizeNo);
|
||||
log.error("itemArray:{}",itemArray.size());
|
||||
sealsArray.addAll(itemArray);
|
||||
}
|
||||
|
||||
|
||||
int effectiveTotal = 0;
|
||||
int failTotal = 0;
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("yzzl");
|
||||
fieldList.add("sealid");
|
||||
fieldList.add("orgno");
|
||||
fieldList.add("sealname");
|
||||
fieldList.add("sealstatus");
|
||||
fieldList.add("sealtype");
|
||||
fieldList.add("sealno");
|
||||
|
||||
log.error("sealsArray:{}",sealsArray.size());
|
||||
log.error("sealsArray:{}",sealsArray.toJSONString());
|
||||
try{
|
||||
if(sealsArray.size() > 0){
|
||||
|
||||
Map<String, Object> fieldMap = formFieldDao.queryFromTableField(Constants.sealTable,fieldList);
|
||||
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
List<EBDataReqDto> updateDatas = new ArrayList<EBDataReqDto>();
|
||||
log.error("fieldMap2:{}",fieldMap.size());
|
||||
for(int i=0;i<sealsArray.size();i++){
|
||||
log.error("i:{}",i);
|
||||
JSONObject dataJson = sealsArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("sealid") && StringUtils.isNotBlank(dataJson.getString("sealid"))){
|
||||
String sealid = dataJson.getString("sealid");
|
||||
String ufId = sealsManageDao.querySealsDataBySealId(sealid);
|
||||
log.error("ufId:{}",ufId);
|
||||
|
||||
if(StringUtils.isNotBlank(ufId)){
|
||||
log.error("修改");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
mainData.add(new EBDataReqDetailDto("id", ufId));
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
effectiveTotal++;
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
updateDatas.add(ebDataReqDto);
|
||||
}else{
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
effectiveTotal++;
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
}else{
|
||||
failTotal++;
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
log.error("updateDatas:{}",updateDatas.size());
|
||||
|
||||
Map<String,Object> recordMap = formFieldDao.queryTableFormId(Constants.sealTable);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertEbForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
|
||||
if(updateDatas.size() > 0){
|
||||
|
||||
EBDataChangeResult updateEbDataChangeResult = ebuilderOperateUtils.bacthEditEbForm(updateDatas,formId,appId);
|
||||
boolean isTrue = updateEbDataChangeResult.getStatus();
|
||||
log.error("isTrue2:{}",isTrue);
|
||||
log.error("message2:{}",updateEbDataChangeResult.getMessage());
|
||||
if(isTrue){
|
||||
ebList.addAll(updateEbDataChangeResult.getDataIds());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("total",sealsArray.size());
|
||||
actionMap.put("effectiveTotal",effectiveTotal);
|
||||
actionMap.put("failTotal",failTotal);
|
||||
actionMap.put("ebTotal",ebList.size());
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 获取印章数据
|
||||
* @param organizeNo
|
||||
* @return
|
||||
*/
|
||||
public JSONArray querySealData(String organizeNo){
|
||||
|
||||
JSONArray sealsArray = new JSONArray();
|
||||
|
||||
int pageSize = 30;
|
||||
int total = 0;
|
||||
JSONArray itemArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(organizeNo)){
|
||||
int pageIndex = 1;
|
||||
String querySealsUrl = Constants.querySealsUrl+"?pageIndex="+pageIndex+"&pageSize="+pageSize+"&organizeNo="+organizeNo;
|
||||
log.error("querySealsUrl:{}",querySealsUrl);
|
||||
String msg = esb2EsignSyncSealsUtil.queryEsignSealTemplate(querySealsUrl);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("errCode")){
|
||||
String errCode = msgJson.getString("errCode");
|
||||
if("0".equals(errCode)){
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONObject dataJson = msgJson.getJSONObject("data");
|
||||
if(dataJson.containsKey("total")){
|
||||
total = dataJson.getInteger("total");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemArray = esb2EsignSyncSealsUtil.querySealsArray(msg,organizeNo);
|
||||
}
|
||||
}
|
||||
|
||||
if (total <= pageSize) {
|
||||
sealsArray = itemArray;
|
||||
} else {
|
||||
sealsArray.addAll(itemArray);
|
||||
int pageCount = (int) Math.floor(total / (pageSize * 1.0));
|
||||
log.error("pageCount:" + pageCount);
|
||||
for (int i = 1; i < pageCount; i++) {
|
||||
int pageIndex = i + 1;
|
||||
|
||||
String querySealsUrl = Constants.querySealsUrl+"?pageIndex="+pageIndex+"&pageSize="+pageSize+"&organizeNo="+organizeNo;
|
||||
log.error("querySealsUrl:{}",querySealsUrl);
|
||||
String msg = esb2EsignSyncSealsUtil.queryEsignSealTemplate(querySealsUrl);
|
||||
JSONArray itemArray2 = esb2EsignSyncSealsUtil.querySealsArray(msg,organizeNo);
|
||||
sealsArray.addAll(itemArray2);
|
||||
}
|
||||
}
|
||||
return sealsArray;
|
||||
}
|
||||
|
||||
// public String queryEsignSealTemplate(String querySealsUrl,String organizeNo){
|
||||
//
|
||||
//// String secretKey = "7f067a08f5c675137e6e72aa298e2c07";
|
||||
//// String xTimevaleProjectId = "1001003";
|
||||
//// String eSignHost = "http://110.185.172.132:8086";
|
||||
//
|
||||
// String bodyData = "";
|
||||
// String xTimevaleSignature = esb2EsignUtil.encryptionHmacSHA256(bodyData);
|
||||
// log.error("xTimevaleSignature:"+xTimevaleSignature);
|
||||
// String msg = esb2EsignUtil.doGetEsignQuerySeals(xTimevaleSignature,querySealsUrl);
|
||||
// log.error("msg:"+msg);
|
||||
// return msg;
|
||||
// }
|
||||
|
||||
|
||||
// public String doHttpPost(String eSignHost,String eSignUrl,String bodyData,String xTimevaleSignature,String xTimevaleProjectId){
|
||||
// String msg = "";
|
||||
// OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
// .build();
|
||||
// MediaType mediaType = MediaType.parse("text/plain");
|
||||
// System.out.println(eSignHost+eSignUrl);
|
||||
// try {
|
||||
// Request request = new Request.Builder()
|
||||
// .url(eSignHost+eSignUrl)
|
||||
// .method("GET", null)
|
||||
// .addHeader("x-timevale-project-id", xTimevaleProjectId)
|
||||
// .addHeader("x-timevale-signature", xTimevaleSignature)
|
||||
// .addHeader("Content-Type", "application/json")
|
||||
// .build();
|
||||
// Response response = client.newCall(request).execute();
|
||||
// int code = response.code();
|
||||
// if(code == 200){
|
||||
// msg = response.body().string();
|
||||
// }
|
||||
// log.error("msg:"+msg);
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// return msg;
|
||||
// }
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// Esb2EsignSyncSealsCron esb2EsignQuerySealsAction = new Esb2EsignSyncSealsCron();
|
||||
// String pageIndex = "1";
|
||||
// String pageSize = "10";
|
||||
// String organizeNo = "91510115MA62QJQJ4N";
|
||||
//
|
||||
// String querySealsUrl = Constants.querySealsUrl+"?pageIndex="+pageIndex+"&pageSize="+pageSize+"&organizeNo="+organizeNo;
|
||||
// esb2EsignQuerySealsAction.queryEsignSealTemplate(querySealsUrl,organizeNo);
|
||||
// }
|
||||
|
||||
|
||||
// public String encryptionHmacSHA256(String secretKey,String bodyData){
|
||||
// String encryptionData = "";
|
||||
//// String secretKey = "7f067a08f5c675137e6e72aa298e2c07";
|
||||
// // 要签名的数据
|
||||
//// JSONObject dataObject = new JSONObject();
|
||||
//// dataObject.put("templateId","JMHT-ZXSJ");
|
||||
//// String data = "{\"templateId\":\"JMHT-ZXSJ\"}" ;
|
||||
// try {
|
||||
// // 初始化Mac对象
|
||||
// Mac sha256Hmac = Mac.getInstance("HmacSHA256");
|
||||
// SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
|
||||
// sha256Hmac.init(secretKeySpec);
|
||||
// byte[] result = sha256Hmac.doFinal(bodyData.getBytes(StandardCharsets.UTF_8));
|
||||
// encryptionData = Hex.encodeHexString(result);
|
||||
// } catch (NoSuchAlgorithmException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }catch (InvalidKeyException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// return encryptionData;
|
||||
// }
|
||||
}
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.esign.dao.FormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.esign.dao.SealTemplateDao;
|
||||
import com.weaver.seconddev.chapanda.esign.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignSealTemplateUtil;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignTemplateFormUtil;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 同步电子印章模板数据, 含有明细表字段
|
||||
*/
|
||||
@Service("Esb2EsignSyncTemplateCron")
|
||||
public class Esb2EsignSyncTemplateCron implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignSyncTemplateCron.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
FormFieldDao formFieldDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
|
||||
@Autowired
|
||||
Esb2EsignSealTemplateUtil esb2EsignSealTemplateUtil;
|
||||
|
||||
@Autowired
|
||||
SealTemplateDao sealTemplateDao;
|
||||
|
||||
@Autowired
|
||||
Esb2EsignTemplateFormUtil esb2EsignTemplateFormUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
JSONArray templateArray = queryTemplateData();
|
||||
|
||||
int effectiveTotal = 0;
|
||||
int failTotal = 0;
|
||||
|
||||
log.error("templateArray:{}",templateArray.size());
|
||||
if(templateArray.size() > 0){
|
||||
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
|
||||
for(int i=0;i<templateArray.size();i++){
|
||||
JSONObject dataJson = templateArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("mbid") && StringUtils.isNotBlank(dataJson.getString("mbid"))){
|
||||
String mbid = dataJson.getString("mbid");
|
||||
log.error("mbid:{}",mbid);
|
||||
String ufId = sealTemplateDao.queryTemplateDataByTemplateId(mbid);
|
||||
log.error("ufId:{}",ufId);
|
||||
if(StringUtils.isBlank(ufId)){
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = appendMainData(dataJson);
|
||||
if(mainData.size() > 0){
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
Map<Long, List<List<EBDataReqDetailDto>>> detailDatas = appendDetailData(mbid);
|
||||
ebDataReqDto.setDetailDatas(detailDatas);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
}
|
||||
//
|
||||
// if(StringUtils.isNotBlank(ufId)){
|
||||
// log.error("修改");
|
||||
// EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
// List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
// mainData.add(new EBDataReqDetailDto("id", ufId));
|
||||
// for(int n=0;n<fieldList.size();n++){
|
||||
// if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
// String value = dataJson.getString(fieldList.get(n));
|
||||
// String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
// log.error("fieldId:{}",fieldId);
|
||||
// log.error("value:{}",value);
|
||||
// mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
// effectiveTotal++;
|
||||
// }
|
||||
// }
|
||||
// ebDataReqDto.setMainDatas(mainData);
|
||||
// updateDatas.add(ebDataReqDto);
|
||||
// }else{
|
||||
// log.error("新增");
|
||||
// EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
// List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
// for(int n=0;n<fieldList.size();n++){
|
||||
// if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
// String value = dataJson.getString(fieldList.get(n));
|
||||
// String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
//
|
||||
// log.error("fieldId:{}",fieldId);
|
||||
// log.error("value:{}",value);
|
||||
// mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
// effectiveTotal++;
|
||||
// }
|
||||
// }
|
||||
// ebDataReqDto.setMainDatas(mainData);
|
||||
// addDatas.add(ebDataReqDto);
|
||||
// }
|
||||
}else{
|
||||
failTotal++;
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
|
||||
Map<String,Object> recordMap = formFieldDao.queryTableFormId(Constants.templateTable);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
if(addDatas.size() > 0){
|
||||
|
||||
for(int i=0;i<addDatas.size();i++){
|
||||
EBDataReqDto ebdatareqdto = addDatas.get(i);
|
||||
log.error("ebdatareqdto:{}",JSON.toJSON(ebdatareqdto).toString());
|
||||
}
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertEbDetailForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
|
||||
// if(updateDatas.size() > 0){
|
||||
//
|
||||
// EBDataChangeResult updateEbDataChangeResult = ebuilderOperateUtils.bacthEditEbForm(updateDatas,formId,appId);
|
||||
// boolean isTrue = updateEbDataChangeResult.getStatus();
|
||||
// log.error("isTrue2:{}",isTrue);
|
||||
// log.error("message2:{}",updateEbDataChangeResult.getMessage());
|
||||
// if(isTrue){
|
||||
// ebList.addAll(updateEbDataChangeResult.getDataIds());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
// actionMap.put("total",sealsArray.size());
|
||||
actionMap.put("effectiveTotal",effectiveTotal);
|
||||
actionMap.put("failTotal",failTotal);
|
||||
actionMap.put("ebTotal",ebList.size());
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public JSONArray queryTemplateData(){
|
||||
|
||||
JSONArray templateArray = new JSONArray();
|
||||
|
||||
int pageSize = 30;
|
||||
int totalCount = 0;
|
||||
JSONArray itemArray = new JSONArray();
|
||||
int pageIndex = 1;
|
||||
String msg = esb2EsignSealTemplateUtil.queryTemplateData(pageIndex,pageSize);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("errCode")){
|
||||
String errCode = msgJson.getString("errCode");
|
||||
if("0".equals(errCode)){
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONObject dataJson = msgJson.getJSONObject("data");
|
||||
if(dataJson.containsKey("totalCount")){
|
||||
totalCount = dataJson.getInteger("totalCount");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
itemArray = esb2EsignSealTemplateUtil.queryTemplateArray(msg);
|
||||
}
|
||||
|
||||
log.error("itemArray:" + itemArray.size());
|
||||
|
||||
if (totalCount <= pageSize) {
|
||||
templateArray.addAll(itemArray);
|
||||
} else {
|
||||
templateArray.addAll(itemArray);
|
||||
int pageCount = (int) Math.floor(totalCount / (pageSize * 1.0));
|
||||
log.error("pageCount:" + pageCount);
|
||||
for (int i = 1; i < pageCount; i++) {
|
||||
int pageIndex2 = i + 1;
|
||||
String msg2 = esb2EsignSealTemplateUtil.queryTemplateData(pageIndex2,pageSize);
|
||||
JSONArray itemArray2 = esb2EsignSealTemplateUtil.queryTemplateArray(msg2);
|
||||
templateArray.addAll(itemArray2);
|
||||
}
|
||||
}
|
||||
|
||||
log.error("templateArray:" + templateArray.size());
|
||||
return templateArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mbid
|
||||
* @return
|
||||
*/
|
||||
public Map<Long, List<List<EBDataReqDetailDto>>> appendDetailData(String mbid){
|
||||
Map<Long, List<List<EBDataReqDetailDto>>> detailDatas = new HashMap<Long, List<List<EBDataReqDetailDto>>>();
|
||||
List<String> detailList = new ArrayList<String>();
|
||||
detailList.add("zdm");
|
||||
detailList.add("zdmc");
|
||||
|
||||
long subformId = formFieldDao.queryTableFormIdByEb(Constants.templateTableZdb);
|
||||
log.error("subformId:{}",subformId);
|
||||
Map<String, Object> detailFieldMap = formFieldDao.queryDetailTableField(Constants.templateTable,Constants.templateTableZdb, detailList);
|
||||
log.error("detailFieldMap:{}",detailFieldMap.size());
|
||||
JSONArray formArray = esb2EsignTemplateFormUtil.queryTemplateFormData(mbid);
|
||||
// 明细数据参数
|
||||
log.error("formArray:{}",formArray.size());
|
||||
|
||||
List<List<EBDataReqDetailDto>> subFormDatas = new ArrayList<List<EBDataReqDetailDto>>();
|
||||
for(int i=0;i<formArray.size();i++){
|
||||
JSONObject formJson = formArray.getJSONObject(i);
|
||||
log.error("formJson:{}",formJson.toJSONString());
|
||||
List<EBDataReqDetailDto> subFormRowData = new ArrayList<>();
|
||||
for(int n=0;n<detailList.size();n++){
|
||||
if(formJson.containsKey(detailList.get(n)) && detailFieldMap.containsKey(detailList.get(n))){
|
||||
String value = formJson.getString(detailList.get(n));
|
||||
String fieldId = detailFieldMap.get(detailList.get(n)).toString();
|
||||
|
||||
log.error("fieldId2:{}",fieldId);
|
||||
log.error("value2:{}",value);
|
||||
subFormRowData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
subFormDatas.add(subFormRowData);
|
||||
}
|
||||
detailDatas.put(subformId, subFormDatas);
|
||||
|
||||
return detailDatas;
|
||||
}
|
||||
|
||||
|
||||
public List<EBDataReqDetailDto> appendMainData(JSONObject dataJson){
|
||||
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("mbid");
|
||||
fieldList.add("mbmc");
|
||||
fieldList.add("sfqy");
|
||||
|
||||
Map<String, Object> fieldMap = formFieldDao.queryFromTableField(Constants.templateTable,fieldList);
|
||||
log.error("fieldMap:{}",fieldMap.size());
|
||||
log.error("sfqy:{}",String.valueOf(fieldMap.get("sfqy")));
|
||||
|
||||
mainData.add(new EBDataReqDetailDto(String.valueOf(fieldMap.get("sfqy")), "1"));
|
||||
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
|
||||
}
|
||||
}
|
||||
return mainData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue