Compare commits

...

5 Commits

Author SHA1 Message Date
67ea253fc9 优化修bug 2026-06-05 21:43:41 +08:00
e5615a0068 改变目录结构 2026-06-05 18:21:23 +08:00
e366c682a2 Merge remote-tracking branch 'origin/master' into CLXCZC
# Conflicts:
#	v5/apps-customize/src/main/java/com/seeyon/apps/src_leasebill/controller/LeaseBillController.java
#	v5/apps-customize/src/main/java/com/seeyon/apps/src_leasebill/dao/impl/LeaseBillDaoImpl.java
#	v5/apps-customize/src/main/java/com/seeyon/apps/src_leasebill/util/LeaseBillUtil.java
2026-06-05 18:01:56 +08:00
624ccfb50a 修复精度bug 2026-06-05 17:47:11 +08:00
8fe015cda7 优化代码 2026-06-05 13:00:06 +08:00
28 changed files with 236 additions and 161 deletions

View File

@@ -12,7 +12,17 @@ public class FieldDisplayNameQueryService {
public String getDisplayName(String fieldName) {
String jsonStr = configProvider.getBizConfigByKey(LeaseBillConstant.fieldDisplayMap);
if (jsonStr == null || jsonStr.trim().isEmpty()) {
throw new RuntimeException("字段显示名称映射配置为空,请检查插件配置 fieldDisplayMap");
}
Map<String,String> map = (Map<String,String>)JsonUtils.parseObject(jsonStr, Map.class);
return map.get(fieldName);
if (map == null) {
throw new RuntimeException("字段显示名称映射解析失败,配置内容:" + jsonStr);
}
String displayName = map.get(fieldName);
if (displayName == null) {
throw new RuntimeException("字段显示名称映射中未找到key" + fieldName);
}
return displayName;
}
}

View File

