util加输出异常信息方法
parent
82670bae0e
commit
e272a1f295
|
@ -4068,5 +4068,30 @@ public class Util extends weaver.general.Util {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>将线程错误信息输出</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/17 16:43
|
||||||
|
* @param e 线程异常对象
|
||||||
|
**/
|
||||||
|
public static void logErrorStr(Throwable e){
|
||||||
|
logErrorStr(e, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>将线程错误信息输出</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/17 16:43
|
||||||
|
* @param e 线程异常对象
|
||||||
|
* @param logger 日志对象
|
||||||
|
**/
|
||||||
|
public static void logErrorStr(Throwable e, Logger logger){
|
||||||
|
if(null != logger){
|
||||||
|
logger.error(getErrString(e));
|
||||||
|
}else {
|
||||||
|
Util.getLogger().error(getErrString(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,50 +6,98 @@ import aiyh.utils.excention.CustomerException;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.api.xuanran.wang.eny.workflow.mapper.ExchangeRateMapper;
|
import com.api.xuanran.wang.eny.workflow.mapper.ExchangeRateMapper;
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.seconddev.ey.zhangm.util.EYSeconddevUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1></h1>
|
* <h1>根据接口币种数据以及流程币种转成对应的汇率</h1>
|
||||||
*
|
*
|
||||||
* @author xuanran.wang
|
* @author xuanran.wang
|
||||||
* @date 2023/7/14 15:02
|
* @date 2023/7/14 15:02
|
||||||
*/
|
*/
|
||||||
@Path("/wxr/eny/workflow/rate")
|
@Path("/wxr/ey/workflow/rate")
|
||||||
public class GetExchangeRate {
|
public class GetExchangeRate {
|
||||||
|
|
||||||
private final Logger log = Util.getLogger();
|
private final Logger log = Util.getLogger();
|
||||||
private final ExchangeRateMapper mapper = Util.getMapper(ExchangeRateMapper.class);
|
private final ExchangeRateMapper mapper = Util.getMapper(ExchangeRateMapper.class);
|
||||||
|
private EYSeconddevUtil eySeconddevUtil = null;
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/exchange")
|
@Path("/exchange")
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public String exchangeRate(@Context HttpServletRequest request,
|
public String exchangeRate(@Context HttpServletRequest request,
|
||||||
@Context HttpServletResponse response,
|
@Context HttpServletResponse response,
|
||||||
@RequestBody Map<String, String> params){
|
@RequestBody Map<String, Object> params){
|
||||||
try {
|
try {
|
||||||
|
if(eySeconddevUtil == null){
|
||||||
|
eySeconddevUtil = new EYSeconddevUtil();
|
||||||
|
}
|
||||||
// 地区
|
// 地区
|
||||||
String area = Util.null2DefaultStr(params.get("area"),"");
|
String date = Util.null2DefaultStr(params.get("date"),"");
|
||||||
// 本位币
|
// 本位币
|
||||||
String baseCurrency = Util.null2DefaultStr(params.get("baseCurrency"),"");
|
String baseCurrency = Util.null2DefaultStr(params.get("baseCurrency"),"");
|
||||||
// 接口币种
|
// 接口币种
|
||||||
String interfaceCurrency = Util.null2DefaultStr(params.get("interfaceCurrency"),"");
|
String interfaceCurrency = Util.null2DefaultStr(params.get("interfaceCurrency"),"");
|
||||||
if(StringUtils.isBlank(area) || StringUtils.isBlank(baseCurrency) || StringUtils.isBlank(interfaceCurrency)){
|
// 是否打印参数
|
||||||
|
String printParams = Util.null2DefaultStr(params.get("printParams"),"");
|
||||||
|
// rateType
|
||||||
|
String rateType = Util.null2DefaultStr(params.get("rateType"),"5");
|
||||||
|
// 字段名
|
||||||
|
List<Map<String,Object>> fieldList = (List<Map<String, Object>>) params.get("fieldList");
|
||||||
|
boolean print = "1".equals(printParams);
|
||||||
|
if(print){
|
||||||
|
log.info("params : " + JSONObject.toJSONString(params));
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(date) || StringUtils.isBlank(baseCurrency)
|
||||||
|
|| StringUtils.isBlank(interfaceCurrency) || CollectionUtils.isEmpty(fieldList)){
|
||||||
log.error("params : " + JSONObject.toJSONString(params));
|
log.error("params : " + JSONObject.toJSONString(params));
|
||||||
throw new CustomerException("参数不可为空!");
|
throw new CustomerException("参数不可为空!");
|
||||||
}
|
}
|
||||||
String interfac = mapper.selectCurrencyIdByCurrencyName(interfaceCurrency);
|
// 接口币种名称转OA数据id
|
||||||
return "";
|
String baseCurrencyName = mapper.selectCurrencyNameById(baseCurrency);
|
||||||
|
if(StringUtils.isBlank(baseCurrencyName)){
|
||||||
|
throw new CustomerException("当前币种id : " + interfaceCurrency + " 在oa表中没有找到对应的name!");
|
||||||
|
}
|
||||||
|
Map<String, Object> res = new HashMap<>();
|
||||||
|
for (Map<String, Object> map : fieldList) {
|
||||||
|
if(print){
|
||||||
|
log.info("map : " + JSONObject.toJSONString(map));
|
||||||
|
}
|
||||||
|
String money = Util.null2DefaultStr(map.get("money"), "");
|
||||||
|
String field = Util.null2DefaultStr(map.get("field"),"");
|
||||||
|
if(print){
|
||||||
|
log.info("field : " + field + " ,money : " + money + " ,baseCurrencyName : " +
|
||||||
|
baseCurrencyName + " ,interfaceCurrency : " + interfaceCurrency + " ,rateType : " + rateType + " ,date : " + date);
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(money) || StringUtils.isBlank(field)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Map<String, Object> rate = eySeconddevUtil.getExchargeRate(new BigDecimal(money), baseCurrencyName, interfaceCurrency, rateType, date);
|
||||||
|
if(print){
|
||||||
|
log.info("field : " + field + " ,rate : " + JSONObject.toJSONString(rate));
|
||||||
|
}
|
||||||
|
res.put(field, rate);
|
||||||
|
}
|
||||||
|
// 调方法获取汇率
|
||||||
|
return ApiResult.success(res);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return ApiResult.error("汇率转换error : " + e.getMessage());
|
log.error("exchangeRate error : " + e.getMessage());
|
||||||
|
log.error(Util.getErrString(e));
|
||||||
|
return ApiResult.error("汇率转换接口error : [ " + e.getMessage() + " ]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,6 @@ import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
*/
|
*/
|
||||||
@SqlMapper
|
@SqlMapper
|
||||||
public interface ExchangeRateMapper {
|
public interface ExchangeRateMapper {
|
||||||
@Select("select id from fnacurrency where currencyname = #{currencyName}")
|
@Select("select currencyname from fnacurrency where id = #{id}")
|
||||||
String selectCurrencyIdByCurrencyName(@ParamMapper("currencyName") String currencyName);
|
String selectCurrencyNameById(@ParamMapper("id") String id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.api.xuanran.wang.xk_hospital.data_async.controller;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>胸科医院数据同步</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/17 16:38
|
||||||
|
*/
|
||||||
|
@Path("/wxr/xk_hospital/common")
|
||||||
|
public class CommonDataAsyncController {
|
||||||
|
|
||||||
|
private final Logger logger = Util.getLogger();
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/{configId}}")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public String async(@Context HttpServletRequest request,
|
||||||
|
@Context HttpServletResponse response,
|
||||||
|
@PathParam("configId") String configId,
|
||||||
|
@RequestBody Map<String, Object> params){
|
||||||
|
try {
|
||||||
|
return "";
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("CommonDataAsyncController error : " + e.getMessage());
|
||||||
|
Util.logErrorStr(e, logger);
|
||||||
|
return ApiResult.error("数据同步失败! [ " + e.getMessage() + " ]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,212 @@
|
||||||
|
package weaver.formmode.customjavacode.modeexpand.ey.jiahx;
|
||||||
|
|
||||||
|
|
||||||
|
import com.api.nonstandardext.model_field_async.service.ModelFieldAsyncServiceImpl;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description
|
||||||
|
* @Author 贾寒旭
|
||||||
|
* @Date 2023/4/24
|
||||||
|
* @Other
|
||||||
|
* @Version
|
||||||
|
*/
|
||||||
|
public class UpdateStatusAchargeTwo extends AbstractModeExpandJavaCodeNew {
|
||||||
|
@Override
|
||||||
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
|
||||||
|
// src/weaver/formmode/customjavacode/modeexpand/getKmmb.java
|
||||||
|
baseBean.writeLog("保存自定义接口开始UpdateStatusAchargeTwo");
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
try {
|
||||||
|
User user = (User) param.get("user");
|
||||||
|
int billid = -1;//数据id
|
||||||
|
int modeid = -1;//模块id
|
||||||
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||||
|
if (requestInfo != null) {
|
||||||
|
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||||
|
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
if (billid > 0 && modeid > 0) {
|
||||||
|
// 撤销账单规则,当requestTypewb = (BillingReversal账单)根据原账单号oriInvoiceNo文本字段找到原账单主表和子表数据更新数据
|
||||||
|
String sql = "select m.id id,m.finishedTime finishedTime,m.requestTypewb requestTypewb,d.engCodewb engCodewb,m.invoiceNo invoiceNo,d.subInvoiceNo subInvoiceNo," +
|
||||||
|
"d.totalAmount totalAmount,m.oriInvoiceNo oriInvoiceNo,d.wskje wskje," +
|
||||||
|
"d.subTotal subTotalZeo,d.totalAmount totalAmountZeo,d.localTotalAmount as localTotalAmountlAmountZeo," +
|
||||||
|
"d.rmbTotalAmount as rmbTotalAmountZeo,d.balanceAmount as balanceAmountZeo from uf_zdjmbd_dt1 d left join uf_zdjmbd m on m.id = d.mainid where m.id = ?";
|
||||||
|
rs.executeQuery(sql, billid);
|
||||||
|
String mid = "";
|
||||||
|
while (rs.next()) {
|
||||||
|
mid = rs.getString("id");
|
||||||
|
String requestTypewb = rs.getString("requestTypewb");
|
||||||
|
if (requestTypewb.equals("credit_request")) {
|
||||||
|
String engCode = rs.getString("engCodewb");
|
||||||
|
String invoiceNo = rs.getString("invoiceNo");
|
||||||
|
String subInvoiceNo = rs.getString("subInvoiceNo");
|
||||||
|
String totalAmount = rs.getString("totalAmount");
|
||||||
|
String finishedTime = rs.getString("finishedTime");
|
||||||
|
double wskje = Util.getDoubleValue(rs.getString("wskje"), 0f);
|
||||||
|
String oriInvoiceNo = rs.getString("oriInvoiceNo");//原账单号
|
||||||
|
String sqls = "select d.mainid mainid,d.engCodewb engCodewb,d.wskje wskje from uf_zdjmbd_dt1 d left join uf_zdjmbd m on m.id = d.mainid where m.invoiceStatus='0' and m.invoiceNo = ?";
|
||||||
|
RecordSet rss = new RecordSet();
|
||||||
|
rss.executeQuery(sqls, oriInvoiceNo);
|
||||||
|
while (rss.next()) {
|
||||||
|
String orengCode = rss.getString("engCodewb");
|
||||||
|
String mainid = rss.getString("mainid");
|
||||||
|
double wskjeY = Util.getDoubleValue(rss.getString("wskje"), 0f);
|
||||||
|
if (orengCode.equals(engCode) && (Math.abs(Util.getDoubleValue(totalAmount, 0f)) < wskjeY)) {
|
||||||
|
// 1、插入撤销账单号的明细5冲销明细,生成对应新数据
|
||||||
|
// 冲销金额cxje=账单.冲销金额cxje + |撤销账单子表.项目代码一致的totalAmount|(绝对值)
|
||||||
|
String insertsql = "insert into uf_zdjmbd_dt5 (cxzdh,cxzzdh,zdh,zzdh,cxje,cxrq,engCodewb,mainid) values(?,?,?,?,?,?,?,?)";
|
||||||
|
RecordSet insertRs = new RecordSet();
|
||||||
|
insertRs.executeUpdate(insertsql, invoiceNo, subInvoiceNo, oriInvoiceNo, oriInvoiceNo, totalAmount, finishedTime, engCode, mainid);
|
||||||
|
String Qusql = "select cxje from uf_zdjmbd_dt1 where engCodewb = ? and mainid = ?";
|
||||||
|
RecordSet recordSet1 = new RecordSet();
|
||||||
|
recordSet1.executeQuery(Qusql, engCode, mainid);
|
||||||
|
while (recordSet1.next()) {
|
||||||
|
double cxje = Util.getDoubleValue(recordSet1.getString("cxje"), 0f);
|
||||||
|
cxje += Math.abs(Util.getDoubleValue(totalAmount));
|
||||||
|
String UpSql = "update uf_zdjmbd_dt1 set cxje = ? where engCodewb = ? and mainid = ?";
|
||||||
|
RecordSet recordSet = new RecordSet();
|
||||||
|
recordSet.executeUpdate(UpSql, cxje, engCode, mainid);
|
||||||
|
}
|
||||||
|
// 未收款金额wskje(需要先执行冲销金额的更新)
|
||||||
|
// 未收款金额wskje=uf_zdjmbd_dt1中的总金额totalAmount-已收款金额yskje-冲销金额cxje
|
||||||
|
String Upsql1 = "update uf_zdjmbd_dt1 set wskje = totalAmount-yskje-cxje-hxje where engCodewb = ? and mainid = ?";
|
||||||
|
RecordSet recordSet = new RecordSet();
|
||||||
|
recordSet.executeUpdate(Upsql1, engCode, mainid);
|
||||||
|
// 收款状态skzt
|
||||||
|
// 如果账单明细.未收款金额wskje > 0 则改为1,部分收款
|
||||||
|
// 如果账单明细.未收款金额wskje = 0 则改为2,全部收款
|
||||||
|
String Qsql1 = "select wskje from uf_zdjmbd_dt1 where engCodewb = ? and mainid = ? ";
|
||||||
|
recordSet.executeQuery(Qsql1, engCode, mainid);
|
||||||
|
String skzt = "";
|
||||||
|
while (recordSet.next()) {
|
||||||
|
double wskje1 = Util.getDoubleValue(recordSet.getString("wskje"), 0f);
|
||||||
|
if (wskje1 > 0) {
|
||||||
|
skzt = "1";
|
||||||
|
} else if (wskje == 0) {
|
||||||
|
skzt = "2";
|
||||||
|
} else {
|
||||||
|
skzt = "9";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String Upsql2 = "update uf_zdjmbd_dt1 set skzt = ? where engCodewb = ? and mainid = ?";
|
||||||
|
RecordSet recordSet2 = new RecordSet();
|
||||||
|
recordSet2.executeUpdate(Upsql2, skzt, engCode, mainid);
|
||||||
|
|
||||||
|
// 2、更新账单uf_zdjmbd的主表中冲销金额cxje:
|
||||||
|
// 冲销金额cxje
|
||||||
|
// 冲销金额cxje=uf_zdjmbd_dt1中的冲销金额cxje合计
|
||||||
|
// 未收款金额wskje
|
||||||
|
// 未收款金额wskje=uf_zdjmbd_dt1中的未收款金额wskje合计
|
||||||
|
// 收款状态skzt
|
||||||
|
// 如果账单明细1.未收款金额合计wskje > 0 则改为1,部分收款
|
||||||
|
// 如果账单明细1.未收款金额合计wskje = 0 则改为2,全部收款
|
||||||
|
// 账单状态invoiceStatus
|
||||||
|
// 如果账单明细1.未收款金额合计wskje = 0 则改为2,close
|
||||||
|
RecordSet Mrs = new RecordSet();
|
||||||
|
String Msql = "select * from uf_zdjmbd_dt1 where mainid = ?";
|
||||||
|
double cxje1 = 0;
|
||||||
|
double wskje1 = 0;
|
||||||
|
String M_skzt = "";
|
||||||
|
String invoiceStatus = "";
|
||||||
|
Mrs.executeQuery(Msql, mainid);
|
||||||
|
while (Mrs.next()) {
|
||||||
|
cxje1 += Util.getDoubleValue(Mrs.getString("cxje"), 0f);
|
||||||
|
wskje1 += Util.getDoubleValue(Mrs.getString("wskje"), 0f);
|
||||||
|
if (wskje1 > 0) {
|
||||||
|
M_skzt = "1";
|
||||||
|
invoiceStatus = "0";
|
||||||
|
} else if (wskje1 == 0) {
|
||||||
|
M_skzt = "2";
|
||||||
|
invoiceStatus = "1";
|
||||||
|
} else {
|
||||||
|
M_skzt = "1";
|
||||||
|
invoiceStatus = "0";
|
||||||
|
}
|
||||||
|
String mainidC = Mrs.getString("mainid");
|
||||||
|
String Mupsql = "update uf_zdjmbd set cxje =?,wskje = ?,skzt = ?,invoiceStatus = ? where id = ?";
|
||||||
|
baseBean.writeLog("Mupsql=====" + Mupsql);
|
||||||
|
recordSet2.executeUpdate(Mupsql, cxje1, wskje1, M_skzt, invoiceStatus, mainidC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过配置同步字段
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023-06-27
|
||||||
|
*/
|
||||||
|
new ModelFieldAsyncServiceImpl().asyncDataByClassName(this.getClass().getSimpleName(), String.valueOf(billid));
|
||||||
|
}
|
||||||
|
String Usql = "update uf_zdjmbd set invoiceStatus = '1' where id = ?";
|
||||||
|
RecordSet Urs = new RecordSet();
|
||||||
|
Urs.executeUpdate(Usql, billid);
|
||||||
|
} else if ("zb_request".equals(requestTypewb)) {
|
||||||
|
// baseBean.writeLog("零账单处理>>>>>>>>>>>>>");
|
||||||
|
// String engCode = rs.getString("engCodewb");
|
||||||
|
// String invoiceNo = rs.getString("invoiceNo");
|
||||||
|
// String subInvoiceNo = rs.getString("subInvoiceNo");
|
||||||
|
// //2023年6月1日 新增零账单数据处理 --cds
|
||||||
|
// String querySql = "select m.id mainid,d.id id,d.engCodewb engCodewb,d.subInvoiceNo as subInvoiceNo from uf_zdjmbd_dt1 d left join uf_zdjmbd m on m.id = d.mainid where m.invoiceStatus='0' and m.invoiceNo = ?";
|
||||||
|
// RecordSet rs1 = new RecordSet();
|
||||||
|
// rs1.executeQuery(querySql, invoiceNo);
|
||||||
|
// while (rs1.next()) {
|
||||||
|
// String engCodewb = Util.null2String(rs1.getString("engCodewb"));
|
||||||
|
// String subInvoiceNo_dt = Util.null2String(rs1.getString("subInvoiceNo"));
|
||||||
|
// String dtid = Util.null2String(rs1.getString("id"));
|
||||||
|
// if (engCodewb.equals(engCode) && subInvoiceNo_dt.equals(subInvoiceNo)) {
|
||||||
|
// /*1、更新正数账单uf_zdjmbd_dt1子表的字段
|
||||||
|
// subTotal
|
||||||
|
// subTotal = 正数账单中的subTotal+零账单子表.subTotal
|
||||||
|
// totalAmount
|
||||||
|
// totalAmount = 正数账单中的totalAmount+零账单子表.totalAmount
|
||||||
|
// localTotalAmount
|
||||||
|
// localTotalAmountlAmount = 正数账单中的localTotalAmountlAmount+零账单子表.localTotalAmountlAmount
|
||||||
|
// rmbTotalAmount
|
||||||
|
// rmbTotalAmount = 正数账单中的rmbTotalAmount+零账单子表.rmbTotalAmount
|
||||||
|
// balanceAmount
|
||||||
|
// balanceAmount = 正数账单中的balanceAmount+零账单子表.balanceAmount
|
||||||
|
// */
|
||||||
|
// double subTotal = Util.getDoubleValue(rs.getString("subTotalZeo"), 0f);
|
||||||
|
// double totalAmount = Util.getDoubleValue(rs.getString("totalAmountZeo"), 0f);
|
||||||
|
// double localTotalAmountlAmount = Util.getDoubleValue(rs.getString("localTotalAmountlAmountZeo"), 0f);
|
||||||
|
// double rmbTotalAmount = Util.getDoubleValue(rs.getString("rmbTotalAmountZeo"), 0f);
|
||||||
|
// double balanceAmount = Util.getDoubleValue(rs.getString("balanceAmountZeo"), 0f);
|
||||||
|
//
|
||||||
|
// String updateSql = "update uf_zdjmbd_dt1 set subTotal=ifnull(subTotal,0)+" + subTotal + ",totalAmount=ifnull(totalAmount,0)+" + totalAmount + ",localTotalAmount=ifnull(localTotalAmount,0)+" + localTotalAmountlAmount + ",rmbTotalAmount=ifnull(rmbTotalAmount,0)+" + rmbTotalAmount + ",balanceAmount=ifnull(balanceAmount,0)+" + balanceAmount + " where id=" + dtid;
|
||||||
|
// baseBean.writeLog("更新零账单updateSql: " + updateSql);
|
||||||
|
// RecordSet updateRs = new RecordSet();
|
||||||
|
// boolean updateFlag = updateRs.executeUpdate(updateSql);
|
||||||
|
// baseBean.writeLog("更新零账单updateFlag: " + updateFlag);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// //更新零账单主表的账单状态invoiceStatus改为1,close
|
||||||
|
// if (!"".equals(mid)) {
|
||||||
|
// String updateSql = "update uf_zdjmbd set invoiceStatus='1' where id=" + mid;
|
||||||
|
// baseBean.writeLog("更新零账单主表账单状态Sql:" + updateSql);
|
||||||
|
// boolean flag = rs.executeUpdate(updateSql);
|
||||||
|
// baseBean.writeLog("更新零账单主表账单状态flag:" + flag);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
baseBean.writeLog("UpdateStatusAchargeTwo catch exception:" + e);
|
||||||
|
result.put("errmsg", "自定义出错信息");
|
||||||
|
result.put("flag", "false");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,342 +0,0 @@
|
||||||
package weaver.formmode.interfaces.impl.ey.zhang;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import weaver.conn.RecordSet;
|
|
||||||
import weaver.file.ExcelParseForPOI;
|
|
||||||
import weaver.formmode.interfaces.ImportPreInterfaceForPOIAction;
|
|
||||||
import weaver.general.BaseBean;
|
|
||||||
import weaver.general.Util;
|
|
||||||
import weaver.hrm.User;
|
|
||||||
import weaver.seconddev.ey.zhangm.didi.util.DaoUtils;
|
|
||||||
import weaver.seconddev.ey.zhangm.util.EYSeconddevUtil;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description
|
|
||||||
* @Author miao.zhang <yyem954135@163.com>
|
|
||||||
* @Version V1.0.0
|
|
||||||
* @Since 1.0
|
|
||||||
* @Date 6/22/23
|
|
||||||
*/
|
|
||||||
public class ImportExtValidateTemplate implements ImportPreInterfaceForPOIAction {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String checkImportData(Map <String, Object> param, User user, ExcelParseForPOI excelParse) {
|
|
||||||
|
|
||||||
EYSeconddevUtil eySeconddevUtil = new EYSeconddevUtil();
|
|
||||||
String ssids="ey_clentid_col,budget_version_col,plan_source_col,ey_bucode_col,ey_oucode_col,ey_mucode_col,ey_smucode_col,ey_engagementname_col,ey_ep_col,ey_em_col,ey_pfma_col,";
|
|
||||||
ssids=ssids+"ey_local_service_code_col,ey_mercury_code_col,ey_pycode_col,ey_pacelink_col,ey_oppr_code_col,ey_blocking_level_col,opencheckcustom,";
|
|
||||||
ssids=ssids+"opencheckbudget,opencheckcodeblock,opencheckgpn,opencheckengagementname,opencheckpycode,opencheckcodeblockByBcp,openchecklocalservicecode,";
|
|
||||||
ssids=ssids+"opencheckconfidential,opencheckopprCode,opencheckmercury,opencheckblocklevel";
|
|
||||||
Map<String, String> ey_params_map =eySeconddevUtil.getSystemParamValues(ssids);
|
|
||||||
|
|
||||||
int ey_clentid_col = Util.getIntValue(ey_params_map.get("ey_clentid_col"));
|
|
||||||
int budget_version_col = Util.getIntValue(ey_params_map.get("budget_version_col"));
|
|
||||||
int plan_source_col = Util.getIntValue(ey_params_map.get("plan_source_col"));
|
|
||||||
int ey_bucode_col = Util.getIntValue(ey_params_map.get("ey_bucode_col"));
|
|
||||||
int ey_oucode_col = Util.getIntValue(ey_params_map.get("ey_oucode_col"));
|
|
||||||
int ey_mucode_col = Util.getIntValue(ey_params_map.get("ey_mucode_col"));
|
|
||||||
int ey_smucode_col = Util.getIntValue(ey_params_map.get("ey_smucode_col"));
|
|
||||||
int ey_engagementname_col = Util.getIntValue(ey_params_map.get("ey_engagementname_col"));
|
|
||||||
int ey_ep_col = Util.getIntValue(ey_params_map.get("ey_ep_col"));
|
|
||||||
int ey_em_col = Util.getIntValue(ey_params_map.get("ey_em_col"));
|
|
||||||
int ey_pfma_col = Util.getIntValue(ey_params_map.get("ey_pfma_col"));
|
|
||||||
int ey_local_service_code_col = Util.getIntValue(ey_params_map.get("ey_local_service_code_col"));
|
|
||||||
int ey_mercury_code_col = Util.getIntValue(ey_params_map.get("ey_mercury_code_col"));
|
|
||||||
int ey_pycode_col = Util.getIntValue(ey_params_map.get("ey_pycode_col"));
|
|
||||||
int ey_pacelink_col = Util.getIntValue(ey_params_map.get("ey_pacelink_col"));
|
|
||||||
int ey_oppr_code_col = Util.getIntValue(ey_params_map.get("ey_oppr_code_col"));
|
|
||||||
int ey_blocking_level_col = Util.getIntValue(ey_params_map.get("ey_blocking_level_col"));
|
|
||||||
String opencheckcustom = Util.null2String(ey_params_map.get("opencheckcustom"));
|
|
||||||
String opencheckbudget = Util.null2String(ey_params_map.get("opencheckbudget"));
|
|
||||||
String opencheckcodeblock = Util.null2String(ey_params_map.get("opencheckcodeblock"));
|
|
||||||
String opencheckgpn = Util.null2String(ey_params_map.get("opencheckgpn"));
|
|
||||||
String opencheckengagementname = Util.null2String(ey_params_map.get("opencheckengagementname"));
|
|
||||||
String opencheckpycode = Util.null2String(ey_params_map.get("opencheckpycode"));
|
|
||||||
String opencheckcodeblockByBcp = Util.null2String(ey_params_map.get("opencheckcodeblockByBcp"));
|
|
||||||
String openchecklocalservicecode = Util.null2String(ey_params_map.get("openchecklocalservicecode"));
|
|
||||||
String opencheckconfidential = Util.null2String(ey_params_map.get("opencheckconfidential"));
|
|
||||||
String opencheckopprCode =Util.null2String(ey_params_map.get("opencheckopprCode"));
|
|
||||||
String opencheckmercury =Util.null2String(ey_params_map.get("opencheckmercury"));
|
|
||||||
String opencheckblocklevel =Util.null2String(ey_params_map.get("opencheckblocklevel"));
|
|
||||||
|
|
||||||
new BaseBean().writeLog("opencheckcustom==>" + opencheckcustom+",opencheckbudget==>"+opencheckbudget+",opencheckcodeblock==>"+opencheckcodeblock);
|
|
||||||
new BaseBean().writeLog("opencheckgpn==>" + opencheckgpn+",opencheckengagementname==>"+opencheckengagementname+",opencheckpycode==>"+opencheckpycode);
|
|
||||||
new BaseBean().writeLog("opencheckcodeblockByBcp==>" + opencheckcodeblockByBcp+",openchecklocalservicecode==>"+openchecklocalservicecode+",opencheckconfidential==>"+opencheckconfidential);
|
|
||||||
new BaseBean().writeLog("opencheckopprCode==>" + opencheckopprCode+",opencheckmercury==>"+opencheckmercury);
|
|
||||||
|
|
||||||
|
|
||||||
// 获取模块ID
|
|
||||||
Integer modeId = Util.getIntValue(param.get("modeid").toString());
|
|
||||||
//表单id
|
|
||||||
Integer formId = Util.getIntValue(param.get("formid").toString());
|
|
||||||
// 获取当前登录人员ID
|
|
||||||
Integer userId = user.getUID();
|
|
||||||
String sheetname = "1";
|
|
||||||
//获取第 sheetindex 个sheet的第row行第col列的单元格的值 (下标都是从1开始)
|
|
||||||
//String value = excelParse.getValue("1", 2, 2);
|
|
||||||
Workbook wb = excelParse.getWb();
|
|
||||||
Sheet sheet = wb.getSheetAt(Util.getIntValue(sheetname) - 1);
|
|
||||||
StringBuilder error = new StringBuilder();
|
|
||||||
Pattern DATE_PATTERN = Pattern.compile("^\\d{4}-\\d{2}$");
|
|
||||||
if (sheet != null) {
|
|
||||||
int rowSum = sheet.getPhysicalNumberOfRows();
|
|
||||||
new BaseBean().writeLog("rowSum==>" + rowSum);
|
|
||||||
int current_row = 0;
|
|
||||||
for (int i = 2; i <= rowSum; i++) {
|
|
||||||
current_row = i - 1;
|
|
||||||
String client_id = Util.null2String(excelParse.getValue("1", i, ey_clentid_col));
|
|
||||||
String budget_version_id = Util.null2String(excelParse.getValue("1", i, budget_version_col));
|
|
||||||
String bucode = Util.null2String(excelParse.getValue("1", i, ey_bucode_col));
|
|
||||||
String oucode = Util.null2String(excelParse.getValue("1", i, ey_oucode_col));
|
|
||||||
String mucode = Util.null2String(excelParse.getValue("1", i, ey_mucode_col));
|
|
||||||
String plan_source = Util.null2String(excelParse.getValue("1", i, plan_source_col));
|
|
||||||
String smucode = Util.null2String(excelParse.getValue("1", i, ey_smucode_col));
|
|
||||||
String engagement_name = Util.null2String(excelParse.getValue("1", i, ey_engagementname_col)).trim();
|
|
||||||
String ep = Util.null2String(excelParse.getValue("1", i, ey_ep_col));
|
|
||||||
String em = Util.null2String(excelParse.getValue("1", i, ey_em_col));
|
|
||||||
String pfma = Util.null2String(excelParse.getValue("1", i, ey_pfma_col));
|
|
||||||
String pycode = Util.null2String(excelParse.getValue("1", i, ey_pycode_col)).trim();
|
|
||||||
String blocking_level= Util.null2String(excelParse.getValue("1", i, ey_blocking_level_col)).trim();
|
|
||||||
new BaseBean().writeLog("pycode==>"+pycode);
|
|
||||||
|
|
||||||
|
|
||||||
String pace_link = Util.null2String(excelParse.getValue("1", i, ey_pacelink_col)).trim();
|
|
||||||
String local_service_code =Util.null2String(excelParse.getValue("1", i, ey_local_service_code_col)).trim();
|
|
||||||
String opprCode =Util.null2String(excelParse.getValue("1", i, ey_oppr_code_col)).trim();
|
|
||||||
String mercury_code =Util.null2String(excelParse.getValue("1", i, ey_mercury_code_col)).trim();
|
|
||||||
String countryregioncode =Util.null2String(DaoUtils.querySingleVal("select countryregioncode from uf_Codeblockjcdab where bucode=? and oucode=? and mucode=? and smucode=?",bucode, oucode, mucode, smucode));
|
|
||||||
String local_global_service_code =DaoUtils.querySingleVal("select global_service_code from uf_service_code where Servicecode=?",local_service_code);
|
|
||||||
new BaseBean().writeLog("====1、mercury_code===="+mercury_code );
|
|
||||||
String mercury_global_service_code =DaoUtils.querySingleVal("select global_service_code from uf_msc_gsc where mercury_service_code=?",mercury_code);
|
|
||||||
|
|
||||||
//1、Excel模版 BU 、OU、MU、SMU校验:是否存在对应codeblock Done
|
|
||||||
if (opencheckcodeblock.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====1、opencheckcodeblock.start====" );
|
|
||||||
RecordSet recordSet = DaoUtils.executeQuery("select " +
|
|
||||||
" count(1) as rowcount " +
|
|
||||||
" from uf_Codeblockjcdab where bucode=? and oucode=? and mucode=? and smucode=?", bucode, oucode, mucode, smucode);
|
|
||||||
if (recordSet.next()) {
|
|
||||||
int rowcount = recordSet.getInt("rowcount");
|
|
||||||
if (rowcount > 1) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认codeblock是否唯一!").append("<BR />");
|
|
||||||
} else if (rowcount == 0) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,未匹配到对应codeblock数据!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new BaseBean().writeLog("====1、opencheckcodeblock.end====" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//2、Excel模版 BU 、OU、MU、SMU校验:调用业务核心接口 Done
|
|
||||||
if (opencheckcodeblockByBcp.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====2、opencheckcodeblockByBcp.start====" );
|
|
||||||
boolean flag =eySeconddevUtil.getLegalEffective(bucode,oucode,mucode,smucode);
|
|
||||||
new BaseBean().writeLog("getLegalEffective===>"+flag);
|
|
||||||
if(!flag){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认Bu,Ou,Mu,Smu有效性! ").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====2、opencheckcodeblockByBcp.end====" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//3、Excel模版商机校验:国家编号不是MNG,商机id必填 Done
|
|
||||||
if (opencheckopprCode.equals("1") ) {
|
|
||||||
new BaseBean().writeLog("====3、opencheckopprCode.start====" );
|
|
||||||
new BaseBean().writeLog("====3、countryregioncode===="+countryregioncode );
|
|
||||||
if(StringUtils.isNotBlank(countryregioncode)){
|
|
||||||
if( !countryregioncode.equals("MNG") && opprCode.equals("")){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,商机id必填! ").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new BaseBean().writeLog("====3、opencheckopprCode.end====" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//4、Excel模版Client_id校验 Done
|
|
||||||
if (opencheckcustom.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====4、opencheckcustom.start====" );
|
|
||||||
Map <String, Object> custominfo = eySeconddevUtil.getCustomInfo(client_id);
|
|
||||||
String code = Util.null2String((String)custominfo.get("code"));
|
|
||||||
new BaseBean().writeLog("getCustomInfo===>"+code);
|
|
||||||
if (!code.equals("100")) {
|
|
||||||
//return "数据验证失败:第一个sheet第"+current_row+"行数据的,请确认客户中心系统中已存在该客户!";
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认客户中心系统中已存在该客户! ")
|
|
||||||
.append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====4、opencheckcustom.end====" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//5、Excel模版Client_id,商机id,PACE_ID(截取PACE_link) 校验项 :前置条件:国家编号不是MNG,
|
|
||||||
// 调用商机接口传入Client_id,商机id,PACE_ID 是否有效,有效返回IsConfidential Done
|
|
||||||
if (opencheckconfidential.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====5、opencheckconfidential.start====" );
|
|
||||||
String pace_id ="";
|
|
||||||
if(StringUtils.isNotBlank(pace_link)){
|
|
||||||
int beginindex =pace_link.lastIndexOf("Assessment/")+11;
|
|
||||||
String endstr =pace_link.substring(beginindex,pace_link.length());
|
|
||||||
int endindex = endstr.lastIndexOf("/");
|
|
||||||
pace_id =pace_link.substring(beginindex,beginindex+endindex);
|
|
||||||
new BaseBean().writeLog("ModeExpandForExtCodeImport,pace_id==>"+pace_id);
|
|
||||||
}
|
|
||||||
Map<String,Object > result =eySeconddevUtil.getConfidentialInfo(opprCode,pace_id,client_id);
|
|
||||||
String errstr =Util.null2String(result.get("errorstr"));
|
|
||||||
if(StringUtils.isNotBlank(errstr)){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据,请确认"+errstr.substring(0,errstr.length()-1)+"等问题! ")
|
|
||||||
.append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====5、opencheckconfidential.end====" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//6、Excel模版”PY_Code” 校验: PY code 历史上是否存在对应的.engagement_code Done
|
|
||||||
if (opencheckpycode.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====6、opencheckpycode.start====" );
|
|
||||||
new BaseBean().writeLog("====6、opencheckpycode.pycode===="+pycode );
|
|
||||||
if(StringUtils.isNotBlank(pycode)){
|
|
||||||
RecordSet rs2 = new RecordSet();
|
|
||||||
rs2.executeQuery("select id from uf_xmjbxxjmbd where engagement_code=?", pycode);
|
|
||||||
if (!rs2.next()) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,该项目PY_CODE未关联! ").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====6、opencheckpycode.end====" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//7、Excel模版“本地服务编码”校验:uf_service_code.Servicecode 是否存在 Done
|
|
||||||
if (openchecklocalservicecode.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====7、openchecklocalservicecode.start====" );
|
|
||||||
RecordSet rs2 = new RecordSet();
|
|
||||||
new BaseBean().writeLog("====7、openchecklocalservicecode.local_service_code====" +local_service_code);
|
|
||||||
rs2.executeQuery("select id from uf_service_code where Servicecode=? ",local_service_code);
|
|
||||||
if(!rs2.next()){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认本地服务编码是否有效! ").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====7、openchecklocalservicecode.end====" );
|
|
||||||
}
|
|
||||||
|
|
||||||
//8、Excel模版“计划编号”校验项 ,根据“计划来源”,调用CCT&MMT或者SmartHub接口是否存在 Done
|
|
||||||
if (opencheckbudget.equals("1")) {
|
|
||||||
new BaseBean().writeLog("==8、opencheckbudget。start==");
|
|
||||||
Map <String, Object> budgetinfo = new HashMap <String, Object>();
|
|
||||||
new BaseBean().writeLog("==plan_source=="+plan_source);
|
|
||||||
if(!(plan_source.equals("CCT") || plan_source.equals("MMT") || plan_source.equals("SmartHub") )){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,计划来源填写错误只允许填写CCT、MMT、SmartHub!").append("<BR />");
|
|
||||||
}
|
|
||||||
if (plan_source.equals("CCT") || plan_source.equals("MMT")) {
|
|
||||||
budgetinfo = eySeconddevUtil.getBudgetInfo("mmtplandetail", budget_version_id);
|
|
||||||
} else {
|
|
||||||
budgetinfo = eySeconddevUtil.getBudgetInfo("smarthubbudgetdetail", budget_version_id);
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("==budgetinfo=="+ JSON.toJSONString(budgetinfo));
|
|
||||||
if (budgetinfo.isEmpty() || budgetinfo==null) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认预算系统中是否存在该预算!").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("==8、opencheckbudget。end==");
|
|
||||||
}
|
|
||||||
|
|
||||||
//9、Excel模版GPN是否存在 Done
|
|
||||||
if (opencheckgpn.equals("1")) {
|
|
||||||
|
|
||||||
new BaseBean().writeLog("==9、opencheckgpn。start==");
|
|
||||||
new BaseBean().writeLog("em==>"+em);
|
|
||||||
new BaseBean().writeLog("ep==>"+ep);
|
|
||||||
new BaseBean().writeLog("pfma==>"+pfma);
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(ep)) {
|
|
||||||
RecordSet recordSet=new RecordSet();
|
|
||||||
recordSet.executeQuery("select id from hrmresource where workcode=?",ep);
|
|
||||||
if(!recordSet.next()){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认EP的GPN不存在系统中!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(em)) {
|
|
||||||
RecordSet recordSet=new RecordSet();
|
|
||||||
recordSet.executeQuery("select id from hrmresource where workcode=?",em);
|
|
||||||
if(!recordSet.next()){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认EP的GPN不存在系统中!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(pfma)) {
|
|
||||||
RecordSet recordSet=new RecordSet();
|
|
||||||
recordSet.executeQuery("select id from hrmresource where workcode=?",pfma);
|
|
||||||
if(!recordSet.next()){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认PFMA的GPN不存在系统中!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("==9、opencheckgpn。end==");
|
|
||||||
}
|
|
||||||
|
|
||||||
//10、mercury_service_code校验 Done
|
|
||||||
if(opencheckmercury.equals("1")){
|
|
||||||
new BaseBean().writeLog("==10、opencheckmercury。start==");
|
|
||||||
new BaseBean().writeLog("====10、mercury_global_service_code===="+mercury_global_service_code );
|
|
||||||
new BaseBean().writeLog("====10、local_global_service_code===="+local_global_service_code );
|
|
||||||
if(!mercury_global_service_code.equals(local_global_service_code)){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认MercuryCode与global_service_code不匹配!").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("==10、opencheckmercury。end==");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//11、Excel的项目名称 Done
|
|
||||||
if (opencheckengagementname.equals("1")) {
|
|
||||||
new BaseBean().writeLog("==11、opencheckengagementname。start==");
|
|
||||||
new BaseBean().writeLog("==11、opencheckengagementname。engagement_name=="+engagement_name);
|
|
||||||
RecordSet recordSet = new RecordSet();
|
|
||||||
recordSet.executeQuery("select " +
|
|
||||||
" servicelinecode, subservicelinecode " +
|
|
||||||
" from uf_Codeblockjcdab where bucode=? and oucode=? and mucode=? and smucode=?", bucode, oucode, mucode, smucode);
|
|
||||||
if(recordSet.next()){
|
|
||||||
String servicelinecode =Util.null2String(recordSet.getString("servicelinecode"));
|
|
||||||
String subservicelinecode =Util.null2String(recordSet.getString("subservicelinecode"));
|
|
||||||
if(servicelinecode.equals("01") && subservicelinecode.equals("0101")){ //serviceline=01和subserviceline=0101时,触发项目名称校验
|
|
||||||
//检验 :0~3位 必须是AUT 或者 INT
|
|
||||||
boolean flag = EYSeconddevUtil.vaildateImportEnagementName(engagement_name,local_global_service_code);
|
|
||||||
String datestr = engagement_name.substring(3, 10);
|
|
||||||
if(!flag){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认前3位是否合规! ").append("<BR />");
|
|
||||||
}else if(!DATE_PATTERN.matcher(datestr).matches()){ //检验:4~10位 必须是YYYY-MM
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认4到10位是否日期字段,如:2001-01! ").append("<BR />");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("==11、opencheckengagementname。end==");
|
|
||||||
}
|
|
||||||
|
|
||||||
//12、BlockLevel Done
|
|
||||||
if(opencheckblocklevel.equals("1")){
|
|
||||||
new BaseBean().writeLog("==12、opencheckblocklevel.start==");
|
|
||||||
if (StringUtils.isNotBlank(ep)) {
|
|
||||||
RecordSet recordSet=new RecordSet();
|
|
||||||
recordSet.executeQuery("select id from uf_bl where engblocklevel =?",blocking_level);
|
|
||||||
if(!recordSet.next()){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,blocking_level填写有误请检查!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("==12、opencheckblocklevel.end==");
|
|
||||||
}
|
|
||||||
// 12、校验项目EP Rank
|
|
||||||
if (!"".equals(ep) && !eySeconddevUtil.validateEngagementRoleRank(ep,"1","0")) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,EP填写有误请检查!").append("<BR />");
|
|
||||||
}
|
|
||||||
// 13、校验项目EM Rank
|
|
||||||
if (!"".equals(em) && !eySeconddevUtil.validateEngagementRoleRank(em,"1","0")) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,EM填写有误请检查!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String returnstr =error.toString();
|
|
||||||
new BaseBean().writeLog("returnstr===>"+returnstr);
|
|
||||||
return returnstr;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,307 +0,0 @@
|
||||||
package weaver.formmode.interfaces.impl.ey.zhang;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import weaver.conn.RecordSet;
|
|
||||||
import weaver.file.ExcelParseForPOI;
|
|
||||||
import weaver.formmode.interfaces.ImportPreInterfaceForPOIAction;
|
|
||||||
import weaver.general.BaseBean;
|
|
||||||
import weaver.general.Util;
|
|
||||||
import weaver.hrm.User;
|
|
||||||
import weaver.seconddev.ey.zhangm.didi.util.DaoUtils;
|
|
||||||
import weaver.seconddev.ey.zhangm.util.EYSeconddevUtil;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description
|
|
||||||
* @Author miao.zhang <yyem954135@163.com>
|
|
||||||
* @Version V1.0.0
|
|
||||||
* @Since 1.0
|
|
||||||
* @Date 6/22/23
|
|
||||||
*/
|
|
||||||
public class ImportNtoOValidateTemplate implements ImportPreInterfaceForPOIAction {
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String checkImportData(Map <String, Object> param, User user, ExcelParseForPOI excelParse) {
|
|
||||||
|
|
||||||
EYSeconddevUtil eySeconddevUtil = new EYSeconddevUtil();
|
|
||||||
|
|
||||||
|
|
||||||
String ssids="ey_nto_clentid_col,ey_nto_budget_version_col,ey_nto_bucode_col,ey_nto_oucode_col,ey_nto_mucode_col,ey_nto_smucode_col,ey_nto_engagementname_col,ey_nto_ep_col,ey_nto_em_col,ey_nto_pfma_col,";
|
|
||||||
ssids=ssids+"ey_nto_engagementcode_col,ey_nto_mercurycode_col,ey_nto_pacelink_col,opencheckntooengagementstatus,";
|
|
||||||
ssids=ssids+"opencheckntooservicecode,opencheckntooserviceline,opencheckntopycode,opencheckntoengagementname,opencheckntocustom,opencheckntocodeblock,opencheckntogpn,";
|
|
||||||
ssids=ssids+"opencheckntobudget,opencheckntomercury,opencheckntopaceid";
|
|
||||||
Map<String, String> ey_params_map =eySeconddevUtil.getSystemParamValues(ssids);
|
|
||||||
|
|
||||||
|
|
||||||
int ey_clentid_col = Util.getIntValue(ey_params_map.get("ey_nto_clentid_col"));
|
|
||||||
int budget_version_col = Util.getIntValue(ey_params_map.get("ey_nto_budget_version_col"));
|
|
||||||
int ey_bucode_col = Util.getIntValue(ey_params_map.get("ey_nto_bucode_col"));
|
|
||||||
int ey_oucode_col = Util.getIntValue(ey_params_map.get("ey_nto_oucode_col"));
|
|
||||||
int ey_mucode_col = Util.getIntValue(ey_params_map.get("ey_nto_mucode_col"));
|
|
||||||
int ey_smucode_col = Util.getIntValue(ey_params_map.get("ey_nto_smucode_col"));
|
|
||||||
int ey_engagementname_col = Util.getIntValue(ey_params_map.get("ey_nto_engagementname_col"));
|
|
||||||
int ey_ep_col = Util.getIntValue(ey_params_map.get("ey_nto_ep_col"));
|
|
||||||
int ey_em_col = Util.getIntValue(ey_params_map.get("ey_nto_em_col"));
|
|
||||||
int ey_pfma_col = Util.getIntValue(ey_params_map.get("ey_nto_pfma_col"));
|
|
||||||
int ey_engagementcode_col = Util.getIntValue(ey_params_map.get("ey_nto_engagementcode_col"));
|
|
||||||
int ey_mercurycode_col = Util.getIntValue(ey_params_map.get("ey_nto_mercurycode_col"));
|
|
||||||
int ey_pacelink_col = Util.getIntValue(ey_params_map.get("ey_nto_pacelink_col"));
|
|
||||||
|
|
||||||
String opencheckntooengagementstatus = Util.null2String(ey_params_map.get("opencheckntooengagementstatus"));
|
|
||||||
String opencheckntoservicecode = Util.null2String(ey_params_map.get("opencheckntooservicecode"));
|
|
||||||
String opencheckntoserviceline = Util.null2String(ey_params_map.get("opencheckntooserviceline"));
|
|
||||||
String opencheckntopycode = Util.null2String(ey_params_map.get("opencheckntopycode"));
|
|
||||||
String opencheckntoengagementname = Util.null2String(ey_params_map.get("opencheckntoengagementname"));
|
|
||||||
String opencheckntocustom = Util.null2String(ey_params_map.get("opencheckntocustom"));
|
|
||||||
String opencheckntocodeblock= Util.null2String(ey_params_map.get("opencheckntocodeblock"));
|
|
||||||
String opencheckntogpn= Util.null2String(ey_params_map.get("opencheckntogpn"));
|
|
||||||
String opencheckntobudget = Util.null2String(ey_params_map.get("opencheckntobudget"));
|
|
||||||
String opencheckntomercury= Util.null2String(ey_params_map.get("opencheckntomercury"));
|
|
||||||
String opencheckntopaceid = Util.null2String(ey_params_map.get("opencheckntopaceid"));
|
|
||||||
|
|
||||||
new BaseBean().writeLog("opencheckntooengagementstatus==>" + opencheckntooengagementstatus+",opencheckntoservicecode==>"+opencheckntoservicecode+",opencheckntoserviceline==>"+opencheckntoserviceline);
|
|
||||||
new BaseBean().writeLog("opencheckntopycode==>" + opencheckntopycode+",opencheckntoengagementname==>"+opencheckntoengagementname+",opencheckntocustom==>"+opencheckntocustom);
|
|
||||||
new BaseBean().writeLog("opencheckntocodeblock==>" + opencheckntocodeblock+",opencheckntogpn==>"+opencheckntogpn+",opencheckntobudget==>"+opencheckntobudget);
|
|
||||||
new BaseBean().writeLog("opencheckntomercury==>" + opencheckntomercury+",opencheckntopaceid==>"+opencheckntopaceid);
|
|
||||||
|
|
||||||
|
|
||||||
// 获取模块ID
|
|
||||||
Integer modeId = Util.getIntValue(param.get("modeid").toString());
|
|
||||||
//表单id
|
|
||||||
Integer formId = Util.getIntValue(param.get("formid").toString());
|
|
||||||
// 获取当前登录人员ID
|
|
||||||
Integer userId = user.getUID();
|
|
||||||
String sheetname = "1";
|
|
||||||
//获取第 sheetindex 个sheet的第row行第col列的单元格的值 (下标都是从1开始)
|
|
||||||
//String value = excelParse.getValue("1", 2, 2);
|
|
||||||
Workbook wb = excelParse.getWb();
|
|
||||||
Sheet sheet = wb.getSheetAt(Util.getIntValue(sheetname) - 1);
|
|
||||||
StringBuilder error = new StringBuilder();
|
|
||||||
Pattern DATE_PATTERN = Pattern.compile("^\\d{4}-\\d{2}$");
|
|
||||||
if (sheet != null) {
|
|
||||||
int rowSum = sheet.getPhysicalNumberOfRows();
|
|
||||||
new BaseBean().writeLog("rowSum==>" + rowSum);
|
|
||||||
int current_row = 0;
|
|
||||||
for (int i = 2; i <= rowSum; i++) {
|
|
||||||
current_row = i - 1;
|
|
||||||
String client_id = Util.null2String(excelParse.getValue("1", i, ey_clentid_col));
|
|
||||||
String budget_version_id = Util.null2String(excelParse.getValue("1", i, budget_version_col));
|
|
||||||
String bucode = Util.null2String(excelParse.getValue("1", i, ey_bucode_col));
|
|
||||||
String oucode = Util.null2String(excelParse.getValue("1", i, ey_oucode_col));
|
|
||||||
String mucode = Util.null2String(excelParse.getValue("1", i, ey_mucode_col));
|
|
||||||
String smucode = Util.null2String(excelParse.getValue("1", i, ey_smucode_col));
|
|
||||||
String engagement_name = Util.null2String(excelParse.getValue("1", i, ey_engagementname_col)).trim();
|
|
||||||
String ep = Util.null2String(excelParse.getValue("1", i, ey_ep_col));
|
|
||||||
String em = Util.null2String(excelParse.getValue("1", i, ey_em_col));
|
|
||||||
String pfma = Util.null2String(excelParse.getValue("1", i, ey_pfma_col));
|
|
||||||
String engagement_code = Util.null2String(excelParse.getValue("1", i, ey_engagementcode_col)).trim();
|
|
||||||
String mercury_code = Util.null2String(excelParse.getValue("1", i, ey_mercurycode_col)).trim();
|
|
||||||
String pace_link = Util.null2String(excelParse.getValue("1", i, ey_pacelink_col)).trim();
|
|
||||||
|
|
||||||
RecordSet rs2 = new RecordSet();
|
|
||||||
rs2.executeQuery("select engagement_status,local_service_code,global_service_code,service_line,sub_service_line,py_code from uf_xmjbxxjmbd where engagement_code=? ", engagement_code);
|
|
||||||
if(rs2.next()) {
|
|
||||||
String local_service_code = Util.null2String(rs2.getString("local_service_code"));
|
|
||||||
String service_line = Util.null2String(rs2.getString("service_line"));
|
|
||||||
String global_service_code = Util.null2String(rs2.getString("global_service_code"));
|
|
||||||
String sub_service_line = Util.null2String(rs2.getString("sub_service_line"));
|
|
||||||
String temp_py_code = Util.null2String(rs2.getString("py_code"));
|
|
||||||
String engagement_status = Util.null2String(rs2.getString("engagement_status"));
|
|
||||||
//String local_global_service_code =DaoUtils.querySingleVal("select global_service_code from uf_service_code where Servicecode=?",local_service_code);
|
|
||||||
String mercury_global_service_code = DaoUtils.querySingleVal("select global_service_code from uf_msc_gsc where mercury_service_code=?", mercury_code);
|
|
||||||
String old_pace_id = DaoUtils.querySingleVal("select pace_id from uf_xmjbxxjmbd where engagement_code=?", temp_py_code);
|
|
||||||
String py_engagement_name = DaoUtils.querySingleVal("select engagement_name from uf_xmjbxxjmbd where engagement_code=?", temp_py_code);
|
|
||||||
|
|
||||||
//1、校验该项目编号在项目档案中的 通过engcode查询,项目状态为N
|
|
||||||
if (opencheckntooengagementstatus.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====1、opencheckntooengagementstatus.start====");
|
|
||||||
new BaseBean().writeLog("engagement_status==>" + engagement_status);
|
|
||||||
if (!engagement_status.equals("N")) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,原项目状态不为N! ").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====1、opencheckntooengagementstatus.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
//2、校验GSC为031、035。通过engcode查询,GSC为GSC =031、GSC=035 ,local_serivce_code=03500 or local_serivce_code=03100
|
|
||||||
if (opencheckntoservicecode.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====2、opencheckntoservicecode.start====");
|
|
||||||
new BaseBean().writeLog("local_service_code==>" + local_service_code);
|
|
||||||
if (!local_service_code.equals("03500") && !local_service_code.equals("03100")) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,原项目本地服务编码是03500或03100! ").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====2、opencheckntoservicecode.end====");
|
|
||||||
}
|
|
||||||
//3、原项目业务线必须是ASU!
|
|
||||||
if (opencheckntoserviceline.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====3、opencheckntoserviceline.start====");
|
|
||||||
new BaseBean().writeLog("====3、service_line====" + service_line);
|
|
||||||
new BaseBean().writeLog("====3、sub_service_line====" + sub_service_line);
|
|
||||||
if (!(service_line.equals("01") && sub_service_line.equals("0101"))) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,原项目业务线必须是ASU,子业务线是Audit! ").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====3、opencheckntoserviceline.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
//4、校该项目编号在项目档案中关联的PY Code不能为空
|
|
||||||
if (opencheckntopycode.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====4、opencheckntopycode.start====");
|
|
||||||
new BaseBean().writeLog("====4、opencheckntopycode.temp_py_code====" + temp_py_code);
|
|
||||||
if (temp_py_code.equals("")) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,项目原PY_CODE不能为空! ").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====4、opencheckntopycode.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
//5、Excel的项目名称 Done
|
|
||||||
if (opencheckntoengagementname.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====5、opencheckntoengagementname.start====");
|
|
||||||
if (engagement_name.equals(py_engagement_name)) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,项目名称不合规,请确认项目名称是否重复或名称格式是否错误,正确格式如:AUD2023-01XXXXX! ").append("<BR />");
|
|
||||||
}else if(engagement_name.length()<=10){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,项目名称不合规,请确认项目名称是否重复或名称格式是否错误,正确格式如:AUD2023-01XXXXX! ").append("<BR />");
|
|
||||||
}else if (engagement_name.length()>10 ){
|
|
||||||
String datestr = engagement_name.substring(3, 10);
|
|
||||||
//String perfix = engagement_name.substring(0, 3);
|
|
||||||
boolean flag = EYSeconddevUtil.vaildateImportEnagementName(engagement_name,global_service_code);
|
|
||||||
//检验:4~10位 必须是YYYY-MM
|
|
||||||
if (!DATE_PATTERN.matcher(datestr).matches()) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,项目名称不合规,请确认项目名称是否重复或名称格式是否错误,正确格式如:AUD2023-01XXXXX! ").append("<BR />");
|
|
||||||
}else if(!flag) { //检验 :0~3位 必须是AUT 或者 INT
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,项目名称不合规,请确认项目名称是否重复或名称格式是否错误,正确格式如:AUD2023-01XXXXX! ").append("<BR />");
|
|
||||||
}
|
|
||||||
}else if (engagement_name.length()<=10){
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,项目名称不合规,请确认项目名称是否重复或名称格式是否错误,正确格式如:AUD2023-01XXXXX! ").append("<BR />");
|
|
||||||
}
|
|
||||||
|
|
||||||
new BaseBean().writeLog("====5、opencheckntoengagementname.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
//6、客户信息 Done
|
|
||||||
if (opencheckntocustom.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====6、opencheckntocustom.start====");
|
|
||||||
Map <String, Object> custominfo = eySeconddevUtil.getCustomInfo(client_id);
|
|
||||||
String code = Util.null2String(custominfo.get("code"));
|
|
||||||
if (!code.equals("100")) {
|
|
||||||
//return "数据验证失败:第一个sheet第"+current_row+"行数据的,请确认客户中心系统中已存在该客户!";
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认客户中心系统中已存在该客户! ")
|
|
||||||
.append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====6、opencheckntocustom.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
//7、pace_id校验
|
|
||||||
if (opencheckntopaceid.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====7、opencheckntopaceid.start====");
|
|
||||||
String pace_id = "";
|
|
||||||
if (StringUtils.isNotBlank(pace_link)) {
|
|
||||||
int beginindex = pace_link.lastIndexOf("Assessment/") + 11;
|
|
||||||
String endstr = pace_link.substring(beginindex, pace_link.length());
|
|
||||||
int endindex = endstr.lastIndexOf("/");
|
|
||||||
pace_id = pace_link.substring(beginindex, beginindex + endindex);
|
|
||||||
new BaseBean().writeLog("ModeExpandForExtCodeImport,pace_id==>" + pace_id);
|
|
||||||
}
|
|
||||||
if (pace_id.equals(old_pace_id)) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,未创建新的PACE!").append("<BR />");
|
|
||||||
}
|
|
||||||
|
|
||||||
new BaseBean().writeLog("====7、opencheckntopaceid.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
//8、CodeBlock信息 Done
|
|
||||||
if (opencheckntocodeblock.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====8、opencheckntocodeblock.start====");
|
|
||||||
RecordSet recordSet = DaoUtils.executeQuery("select " +
|
|
||||||
" id " +
|
|
||||||
" from uf_Codeblockjcdab where bucode=? and oucode=? and mucode=? and smucode=?", bucode, oucode, mucode, smucode);
|
|
||||||
if (!recordSet.next()) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,未匹配到对应codeblock数据!").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====8、opencheckntocodeblock.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
//9、GPN是否存在 Done
|
|
||||||
if (opencheckntogpn.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====9、opencheckntogpn.start====");
|
|
||||||
new BaseBean().writeLog("em==>" + em);
|
|
||||||
new BaseBean().writeLog("ep==>" + ep);
|
|
||||||
new BaseBean().writeLog("pfma==>" + pfma);
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(ep)) {
|
|
||||||
RecordSet recordSet = new RecordSet();
|
|
||||||
recordSet.executeQuery("select id from hrmresource where workcode=?", ep);
|
|
||||||
if (!recordSet.next()) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认EP的GPN不存在系统中!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(em)) {
|
|
||||||
RecordSet recordSet = new RecordSet();
|
|
||||||
recordSet.executeQuery("select id from hrmresource where workcode=?", em);
|
|
||||||
if (!recordSet.next()) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认EP的GPN不存在系统中!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(pfma)) {
|
|
||||||
RecordSet recordSet = new RecordSet();
|
|
||||||
recordSet.executeQuery("select id from hrmresource where workcode=?", pfma);
|
|
||||||
if (!recordSet.next()) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认PFMA的GPN不存在系统中!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====9、opencheckntogpn.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 10、SmartHub检查
|
|
||||||
if (opencheckntobudget.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====10、opencheckntobudget.start====");
|
|
||||||
Map <String, Object> budgetinfo = new HashMap <String, Object>();
|
|
||||||
budgetinfo = eySeconddevUtil.getBudgetInfo("smarthubbudgetdetail", budget_version_id);
|
|
||||||
//}
|
|
||||||
if (budgetinfo.size() == 0) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认预算系统中已存在该预算!").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====10、opencheckntobudget.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 11、mercury_service_code校验 Done
|
|
||||||
if (opencheckntomercury.equals("1")) {
|
|
||||||
new BaseBean().writeLog("====11、opencheckntomercury.start====");
|
|
||||||
new BaseBean().writeLog("global_service_code==>" + global_service_code);
|
|
||||||
new BaseBean().writeLog("mercury_global_service_code==>" + mercury_global_service_code);
|
|
||||||
if (!(mercury_global_service_code.equals(global_service_code))) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认Mercury Service Code与Global Service Code不匹配!").append("<BR />");
|
|
||||||
}
|
|
||||||
new BaseBean().writeLog("====11、opencheckntomercury.end====");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,请确认Engagement Code不存在!").append("<BR />");
|
|
||||||
|
|
||||||
}
|
|
||||||
// 12、校验项目EP Rank
|
|
||||||
if (!"".equals(ep) && !eySeconddevUtil.validateEngagementRoleRank(ep,"1","0")) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,EP填写有误请检查!").append("<BR />");
|
|
||||||
}
|
|
||||||
// 13、校验项目EM Rank
|
|
||||||
if (!"".equals(em) && !eySeconddevUtil.validateEngagementRoleRank(em,"1","0")) {
|
|
||||||
error.append("数据验证失败:第一个sheet第" + current_row + "行数据的,EM填写有误请检查!").append("<BR />");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (error.toString().equals("")) {
|
|
||||||
return "";
|
|
||||||
} else {
|
|
||||||
return error.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,773 @@
|
||||||
|
package weaver.seconddev.ey.zhangm.didi.util;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.wbi.util.StringUtil;
|
||||||
|
import com.weaver.esb.client.EsbClient;
|
||||||
|
import com.weaver.esb.spi.EsbService;
|
||||||
|
import okhttp3.*;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.resource.ResourceComInfo;
|
||||||
|
import weaver.seconddev.ey.zhangm.didi.entity.Result;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class EYSeconddevUtil extends BaseBean {
|
||||||
|
/**
|
||||||
|
* 获取汇率相关信息
|
||||||
|
* @param amount 转换前金额
|
||||||
|
* @param fromCurrency 本位币
|
||||||
|
* @param toCurrency 目标币种
|
||||||
|
* @param rateType 汇率类型 0 CN日汇率 6 日汇率global CN周汇率 1 周汇率global 2
|
||||||
|
* @param date
|
||||||
|
* @return {"rateType":"rateType","date","2023-10-11","formCurrency":"CNY","toCurrency":"USD","exchargeRate":"8.000000","tronferBeforeAmount":"1000.00","tronferAfterAmount":"8000.00"}
|
||||||
|
*/
|
||||||
|
public Map<String,Object> getExchargeRate(BigDecimal amount,String fromCurrency,String toCurrency,String rateType,String date){
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
//rs.executeQuery("");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 校验用户是否存在
|
||||||
|
* @param workcode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean validateUser(String workcode){
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.executeQuery("select id from hrmresource where workcode=?,workcode");
|
||||||
|
return rs.getCounts()>0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 校验EM、EP rank
|
||||||
|
* @param gpn
|
||||||
|
* @param mark 内部项目、外部项目标识 0 内部、1外部
|
||||||
|
* @param role 项目角色标识标识 0 EP、1 EM
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean validateEngagementRoleRank(String gpn,String mark,String role){
|
||||||
|
RecordSet rs=new RecordSet();
|
||||||
|
rs.executeQuery("select id from hrmresource where workcode=?",gpn);
|
||||||
|
String userId="";
|
||||||
|
if(rs.next()){
|
||||||
|
userId=Util.null2String(rs.getString(1));
|
||||||
|
}
|
||||||
|
writeLog("validateEngagementRoleRank>>>>gpn:"+gpn);
|
||||||
|
// 查询rank
|
||||||
|
String rank="";
|
||||||
|
rs.executeQuery("select concat(field2,field24) from cus_fielddata scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=?",userId);
|
||||||
|
if(rs.next()){
|
||||||
|
rank=Util.null2String(rs.getString(1));
|
||||||
|
}
|
||||||
|
writeLog("validateEngagementRoleRank>>>>rank:"+rank);
|
||||||
|
// 校验rank
|
||||||
|
rs.executeQuery("select id from uf_xmjsrankjyb where rankcode=? and mark=? and role=?",rank,mark,role);
|
||||||
|
return rs.getCounts()>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSystemParamValue(String ssid){
|
||||||
|
String paramvalue ="";
|
||||||
|
if(!"".equals(ssid)){
|
||||||
|
String select_sql="select paramvalue from uf_dd_prmt where ssid ='"+ssid+"'";
|
||||||
|
RecordSet rs =new RecordSet();
|
||||||
|
rs.executeSql(select_sql);
|
||||||
|
if(rs.next()){
|
||||||
|
paramvalue = Util.null2String(rs.getString("paramvalue"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return paramvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String,String> getSystemParamValues(String ssids){
|
||||||
|
|
||||||
|
HashMap<String,String> paramvalues=new HashMap<String, String>();
|
||||||
|
String ssidsstr="";
|
||||||
|
if(!"".equals(ssids)){
|
||||||
|
String [] ssidsArray = ssids.split(",");
|
||||||
|
for (String s:ssidsArray){
|
||||||
|
if(!"".equals(s)) {
|
||||||
|
ssidsstr = ssidsstr + "'" + s + "',";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!"".equals(ssidsstr)) {
|
||||||
|
ssidsstr = ssidsstr.substring(0, ssidsstr.length() - 1);
|
||||||
|
String select_sql="select ssid,paramvalue from uf_dd_prmt where ssid in("+ssidsstr+")";
|
||||||
|
RecordSet rs =new RecordSet();
|
||||||
|
rs.executeSql(select_sql);
|
||||||
|
while (rs.next()){
|
||||||
|
paramvalues.put(rs.getString("ssid"),rs.getString("paramvalue"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return paramvalues;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserAllRole(Integer userid){
|
||||||
|
String returnStr = "";
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.executeSql("select roleid from hrmrolemembers where resourceid=" + userid);
|
||||||
|
while (rs.next()) {
|
||||||
|
returnStr = returnStr + Util.null2String(rs.getString("roleid")) + ",";
|
||||||
|
}
|
||||||
|
if (!"".equals(returnStr)) {
|
||||||
|
returnStr = returnStr.substring(0, returnStr.length() - 1);
|
||||||
|
}
|
||||||
|
if ("".equals(returnStr)) {
|
||||||
|
returnStr = "0";
|
||||||
|
}
|
||||||
|
return returnStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMD5Str(String plainText){
|
||||||
|
//定义一个字节数组
|
||||||
|
byte[] secretBytes = null;
|
||||||
|
try {
|
||||||
|
// 生成一个MD5加密计算摘要
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
//对字符串进行加密
|
||||||
|
md.update(plainText.getBytes());
|
||||||
|
//获得加密后的数据
|
||||||
|
secretBytes = md.digest();
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
//throw new RuntimeException("没有md5这个算法!");
|
||||||
|
//throw new RuntimeException(SystemEnv.getHtmlLabelName(517545,userLanguage));
|
||||||
|
}
|
||||||
|
//将加密后的数据转换为16进制数字
|
||||||
|
String md5code = new BigInteger(1, secretBytes).toString(16);
|
||||||
|
// 如果生成数字未满32位,需要前面补0
|
||||||
|
// 不能把变量放到循环条件,值改变之后会导致条件变化。如果生成30位 只能生成31位md5
|
||||||
|
int tempIndex = 32 - md5code.length();
|
||||||
|
for (int i = 0; i < tempIndex; i++) {
|
||||||
|
md5code = "0" + md5code;
|
||||||
|
}
|
||||||
|
return md5code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCurrentTime() {
|
||||||
|
Date newdate = new Date();
|
||||||
|
long datetime = newdate.getTime();
|
||||||
|
Timestamp timestamp = new Timestamp(datetime);
|
||||||
|
String currenttime = (timestamp.toString()).substring(11, 13) + ":" + (timestamp.toString()).substring(14, 16) + ":"
|
||||||
|
+ (timestamp.toString()).substring(17, 19);
|
||||||
|
return currenttime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCurrentDate() {
|
||||||
|
Date newdate = new Date();
|
||||||
|
long datetime = newdate.getTime();
|
||||||
|
Timestamp timestamp = new Timestamp(datetime);
|
||||||
|
String currentdate = (timestamp.toString()).substring(0, 4) + "-" + (timestamp.toString()).substring(5, 7) + "-"
|
||||||
|
+ (timestamp.toString()).substring(8, 10);
|
||||||
|
return currentdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前日期时间。 YYYY-MM-DD HH:MM:SS
|
||||||
|
* @return 当前日期时间
|
||||||
|
*/
|
||||||
|
public static String getCurDateTime() {
|
||||||
|
Date newdate = new Date();
|
||||||
|
long datetime = newdate.getTime();
|
||||||
|
Timestamp timestamp = new Timestamp(datetime);
|
||||||
|
return (timestamp.toString()).substring(0, 19);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取时间戳 格式如:19990101235959
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getTimestamp(){
|
||||||
|
return getCurDateTime().replace("-", "").replace(":", "").replace(" ", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String doAction(Map<String,Object> paramDatajson,String url,String method){
|
||||||
|
String resultstr="";
|
||||||
|
try{
|
||||||
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||||
|
.build();
|
||||||
|
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
|
||||||
|
new BaseBean().writeLog("json==>"+ JSON.toJSONString(paramDatajson));
|
||||||
|
|
||||||
|
RequestBody body = RequestBody.create(mediaType, "datajson="+ JSON.toJSONString(paramDatajson));
|
||||||
|
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(url)
|
||||||
|
.method(method, body)
|
||||||
|
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
.build();
|
||||||
|
Response result = client.newCall(request).execute();
|
||||||
|
resultstr = result.body().string();
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
new BaseBean().writeLog("请求失败"+getCurrentDate()+" "+getCurrentDate()+"====errormsg:"+e.getMessage());
|
||||||
|
}
|
||||||
|
return resultstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传入两个时间范围,返回这两个时间范围内的所有日期,并保存在一个集合中
|
||||||
|
*
|
||||||
|
* @param beginTime
|
||||||
|
* @param endTime
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static List <String> findEveryDay(String beginTime, String endTime)
|
||||||
|
throws Exception {
|
||||||
|
//创建一个放所有日期的集合
|
||||||
|
List<String> dates = new ArrayList();
|
||||||
|
|
||||||
|
//创建时间解析对象规定解析格式
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
|
//将传入的时间解析成Date类型,相当于格式化
|
||||||
|
Date dBegin = sdf.parse(beginTime);
|
||||||
|
Date dEnd = sdf.parse(endTime);
|
||||||
|
|
||||||
|
//将格式化后的第一天添加进集合
|
||||||
|
dates.add(sdf.format(dBegin));
|
||||||
|
|
||||||
|
//使用本地的时区和区域获取日历
|
||||||
|
Calendar calBegin = Calendar.getInstance();
|
||||||
|
|
||||||
|
//传入起始时间将此日历设置为起始日历
|
||||||
|
calBegin.setTime(dBegin);
|
||||||
|
|
||||||
|
//判断结束日期前一天是否在起始日历的日期之后
|
||||||
|
while (dEnd.after(calBegin.getTime())) {
|
||||||
|
|
||||||
|
//根据日历的规则:月份中的每一天,为起始日历加一天
|
||||||
|
calBegin.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
|
||||||
|
//得到的每一天就添加进集合
|
||||||
|
dates.add(sdf.format(calBegin.getTime()));
|
||||||
|
//如果当前的起始日历超过结束日期后,就结束循环
|
||||||
|
}
|
||||||
|
return dates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String createHrToken() throws Exception{
|
||||||
|
String accessToken="";
|
||||||
|
OkHttpClient client = new OkHttpClient().newBuilder().build();
|
||||||
|
String clientId =getSystemParamValue("eyhrclientId");
|
||||||
|
String appId =getSystemParamValue("eyhrappId");
|
||||||
|
String appSecret =getSystemParamValue("eyhrappSecret");
|
||||||
|
String hrsynccreatetokenurl =getSystemParamValue("hrsynccreatetokenurl");
|
||||||
|
String hrsyncaddress =getSystemParamValue("hrsyncaddress");
|
||||||
|
Map<String,String >params =new HashMap <String,String>();
|
||||||
|
params.put("clientId",clientId);
|
||||||
|
params.put("appId",appId);
|
||||||
|
params.put("appSecret",appSecret);
|
||||||
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
|
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(params));
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(hrsyncaddress+hrsynccreatetokenurl)
|
||||||
|
.method("POST", body)
|
||||||
|
.addHeader("Content-Type", "application/json")
|
||||||
|
.build();
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
Result result = Result.success(Objects.requireNonNull(response.body()).string());
|
||||||
|
if (result.isOk()) {
|
||||||
|
JSONObject data = JSON.parseObject(result.getContent());
|
||||||
|
String code = Objects.requireNonNull(data).getString("code");
|
||||||
|
String msg = Objects.requireNonNull(data).getString("msg");
|
||||||
|
if(code.equals("0")){
|
||||||
|
// 将组织机构数据封装至List
|
||||||
|
accessToken = Objects.requireNonNull(data).getJSONObject("data").getString("accessToken");
|
||||||
|
//new BaseBean().writeLog("Token授权==>"+accessToken);
|
||||||
|
}else{
|
||||||
|
//new BaseBean().writeLog("Token授权异常,code==>"+code+",msg==>"+msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//new BaseBean().writeLog("Token授权,accessToken==>"+accessToken);
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String createToken(String clientId,String appId,String appSecret,String address,String tokenurl) throws Exception{
|
||||||
|
String accessToken="";
|
||||||
|
OkHttpClient client = new OkHttpClient().newBuilder().build();
|
||||||
|
Map<String,String >params =new HashMap <String,String>();
|
||||||
|
params.put("clientId",clientId);
|
||||||
|
params.put("appId",appId);
|
||||||
|
params.put("appSecret",appSecret);
|
||||||
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
|
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(params));
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(address+tokenurl)
|
||||||
|
.method("POST", body)
|
||||||
|
.addHeader("Content-Type", "application/json")
|
||||||
|
.build();
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
Result result = Result.success(Objects.requireNonNull(response.body()).string());
|
||||||
|
if (result.isOk()) {
|
||||||
|
JSONObject data = JSON.parseObject(result.getContent());
|
||||||
|
String code = Objects.requireNonNull(data).getString("code");
|
||||||
|
String msg = Objects.requireNonNull(data).getString("msg");
|
||||||
|
if(code.equals("0")){
|
||||||
|
// 将组织机构数据封装至List
|
||||||
|
accessToken = Objects.requireNonNull(data).getJSONObject("data").getString("accessToken");
|
||||||
|
//new BaseBean().writeLog("Token授权==>"+accessToken);
|
||||||
|
}else{
|
||||||
|
//new BaseBean().writeLog("Token授权异常,code==>"+code+",msg==>"+msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//new BaseBean().writeLog("Token授权,accessToken==>"+accessToken);
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前人所能看到所有数据
|
||||||
|
*/
|
||||||
|
public String getEyCustomRigthSql(int userid,String tablename){
|
||||||
|
String returnStr = " select id from "+tablename+" where ";
|
||||||
|
String matchsql ="select * from uf_stand_match_conf where tablename=?";
|
||||||
|
RecordSet recordSet=new RecordSet();
|
||||||
|
recordSet.executeQuery(matchsql,tablename);
|
||||||
|
if(recordSet.next()){
|
||||||
|
try {
|
||||||
|
ResourceComInfo resourceComInfo=new ResourceComInfo();
|
||||||
|
String workcode=resourceComInfo.getWorkcode(userid+"");//员工工号
|
||||||
|
String currentroleids =getUserAllRole(userid);//获取当前人员所有角色id
|
||||||
|
String georegion_fieldname =Util.null2String(recordSet.getString("georegion_fieldname"));
|
||||||
|
String legalentity_fieldname =Util.null2String(recordSet.getString("legalentity_fieldname"));
|
||||||
|
String type_fieldname =Util.null2String(recordSet.getString("type_fieldname"));
|
||||||
|
String codeblock_fieldname =Util.null2String(recordSet.getString("codeblock_fieldname"));
|
||||||
|
String engagementcode_fieldname =Util.null2String(recordSet.getString("engagementcode_fieldname"));
|
||||||
|
//业务维度
|
||||||
|
if(StringUtil.isNotBlank(codeblock_fieldname)){
|
||||||
|
String codeblocksql = getEyCodeBlockRightSql(workcode,codeblock_fieldname);
|
||||||
|
if(StringUtil.isNotBlank(codeblocksql)){
|
||||||
|
returnStr =returnStr+codeblocksql;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//3.1先查询中间匹配表-firm
|
||||||
|
//判断台账中间表是否配置完全
|
||||||
|
if(StringUtil.isNotBlank(georegion_fieldname)&&StringUtil.isNotBlank(legalentity_fieldname)) {
|
||||||
|
String firmsql = getEyfirmRightSql(type_fieldname,georegion_fieldname, legalentity_fieldname, currentroleids);
|
||||||
|
if (StringUtil.isNotBlank(firmsql)) {
|
||||||
|
returnStr = returnStr + firmsql;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//3.2先查询中间匹配表-gds
|
||||||
|
if(StringUtil.isNotBlank(type_fieldname)) {
|
||||||
|
String typesql =getEyGdsRightSql(type_fieldname,currentroleids);
|
||||||
|
if(StringUtil.isNotBlank(typesql)){
|
||||||
|
returnStr = returnStr + typesql;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writeLog("getEyCustomRigthSql,returnStr==>"+returnStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*业务维度权限
|
||||||
|
*/
|
||||||
|
public String getEyCodeBlockRightSql(String workcode,String codeblock_fieldname){
|
||||||
|
String result="";
|
||||||
|
//1、项目卡片中所有成员
|
||||||
|
String codeblocksql ="select codeblock from uf_xmjbxxjmbd where id in (" +
|
||||||
|
"select mainid from uf_xmjbxxjmbd_dt2 where role_gpn='"+workcode+"' " +
|
||||||
|
")";
|
||||||
|
//2、通过第三接口获取公司高层维护的codeblock
|
||||||
|
codeblocksql = codeblocksql +" union " +
|
||||||
|
" select codeblock from uf_permisson_conf_business where gpn='"+workcode+"' ";
|
||||||
|
result = " ( "+codeblock_fieldname+" in ("+codeblocksql+") ) or";
|
||||||
|
writeLog("codeblocksql==>"+codeblocksql);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*FIRM财务维度权限
|
||||||
|
*/
|
||||||
|
public String getEyfirmRightSql(String type_fieldname,String georegion_fieldname,String legalentity_fieldname,String currentroleids) {
|
||||||
|
String result="";
|
||||||
|
RecordSet rs =new RecordSet();
|
||||||
|
String firmrolesql =" select legalentity,georegion,roleids from uf_permissionconfig where isopen=0";
|
||||||
|
rs.executeQuery(firmrolesql,new Object[0]);
|
||||||
|
List<Map<String,String>> firmmatchlist =new ArrayList <Map<String,String>>();
|
||||||
|
while(rs.next()){
|
||||||
|
String roleids =Util.null2String(rs.getString("roleids"));
|
||||||
|
String legalentity =Util.null2String(rs.getString("legalentity"));
|
||||||
|
String georegion =Util.null2String(rs.getString("georegion"));
|
||||||
|
//判断规则中间表是否配置完全
|
||||||
|
if(!legalentity.equals("")&&!georegion.equals("")){
|
||||||
|
String[] currentroleidarry =currentroleids.split(",");
|
||||||
|
//判断当前用户所有角色与规则表的角色是否匹配
|
||||||
|
for(String roleid:currentroleidarry){
|
||||||
|
if((","+roleid+",").indexOf(","+roleids+",")>=0){
|
||||||
|
//legalentity和georegion封装
|
||||||
|
HashMap<String,String> rolematch =new HashMap <String,String>();
|
||||||
|
rolematch.put("legalentity",legalentity);
|
||||||
|
rolematch.put("georegion",georegion);
|
||||||
|
firmmatchlist.add(rolematch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//遍历legalentity和georegion封装的map 转换sql
|
||||||
|
if(firmmatchlist.size()>0){
|
||||||
|
for(Map<String,String> match:firmmatchlist){
|
||||||
|
String type =Util.null2String(match.get("type"));
|
||||||
|
String legalentity =Util.null2String(match.get("legalentity"));
|
||||||
|
String georegion =Util.null2String(match.get("georegion"));
|
||||||
|
if(StringUtil.isNotBlank(type)){
|
||||||
|
String firmsql ="";
|
||||||
|
String lesql = legalentity_fieldname + " in (";
|
||||||
|
String geosql = georegion_fieldname + " in (";
|
||||||
|
String[] typearry =type.split(",");
|
||||||
|
for(String t:typearry){
|
||||||
|
firmsql =firmsql+type_fieldname+"='"+t+"' and";
|
||||||
|
if(StringUtil.isNotBlank(legalentity)){
|
||||||
|
String[] legalentityarry =legalentity.split(",");
|
||||||
|
for(String le:legalentityarry){
|
||||||
|
lesql =lesql+"'"+le+"',";
|
||||||
|
}
|
||||||
|
lesql=lesql.substring(0,lesql.length()-1)+")";
|
||||||
|
firmsql =firmsql+lesql+" and";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtil.isNotBlank(georegion)){
|
||||||
|
String[] georegionarry =georegion.split(",");
|
||||||
|
for(String geo:georegionarry){
|
||||||
|
geosql =geosql+"'"+geo+"',";
|
||||||
|
}
|
||||||
|
geosql=geosql.substring(0,geosql.length()-1)+")";
|
||||||
|
firmsql =firmsql+geosql+" and";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result =result+"("+firmsql.substring(0,firmsql.length()-3)+")or";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writeLog("result==>"+result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*GDS财务维度权限
|
||||||
|
*/
|
||||||
|
public String getEyGdsRightSql(String type_fieldname,String currentroleids){
|
||||||
|
String result ="";
|
||||||
|
List<Map<String,String>> gdsmatchlist =new ArrayList <Map<String,String>>();
|
||||||
|
RecordSet rs =new RecordSet();
|
||||||
|
String gdsrolesql =" select type,legalentity,roleids from uf_permisson_conf_gds where isopen=0 ";
|
||||||
|
rs.executeQuery(gdsrolesql,new Object[0]);
|
||||||
|
while(rs.next()){
|
||||||
|
String roleids =Util.null2String(rs.getString("roleids"));
|
||||||
|
String type =Util.null2String(rs.getString("type"));
|
||||||
|
if(!type.equals("")){
|
||||||
|
String[] currentroleidarry =currentroleids.split(",");
|
||||||
|
//判断当前用户所有角色与规则表的角色是否匹配
|
||||||
|
for(String roleid:currentroleidarry){
|
||||||
|
if((","+roleid+",").indexOf(","+roleids+",")>=0){
|
||||||
|
//legalentity和georegion封装
|
||||||
|
HashMap<String,String> rolematch =new HashMap <String,String>();
|
||||||
|
rolematch.put("type",type);
|
||||||
|
gdsmatchlist.add(rolematch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(gdsmatchlist.size()>0){
|
||||||
|
Set<String> typeset =new HashSet<String>();
|
||||||
|
for(Map<String,String> match:gdsmatchlist){
|
||||||
|
String type =Util.null2String(match.get("type"));
|
||||||
|
String[] typearry =type.split(",");
|
||||||
|
for(String value:typearry){
|
||||||
|
typeset.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(String s:typeset){
|
||||||
|
result =result + "("+type_fieldname+"='"+s+"') or";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String,Object> getConfidentialInfo(String opprCode,String paceFolderId,String clientId){
|
||||||
|
Map<String,Object> result =new HashMap <>();
|
||||||
|
String eventKey = "checkopportunitypaceandclient"; //事件标识
|
||||||
|
Map<String,Object> body =new HashMap <String,Object>();
|
||||||
|
Map<String,String> params =new HashMap <String,String>();
|
||||||
|
List<Map<String,String>> reqdata =new ArrayList <>();
|
||||||
|
params.put("opprCode",opprCode);
|
||||||
|
params.put("paceFolderId",paceFolderId);
|
||||||
|
params.put("clientId",clientId);
|
||||||
|
reqdata.add(params);
|
||||||
|
body.put("body",reqdata);
|
||||||
|
String paramsstr = JSON.toJSONString(body); //事件请求参数
|
||||||
|
//EsbService其他方法及说明见ESB API接口说明文档
|
||||||
|
EsbService service = EsbClient.getService(); //获取 ESB 服务
|
||||||
|
String clientdetailjsonstr = service.execute(eventKey, paramsstr);
|
||||||
|
new BaseBean().writeLog("getConfidentialInfo,JsonStr==>"+clientdetailjsonstr);
|
||||||
|
if(StringUtils.isNotBlank(clientdetailjsonstr)){
|
||||||
|
JSONObject jsonObject=JSON.parseObject(clientdetailjsonstr);
|
||||||
|
JSONArray resultdata =jsonObject.getJSONObject("data").getJSONArray("data");
|
||||||
|
String errorStr ="";
|
||||||
|
String isConfidential ="1";
|
||||||
|
for(int i=0;i<resultdata.size();i++){
|
||||||
|
JSONObject single =resultdata.getJSONObject(i);
|
||||||
|
String errortype =Util.null2String(single.getString("errorType"));
|
||||||
|
if(errortype.equals("10")){
|
||||||
|
errorStr =errorStr+"商机Id不存在、";
|
||||||
|
}else if (errortype.equals("20")){
|
||||||
|
errorStr =errorStr+"PACEId不存在、";
|
||||||
|
}else if (errortype.equals("30")){
|
||||||
|
errorStr =errorStr+"商机Id 和 PACEId无关联、";
|
||||||
|
}else if(errortype.equals("40")){
|
||||||
|
errorStr =errorStr+"客户Id不存在、";
|
||||||
|
}else if(errortype.equals("50")){
|
||||||
|
errorStr =errorStr+"客户Id和 PACEId无关联、";
|
||||||
|
}
|
||||||
|
JSONArray opprsIsConfidential = single.getJSONArray("opprsIsConfidential");
|
||||||
|
if(opprsIsConfidential!=null && opprsIsConfidential.size()>0) {
|
||||||
|
for (int j = 0; j < opprsIsConfidential.size(); j++) {
|
||||||
|
String isConfidentialflag =Util.null2String(opprsIsConfidential.getJSONObject(j).getString("isConfidential"));
|
||||||
|
if (isConfidentialflag.equals("true")) {
|
||||||
|
isConfidential = "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("errorstr",errorStr);
|
||||||
|
result.put("isConfidential",isConfidential);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getLegalEffective(String bucode,String oucode,String mucode,String smucode){
|
||||||
|
boolean result =false;
|
||||||
|
String eventKey = "getLegalEffective"; //事件标识
|
||||||
|
Map<String,String> params =new HashMap <String,String>();
|
||||||
|
params.put("buCode",bucode);
|
||||||
|
params.put("ouCode",oucode);
|
||||||
|
params.put("muCode",mucode);
|
||||||
|
params.put("smuCode",smucode);
|
||||||
|
String paramsstr = JSON.toJSONString(params); //事件请求参数
|
||||||
|
//EsbService其他方法及说明见ESB API接口说明文档
|
||||||
|
EsbService service = EsbClient.getService(); //获取 ESB 服务
|
||||||
|
String clientdetailjsonstr = service.execute(eventKey, paramsstr);
|
||||||
|
new BaseBean().writeLog("clientdetailjsonstr,getLegalEffective==>"+clientdetailjsonstr);
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(clientdetailjsonstr)) {
|
||||||
|
JSONObject jsonObject = JSON.parseObject(clientdetailjsonstr);
|
||||||
|
JSONObject resultdata = jsonObject.getJSONObject("data").getJSONObject("data");
|
||||||
|
result = resultdata.getBoolean("isLegal");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预算信息
|
||||||
|
* @param eventKey 事件key
|
||||||
|
* @param eventKey primaryKey
|
||||||
|
*/
|
||||||
|
public Map<String,Object> getBudgetInfo(String eventKey,String primaryKey){
|
||||||
|
Map<String,Object> result =new HashMap <>();
|
||||||
|
//事件标识
|
||||||
|
Map<String,String> params_mmt =new HashMap <String,String>();
|
||||||
|
params_mmt.put("PrimaryKey",primaryKey);
|
||||||
|
String paramsstr_mmt = JSON.toJSONString(params_mmt); //事件请求参数
|
||||||
|
//EsbService其他方法及说明见ESB API接口说明文档
|
||||||
|
EsbService service = EsbClient.getService(); //获取 ESB 服务
|
||||||
|
String mmtdetailjsonstr = service.execute(eventKey, paramsstr_mmt);
|
||||||
|
new BaseBean().writeLog("getBudgetInfo===>"+mmtdetailjsonstr);
|
||||||
|
if(StringUtils.isNotBlank(mmtdetailjsonstr)){
|
||||||
|
JSONObject jsonObject=JSON.parseObject(mmtdetailjsonstr);
|
||||||
|
if(jsonObject.getJSONObject("data").getJSONArray("list")!=null) {
|
||||||
|
JSONObject resultdata = jsonObject.getJSONObject("data").getJSONArray("list").getJSONObject(0);
|
||||||
|
if (eventKey.equals("smarthubbudgetdetail")) {
|
||||||
|
String startDate =Util.null2String(resultdata.getString("startDate"));
|
||||||
|
String closeDate =Util.null2String(resultdata.getString("closeDate"));
|
||||||
|
if(!startDate.equals("")){
|
||||||
|
result.put("estimated_start_date", startDate.substring(0,10));
|
||||||
|
}else{
|
||||||
|
result.put("estimated_start_date", "");
|
||||||
|
}
|
||||||
|
if(!closeDate.equals("")){
|
||||||
|
result.put("estimated_close_date", closeDate.substring(0,10));
|
||||||
|
}else{
|
||||||
|
result.put("estimated_close_date", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
result.put("estimated_start_date", formatDate(resultdata.getString("estimatedStartDate")));
|
||||||
|
result.put("estimated_close_date", formatDate(resultdata.getString("estimatedEndDate")));
|
||||||
|
}
|
||||||
|
if (eventKey.equals("smarthubbudgetdetail")) {
|
||||||
|
result.put("eaf", formatDouble(Util.null2String(resultdata.getString("eaf"))));
|
||||||
|
} else {
|
||||||
|
result.put("eaf", formatDouble(Util.null2String(resultdata.getString("engagementAdjustedFactor"))));
|
||||||
|
}
|
||||||
|
result.put("standard_engagement_revenue", resultdata.getString("ser"));
|
||||||
|
result.put("net_engagement_revenue", resultdata.getString("ner"));
|
||||||
|
if (eventKey.equals("smarthubbudgetdetail")) {
|
||||||
|
result.put("current_year_total_revenue", formatDouble(Util.null2String(resultdata.getString("ter"))));
|
||||||
|
} else {
|
||||||
|
result.put("current_year_total_revenue", Util.null2String(resultdata.getString("currentFyTer")));
|
||||||
|
}
|
||||||
|
result.put("total_revenue", Util.null2String(resultdata.getString("ter")));
|
||||||
|
if (eventKey.equals("smarthubbudgetdetail")) {
|
||||||
|
result.put("margin", "0.00");
|
||||||
|
} else {
|
||||||
|
result.put("margin", formatDouble(Util.null2String(resultdata.getString("marginPercent"))));
|
||||||
|
}
|
||||||
|
if (eventKey.equals("smarthubbudgetdetail")) {
|
||||||
|
result.put("partner_involvement", formatDouble(Util.null2String(resultdata.getString("partnerInvolvement"))));
|
||||||
|
} else {
|
||||||
|
result.put("partner_involvement", formatDouble(Util.null2String(resultdata.getString("partnerLeverage"))));
|
||||||
|
}
|
||||||
|
result.put("erp1", formatDouble(Util.null2String(resultdata.getString("erp"))));
|
||||||
|
result.put("realization", formatDouble(Util.null2String(resultdata.getString("erp"))));
|
||||||
|
|
||||||
|
String expenses =Util.null2String(resultdata.getString("totalExpense"));
|
||||||
|
if(expenses.equals("")){
|
||||||
|
expenses ="0.00";
|
||||||
|
}
|
||||||
|
result.put("expenses",expenses);
|
||||||
|
if (eventKey.equals("smarthubbudgetdetail")) {
|
||||||
|
result.put("margin1", "0.00");
|
||||||
|
} else {
|
||||||
|
result.put("margin1", resultdata.getString("margin"));
|
||||||
|
}
|
||||||
|
if (eventKey.equals("smarthubbudgetdetail")) {
|
||||||
|
result.put("total_cost", "0.00");
|
||||||
|
} else {
|
||||||
|
result.put("total_cost", Util.null2String(resultdata.getString("stdCost")));
|
||||||
|
}
|
||||||
|
String hours =Util.null2String(resultdata.getString("totalHours"));
|
||||||
|
if(hours.equals("")){
|
||||||
|
hours ="0.00";
|
||||||
|
}
|
||||||
|
|
||||||
|
result.put("hours",hours );
|
||||||
|
}
|
||||||
|
new BaseBean().writeLog(JSON.toJSONString(result));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客户信息
|
||||||
|
* @param clientId 客户id
|
||||||
|
*/
|
||||||
|
public Map<String,Object> getCustomInfo(String clientId){
|
||||||
|
Map<String,Object> result =new HashMap <>();
|
||||||
|
String eventKey = "clientdetail"; //事件标识
|
||||||
|
Map<String,String> params =new HashMap <String,String>();
|
||||||
|
params.put("clientId",clientId);
|
||||||
|
String paramsstr = JSON.toJSONString(params); //事件请求参数
|
||||||
|
//EsbService其他方法及说明见ESB API接口说明文档
|
||||||
|
EsbService service = EsbClient.getService(); //获取 ESB 服务
|
||||||
|
String clientdetailjsonstr = service.execute(eventKey, paramsstr);
|
||||||
|
|
||||||
|
|
||||||
|
String clientScope ="";
|
||||||
|
String chineseName ="";
|
||||||
|
new BaseBean().writeLog("clientdetailjsonstr,getCustomInfo==>"+clientdetailjsonstr);
|
||||||
|
if(StringUtils.isNotBlank(clientdetailjsonstr)){
|
||||||
|
JSONObject jsonObject=JSON.parseObject(clientdetailjsonstr);
|
||||||
|
String returncode =jsonObject.getString("code");
|
||||||
|
if(returncode.equals("100")){
|
||||||
|
JSONObject resultdata =jsonObject.getJSONObject("data").getJSONObject("result");
|
||||||
|
clientScope =Util.null2String(resultdata.getString("clientScope"));
|
||||||
|
//chineseName =Util.null2String(resultdata.getString("chineseName"));
|
||||||
|
chineseName =Util.null2String(resultdata.getString("englishName"));
|
||||||
|
result.put("client_name",chineseName);
|
||||||
|
if(clientScope.equals("100")){
|
||||||
|
result.put("client_type","0");
|
||||||
|
}else if (clientScope.equals("101")){
|
||||||
|
result.put("client_type","1");
|
||||||
|
}else if (clientScope.equals("102")){
|
||||||
|
result.put("client_type","2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("code",returncode);
|
||||||
|
}else{
|
||||||
|
result.put("code","-1");
|
||||||
|
result.put("client_name","");
|
||||||
|
result.put("client_type","");
|
||||||
|
}
|
||||||
|
new BaseBean().writeLog("getCustomInfo,returnmap==>"+JSON.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatDouble(String value){
|
||||||
|
String result="";
|
||||||
|
if(value.equals("")){
|
||||||
|
result ="0.00";
|
||||||
|
}else{
|
||||||
|
BigDecimal bigDecimal =new BigDecimal(value);
|
||||||
|
result = bigDecimal.divide(new BigDecimal(100)).toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatDate(String datestr){
|
||||||
|
long time = Long.parseLong(datestr);
|
||||||
|
Date date = new Date(time);
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String str = dateFormat.format(date);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean vaildateImportEnagementName(String engagementname,String global_service_code){
|
||||||
|
boolean flag=false;
|
||||||
|
if(engagementname.equals("")||global_service_code.equals("")){
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
RecordSet recordSet1=new RecordSet();
|
||||||
|
String perfix = engagementname.substring(0, 3);
|
||||||
|
recordSet1.executeQuery("select id from uf_mcgzb where global_service_code=? and mcgz=?",global_service_code,perfix);
|
||||||
|
if(recordSet1.next()){
|
||||||
|
flag =true;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String removespace(String resource)
|
||||||
|
{
|
||||||
|
char ch=' ';
|
||||||
|
return remove(resource,ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String remove(String resource,char ch)
|
||||||
|
{
|
||||||
|
StringBuffer buffer=new StringBuffer();
|
||||||
|
int position=0;
|
||||||
|
char currentChar;
|
||||||
|
while(position<resource.length())
|
||||||
|
{
|
||||||
|
currentChar=resource.charAt(position++);
|
||||||
|
//如果当前字符不是要去除的字符,则将当前字符加入到StringBuffer中
|
||||||
|
if(currentChar!=ch) buffer.append(currentChar);
|
||||||
|
}
|
||||||
|
return buffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -26,6 +26,21 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class EYSeconddevUtil extends BaseBean {
|
public class EYSeconddevUtil extends BaseBean {
|
||||||
|
public Map<String, Object> getExchargeRate(BigDecimal decimal, String fromCurrency,String toCurrency,String codeblock, String a){
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
//rs.executeQuery("");
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 校验用户是否存在
|
||||||
|
* @param workcode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean validateUser(String workcode){
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.executeQuery("select id from hrmresource where workcode=?,workcode");
|
||||||
|
return rs.getCounts()>0;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 校验EM、EP rank
|
* 校验EM、EP rank
|
||||||
* @param gpn
|
* @param gpn
|
||||||
|
@ -40,12 +55,14 @@ public class EYSeconddevUtil extends BaseBean {
|
||||||
if(rs.next()){
|
if(rs.next()){
|
||||||
userId=Util.null2String(rs.getString(1));
|
userId=Util.null2String(rs.getString(1));
|
||||||
}
|
}
|
||||||
|
writeLog("validateEngagementRoleRank>>>>gpn:"+gpn);
|
||||||
// 查询rank
|
// 查询rank
|
||||||
String rank="";
|
String rank="";
|
||||||
rs.executeQuery("select concat(field2,field24) from cus_fielddata scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=?",userId);
|
rs.executeQuery("select concat(field2,field24) from cus_fielddata scope='HrmCustomFieldByInfoType' and scopeid=-1 and id=?",userId);
|
||||||
if(rs.next()){
|
if(rs.next()){
|
||||||
rank=Util.null2String(rs.getString(1));
|
rank=Util.null2String(rs.getString(1));
|
||||||
}
|
}
|
||||||
|
writeLog("validateEngagementRoleRank>>>>rank:"+rank);
|
||||||
// 校验rank
|
// 校验rank
|
||||||
rs.executeQuery("select id from uf_xmjsrankjyb where rankcode=? and mark=? and role=?",rank,mark,role);
|
rs.executeQuery("select id from uf_xmjsrankjyb where rankcode=? and mark=? and role=?",rank,mark,role);
|
||||||
return rs.getCounts()>0;
|
return rs.getCounts()>0;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import aiyh.utils.tool.org.apache.commons.jexl3.MapContext;
|
||||||
import basetest.BaseTest;
|
import basetest.BaseTest;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfigClass;
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfigClass;
|
||||||
|
import com.api.xuanran.wang.eny.workflow.mapper.ExchangeRateMapper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfig;
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfig;
|
||||||
|
@ -89,6 +90,22 @@ public class ModelFieldAsyncTest extends BaseTest {
|
||||||
return (T) response.get(split[len - 1]);
|
return (T) response.get(split[len - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final ExchangeRateMapper mapper = Util.getMapper(ExchangeRateMapper.class);
|
||||||
|
@Test
|
||||||
|
public void testE(){
|
||||||
|
String json ="{\"date\":\"2021-04-07\",\"interfaceCurrency\":\"CNY\",\"printParams\":1,\"fieldList\":[{\"field\":\"field11111\",\"money\":12920295.96}],\"baseCurrency\":\"1\"} ";
|
||||||
|
Map map = JSONObject.parseObject(json, Map.class);
|
||||||
|
List<Map<String,Object>> fieldList = (List<Map<String, Object>>) map.get("fieldList");
|
||||||
|
System.out.println("list : " + fieldList);
|
||||||
|
for (Map<String, Object> objectMap : fieldList) {
|
||||||
|
double money = Util.getDoubleValue(Util.null2DefaultStr(objectMap.get("money"), ""), 0);
|
||||||
|
if(money == 0){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
System.out.println("money : " + money);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue