2026-06-11永明实业租赁部署代码上传
This commit is contained in:
@@ -12,7 +12,11 @@ import com.seeyon.apps.src_financing.util.NumberUtil;
|
||||
import com.seeyon.cap4.form.api.FormApi4Cap4;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.controller.BaseController;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgAccount;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import com.seeyon.ctp.organization.manager.OrgManagerDirect;
|
||||
import com.seeyon.ctp.util.UUIDLong;
|
||||
import com.seeyon.ctp.util.annotation.Inject;
|
||||
import com.seeyon.ctp.util.json.JSONUtil;
|
||||
import com.seeyon.v3x.services.form.FormFactory;
|
||||
import com.seeyon.v3x.services.form.bean.FormExport;
|
||||
@@ -77,18 +81,21 @@ public class InterestMeasurementController extends BaseController {
|
||||
return FinancingConstants.getPluginId();
|
||||
}
|
||||
|
||||
@Inject
|
||||
OrgManager orgManager ;
|
||||
@Inject
|
||||
OrgManagerDirect orgManagerDirect;
|
||||
|
||||
public ModelAndView index(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
log.info("进入ajax方法");
|
||||
ConfigVo configVo = getFinancingConfig();
|
||||
// 设置返回值对象
|
||||
//设置返回值对象
|
||||
Map<String, Object> res = new HashMap<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
InterestCalculationUtil rentCalculationUtil = new InterestCalculationUtil();
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
|
||||
BufferedReader reader = request.getReader();
|
||||
String line;
|
||||
StringBuilder requestBody = new StringBuilder();
|
||||
@@ -231,7 +238,7 @@ public class InterestMeasurementController extends BaseController {
|
||||
log.info("创建档案");
|
||||
List<String> contractIds = getLeaseContractDao().getFZinancingid(contractCode);
|
||||
FormExport[] formExports = getFormFactory().exportBusinessFormData("LXCSMX",
|
||||
"2024-11-01 00:00:00",simpleDateFormat.format(new Date()),new String[]{});
|
||||
"2026-01-01 00:00:00",simpleDateFormat.format(new Date()),new String[]{});
|
||||
FormExportUtil formExportUtil = new FormExportUtil();
|
||||
FormExport formExport = new FormExport();
|
||||
for(FormExport formExportold :formExports){
|
||||
@@ -286,7 +293,7 @@ public class InterestMeasurementController extends BaseController {
|
||||
paramMap.put("field0004",subValueExport.getValue());
|
||||
}
|
||||
}
|
||||
paramMap.put("field0005","-4351865301164799504");
|
||||
paramMap.put("field0005","-934312770236691702");
|
||||
paramMap.put("formmainId",contractId);
|
||||
paramMap.put("field0006",map.get("计划还款日期").toString());
|
||||
paramMap.put("field0007",map.get("计划还款金额").toString());
|
||||
@@ -310,7 +317,7 @@ public class InterestMeasurementController extends BaseController {
|
||||
paramMap.put("field0004",subValueExport.getValue());
|
||||
}
|
||||
}
|
||||
paramMap.put("field0005","-4351865301164799504");
|
||||
paramMap.put("field0005","-934312770236691702");
|
||||
paramMap.put("formmainId",contractId);
|
||||
paramMap.put("field0006",map.get("计划还款日期").toString());
|
||||
paramMap.put("field0007",map.get("计划还款金额").toString());
|
||||
@@ -337,7 +344,7 @@ public class InterestMeasurementController extends BaseController {
|
||||
paramMap.put("field0004",subValueExport.getValue());
|
||||
}
|
||||
}
|
||||
paramMap.put("field0005","-4351865301164799504");
|
||||
paramMap.put("field0005","-934312770236691702");
|
||||
paramMap.put("formmainId",contractId);
|
||||
paramMap.put("field0006",map.get("计划还款日期").toString());
|
||||
paramMap.put("field0007",map.get("计划还款金额").toString());
|
||||
@@ -355,7 +362,7 @@ public class InterestMeasurementController extends BaseController {
|
||||
paramMap.put("formmainId",contractId);
|
||||
paramMap.put("field0001",recordExports.size()+i+1+"");
|
||||
paramMap.put("field0004",contractCode+(recordExports.size()+i+1));
|
||||
paramMap.put("field0005","-4351865301164799504");
|
||||
paramMap.put("field0005","-934312770236691702");
|
||||
paramMap.put("field0006",map.get("计划还款日期").toString());
|
||||
paramMap.put("field0007",map.get("计划还款金额").toString());
|
||||
int isAddSub = getLeaseContractDao().addLXFinancingSubbyFormId(paramMap);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class InterestCalculationUtil {
|
||||
String num= contractCode+n;
|
||||
map.put("计划利息还款明细编号",num+"");
|
||||
// 还款类型枚举固定为利息
|
||||
String type = "-4351865301164799504";
|
||||
String type = "-934312770236691702";
|
||||
map.put("还款费项类型",type);
|
||||
// 计划还款日期
|
||||
String dateStr = sdf.format(cycleDates.get(i));
|
||||
@@ -102,7 +102,7 @@ public class InterestCalculationUtil {
|
||||
String num= contractCode+n;
|
||||
map.put("计划利息还款明细编号",num+"");
|
||||
// 还款类型枚举
|
||||
String type = "-4351865301164799504";
|
||||
String type = "-934312770236691702";
|
||||
map.put("还款费项类型",type);
|
||||
// 计划还款日期
|
||||
String dateStr = sdf.format(cycleDates.get(i));
|
||||
@@ -146,7 +146,7 @@ public class InterestCalculationUtil {
|
||||
String num = contractCode+n;
|
||||
map.put("计划利息还款明细编号",num+"");
|
||||
// 还款类型枚举
|
||||
String type = "-4351865301164799504";
|
||||
String type = "-934312770236691702";
|
||||
map.put("还款费项类型",type);
|
||||
// 计划还款日期
|
||||
String dateStr = sdf.format(cycleDates.get(i));
|
||||
|
||||
@@ -132,4 +132,26 @@ public class DateUtil {
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 字符串文本 转 Calendar
|
||||
* @param dateStr 日期文本 如:2025-12-05
|
||||
* @param pattern 格式 yyyy-MM-dd HH:mm:ss
|
||||
* @return Calendar
|
||||
*/
|
||||
public static Calendar stringToCalendar(String dateStr, String pattern) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||
try {
|
||||
Date date = sdf.parse(dateStr);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
return calendar;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,15 @@ public class LeaseBillUtil {
|
||||
}
|
||||
float zlmjFloat = 0;
|
||||
double zf = 0;
|
||||
// 租金是否递增
|
||||
String zjsfdz = jsonObject.getString("zjsfdz");
|
||||
// 递增比例默认为0,免增年限默认为1
|
||||
String zjdzbl = "0";
|
||||
String mznx = "1";
|
||||
if("递增".equals(zjsfdz)){
|
||||
zjdzbl = jsonObject.getString("zjdzbl");
|
||||
mznx = jsonObject.getString("mznx");
|
||||
}
|
||||
if("面积计费".equals(jifeifs)){
|
||||
String mjStr = jsonObject.getString("mj");
|
||||
zlmjFloat = Float.parseFloat(mjStr);
|
||||
@@ -77,6 +86,8 @@ public class LeaseBillUtil {
|
||||
Map<String, String> rentMap = new HashMap<String, String>();
|
||||
// 设置租费时间
|
||||
// rentMap.put("开始日期", sdf.format(startTime.getTime()));
|
||||
int CurrentMonthNum = dateUtil.betweenMonthByTwoCalendar(DateUtil.stringToCalendar(jsonObject.getString("startDate"),"yyyy-MM-dd"),startTime);
|
||||
int incrementYearNum = (CurrentMonthNum/12)+1-Integer.parseInt(mznx);
|
||||
rentMap.put("开始日期", sdf.format(startTime.getTime()));
|
||||
if (!isMaxDay) {
|
||||
startTime.add(Calendar.MONTH, jfzqNum);
|
||||
@@ -88,27 +99,63 @@ public class LeaseBillUtil {
|
||||
if (startTime.getTime().getTime() < endTime.getTime().getTime()) {
|
||||
// rentMap.put("期间月数-租金",jfzqNum+"");
|
||||
// rentMap.put("租费", (zf * jfzqNum) + "");
|
||||
// 本期对应月份数
|
||||
if("面积计费".equals(jifeifs)){
|
||||
// rentMap.put("租费", (zf * jfzqNum) + "");
|
||||
rentMap.put("租费", (zf * jfzqNum) + "");
|
||||
double zufei = zf * jfzqNum;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
System.out.println("比例:"+Double.parseDouble(zjdzbl));
|
||||
System.out.println("年数:"+incrementYearNum);
|
||||
System.out.println("递增租费:"+dzzf);
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}else if ("固定租金".equals(jifeifs)){
|
||||
// rentMap.put("租费", (zf * 1) + "");
|
||||
rentMap.put("租费", (zf * 1) + "");
|
||||
double zufei = zf * 1;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
System.out.println("比例"+Double.parseDouble(zjdzbl));
|
||||
System.out.println("年数"+incrementYearNum);
|
||||
System.out.println("递增租费"+dzzf);
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}
|
||||
// rentMap.put("结束日期", sdf.format(startTime.getTime()));
|
||||
rentMap.put("结束日期", sdf.format(startTime.getTime()));
|
||||
} else {
|
||||
//两个日期相差多少月
|
||||
// int CurrentMonthNum = dateUtil.betweenMonthByTwoCalendar(DateUtil.stringToCalendar(jsonObject.getString("startDate"),"yyyy-MM-dd"),startTime);
|
||||
// int incrementYearNum = (CurrentMonthNum/12)+1-Integer.parseInt(mznx);
|
||||
startTime.add(Calendar.MONTH, jfzqNum*-1);
|
||||
startTime.add(Calendar.DAY_OF_MONTH, 1);
|
||||
int qijianyueshu = dateUtil.betweenMonthByTwoCalendar(startTime, endTime);
|
||||
|
||||
// rentMap.put("期间月数-租金",qijianyueshu+"");
|
||||
if("面积计费".equals(jifeifs)){
|
||||
// rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
double zufei = zf * qijianyueshu;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
System.out.println("比例:"+Double.parseDouble(zjdzbl));
|
||||
System.out.println("年数:"+incrementYearNum);
|
||||
System.out.println("递增租费:"+dzzf);
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}else if ("固定租金".equals(jifeifs)){
|
||||
// rentMap.put("租费", (zf * 1) + "");
|
||||
double zufei = zf * 1;
|
||||
rentMap.put("租费", (zf * 1) + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
System.out.println("比例:"+Double.parseDouble(zjdzbl));
|
||||
System.out.println("年数:"+incrementYearNum);
|
||||
System.out.println("递增租费:"+dzzf);
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}
|
||||
|
||||
endTime.add(Calendar.DAY_OF_MONTH, -1);
|
||||
@@ -162,11 +209,22 @@ public class LeaseBillUtil {
|
||||
double gdzj = dateUtil.stringToNum(gdzjStr);
|
||||
zf = gdzj*zlmjFloat;
|
||||
}
|
||||
// 租金是否递增
|
||||
String zjsfdz = jsonObject.getString("zjsfdz");
|
||||
// 递增比例默认为0,免增年限默认为1
|
||||
String zjdzbl = "0";
|
||||
String mznx = "1";
|
||||
if("递增".equals(zjsfdz)){
|
||||
zjdzbl = jsonObject.getString("zjdzbl");
|
||||
mznx = jsonObject.getString("mznx");
|
||||
}
|
||||
for(int i = 0 ; i < termNum ; i ++) {
|
||||
if (startTime.getTime().getTime() < endTime.getTime().getTime()) {
|
||||
Map<String, String> rentMap = new HashMap<String, String>();
|
||||
// 设置租费时间
|
||||
// rentMap.put("开始日期", sdf.format(startTime.getTime()));
|
||||
int CurrentMonthNum = dateUtil.betweenMonthByTwoCalendar(DateUtil.stringToCalendar(jsonObject.getString("startDate"),"yyyy-MM-dd"),startTime);
|
||||
int incrementYearNum = (CurrentMonthNum/12)+1-Integer.parseInt(mznx);
|
||||
rentMap.put("开始日期", sdf.format(startTime.getTime()));
|
||||
startTime.add(Calendar.MONTH, jfzqNum);
|
||||
startTime.add(Calendar.DAY_OF_MONTH, -1);
|
||||
@@ -175,10 +233,20 @@ public class LeaseBillUtil {
|
||||
// rentMap.put("租费", (zf * jfzqNum) + "");
|
||||
if("固定租金".equals(jifeifs)){
|
||||
// rentMap.put("租费", (zf * 1) + "");
|
||||
rentMap.put("租费", (zf * 1) + "");
|
||||
double zufei = zf * 1;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}else{
|
||||
// rentMap.put("租费", (zf * jfzqNum) + "");
|
||||
rentMap.put("租费", (zf * jfzqNum) + "");
|
||||
double zufei = zf * jfzqNum;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}
|
||||
// rentMap.put("结束日期", sdf.format(startTime.getTime()));
|
||||
rentMap.put("结束日期", sdf.format(startTime.getTime()));
|
||||
@@ -191,10 +259,20 @@ public class LeaseBillUtil {
|
||||
// rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
if("固定租金".equals(jifeifs)){
|
||||
// rentMap.put("租费", (zf * 1) + "");
|
||||
rentMap.put("租费", (zf * 1) + "");
|
||||
double zufei = zf * 1;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}else{
|
||||
// rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
double zufei = zf * qijianyueshu;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}
|
||||
endTime.add(Calendar.DAY_OF_MONTH, -1);
|
||||
// rentMap.put("结束日期", sdf.format(endTime.getTime()));
|
||||
@@ -245,12 +323,22 @@ public class LeaseBillUtil {
|
||||
double gdzj = dateUtil.stringToNum(gdzjStr);
|
||||
zf = gdzj*zlmjFloat;
|
||||
}
|
||||
|
||||
// 租金是否递增
|
||||
String zjsfdz = jsonObject.getString("zjsfdz");
|
||||
// 递增比例默认为0,免增年限默认为1
|
||||
String zjdzbl = "0";
|
||||
String mznx = "1";
|
||||
if("递增".equals(zjsfdz)){
|
||||
zjdzbl = jsonObject.getString("zjdzbl");
|
||||
mznx = jsonObject.getString("mznx");
|
||||
}
|
||||
for(int i = 0 ; i < termNum ; i ++) {
|
||||
if (startTime.getTime().getTime() < endTime.getTime().getTime()) {
|
||||
Map<String, String> rentMap = new HashMap<String, String>();
|
||||
// 设置租费时间
|
||||
// rentMap.put("开始日期", sdf.format(startTime.getTime()));
|
||||
int CurrentMonthNum = dateUtil.betweenMonthByTwoCalendar(DateUtil.stringToCalendar(jsonObject.getString("startDate"),"yyyy-MM-dd"),startTime);
|
||||
int incrementYearNum = (CurrentMonthNum/12)+1-Integer.parseInt(mznx);
|
||||
rentMap.put("开始日期", sdf.format(startTime.getTime()));
|
||||
startTime.set(Calendar.MONTH, 11);
|
||||
startTime.set(Calendar.DATE, 31);
|
||||
@@ -262,10 +350,20 @@ public class LeaseBillUtil {
|
||||
// rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
if ("固定租金".equals(jifeifs)){
|
||||
// rentMap.put("租费", (zf * 1) + "");
|
||||
rentMap.put("租费", (zf * 1) + "");
|
||||
double zufei = zf * 1;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}else{
|
||||
// rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
double zufei = zf * qijianyueshu;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}
|
||||
// rentMap.put("结束日期", sdf.format(startTime.getTime()));
|
||||
rentMap.put("结束日期", sdf.format(startTime.getTime()));
|
||||
@@ -278,10 +376,20 @@ public class LeaseBillUtil {
|
||||
// rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
if ("固定租金".equals(jifeifs)){
|
||||
// rentMap.put("租费", (zf * 1) + "");
|
||||
rentMap.put("租费", (zf * 1) + "");
|
||||
double zufei = zf * 1;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}else{
|
||||
// rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
rentMap.put("租费", (zf * qijianyueshu) + "");
|
||||
double zufei = zf * qijianyueshu;
|
||||
rentMap.put("租费", zufei + "");
|
||||
// 当前租费 = (租金*比例*年份)+租金
|
||||
// 当前租费 = 租金 *(1+比例)*(1+比例)*(1+比例)
|
||||
double dzzf = incrementYearNum==0 ? 0: Math.pow(Double.parseDouble(zjdzbl)+1, incrementYearNum)*zufei-zufei;
|
||||
rentMap.put("租费递增", dzzf + "");
|
||||
}
|
||||
endTime.add(Calendar.DAY_OF_MONTH, -1);
|
||||
// rentMap.put("结束日期", sdf.format(endTime.getTime()));
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.seeyon.apps.src_monitoring;
|
||||
|
||||
import com.seeyon.apps.common.plugin.api.APluginInfoApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.src_monitoring.constant.MonitoringConstant;
|
||||
|
||||
/**
|
||||
* 功能描述:<br>
|
||||
* <pre>
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @Author: FanGaowei
|
||||
* @Date: 2022/12/1
|
||||
*/
|
||||
public class MonitoringPluginApi extends APluginInfoApi {
|
||||
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return MonitoringConstant.getPluginId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreateUser() {
|
||||
return "湖北橙阳";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigVo getDefaultConfig() {
|
||||
ConfigVo configVo = new ConfigVo();
|
||||
for (MonitoringConstant value : MonitoringConstant.values()) {
|
||||
if(value != MonitoringConstant.plugin) {
|
||||
configVo.getDevParams().put(value.name(), value.getDefaultValue());
|
||||
configVo.getProdParams().put(value.name(), value.getDefaultValue());
|
||||
configVo.getParamMap().put(value.name(), value.getDescription());
|
||||
}
|
||||
}
|
||||
return configVo;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,12 @@ package com.seeyon.apps.src_monitoring.constant;
|
||||
public enum MonitoringConstant {
|
||||
|
||||
plugin("src_monitoring","插件ID"),
|
||||
loginName("shenxian","辅助表创建人");
|
||||
loginName("shenxian","表创建人"),
|
||||
tableCode("JKLBFZB","辅助表表单编号"),
|
||||
ipcorp("http://36.158.106.129:8088","ipcorp"),
|
||||
monitoringToken("pkng9081","监控系统Token"),
|
||||
getTreeUrl("/index/dak/tree?_=1775032576179","监控序列ID获取接口"),
|
||||
toMonitoringUrl("/index/video2?channelId=","监控跳转链接");
|
||||
|
||||
MonitoringConstant(String defaultValue, String description) {
|
||||
this.defaultValue = defaultValue;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.seeyon.apps.src_monitoring.dao;
|
||||
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SrcMonitoringDao {
|
||||
|
||||
// private String getMonitoringAuxiliaryByMonitoringId = "select id,field0001 monitoringId,field0002 monitoringName,field0003 channelCode,field0004 monitoringUrl from formmain_0246 where field0001 = ?";
|
||||
// private String updateMonitoringAuxiliaryById = "update formmain_0246 set field0001 = ? ,field0002 = ? ,field0003 = ?,field0004 = ? where field0001 = ?";
|
||||
|
||||
private String getMonitoringAuxiliaryByMonitoringId = "select id,field0001 monitoringId,field0002 monitoringName,field0003 channelCode,field0004 monitoringUrl from formmain_0241 where field0001 = ?";
|
||||
private String updateMonitoringAuxiliaryById = "update formmain_0241 set field0001 = ? ,field0002 = ? ,field0003 = ?,field0004 = ? where id = ?";
|
||||
|
||||
public Map<String,String> getMonitoringAuxiliaryByMonitoringId(String monitoringId){
|
||||
Map<String,String> res = new HashMap<>();
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
StringBuilder sql = new StringBuilder(getMonitoringAuxiliaryByMonitoringId);
|
||||
List<Object> p = new ArrayList<Object>();
|
||||
p.add(monitoringId);
|
||||
agent.execute(sql.toString(), p);
|
||||
List<Map> list = agent.resultSetToList();
|
||||
if (list != null && list.size() > 0) {
|
||||
Map<String,Object> m = list.get(0);
|
||||
res.put("monitoringId",m.get("monitoringid")!=null?m.get("monitoringid").toString():"");
|
||||
res.put("monitoringName",m.get("monitoringname")!=null?m.get("monitoringname").toString():"");
|
||||
res.put("channelCode",m.get("channelcode")!=null?m.get("channelcode").toString():"");
|
||||
// res.put("monitoringUrl",m.get("monitoringUrl")!=null?m.get("monitoringUrl").toString():"");
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (agent != null) {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public int updateMonitoringAuxiliaryById(Map<String,String> param,String monitoringId) {
|
||||
int i = 0 ;
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
StringBuilder sql = new StringBuilder(updateMonitoringAuxiliaryById);
|
||||
List<Object> p = new ArrayList<Object>();
|
||||
p.add(param.get("monitoringId"));
|
||||
p.add(param.get("monitoringName"));
|
||||
p.add(param.get("channelCode"));
|
||||
p.add(param.get("monitoringUrl"));
|
||||
p.add(monitoringId);
|
||||
i=agent.execute(sql.toString(), p);
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (agent != null) {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,11 +5,17 @@ import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.ext.quartz.AbstractQuartzTask;
|
||||
import com.seeyon.apps.src_monitoring.constant.MonitoringConstant;
|
||||
import com.seeyon.apps.src_monitoring.server.MonitoringServer;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
||||
public class MonitoringQuartz extends AbstractQuartzTask {
|
||||
|
||||
private static Log log = Log.get(MonitoringQuartz.class);
|
||||
@Inject
|
||||
private MonitoringServer monitoringServer;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
@@ -22,11 +28,20 @@ public class MonitoringQuartz extends AbstractQuartzTask {
|
||||
|
||||
@Override
|
||||
public String taskRun(String s) throws Exception {
|
||||
ConfigVo configVo = this.cstConfigApi.getConfig(this.getPluginId());
|
||||
String loginName = configVo.getParamVal(MonitoringConstant.loginName.name());
|
||||
List<String> performMonitorings = monitoringServer.performMonitoring(s);
|
||||
StringBuilder res = new StringBuilder();
|
||||
if(performMonitorings.size()==0){
|
||||
for (String performMonitoring : performMonitorings){
|
||||
res.append(performMonitoring).append(',');
|
||||
}
|
||||
if (res != null && res.length() > 0) {
|
||||
res.deleteCharAt(res.length() - 1);
|
||||
}
|
||||
}else{
|
||||
res.append("同步成功");
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.seeyon.apps.src_monitoring.server;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.src_monitoring.constant.MonitoringConstant;
|
||||
import com.seeyon.apps.src_monitoring.dao.SrcMonitoringDao;
|
||||
import com.seeyon.apps.src_monitoring.util.FormExportUtil;
|
||||
import com.seeyon.apps.src_monitoring.util.ProtUtil;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.services.ServiceException;
|
||||
import com.seeyon.v3x.services.form.FormFactory;
|
||||
import com.seeyon.v3x.services.form.bean.FormExport;
|
||||
import com.seeyon.v3x.services.form.bean.ValueExport;
|
||||
import www.seeyon.com.utils.StringUtil;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MonitoringServer {
|
||||
|
||||
@Inject
|
||||
private SrcMonitoringDao srcMonitoringDao;
|
||||
@Inject
|
||||
private FormFactory formFactory;
|
||||
|
||||
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
public String getPluginId() {return MonitoringConstant.getPluginId();}
|
||||
public ConfigVo getMonitoringConfig() {return cstConfigApi.getConfig(getPluginId());}
|
||||
|
||||
|
||||
public List<String> performMonitoring (String param) throws UnsupportedEncodingException {
|
||||
ConfigVo configVo = this.cstConfigApi.getConfig(this.getPluginId());
|
||||
String ipcorp = configVo.getParamVal(MonitoringConstant.ipcorp.name());
|
||||
String getTreeUrl = configVo.getParamVal(MonitoringConstant.getTreeUrl.name());
|
||||
String monitoringToken = configVo.getParamVal(MonitoringConstant.monitoringToken.name());
|
||||
// 调用接口查询第三方监控系统监控列表
|
||||
StringBuilder urlSb = new StringBuilder(ipcorp).append(getTreeUrl).append("&xtoken=").append(monitoringToken);
|
||||
JSONArray res = getTreeMonitoring(urlSb.toString());
|
||||
List<String> results = new ArrayList<>();
|
||||
// 遍历结果数据
|
||||
for(int i = 0 ; i < res.size();i++){
|
||||
String result = "";
|
||||
JSONObject monitoringData = res.getJSONObject(i);
|
||||
Map<String,String> monitoringMap = srcMonitoringDao.getMonitoringAuxiliaryByMonitoringId(monitoringData.getString("id"));
|
||||
if(monitoringMap.size()==0){
|
||||
result = insertData(monitoringData);
|
||||
}else{
|
||||
if(StringUtil.isNotEmpty(monitoringMap.get("monitoringId"))){
|
||||
Map<String,String> thisMap = new HashMap<>();
|
||||
thisMap.put("monitoringId",monitoringData.getString("id"));
|
||||
thisMap.put("monitoringName",monitoringData.getString("name"));
|
||||
thisMap.put("channelCode",monitoringData.getString("channelCode"));
|
||||
if(!thisMap.equals(monitoringMap)){
|
||||
result = updateData(monitoringData,monitoringData.getString("id"));
|
||||
}
|
||||
}else{
|
||||
result = insertData(monitoringData);
|
||||
}
|
||||
}
|
||||
if(StringUtil.isNotEmpty(result)){
|
||||
results.add(result);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
public JSONArray getTreeMonitoring(String url){
|
||||
String res = ProtUtil.doGet(url);
|
||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||
JSONArray jsonData = new JSONArray();
|
||||
// 获取操作返回编码
|
||||
String code = jsonObject.getString("code");
|
||||
if("0".equals(code)){
|
||||
// 如果返回结果为0说明请求成功
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
boolean issuccess = data.getBoolean("success");
|
||||
// 获取数据返回结果编码
|
||||
if(issuccess){
|
||||
JSONObject resData = data.getJSONObject("data");
|
||||
jsonData = resData.getJSONArray("value");
|
||||
for (int i = 0 ; i < jsonData.size();i++){
|
||||
JSONObject json = jsonData.getJSONObject(i);
|
||||
String type = json.getString("type");
|
||||
if("org_county".equals(type)){
|
||||
jsonData.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
|
||||
public String insertData(JSONObject data) throws UnsupportedEncodingException {
|
||||
// 当前表单不存在于档案表中,完成数据新增
|
||||
String res = "";
|
||||
ConfigVo configVo = this.cstConfigApi.getConfig(this.getPluginId());
|
||||
String loginName = configVo.getParamVal(MonitoringConstant.loginName.name());
|
||||
String tableCode = configVo.getParamVal(MonitoringConstant.tableCode.name());
|
||||
String monitoringToken = configVo.getParamVal(MonitoringConstant.monitoringToken.name());
|
||||
String ipcorp = configVo.getParamVal(MonitoringConstant.ipcorp.name());
|
||||
String toMonitoringUrl = configVo.getParamVal(MonitoringConstant.toMonitoringUrl.name());
|
||||
FormExport formExport = new FormExport();
|
||||
Map<String , String > insertMap = new HashMap<String, String>();
|
||||
// 设置数据
|
||||
insertMap.put("监控主键",data.getString("id"));
|
||||
insertMap.put("监控名称",data.getString("name"));
|
||||
insertMap.put("channelCode",data.getString("channelCode"));
|
||||
// 链接
|
||||
String encodedXtoken = URLEncoder.encode(monitoringToken, "UTF-8");
|
||||
String encodedChannelId = URLEncoder.encode(data.getString("id"), "UTF-8");
|
||||
StringBuilder url = new StringBuilder(ipcorp).append(toMonitoringUrl).append(encodedChannelId).
|
||||
append("&xtoken=").append(encodedXtoken);
|
||||
insertMap.put("监控链接",url.toString());
|
||||
List<ValueExport> valueExports = FormExportUtil.setFormValue(insertMap);
|
||||
formExport.setValues(valueExports);
|
||||
try {
|
||||
formFactory.importBusinessFormData(loginName, tableCode,formExport, new String[] {});
|
||||
} catch (ServiceException e) {
|
||||
e.printStackTrace();
|
||||
res = "创建失败"+e.getMessage();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String updateData(JSONObject data,String monitoringId) throws UnsupportedEncodingException {
|
||||
String res = "";
|
||||
ConfigVo configVo = this.cstConfigApi.getConfig(this.getPluginId());
|
||||
String monitoringToken = configVo.getParamVal(MonitoringConstant.monitoringToken.name());
|
||||
String ipcorp = configVo.getParamVal(MonitoringConstant.ipcorp.name());
|
||||
String toMonitoringUrl = configVo.getParamVal(MonitoringConstant.toMonitoringUrl.name());
|
||||
Map<String,String> param = new HashMap<>();
|
||||
param.put("monitoringId",data.getString("id"));
|
||||
param.put("monitoringName",data.getString("name"));
|
||||
param.put("channelCode",data.getString("channelCode"));
|
||||
String encodedXtoken = URLEncoder.encode(monitoringToken, "UTF-8");
|
||||
String encodedChannelId = URLEncoder.encode(data.getString("id"), "UTF-8");
|
||||
StringBuilder url = new StringBuilder(ipcorp).append(toMonitoringUrl).append(encodedChannelId).
|
||||
append("&xtoken=").append(encodedXtoken);
|
||||
param.put("monitoringUrl",url.toString());
|
||||
int i = srcMonitoringDao.updateMonitoringAuxiliaryById(param,monitoringId);
|
||||
if(i==0){
|
||||
res = "修改失败"+data.getString("id")+data.getString("name");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.seeyon.apps.src_monitoring.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.v3x.services.form.bean.RecordExport;
|
||||
import com.seeyon.v3x.services.form.bean.SubordinateFormExport;
|
||||
import com.seeyon.v3x.services.form.bean.ValueExport;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
//创建无流程表单数据处理工具类
|
||||
public class FormExportUtil {
|
||||
|
||||
/**
|
||||
* 设置主表信息
|
||||
* @param map 设置主表字段。Map<主表显示名称,主表数据>
|
||||
* @return
|
||||
*/
|
||||
public static List<ValueExport> setFormValue(Map<String, String> map){
|
||||
// 创建返回值对象
|
||||
List<ValueExport> valueExports = new ArrayList<ValueExport>();
|
||||
ValueExport valueExport ;
|
||||
// 获取参数信息(显示名称)
|
||||
Set<String> keys = map.keySet();
|
||||
if(keys.size()>0) {
|
||||
// 对控件赋值
|
||||
for (String key : keys) {
|
||||
valueExport = new ValueExport();
|
||||
valueExport.setDisplayName(key);
|
||||
valueExport.setValue(map.get(key));
|
||||
valueExports.add(valueExport);
|
||||
}
|
||||
}
|
||||
return valueExports;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置从表信息
|
||||
* @param lists 设置主表字段。List<Map<显示名称,数据值>>
|
||||
*/
|
||||
public static List<SubordinateFormExport> setSubordinateFormValue(List<Map<String, String>> lists){
|
||||
List<SubordinateFormExport> subordinateFormExports = new ArrayList<SubordinateFormExport>();
|
||||
SubordinateFormExport subordinateFormExport = new SubordinateFormExport();
|
||||
List<RecordExport> recordExports = new ArrayList<RecordExport>();
|
||||
List<ValueExport> valueExports;
|
||||
RecordExport recordExport;
|
||||
for(int i = 0 ; i < lists.size() ; i++) {
|
||||
recordExport = new RecordExport();
|
||||
valueExports = setFormValue(lists.get(i));
|
||||
recordExport.setRecord(valueExports);
|
||||
recordExports.add(recordExport);
|
||||
}
|
||||
subordinateFormExport.setValues(recordExports);
|
||||
subordinateFormExports.add(subordinateFormExport);
|
||||
|
||||
return subordinateFormExports;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 格式转换将{"id":1,"str1":"123","str2":"asd","str3":"qwe"},{"id":2,"str1":"123","str2":"asd","str3":"qwe"},{"id":3,"str1":"123","str2":"asd","str3":"qwe"},{"id":1,"str1":"123","str2":"asd","str3":"qwe"},{"id":2,"str1":"123","str2":"asd","str3":"qwe"},{"id":3,"str1":"123","str2":"asd","str3":"qwe"}]
|
||||
有什么办法转换成
|
||||
[{"id":1,"data":[{"id":1,"str1":"123","str2":"asd","str3":"qwe"},{"id":1,"str1":"123","str2":"asd","str3":"qwe"}]}{"id":2,"data":[{"id":2,"str1":"123","str2":"asd","str3":"qwe"},{"id":2,"str1":"123","str2":"asd","str3":"qwe"}]}{"id":3,"data":[{"id":3,"str1":"123","str2":"asd","str3":"qwe"},{"id":3,"str1":"123","str2":"asd","str3":"qwe"}]}]
|
||||
* @param inputList
|
||||
* @return
|
||||
*/
|
||||
// public static List<Map<String, Object>> transformData(JSONArray inputList) {
|
||||
// Map<String, List<Map<String, Object>>> groupedData = new HashMap<>();
|
||||
// for(int i = 0 ; i < inputList.size();i++) {
|
||||
// String userId = inputList.getJSONObject(i).getString("userId");
|
||||
//
|
||||
// groupedData.computeIfAbsent(userId, k -> new ArrayList<>()).add(inputList.getJSONObject(i));
|
||||
// }
|
||||
//
|
||||
// List<Map<String, Object>> result = new ArrayList<>();
|
||||
//
|
||||
// for (Map.Entry<String, List<Map<String, Object>>> entry : groupedData.entrySet()) {
|
||||
// Map<String, Object> resultMap = new HashMap<>();
|
||||
// resultMap.put("userId", entry.getKey());
|
||||
// resultMap.put("data", entry.getValue());
|
||||
// result.add(resultMap);
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package com.seeyon.apps.src_monitoring.util;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import www.seeyon.com.utils.StringUtil;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ProtUtil {
|
||||
private static Log log = Log.get(ProtUtil.class);
|
||||
|
||||
/**
|
||||
* 获取一个token
|
||||
* @return
|
||||
*/
|
||||
public static String getToken(String url,String loginName) {
|
||||
if(StringUtil.isNotEmpty(loginName)){
|
||||
url+="?loginName="+loginName;
|
||||
}
|
||||
DefaultHttpClient client = new DefaultHttpClient();
|
||||
String result = "";
|
||||
HttpGet get = new HttpGet(url);
|
||||
try {
|
||||
get.addHeader("Accept","application/json");
|
||||
HttpResponse res = client.execute(get);
|
||||
if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
result = EntityUtils.toString(res.getEntity());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String token = "";
|
||||
if(result.contains("{")) {
|
||||
JSONObject jsObj = JSONObject.parseObject(result);
|
||||
token = jsObj.get("id").toString();
|
||||
}else {
|
||||
token = result;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用get接口
|
||||
* @param strUrl 需要调用的url对应的配置文件的key
|
||||
* @return
|
||||
*/
|
||||
public static String doGet( String strUrl) {
|
||||
return doGet(strUrl , new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用get接口
|
||||
* @param strUrl 需要调用的url对应的配置文件的key
|
||||
* @return
|
||||
*/
|
||||
public static String doGet( String strUrl,Map<String,String> headerMap) {
|
||||
String address = strUrl;
|
||||
DefaultHttpClient client = new DefaultHttpClient();
|
||||
String result = "";
|
||||
HttpGet get = new HttpGet(address);
|
||||
try {
|
||||
if(headerMap.size()>0){
|
||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
String key = entry.getKey(); // 获取键
|
||||
String value = entry.getValue(); // 获取值
|
||||
get.addHeader(key,value);
|
||||
}
|
||||
}
|
||||
HttpResponse res = client.execute(get);
|
||||
if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
result = EntityUtils.toString(res.getEntity());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static String callPutApi(String apiUrl, String requestBody) {
|
||||
StringBuilder response = new StringBuilder();
|
||||
try {
|
||||
URL url = new URL(apiUrl);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("PUT");
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setDoOutput(true);
|
||||
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
|
||||
outputStream.writeBytes(requestBody);
|
||||
outputStream.flush();
|
||||
}
|
||||
int responseCode = connection.getResponseCode();
|
||||
System.out.println("Response Code : " + responseCode);
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||
String line;
|
||||
while ((line = reader.readLine())!= null) {
|
||||
response.append(line);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return response.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用post接口
|
||||
* @param str 调用接口传递的参数json
|
||||
* @param urlStr 需要调用的url对应的参数文件中的编码
|
||||
* @return
|
||||
*/
|
||||
public static String doPost(String str, String urlStr) {
|
||||
return doPost(str,urlStr ,new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用post接口
|
||||
* @param str 调用接口传递的参数json
|
||||
* @param urlStr 需要调用的url对应的参数文件中的编码
|
||||
* @param headerMap 请求头参数列表
|
||||
* @return
|
||||
*/
|
||||
public static String doPost(String str, String urlStr , Map<String,String> headerMap) {
|
||||
HttpURLConnection connection = null;
|
||||
InputStream is = null;
|
||||
OutputStream os = null;
|
||||
BufferedReader br = null;
|
||||
String result = null;
|
||||
try {
|
||||
URL url = new URL(urlStr);
|
||||
// 通过远程url连接对象打开连接
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
// 设置连接请求方式
|
||||
connection.setRequestMethod("POST");
|
||||
// 设置连接主机服务器超时时间:15000毫秒
|
||||
connection.setConnectTimeout(15000);
|
||||
// 设置读取主机服务器返回数据超时时间:60000毫秒
|
||||
connection.setReadTimeout(60000);
|
||||
// 默认值为:false,当向远程服务器传送数据/写数据时,需要设置为true
|
||||
connection.setDoOutput(true);
|
||||
// 默认值为:true,当前向远程服务读取数据时,设置为true,该参数可有可无
|
||||
connection.setDoInput(true);
|
||||
if(headerMap.size()>0){
|
||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
String key = entry.getKey(); // 获取键
|
||||
String value = entry.getValue(); // 获取值
|
||||
connection.setRequestProperty(key, value);
|
||||
}
|
||||
}else{
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
}
|
||||
os = connection.getOutputStream();
|
||||
if (!("".equals(str) || str == null)) {
|
||||
os.write(str.getBytes("UTF-8"));
|
||||
}
|
||||
if (connection.getResponseCode() == 200) {
|
||||
is = connection.getInputStream();
|
||||
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
StringBuffer sbf = new StringBuffer();
|
||||
String temp = null;
|
||||
while ((temp = br.readLine()) != null) {
|
||||
sbf.append(temp);
|
||||
sbf.append("\r\n");
|
||||
}
|
||||
result = sbf.toString();
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (null != br) {
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != os) {
|
||||
try {
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != is) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}if (null != connection) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static String httpPutRaw(String url, String stringJson, Map<String,Object> headers, String encode){
|
||||
if(encode == null){
|
||||
encode = "utf-8";
|
||||
}
|
||||
CloseableHttpResponse httpResponse = null;
|
||||
CloseableHttpClient closeableHttpClient = null;
|
||||
String content = null;
|
||||
//since 4.3 不再使用 DefaultHttpClient
|
||||
try {
|
||||
|
||||
closeableHttpClient = HttpClients.createDefault();
|
||||
HttpPut httpput = new HttpPut(url);
|
||||
|
||||
//设置header
|
||||
httpput.setHeader("Content-type", "application/json");
|
||||
if (headers != null && headers.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : headers.entrySet()) {
|
||||
httpput.setHeader(entry.getKey(),entry.getValue().toString());
|
||||
}
|
||||
}
|
||||
//组织请求参数
|
||||
StringEntity stringEntity = new StringEntity(stringJson, encode);
|
||||
httpput.setEntity(stringEntity);
|
||||
//响应信息
|
||||
httpResponse = closeableHttpClient.execute(httpput);
|
||||
HttpEntity entity = httpResponse.getEntity();
|
||||
content = EntityUtils.toString(entity, encode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
httpResponse.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
closeableHttpClient.close(); //关闭连接、释放资源
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean id="srcMonitoringDao" class="com.seeyon.apps.src_monitoring.dao.SrcMonitoringDao" />
|
||||
</beans>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean id="monitoringServer" class="com.seeyon.apps.src_monitoring.server.MonitoringServer" />
|
||||
</beans>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean id="monitoringPluginApi" class="com.seeyon.apps.src_monitoring.MonitoringPluginApi" />
|
||||
</beans>
|
||||
@@ -67,7 +67,8 @@
|
||||
const fieldInfo = s.messageObj.formdata.alldata.tableInfo.formmain.fieldInfo;
|
||||
|
||||
var startDateValue='',contractCodeValue='',contractDateValue='',creditValue='',principalValue='',moneyValue=''
|
||||
,interestRateValue='',updateCodeValue='',cycleValue='',loanTypeValue='',periodValue='';
|
||||
,interestRateValue='',updateCodeField = '',updateCodeValue='',cycleValue='',loanTypeValue='',periodValue=''
|
||||
,fireString='';
|
||||
|
||||
for (const key in fieldInfo) {
|
||||
const field = fieldInfo[key];
|
||||
@@ -101,6 +102,7 @@
|
||||
// interestRateValue = field.value;
|
||||
}else if(field.display === "触发文本更新"){
|
||||
var updateCode = {fieldId: key};
|
||||
updateCodeField = key;
|
||||
updateCodeValue = csdk.core.getFieldData(updateCode).value;
|
||||
// updateCodeValue = field.value;
|
||||
}else if(field.display === "利息还款周期"){
|
||||
@@ -115,30 +117,10 @@
|
||||
var period = {fieldId: key};
|
||||
periodValue = csdk.core.getFieldData(period).showValue;
|
||||
// periodValue = field.showValue;
|
||||
}else if(field.display === "触发文本"){
|
||||
var fireString = key;
|
||||
}
|
||||
}
|
||||
// var startDate = {fieldId: 'field0206'};//利息初始时间
|
||||
// var startDateValue = csdk.core.getFieldData(startDate).value;
|
||||
// var contractCode = {fieldId: 'field0001'};//合同编号
|
||||
// var contractCodeValue = csdk.core.getFieldData(contractCode).value;
|
||||
// var contractDate = {fieldId: 'field0007'};//签订日期
|
||||
// var contractDateValue = csdk.core.getFieldData(contractDate).value;
|
||||
// var credit = {fieldId: 'field0068'};//授信金额
|
||||
// var creditValue = csdk.core.getFieldData(credit).value;
|
||||
// var principal = {fieldId: 'field0212'};//计划还本金-列
|
||||
// var principalValue = csdk.core.getFieldData(principal).value;
|
||||
// var money = {fieldId: 'field0213'};//提款明细-列
|
||||
// var moneyValue = csdk.core.getFieldData(money).value;
|
||||
// var interestRate = {fieldId: 'field0214'};//利率明细-列
|
||||
// var interestRateValue = csdk.core.getFieldData(interestRate).value;
|
||||
// var updateCode = {fieldId: 'field0216'};//触发文本更新
|
||||
// var updateCodeValue = csdk.core.getFieldData(updateCode).value;
|
||||
// var cycle = {fieldId: 'field0207'};//利息还款周期
|
||||
// var cycleValue = csdk.core.getFieldData(cycle).showValue;
|
||||
// var loanType = {fieldId: 'field0014'};//借款类型
|
||||
// var loanTypeValue = csdk.core.getFieldData(loanType).showValue;
|
||||
// var period = {fieldId: 'field0011'};//借款期限
|
||||
// var periodValue = csdk.core.getFieldData(period).showValue;
|
||||
console.log(url2);
|
||||
var str = "";
|
||||
|
||||
@@ -167,7 +149,7 @@
|
||||
if(money!="" ){
|
||||
// self.adaptation.formdata.field0215.formmains.formmain_0725.field0216.value = res.num;
|
||||
var data = {
|
||||
fieldId: 'field0216',
|
||||
fieldId: updateCodeField,
|
||||
fieldData: {
|
||||
value: res.num+'', //数据值,存入数据库中的value值
|
||||
display: res.num+'' //字段渲染在页面上的显示值,通常是经过format后的值
|
||||
@@ -176,7 +158,7 @@
|
||||
csdk.core.setFieldData(data);
|
||||
}else{
|
||||
var data = {
|
||||
fieldId: 'field0216',
|
||||
fieldId: updateCodeField,
|
||||
fieldData: {
|
||||
value: res.num+'', //数据值,存入数据库中的value值
|
||||
display: res.num+'' //字段渲染在页面上的显示值,通常是经过format后的值
|
||||
@@ -184,7 +166,7 @@
|
||||
};
|
||||
csdk.core.setFieldData(data);
|
||||
var data1 = {
|
||||
fieldId: 'field0215',
|
||||
fieldId: fireString,
|
||||
fieldData: {
|
||||
value: randomNum+'', //数据值,存入数据库中的value值
|
||||
display: randomNum+'' //字段渲染在页面上的显示值,通常是经过format后的值
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
const fieldInfo = s.messageObj.formdata.alldata.tableInfo.formmain.fieldInfo;
|
||||
|
||||
var jifeifsValue='',jiaofeifsValue='',njiaofeifsValue='',mjzjValue='',gdzjValue='',startDateValue=''
|
||||
,endDateValue='',mjValue='',bdidValue='',bdidField = '';
|
||||
,endDateValue='',mjValue='',bdidValue='',bdidField = '',zjsfdzValue = '',zjdzblValue = '',mznxValue = '';
|
||||
for (const key in fieldInfo) {
|
||||
const field = fieldInfo[key];
|
||||
if (field.display === "计费方式") {
|
||||
@@ -81,61 +81,36 @@
|
||||
}else if(field.display === "年缴费方案选项"){
|
||||
var njiaofeifs = {fieldId: key};
|
||||
njiaofeifsValue = csdk.core.getFieldData(njiaofeifs).showValue;
|
||||
// njiaofeifsValue = field.showValue;
|
||||
}else if(field.display === "租赁单价"){
|
||||
var mjzj = {fieldId: key};
|
||||
mjzjValue = csdk.core.getFieldData(mjzj).value;
|
||||
// mjzjValue = field.value;
|
||||
}else if(field.display === "固定租金标准"){
|
||||
var gdzj = {fieldId: key};
|
||||
gdzjValue = csdk.core.getFieldData(gdzj).value;
|
||||
// gdzjValue = field.value;
|
||||
}else if(field.display === "合同开始日期"){
|
||||
var startDate = {fieldId: key};
|
||||
startDateValue = csdk.core.getFieldData(startDate).value;
|
||||
// startDateValue = field.value;
|
||||
}else if(field.display === "合同截止日期"){
|
||||
var endDate = {fieldId: key};
|
||||
endDateValue = csdk.core.getFieldData(endDate).value;
|
||||
// endDateValue = field.value;
|
||||
}else if(field.display === "租赁总面积"){
|
||||
var mj = {fieldId: key};
|
||||
mjValue = csdk.core.getFieldData(mj).value;
|
||||
// mjValue = field.value;
|
||||
}else if(field.display === "账单编号"){
|
||||
var bdid = {fieldId: key};
|
||||
bdidValue = csdk.core.getFieldData(bdid).value;
|
||||
bdidField = key;
|
||||
// bdidValue = field.value;
|
||||
}else if(field.display === "租金是否递增"){
|
||||
var zjsfdz = {fieldId: key};
|
||||
zjsfdzValue = csdk.core.getFieldData(zjsfdz).showValue;
|
||||
}else if(field.display === "租金递增比例"){
|
||||
var zjdzbl = {fieldId: key};
|
||||
zjdzblValue = csdk.core.getFieldData(zjdzbl).value;
|
||||
}else if(field.display === "免增年限"){
|
||||
var mznx = {fieldId: key};
|
||||
mznxValue = csdk.core.getFieldData(mznx).value;
|
||||
}
|
||||
}
|
||||
// // 计费方式
|
||||
// var jifeifsfield = {fieldId: 'field0027'};
|
||||
// var jifeifs = csdk.core.getFieldData(jifeifsfield).showValue;
|
||||
// // 缴费方式
|
||||
// var jiaofeifsfield = {fieldId: 'field0028'};
|
||||
// var jiaofeifs = csdk.core.getFieldData(jiaofeifsfield).showValue;
|
||||
// // 年缴费方式类型
|
||||
// var njiaofeifsfield = {fieldId: 'field0029'};
|
||||
// var njiaofeifs = csdk.core.getFieldData(njiaofeifsfield).showValue;
|
||||
// // 面积单价
|
||||
// var mjzjfield = {fieldId: 'field0030'};
|
||||
// var mjzj = csdk.core.getFieldData(mjzjfield).value;
|
||||
// // 固定租金单价
|
||||
// var gdzjfield = {fieldId: 'field0031'};
|
||||
// var gdzj = csdk.core.getFieldData(gdzjfield).value;
|
||||
// // 合同开始日期
|
||||
// var startDatefield = {fieldId: 'field0033'};
|
||||
// var startDate = csdk.core.getFieldData(startDatefield).value;
|
||||
// // 合同结束日期
|
||||
// var endDatefield = {fieldId: 'field0034'};
|
||||
// var endDate = csdk.core.getFieldData(endDatefield).value;
|
||||
// // 租赁面积
|
||||
// var mjfield = {fieldId: 'field0041'};
|
||||
// var mj = csdk.core.getFieldData(mjfield).value;
|
||||
// // 账单编号
|
||||
// var bdidfield = {fieldId: 'field0062'};
|
||||
// var bdid = csdk.core.getFieldData(bdidfield).value;
|
||||
|
||||
// 判断合同开始日期是否在合同结束日期之前
|
||||
if(!isEmpty(startDateValue)|| !isEmpty(endDateValue)){
|
||||
@@ -171,7 +146,10 @@
|
||||
"mj":mjValue,
|
||||
"mjzj":mjzjValue,
|
||||
"gdzj":gdzjValue,
|
||||
"bdid":bdidValue
|
||||
"bdid":bdidValue,
|
||||
"zjsfdz":zjsfdzValue,
|
||||
"zjdzbl":zjdzblValue,
|
||||
"mznx":mznxValue
|
||||
},
|
||||
dataType : 'json',
|
||||
contentType : 'application/json; charset=UTF-8',
|
||||
|
||||
Reference in New Issue
Block a user