@@ -78,8 +78,34 @@ public class LeaseBillController extends BaseController {
this.leaseBillDao = leaseBillDao;
}
// ======================== 主入口生成账单 ========================
// ======================== 主入口 ========================
public ModelAndView index(HttpServletRequest request, HttpServletResponse response) throws Exception {
String action = request.getParameter("action");
if ("getFieldDisplayMap".equals(action)) {
return getFieldDisplayMap(request, response);
}
return generateBill(request, response);
}
// ======================== 获取字段显示名称映射 ========================
private ModelAndView getFieldDisplayMap(HttpServletRequest request, HttpServletResponse response) {
log.info("====== 获取字段显示名称映射 ======");
Map<String, Object> res = new HashMap<>();
try {
String jsonStr = configProvider.getBizConfigByKey(LeaseBillConstant.fieldDisplayMap);
res.put("success", true);
res.put("data", jsonStr);
} catch (Exception e) {
log.error("获取字段映射异常", e);
res.put("success", false);
res.put("s", "获取字段映射失败:" + e.getMessage());
}
render(response, JSONUtil.toJSONString(res));
return null;
}
// ======================== 生成账单 ========================
private ModelAndView generateBill(HttpServletRequest request, HttpServletResponse response) throws Exception {
log.info("====== 进入生成账单Ajax方法 ======");
ConfigVo configVo = getYdctLeaseBillConfig();
@@ -104,10 +130,17 @@ public class LeaseBillController extends BaseController {
}
String data = requestBody.toString();
if (data.isEmpty()) {
res.put("success", false);
res.put("s", "请求参数为空");
render(response, JSONUtil.toJSONString(res));
return null;
}
String decodedParam = URLDecoder.decode(data, "UTF-8");
String[] datas = decodedParam.split("&");
JSONObject jsonObject = new JSONObject();
for (String paramStr : datas) {
if (paramStr.isEmpty()) continue;
String[] params = paramStr.split("=");
if (params.length > 1) {
jsonObject.put(params[0], params[1]);
@@ -117,14 +150,16 @@ public class LeaseBillController extends BaseController {
}
log.info("前端入参:{}", jsonObject.toString());
try {
// ===================== 2. 账单编号处理 =====================
String bdidValue = jsonObject.getString("bdid");
if (bdidValue == null) {
bdidValue = "";
}
log.info("当前账单编号:{}", bdidValue);
String code = bdidValue;
if ("0".equals(bdidValue)) {
if ("0".equals(bdidValue) || bdidValue.isEmpty()) {
// 编号为0 新建编号
code = sdfNo.format(new Date());
log.info("生成新账单编号:{}", code);
@@ -176,10 +211,8 @@ public class LeaseBillController extends BaseController {
// 年缴 判断年缴计算方式
String njiaofeifs = jsonObject.getString("njiaofeifs");
if (StringUtil.isEmpty(njiaofeifs)) {
res.put("success", true);
res.put("name", AppContext.currentUserLoginName());
res.put("success", false);
res.put("s", "请选择年缴费计算方式");
res.put("num", "");
render(response, JSONUtil.toJSONString(res));
return null;
}
@@ -235,11 +268,11 @@ public class LeaseBillController extends BaseController {
res.put("success", false);
res.put("s", "生成账单失败:" + e.getMessage());
}
render(response, JSONUtil.toJSONString(res));
return null;
}
// ======================== 输出JSON ========================
private void render(HttpServletResponse response, String text) {
response.setContentType("application/json;charset=UTF-8");
@@ -251,6 +284,7 @@ public class LeaseBillController extends BaseController {
}
// ======================== 配置 ========================
public ConfigVo getYdctLeaseBillConfig() {
return cstConfigApi.getConfig(getPluginId());
}

View File

@@ -15,16 +15,30 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* 租金账单DAO实现类
* 功能查询删除账单主表和明细表数据
*/
public class LeaseBillDaoImpl implements ILeaseBillDao {
private LeaseBillConfigProvider configProvider = (LeaseBillConfigProvider) AppContext.getBean("leaseBillConfigProvider");
private FieldDisplayNameQueryService fieldDisplayNameQueryService = (FieldDisplayNameQueryService) AppContext.getBean("fieldDisplayNameQueryService");
/** 配置提供者 */
private final LeaseBillConfigProvider configProvider =
(LeaseBillConfigProvider) AppContext.getBean("leaseBillConfigProvider");
private String getFormNo(){
/** 字段名称查询服务 */
private final FieldDisplayNameQueryService fieldDisplayNameQueryService =
(FieldDisplayNameQueryService) AppContext.getBean("fieldDisplayNameQueryService");
/**
* 获取表单编号
*/
private String getFormNo() {
return configProvider.getBizConfigByKey(LeaseBillConstant.assistiveFormNo);
}
/**
* 根据账单编号查询账单ID列表
*/
@Override
public List<String> leaseBillByCode(String code) throws BusinessException, SQLException {
List<String> lists = new ArrayList<String>();
@@ -40,6 +54,9 @@ public class LeaseBillDaoImpl implements ILeaseBillDao {
return lists;
}
/**
* 根据ID删除账单主表数据
*/
@Override
public int deleteBillById(String id) throws BusinessException, SQLException {
TableContext tableContext = FormTableExecutor.master(getFormNo());
@@ -48,12 +65,15 @@ public class LeaseBillDaoImpl implements ILeaseBillDao {
return FormTableExecutor.delete(tableContext, conditions);
}
/**
* 根据主表ID删除账单明细表数据
*/
@Override
public int deleteBillsByBillId(String formmainId) throws BusinessException, SQLException {
String tableName = configProvider.getBizConfigByKey(LeaseBillConstant.billAssistiveTableName);
TableContext sub = FormTableExecutor.sub(getFormNo(), tableName);
List<FormWhereCondition> conditions = new ArrayList<>();
conditions.add(FormWhereCondition.build().display("formmain_id").value(formmainId));
return FormTableExecutor.delete(sub,conditions);
return FormTableExecutor.delete(sub, conditions);
}
}

View File

@@ -23,7 +23,20 @@ public class DateUtil {
int yearsDiff = endCalendar.get(Calendar.YEAR) - startCalendar.get(Calendar.YEAR);
int monthsDiff = yearsDiff * 12 + endCalendar.get(Calendar.MONTH)- startCalendar.get(Calendar.MONTH);
if (endCalendar.get(Calendar.DAY_OF_MONTH) > startCalendar.get(Calendar.DAY_OF_MONTH)) {
// 月末日期规范化将起始日为月末的日期规范化为相同参考日避免不同月份天数差异导致误判
// 例如1月31日2月28日规范化为 1月28日2月28日day相同不加月
int startDay = startCalendar.get(Calendar.DAY_OF_MONTH);
int endDay = endCalendar.get(Calendar.DAY_OF_MONTH);
int startMaxDay = startCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
int endMaxDay = endCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
if (startDay == startMaxDay) {
startDay = Math.min(startDay, endMaxDay);
}
if (endDay == endMaxDay) {
endDay = Math.min(endDay, startMaxDay);
}
if (endDay > startDay) {
monthsDiff++;
}
return monthsDiff;
@@ -106,19 +119,18 @@ public class DateUtil {
public int getCycleNum (String cycle){
int cycleNum = 1;
if("".equals(cycle)||"月付".equals(cycle)){
cycleNum = 1;
return 1;
}else if("".equals(cycle)||"季付".equals(cycle)){
cycleNum = 3;
return 3;
}else if("半年".equals(cycle)||"半年付".equals(cycle)){
cycleNum = 6;
return 6;
}else if("".equals(cycle)||"年付".equals(cycle)){
cycleNum = 12;
return 12;
}else if("一次性".equals(cycle)||"其他".equals(cycle)){
cycleNum = 99;
return 99;
}
return cycleNum;
throw new IllegalArgumentException("未识别的缴费方式:" + cycle + ",请检查表单缴费方式字段值");
}
public double stringToNum(String str){

View File

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import com.seeyon.apps.src_leasebill.config.FieldDisplayNameQueryService;
import com.seeyon.ctp.common.AppContext;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -20,15 +22,22 @@ public class LeaseBillUtil {
(FieldDisplayNameQueryService) AppContext.getBean("fieldDisplayNameQueryService");
/**
* 日期格式化工具yyyy-MM-dd
* 获取日期格式化工具线程安全
*/
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private SimpleDateFormat getSdf() {
return new SimpleDateFormat("yyyy-MM-dd");
}
/**
* 日期工具类实例
*/
private final DateUtil dateUtil = new DateUtil();
/**
* 金额精度保留2位小数
*/
private static final int MONEY_SCALE = 2;
// ======================== 1主方法生成租金账单支持一次性/周期 ========================
/**
@@ -47,8 +56,8 @@ public class LeaseBillUtil {
// ====================== 控制台打印生成账单入参 ======================
System.out.println("======================================");
System.out.println("【主方法】生成账单参数开始");
System.out.println("租赁开始时间:" + sdf.format(startTime.getTime()));
System.out.println("租赁结束时间:" + sdf.format(endTime.getTime()));
System.out.println("租赁开始时间:" + getSdf().format(startTime.getTime()));
System.out.println("租赁结束时间:" + getSdf().format(endTime.getTime()));
System.out.println("是否每月最后一天:" + isMonthLastDay);
System.out.println("缴费周期(月):" + payCycleMonths);
System.out.println("计费方式:" + chargeType);
@@ -70,6 +79,7 @@ public class LeaseBillUtil {
return createCycleBills(startTime, endTime, isMonthLastDay, payCycleMonths, params, chargeType);
}
// ======================== 2按年周期账单版本1 ========================
/**
@@ -80,8 +90,8 @@ public class LeaseBillUtil {
// ====================== 控制台打印生成账单入参 ======================
System.out.println("======================================");
System.out.println("【按年方法1】生成账单参数开始");
System.out.println("租赁开始时间:" + sdf.format(startTime.getTime()));
System.out.println("租赁结束时间:" + sdf.format(endTime.getTime()));
System.out.println("租赁开始时间:" + getSdf().format(startTime.getTime()));
System.out.println("租赁结束时间:" + getSdf().format(endTime.getTime()));
System.out.println("是否每月最后一天:" + isMonthLastDay);
System.out.println("缴费周期(月):" + payCycleMonths);
System.out.println("计费方式:" + chargeType);
@@ -92,6 +102,7 @@ public class LeaseBillUtil {
return createCycleBills(startTime, endTime, isMonthLastDay, payCycleMonths, params, chargeType);
}
// ======================== 3按自然年切割账单版本2 ========================
/**
@@ -102,8 +113,8 @@ public class LeaseBillUtil {
// ====================== 控制台打印生成账单入参 ======================
System.out.println("======================================");
System.out.println("【按年方法2】生成账单参数开始");
System.out.println("租赁开始时间:" + sdf.format(startTime.getTime()));
System.out.println("租赁结束时间:" + sdf.format(endTime.getTime()));
System.out.println("租赁开始时间:" + getSdf().format(startTime.getTime()));
System.out.println("租赁结束时间:" + getSdf().format(endTime.getTime()));
System.out.println("是否每月最后一天:" + isMonthLastDay);
System.out.println("缴费周期(月):" + payCycleMonths);
System.out.println("计费方式:" + chargeType);
@@ -123,7 +134,7 @@ public class LeaseBillUtil {
if (!tempStart.before(endTime)) break;
Map<String, String> bill = new HashMap<>();
bill.put(fieldDisplayNameService.getDisplayName("开始日期"), sdf.format(tempStart.getTime()));
bill.put(fieldDisplayNameService.getDisplayName("开始日期"), getSdf().format(tempStart.getTime()));
// 设置为当年最后一天12月31日
tempStart.set(Calendar.MONTH, 11);
@@ -135,27 +146,26 @@ public class LeaseBillUtil {
nextYearStart.add(Calendar.DATE, 1);
int monthCount = dateUtil.betweenMonthByTwoCalendar(yearBaseCal, nextYearStart);
double rent = calculateRent(monthCount, params, chargeType);
String rent = calculateRent(monthCount, params, chargeType);
bill.put(fieldDisplayNameService.getDisplayName("租费"), String.valueOf(rent));
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), sdf.format(tempStart.getTime()));
bill.put(fieldDisplayNameService.getDisplayName("租费"), rent);
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), getSdf().format(tempStart.getTime()));
yearBaseCal = (Calendar) tempStart.clone();
} else {
// 最后一个年度 不足一年
int monthCount = dateUtil.betweenMonthByTwoCalendar(yearBaseCal, endTime);
double rent = calculateRent(monthCount, params, chargeType);
String rent = calculateRent(monthCount, params, chargeType);
Calendar realEnd = (Calendar) endTime.clone();
realEnd.add(Calendar.DATE, -1);
bill.put(fieldDisplayNameService.getDisplayName("租费"), String.valueOf(rent));
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), sdf.format(realEnd.getTime()));
bill.put(fieldDisplayNameService.getDisplayName("租费"), rent);
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), getSdf().format(realEnd.getTime()));
}
// 下一期开始时间 = 当前结束时间 + 1天
tempStart.add(Calendar.DATE, 1);
// 👆 这里已经修复删除了错误的 calendar.add(...)
// 如果是月末模式设置为当月最后一天
if (isMonthLastDay) {
@@ -176,16 +186,16 @@ public class LeaseBillUtil {
private Map<String, String> createOneTimeBill(Calendar startTime, Calendar endTime, int totalMonths,
JSONObject params, String chargeType) {
Map<String, String> bill = new HashMap<>();
double rent = calculateRent(totalMonths, params, chargeType);
String rent = calculateRent(totalMonths, params, chargeType);
bill.put(fieldDisplayNameService.getDisplayName("开始日期"), sdf.format(startTime.getTime()));
bill.put(fieldDisplayNameService.getDisplayName("开始日期"), getSdf().format(startTime.getTime()));
// 结束时间 = 原结束时间 -1天
Calendar realEnd = (Calendar) endTime.clone();
realEnd.add(Calendar.DATE, -1);
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), sdf.format(realEnd.getTime()));
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), getSdf().format(realEnd.getTime()));
bill.put(fieldDisplayNameService.getDisplayName("租费"), String.valueOf(rent));
bill.put(fieldDisplayNameService.getDisplayName("租费"), rent);
return bill;
}
@@ -210,7 +220,7 @@ public class LeaseBillUtil {
if (!tempStart.before(endTime)) break;
Map<String, String> bill = new HashMap<>();
bill.put(fieldDisplayNameService.getDisplayName("开始日期"), sdf.format(tempStart.getTime()));
bill.put(fieldDisplayNameService.getDisplayName("开始日期"), getSdf().format(tempStart.getTime()));
// 计算本期结束日 = 开始时间 + 周期月数 - 1天
Calendar periodEnd = (Calendar) tempStart.clone();
@@ -219,19 +229,19 @@ public class LeaseBillUtil {
if (periodEnd.before(endTime)) {
// 正常完整周期
double rent = calculateRent(payCycleMonths, params, chargeType);
bill.put(fieldDisplayNameService.getDisplayName("租费"), String.valueOf(rent));
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), sdf.format(periodEnd.getTime()));
String rent = calculateRent(payCycleMonths, params, chargeType);
bill.put(fieldDisplayNameService.getDisplayName("租费"), rent);
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), getSdf().format(periodEnd.getTime()));
} else {
// 最后一期不足一个缴费周期
int realMonths = dateUtil.betweenMonthByTwoCalendar(tempStart, endTime);
double rent = calculateRent(realMonths, params, chargeType);
String rent = calculateRent(realMonths, params, chargeType);
Calendar realEnd = (Calendar) endTime.clone();
realEnd.add(Calendar.DATE, -1);
bill.put(fieldDisplayNameService.getDisplayName("租费"), String.valueOf(rent));
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), sdf.format(realEnd.getTime()));
bill.put(fieldDisplayNameService.getDisplayName("租费"), rent);
bill.put(fieldDisplayNameService.getDisplayName("结束日期"), getSdf().format(realEnd.getTime()));
}
// 下一期开始时间
@@ -255,24 +265,44 @@ public class LeaseBillUtil {
* @param months 计费月数
* @param params 表单参数
* @param chargeType 计费方式
* @return 计算后租金金额
* @return 计算后租金金额保留2位小数
*/
private double calculateRent(int months, JSONObject params, String chargeType) {
double unitPrice = 0;
private String calculateRent(int months, JSONObject params, String chargeType) {
BigDecimal rent = BigDecimal.ZERO;
boolean isAreaCharge = "面积计费".equals(chargeType);
boolean isFixedRent = "固定租金".equals(chargeType);
if (isAreaCharge) {
// 面积计费租金 = 面积 × 每平单价
double area = Double.parseDouble(params.getString("mj"));
double pricePerArea = dateUtil.stringToNum(params.getString("mjzj"));
unitPrice = area * pricePerArea;
BigDecimal area = parseBigDecimal(params.getString("mj"));
BigDecimal pricePerArea = parseBigDecimal(params.getString("mjzj"));
rent = area.multiply(pricePerArea);
} else if (isFixedRent) {
// 固定租金直接取固定金额
unitPrice = dateUtil.stringToNum(params.getString("gdzj"));
rent = parseBigDecimal(params.getString("gdzj"));
}
// 固定租金不乘月数其他计费方式 × 月数
return isFixedRent ? unitPrice : unitPrice * months;
if (!isFixedRent) {
rent = rent.multiply(new BigDecimal(months));
}
// 保留2位小数四舍五入
return rent.setScale(MONEY_SCALE, RoundingMode.HALF_UP).toString();
}
/**
* 将字符串解析为BigDecimal处理逗号分隔符
*
* @param str 数字字符串可能包含逗号分隔符
* @return BigDecimal对象
*/
private BigDecimal parseBigDecimal(String str) {
if (str == null || str.trim().isEmpty()) {
return BigDecimal.ZERO;
}
// 移除逗号分隔符
String cleanStr = str.replace(",", "").trim();
return new BigDecimal(cleanStr);
}
}

View File

@@ -55,103 +55,79 @@
},
doBiz: function(privateId, messageObj, adaptation) {
var url2 = window.location.origin;
var self = this;
messageObj = adaptation.childrenGetData(privateId);
const targetObj = messageObj.formdata.formmains[adaptation.formMessage.tableName]
var jifeifs;// 计费方式
var jiaofeifs;// 缴费方式
var njiaofeifs;// 年缴费方式类型
var mjzj;// 面积单价
var gdzj;// 固定租金单价
var startDate;// 合同开始日期
var endDate;// 合同结束日期
var mj;// 租赁面积
var bdid; // 账单编号
var bdidFieldName;
var targetObj = messageObj.formdata.formmains[adaptation.formMessage.tableName];
// 先获取字段显示名称映射,再执行业务逻辑
$.ajax({
type: 'get',
async: true,
url: encodeURI('/seeyon/leaseBillController.do?action=getFieldDisplayMap&datetime=' + Math.random()),
dataType: 'json',
success: function(mappingRes) {
if (!mappingRes.success) {
$.alert(mappingRes.s || "获取字段映射失败");
return;
}
var fieldMap = JSON.parse(mappingRes.data);
self.doGenerateBill(targetObj, fieldMap, adaptation, privateId);
},
error: function() {
$.alert("获取字段映射请求失败");
}
});
},
doGenerateBill: function(targetObj, fieldMap, adaptation, privateId) {
// 校验字段映射配置完整性
var requiredKeys = ["计费方式", "缴费方式", "计租日期", "合同截止日期", "账单编号"];
for (var i = 0; i < requiredKeys.length; i++) {
if (!fieldMap[requiredKeys[i]]) {
$.alert("字段映射配置缺少必要key" + requiredKeys[i] + ",请联系管理员检查插件配置");
return;
}
}
var jifeifs, jiaofeifs, njiaofeifs, mjzj, gdzj, startDate, endDate, mj, bdid, bdidFieldName;
if (targetObj) {
for (const key in targetObj) {
console.log(targetObj)
for (var key in targetObj) {
if (targetObj.hasOwnProperty(key) && !/^auxiliary/.test(key)) {
if (targetObj[key].display === "计费方式") {
jifeifs = targetObj[key].showValue
}
if(targetObj[key].display === "缴费方式") {
jiaofeifs = targetObj[key].showValue
}
if(targetObj[key].display === "年缴费方案选项") {
njiaofeifs = targetObj[key].showValue
}
if(targetObj[key].display === "租赁单价") {
mjzj = targetObj[key].showValue
}
if(targetObj[key].display === "固定租金标准") {
gdzj = targetObj[key].showValue
}
if(targetObj[key].display === "计租日期") {
startDate = targetObj[key].showValue
}
if(targetObj[key].display === "合同截止日期") {
endDate = targetObj[key].showValue
}
if(targetObj[key].display === "租赁面积") {
mj = targetObj[key].showValue
}
if(targetObj[key].display === "账单编号") {
bdidFieldName = key
bdid = targetObj[key].showValue
var display = targetObj[key].display;
if (display === fieldMap["计费方式"]) {
jifeifs = targetObj[key].showValue;
} else if (display === fieldMap["缴费方式"]) {
jiaofeifs = targetObj[key].showValue;
} else if (display === fieldMap["年缴费方案选项"]) {
njiaofeifs = targetObj[key].showValue;
} else if (display === fieldMap["租赁单价"]) {
mjzj = targetObj[key].showValue;
} else if (display === fieldMap["固定租金标准"]) {
gdzj = targetObj[key].showValue;
} else if (display === fieldMap["计租日期"]) {
startDate = targetObj[key].showValue;
} else if (display === fieldMap["合同截止日期"]) {
endDate = targetObj[key].showValue;
} else if (display === fieldMap["租赁面积"]) {
mj = targetObj[key].showValue;
} else if (display === fieldMap["账单编号"]) {
bdidFieldName = key;
bdid = targetObj[key].showValue;
}
}
}
}
// var s = self;
// var recordId = self.messageObj.formdata.formsons.front_formson_7.records[0].recordId;
// 计费方式
// var jifeifsfield = {
// fieldId: 'field0032'
// };
// var jifeifs = csdk.core.getFieldData(jifeifsfield).showValue;
// 缴费方式
// var jiaofeifsfield = {
// fieldId: 'field0033'
// };
// var jiaofeifs = csdk.core.getFieldData(jiaofeifsfield).showValue;
// 年缴费方式类型
// var njiaofeifsfield = {
// fieldId: 'field0034'
// };
// var njiaofeifs = csdk.core.getFieldData(njiaofeifsfield).showValue;
// 面积单价
// var mjzjfield = {
// fieldId: 'field0035'
// };
// var mjzj = csdk.core.getFieldData(mjzjfield).value;
// 固定租金单价
// var gdzjfield = {
// fieldId: 'field0038'
// };
// var gdzj = csdk.core.getFieldData(gdzjfield).value;
// 合同开始日期
// var startDatefield = {
// fieldId: 'field0041'
// };
// var startDate = csdk.core.getFieldData(startDatefield).value;
// 合同结束日期
// var endDatefield = {
// fieldId: 'field0042'
// };
// var endDate = csdk.core.getFieldData(endDatefield).value;
// 租赁面积
// var mjfield = {
// fieldId: 'field0081'
// };
// var mj = csdk.core.getFieldData(mjfield).value;
// 账单编号
// var field0083 = {fieldId: 'field0083'};
// var field0083value = csdk.core.getFieldData(field0083).value;
// var bdidfield = {
// fieldId: 'field0101'
// };
// var bdid = csdk.core.getFieldData(bdidfield).value;
// 校验表单必填字段是否已匹配
if (isEmpty(jifeifs)) {
$.alert("未找到计费方式字段或值为空,请检查表单");
return;
}
if (isEmpty(jiaofeifs)) {
$.alert("未找到缴费方式字段或值为空,请检查表单");
return;
}
// 判断合同开始日期是否在合同结束日期之前
if (!isEmpty(startDate) || !isEmpty(endDate)) {
@@ -172,11 +148,9 @@
}
}
var str = "";
$.ajax({
type: 'post',
async: true,
// 记得加随机数不然如果ajax轮询请求会不执行
url: encodeURI('/seeyon/leaseBillController.do?datetime=' + Math.random()),
data: {
"jifeifs": jifeifs,
@@ -192,23 +166,18 @@
dataType: 'json',
contentType: 'application/json; charset=UTF-8',
success: function(res) {
var randomNum = Math.floor(Math.random() * 10001);
if (res.success) {
// $.alert("账单明细生成完成");
if (bdid == "") {
if (bdid == "" || bdid == "0") {
var data = {
fieldId: bdidFieldName,
fieldData: {
value: res.num + '', //数据值存入数据库中的value值
display: res.num + '', //字段渲染在页面上的显示值通常是经过format后的值
value: res.num + '',
display: res.num + '',
auth: ''
}
};
csdk.core.setFieldData(data);
}
// messageObj.formdata.formmains[adaptation.formMessage.tableName]
// self.adaptation.formdata.field0095.formmains.formmain_0228.field0064.value = randomNum;
// self.adaptation.formdata.field0100__.formmains.formmain_0033.field0102.value = randomNum;
} else {
$.alert(res.s);
}