Commit 4b385da7 by 宋祥

Merge branch 'dev-sx' of http://git.pseer.com:8800/platform/hg-smart into dev

parents 45800e0d ffcf575b
...@@ -332,7 +332,7 @@ ...@@ -332,7 +332,7 @@
a.PROJ_CODE as "projCode", <!-- 项目编码 --> a.PROJ_CODE as "projCode", <!-- 项目编码 -->
a.PROJ_NAME as "projName", <!-- 项目名称 --> a.PROJ_NAME as "projName", <!-- 项目名称 -->
a.CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 --> a.CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
b.STATUS as "status", <!-- 状态 --> a.STATUS as "status", <!-- 状态 -->
b.CONTRACT_DATE as "contractDate", <!-- 合同日期 --> b.CONTRACT_DATE as "contractDate", <!-- 合同日期 -->
b.CONTRACT_NO as "contractNo", <!-- 合同号 --> b.CONTRACT_NO as "contractNo", <!-- 合同号 -->
b.PLAN_NO as "planNo", <!-- 计划单号 --> b.PLAN_NO as "planNo", <!-- 计划单号 -->
......
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ016;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/8/23,16:47
*/
public class ServiceHGPZ016 extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID));
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGPZ016.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HGPZ016.QUERY, new HGPZ016());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户画像", operType = "保存", operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<HGPZ016> fPz016s = MapUtils.toDaoEPBases(inInfo, HGPZ016.class);
// 写入数据
for (HGPZ016 fPz016 : fPz016s) {
if (fPz016.getId() == null || fPz016.getId() == 0) {
this.add(fPz016);
} else {
this.modify(fPz016);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fPz016s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param fPz016
*/
public void add(HGPZ016 fPz016) {
DaoUtils.insert(HGPZ016.INSERT, fPz016);
}
/**
* 修改操作
*
* @param fPz016
*/
public void modify(HGPZ016 fPz016) {
fPz016.setPurchaseDate(StringUtil.removeHorizontalLine(fPz016.getPurchaseDate()));
DaoUtils.update(HGPZ016.UPDATE, fPz016);
}
/**
* 删除
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户画像", operType = "删除", operDesc = "删除操作")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGPZ016> fPz016s = MapUtils.toDaoEPBases(inInfo, HGPZ016.class);
for (HGPZ016 fPz016 : fPz016s) {
fPz016.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGPZ016.DELETE, fPz016);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + fPz016s.size() + "]条数据删除成功!");
} catch (PlatException e) {
LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.hg.pz.domain.HGPZ016;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.Map;
/**
* @author:songx
* @date:2024/8/23,16:06
*/
public class ServiceHGPZ016A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID));
// 填充信息
this.setProjectInfo(inInfo);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 设置项目信息
*
* @param inInfo
*/
public void setProjectInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
Long id = MapUtils.getLong(queryRow, HGPZ016.FIELD_ID);
if (id == null) {
return;
}
EiBlock resultBlock = new EiBlock(EiConstant.resultBlock);
resultBlock.addRow(HGPZTools.HgPz016.get(id));
resultBlock.addBlockMeta(new HGPZ016().eiMetadata);
inInfo.setBlock(resultBlock);
}
/**
* 查询
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
return super.query(inInfo);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGPZ016">
<sql id="column">
ID as "id", <!-- ID -->
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_NAME as "updatedName",
UPDATED_TIME as "updatedTime",
DELETE_FLAG as "deleteFlag", <!-- 是否删除0:否1.是 -->
CUST_CODE as "custCode", <!-- 客户编码 -->
CUST_NAME as "custName", <!-- 客户名称 -->
BEHAVIOR_TYPE as "behaviorType", <!-- 行业类型 -->
COMPANY_SCALE as "companyScale", <!-- 企业规模 -->
USER_COUNT as "userCount", <!-- 员工人数 -->
REVENUE as "revenue", <!-- 营业收入 -->
INDU_TYPE as "induType", <!-- 产品类型 -->
INDU_QUALITY as "induQuality", <!-- 产品质量 -->
USAGE_SCENARIO as "usageScenario", <!-- 使用场景 -->
PURCHASE_NUM as "purchaseNum", <!-- 购买频率 -->
PURCHASE_DATE as "purchaseDate", <!-- 最近购买时间 -->
PAYMENT_MODE as "paymentMode", <!-- 支付方式 -->
MISFEASOR_NAME as "misfeasorName", <!-- 违法行为 -->
MISFEASOR_NUM as "misfeasorNum" <!-- 违约次数 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custCode">
CUST_CODE = #custCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custName">
CUST_NAME = #custName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="behaviorType">
BEHAVIOR_TYPE = #behaviorType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyScale">
COMPANY_SCALE = #companyScale#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userCount">
USER_COUNT = #userCount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="revenue">
REVENUE = #revenue#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="induType">
INDU_TYPE LIKE CONCAT('%', #induType#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="induQuality">
INDU_QUALITY = #induQuality#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="usageScenario">
USAGE_SCENARIO = #usageScenario#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purchaseNum">
PURCHASE_NUM = #purchaseNum#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purchaseDate">
PURCHASE_DATE = #purchaseDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="paymentMode">
PAYMENT_MODE = #paymentMode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="misfeasorName">
MISFEASOR_NAME = #misfeasorName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="misfeasorNum">
MISFEASOR_NUM = #misfeasorNum#
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
PURCHASE_DATE desc, CREATED_TIME desc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.pz.domain.HGPZ016">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGPZ016
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ016
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGPZ016 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建名称 -->
CREATED_TIME, <!-- 创建时间 -->
CUST_CODE, <!-- 客户编码 -->
CUST_NAME, <!-- 客户名称 -->
BEHAVIOR_TYPE, <!-- 行业类型 -->
COMPANY_SCALE, <!-- 企业规模 -->
USER_COUNT, <!-- 员工人数 -->
REVENUE, <!-- 营业收入 -->
INDU_TYPE, <!-- 产品类型 -->
INDU_QUALITY, <!-- 产品质量 -->
USAGE_SCENARIO, <!-- 使用场景 -->
PURCHASE_NUM, <!-- 购买频率 -->
PURCHASE_DATE, <!-- 最近购买时间 -->
PAYMENT_MODE, <!-- 支付方式 -->
MISFEASOR_NAME, <!-- 违法行为 -->
MISFEASOR_NUM <!-- 违约次数 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#custCode#, #custName#, #behaviorType#, #companyScale#, #userCount#,
#revenue#, #induType#, #induQuality#, #usageScenario#, #purchaseNum#,
#purchaseDate#, #paymentMode#, #misfeasorName#, #misfeasorNum#
)
</insert>
<delete id="delete">
UPDATE ${hggpSchema}.HGPZ016
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0:否1.是 -->
WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGPZ016
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#,
BEHAVIOR_TYPE = #behaviorType#, <!-- 行业类型 -->
COMPANY_SCALE = #companyScale#, <!-- 企业规模 -->
USER_COUNT = #userCount#, <!-- 员工人数 -->
REVENUE = #revenue#, <!-- 营业收入 -->
INDU_TYPE = #induType#, <!-- 产品类型 -->
INDU_QUALITY = #induQuality#, <!-- 产品质量 -->
USAGE_SCENARIO = #usageScenario#, <!-- 使用场景 -->
PURCHASE_NUM = #purchaseNum#, <!-- 购买频率 -->
PURCHASE_DATE = #purchaseDate#, <!-- 最近购买时间 -->
PAYMENT_MODE = #paymentMode#, <!-- 支付方式 -->
MISFEASOR_NAME = #misfeasorName#, <!-- 违法行为 -->
MISFEASOR_NUM = #misfeasorNum# <!-- 违约次数 -->
WHERE ID = #id#
</update>
</sqlMap>
...@@ -719,5 +719,24 @@ public class HGPZTools { ...@@ -719,5 +719,24 @@ public class HGPZTools {
return CollectionUtils.isEmpty(results) ? null : results; return CollectionUtils.isEmpty(results) ? null : results;
} }
} }
/**
* @author:songx
* @date:2024/8/23,16:48
*/
public static class HgPz016 {
/**
* @param id
* @return
*/
public static HGPZ016 get(Long id) {
AssertUtils.isNull(id, "ID不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGPZ016.FIELD_ID, id);
List<HGPZ016> results = DaoBase.getInstance().query(HGPZ016.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
} }
package com.baosight.iplat4j.core.security;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.iplat4j.core.web.WebUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.util.matcher.OrRequestMatcher;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* @author:songx
* @date:2024/8/26,17:01
*/
public class PlatServiceValidateFilter implements Filter {
private final Logger logger = LogManager.getLogger(PlatServiceValidateFilter.class);
protected ITokenValidateFilter iTokenValidateFilter = null;
private AuthenticationEntryPoint entryPoint;
private String filterServiceId = null;
private OrRequestMatcher orRequestMatcher;
public PlatServiceValidateFilter() {
}
public void setFilterServiceId(String filterServiceId) {
this.filterServiceId = filterServiceId;
}
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
FilterChain filterChain) throws ServletException, IOException {
String ip = WebUtils.getRemoteAddr(httpServletRequest);
this.logger.debug("******cached ip:" + ip + "**********");
boolean authed = false;
String uri = httpServletRequest.getServletPath();
SecurityContext context = SecurityContextHolder.getContext();
if (context != null && context.getAuthentication() != null) {
Collection<? extends GrantedAuthority> authoritis = context.getAuthentication().getAuthorities();
if (authoritis != null && !authoritis.isEmpty()) {
Iterator var9 = authoritis.iterator();
while (var9.hasNext()) {
GrantedAuthority authority = (GrantedAuthority) var9.next();
authed = authority.getAuthority().equals("ROLE_VERIFIED");
if (!authed && authority.getAuthority().equals("CHANGEPASS")) {
authed = uri.indexOf("service/XS0104/") >= 0;
}
if (authed) {
break;
}
}
}
}
if (uri.indexOf("service") < 0) {
authed = true;
}
// modify by songx at 20240826 if条件去掉authed,否则token会串
if (this.iTokenValidateFilter != null) {
this.iTokenValidateFilter.doFilter(httpServletRequest, httpServletResponse);
authed = this.isAuthedByJwt(httpServletRequest);
}
Map headerMap = new HashMap();
Enumeration<String> headerNames = httpServletRequest.getHeaderNames();
String headValue;
String serviceParam;
boolean hasXPlatHeader;
for (hasXPlatHeader = false; headerNames.hasMoreElements(); headerMap.put(serviceParam, headValue)) {
String name = (String) headerNames.nextElement();
headValue = httpServletRequest.getHeader(name);
this.logger.debug("******cached header:" + name + "****** value:" + headValue + "********");
serviceParam = name.toLowerCase();
if (serviceParam.contains("xplat")) {
hasXPlatHeader = true;
}
}
if (authed) {
filterChain.doFilter(httpServletRequest, httpServletResponse);
} else {
try {
EiInfo securityInfo = new EiInfo();
securityInfo.set("headerMap", headerMap);
securityInfo.set("clientIp", ip);
if (uri.indexOf("service/") > 0) {
String[] uriParts = uri.split("service/");
serviceParam = uriParts[uriParts.length - 1];
if (serviceParam.contains("/")) {
String[] serviceInfos = serviceParam.split("/");
securityInfo.set("paramServiceName", serviceInfos[0]);
securityInfo.set("paramMethodName", serviceInfos[1]);
} else {
securityInfo.set("paramServiceId", serviceParam);
}
}
securityInfo.set("uri", uri);
EiInfo outInfo = null;
if (StringUtils.isNotEmpty(this.filterServiceId)) {
securityInfo.set(EiConstant.serviceId, this.filterServiceId);
outInfo = XServiceManager.call(securityInfo);
} else {
if (!hasXPlatHeader) {
throw new AccessDeniedException("Access is denied, reason: no service validate public key!");
}
securityInfo.set(EiConstant.serviceName, "EPFI01");
securityInfo.set(EiConstant.methodName, "validate");
outInfo = XLocalManager.call(securityInfo);
}
if (outInfo.getStatus() < 0) {
throw new AccessDeniedException("Access is denied, reason:" + outInfo.getMsg());
}
Object jwtMapObj = outInfo.get("jwt_map");
if (jwtMapObj != null && jwtMapObj instanceof Map) {
httpServletRequest.setAttribute("jwt_map", jwtMapObj);
}
filterChain.doFilter(httpServletRequest, httpServletResponse);
} catch (Exception var15) {
if (this.orRequestMatcher != null && this.orRequestMatcher.matches(httpServletRequest)) {
filterChain.doFilter(httpServletRequest, httpServletResponse);
} else {
this.logger.warn(var15.getMessage());
if (this.entryPoint == null) {
if (var15 instanceof AccessDeniedException) {
throw var15;
}
throw new AccessDeniedException("Access is denied, reason:" + var15.getMessage());
}
this.entryPoint.commence(httpServletRequest, httpServletResponse, (AuthenticationException) null);
}
}
}
}
private boolean isAuthedByJwt(HttpServletRequest httpServletRequest) {
boolean authed = false;
Object jwtMapObj = httpServletRequest.getAttribute("jwt_map");
if (jwtMapObj != null && jwtMapObj instanceof Map) {
Map jwtMap = (Map) jwtMapObj;
String s_loginName = (String) jwtMap.get("sub");
if (s_loginName != null) {
authed = true;
}
}
return authed;
}
public void init(FilterConfig filterConfig) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
this.doFilterInternal((HttpServletRequest) request, (HttpServletResponse) response, chain);
}
public void destroy() {
}
public OrRequestMatcher getOrRequestMatcher() {
return this.orRequestMatcher;
}
public void setOrRequestMatcher(OrRequestMatcher orRequestMatcher) {
this.orRequestMatcher = orRequestMatcher;
}
public AuthenticationEntryPoint getEntryPoint() {
return this.entryPoint;
}
public void setEntryPoint(AuthenticationEntryPoint entryPoint) {
this.entryPoint = entryPoint;
}
public void setITokenValidateFilter(ITokenValidateFilter iTokenValidateFilter) {
this.iTokenValidateFilter = iTokenValidateFilter;
}
}
$(function () {
IPLATUI.EFAutoComplete = {
"inqu_status-0-deviceName": {
minLength: 1,
dataSource: {
pageSize: 10,
serverPaging: true,
serverFiltering: true
}
}
};
IPLATUI.EFGrid = {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [{
field: "operator",
title: "操作",
template: function (item) {
let id = item.id;
let template = '';
if (id) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="modify(' + item.id + ')" >画像详情</a>';
}
return template;
}
}],
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 新增
$("#ADD").on("click", add);
// 新增
$("#REMOVE").on("click", remove);
// 键盘按键
downKeyUp();
});
/**
* 页面加载完
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 新增
*/
let add = function () {
addOrUpdate("");
}
/**
* 修改
*/
let modify = function (id) {
let params = "&inqu_status-0-id=" + id;
addOrUpdate(params);
}
/**
* 新增
*/
let addOrUpdate = function (params) {
JSColorbox.open({
href: "HGPZ016A?methodName=initLoad" + params,
title: "<div style='text-align: center;'>" + (isBlank(params) ? "新增客户画像" : "客户画像详情") + "</div>",
width: "90%",
height: "80%",
callbackName: addOrUpdateCallback
});
}
/**
* 新增成功后回调
*/
let addOrUpdateCallback = function (res) {
// msg
message(res.msg);
// 刷新列表
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGPZ016", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
/**
* 删除
*/
let remove = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGPZ016", "remove",
true, function (res) {
message(res);
if (res.status > -1) {
query();
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="客户画像">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="custCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="customer_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="behaviorType" cname="行业类型" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hppz.companyType"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="companyScale" cname="企业规模" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hppz.companyScale"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="induType" cname="产品类型" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="misfeasorName" cname="有违法行为" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.misfeasorName"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="custCode" enable="false" cname="客户编码" hidden="true" width="100"
align="center"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFColumn ename="custName" cname="公司名称" enable="false" align="center" width="100"/>
<EF:EFComboColumn ename="behaviorType" cname="行业类型" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="hpjx.hppz.companyType"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="companyScale" cname="企业规模" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="hpjx.hppz.companyScale"/>
</EF:EFComboColumn>
<EF:EFColumn ename="userCount" cname="员工人数" enable="false" width="100" format="{0:N0}"
sort="true" align="right" maxLength="20"/>
<EF:EFColumn ename="revenue" cname="营业收入" enable="false" width="120" format="{0:C3}"
sort="true" align="right" maxLength="20"/>
<EF:EFColumn ename="induType" cname="产品类型" enable="false" align="center" width="120"/>
<EF:EFColumn ename="induQuality" cname="产品质量" enable="false" align="center" width="120"/>
<EF:EFColumn ename="usageScenario" cname="使用场景" enable="false" align="center" width="120"/>
<EF:EFColumn ename="purchaseNum" cname="购买频率" enable="false" align="center" width="120"/>
<EF:EFColumn ename="purchaseDate" cname="最近购买时间" enable="false" align="center" width="120" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="paymentMode" cname="常用支付方式" enable="false" align="center" width="120"/>
<EF:EFComboColumn ename="misfeasorName" cname="有违法行为" enable="false" align="center" width="100">
<EF:EFCodeOption codeName="hpjx.hpjx.misfeasorName"/>
</EF:EFComboColumn>
<EF:EFColumn ename="misfeasorNum" cname="违约次数" enable="false" width="100" format="{0:N0}"
sort="true" align="right" maxLength="20"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFSelect = {
"result-0-custCode": {
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var textField = dataItem['textField'];
if (valueField) {
textField = textField.indexOf("-") > -1 ? textField.split("-")[1] : textField;
$("#result-0-custName").val(textField);
} else {
$("#result-0-custName").val("");
}
}
}
}
IPLATUI.EFGrid = {
"result": {
pageable: false,
exportGrid: false,
toolbarConfig: {
hidden: false,
},
columns: [],
loadComplete: function (grid) {
},
onSuccess: function (e) {
}
},
"detail": {
pageable: false,
exportGrid: false,
toolbarConfig: {
hidden: false,
},
columns: [],
}
};
/**
* 取消
*/
$('#cancel').on('click', function () {
// 关闭弹窗
parent.JSColorbox.close();
});
// 确认
$('#confirm').on('click', confirm);
// 键盘按键
downKeyUp();
})
/**
* 确认
*/
let confirm = function () {
let custCode = $("#result-0-custCode").val();
if (isBlank(custCode)) {
message("客户名称不能为空");
return;
}
let companyScale = $("#result-0-companyScale").val();
if (isBlank(companyScale)) {
message("企业规模不能为空");
return;
}
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("", "HGPZ016", "save", true, function (res) {
if (res.status > -1) {
parent.JSColorbox.setValueCallback(res);
} else {
message(res.msg);
}
});
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="客户画像详情">
<EF:EFRegion id="inqu" title="基本信息">
<EF:EFInput ename="id" cname="ID" blockId="result" row="0" type="hidden"/>
<div class="row">
<EF:EFSelect ename="custCode" cname="客户名称" blockId="result" row="0"
colWidth="4" optionLabel="请选择" template="#=valueField#-#=textField#"
valueTemplate="#=valueField#-#=textField#">
<EF:EFOptions blockId="customer_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput ename="custName" cname="客户名称" blockId="result" row="0" type="hidden"/>
<EF:EFSelect ename="behaviorType" cname="行业类型" blockId="result" row="0" colWidth="4">
<EF:EFCodeOption codeName="hpjx.hppz.companyType"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect ename="companyScale" cname="企业规模" blockId="result" row="0" colWidth="4">
<EF:EFOption label="请选择" value=""/>
<EF:EFCodeOption codeName="hpjx.hppz.companyScale"/>
</EF:EFSelect>
<EF:EFInput ename="userCount" cname="员工人数" blockId="result" row="0" colWidth="4" type="number"/>
<EF:EFInput ename="revenue" cname="营业收入" blockId="result" row="0" colWidth="4" type="number"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="inqu2" title="业务需求">
<div class="row">
<EF:EFInput cname="产品类型" ename="induType" blockId="result" row="0" colWidth="4"/>
<EF:EFInput cname="产品质量" ename="induQuality" blockId="result" row="0" colWidth="4"/>
<EF:EFInput cname="使用场景" ename="usageScenario" blockId="result" row="0" colWidth="4"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="inqu3" title="业务需求">
<div class="row">
<EF:EFInput cname="购买频率" ename="purchaseNum" blockId="result" row="0" colWidth="4"/>
<EF:EFDatePicker cname="最近购买时间" ename="purchaseDate" blockId="result" row="0" colWidth="4"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true"/>
<EF:EFInput cname="常用支付方式" ename="paymentMode" blockId="result" row="0" colWidth="4"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="inqu4" title="信誉情况">
<div class="row">
<EF:EFSelect cname="有违法行为" ename="misfeasorName" blockId="result" row="0" colWidth="4">
<EF:EFCodeOption codeName="hpjx.hpjx.misfeasorName"/>
</EF:EFSelect>
<EF:EFInput cname="违约次数" ename="misfeasorNum" blockId="result" row="0" colWidth="4" type="number"/>
</div>
</EF:EFRegion>
<div class="row">
<EF:EFButton cname="取消" ename="cancel" type="button" class="btn-align-right"/>
<EF:EFButton cname="确认" ename="confirm" type="button" class="btn-align-right"/>
</div>
</EF:EFPage>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment