Commit 9726be52 by wasx8023

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

 Conflicts:
	src/main/java/com/baosight/hpjx/hp/mt/service/ServiceHPMT002.java
	src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC006.java
parents 449b5259 27271308
......@@ -8,7 +8,9 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
@SpringBootApplication(scanBasePackages = "com.baosight")
@ServletComponentScan("com.baosight.iplat4j.core.web.servlet")
......@@ -26,4 +28,12 @@ public class HpjxApplication extends SpringBootServletInitializer {
return application.sources(HpjxApplication.class);
}
@Bean("multipartResolver")
public CommonsMultipartResolver multipartResolver(){
CommonsMultipartResolver resolver = new CommonsMultipartResolver();
resolver.setDefaultEncoding("UTF-8");
resolver.setMaxInMemorySize(10000);
return resolver;
}
}
package com.baosight.hpjx.aspect.annotation;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hpjx.util.DocExcelUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
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.soa.XLocalManager;
import com.baosight.iplat4j.core.web.controller.WebDispatchController;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.Args;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.baosight.hpjx.common.DocRouteEnum;
/**
* DOC 接口类
*
* @author:songx
* @date:2022/5/5,10:04
*/
@CrossOrigin
@RestController
@RequestMapping("/doc")
public class DocController extends WebDispatchController {
private final static Logger logger = LoggerFactory.getLogger(DocController.class);
/**
* 批量导入
*
* @param file
* @return
*/
@RequestMapping(value = "/import/api", method = RequestMethod.POST)
public EiInfo importExcel(MultipartFile file, HttpServletRequest request) {
Map<String, String[]> paramMaps = request.getParameterMap();
EiInfo outInfo = new EiInfo();
outInfo.setStatus(EiConstant.STATUS_FAILURE);
try {
if (file == null) {
outInfo.setMsg("导入文件不能为空");
return outInfo;
}
String id = request.getParameter("id");
DocRouteEnum docRouteEnum = DocRouteEnum.getById(id);
if (docRouteEnum == null) {
outInfo.setMsg("导入标识ID不存在");
return outInfo;
}
String startRow = request.getParameter("startRow");
List dataList = DocExcelUtils.readExcel(file, NumberUtils.createInteger(startRow), docRouteEnum.getClazz());
if (CollectionUtils.isEmpty(dataList)) {
outInfo.setMsg("未读取到数据");
return outInfo;
}
outInfo.set(EiConstant.serviceName, docRouteEnum.getServiceNme());
outInfo.set(EiConstant.methodName, docRouteEnum.getMethodName());
outInfo.set("params", this.convertParam(paramMaps));
outInfo.set("dataList", dataList);
outInfo = XLocalManager.call(outInfo);
} catch (Exception e) {
LogUtils.setDetailMsg(outInfo, e, "导入excel失败");
}
return outInfo;
}
/**
* 参数转换
*
* @param paramMaps
* @return
*/
private Map<String, String> convertParam(Map<String, String[]> paramMaps) {
if (MapUtils.isEmpty(paramMaps)) {
return new HashMap<>();
}
Map<String, String> paramMap = new HashMap<>();
for (Map.Entry<String, String[]> entry : paramMaps.entrySet()) {
paramMap.put(entry.getKey(), entry.getValue()[0]);
}
return paramMap;
}
}
......@@ -272,6 +272,26 @@ public enum DdynamicEnum {
*/
FACTORY_CODE1_BLOCK_ID("factory_code1_block_id","factoryCode","factoryName", "HPSC008.queryFactoryCode"),
/**
* 模块:系统管理
* 用途:用户查询
* 编写:ly
*/
USER_NAME_BLOCK_ID("user_name_block_id","userId","userName","factoryCode","groupCode", "HPSC008.queryUserName"),
/**
* 模块:系统管理
* 用途:生产组查询
* 编写:ly
*/
GROUP_NAME_BLOCK_ID("group_name_block_id","groupCode","groupName","factoryCode", "HPSC008.queryGroupName"),
/**
* 模块:系统管理
* 用途:厂区查询
* 编写:ly
*/
FACTORY_NAME_BLOCK_ID("factory_name_block_id","factoryCode","factoryName", "HPSC008.queryFactoryCode"),
/**
* 模块:巡检填报APP下拉
......
package com.baosight.hpjx.common;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
/**
* @author:songx
* @date:2022/9/23,14:51
*/
public enum DocRouteEnum {
HPSC002("route_001", "HPSC002", "importData", HPSC002.class),
HPSC006("route_002", "HPSC006", "importData",HPSC006 .class);
private String id;
private String serviceNme;
private String methodName;
private Class clazz;
<T> DocRouteEnum(String id, String serviceNme, String methodName, Class<T> clazz) {
this.id = id;
this.serviceNme = serviceNme;
this.methodName = methodName;
this.clazz = clazz;
}
/**
* 根据ID获取枚举
*
* @param id
* @return
*/
public static DocRouteEnum getById(String id) {
for (DocRouteEnum docRouteEnum : DocRouteEnum.values()) {
if (docRouteEnum.id.equals(id)) {
return docRouteEnum;
}
}
return null;
}
public String getId() {
return id;
}
public String getServiceNme() {
return serviceNme;
}
public String getMethodName() {
return methodName;
}
public Class getClazz() {
return clazz;
}
}
package com.baosight.hpjx.common;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author:songx
* @date:2021/3/20,21:38
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface ExcelAnno {
/**
* 列索引
*
* @return
*/
int index() default 0;
/**
* 列名
*
* @return
*/
String name() default "";
}
package com.baosight.hpjx.common;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author:songx
* @date:2021/3/20,21:38
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface ExcelHeadAnon {
/**
* 列索引
*
* @return
*/
int index() default 0;
/**
* 必须与属性名保持一致,否则会获取不到数据
*
* @return
*/
String field() default "";
/**
* 列的中文名
*
* @return
*/
String name() default "";
}
package com.baosight.hpjx.controller;
import com.baosight.hpjx.hp.mt.untils.Base64ToMultipartFile;
import com.baosight.hpjx.hp.mt.untils.UploadUtils2;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
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.soa.XServiceManager;
import com.baosight.iplat4j.eu.dm.document.bos.s3.api.signed.SignedBosHelp;
import com.baosight.iplat4j.eu.dm.document.bos.s3.param.BosParamHelp;
import com.google.common.base.Joiner;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* @author:songx
* @date:2024/3/14,14:26
*/
@CrossOrigin
@RestController
@RequestMapping({"/upload/file"})
public class FileUploadController {
/**
* 更具docId上传文件
*
* @param file
* @throws IOException
*/
@RequestMapping(value = "/app", method = RequestMethod.POST)
public Map upload(MultipartFile file) throws IOException {
Map resultMap = new HashMap();
try {
JSONObject upload = UploadUtils2.upload((CommonsMultipartFile)file);
resultMap.put("id",upload.getString("docId"));
resultMap.put("status", EiConstant.STATUS_SUCCESS);
resultMap.put("message", "SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
return resultMap;
}
}
}
......@@ -105,7 +105,7 @@
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC010">
SELECT <include refid="column"/>
FROM hpjx.T_HPKC010
WHERE 1=1
WHERE 1=1 AND AMOUNT!=0
<include refid="condition"/>
<include refid="customCondition"/>
<dynamic prepend="ORDER BY">
......
......@@ -44,21 +44,18 @@ public class ServiceHPMT001 extends ServiceBase {
* @param inInfo
* @return
*/
public EiInfo pmOverview(EiInfo inInfo) {
String queryMonth = inInfo.getString("queryMonth");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("queryMonth", queryMonth);
sqlMap.put("companyCode", companyCode);
List<Map> row1 = this.dao.query("HPMT001.pmOverview1", sqlMap);//目标
List<Map> row2 = this.dao.query("HPMT001.pmOverview2", sqlMap);//实际
List<Map> rows = new ArrayList<>();
public Map pmOverview(EiInfo inInfo) {
Map resultMap = new HashMap();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
try {
String queryMonth = inInfo.getString("queryMonth");
String companyCode = UserSessionUtils.getCompanyCode();
Map sqlMap = new HashMap();
sqlMap.put("queryMonth", queryMonth);
sqlMap.put("companyCode", companyCode);
List<Map> row1 = this.dao.query("HPMT001.pmOverview1", sqlMap);//目标
List<Map> row2 = this.dao.query("HPMT001.pmOverview2", sqlMap);//实际
List<Map> rows = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
Date parse = sdf.parse(queryMonth);
Calendar instance = Calendar.getInstance();
instance.setTime(parse);
......@@ -132,15 +129,13 @@ public class ServiceHPMT001 extends ServiceBase {
resultMap.put("actualWt_h_yoy", actualWt.subtract(actualWt2).divide(actualWt2,BigDecimal.ROUND_UP).
multiply(new BigDecimal(100)).doubleValue());
}
rows.add(resultMap);
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
return outInfo;
} catch (ParseException e) {
e.printStackTrace();
return inInfo;
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
......@@ -151,24 +146,26 @@ public class ServiceHPMT001 extends ServiceBase {
* @param inInfo
* @return
*/
public EiInfo pmBenchmarking(EiInfo inInfo) {
public Map pmBenchmarking(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String queryMonth = inInfo.getString("queryMonth");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("queryMonth", queryMonth);
sqlMap.put("companyCode", companyCode);
List<Map> rows = this.dao.query("HPMT001.pmBenchmarking", sqlMap);
List<Map> rows2 = this.dao.query("HPMT001.pmBenchmarking2", sqlMap);
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
outInfo.set("cout",rows2);
return outInfo;
resultMap.put("result",rows);
resultMap.put("result2",rows2);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
}
}
......@@ -3,6 +3,7 @@
<sqlMap namespace="HPMT002">
<select id="pmProject" resultClass="java.util.HashMap">
SELECT * FROM (
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
......@@ -42,16 +43,52 @@
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
order by STATUS,PLAN_COMPLETION_DATE
) AS A WHERE actualCompletionNum!=num
limit #offset#, #pageSize#
</select>
<select id="pmProjectCount" resultClass="int">
<select id="pmProjectCount" resultClass="java.util.HashMap">
SELECT * FROM (
SELECT
COUNT(*)
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
PROJ_TYPE as "projType", <!-- 项目类型 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PLAN_INFO_NO as "planInfoNo", <!-- 生产计划单号 -->
PLAN_COMPLETION_DATE as "planCompletionDate", <!-- 计划完成日期 -->
STATUS as "status", <!-- 状态 0-计划中,1-生产中 -->
CONCAT((
SELECT
format((ifnull( SUM( ACTUAL_COMPLETION_NUM ), 0 ) / ifnull( SUM( NUM ), 0 ) * 100),2)
FROM
hpjx.T_HPSC004
WHERE
PARENT_ID = hpjx.T_HPSC003.PLAN_INFO_NO
),'%') AS "schedule", <!-- 进度 -->
(
SELECT
IFNULL( SUM( ACTUAL_COMPLETION_UNIT_WT ), 0 )
FROM
hpjx.T_HPSC004
WHERE
PARENT_ID = hpjx.T_HPSC003.PLAN_INFO_NO
) AS "actualCompletionNum" <!-- 完成重量 -->
,
(
SELECT
IFNULL( SUM( TOTAL_WT ),2)
FROM
hpjx.T_HPSC004
WHERE
PARENT_ID = hpjx.T_HPSC003.PLAN_INFO_NO
) AS "num" <!-- 计划重量 -->
FROM hpjx.T_HPSC003 WHERE COMPANY_CODE= #companyCode#
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
order by STATUS,PLAN_COMPLETION_DATE
) AS A WHERE actualCompletionNum!=num
</select>
<select id="pmQuality" resultClass="java.util.HashMap">
......@@ -194,7 +231,7 @@
<select id="queryFile" resultClass="java.util.HashMap">
SELECT CHG_NAME FROM iplat.TEUDM02 where DOC_ID=#docId#
SELECT URL FROM iplat.TEUDM05 where RES_ID=#docId#
</select>
......@@ -312,7 +349,7 @@
<select id="queryFvalue" resultClass="java.util.HashMap">
SELECT FVALUE AS "fvalue" FROM iplat.TEDCC03 WHERE FKEY='docRootDir'
SELECT DISTINCT FVALUE AS "fvalue" FROM iplat.TEDCC03 WHERE FKEY='docRootDir'
</select>
......
package com.baosight.hpjx.hp.mt.untils;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.data.id.UUIDHexIdGenerator;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -44,10 +45,12 @@ public class UploadUtils {
filePath = multipartFile.getOriginalFilename();
Long docSize = multipartFile.getSize();
String chgName = transformFileName(filePath);
System.out.println("----------------------------------解析Path");
String attachmentName;
Map<String, String> pathMap = getRealPath("A");
msg = (String)pathMap.get("dirId");
category = (String)pathMap.get("path");
System.out.println("----------------------------------获取dirId成功");
checkInvalidPath(category);
File dir = new File(category);
if (!dir.exists()) {
......@@ -116,7 +119,10 @@ public class UploadUtils {
public static Map<String, String> getRealPath(String path) {
String postPath = preparePath(path);
String dirId = initPath(postPath);
List<Map> query = dao.query("HPMT002.queryFvalue");
Map hashMap = new HashMap();
hashMap.put("fkey","docRootDir");
List<Map> query = DaoBase.getInstance().query("EDCC03.query",hashMap);
System.out.println("----------------------------------获取path地址");
if (query.get(0).get("fvalue")!=null) {
ROOT_PATH= (String) query.get(0).get("fvalue");
}
......
package com.baosight.hpjx.hp.mt.untils;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.data.id.UUIDHexIdGenerator;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -13,47 +14,44 @@ import com.baosight.iplat4j.eu.dm.util.FileProcessUtils;
import com.baosight.iplat4j.eu.dm.util.IFileUploader;
import net.sf.json.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
public class UploadUtils2 {
private static Dao dao = (Dao)PlatApplicationContext.getApplicationContext().getBean("dao");
public static JSONObject upload(CommonsMultipartFile multipartFile ) throws Exception {
JSONObject documentJSON = new JSONObject();
String docName = multipartFile.getOriginalFilename();
Long docSize = multipartFile.getSize();
HashMap<String, String> inMap = new HashMap();
Map<String, String> returnMap = null;
returnMap = PlatFileUploadUtils.uploadFile(multipartFile, inMap);
String docId = (String)returnMap.get("docId");
String docUrl = (String)returnMap.get("docUrl");
docId = docId == null ? "" : docId;
documentJSON.put("docId", docId);
if (StringUtils.isNotEmpty(docUrl)) {
documentJSON.put("docUrl", docUrl);
} else {
documentJSON.remove("docUrl");
}
documentJSON.put("groupId", returnMap.get("groupId") == null ? "" : returnMap.get("groupId"));
documentJSON.put("docName", docName);
documentJSON.put("docSize", docSize);
documentJSON.put("docType", docName.substring(docName.lastIndexOf(46)));
JSONObject documentJSON = new JSONObject();
String docName = multipartFile.getOriginalFilename();
Long docSize = multipartFile.getSize();
HashMap<String, String> inMap = new HashMap();
inMap.put("groupId", "hk_file11");
inMap.put("configPathDefine", "A");
Map<String, String> returnMap = PlatFileUploadUtils.uploadFile(multipartFile, inMap);
String docId = (String)returnMap.get("docId");
String docUrl = (String)returnMap.get("docUrl");
docId = docId == null ? "" : docId;
documentJSON.put("docId", docId);
if (StringUtils.isNotEmpty(docUrl)) {
documentJSON.put("docUrl", docUrl);
} else {
documentJSON.remove("docUrl");
}
documentJSON.put("groupId", returnMap.get("groupId") == null ? "" : returnMap.get("groupId"));
documentJSON.put("docName", docName);
documentJSON.put("docSize", docSize);
documentJSON.put("docType", docName.substring(docName.lastIndexOf(46)));
return documentJSON;
}
}
}
......@@ -26,6 +26,8 @@ public class HPPZ009 extends DaoEPBase {
public static final String FIELD_COMPANY_NAME = "companyName"; /* 企业名称*/
public static final String FIELD_VALID_FLAG = "validFlag"; /* 是否启用:1.启用,0.停用*/
public static final String FIELD_LOGIN_PREFIX = "loginPrefix"; /* 登录前缀*/
public static final String FIELD_DOC_ID_PC = "docIdPc"; /* 登录前缀*/
public static final String FIELD_DOC_ID_APP = "docIdApp"; /* 登录前缀*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
......@@ -60,6 +62,8 @@ public class HPPZ009 extends DaoEPBase {
private String companyName = " "; /* 企业名称*/
private Integer validFlag; /* 是否启用:1.启用,0.停用*/
private String loginPrefix = " "; /* 登录前缀*/
private String docIdPc = " "; /* 登录前缀*/
private String docIdApp = " "; /* 登录前缀*/
private String remark = " "; /* 备注*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
......@@ -95,6 +99,14 @@ public class HPPZ009 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_LOGIN_PREFIX);
eiColumn.setDescName("登录前缀");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_ID_PC);
eiColumn.setDescName("pc文档标识");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_ID_APP);
eiColumn.setDescName("app文档标识");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
......@@ -218,6 +230,23 @@ public class HPPZ009 extends DaoEPBase {
public void setLoginPrefix(String loginPrefix) {
this.loginPrefix = loginPrefix;
}
public String getDocIdPc() {
return docIdPc;
}
public void setDocIdPc(String docIdPc) {
this.docIdPc = docIdPc;
}
public String getDocIdApp() {
return docIdApp;
}
public void setDocIdApp(String docIdApp) {
this.docIdApp = docIdApp;
}
/**
* get the remark - 备注.
* @return the remark
......@@ -359,6 +388,8 @@ public class HPPZ009 extends DaoEPBase {
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setValidFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_VALID_FLAG)), validFlag));
setLoginPrefix(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LOGIN_PREFIX)), loginPrefix));
setDocIdPc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID_PC)), docIdPc));
setDocIdApp(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID_APP)), docIdApp));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
......@@ -381,6 +412,8 @@ public class HPPZ009 extends DaoEPBase {
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_VALID_FLAG, StringUtils.toString(validFlag, eiMetadata.getMeta(FIELD_VALID_FLAG)));
map.put(FIELD_LOGIN_PREFIX, StringUtils.toString(loginPrefix, eiMetadata.getMeta(FIELD_LOGIN_PREFIX)));
map.put(FIELD_DOC_ID_PC, StringUtils.toString(docIdPc, eiMetadata.getMeta(FIELD_DOC_ID_PC)));
map.put(FIELD_DOC_ID_APP, StringUtils.toString(docIdApp, eiMetadata.getMeta(FIELD_DOC_ID_APP)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
......
......@@ -61,6 +61,7 @@ public class ServiceHPPZ006 extends ServiceBase {
@Override
public EiInfo query(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null,false);
inInfo = super.query(inInfo, HPPZ006.QUERY, new HPPZ006());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
......@@ -3,12 +3,15 @@ package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -57,12 +60,14 @@ public class ServiceHPPZ009 extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, "HPPZ009.query", new HPPZ009());
String projectEnv = ProjectInfo.getProjectEnv();
inInfo.setCell(EiConstant.resultBlock,ACConstants.ROW_CODE_0,"projectEnv",projectEnv);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
......
......@@ -96,7 +96,7 @@ public class ServiceHPPZ015 extends ServiceBase {
HPPZ015.setProjCode(hpsc001.getProjCode());
HPPZ015.setTemplateName(inInfo.getString("templateName"));
HPPZ015.setCreatedBy(UserSession.getUserId());
HPPZ015.setCompanyCode(UserSession.getUserId());
HPPZ015.setCompanyCode(UserSessionUtils.getCompanyCode());
HPPZ015.setCreatedName(UserSession.getUserId()+"-"+UserSession.getLoginCName());
HPPZ015.setCreatedTime(sdf.format(new Date()));
HPPZ015.setUpdatedBy(null);
......
......@@ -8,6 +8,8 @@
COMPANY_NAME as "companyName", <!-- 企业名称 -->
VALID_FLAG as "validFlag", <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX as "loginPrefix", <!-- 登录前缀 -->
DOC_ID_PC as "docIdPc",
DOC_ID_APP as "docIdApp",
REMARK as "remark", <!-- 备注 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
......@@ -81,12 +83,14 @@
COMPANY_NAME, <!-- 企业名称 -->
VALID_FLAG, <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX, <!-- 登录前缀 -->
DOC_ID_PC,
DOC_ID_APP,
REMARK, <!-- 备注 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES (
#companyCode#, #companyName#, #validFlag#, #loginPrefix#, #remark#, #createdBy#,
#companyCode#, #companyName#, #validFlag#, #loginPrefix#, #docIdPc#, #docIdApp#, #remark#, #createdBy#,
#createdName#, #createdTime#
)
</insert>
......@@ -96,6 +100,8 @@
UPDATE ${hpjxSchema}.T_HPPZ009
SET
COMPANY_NAME = #companyName#,
DOC_ID_PC = #docIdPc#,
DOC_ID_APP = #docIdApp#,
VALID_FLAG = #validFlag#,
REMARK = #remark#,
<include refid="updateRevise"/>
......
package com.baosight.hpjx.hp.sc.domain;
import com.baosight.hpjx.common.ExcelAnno;
import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn;
......@@ -119,15 +120,22 @@ public class HPSC002 extends DaoEPBase {
private String leaf = "1"; /* 是否有叶子节点*/
private String sort = " "; /* 排序字段*/
private String icon = " "; /* 图片地址*/
@ExcelAnno(index = 0)
private Integer prdtType; /* 产品类型*/
private String prdtCode = " "; /* 产品编码*/
@ExcelAnno(index = 1)
private String prdtName = " "; /* 产品名称*/
@ExcelAnno(index = 2)
private BigDecimal length = new BigDecimal("0"); /* 长*/
@ExcelAnno(index = 3)
private BigDecimal width = new BigDecimal("0"); /* 宽*/
@ExcelAnno(index = 4)
private BigDecimal thick = new BigDecimal("0"); /* 厚*/
private Long inventRecordId; /* 项目档案ID*/
private String spec = " "; /* 规格*/
@ExcelAnno(index = 6)
private BigDecimal num = new BigDecimal(0.000); /* 数量*/
@ExcelAnno(index = 7)
private BigDecimal unitWt = new BigDecimal(0.000); /* 单重*/
private BigDecimal totalWt = new BigDecimal(0.000); /* 总重*/
private String filePath1 = " "; /* 文件地址1*/
......@@ -143,6 +151,7 @@ public class HPSC002 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/
@ExcelAnno(index = 5)
private String remark = " "; /* 备注*/
private String pgStatus = " "; /* 派工状态*/
......
package com.baosight.hpjx.hp.sc.domain;
import com.baosight.hpjx.common.ExcelAnno;
import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn;
......@@ -117,13 +118,20 @@ public class HPSC006 extends DaoEPBase {
private String productionOrderNo = " "; /* 生产订单号*/
private Integer inventType; /* 材料类型*/
private String inventCode = " "; /* 材料编码*/
@ExcelAnno(index = 0)
private String inventName = " "; /* 材料名称*/
@ExcelAnno(index = 1)
private BigDecimal inventLength = new BigDecimal("0"); /* 材料-长*/
@ExcelAnno(index = 2)
private BigDecimal inventWidth = new BigDecimal("0"); /* 材料-宽*/
@ExcelAnno(index = 3)
private BigDecimal inventThick = new BigDecimal("0"); /* 材料-厚*/
private String inventSpec = " "; /* 材料规格*/
@ExcelAnno(index = 8)
private String planCompletionDate = " "; /* 计划完成日期*/
@ExcelAnno(index = 6)
private BigDecimal num = new BigDecimal(0.000); /* 计划数量*/
@ExcelAnno(index = 7)
private BigDecimal unitWt = new BigDecimal("0"); /* 计划单重*/
private BigDecimal totalWt = new BigDecimal(0.000); /* 计划重量*/
private String actualCompletionDate = " "; /* 实际完工日期*/
......@@ -139,9 +147,11 @@ public class HPSC006 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/
private String updatedTime = " "; /* 更新时间*/
private String depCode = " "; /* 部门编码*/
@ExcelAnno(index = 5)
private String remark = " "; /* 备注*/
private String filePath1 = " "; /* 文件地址1*/
private Integer inventRecordId = new Integer(0); /* 存货档案ID*/
@ExcelAnno(index = 4)
private String material = " "; /* 材质*/
private String prdtName = " "; /* 产品名称*/
private String partName = " "; /* 零件名称*/
......
......@@ -67,6 +67,7 @@ public class HPSC008 extends DaoEPBase {
public static final String INSERT = "HPSC008.insert";
public static final String UPDATE = "HPSC008.update";
public static final String DELETE = "HPSC008.delete";
public static final String DELETE_FLAG = "HPSC008.deleteFlag";
private Long id = new Long(0); /* ID*/
private String companyCode = " "; /* 企业编码 预留*/
......
package com.baosight.hpjx.hp.sc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:THpxs002.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-03-21 11:14:28 create
*/
public class HPSC009 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; /* ID*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码 预留*/
public static final String FIELD_REGISTER_DATE = "registerDate"; /* 登记日期*/
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 工厂代码*/
public static final String FIELD_GROUP_CODE = "groupCode"; /* 下料组代码*/
public static final String FIELD_USER_ID = "userId"; /* 员工代码*/
public static final String FIELD_GROUP_TYPE = "groupType"; /* 下料类型*/
public static final String FIELD_CONTENT = "content"; /* 报工内容*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0:否1.是*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 修改人*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 修改人名称*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改时间*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码 预留*/
public static final String COL_REGISTER_DATE = "REGISTER_DATE"; /* 登记日期*/
public static final String COL_FACTORY_CODE = "FACTORY_CODE"; /* 工厂代码*/
public static final String COL_GROUP_CODE = "GROUP_CODE"; /* 下料组代码*/
public static final String COL_USER_ID = "USER_ID"; /* 员工代码*/
public static final String COL_GROUP_TYPE = "GROUP_TYPE"; /* 下料类型*/
public static final String COL_CONTENT = "CONTENT"; /* 报工内容*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0:否1.是*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 修改人*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 修改人名称*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改时间*/
public static final String QUERY = "HPSC009.query";
public static final String COUNT = "HPSC009.count";
public static final String INSERT = "HPSC009.insert";
public static final String UPDATE = "HPSC009.update";
public static final String DELETE = "HPSC009.delete";
public static final String DELETE_FLAG = "HPSC009.deleteFlag";
private Long id = new Long(0); /* ID*/
private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码 预留*/
private String registerDate = " "; /* 登记日期*/
private String factoryCode = " "; /* 工厂代码*/
private String groupCode = " "; /* 下料组代码*/
private String userId = " "; /* 员工代码*/
private String groupType = " "; /* 下料类型*/
private String content = " "; /* 报工内容*/
private String remark = " "; /* 备注*/
private Integer deleteFlag; /* 是否删除0:否1.是*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 修改人*/
private String updatedTime = " "; /* 修改人名称*/
private String updatedName = " "; /* 修改时间*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REGISTER_DATE);
eiColumn.setDescName("登记日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_CODE);
eiColumn.setDescName("工厂代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_GROUP_CODE);
eiColumn.setDescName("下料组代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_USER_ID);
eiColumn.setDescName("员工代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_GROUP_TYPE);
eiColumn.setDescName("下料类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CONTENT);
eiColumn.setDescName("报工内容");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除0:否1.是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("修改人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("修改人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("修改时间");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPSC009() {
initMetaData();
}
/**
* get the id - ID.
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id - ID.
*
* @param id - ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode - 企业编码 预留.
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 企业编码 预留.
*
* @param companyCode - 企业编码 预留
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the depCode - 部门编码 预留.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码 预留.
*
* @param depCode - 部门编码 预留
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the registerDate - 登记日期.
* @return the registerDate
*/
public String getRegisterDate() {
return this.registerDate;
}
/**
* set the registerDate - 登记日期.
*
* @param registerDate - 登记日期
*/
public void setRegisterDate(String registerDate) {
this.registerDate = registerDate;
}
/**
* get the factoryCode - 工厂代码.
* @return the factoryCode
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* set the factoryCode - 工厂代码.
*
* @param factoryCode - 工厂代码
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* get the groupCode - 下料组代码.
* @return the groupCode
*/
public String getGroupCode() {
return this.groupCode;
}
/**
* set the groupCode - 下料组代码.
*
* @param groupCode - 下料组代码
*/
public void setGroupCode(String groupCode) {
this.groupCode = groupCode;
}
/**
* get the userId - 员工代码.
* @return the userId
*/
public String getUserId() {
return this.userId;
}
/**
* set the userId - 员工代码.
*
* @param userId - 员工代码
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* get the groupType - 下料类型.
* @return the groupType
*/
public String getGroupType() {
return this.groupType;
}
/**
* set the groupType - 下料类型.
*
* @param groupType - 下料类型
*/
public void setGroupType(String groupType) {
this.groupType = groupType;
}
/**
* get the content - 报工内容.
* @return the content
*/
public String getContent() {
return this.content;
}
/**
* set the content - 报工内容.
*
* @param content - 报工内容
*/
public void setContent(String content) {
this.content = content;
}
/**
* get the remark - 备注.
* @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注.
*
* @param remark - 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get the deleteFlag - 是否删除0:否1.是.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除0:否1.是.
*
* @param deleteFlag - 是否删除0:否1.是
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 修改人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 修改人.
*
* @param updatedBy - 修改人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedTime - 修改人名称.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 修改人名称.
*
* @param updatedTime - 修改人名称
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the updatedName - 修改时间.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 修改时间.
*
* @param updatedName - 修改时间
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setRegisterDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REGISTER_DATE)), registerDate));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_GROUP_CODE)), groupCode));
setUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_ID)), userId));
setGroupType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_GROUP_TYPE)), groupType));
setContent(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTENT)), content));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_REGISTER_DATE, StringUtils.toString(registerDate, eiMetadata.getMeta(FIELD_REGISTER_DATE)));
map.put(FIELD_FACTORY_CODE, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_FACTORY_CODE)));
map.put(FIELD_GROUP_CODE, StringUtils.toString(groupCode, eiMetadata.getMeta(FIELD_GROUP_CODE)));
map.put(FIELD_USER_ID, StringUtils.toString(userId, eiMetadata.getMeta(FIELD_USER_ID)));
map.put(FIELD_GROUP_TYPE, StringUtils.toString(groupType, eiMetadata.getMeta(FIELD_GROUP_TYPE)));
map.put(FIELD_CONTENT, StringUtils.toString(content, eiMetadata.getMeta(FIELD_CONTENT)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
return map;
}
}
......@@ -139,7 +139,7 @@ public class ServiceHPSC002 extends ServiceBase {
BigDecimal num = hpsc002.getNum();
BigDecimal unitWt = hpsc002.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
hpsc002.setDelStatus(CommonConstant.YesNo.NO_0.intValue());
hpsc002.setTotalWt(totalWt);
......@@ -293,7 +293,7 @@ public class ServiceHPSC002 extends ServiceBase {
BigDecimal num = hppz002.getNum();
BigDecimal unitWt = hppz002.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
hppz002.setDelStatus(CommonConstant.YesNo.NO_0.intValue());
hppz002.setTotalWt(totalWt);
......@@ -443,7 +443,7 @@ public class ServiceHPSC002 extends ServiceBase {
BigDecimal num = hppz002.getNum();
BigDecimal unitWt = hppz002.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
hppz002.setDelStatus(CommonConstant.YesNo.NO_0.intValue());
hppz002.setTotalWt(totalWt);
hppz002.setSpec(HPPZTools.HpPz006.jointSpec(hppz002.getLength(),hppz002.getWidth(),hppz002.getThick()));
......@@ -742,7 +742,33 @@ public class ServiceHPSC002 extends ServiceBase {
}
}
@OperationLogAnnotation(operModul = "物料清单",operType = "导入",operDesc = "导入")
public EiInfo importData(EiInfo inInfo) {
try {
List<HPSC002> dataList = (List) inInfo.get("dataList");
HashMap params = (HashMap) inInfo.get("params");
String parentId = (String) params.get("parentId");
String projCode = (String) params.get("projCode");
String projName = (String) params.get("projName");
String parentPrdtName = (String) params.get("parentPrdtName");
// 写入数据
for (HPSC002 hpsc002:dataList) {
hpsc002.setParentId(parentId);
hpsc002.setProjCode(projCode);
hpsc002.setProjName(projName);
hpsc002.setParentPrdtName(parentPrdtName);
hpsc002.setStatus(CommonConstant.YesNo.NO_0.intValue());
add(hpsc002);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + dataList.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 部件类型下拉框
* @param inInfo 形参
......
package com.baosight.hpjx.hp.sc.service;
import cn.hutool.core.bean.BeanUtil;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.pz.domain.HPPZ002;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.*;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ProjectInfo;
......@@ -20,11 +26,13 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
......@@ -100,6 +108,74 @@ public class ServiceHPSC006 extends ServiceBase {
}
/**
* 保存操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产下料",operType = "保存",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock("detail").getRows();
String productionOrderNo = inInfo.getString("productionOrderNo");
String projCode = inInfo.getString("projCode");
String projName = inInfo.getString("projName");
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPSC006 hpsc006 = new HPSC006();
hpsc006.fromMap(resultRows.get(i));
hpsc006.setInventType(7);
BigDecimal num = hpsc006.getNum();
BigDecimal unitWt = hpsc006.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
hpsc006.setInventSpec(HPPZTools.HpPz006.jointSpec(hpsc006.getInventLength(),hpsc006.getInventWidth(),hpsc006.getInventThick()));
hpsc006.setProjCode(projCode);
hpsc006.setProjName(projName);
hpsc006.setProductionOrderNo(productionOrderNo);
hpsc006.setTotalWt(totalWt);
hpsc006.setInventCode(HPPZTools.checkAndSavePZ04(hpsc006.getInventType(),hpsc006.getInventName()));
// 去除日期字符串中的-
hpsc006.setPlanCompletionDate(StringUtil.removeHorizontalLine(hpsc006.getPlanCompletionDate()));
if(hpsc006.getFactoryCode()!=null && !(hpsc006.getFactoryCode().equals(" "))) {
AssertUtils.isEmpty(hpsc006.getOrgNo(), "已选择厂区,下料组不能为空");
hpsc006.setStatus(1);
hpsc006.setOrgName(HPXSTools.XsOrg.get(hpsc006.getFactoryCode()).getOrgCname());
hpsc006.setFactoryName(HPXSTools.XsOrg.get(hpsc006.getOrgNo()).getOrgCname());
}
if (hpsc006.getId() == null || hpsc006.getId() == 0) {
hpsc006.setStatus(CommonConstant.YesNo.NO_0.intValue());
this.add(hpsc006);
} else {
this.modify(hpsc006);
}
}
int size = resultRows.size();
//刷新
//inInfo = this.refreshHPSC006(inInfo, productionOrderNo);
inInfo = this.queryDetail(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + size + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作.
*/
public void add(HPSC006 hpsc006) {
DaoUtils.insert("HPSC006.insert",hpsc006);
}
/**
* 修改操作.
*/
public void modify(HPSC006 hpsc006) {
DaoUtils.update("HPSC006.update",hpsc006);
}
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "生产下料",operType = "新增",operDesc = "新增")
......@@ -119,7 +195,7 @@ public class ServiceHPSC006 extends ServiceBase {
BigDecimal num = HPSC006.getNum();
BigDecimal unitWt = HPSC006.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
HPSC006.setInventSpec(HPPZTools.HpPz006.jointSpec(HPSC006.getInventLength(),HPSC006.getInventWidth(),HPSC006.getInventThick()));
HPSC006.setProjCode(projCode);
HPSC006.setProjName(projName);
......@@ -176,7 +252,7 @@ public class ServiceHPSC006 extends ServiceBase {
BigDecimal num = HPSC006.getNum();
BigDecimal unitWt = HPSC006.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
HPSC006.setInventSpec(HPPZTools.HpPz006.jointSpec(HPSC006.getInventLength(),HPSC006.getInventWidth(),HPSC006.getInventThick()));
HPSC006.setProjCode(projCode);
HPSC006.setProjName(projName);
......@@ -305,6 +381,41 @@ public class ServiceHPSC006 extends ServiceBase {
return outInfo;
}
@OperationLogAnnotation(operModul = "物料清单",operType = "导入",operDesc = "导入")
public EiInfo importData(EiInfo inInfo) {
try {
List<HPSC006> dataList = (List) inInfo.get("dataList");
HashMap params = (HashMap) inInfo.get("params");
String productionOrderNo = (String) params.get("productionOrderNo");
String projCode = (String) params.get("projCode");
String projName = (String) params.get("projName");
// 写入数据
for (HPSC006 hpsc006:dataList) {
hpsc006.setInventType(7);
BigDecimal num = hpsc006.getNum();
BigDecimal unitWt = hpsc006.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
hpsc006.setInventSpec(HPPZTools.HpPz006.jointSpec(hpsc006.getInventLength(),hpsc006.getInventWidth(),hpsc006.getInventThick()));
hpsc006.setProjCode(projCode);
hpsc006.setProjName(projName);
hpsc006.setProductionOrderNo(productionOrderNo);
hpsc006.setTotalWt(totalWt);
hpsc006.setInventCode(HPPZTools.checkAndSavePZ04(hpsc006.getInventType(),hpsc006.getInventName()));
// 去除日期字符串中的-
hpsc006.setPlanCompletionDate(StringUtil.removeHorizontalLine(hpsc006.getPlanCompletionDate()));
add(hpsc006);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + dataList.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 删除附件文件
* @param id 文件ID
......
......@@ -8,12 +8,14 @@ import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.sc.domain.HPSC008;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
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.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
......@@ -27,22 +29,39 @@ import java.util.Map;
*/
public class ServiceHPSC008 extends ServiceEPBase {
final public static String GROUP_TYPE = "prodGroup";
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HPSC008.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
final EiInfo outEiInfo = super.query(inInfo, HPSC008.QUERY, new HPSC008());
final String companyCode = UserSessionUtils.getCompanyCode();
//拼接名称 包含逻辑删除数据
CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID,DdynamicEnum.GROUP_CODE_BLOCK_ID,DdynamicEnum.FACTORY_CODE_BLOCK_ID),
new HashMap<String,Object>(){{put(HPSC008.FIELD_COMPANY_CODE,companyCode);}}
new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_GROUP_TYPE,GROUP_TYPE);
}}
);
//拼接名称 不包含逻辑删除数据
CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.USER_ID1_BLOCK_ID,DdynamicEnum.GROUP_CODE1_BLOCK_ID,DdynamicEnum.FACTORY_CODE1_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_GROUP_TYPE,GROUP_TYPE);
put(HPSC008.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
}}
);
//outEiInfo.getBlock(EiConstant.resultBlock).getRows().clear();
//无拼接名称 包含逻辑删除数据
CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.USER_NAME_BLOCK_ID,DdynamicEnum.GROUP_NAME_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_GROUP_TYPE,GROUP_TYPE);
//put(HPSC008.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
}}
);
return outEiInfo;
}
......@@ -57,71 +76,112 @@ public class ServiceHPSC008 extends ServiceEPBase {
if (!startDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"createdDateFrom",StringUtil.removeHorizontalLine(startDate));
}
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HPSC008.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPSC008.QUERY,new HPSC008());
}
@OperationLogAnnotation(operModul = "报工管理",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HPSC008.DELETE);
int i = 0;
try {
HPSC008 hpxs001 = new HPSC008();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs001.fromMap(map);
hpxs001.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSC008.DELETE_FLAG, hpxs001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "报工管理",operType = "修改",operDesc = "修改操作")
@Override
public EiInfo update(EiInfo inInfo) {
return super.update(inInfo, HPSC008.UPDATE);
int i = 0;
try {
HPSC008 hpxs002 = new HPSC008();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs002.fromMap(map);
hpxs002.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.update(HPSC008.UPDATE, hpxs002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "报工管理",operType = "新增",operDesc = "新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
int i = 0;
try {
HPSC008 hpxs001 = new HPSC008();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs001.fromMap(map);
hpxs001.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPSC008.INSERT, hpxs001.toMap());
DaoUtils.insert(HPSC008.INSERT, hpxs001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.insert", "新增")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
ErrorCodeUtils.handleInsertException(inInfo,i,e);
logError("新增失败", e.getMessage());
return inInfo;
}
return query(inInfo);
//return super.insert(inInfo,HPXS001.INSERT);
return inInfo;
}
public EiInfo queryFactoryCode(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode();
String factoryCode = inInfo.getString(HPPZ013.FIELD_FACTORY_CODE);
String factoryCode = inInfo.getString(HPSC008.FIELD_FACTORY_CODE);
String groupType = inInfo.getString(HPSC008.FIELD_GROUP_TYPE);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.GROUP_CODE_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_FACTORY_CODE,factoryCode);
put(HPSC008.FIELD_GROUP_TYPE,groupType);
}});
return inInfo;
}
public EiInfo queryGroupCode(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode();
String factoryCode = inInfo.getString(HPPZ013.FIELD_FACTORY_CODE);
String factoryCode = inInfo.getString(HPSC008.FIELD_FACTORY_CODE);
String groupCode = inInfo.getString(HPSC008.FIELD_GROUP_CODE);
String groupType = inInfo.getString(HPSC008.FIELD_GROUP_TYPE);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_FACTORY_CODE,factoryCode);
put(HPSC008.FIELD_GROUP_CODE,groupCode);
}});
put(HPSC008.FIELD_GROUP_TYPE,groupType);
}});
return inInfo;
}
}
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.sc.domain.HPSC009;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
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.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/3/21
* @page 下料报工管理
*/
public class ServiceHPSC009 extends ServiceEPBase {
//下料组编码
final public static String GROUP_TYPE = "cutGroup";
@Override
public EiInfo initLoad(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode();
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0, HPSC009.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HPSC009.COL_COMPANY_CODE,companyCode);
final EiInfo outEiInfo = super.query(inInfo, HPSC009.QUERY, new HPSC009());
CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID,DdynamicEnum.GROUP_CODE_BLOCK_ID,DdynamicEnum.FACTORY_CODE_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC009.FIELD_COMPANY_CODE,companyCode);
put(HPSC009.FIELD_GROUP_TYPE,GROUP_TYPE);
}}
);
CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.USER_ID1_BLOCK_ID,DdynamicEnum.GROUP_CODE1_BLOCK_ID,DdynamicEnum.FACTORY_CODE1_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC009.FIELD_COMPANY_CODE,companyCode);
put(HPSC009.FIELD_GROUP_TYPE,GROUP_TYPE);
put(HPSC009.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
}}
);
CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.USER_NAME_BLOCK_ID,DdynamicEnum.GROUP_NAME_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC009.FIELD_COMPANY_CODE,companyCode);
put(HPSC009.FIELD_GROUP_TYPE,GROUP_TYPE);
//put(HPSC009.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
}}
);
return outEiInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
String startDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdDateFrom");
String endDate = block.getCellStr(ACConstants.ROW_CODE_0,"createdDateTo");
if (!endDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,"createdDateTo", StringUtil.removeHorizontalLine(endDate));
}
if (!startDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"createdDateFrom",StringUtil.removeHorizontalLine(startDate));
}
inInfo.setCell(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HPSC009.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPSC009.QUERY,new HPSC009());
}
@OperationLogAnnotation(operModul = "报工管理",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPSC009 hpxs001 = new HPSC009();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs001.fromMap(map);
hpxs001.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSC009.DELETE_FLAG, hpxs001.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return query(inInfo);
}
@OperationLogAnnotation(operModul = "报工管理",operType = "修改",operDesc = "修改操作")
@Override
public EiInfo update(EiInfo inInfo) {
int i = 0;
try {
HPSC009 hpxs002 = new HPSC009();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs002.fromMap(map);
hpxs002.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.update(HPSC009.UPDATE, hpxs002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return query(inInfo);
}
@OperationLogAnnotation(operModul = "报工管理",operType = "新增",operDesc = "新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
int i = 0;
try {
HPSC009 hpxs002 = new HPSC009();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs002.fromMap(map);
hpxs002.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPSC009.INSERT, hpxs002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.insert", "新增")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleInsertException(inInfo,i,e);
logError("新增失败", e.getMessage());
return inInfo;
}
return query(inInfo);
}
public EiInfo queryFactoryCode(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode();
String factoryCode = inInfo.getString(HPSC009.FIELD_FACTORY_CODE);
String groupType = inInfo.getString(HPSC009.FIELD_GROUP_TYPE);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.GROUP_CODE_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC009.FIELD_COMPANY_CODE,companyCode);
put(HPSC009.FIELD_FACTORY_CODE,factoryCode);
put(HPSC009.FIELD_GROUP_TYPE,groupType);
}});
return inInfo;
}
public EiInfo queryGroupCode(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode();
String factoryCode = inInfo.getString(HPSC009.FIELD_FACTORY_CODE);
String groupCode = inInfo.getString(HPSC009.FIELD_GROUP_CODE);
String groupType = inInfo.getString(HPSC009.FIELD_GROUP_TYPE);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID),
new HashMap<String,Object>(){{
put(HPSC009.FIELD_COMPANY_CODE,companyCode);
put(HPSC009.FIELD_FACTORY_CODE,factoryCode);
put(HPSC009.FIELD_GROUP_CODE,groupCode);
put(HPSC009.FIELD_GROUP_TYPE,groupType);
}});
return inInfo;
}
}
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
/**
*
*/
public class ServiceHPSC097 extends ServiceBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "上传",operDesc = "附件上传")
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
......@@ -209,6 +209,23 @@
</isNotEmpty>
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPXS001
SET
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_TIME = #updatedTime#, <!-- 修改人名称 -->
UPDATED_NAME = #updatedName# <!-- 修改时间 -->
WHERE
ID = #id#
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPXS001
SET
......@@ -240,39 +257,97 @@
</update>
<select id="queryFactoryCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
SELECT
FACTORY_CODE as "factoryCode",
FACTORY_NAME as "factoryName"
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
FROM ${hpjxSchema}.T_HPPZ013
WHERE 1=1
and length(FACTORY_CODE)>0
and length(FACTORY_NAME)>0
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
GROUP BY FACTORY_CODE,FACTORY_NAME
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
CREATED_TIME desc
</isEmpty>
</dynamic>
</select>
<select id="queryGroupCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
GROUP_CODE as "groupCode",
GROUP_NAME as "groupName",
FACTORY_CODE AS factoryCode
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
SELECT
A.GROUP_CODE as "groupCode",
CONCAT('[',A.FACTORY_NAME,']',A.GROUP_NAME) as "groupName",
A.FACTORY_CODE AS factoryCode
FROM ${hpjxSchema}.T_HPPZ013 A
LEFT JOIN ${platSchema}.TXSOG01 B ON A.COMPANY_CODE = B.COMPANY_CODE AND A.GROUP_CODE = B.ORG_ENAME
WHERE 1=1
and length(A.FACTORY_CODE)>0
and length(A.FACTORY_NAME)>0
and length(A.GROUP_CODE)>0
and length(A.GROUP_NAME)>0
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
A.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
A.DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isEmpty prepend=" AND " property="groupType">
A.GROUP_TYPE = 'prodGroup'
</isEmpty>
<isNotEmpty prepend=" AND " property="groupType">
A.GROUP_TYPE = #groupType#
</isNotEmpty>
GROUP BY A.GROUP_CODE,A.GROUP_NAME,A.FACTORY_CODE,A.FACTORY_NAME
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.FACTORY_CODE,B.SORT_INDEX ASC
</isEmpty>
</dynamic>
</select>
<select id="queryUserId" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
USER_ID as "userId",
CONCAT('[',FACTORY_NAME,' - ',GROUP_NAME,']',USER_NAME) as "userName",
FACTORY_CODE AS factoryCode,
GROUP_CODE as "groupCode"
FROM ${hpjxSchema}.T_HPPZ013
WHERE 1=1
and STATUS = '1'
and length(FACTORY_CODE)>0
and length(FACTORY_NAME)>0
and length(GROUP_CODE)>0
and length(GROUP_NAME)>0
and length(USER_ID)>0
and length(USER_NAME)>0
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
......@@ -282,24 +357,72 @@
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
GROUP BY USER_ID,USER_NAME,FACTORY_CODE,FACTORY_NAME,GROUP_CODE,GROUP_NAME
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
CREATED_TIME desc
</isEmpty>
</dynamic>
</select>
<select id="queryUserId" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
<select id="queryGroupName" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
A.GROUP_CODE as "groupCode",
A.GROUP_NAME as "groupName",
A.FACTORY_CODE AS factoryCode
FROM ${hpjxSchema}.T_HPPZ013 A
LEFT JOIN ${platSchema}.TXSOG01 B ON A.COMPANY_CODE = B.COMPANY_CODE AND A.GROUP_CODE = B.ORG_ENAME
WHERE 1=1
and length(A.FACTORY_CODE)>0
and length(A.FACTORY_NAME)>0
and length(A.GROUP_CODE)>0
and length(A.GROUP_NAME)>0
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
A.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
A.DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isEmpty prepend=" AND " property="groupType">
A.GROUP_TYPE = 'prodGroup'
</isEmpty>
<isNotEmpty prepend=" AND " property="groupType">
A.GROUP_TYPE = #groupType#
</isNotEmpty>
GROUP BY A.GROUP_CODE,A.GROUP_NAME,A.FACTORY_CODE
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.FACTORY_CODE,B.SORT_INDEX ASC
</isEmpty>
</dynamic>
</select>
<select id="queryUserName" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
USER_ID as "userId",
USER_NAME as "userName",
FACTORY_CODE AS factoryCode,
GROUP_CODE as "groupCode"
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and STATUS = '1'
FROM ${hpjxSchema}.T_HPPZ013
WHERE 1=1
and STATUS = '1'
and length(FACTORY_CODE)>0
and length(FACTORY_NAME)>0
and length(GROUP_CODE)>0
and length(GROUP_NAME)>0
and length(USER_ID)>0
and length(USER_NAME)>0
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -318,12 +441,13 @@
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
GROUP BY USER_ID,USER_NAME,FACTORY_CODE,GROUP_CODE
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
CREATED_TIME desc
</isEmpty>
</dynamic>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-03-21 11:14:28
Version : 1.0
schema : hpjx
tableName : T_HPXS002
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
REGISTER_DATE VARCHAR,
FACTORY_CODE VARCHAR NOT NULL,
GROUP_CODE VARCHAR,
USER_ID VARCHAR,
GROUP_TYPE VARCHAR,
CONTENT VARCHAR,
REMARK VARCHAR,
DELETE_FLAG TINYINT,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
UPDATED_NAME VARCHAR
-->
<sqlMap namespace="HPSC009">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="registerDate">
REGISTER_DATE = #registerDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="content">
CONTENT = #content#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</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="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC009">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
REGISTER_DATE as "registerDate", <!-- 登记日期 -->
FACTORY_CODE as "factoryCode", <!-- 工厂代码 -->
GROUP_CODE as "groupCode", <!-- 下料组代码 -->
USER_ID as "userId", <!-- 员工代码 -->
GROUP_TYPE as "groupType", <!-- 下料类型 -->
CONTENT as "content", <!-- 报工内容 -->
REMARK as "remark", <!-- 备注 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0:否1.是 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_TIME as "updatedTime", <!-- 修改人名称 -->
UPDATED_NAME as "updatedName" <!-- 修改时间 -->
FROM ${hpjxSchema}.T_HPXS002 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPXS002 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="registerDate">
REGISTER_DATE = #registerDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="content">
CONTENT = #content#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</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="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPXS002 (ID, <!-- ID -->
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
REGISTER_DATE, <!-- 登记日期 -->
FACTORY_CODE, <!-- 工厂代码 -->
GROUP_CODE, <!-- 下料组代码 -->
USER_ID, <!-- 员工代码 -->
GROUP_TYPE, <!-- 下料类型 -->
CONTENT, <!-- 报工内容 -->
REMARK, <!-- 备注 -->
DELETE_FLAG, <!-- 是否删除0:否1.是 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_TIME, <!-- 修改人名称 -->
UPDATED_NAME <!-- 修改时间 -->
)
VALUES (#id#, #companyCode#, #depCode#, #registerDate#, #factoryCode#, #groupCode#, #userId#, #groupType#, #content#, #remark#, #deleteFlag#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedTime#, #updatedName#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPXS002 WHERE
ID = #id#
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
</delete>
<!--逻辑删除-->
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPXS002
SET
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_TIME = #updatedTime#, <!-- 修改人名称 -->
UPDATED_NAME = #updatedName# <!-- 修改时间 -->
WHERE
ID = #id#
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPXS002
SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 预留 -->
DEP_CODE = #depCode#, <!-- 部门编码 预留 -->
REGISTER_DATE = #registerDate#, <!-- 登记日期 -->
FACTORY_CODE = #factoryCode#, <!-- 工厂代码 -->
GROUP_CODE = #groupCode#, <!-- 下料组代码 -->
USER_ID = #userId#, <!-- 员工代码 -->
GROUP_TYPE = #groupType#, <!-- 下料类型 -->
CONTENT = #content#, <!-- 报工内容 -->
REMARK = #remark#, <!-- 备注 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_TIME = #updatedTime#, <!-- 修改人名称 -->
UPDATED_NAME = #updatedName# <!-- 修改时间 -->
WHERE
ID = #id#
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
</update>
</sqlMap>
package com.baosight.hpjx.hp.xs.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
* Title:THpxs003.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-03-25 15:58:56 create
*/
public class HPXS003 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; /* ID*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 企业编码 预留*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码 预留*/
public static final String FIELD_DOC_ID = "docId"; /* 文件标识*/
public static final String FIELD_DIR_ID = "dirId"; /* 目录标识*/
public static final String FIELD_DOC_NAME = "docName"; /* 文件名*/
public static final String FIELD_CHG_NAME = "chgName"; /* 物料文件名*/
public static final String FIELD_DOC_SIZE = "docSize"; /* 文件大小*/
public static final String FIELD_DOC_TAG = "docTag"; /* 文件标签*/
public static final String FIELD_REAL_PATH = "realPath"; /* 物理路径*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0:否1.是*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 修改人*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 修改人名称*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改时间*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码 预留*/
public static final String COL_DOC_ID = "DOC_ID"; /* 文件标识*/
public static final String COL_DIR_ID = "DIR_ID"; /* 目录标识*/
public static final String COL_DOC_NAME = "DOC_NAME"; /* 文件名*/
public static final String COL_CHG_NAME = "CHG_NAME"; /* 物料文件名*/
public static final String COL_DOC_SIZE = "DOC_SIZE"; /* 文件大小*/
public static final String COL_DOC_TAG = "DOC_TAG"; /* 文件标签*/
public static final String COL_REAL_PATH = "REAL_PATH"; /* 物理路径*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0:否1.是*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 修改人*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 修改人名称*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改时间*/
public static final String QUERY = "HPXS003.query";
public static final String COUNT = "HPXS003.count";
public static final String INSERT = "HPXS003.insert";
public static final String UPDATE = "HPXS003.update";
public static final String DELETE = "HPXS003.delete";
public static final String DELETE_FLAG = "HPXS003.deleteFlag";
private Long id = new Long(0); /* ID*/
private String companyCode = " "; /* 企业编码 预留*/
private String companyName = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码 预留*/
private String docId = " "; /* 文件标识*/
private String dirId = " "; /* 目录标识*/
private String docName = " "; /* 文件名*/
private String chgName = " "; /* 物料文件名*/
private BigDecimal docSize = new BigDecimal(0); /* 文件大小*/
private String docTag = " "; /* 文件标签*/
private String realPath = " "; /* 物理路径*/
private Integer deleteFlag; /* 是否删除0:否1.是*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 修改人*/
private String updatedTime = " "; /* 修改人名称*/
private String updatedName = " "; /* 修改时间*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_NAME);
eiColumn.setDescName("企业名称 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_ID);
eiColumn.setDescName("文件标识");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DIR_ID);
eiColumn.setDescName("目录标识");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_NAME);
eiColumn.setDescName("文件名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CHG_NAME);
eiColumn.setDescName("物料文件名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_SIZE);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(16);
eiColumn.setDescName("文件大小");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_TAG);
eiColumn.setDescName("文件标签");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REAL_PATH);
eiColumn.setDescName("物理路径");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除0:否1.是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("修改人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("修改人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("修改时间");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPXS003() {
initMetaData();
}
/**
* get the id - ID.
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id - ID.
*
* @param id - ID
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode - 企业编码 预留.
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 企业编码 预留.
*
* @param companyCode - 企业编码 预留
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
/**
* get the depCode - 部门编码 预留.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码 预留.
*
* @param depCode - 部门编码 预留
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the docId - 文件标识.
* @return the docId
*/
public String getDocId() {
return this.docId;
}
/**
* set the docId - 文件标识.
*
* @param docId - 文件标识
*/
public void setDocId(String docId) {
this.docId = docId;
}
/**
* get the dirId - 目录标识.
* @return the dirId
*/
public String getDirId() {
return this.dirId;
}
/**
* set the dirId - 目录标识.
*
* @param dirId - 目录标识
*/
public void setDirId(String dirId) {
this.dirId = dirId;
}
/**
* get the docName - 文件名.
* @return the docName
*/
public String getDocName() {
return this.docName;
}
/**
* set the docName - 文件名.
*
* @param docName - 文件名
*/
public void setDocName(String docName) {
this.docName = docName;
}
/**
* get the chgName - 物料文件名.
* @return the chgName
*/
public String getChgName() {
return this.chgName;
}
/**
* set the chgName - 物料文件名.
*
* @param chgName - 物料文件名
*/
public void setChgName(String chgName) {
this.chgName = chgName;
}
/**
* get the docSize - 文件大小.
* @return the docSize
*/
public BigDecimal getDocSize() {
return this.docSize;
}
/**
* set the docSize - 文件大小.
*
* @param docSize - 文件大小
*/
public void setDocSize(BigDecimal docSize) {
this.docSize = docSize;
}
/**
* get the docTag - 文件标签.
* @return the docTag
*/
public String getDocTag() {
return this.docTag;
}
/**
* set the docTag - 文件标签.
*
* @param docTag - 文件标签
*/
public void setDocTag(String docTag) {
this.docTag = docTag;
}
public String getRealPath() {
return realPath;
}
public void setRealPath(String realPath) {
this.realPath = realPath;
}
/**
* get the deleteFlag - 是否删除0:否1.是.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除0:否1.是.
*
* @param deleteFlag - 是否删除0:否1.是
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 修改人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 修改人.
*
* @param updatedBy - 修改人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedTime - 修改人名称.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 修改人名称.
*
* @param updatedTime - 修改人名称
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the updatedName - 修改时间.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 修改时间.
*
* @param updatedName - 修改时间
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID)), docId));
setDirId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DIR_ID)), dirId));
setDocName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_NAME)), docName));
setChgName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CHG_NAME)), chgName));
setDocSize(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_DOC_SIZE)), docSize));
setDocTag(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_TAG)), docTag));
setRealPath(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REAL_PATH)), realPath));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_DOC_ID, StringUtils.toString(docId, eiMetadata.getMeta(FIELD_DOC_ID)));
map.put(FIELD_DIR_ID, StringUtils.toString(dirId, eiMetadata.getMeta(FIELD_DIR_ID)));
map.put(FIELD_DOC_NAME, StringUtils.toString(docName, eiMetadata.getMeta(FIELD_DOC_NAME)));
map.put(FIELD_CHG_NAME, StringUtils.toString(chgName, eiMetadata.getMeta(FIELD_CHG_NAME)));
map.put(FIELD_DOC_SIZE, StringUtils.toString(docSize, eiMetadata.getMeta(FIELD_DOC_SIZE)));
map.put(FIELD_DOC_TAG, StringUtils.toString(docTag, eiMetadata.getMeta(FIELD_DOC_TAG)));
map.put(FIELD_REAL_PATH, StringUtils.toString(realPath, eiMetadata.getMeta(FIELD_REAL_PATH)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
return map;
}
}
package com.baosight.hpjx.hp.xs.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.sc.domain.HPSC002A;
import com.baosight.hpjx.hp.xs.domain.HPXS003;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ProjectInfo;
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.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/3/25
*/
public class ServiceHPXS003 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXS003.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
final EiInfo outEiInfo = super.query(inInfo, HPXS003.QUERY, new HPXS003());
//outInfo.getBlock(EiConstant.resultBlock).getRows().clear();
return outEiInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXS003.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPXS003.QUERY,new HPXS003());
}
/**
* 查询最新企业log附件
* @param inInfo
* @return
*/
public EiInfo queryMaxLog(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPXS003.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
EiInfo eiInfo = super.query(inInfo, HPXS003.QUERY,new HPXS003());
String projectEnv = ProjectInfo.getProjectEnv();
eiInfo.setCell(EiConstant.resultBlock,ACConstants.ROW_CODE_0,"projectEnv",projectEnv);
return eiInfo;
}
@OperationLogAnnotation(operModul = "企业log上传管理", operType = "删除", operDesc = "删除6个月之前的历史数据")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HPXS003 hpxs003 = new HPXS003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs003.fromMap(map);
hpxs003.setDeleteFlag(CommonConstant.YesNo.YES_1);
delectDoc(eiBlock.getCellStr(i,HPXS003.FIELD_DIR_ID));
DaoUtils.update(HPXS003.DELETE_FLAG, hpxs003.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "企业log上传管理", operType = "修改", operDesc = "修改log操作")
@Override
public EiInfo update(EiInfo inInfo) {
int i = 0;
try {
HPXS003 hpxs003 = new HPXS003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs003.fromMap(map);
hpxs003.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.update(HPXS003.UPDATE, hpxs003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
}
@OperationLogAnnotation(operModul = "企业log上传管理", operType = "新增", operDesc = "新增log操作")
@Override
public EiInfo insert(EiInfo inInfo) {
int i = 0;
try {
HPXS003 hpxs003 = new HPXS003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
String userName;
try {
userName = UserSession.getLoginCName();
} catch (Exception e) {
userName = "System";
}
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpxs003.fromMap(map);
hpxs003.setDeleteFlag(CommonConstant.YesNo.NO_0);
hpxs003.setCompanyName(userName);
DaoUtils.insert(HPXS003.INSERT, hpxs003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.insert", "新增")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleInsertException(inInfo,i,e);
logError("新增失败", e.getMessage());
return inInfo;
}
return inInfo;
}
/**
* 删除附件文件
* @param docId 文件ID
*/
@OperationLogAnnotation(operModul = "企业log上传管理",operType = "删除",operDesc = "删除附件文件")
public void delectDoc(String docId){
Map<String,Object> map = new HashMap<>();
map.put("docId",docId);
List<HPDS002> list = this.dao.query("HPXS003.query",map);
if (list.size() > 0) {
for (HPDS002 hpds002: list) {
String realPath = hpds002.getRealPath();
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HPSC002A.FIELD_DOC_ID,hpds002.getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
}
this.dao.delete(HPDS002.DELETE,map);
}
}
}
package com.baosight.hpjx.hp.xs.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
/**
* @author LiuYang
* @version 1.0 2024/3/25
*/
public class ServiceHPXS099 extends ServiceEPBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
@OperationLogAnnotation(operModul = "附件上传",operType = "上传",operDesc = "附件上传")
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-03-25 15:58:56
Version : 1.0
schema : hpjx
tableName : T_HPXS003
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
DOC_ID VARCHAR NOT NULL,
DIR_ID VARCHAR,
DOC_NAME VARCHAR,
CHG_NAME VARCHAR,
DOC_SIZE DECIMAL,
DOC_TAG VARCHAR,
DELETE_FLAG TINYINT,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
UPDATED_NAME VARCHAR
-->
<sqlMap namespace="HPXS003">
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE=#companyCode#
</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>
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dirId">
DIR_ID = #dirId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME = #docName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="chgName">
CHG_NAME = #chgName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docSize">
DOC_SIZE = #docSize#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docTag">
DOC_TAG = #docTag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="realPath">
REAL_PATH = #realPath#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</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="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.xs.domain.HPXS003">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
COMPANY_NAME as "companyName", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
DOC_ID as "docId", <!-- 文件标识 -->
DIR_ID as "dirId", <!-- 目录标识 -->
DOC_NAME as "docName", <!-- 文件名 -->
CHG_NAME as "chgName", <!-- 物料文件名 -->
DOC_SIZE as "docSize", <!-- 文件大小 -->
DOC_TAG as "docTag", <!-- 文件标签 -->
REAL_PATH as "realPath", <!-- 物理路径 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0:否1.是 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_TIME as "updatedTime", <!-- 修改人名称 -->
UPDATED_NAME as "updatedName" <!-- 修改时间 -->
FROM ${hpjxSchema}.T_HPXS003 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME DESC
</isEmpty>
</dynamic>
</select>
<select id="queryMax" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.xs.domain.HPXS003">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
COMPANY_NAME as "companyName", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
DOC_ID as "docId", <!-- 文件标识 -->
DIR_ID as "dirId", <!-- 目录标识 -->
DOC_NAME as "docName", <!-- 文件名 -->
CHG_NAME as "chgName", <!-- 物料文件名 -->
DOC_SIZE as "docSize", <!-- 文件大小 -->
DOC_TAG as "docTag", <!-- 文件标签 -->
REAL_PATH as "realPath", <!-- 物理路径 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0:否1.是 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_TIME as "updatedTime", <!-- 修改人名称 -->
UPDATED_NAME as "updatedName" <!-- 修改时间 -->
FROM ${hpjxSchema}.T_HPXS003 WHERE 1=1 AND CREATED_TIME = (SELECT MAX(CREATED_TIME) FROM ${hpjxSchema}.T_HPXS003 WHERE DELETE_FLAG = '0')
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME DESC
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPXS003 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dirId">
DIR_ID = #dirId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME = #docName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="chgName">
CHG_NAME = #chgName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docSize">
DOC_SIZE = #docSize#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docTag">
DOC_TAG = #docTag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</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="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPXS003 (ID, <!-- ID -->
COMPANY_CODE, <!-- 企业编码 预留 -->
COMPANY_NAME, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
DOC_ID, <!-- 文件标识 -->
DIR_ID, <!-- 目录标识 -->
DOC_NAME, <!-- 文件名 -->
CHG_NAME, <!-- 物料文件名 -->
DOC_SIZE, <!-- 文件大小 -->
DOC_TAG, <!-- 文件标签 -->
REAL_PATH, <!-- 物理路径 -->
DELETE_FLAG, <!-- 是否删除0:否1.是 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_TIME, <!-- 修改人名称 -->
UPDATED_NAME <!-- 修改时间 -->
)
VALUES (#id#, #companyCode#, #companyName#, #depCode#, #docId#, #dirId#, #docName#, #chgName#, #docSize#, #docTag#, #realPath#,
#deleteFlag#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedTime#, #updatedName#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPXS003 WHERE
ID = #id#
</delete>
<!--逻辑删除-->
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPXS003
SET
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_TIME = #updatedTime#, <!-- 修改人名称 -->
UPDATED_NAME = #updatedName# <!-- 修改时间 -->
WHERE
ID = #id#
<include refid="authCondition" />
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPXS003
SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 预留 -->
DEP_CODE = #depCode#, <!-- 部门编码 预留 -->
DOC_ID = #docId#, <!-- 文件标识 -->
DIR_ID = #dirId#, <!-- 目录标识 -->
DOC_NAME = #docName#, <!-- 文件名 -->
CHG_NAME = #chgName#, <!-- 物料文件名 -->
DOC_SIZE = #docSize#, <!-- 文件大小 -->
DOC_TAG = #docTag#, <!-- 文件标签 -->
REAL_PATH = #realPath#,
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_TIME = #updatedTime#, <!-- 修改人名称 -->
UPDATED_NAME = #updatedName# <!-- 修改时间 -->
WHERE
ID = #id#
<include refid="authCondition" />
</update>
</sqlMap>
......@@ -209,7 +209,7 @@
</select>
<!-- 查询组织信息 -->
<select id="queryTedcm01" resultClass="com.baosight.iplat4j.common.ed.domain.TEDCM01">
<select id="queryTedcm01" resultClass="java.util.HashMap">
SELECT
ITEM_CODE AS "itemCode",
ITEM_CNAME AS "itemCname"
......
package com.baosight.hpjx.util;
import com.baosight.hpjx.common.ExcelAnno;
import com.baosight.hpjx.common.ExcelHeadAnon;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* @author:songx
* @date:2021/3/20,21:22
*/
@Slf4j
public class DocExcelUtils {
/**
* 读取excel反射实体
*
* @param file MultipartFile
* @param startRow 起始行
* @param clazz entity
* @return
* @throws RuntimeException
*/
public static <T extends Object> List<T> readExcel(MultipartFile file, Integer startRow, Class<T> clazz)
throws Exception {
// 得到一个工作表
Sheet sheet = getSheet(file);
return getRowData(sheet, startRow, clazz);
}
/**
* 读取excel内容
*
* @param sheet
* @param startRow 起始行
* @param clazz
* @param <T>
* @return
*/
private static <T> List<T> getRowData(Sheet sheet, Integer startRow, Class<T> clazz) throws Exception {
List<T> results = new ArrayList();
// 获取类所有属性
Field[] fields = clazz.getDeclaredFields();
// 获取行总数
int rows = sheet.getLastRowNum() + 1;
for (int i = (startRow == null ? 1 : startRow); i < rows; i++) {
// 获取excel行
Row row = sheet.getRow(i);
if (row == null || row.getCell(0) == null || row.getCell(1) == null) {
continue;
}
// 创建实体
T obj = clazz.newInstance();
for (Field f : fields) {
// 设置属性可访问
f.setAccessible(true);
// 判断是否是注解
if (f.isAnnotationPresent(ExcelAnno.class)) {
// 获取注解
ExcelAnno excelAnno = f.getAnnotation(ExcelAnno.class);
// 获取列索引
int columnIndex = excelAnno.index();
// 获取单元格
Cell cell = row.getCell(columnIndex);
// 设置属性
setFieldValue(obj, f, cell);
}
}
// 添加到集合中
results.add(obj);
}
return results;
}
/**
* 绑定实体值
*
* @param obj Object
* @param f Field
* @param cell Cell
* @return
* @throws RuntimeException
*/
private static void setFieldValue(Object obj, Field f, Cell cell) throws IOException {
if (cell == null) {
return;
}
cell.setCellType(Cell.CELL_TYPE_STRING);
String cellValue = cell.getStringCellValue();
if (cellValue.equals("3-零件")) {
cellValue = "3";
}
if (cellValue.equals("4-部件")) {
cellValue = "4";
}
if (cellValue.equals("2-耗材")) {
cellValue = "2";
}
try {
if (StringUtils.isBlank(cellValue)) {
f.set(obj, f.getType() == String.class ? cellValue : null);
return;
}
if (f.getType() == byte.class || f.getType() == Byte.class) {
f.set(obj, Byte.parseByte(cellValue));
} else if (f.getType() == int.class || f.getType() == Integer.class) {
f.set(obj, Integer.parseInt(cellValue));
} else if (f.getType() == Double.class || f.getType() == double.class) {
f.set(obj, Double.parseDouble(cellValue));
} else if (f.getType() == BigDecimal.class) {
f.set(obj, new BigDecimal(cellValue));
} else {
f.set(obj, cellValue);
}
} catch (Exception e) {
String msg = String.format("读取数据值失败,名称[%s],数值[%s],%s", f.getName(), cellValue, e.getMessage());
log.error(msg, e);
throw new IOException(msg);
}
}
/**
* 工作簿处理
*
* @param file
*/
private static Sheet getSheet(MultipartFile file) throws IOException {
Workbook workbook;
try (InputStream is = file.getInputStream()) {
// 根据excel文件版本获取工作簿
if (file.getOriginalFilename().endsWith(".xls")) {
workbook = new HSSFWorkbook(is);
} else if (file.getOriginalFilename().endsWith(".xlsx")) {
workbook = new XSSFWorkbook(is);
} else {
throw new RuntimeException("非excel文件");
}
// 得到一个工作表
return workbook.getSheetAt(0);
} catch (IOException e) {
throw e;
}
}
/**
* 导出Excel
*
* @param sheetName 要导出的excel名称
* @param dataList 要导出的数据集合
* @param clazz if dataList is Map, clazz must be null
* @param <T>
*/
public static <T> HSSFWorkbook export(String sheetName, List<T> dataList, Class<T> clazz) throws Exception {
// 设置默认文件名为当前时间:年月日时分秒
if (StringUtils.isBlank(sheetName)) {
sheetName = "sheet1";
}
//创建一个WorkBook,对应一个Excel文件
HSSFWorkbook wb = new HSSFWorkbook();
//在Workbook中,创建一个sheet,对应Excel中的工作薄(sheet)
HSSFSheet sheet = wb.createSheet(sheetName);
//创建单元格,并设置值表头 设置表头居中
HSSFCellStyle style = wb.createCellStyle();
//创建一个居中格式
style.setAlignment(HorizontalAlignment.CENTER);
//style.setAlignment(CellStyle.ALIGN_CENTER);
// 获取excel标题
LinkedHashMap<String, String> fieldMap = clazz == null ? getFieldMap(dataList) : getFieldMap(clazz);
// 填充工作表
fillSheet(sheet, dataList, fieldMap, style);
return wb;
}
/**
* 获取field头
*
* @param dataList
* @param <T>
* @return
*/
private static <T> LinkedHashMap<String, String> getFieldMap(List<T> dataList) {
LinkedHashMap<String, String> resultMap = new LinkedHashMap();
if (CollectionUtils.isEmpty(dataList)) {
return resultMap;
}
Map<String, Object> dataMap = (Map<String, Object>) dataList.get(0);
for (String key : dataMap.keySet()) {
resultMap.put(key, key);
}
return resultMap;
}
/**
* 获取field头
*
* @param clazz
* @return
*/
private static <T> LinkedHashMap<String, String> getFieldMap(Class<T> clazz) {
LinkedHashMap<String, String> resultMap = new LinkedHashMap();
if (clazz == null) {
return resultMap;
}
Field[] fields = clazz.getDeclaredFields();
List<ExcelHeadAnon> excelHeadAnons = new ArrayList<>();
for (Field f : fields) {
// 设置属性可访问
f.setAccessible(true);
// 判断是否是注解
if (f.isAnnotationPresent(ExcelHeadAnon.class)) {
excelHeadAnons.add(f.getAnnotation(ExcelHeadAnon.class));
}
}
// 从小到大正序排
excelHeadAnons.sort(Comparator.comparing(ExcelHeadAnon::index));
for (ExcelHeadAnon excelHeadAnon : excelHeadAnons) {
resultMap.put(excelHeadAnon.field(), excelHeadAnon.name());
}
return resultMap;
}
/**
* 根据字段名获取字段对象
*
* @param fieldName 字段名
* @param clazz 包含该字段的类
* @return 字段
*/
public static Field getFieldByName(String fieldName, Class<?> clazz) {
// 拿到本类的所有字段
Field[] selfFields = clazz.getDeclaredFields();
// 如果本类中存在该字段,则返回
for (Field field : selfFields) {
//如果本类中存在该字段,则返回
if (field.getName().equals(fieldName)) {
return field;
}
}
// 否则,查看父类中是否存在此字段,如果有则返回
Class<?> superClazz = clazz.getSuperclass();
if (superClazz != null && superClazz != Object.class) {
// 递归
return getFieldByName(fieldName, superClazz);
}
// 如果本类和父类都没有,则返回空
return null;
}
/**
* 根据字段名获取字段值
*
* @param fieldName 字段名
* @param o 对象
* @return 字段值
* @throws Exception 异常
*/
public static Object getFieldValueByName(String fieldName, Object o) throws Exception {
Object value = null;
//根据字段名得到字段对象
Field field = getFieldByName(fieldName, o.getClass());
//如果该字段存在,则取出该字段的值
if (field != null) {
field.setAccessible(true);//类中的成员变量为private,在类外边使用属性值,故必须进行此操作
value = field.get(o);//获取当前对象中当前Field的value
} else {
throw new IllegalArgumentException(o.getClass().getSimpleName() + "类不存在字段名 "
+ fieldName);
}
return value;
}
/**
* 根据带路径或不带路径的属性名获取属性值,即接受简单属性名,
* 如userName等,又接受带路径的属性名,如student.department.name等
*
* @param fieldNameSequence 带路径的属性名或简单属性名
* @param o 对象
* @return 属性值
*/
public static Object getFieldValueByNameSequence(String fieldNameSequence, Object o) throws Exception {
Object value = null;
// 将fieldNameSequence进行拆分
String[] attributes = fieldNameSequence.split("\\.");
if (o instanceof Map) {
value = ((Map) o).get(fieldNameSequence);
} else if (attributes.length == 1) {
value = getFieldValueByName(fieldNameSequence, o);
} else {
// 根据数组中第一个连接属性名获取连接属性对象,如student.department.name
Object fieldObj = getFieldValueByName(attributes[0], o);
//截取除第一个属性名之后的路径
String subFieldNameSequence = fieldNameSequence
.substring(fieldNameSequence.indexOf(".") + 1);
//递归得到最终的属性对象的值
value = getFieldValueByNameSequence(subFieldNameSequence, fieldObj);
}
return value;
}
/**
* 向工作表中填充数据
*
* @param sheet excel的工作表名称
* @param dataList 数据源
* @param fieldMap 中英文字段对应关系的Map
* @param style 表格中的格式
* @throws Exception 异常
*/
public static <T> void fillSheet(HSSFSheet sheet, List<T> dataList, LinkedHashMap<String, String> fieldMap,
HSSFCellStyle style) throws Exception {
// 定义存放英文字段名和中文字段名的数组
String[] enFields = new String[fieldMap.size()];
String[] cnFields = new String[fieldMap.size()];
// 填充数组
int count = 0;
for (Map.Entry<String, String> entry : fieldMap.entrySet()) {
enFields[count] = entry.getKey();
cnFields[count] = entry.getValue();
count++;
}
//在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
HSSFRow row = sheet.createRow((int) 0);
// 填充表头
for (int i = 0; i < cnFields.length; i++) {
HSSFCell cell = row.createCell(i);
cell.setCellValue(cnFields[i]);
cell.setCellStyle(style);
sheet.autoSizeColumn(i);
}
// 填充内容
for (int index = 0; index < dataList.size(); index++) {
row = sheet.createRow(index + 1);
// 获取单个对象
T item = dataList.get(index);
for (int i = 0; i < enFields.length; i++) {
Object objValue = getFieldValueByNameSequence(enFields[i], item);
String fieldValue = convertValue(objValue);
row.createCell(i).setCellValue(fieldValue);
}
}
}
/**
* 转换值
*
* @param objValue
* @return
*/
private static String convertValue(Object objValue) {
if (objValue == null) {
return "";
}
if (objValue instanceof Date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(objValue);
}
return objValue.toString();
}
//
// /**
// * 创建独立下拉框
// *
// * @param workbook 工作簿
// * @param targetSheet 目标sheet
// * @param options 下拉框值(key-value)
// * @param column 下拉框所在的列索引(0开始)
// * @param sheetIndex sheet也索引(0开始)
// * @author lanheng
// * 2019-05-27 15:32:35
// */
// public static void addValidationToSheet(Workbook workbook, Sheet targetSheet, List<String> options, int column,
// int sheetIndex) {
// String sheetName = "hidden" + sheetIndex;
// Sheet optionsSheet = workbook.createSheet(sheetName);
// String nameName = sheetName + "_parent";
//
// int rowIndex = 0;
// for (String option : options) {
// Row row = optionsSheet.createRow(rowIndex);
// Cell cell = row.createCell(0);
// cell.setCellValue(option);
// rowIndex++;
// }
//
// // 将码值sheet页做成excel公式
// Name namedCell = workbook.createName();
// namedCell.setNameName(nameName);
// namedCell.setRefersToFormula(sheetName + "!$A$1:$A$" + (options.size() > 0 ? options.size() : 1));
//
// if (optionsSheet instanceof HSSFSheet) {
// DVConstraint constraint = DVConstraint.createFormulaListConstraint(nameName);
// CellRangeAddressList regions = new CellRangeAddressList(0, 65535, column, column);
// targetSheet.addValidationData(new HSSFDataValidation(regions, constraint));
// } else if (optionsSheet instanceof XSSFSheet) {
// XSSFDataValidationConstraint constraint = new XSSFDataValidationConstraint(
// DataValidationConstraint.ValidationType.LIST, nameName);
// // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
// CellRangeAddressList regions = new CellRangeAddressList(0, 100, column, column);
// // 数据有效性对象
// DataValidationHelper help = new XSSFDataValidationHelper((XSSFSheet) optionsSheet);
// DataValidation validation = help.createValidation(constraint, regions);
// targetSheet.addValidationData(validation);
// } else if (optionsSheet instanceof SXSSFSheet) {
// DataValidationHelper help = optionsSheet.getDataValidationHelper();
// DataValidationConstraint constraint = help.createFormulaListConstraint(nameName);
// CellRangeAddressList regions = new CellRangeAddressList(0, 65535, column, column);
// DataValidation validation = help.createValidation(constraint, regions);
// targetSheet.addValidationData(validation);
// }
// workbook.setSheetHidden(sheetIndex, true);
// }
//
}
......@@ -3,6 +3,9 @@ package com.baosight.hpjx.util;
import com.baosight.hpjx.common.ErrorCodeEnum;
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.resource.I18nMessages;
import com.baosight.iplat4j.core.util.ExceptionUtil;
/**
* ErrorCodeUtils
......@@ -99,6 +102,25 @@ public class ErrorCodeUtils {
return detail;
}
public static void handleDeleteException(EiInfo inInfo, int i, Exception ex) {
inInfo.setMsgByKey("ep.0002", new String[]{String.valueOf(i + 1), I18nMessages.getText("label.delete", "删除"), ExceptionUtil.getRootCauseMessage(ex)});
inInfo.setDetailMsg(ex.toString());
throw new PlatException("E_Plat_DeleteError", ex, inInfo);
}
public static void handleUpdateException(EiInfo inInfo, int i, Exception ex) {
inInfo.setMsgByKey("ep.0002", new String[]{String.valueOf(i + 1), I18nMessages.getText("label.update", "修改"), ExceptionUtil.getRootCauseMessage(ex)});
inInfo.setDetailMsg(ex.toString());
throw new PlatException("E_Plat_UpdateError", ex, inInfo);
}
public static void handleInsertException(EiInfo inInfo, int i, Exception ex) {
inInfo.setMsgByKey("ep.0002", new String[]{String.valueOf(i + 1), I18nMessages.getText("label.insert", "新增"), ExceptionUtil.getRootCauseMessage(ex)});
inInfo.setDetailMsg(ex.toString());
throw new PlatException("E_Plat_InsertError", ex, inInfo);
}
private static final String SQL_ERROR_WORD1 = "SQLCODE=";
private static final String SQL_ERROR_WORD2 = "Error Code:";
}
\ No newline at end of file
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.baosight.xservices.xs.service;
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.exception.PlatException;
import com.baosight.iplat4j.core.log.xeye.entity.XEyeEntity;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XEventManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.util.JudgeCircleUtils;
import com.baosight.xservices.xs.common.AuthInfoManager;
import com.baosight.xservices.xs.util.XSServiceUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
public class ServiceXSResourceGroupManage extends ServiceEPBase {
private static final Logger logger = LogManager.getLogger(ServiceXSResourceGroupManage.class);
public ServiceXSResourceGroupManage() {
}
public EiInfo insertResourceGroup(EiInfo inInfo) {
boolean ignoreDuplicate = "true".equals(inInfo.get("ignoreDuplicate"));
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List insertedResourceGroupList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
String resourceGroupId = inInfoRowMap.get("resourceGroupId") != null ? inInfoRowMap.get("resourceGroupId").toString() : "";
if (StringUtils.isBlank(resourceGroupId)) {
resourceGroupId = UUID.randomUUID().toString().replaceAll("-", "");
}
String resourceGroupEname;
String resourceGroupCname;
try {
resourceGroupEname = inInfoRowMap.get("resourceGroupEname").toString();
resourceGroupCname = inInfoRowMap.get("resourceGroupCname").toString();
} catch (Exception var23) {
inInfo.setMsg("没有提供有效的群组英文名/中文名,请检查!");
inInfo.setStatus(-1);
return inInfo;
}
if ("".equals(resourceGroupEname) || "".equals(resourceGroupCname)) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源群组英文名和中文名均不能为空\n");
inInfo.setStatus(-1);
return inInfo;
}
try {
Map paramMap = new HashMap();
paramMap.put("resourceGroupEname", resourceGroupEname.toUpperCase());
List existResourceGroup = this.dao.query("XSResourceManage.queryResourceGroup", paramMap);
if (null != existResourceGroup && existResourceGroup.size() > 0) {
if (!ignoreDuplicate) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,该资源组信息已存在\n");
inInfo.setStatus(-1);
inInfoRowMap.put("resourceGroupId", "");
return inInfo;
}
} else {
inInfoRowMap.put("resourceGroupEname", resourceGroupEname.toUpperCase());
inInfoRowMap.put("resourceGroupId", resourceGroupId);
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
String archiveFlag = (String)inInfoRowMap.get("archiveFlag");
if (null == archiveFlag || "".equals(archiveFlag.trim())) {
archiveFlag = "0";
inInfoRowMap.put("archiveFlag", archiveFlag);
}
String sortIndex = (String)inInfoRowMap.get("sortIndex");
if (null == sortIndex || "".equals(sortIndex.trim())) {
inInfoRowMap.put("sortIndex", 0);
}
String recRevisor = (String)inInfoRowMap.get("recRevisor");
String recReviseTime = (String)inInfoRowMap.get("recReviseTime");
if (StringUtils.isBlank(recRevisor)) {
inInfoRowMap.put("recRevisor", " ");
}
if (StringUtils.isBlank(recReviseTime)) {
inInfoRowMap.put("recReviseTime", " ");
}
this.dao.insert("XS05.insert", inInfoRowMap);
logger.info("新增第" + (i + 1) + "条记录成功\n");
Map map = new HashMap();
map.put("resourceGroupId", resourceGroupId);
List insertResourceGroupList = this.dao.query("XS05.query", map);
Map insertResourceGroupMap = (Map)insertResourceGroupList.get(0);
insertedResourceGroupList.add(insertResourceGroupMap);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2300");
xEyeEntity.setLogName("新增资源组");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recCreator") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "新增了资源组英文名为 " + inInfoRowMap.get("resourceGroupEname") + " 的资源组信息");
xEyeEntity.set("x_xs_rgi", resourceGroupId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recCreator"));
xEyeEntity.set("x_xs_rge", resourceGroupEname);
this.log(xEyeEntity);
}
} catch (Exception var24) {
logger.error("新增第" + (i + 1) + "条记录失败\n");
buffer.append("新增第").append(i + 1).append("条记录失败\n").append(var24.getMessage());
inInfo.setStatus(-1);
inInfoRowMap.put("resourceGroupId", "");
String errorMsg = var24.getCause() == null ? var24.getMessage() : var24.getCause().toString();
detail.append(errorMsg);
logger.error(errorMsg);
return inInfo;
}
}
buffer.append("新增").append(rowCount).append("条记录成功\n");
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (insertedResourceGroupList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", insertedResourceGroupList);
eiInfo.set(EiConstant.eventId, "E_XS_40");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("新增资源组失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo deleteResourceGroup(EiInfo inInfo) {
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List deletedResourceGroupList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map inInfoRowMap = eiBlock.getRow(i);
String resourceGroupId;
String resourceGroupEname;
try {
resourceGroupId = inInfoRowMap.get("resourceGroupId") != null ? inInfoRowMap.get("resourceGroupId").toString().trim() : "";
resourceGroupEname = inInfoRowMap.get("resourceGroupEname") != null ? inInfoRowMap.get("resourceGroupEname").toString().trim().toUpperCase() : "";
if (StringUtils.isEmpty(resourceGroupId) && StringUtils.isEmpty(resourceGroupEname)) {
throw new PlatException("没有提供有效的群组Id或群组英文名");
}
} catch (Exception var18) {
inInfo.setMsg("没有提供有效的群组Id/英文名,请检查!");
inInfo.setStatus(-1);
return inInfo;
}
try {
HashMap map;
List resourceGroupIdList;
if (StringUtils.isEmpty(resourceGroupId) && StringUtils.isNotEmpty(resourceGroupEname)) {
map = new HashMap();
map.put("resourceGroupEname", resourceGroupEname);
resourceGroupIdList = this.dao.query("XS05.queryResourceGroupId", map);
if (null == resourceGroupIdList || resourceGroupIdList.size() <= 0) {
inInfo.setMsg("删除第" + (i + 1) + "条记录失败,群组英文名" + resourceGroupEname + "不存在!\n");
inInfo.setStatus(-1);
return inInfo;
}
HashMap resourceGroupIdMap = (HashMap)resourceGroupIdList.get(0);
resourceGroupId = resourceGroupIdMap.get("resourceGroupId").toString();
}
map = new HashMap();
map.put("resourceMemberId", resourceGroupId);
resourceGroupIdList = this.dao.query("XS06.query", map);
if (null != resourceGroupIdList && resourceGroupIdList.size() > 0) {
throw new PlatException("[" + resourceGroupEname + "]资源组是其他资源组的成员,不能删除!");
}
map.put("resourceMemberId", "");
map.put("resourceParentId", resourceGroupId);
List resourceGroupAsParents = this.dao.query("XS06.query", map);
if (null != resourceGroupAsParents && resourceGroupAsParents.size() > 0) {
throw new PlatException("[" + resourceGroupEname + "]资源组下有成员关系,不能删除!");
}
map.put("objectId", resourceGroupId);
List resourceGroupAsObjects = this.dao.query("XS07.query", map);
if (null != resourceGroupAsObjects && resourceGroupAsObjects.size() > 0) {
throw new PlatException("[" + resourceGroupEname + "]资源组存在授权关系,不能删除!");
}
Map paramMap = new HashMap();
paramMap.put("resourceGroupId", resourceGroupId);
List existResourceGroup = this.dao.query("XSResourceManage.queryResourceGroup", paramMap);
if (existResourceGroup.size() <= 0) {
throw new PlatException("没有查到resourceGroupId为" + resourceGroupId + "的数据!");
}
this.dao.delete("XS05.delete", paramMap);
deletedResourceGroupList.add(existResourceGroup);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2301");
xEyeEntity.setLogName("删除资源组");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recRevisor") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "删除了资源组英文名为 " + inInfoRowMap.get("resourceGroupEname") + " 的资源组信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_rgi", resourceGroupId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recCreator"));
xEyeEntity.set("x_xs_rge", inInfoRowMap.get("resourceGroupEname"));
this.log(xEyeEntity);
} catch (Exception var19) {
buffer.append("删除第").append(i + 1).append("条记录失败\n");
inInfo.setStatus(-1);
inInfo.setMsg(buffer.toString());
detail.append(var19.getMessage());
logger.error(var19.getMessage());
return inInfo;
}
}
buffer.append("删除").append(rowCount).append("条记录成功\n");
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (deletedResourceGroupList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", deletedResourceGroupList);
eiInfo.set(EiConstant.eventId, "E_XS_41");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("删除资源组失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo updateResourceGroup(EiInfo inInfo) {
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuffer buffer = new StringBuffer();
StringBuffer detail = new StringBuffer();
List updatedResourceGroupList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
HashMap paramMap = new HashMap();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
String resourceGroupId;
String resourceGroupEname;
try {
resourceGroupId = inInfoRowMap.get("resourceGroupId") != null ? inInfoRowMap.get("resourceGroupId").toString() : "";
resourceGroupEname = inInfoRowMap.get("resourceGroupEname").toString().toUpperCase();
String resourceGroupCname = inInfoRowMap.get("resourceGroupCname").toString();
if (StringUtils.isEmpty(resourceGroupId) && StringUtils.isEmpty(resourceGroupEname)) {
throw new PlatException("没有提供有效的群组Id或群组英文名");
}
} catch (Exception var19) {
inInfo.setMsg("没有提供有效的群组Id/英文名/中文名,请检查!");
inInfo.setStatus(-1);
return inInfo;
}
try {
if (StringUtils.isEmpty(resourceGroupId) && StringUtils.isNotEmpty(resourceGroupEname)) {
Map map = new HashMap();
map.put("resourceGroupEname", resourceGroupEname);
List resourceGroupIdList = this.dao.query("XS05.queryResourceGroupId", map);
if (null == resourceGroupIdList || resourceGroupIdList.size() <= 0) {
inInfo.setMsg("修改第" + (i + 1) + "条记录失败,群组英文名" + resourceGroupEname + "不存在!\n");
inInfo.setStatus(-1);
return inInfo;
}
map = (HashMap)resourceGroupIdList.get(0);
resourceGroupId = map.get("resourceGroupId").toString();
}
paramMap.put("resourceGroupId", resourceGroupId);
List existResourceGroup = this.dao.query("XSResourceManage.queryResourceGroup", paramMap);
if (existResourceGroup.size() <= 0) {
throw new PlatException("没有查到resourceGroupId为" + resourceGroupId + "的数据!");
}
Map result = (Map)existResourceGroup.get(0);
Iterator var26 = inInfoRowMap.entrySet().iterator();
while(var26.hasNext()) {
Entry entry = (Entry)var26.next();
Object _value = entry.getValue();
if (_value != null) {
result.put(entry.getKey(), _value);
}
}
this.dao.update("XS05.update", result);
buffer.append("更新资源组:").append(eiBlock.getCell(i, "resourceGroupEname")).append(" 的记录成功\n");
Map map = new HashMap();
map.put("resourceGroupId", resourceGroupId);
List updateResourceGroupList = this.dao.query("XS05.query", map);
Map updateResourceGroupMap = (Map)updateResourceGroupList.get(0);
updatedResourceGroupList.add(updateResourceGroupMap);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2302");
xEyeEntity.setLogName("修改资源组");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recRevisor") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "修改了资源组英文名为 " + inInfoRowMap.get("resourceGroupEname") + " 的资源组信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_rgi", resourceGroupId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recRevisor"));
xEyeEntity.set("x_xs_rge", inInfoRowMap.get("resourceGroupEname"));
this.log(xEyeEntity);
} catch (Exception var20) {
buffer.append("更新资源组:").append(eiBlock.getCell(i, "resourceGroupEname")).append(" 的记录失败\n");
inInfo.setStatus(-1);
String errorMsg = var20.getCause() == null ? var20.getMessage().toString() : var20.getCause().toString();
detail.append(errorMsg);
logger.error(errorMsg);
}
}
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (updatedResourceGroupList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", updatedResourceGroupList);
eiInfo.set(EiConstant.eventId, "E_XS_42");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("更新资源组失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo insertResourceGroupMember(EiInfo inInfo) {
boolean ignoreDuplicate = "true".equals(inInfo.get("ignoreDuplicate"));
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List insertedMemberList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
if (inInfoRowMap.get("resourceMemberId") == null || inInfoRowMap.get("resourceParentId") == null) {
inInfoRowMap.put("resourceMemberId", "");
inInfoRowMap.put("resourceParentId", "");
}
if (inInfoRowMap.get("resourceMemberEname") == null || inInfoRowMap.get("resourceParentEname") == null) {
inInfoRowMap.put("resourceMemberEname", "");
inInfoRowMap.put("resourceParentEname", "");
}
String resourceMemberId = inInfoRowMap.get("resourceMemberId").toString();
String resourceParentId = inInfoRowMap.get("resourceParentId").toString();
String resourceMemberEname = inInfoRowMap.get("resourceMemberEname").toString().toUpperCase();
String resourceParentEname = inInfoRowMap.get("resourceParentEname").toString().toUpperCase();
String memberType = inInfoRowMap.get("memberType").toString();
HashMap rowMap;
List list;
if ("".equals(resourceMemberId) || "".equals(resourceParentId) || "".equals(memberType)) {
if ("".equals(resourceMemberEname) || "".equals(resourceParentEname) || "".equals(memberType)) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源ID、资源所属组ID或者资源英文名、资源组英文名及资源类别均不能为空\n");
inInfo.setStatus(-1);
return inInfo;
}
rowMap = new HashMap();
rowMap.put("resourceGroupEname", resourceParentEname);
list = this.dao.query("XS06.queryByResourceGroupId", rowMap);
if (list != null && list.size() <= 0) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源组不存在\n");
inInfo.setStatus(-1);
return inInfo;
}
resourceParentId = ((HashMap)list.get(0)).get("resourceGroupId").toString();
list.clear();
rowMap.clear();
try {
byte var18 = -1;
switch(memberType.hashCode()) {
case -973253906:
if (memberType.equals("RESOURCE_GROUP")) {
var18 = 0;
}
default:
switch(var18) {
case 0:
rowMap.put("resourceGroupEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceGroupId", rowMap);
if (list != null && list.size() <= 0) {
throw new PlatException("新增第" + (i + 1) + "条记录失败,资源不存在\n");
}
resourceMemberId = ((HashMap)list.get(0)).get("resourceGroupId").toString();
break;
default:
rowMap.put("resourceEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceId", rowMap);
if (list != null && list.size() <= 0) {
throw new PlatException("新增第" + (i + 1) + "条记录失败,资源不存在\n");
}
resourceMemberId = ((HashMap)list.get(0)).get("resourceId").toString();
}
}
} catch (PlatException var26) {
inInfo.setMsg(var26.getMessage());
inInfo.setStatus(-1);
return inInfo;
}
}
if (resourceMemberId.equals(resourceParentId)) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源与父节点不能是同一个\n");
inInfo.setStatus(-1);
return inInfo;
}
try {
rowMap = new HashMap();
rowMap.put("resourceMemberId", resourceMemberId);
rowMap.put("resourceParentId", resourceParentId);
list = this.dao.query("XS06.query", rowMap);
if (list != null && list.size() > 0) {
if (!ignoreDuplicate) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,该记录已存在\n");
inInfo.setStatus(-1);
inInfoRowMap.put("resourceMemberId", "");
inInfoRowMap.put("resourceParentId", "");
return inInfo;
}
} else {
inInfoRowMap.put("resourceMemberId", resourceMemberId);
inInfoRowMap.put("resourceParentId", resourceParentId);
if (JudgeCircleUtils.judgeCircle("XS06.queryParentInfo", "XS06.queryChildInfo", resourceParentId, resourceMemberId).getStatus() < 0) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,父节点与子节点不能形成环状\n");
} else {
String archiveFlag = (String)inInfoRowMap.get("archiveFlag");
if (null == archiveFlag || "".equals(archiveFlag)) {
archiveFlag = "0";
inInfoRowMap.put("archiveFlag", archiveFlag);
}
String sortIndex = (String)inInfoRowMap.get("sortIndex");
if (null == sortIndex || "".equals(sortIndex)) {
inInfoRowMap.put("sortIndex", 0);
}
String recRevisor = (String)inInfoRowMap.get("recRevisor");
String recReviseTime = (String)inInfoRowMap.get("recReviseTime");
if (StringUtils.isBlank(recRevisor)) {
inInfoRowMap.put("recRevisor", " ");
}
if (StringUtils.isBlank(recReviseTime)) {
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
}
inInfoRowMap.putIfAbsent("path", "");
this.dao.insert("XS06.insert", inInfoRowMap);
logger.info("新增第" + (i + 1) + "条记录成功\n");
Map map = new HashMap();
map.put("resourceMemberId", resourceMemberId);
map.put("resourceParentId", resourceParentId);
List insertMemberList = this.dao.query("XS06.query", map);
Map insertMemberMap = (Map)insertMemberList.get(0);
insertedMemberList.add(insertMemberMap);
map.put("objectId", resourceParentId);
this.dao.query("XS07.query", map);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2303");
xEyeEntity.setLogName("为资源组添加新成员");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recCreator") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "将 " + insertMemberMap.get("memberName") + " 添加为" + insertMemberMap.get("resourceParentName") + " 资源组的成员");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_rmi", inInfoRowMap.get("resourceMemberId"));
xEyeEntity.set("x_xs_rpi", resourceParentId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recCreator"));
xEyeEntity.set("x_xs_rmn", insertMemberMap.get("memberName"));
xEyeEntity.set("x_xs_rpn", insertMemberMap.get("resourceParentName"));
this.log(xEyeEntity);
}
}
} catch (Exception var27) {
logger.info("新增第" + (i + 1) + "条记录失败\n");
buffer.append("新增第").append(i + 1).append("条记录失败\n");
inInfo.setStatus(-1);
inInfoRowMap.put("resourceMemberId", "");
detail.append(var27.getMessage());
logger.error(var27.getMessage());
return inInfo;
}
}
buffer.append("新增").append(rowCount).append("条记录成功\n");
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (insertedMemberList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", insertedMemberList);
eiInfo.set(EiConstant.eventId, "E_XS_43");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("新增资源组成员失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
AuthInfoManager.clearAuthInfo();
}
return inInfo;
}
}
public EiInfo deleteResourceGroupMember(EiInfo inInfo) {
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List deletedMemberList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
if (inInfoRowMap.get("resourceMemberId") == null || inInfoRowMap.get("resourceParentId") == null) {
inInfoRowMap.put("resourceMemberId", "");
inInfoRowMap.put("resourceParentId", "");
continue;
}
if (inInfoRowMap.get("resourceMemberEname") == null || inInfoRowMap.get("resourceParentEname") == null) {
inInfoRowMap.put("resourceMemberEname", "");
inInfoRowMap.put("resourceParentEname", "");
}
String resourceParentId = inInfoRowMap.get("resourceParentId").toString();
String objectId = inInfoRowMap.get("resourceMemberId").toString();
String resourceMemberEname = inInfoRowMap.get("resourceMemberEname").toString().toUpperCase();
String resourceParentEname = inInfoRowMap.get("resourceParentEname").toString().toUpperCase();
String memberType = inInfoRowMap.get("memberType").toString();
HashMap rowMap;
List list;
if (StringUtils.isEmpty(resourceParentId) && StringUtils.isEmpty(objectId) && StringUtils.isNotEmpty(resourceMemberEname) && StringUtils.isNotEmpty(resourceParentEname)) {
rowMap = new HashMap();
rowMap.put("resourceGroupEname", resourceParentEname);
rowMap.put("resourceEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceGroupId", rowMap);
if (list != null && list.size() <= 0) {
inInfo.setMsg("删除第" + (i + 1) + "条记录失败,资源组不存在\n");
inInfo.setStatus(-1);
return inInfo;
}
resourceParentId = ((HashMap)list.get(0)).get("resourceGroupId").toString();
list.clear();
rowMap.clear();
try {
byte var17 = -1;
switch(memberType.hashCode()) {
case -973253906:
if (memberType.equals("RESOURCE_GROUP")) {
var17 = 0;
}
default:
switch(var17) {
case 0:
rowMap.put("resourceGroupEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceGroupId", rowMap);
if (list != null && list.size() <= 0) {
throw new PlatException("新增第" + (i + 1) + "条记录失败,资源不存在\n");
}
objectId = ((HashMap)list.get(0)).get("resourceGroupId").toString();
break;
default:
rowMap.put("resourceEname", resourceMemberEname);
list = this.dao.query("XS06.queryByResourceId", rowMap);
if (list != null && list.size() <= 0) {
throw new PlatException("新增第" + (i + 1) + "条记录失败,资源不存在\n");
}
objectId = ((HashMap)list.get(0)).get("resourceId").toString();
}
}
} catch (PlatException var20) {
inInfo.setMsg(var20.getMessage());
inInfo.setStatus(-1);
return inInfo;
}
}
if (!StringUtils.isNotEmpty(resourceParentId) || !StringUtils.isNotEmpty(objectId)) {
inInfo.setStatus(-1);
String errorMsg = "传入数据为空,删除失败!";
inInfo.setMsg(errorMsg);
logger.error(errorMsg);
return inInfo;
}
try {
inInfoRowMap.put("resourceMemberId", objectId);
inInfoRowMap.put("resourceParentId", resourceParentId);
rowMap = new HashMap();
rowMap.put("resourceMemberId", objectId);
rowMap.put("resourceParentId", resourceParentId);
list = this.dao.query("XS06.query", rowMap);
Map deleteMemberMap = (Map)list.get(0);
deletedMemberList.add(deleteMemberMap);
this.dao.delete("XS06.delete", inInfoRowMap);
Map map2 = new HashMap();
map2.put("objectId", resourceParentId);
this.dao.query("XS07.query", map2);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2304");
xEyeEntity.setLogName("解除资源组与资源的成员关系");
xEyeEntity.setInvokeInfo(inInfoRowMap.get("recRevisor") + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "解除了 " + inInfoRowMap.get("memberName") + " 与" + inInfoRowMap.get("resourceParentName") + " 资源组的成员关系");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_rmi", inInfoRowMap.get("resourceMemberId"));
xEyeEntity.set("x_xs_rpi", resourceParentId);
xEyeEntity.set("x_xs_on", inInfoRowMap.get("recCreator"));
xEyeEntity.set("x_xs_rmn", inInfoRowMap.get("memberName"));
xEyeEntity.set("x_xs_rpn", inInfoRowMap.get("resourceParentName"));
this.log(xEyeEntity);
} catch (Exception var21) {
buffer.append("删除第").append(i + 1).append("条记录失败\n");
inInfo.setStatus(-1);
inInfo.setMsg(buffer.toString());
detail.append(var21.getMessage());
logger.error(var21.getMessage());
return inInfo;
}
}
buffer.append("删除").append(rowCount).append("条记录成功\n");
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (deletedMemberList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", deletedMemberList);
eiInfo.set(EiConstant.eventId, "E_XS_44");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("删除资源组成员失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
AuthInfoManager.clearAuthInfo();
}
return inInfo;
}
}
public EiInfo getResourceByResourceGroupEname(EiInfo eiInfo) {
String msg = "";
int status = 0;
String resourceParentId = "";
String resourceGroupEname = eiInfo.get("resourceGroupEname").toString();
try {
if (null != resourceGroupEname && !"".equals(resourceGroupEname)) {
Map map = new HashMap();
if (!"root".equals(resourceGroupEname.toLowerCase())) {
Map map1 = new HashMap();
map1.put("resourceGroupEname", resourceGroupEname);
List resourceGroupList = this.dao.query("XSResourceManage.queryResourceGroup", map1);
if (null != resourceGroupList && resourceGroupList.size() > 0) {
Map resourceGroupMap = (Map)resourceGroupList.get(0);
resourceParentId = resourceGroupMap.get("resourceGroupId").toString();
} else {
msg = "该资源组英文名不存在!";
}
} else {
resourceParentId = resourceGroupEname;
}
if (StringUtils.isNotBlank(resourceParentId)) {
map.put("resourceParentId", resourceParentId);
List list = this.dao.query("XS06.query", map);
if (list != null && list.size() > 0) {
new HashMap();
String memberType = "";
Map paramMap = new HashMap();
List resourceList = new ArrayList();
String resourceMemberId = "";
for(int i = 0; i < list.size(); ++i) {
Map infoMap = (Map)list.get(i);
resourceMemberId = infoMap.get("resourceMemberId").toString();
memberType = infoMap.get("memberType").toString();
List resourceGroupInfoList;
Map resourceInfoMap;
if (memberType.equals("RESOURCE")) {
paramMap.put("resourceId", resourceMemberId);
resourceGroupInfoList = this.dao.query("XS04.queryResource", paramMap);
if (resourceGroupInfoList != null && resourceGroupInfoList.size() > 0) {
resourceInfoMap = (Map)resourceGroupInfoList.get(0);
String resourceMemberCname = resourceInfoMap.get("resourceCname") != null ? resourceInfoMap.get("resourceCname").toString() : " ";
infoMap.put("resourceMemberCname", resourceMemberCname);
}
} else if (memberType.equals("RESOURCE_GROUP")) {
paramMap.put("resourceGroupId", resourceMemberId);
resourceGroupInfoList = this.dao.query("XS05.query", paramMap);
if (resourceGroupInfoList != null && resourceGroupInfoList.size() > 0) {
resourceInfoMap = (Map)resourceGroupInfoList.get(0);
infoMap.put("resourceGroupEname", resourceInfoMap.get("resourceGroupEname").toString());
}
}
resourceList.add(infoMap);
}
status = 1;
msg = "该节点下存在资源组或资源信息!";
eiInfo.set("result", resourceList);
} else {
msg = "该节点下没有资源组或资源信息!";
}
}
} else {
msg = "传入的资源组英文名不能为空!";
status = -1;
}
} catch (Exception var17) {
logger.error(var17.getMessage());
status = -1;
msg = var17.getMessage();
}
eiInfo.setMsg(msg);
eiInfo.setStatus(status);
return eiInfo;
}
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.baosight.xservices.xs.service;
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.log.xeye.entity.XEyeEntity;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XEventManager;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.xservices.xs.util.XSServiceUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ServiceXSResourceManage extends ServiceEPBase {
private static final Logger logger = LogManager.getLogger(ServiceXSResourceManage.class);
public ServiceXSResourceManage() {
}
public EiInfo insertResource(EiInfo inInfo) {
boolean ignoreDuplicate = "true".equals(inInfo.get("ignoreDuplicate"));
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder buffer = new StringBuilder();
StringBuilder detail = new StringBuilder();
List insertedResourceList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
String resourceEname = (String)inInfoRowMap.get("resourceEname");
String type = (String)inInfoRowMap.get("type");
String recCreator = (String)inInfoRowMap.get("recCreator");
if (null == resourceEname || null == type || null == recCreator || "".equals(resourceEname) || "".equals(type) || "".equals(recCreator)) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,资源英文名,类型,创建者均不能为空\n");
inInfo.setStatus(-1);
return inInfo;
}
try {
Map paramMap = new HashMap();
paramMap.put("resourceEname", resourceEname);
List existResource = this.dao.query("XSResourceManage.queryResource", paramMap);
if (null != existResource && existResource.size() > 0) {
if (!ignoreDuplicate) {
inInfo.setMsg("新增第" + (i + 1) + "条记录失败,该资源信息已存在\n");
inInfo.setStatus(-1);
return inInfo;
}
} else {
String resourceId = inInfoRowMap.get("resourceId") != null ? inInfoRowMap.get("resourceId").toString() : "";
if (!StringUtils.isNotEmpty(resourceId) || resourceId.equals(" ")) {
resourceId = XSServiceUtils.getUUID();
inInfoRowMap.put("resourceId", resourceId);
}
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
inInfoRowMap.put("isAuth", "0");
String archiveFlag = (String)inInfoRowMap.get("archiveFlag");
if (null == archiveFlag || "".equals(archiveFlag)) {
archiveFlag = "0";
inInfoRowMap.put("archiveFlag", archiveFlag);
}
String sortIndex = (String)inInfoRowMap.get("sortIndex");
if (StringUtils.isBlank(sortIndex)) {
inInfoRowMap.put("sortIndex", 0);
}
String recRevisor = (String)inInfoRowMap.get("recRevisor");
String recReviseTime = (String)inInfoRowMap.get("recReviseTime");
if (!"".equals(recRevisor)) {
inInfoRowMap.put("recRevisor", " ");
}
if (!"".equals(recReviseTime)) {
inInfoRowMap.put("recReviseTime", " ");
}
this.dao.insert("XS04.insert", inInfoRowMap);
Map map = new HashMap();
map.put("resourceId", resourceId);
List insertResourceList = this.dao.query("XS04.query", map);
Map insertResourceMap = (Map)insertResourceList.get(0);
insertedResourceList.add(insertResourceMap);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2000");
xEyeEntity.setLogName("新增资源");
xEyeEntity.setInvokeInfo(recCreator + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "调用接口新增了资源名为 " + resourceEname + " 的资源信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_ri", resourceId);
xEyeEntity.set("x_xs_on", recCreator);
xEyeEntity.set("x_xs_re", resourceEname);
this.log(xEyeEntity);
}
} catch (Exception var24) {
buffer.append("新增第").append(i + 1).append("条记录失败\n").append(var24.getMessage());
inInfo.setStatus(-1);
inInfoRowMap.put("resourceId", "");
detail.append(var24.getMessage());
logger.error(var24.getMessage());
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
return inInfo;
}
}
buffer.append("新增").append(rowCount).append("条记录成功\n");
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (insertedResourceList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", insertedResourceList);
eiInfo.set(EiConstant.eventId, "E_XS_23");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
buffer.append("新增资源失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo updateResource(EiInfo inInfo) {
boolean ignoreDuplicate = "true".equals(inInfo.get("ignoreDuplicate"));
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder builder = new StringBuilder();
StringBuilder detail = new StringBuilder();
List updatedResourceList = new ArrayList();
List insertedResourceList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map inInfoRowMap = eiBlock.getRow(i);
String resourceEname = (String)inInfoRowMap.get("resourceEname");
String recRevisor = (String)inInfoRowMap.get("recRevisor");
String type = (String)inInfoRowMap.get("type");
if (null == resourceEname || null == type || null == recRevisor || "".equals(resourceEname) || "".equals(type) || "".equals(recRevisor)) {
inInfo.setStatus(-1);
inInfo.setMsg("传入的资源英文名,资源类型与修改人均不能为空!");
return inInfo;
}
try {
Map paramMap = new HashMap();
paramMap.put("resourceEname", resourceEname);
List existResource = this.dao.query("XSResourceManage.queryResource", paramMap);
if (null != existResource && existResource.size() > 0) {
if (!ignoreDuplicate) {
builder.append(resourceEname + " 的资源信息已存在\n");
Map existMap = (Map)existResource.get(0);
existMap.put("recReviseTime", DateUtils.curDateTimeStr14());
existMap.put("recRevisor", recRevisor);
this.dao.update("XS04.update", existMap);
Map map = new HashMap();
map.put("resourceId", existMap.get("id"));
List updateResourceList = this.dao.query("XS04.query", map);
Map updateResourceMap = (Map)updateResourceList.get(0);
updatedResourceList.add(updateResourceMap);
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2002");
xEyeEntity.setLogName("修改资源");
xEyeEntity.setInvokeInfo(recRevisor + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "调用接口修改了资源名为 " + inInfoRowMap.get("resourceEname") + " 的资源信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_ri", existMap.get("resourceId"));
xEyeEntity.set("x_xs_re", inInfoRowMap.get("resourceEname"));
xEyeEntity.set("x_xs_on", recRevisor);
this.log(xEyeEntity);
}
} else {
String resourceId = inInfoRowMap.get("resourceId") != null ? inInfoRowMap.get("resourceId").toString() : "";
if (!StringUtils.isNotEmpty(resourceId)) {
resourceId = XSServiceUtils.getUUID();
inInfoRowMap.put("resourceId", resourceId);
}
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
inInfoRowMap.put("isAuth", "0");
String archiveFlag = (String)inInfoRowMap.get("archiveFlag");
if (null == archiveFlag || "".equals(archiveFlag)) {
archiveFlag = "0";
inInfoRowMap.put("archiveFlag", archiveFlag);
}
String sortIndex = (String)inInfoRowMap.get("sortIndex");
if (StringUtils.isBlank(sortIndex)) {
inInfoRowMap.put("sortIndex", 0);
}
inInfoRowMap.put("recRevisor", " ");
inInfoRowMap.put("recCreator", recRevisor);
String recReviseTime = (String)inInfoRowMap.get("recReviseTime");
if (!"".equals(recReviseTime)) {
inInfoRowMap.put("recReviseTime", " ");
}
this.dao.insert("XS04.insert", inInfoRowMap);
Map map = new HashMap();
map.put("resourceId", resourceId);
List insertResourceList = this.dao.query("XS04.query", map);
Map insertResourceMap = (Map)insertResourceList.get(0);
insertedResourceList.add(insertResourceMap);
builder.append("同步").append(resourceEname).append("的资源信息成功");
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2000");
xEyeEntity.setLogName("新增资源");
xEyeEntity.setInvokeInfo(recRevisor + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "调用接口新增了资源名为 " + inInfoRowMap.get("resourceEname") + " 的资源信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_ri", resourceId);
xEyeEntity.set("x_xs_on", recRevisor);
xEyeEntity.set("x_xs_re", resourceEname);
this.log(xEyeEntity);
}
} catch (Exception var24) {
builder.append("同步").append(resourceEname).append(" 的资源信息失败\n");
inInfo.setStatus(-1);
detail.append(var24.getMessage());
logger.error(var24.getMessage());
}
}
inInfo.setMsg(builder.toString());
inInfo.setDetailMsg(detail.toString());
EiInfo eiInfo;
EiInfo outInfo;
if (insertedResourceList.size() > 0) {
eiInfo = new EiInfo();
eiInfo.set("list", insertedResourceList);
eiInfo.set(EiConstant.eventId, "E_XS_23");
outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
builder.append("新增资源失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
if (updatedResourceList.size() > 0) {
eiInfo = new EiInfo();
eiInfo.set("list", updatedResourceList);
eiInfo.set(EiConstant.eventId, "E_XS_25");
outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
builder.append("更新资源失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo deleteResource(EiInfo inInfo) {
XSServiceUtils.apiDataHandleDecorator(inInfo);
if (inInfo.getStatus() == -1) {
return inInfo;
} else {
StringBuilder builder = new StringBuilder();
StringBuilder detail = new StringBuilder();
List deletedResourceList = new ArrayList();
EiBlock eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map inInfoRowMap = eiBlock.getRow(i);
String resourceEname = (String)inInfoRowMap.get("resourceEname");
String recRevisor = (String)inInfoRowMap.get("recRevisor");
if (null == resourceEname || "".equals(resourceEname) || null == recRevisor || "".equals(recRevisor)) {
inInfo.setStatus(-1);
inInfo.setMsg("传入的资源英文名与修改人不能为空!");
return inInfo;
}
Map paramMap = new HashMap();
paramMap.put("resourceEname", resourceEname);
try {
List resourceList = this.dao.query("XSResourceManage.queryResource", paramMap);
if (resourceList.size() < 1) {
builder.append("不存在 ").append(resourceEname).append(" 的资源信息\n");
} else {
Map resourceMap = (Map)resourceList.get(0);
String resourceId = (String)resourceMap.get("resourceId");
if (null != resourceId && !"".equals(resourceId)) {
inInfoRowMap.put("resourceId", resourceId);
EiInfo eiInfo = new EiInfo();
eiInfo.set(EiConstant.serviceId, "S_XS_27");
EiBlock block = new EiBlock("result");
eiInfo.setBlock(block);
Map map = new HashMap();
map.put("resourceMemberId", resourceId);
List resourceAsMembers = this.dao.query("XS06.query", map);
if (null != resourceAsMembers && resourceAsMembers.size() > 0) {
block.setRows(resourceAsMembers);
EiInfo outInfo = XServiceManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
inInfo.setMsg(outInfo.getMsg());
inInfo.setStatus(-1);
return inInfo;
}
}
map.put("subjectId", "");
map.put("objectId", resourceId);
List resourceAsObjects = this.dao.query("XS07.query", map);
if (null != resourceAsObjects && resourceAsObjects.size() > 0) {
block.setRows(resourceAsObjects);
eiInfo.set(EiConstant.serviceId, "S_XS_26");
EiInfo outInfo = XServiceManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
inInfo.setMsg(outInfo.getMsg());
inInfo.setStatus(-1);
return inInfo;
}
}
map.put("authResourceId", resourceId);
List resourceAsDataObjects = this.dao.query("XS10.query", map);
eiInfo.set(EiConstant.serviceId, "S_XS_31");
if (null != resourceAsDataObjects && resourceAsDataObjects.size() > 0) {
block.setRows(resourceAsDataObjects);
EiInfo outInfo = XServiceManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
inInfo.setMsg(outInfo.getMsg());
inInfo.setStatus(-1);
return inInfo;
}
}
this.dao.delete("XS04.delete", inInfoRowMap);
deletedResourceList.add(resourceMap);
builder.append("删除资源:").append(resourceEname).append("的信息成功!\n");
XEyeEntity xEyeEntity = new XEyeEntity();
xEyeEntity.setLogId("2001");
xEyeEntity.setLogName("删除资源");
xEyeEntity.setInvokeInfo(recRevisor + "在" + DateUtils.curDateStr("yyyy-MM-dd HH:mm:ss") + "调用接口删除了资源名为 " + inInfoRowMap.get("resourceEname") + " 的资源信息");
xEyeEntity.setStatus(inInfo.getStatus() + "");
xEyeEntity.set("x_xs_ri", resourceId);
xEyeEntity.set("x_xs_on", recRevisor);
xEyeEntity.set("x_xs_re", inInfoRowMap.get("resourceEname"));
this.log(xEyeEntity);
} else {
builder.append("不存在 ").append(resourceEname).append(" 的资源信息\n");
}
}
} catch (Exception var22) {
builder.append("删除资源:").append(resourceEname).append("的信息失败!\n");
inInfo.setStatus(-1);
detail.append(var22.getMessage());
logger.error(var22.getMessage());
}
}
inInfo.setMsg(builder.toString());
inInfo.setDetailMsg(detail.toString());
if (deletedResourceList.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("list", deletedResourceList);
eiInfo.set(EiConstant.eventId, "E_XS_24");
EiInfo outInfo = XEventManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
builder.append("删除资源失败\n").append(outInfo.getMsg());
inInfo.setStatus(-1);
detail.append(outInfo.getDetailMsg());
}
}
return inInfo;
}
}
public EiInfo getResourceInfo(EiInfo inInfo) {
String msg = "";
int status = -1;
List resourceList = new ArrayList();
Integer size = 0;
try {
String resourceEname = inInfo.getString("resourceEname");
String resourceCname = inInfo.getString("resourceCname");
String type = inInfo.getString("type");
Map resourceMap = new HashMap();
if (StringUtils.isNotEmpty(resourceEname)) {
resourceMap.put("resourceEname", resourceEname);
}
if (StringUtils.isNotEmpty(resourceCname)) {
resourceMap.put("resourceCname", resourceCname);
}
if (StringUtils.isNotEmpty(type)) {
resourceMap.put("type", type);
}
resourceList = this.dao.query("XS04.queryResource", resourceMap);
size = ((List)resourceList).size();
status = 1;
msg = "查询成功!";
} catch (Exception var10) {
msg = var10.getCause().toString();
}
EiInfo outInfo = new EiInfo();
outInfo.setMsg(msg);
outInfo.setStatus(status);
outInfo.set("result", resourceList);
outInfo.set("size", size);
return outInfo;
}
}
......@@ -2443,6 +2443,21 @@ $(function () {
}
});
}
if (loginName !== "admin"){
var info = new EiInfo()
info.set("inqu_status-0-companyCode",loginName)
EiCommunicator.send("HPPZ009", "query", info, {
onSuccess: function (ei) {//返回结果集
if (ei.blocks.result !== undefined){
let results = ei.getBlock("result").getMappedRows()
$("#sidebar img").attr("src",downloadHref(results[0].docIdPc),results[0].projectEnv);
}
}, onFail: function (ei) {
}
}, {async: false});
}
})
function timedisplay() {
......@@ -2518,4 +2533,15 @@ function changepassword(formEname,formCname){
});
}
function downloadHref(docId,projectEnv) {
// S3地址有外网
// return IPLATUI.CONTEXT_PATH + ("run" == projectEnv ? ('/docFileDownload/' + docId)
// : ('/EU/DM/EUDM06.jsp?docId=' + docId));
// S3地址无外网
return IPLATUI.CONTEXT_PATH + ("run" == projectEnv ? ('/file/download/' + docId)
: ('/EU/DM/EUDM06.jsp?docId=' + docId));
}
......@@ -558,7 +558,6 @@
var theme = "${theme}";
</script>
<style>
.icon-badge {
......
......@@ -19,7 +19,7 @@ spring.servlet.multipart.file-size-threshold =0
componentEname=hpjx
projectName=hpjx
moduleName=ep
projectEnv=dev
projectEnv=run
platSchema=iplat
eplatSchema=EPLAT
lowcodedbSchema=lowcodedb
......@@ -34,9 +34,9 @@ enterpriseName=\u6B66\u6C49\u5B9D\u4FE1\u5927\u6570\u636E\u4E8B\u4E1A\u90E8
datasource.type=dbcp
jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://127.0.0.1:3306/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8
jdbc.url=jdbc:mysql://10.24.1.94:3306/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=fnvu~aKs9LTDYUxe
jdbc.url=jdbc:mysql://10.135.13.5:30005/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8
jdbc.username=dbprod32
jdbc.password=t9UrgcELp=
#jdbc.password=123456
jdbc.maxActive=20
jdbc.validationQuery=SELECT 1 FROM ${platSchema}.TEDFA00
......
......@@ -26,12 +26,12 @@ org.quartz.jobStore.isClustered = true
#\uFFFD\u02F4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u077F\uFFFD\u05BE\u00FB\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u077F\uFFFD\uFFFD\uFFFD\u0635\uFFFD\uFFFD\uFFFD\u03E2
org.quartz.jobStore.clusterCheckinInterval = 20000
org.quartz.dataSource.appDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.appDS.URL = jdbc:mysql://10.24.1.94:3306/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8
org.quartz.dataSource.appDS.URL = jdbc:mysql://10.135.13.5:30005/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8
#org.quartz.dataSource.appDS.URL = jdbc:mysql://127.0.0.1:3306/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8
org.quartz.dataSource.appDS.user = root
org.quartz.dataSource.appDS.user = dbprod32
#org.quartz.dataSource.appDS.password =root
org.quartz.dataSource.appDS.password =fnvu~aKs9LTDYUxe
org.quartz.dataSource.appDS.password =t9UrgcELp=
org.quartz.dataSource.appDS.maxConnections = 30
#\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u05B1\uFFFD\uFFFD\uFFFD\uFFFD\u05BE\uFFFD\uFFFD\u00BC\uFFFD\uFFFD\uFFFD
......
......@@ -5,20 +5,56 @@ $(function () {
pageSizes: [10, 20, 50, 70, 100],
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
},
onAdd: function (e) {
e.preventDefault()
$("#type").val("update")
$("#companyName").val();
$("#loginPrefix").val();
$("#validFlag").val();
$("#PCfileDocId").val();
$("#APPfileDocId").val();
$("#remark").val();
$("#id").val();
$("#companyCode").val();
addCompany($("#insertGroup"))
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
//save();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
/**
*
* @param e
* e.sender kendoGridresultGrid
* e.model kendo.data.Model
* e.row
* e.tr tr, jquery
*/
onRowClick: function (e) {
$("#type").val("update");
$("#companyCode").val(e.model.companyCode);
$("#companyName").val(e.model.companyName);
$("#loginPrefix").val(e.model.loginPrefix);
$("#validFlag").val(e.model.validFlag);
$("#PCfileDocId").val(e.model.docIdPc);
$("#APPfileDocId").val(e.model.docIdApp);
$("#remark").val(e.model.remark);
$("#id").val(e.model.id);
addCompany($("#insertGroup"))
/*WindowUtil({
"title": "",
"content": "<div class='kendo-del-message'>" + e.row + "</div>"
})*/
}
}
......@@ -26,10 +62,65 @@ $(function () {
$("#QUERY").on("click", query);
// 保存
$("#BTN_SAVE").on("click", save);
//$("#BTN_SAVE").on("click", save);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
IPLATUI.EFUpload = {
docIdApp: {
showFileList:false,
validation: {
allowedExtensions: [".jpg",".png",".gif"], //
maxFileSize: 900000,
minFileSize: 300
},
// 不支持格式提示信息
localization: {
invalidFileExtension: "文件格式不支持, 上传失败"
},
success: function(e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
$("#APPfileDocId").val(docId);
NotificationUtil("附件上传成功");
//console.log($("#fileDocId").val())
//saveTemp(e);
/*try {
parent.JSColorbox.setValueCallback(e);
} catch (e){
}*/
},
},
docIdPc: {
showFileList:false,
validation: {
allowedExtensions: [".jpg",".png",".gif"], //
maxFileSize: 900000,
minFileSize: 300
},
// 不支持格式提示信息
localization: {
invalidFileExtension: "文件格式不支持, 上传失败"
},
success: function(e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
$("#PCfileDocId").val(docId);
NotificationUtil("附件上传成功");
//console.log($("#fileDocId").val())
//saveTemp(e);
/*try {
parent.JSColorbox.setValueCallback(e);
} catch (e){
}*/
},
}
};
});
/**
......@@ -45,23 +136,83 @@ $(window).load(function () {
*/
let query = function () {
resultGrid.dataSource.page(1);
}
};
let save = function (){
var btnNode = $(this);
btnNode.attr("disabled", true);
var ei = new EiInfo();
let type = $("#type").val();
if (type === "update"){
ei.set("result-0-companyCode",$("#companyCode").val());
}
ei.set("result-0-companyName",$("#companyName").val());
ei.set("result-0-loginPrefix",$("#loginPrefix").val());
ei.set("result-0-validFlag",$("#validFlag").val());
ei.set("result-0-docIdPc",$("#PCfileDocId").val());
ei.set("result-0-docIdApp",$("#APPfileDocId").val());
ei.set("result-0-remark",$("#remark").val());
ei.set("result-0-id",$("#id").val());
// 调用请求 onSuccess 成功回掉函数
EiCommunicator.send("HPPZ009", "save", ei, {
onSuccess: function (ei) {
btnNode.attr("disabled", false);
$("#insertGroup").data("kendoWindow").close();
resultGrid.dataSource.page(1);
// onFail 表示失败回掉函数
}, onFail: function (ei) {
// 发生异常
btnNode.attr("disabled", false);
NotificationUtil(ei);
}
});
};
/**
* 保存
*/
let save = function () {
/*let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
if (rows.length = 1) {
$("#type").val("update")
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
let result = new EiInfo();
let docId = e.response.docId;
let docName = e.response.docName;
let docSize = e.response.docSize;
let docTag = e.response.docTag;
let docUrl = e.response.docUrl;
result.set("result-0-docId",docId);
result.set("result-0-docName",docName);
result.set("result-0-docSize",docSize);
result.set("result-0-docTag",docTag);
result.set("result-0-realPath",docUrl);
EiCommunicator.send("HPXS003", "insert", result, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
resultGrid.dataSource.page(1);
},
onFail: function (ei) {
// 发生异常
NotificationUtil("执行失败,原因[" + ei + "]", "error");
}
}, {
async: false
});
/!*JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ009", "save", true);
}
});
}
});*!/
}*/
/**
* 删除
......@@ -78,3 +229,76 @@ let deleteFunc = function () {
}
});
}
/**
* 点击添加
*
* @param id
*/
function addCompany(id) {
let rows = resultGrid.getCheckedRows();
//打开弹窗
id.data("kendoWindow").open().center();
}
$("#update").click(function () {
var btnNode = $(this);
btnNode.attr("disabled", true);
// 创建 EiInfo
var ei = new EiInfo();
ei.setByNodeObject(document.body);
// 获取 数据
// 调用请求 onSuccess 成功回掉函数
EiCommunicator.send("HPPZ009", "update", ei, {
onSuccess: function (ei) {
btnNode.attr("disabled", false);
resultGrid.dataSource.page(1);
// onFail 表示失败回掉函数
}, onFail: function (ei) {
// 发生异常
btnNode.attr("disabled", false);
NotificationUtil(ei);
}
});
});
/**
* 附件上传回调
*
* @param e
*/
function addCompanyCallback(e) {
resultGrid.dataSource.page(1);
/*let result = new EiInfo();
let docId = e.response.docId;
let docName = e.response.docName;
let docSize = e.response.docSize;
let docTag = e.response.docTag;
let docUrl = e.response.docUrl;
result.set("result-0-docId",docId);
result.set("result-0-docName",docName);
result.set("result-0-docSize",docSize);
result.set("result-0-docTag",docTag);
result.set("result-0-realPath",docUrl);
EiCommunicator.send("HPXS003", "insert", result, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
resultGrid.dataSource.page(1);
},
onFail: function (ei) {
// 发生异常
NotificationUtil("执行失败,原因[" + ei + "]", "error");
}
}, {
async: false
});*/
}
......@@ -4,33 +4,106 @@
<%@ 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:EFInput cname="企业编码:" ename="companyCode" blockId="inqu_status" row="0"/>
<EF:EFInput cname="企业名称:" ename="companyName" blockId="inqu_status" row="0"/>
</div>
</EF:EFRegion>
<EF:EFPage title="企业管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="企业编码:" ename="companyCode" blockId="inqu_status" row="0"/>
<EF:EFInput cname="企业名称:" ename="companyName" blockId="inqu_status" row="0"/>
</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="docIdPc" cname="主键" hidden="true"/>
<EF:EFColumn ename="docIdApp" cname="主键" hidden="true"/>
<EF:EFColumn cname="企业编码" ename="companyCode" enable="false" width="120" align="center"/>
<EF:EFColumn cname="企业名称" ename="companyName" width="140" required="true"/>
<EF:EFColumn cname="登录前缀" ename="loginPrefix" width="100" align="center" readonly="true"/>
<EF:EFComboColumn cname="是否启用" ename="validFlag" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hppz.validFlag"/>
</EF:EFComboColumn>
<EF:EFColumn cname="备注" ename="remark" width="150" editType="textarea"/>
<EF:EFColumn cname="创建人" ename="createdName" enable="false" align="center"/>
<EF:EFColumn cname="创建时间" ename="createdTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
<EF:EFColumn cname="修改人" ename="updatedName" enable="false" align="center"/>
<EF:EFColumn cname="修改时间" ename="updatedTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
<br/>
<span style='color: red;font-size: 13px;'>说明:新增企业时会同步新增企业管理员账户,账号和密码与企业编码相同</span>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn cname="企业编码" ename="companyCode" enable="false" width="120" align="center"/>
<EF:EFColumn cname="企业名称" ename="companyName" width="140" required="true"/>
<EF:EFColumn cname="登录前缀" ename="loginPrefix" width="100" align="center" readonly="true"/>
<EF:EFComboColumn cname="是否启用" ename="validFlag" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hppz.validFlag"/>
</EF:EFComboColumn>
<EF:EFColumn cname="备注" ename="remark" width="150" editType="textarea"/>
<EF:EFColumn cname="创建人" ename="createdName" enable="false" align="center"/>
<EF:EFColumn cname="创建时间" ename="createdTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
<EF:EFColumn cname="修改人" ename="updatedName" enable="false" align="center"/>
<EF:EFColumn cname="修改时间" ename="updatedTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
<br/>
<span style='color: red;font-size: 13px;'>说明:新增企业时会同步新增企业管理员账户,账号和密码与企业编码相同</span>
</EF:EFRegion>
</EF:EFPage>
<EF:EFWindow id="insertGroup" top="100px" left="280px" width="38%" height="70%">
<form>
<div class="form-group row">
<label for="companyName" class="col-sm-2 col-form-label col-form-label-sm">企业名称</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="companyName" required="required">
</div>
</div>
<div class="form-group row">
<label for="loginPrefix" class="col-sm-2 col-form-label col-form-label-sm">登录前缀</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="loginPrefix">
</div>
</div>
<div class="form-group row">
<label for="validFlag" class="col-sm-2 col-form-label col-form-label-sm">是否启动</label>
<div class="col-sm-6">
<select class="form-control" id="validFlag">
<option value="1"></option>
<option value="0"></option>
</select>
</div>
</div>
<div class="form-group row">
<label for="docIdPc" class="col-sm-2 col-form-label">PClog上传</label>
<div class="col-sm-6">
<EF:EFUpload ename="docIdPc" cname="PC上传" docTag="hk_filePc" path="A"/>
<%--<input type="file" class="form-control" id="docIdPc">--%>
</div>
<input type="hidden" id="PCfileDocId" value="">
</div>
<div class="form-group row">
<label for="docIdApp" class="col-sm-2 col-form-label">APPlog上传</label>
<div class="col-sm-6">
<EF:EFUpload ename="docIdApp" cname="APP上传" docTag="hk_fileApp" path="A"/>
<%--<input type="file" class="form-control" accept="image/*" id="docIdApp">--%>
</div>
<input type="hidden" id="APPfileDocId" value="">
</div>
<div class="form-group row">
<label for="remark" class="col-sm-2 col-form-label col-form-label-sm">备注</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="remark">
</div>
</div>
<input type="hidden" id="type" value="insert">
<input type="hidden" id="id" value="">
<input type="hidden" id="companyCode" value="">
<div class="form-group col-md-6 col-sm-6 col-sm-offset-9">
<button type="button" onclick="save()" class="btn btn-info">确认</button>
</div>
</form>
</EF:EFWindow>
<EF:EFWindow id="updateGroup" top="100px" left="280px" width="58%" height="80%">
<EF:EFRegion id="updateResult">
<EF:EFInput ename="companyName" colWidth="6" cname="企业名称"/>
<EF:EFInput ename="loginPrefix" colWidth="6" cname="登录前缀"/>
<EF:EFSelect ename="validFlag" cname="是否启动"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#"
required="true" defaultValue="China"> <%--enable="false":不可下拉--%>
<EF:EFOptions blockId="made_country_block_id" textField="country_ch_name" valueField="country"/>
</EF:EFSelect>
<EF:EFUpload ename="uploadFilePc" cname="PC上传" docTag="hk_filePc" path="A"/>
<EF:EFUpload ename="uploadFileApp" cname="APP上传" docTag="hk_fileApp" path="A"/>
<EF:EFInput ename="remark" colWidth="6" cname="备注"/>
<EF:EFInput ename="PCfileDocId" cname="" hidden="true"/>
<EF:EFInput ename="APPfileDocId" cname="" hidden="true"/>
<EF:EFButton ename="update" cname="确认" layout="1" class="k-button"/>
</EF:EFRegion>
</EF:EFWindow>
</EF:EFPage>
......@@ -383,11 +383,30 @@ $(function () {
});
e.preventDefault();
} else {
openFileWindow.open();
//uploadFileWindow.open();
var parentId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
var parentPrdtName = IPLATUI.EFTree.materialTree.selectTreeNode.prdtName;
var projCode = IPLATUI.EFTree.materialTree.selectTreeNode.projCode;
var projName = IPLATUI.EFTree.materialTree.selectTreeNode.projName;
var lv = IPLATUI.EFTree.materialTree.selectTreeNode.lv;
JSColorbox.open({
href: "HPSC097?methodName=initLoad&inqu_status-0-id=route_001&inqu_status-0-parentId=" + parentId+"&inqu_status-0-projCode="+projCode+"&inqu_status-0-projName="+projName+"&inqu_status-0-parentPrdtName="+parentPrdtName,
title: "<div style='text-align: center;'>导入</div>",
width: "60%",
height: "50%",
callbackName: function () {
// 刷新列表
resultGrid.dataSource.page(1);
// 刷新树
updateTree();
// 关闭弹窗
JSColorbox.close();
}
});
}
}
});
IPLATUI.EFUpload = {
/* IPLATUI.EFUpload = {
fileUpload: {
showFileList: false,
upload: function (e) {
......@@ -399,10 +418,12 @@ $(function () {
var src;
var className;
if ("run" == projectEnv) {
src = e.response.docUrl + e.response.docType
//src = e.response.docUrl + e.response.docType
src = downloadHref(e.response.docId) + e.response.docType
className = e.response.groupId;
} else {
src = e.response.docUrl
//src = downloadHref(e.response.docId) + '.' + e.response.docUrl.split(".")[1];
className = e.response.docTag;
}
var parentId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
......@@ -442,13 +463,14 @@ $(function () {
IPLAT.NotificationUtil('导入失败!', "error");// 失败提示信息
}
}
}
}*/
$("#DOWNLOAD").on("click", function (e) {
var href = ctx + "\\HP\\template\\SC\\HPSC002_物料清单.xls";
window.location.href = href;
});
/**
* 生成模板
*/
......
......@@ -88,7 +88,7 @@
</div>
</div>
<%-- EEDM8010页面加载时,不会加载EEDM6000 (lazyload="true") --%>
<EF:EFWindow id="uploadFile" url="${ctx}/web/HPSC099" lazyload="true" refresh="true">
<%-- <EF:EFWindow id="uploadFile" url="${ctx}/web/HPSC099" lazyload="true" refresh="true">
</EF:EFWindow>
<EF:EFWindow id="openFile">
<EF:EFRegion id="upload" title="文件导入区">
......@@ -96,7 +96,15 @@
<EF:EFUpload ename="fileUpload" cname="导入" docTag="HPSC002" path="upload"/>
</EF:EFRegion>
</EF:EFWindow>
<EF:EFWindow id="openFile">
<EF:EFRegion id="upload" title="文件导入区">
<div id="button"></div>
<EF:EFInput cname="上传文件" blockId="inqu_status" ename="file" row="0" type="file" colWidth="3"/>
</EF:EFRegion>
</EF:EFWindow>--%>
<EF:EFWindow id="uploadFile" url="${ctx}/web/HPSC097" lazyload="true" refresh="true"/>
</EF:EFPage>
<script>
let ctx="${ctx}";
</script>
......
......@@ -365,12 +365,42 @@ function saveDetail(btn) {
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
let reslu = JSUtils.submitGridsData("detail", "HPSC003", "updatePlanDetail", true);
console.log("修改保存:"+reslu);
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail"));
EiCommunicator.send("HPSC003", "updatePlanDetail", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
console.log("回调查询:"+pageOffset)
query(pageOffset)
IPLAT.fillNode(document.getElementById(eiInfo.extAttr[EiConstant.EF_FORM_ENAME]),
ei
);
} catch (e) {
// TODO: handle exception
}
if (IPLAT.isAvailable("detail")) {
window['detailGrid'].setEiInfo(ei);
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
//let reslu = JSUtils.submitGridsData("detail", "HPSC003", "updatePlanDetail", true);
//释放禁用按钮
btn.attr("disabled", false);
query(pageOffset)
}
});
}
......
......@@ -115,13 +115,13 @@ $(function () {
let filePath1 = item.filePath1;
let status = item.status;
let template = '';
if (filePath1) {
/* if (filePath1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + filePath1 + ',\'WL\')" >物料附件清单</a>';
}
}*/
if (filePath1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + filePath1 + ',\'XL\')" >下料附件清单</a>';
+ 'onclick="showUploadFile(' + item.id + ')" >下料附件清单</a>';
}
return template
}
......@@ -238,13 +238,12 @@ $(function () {
}
],
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update'
||e.eiInfo.extAttr.methodName == 'insert'
/* onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
query();
queryDetail();
}
},
},*/
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
......@@ -269,10 +268,34 @@ $(function () {
});
e.preventDefault();
} else {
openFileWindow.open();
//openFileWindow.open();
var productionOrderNo = rows[0].get('prodOrderNo');
var projCode = rows[0].get('projCode');
var projName = rows[0].get('projName');
JSColorbox.open({
href: "HPSC097?methodName=initLoad&inqu_status-0-id=route_002&inqu_status-0-productionOrderNo="+productionOrderNo+"&inqu_status-0-projCode="+projCode+"&inqu_status-0-projName="+projName,
title: "<div style='text-align: center;'>导入</div>",
width: "70%",
height: "70%",
callbackName: function () {
// 刷新列表
//resultGrid.dataSource.page(1);
var info = new EiInfo();
info.set("productionOrderNo",productionOrderNo);
EiCommunicator.send("HPSC006","queryDetail",info,{
onSuccess:function(ei){//返回结果集
detailGrid.setEiInfo(ei);
// 关闭弹窗
JSColorbox.close();
},onFail:function(ei){}
},{async:false});
}
});
}
});
IPLATUI.EFUpload = {
/* IPLATUI.EFUpload = {
fileUpload: {
showFileList: false,
upload: function (e) {
......@@ -323,7 +346,7 @@ $(function () {
IPLAT.NotificationUtil('导入失败!', "error");// 失败提示信息
}
}
}
}*/
$("#DOWNLOAD").on("click", function (e) {
var href = ctx + "\\HP\\template\\SC\\HPSC006_生产下料.xls";
......@@ -363,9 +386,9 @@ function reqDetails(projCode) {
height: "90%"
});
}
function showUploadFile(id,type) {
function showUploadFile(id) {
JSColorbox.open({
href: "HPSC002A?methodName=initLoad&inqu_status-0-bizType="+type+"&inqu_status-0-id=" + id,
href: "HPSC002A?methodName=initLoad&inqu_status-0-bizType=XL&inqu_status-0-id=" + id,
title: "<div style='text-align: center;'>附件清单</div>",
width: "80%",
height: "80%",
......@@ -381,26 +404,8 @@ function checkIn(id) {
callbackName: checkInCallback
});
}
checkInCallback = function () {
var block = detailGrid.getEiBlock();
var result = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请选择数据");
return;
}
if (block != null) {
block.setRows([]);
detailGrid.setEiBlock(block);
}
var info = new EiInfo()
var productionOrderNo = result[0]['prodOrderNo'];
info.set("productionOrderNo",productionOrderNo);
EiCommunicator.send("HPSC006","queryDetail",info,{
onSuccess:function(ei){//返回结果集
detailGrid.setEiInfo(ei);
},onFail:function(ei){}
},{async:false});
checkInCallback = function (e) {
detailGrid.setEiInfo(e);
}
let selectStock = function (id) {
JSColorbox.open({
......@@ -496,7 +501,7 @@ function saveFunc() {
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("detail", "HPSC006", "insert", true,
JSUtils.submitGridsData("detail", "HPSC006", "save", true,
function (e) {
detailGrid.setEiInfo(e);
});
......
......@@ -28,6 +28,7 @@
<EF:EFGrid blockId="result" autoDraw="no" height="30vh" checkMode="row,single" >
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" width="100" enable="false" readonly="false"/>
<EF:EFColumn enable="false" ename="projCode" cname="项目号" />
<EF:EFColumn enable="false" ename="projName" cname="项目名称"/>
<EF:EFColumn enable="false" ename="prodOrderNo" cname="生产订单号"/>
......@@ -35,7 +36,7 @@
<EF:EFColumn enable="false" ename="partName" cname="零件名称"/>
<EF:EFColumn enable="false" ename="planCompletionDate" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"
cname="计划完成日期"/>
<EF:EFColumn ename="operator" cname="操作" width="100" enable="false" readonly="false"/>
</EF:EFGrid>
</EF:EFRegion>
......
$(function () {
var factoryCodes = __eiInfo.getBlock("factory_code_block_id").getMappedRows();
var groupCodes = __eiInfo.getBlock("group_code_block_id").getMappedRows();
var userIds = __eiInfo.getBlock("user_id_block_id").getMappedRows();
var groupCodes = __eiInfo.getBlock("group_code1_block_id").getMappedRows();
var userIds = __eiInfo.getBlock("user_id1_block_id").getMappedRows();
var factoryCode = __eiInfo.getBlock("factory_code1_block_id").getMappedRows();
var groupName = __eiInfo.getBlock("group_name_block_id").getMappedRows();
var userName = __eiInfo.getBlock("user_name_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
......@@ -45,6 +48,9 @@ $(function () {
},{
field: "factoryCode",
title: "工厂",
filter: function (options) {
return factoryCode;
},
template: function (dataItem) {
for (let i = 0; i < factoryCodes.length; i++) {
if (factoryCodes[i]['valueField'] === dataItem['factoryCode']) {
......@@ -61,21 +67,21 @@ $(function () {
if(province) {
// 返回我们过滤后的数据集
/*return options.values[0][province];*/
return _.filter(options.values, function (item) {
return _.filter(groupCodes, function (item) {
return item["param1Field"]==province;
})
} else {
return [];
return groupCodes;
}
},
template: function (dataItem) {
for (let i = 0; i < groupCodes.length; i++) {
if (groupCodes[i]['valueField'] === dataItem['groupCode']) {
return groupCodes[i]['textField'];
for (let i = 0; i < groupName.length; i++) {
if (groupName[i]['valueField'] === dataItem['groupCode']) {
return groupName[i]['textField'];
}
}
return dataItem["groupCode"];
}
},
},{
field: "userId",
title: "员工",
......@@ -84,22 +90,21 @@ $(function () {
var groupCode = options.model['groupCode'];
if(province) {
// 返回我们过滤后的数据集
/*return options.values[0][province];*/
return _.filter(options.values, function (item) {
return _.filter(userIds, function (item) {
return item["param1Field"]==province && item["param2Field"]==groupCode;
})
} else {
return [];
return userIds;
}
},
template: function (dataItem) {
for (let i = 0; i < userIds.length; i++) {
if (userIds[i]['valueField'] === dataItem['userId']) {
return userIds[i]['textField'];
for (let i = 0; i < userName.length; i++) {
if (userName[i]['valueField'] === dataItem['userId']) {
return userName[i]['textField'];
}
}
return dataItem["userId"];
}
},
}],
loadComplete: function(grid) {
// 此 grid 对象
......@@ -108,12 +113,39 @@ $(function () {
// 判断父级节点是否发生变化
if (e.field == "factoryCode") {
loadChange(grid,e,"groupCode");
}
else if (e.field == "groupCode") {
} else if (e.field == "groupCode") {
if (e.items[0].factoryCode.length===0){
loadChange(grid,e,"factoryCode");
}
loadChange(grid,e,"userId");
}else if (e.field == "userId"){
if (e.items[0].groupCode.length===0){
loadChange(grid,e,"groupCode");
}
if (e.items[0].factoryCode.length===0){
loadChange(grid,e,"factoryCode");
}
}
});
},
afterEdit:function (e) {
if (e.field === "groupCode" && e.model["factoryCode"].length === 0){
for (let i = 0; i < groupName.length; i++) {
if (e.model[e.field] === groupName[i]["valueField"]){
e.model["factoryCode"]=groupName[i]["param1Field"]
break;
}
}
}else if (e.field === "userId" && e.model["groupCode"].length === 0){
for (let i = 0; i < userName.length; i++) {
if (e.model[e.field] === userName[i]["valueField"]){
//e.model["factoryCode"]=userName[i]["param1Field"]
e.model["groupCode"]=userName[i]["param2Field"]
break;
}
}
}
},
onAdd: function (e) {
//e.sender.dataSource.options.fields[4].values = factoryCode;
//e.sender.dataSource.options.fields[5].values = groupCode
......@@ -133,9 +165,7 @@ $(function () {
//saveResult(btnNode);
},
onSuccess: function (e) {
console.log("onSuccess:"+e)
if (e.eiInfo.extAttr.methodName == 'update'
|| e.eiInfo.extAttr.methodName == 'insert') {
if (e.eiInfo.extAttr.methodName == 'update' || e.eiInfo.extAttr.methodName == 'insert') {
query();
}
},
......@@ -163,6 +193,7 @@ $(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
inInfo.set("groupType","prodGroup");
EiCommunicator.send("HPSC008", "queryFactoryCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
......@@ -186,6 +217,7 @@ $(function () {
inInfo.set("factoryCode",factoryCode);
var groupCode=$("#inqu_status-0-groupCode").val();
inInfo.set("groupCode",groupCode);
inInfo.set("groupType","prodGroup");
EiCommunicator.send("HPSC008", "queryGroupCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-userId");
......
......@@ -48,38 +48,38 @@
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code1_block_id"
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="生产组" blockName="group_code1_block_id"
<EF:EFComboColumn ename="groupCode" cname="生产组" blockName="group_name_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="userId" cname="员工" blockName="user_id1_block_id"
<EF:EFComboColumn ename="userId" cname="员工" blockName="user_name_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="100" required="true"
maxLength="16" readonly="true" width="160" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupType" cname="生产类型"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="100" required="true"
maxLength="16" readonly="true" width="80" required="true"
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpjx.productionType" />
</EF:EFComboColumn>
<EF:EFColumn ename="prdtName" cname="产品" enable="true" width="160" align="center" required="true"/>
<EF:EFColumn ename="weight" cname="产量(T)" width="150" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" readonly="true"
<EF:EFColumn ename="weight" cname="产量(T)" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,16}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
/>
<EF:EFColumn ename="remark" cname="备注" enable="true" width="200"/>
<EF:EFColumn ename="remark" cname="备注" enable="true" width="200" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
......
$(function () {
var factoryCodes = __eiInfo.getBlock("factory_code_block_id").getMappedRows();
var groupCodes = __eiInfo.getBlock("group_code1_block_id").getMappedRows();
var userIds = __eiInfo.getBlock("user_id1_block_id").getMappedRows();
var factoryCode = __eiInfo.getBlock("factory_code1_block_id").getMappedRows();
var groupName = __eiInfo.getBlock("group_name_block_id").getMappedRows();
var userName = __eiInfo.getBlock("user_name_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFGrid = {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [/*{
field: "operator",
template: function (item) {
console.log(item)
let auditStatus = item.status;
let template = '';
if (item.matId != null) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.matId + ')" >附件清单</a>';
}
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" '
+
'onclick="check(' + item.id + ',1, \'' + item.planInfoNo + '\')" >提交</a>';
}
/!*else {
template += '<a hidden="hidden" style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.id + ',0)" >撤回</a>';
}*!/
return template;
}
},*/{
field: "registerDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
},{
field: "factoryCode",
title: "工厂",
filter: function (options) {
return factoryCode;
},
template: function (dataItem) {
for (let i = 0; i < factoryCodes.length; i++) {
if (factoryCodes[i]['valueField'] === dataItem['factoryCode']) {
return factoryCodes[i]['textField'];
}
}
return dataItem["factoryCode"];
}
},{
field: "groupCode",
title: "下料组",
filter: function (options) {
var province = options.model['factoryCode'];
if(province) {
// 返回我们过滤后的数据集
/*return options.values[0][province];*/
return _.filter(groupCodes, function (item) {
return item["param1Field"]==province;
})
} else {
return groupCodes;
}
},
template: function (dataItem) {
for (let i = 0; i < groupName.length; i++) {
if (groupName[i]['valueField'] === dataItem['groupCode']) {
return groupName[i]['textField'];
}
}
return dataItem["groupCode"];
}
},{
field: "userId",
title: "员工",
filter: function (options) {
var province = options.model['factoryCode'];
var groupCode = options.model['groupCode'];
if(province) {
// 返回我们过滤后的数据集
/*return options.values[0][province];*/
return _.filter(userIds, function (item) {
return item["param1Field"]==province && item["param2Field"]==groupCode;
})
} else {
return userIds;
}
},
template: function (dataItem) {
for (let i = 0; i < userName.length; i++) {
if (userName[i]['valueField'] === dataItem['userId']) {
return userName[i]['textField'];
}
}
return dataItem["userId"];
}
}],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field == "factoryCode") {
loadChange(grid,e,"groupCode");
} else if (e.field == "groupCode") {
if (e.items[0].factoryCode.length===0){
loadChange(grid,e,"factoryCode");
}
loadChange(grid,e,"userId");
}else if (e.field == "userId") {
if (e.items[0].groupCode.length === 0) {
loadChange(grid, e, "groupCode");
}
if (e.items[0].factoryCode.length === 0) {
loadChange(grid, e, "factoryCode");
}
}
});
},
afterEdit:function (e) {
if (e.field === "groupCode" && e.model["factoryCode"].length === 0){
for (let i = 0; i < groupName.length; i++) {
if (e.model[e.field] === groupName[i]["valueField"]){
e.model["factoryCode"]=groupName[i]["param1Field"]
break;
}
}
}else if (e.field === "userId" && e.model["groupCode"].length === 0){
for (let i = 0; i < userName.length; i++) {
if (e.model[e.field] === userName[i]["valueField"]){
//e.model["factoryCode"]=userName[i]["param1Field"]
e.model["groupCode"]=userName[i]["param2Field"]
break;
}
}
}
},
onAdd: function (e) {
//e.sender.dataSource.options.fields[4].values = factoryCode;
//e.sender.dataSource.options.fields[5].values = groupCode
//e.sender.dataSource.options.fields[6].values = userId;
// 动态设置默认邮箱
/*$.each(e.items, function(index, item){
item['prdtName'] = "demo"+ index + "@baosight.com";
});*/
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
//e.preventDefault();
//let btnNode = $(this);
//禁用按钮
//btnNode.attr("disabled", true);
//saveResult(btnNode);
},
onSuccess: function (e) {
console.log("onSuccess:"+e)
if (e.eiInfo.extAttr.methodName == 'update' || e.eiInfo.extAttr.methodName == 'insert') {
query();
}
},
onRowClick: function (e) {
/*var block = detailGrid.getEiBlock();
if (block != null) {
block.setRows([]);
detailGrid.setEiBlock(block);
}
var info = new EiInfo()
var parentId = e.model['planInfoNo'];
info.set("parentId", parentId);
EiCommunicator.send("HPSC004", "queryDetail", info, {
onSuccess: function (ei) {//返回结果集
detailGrid.setEiInfo(ei);
}, onFail: function (ei) {
}
}, {async: false});*/
},
}
}
//工厂类型下拉联动
$('input[name="inqu_status-0-factoryCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
inInfo.set("groupType","cutGroup");
EiCommunicator.send("HPSC009", "queryFactoryCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
let dataEdition=ei.getBlock("group_code_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});
//下料组下拉联动
$('input[name="inqu_status-0-groupCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
var groupCode=$("#inqu_status-0-groupCode").val();
inInfo.set("groupCode",groupCode);
inInfo.set("groupType","cutGroup");
EiCommunicator.send("HPSC009", "queryGroupCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-userId");
let dataEdition=ei.getBlock("user_id_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});
});
function showUploadFile(id) {
JSColorbox.open({
href: "HPSC002B?methodName=initLoad&inqu_status-0-bizType=WL&inqu_status-0-id=" + id,
title: "<div style='text-align: center;'>附件清单</div>",
width: "80%",
height: "80%",
});
}
function check(id, auditStatus,planInfoNo) {
const inEiInfo = new EiInfo();
inEiInfo.set("id", id);
inEiInfo.set("planInfoNo",planInfoNo);
//先判断本身是否填写
EiCommunicator.send('HPSC003', 'getInfo', inEiInfo, {
onSuccess(ei) {
var model=ei.get("model");
if(!(model.planCompletionDate).trim()) {
NotificationUtil("提交失败!原因:基本信息中计划完成日期未填写", "error");
return;
} else {
//提交
//提交前先判断明细信息中的计划开始和计划结束时间是否都已经填写,只有填写了之后才能进行提交
if (auditStatus == 1) {
EiCommunicator.send('HPSC004', 'inspectDetail', inEiInfo, {
onSuccess(ei) {
var list=ei.get("list");
if(list) {
var count = list[0];
if (count > 0) {
NotificationUtil("提交失败!原因:明细信息中有未填写的计划开始时间或计划结束时间", "error");
} else {
EiCommunicator.send('HPSC004','queryDetail',inEiInfo,{
onSuccess(ei){
var rows = ei.blocks.detail.rows;
var res = check_time(model,rows);
if (!res){
NotificationUtil("计划结束时间应该大于计划开始时间!", "error");
}
else {
// 提交通过,生成
EiCommunicator.send('HPSC003', 'submitPlan', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
}
}
})
}
} else {
NotificationUtil("提交失败!未找到明细信息", "error");
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
} else {
// 撤回
}
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
}
let query = function () {
resultGrid.dataSource.page(1);
}
function check_time(model,rows){
for (var i=0;i<rows.length;i++){
if (model.planInfoNo == rows[i][5]) {
var start_time = rows[i][22];
var end_time = rows[i][23];
if (end_time < start_time) {
return false;
}
}
}
return true;
}
/**
* 保存汇总
*/
function saveResult(btn) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let planCompletionDate= item.get("planCompletionDate");
if(isBlank(planCompletionDate)){
message("选中的第"+(index+1)+"行\"计划结束时间\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC003", "update", true);
//释放禁用按钮
btn.attr("disabled", false);
}
});
}
}
/**
* 保存明细
*/
function saveDetail(btn) {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let planCommentDate= item.get("planCommentDate");
let planCompletionDate= item.get("planCompletionDate");
if(isBlank(planCommentDate)){
message("选中的第"+(index+1)+"行\"计划开始时间\",不能为空!");
flag = false;
return false;
}
if(isBlank(planCompletionDate)){
message("选中的第"+(index+1)+"行\"计划结束时间\",不能为空!");
flag = false;
return false;
}
let startT = new Date(planCommentDate).getTime();
let endT = new Date(planCompletionDate).getTime();
if (startT > endT) {
message("选中的第"+(index+1)+"行\"计划开始时间\"不能大于\"计划结束时间\"!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("detail", "HPSC003", "updatePlanDetail", true);
//释放禁用按钮
btn.attr("disabled", false);
}
});
}
}
function loadChange(grid,e,field) {
var cell_label = field,that = grid;
// locked 表示是否为固定列
var locked = that.isCellLocked(cell_label);
// tr 表示 locked 和非 locked 的行,index 表示此行的第几列
var tr,index;
// 获取此 model 元素信息
var item = e.items[0];
var _uid = item.uid;
if (locked) {
tr = $(".k-grid-content-locked tr[data-uid="+ _uid +"]");
index = $("th[data-field='"+cell_label+"']").data("index");
} else {
tr = $(".k-grid-content tr[data-uid="+ _uid +"]");
index = parseInt($("th[data-field='"+cell_label+"']").data("index")) - that.lockedHeader.find("th").length;
}
// 获取子 cell(td)
var td = tr.children("td:eq("+index+")");
// 触发 td.click 事件,
td.trigger("click");
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/3/7
Time: 11:20
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ 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 cname="工厂" ename="factoryCode" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="下料组" ename="groupCode" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="group_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="员工" ename="userId" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_id_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<%--<EF:EFSelect cname="是否删除" ename="deleteFlag" blockId="inqu_status" row="0" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect>--%>
</div>
<div class="row">
<EF:EFDateSpan startCname="登记日期" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" satrtRatio="4:8" endRatio="4:8">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code1_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="下料组" blockName="group_name_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="userId" cname="员工" blockName="user_name_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="100" required="true"
align="center" filter="contains" sort="true">
</EF:EFComboColumn>
<%--<EF:EFComboColumn ename="groupType" cname="生产类型"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="100" required="true"
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpjx.productionType" />
</EF:EFComboColumn>--%>
<EF:EFColumn ename="content" cname="报工内容" enable="true" width="160" editType="textarea" align="center" required="true"/>
<EF:EFColumn ename="remark" cname="备注" enable="true" width="200" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
// 提交
$("#btn_upload").on("click", upload);
$("#cancel").on("click", cancel);
});
let cancel = function(){
parent.JSColorbox.close();
}
/**
* 上传文件
*/
let upload = function () {
let file = $("#inqu_status-0-file").val();
if(isBlank(file)){
message("请选择文件");
return;
}
let id = $("#inqu_status-0-id").val();
let parentId = $("#inqu_status-0-parentId").val();
let projCode = $("#inqu_status-0-projCode").val();
let projName = $("#inqu_status-0-projName").val();
let parentPrdtName = $("#inqu_status-0-parentPrdtName").val();
let productionOrderNo = $("#inqu_status-0-productionOrderNo").val();
let _IPLAT = IPLAT;
_IPLAT.progress($("body"), true);
let formData = new FormData();
if(id === 'route_001'){
formData.append("id", id);
formData.append("startRow", "1"); // 第几行开始读取
formData.append("parentId", parentId);
formData.append("projCode", projCode);
formData.append("projName", projName);
formData.append("parentPrdtName", parentPrdtName);
}
if(id === 'route_002'){
formData.append("id", id);
formData.append("startRow", "1"); // 第几行开始读取
formData.append("productionOrderNo", productionOrderNo);
formData.append("projCode", projCode);
formData.append("projName", projName);
}
formData.append("file", $("#inqu_status-0-file")[0].files[0]);
$.ajax({
url: IPLATUI.CONTEXT_PATH + '/doc/import/api',
type: 'POST',
// dataType: 'json',
data: formData,
async: true,
cache: false,
contentType: false,
processData: false,
success: function (res) {
_IPLAT.progress($("body"), false);
parent.JSColorbox.setValueCallback();
},
error: function (res) {
message(res.msg);
_IPLAT.progress($("body"), false);
}
});
}
<!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="upload" title="文件导入区">
<EF:EFInput ename="inqu_status-0-id" cname="服务Id" type="hidden"/>
<EF:EFInput ename="inqu_status-0-parentId" cname="父Id" type="hidden"/>
<EF:EFInput ename="inqu_status-0-projCode" cname="项目代码" type="hidden"/>
<EF:EFInput ename="inqu_status-0-projName" cname="项目名称" type="hidden"/>
<EF:EFInput ename="inqu_status-0-parentPrdtName" cname="项目部件名称" type="hidden"/>
<EF:EFInput ename="inqu_status-0-productionOrderNo" cname="生产订单号" type="hidden"/>
<EF:EFInput cname="上传文件" blockId="inqu_status" ename="file" row="0" type="file" />
<%--<button id="btn_upload" type="submit">提交</button>--%>
<%-- <EF:EFButton cname="提交" ename="btn_upload"></EF:EFButton>--%>
<div class="row">
<EF:EFButton ename="cancel" cname="取消" type="button" class="btn-align-right"/>
<EF:EFButton ename="btn_upload" cname="确认" type="button" class="btn-align-right"/>
</div>
</EF:EFRegion>
</EF:EFPage>
<script src="${ctx}/HP/SC/HPSC097.js"></script>
$(function () {
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
// 附件上传
$("#UPLOAD_FILE").on("click", uploadFile);
IPLATUI.EFGrid = {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [{
field: "operator",
template: function (item) {
let auditStatus = item.status;
let template = '';
let docId = item.docId;
let docName = item.docName
if (item.docId != null){
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(docId) + '" target="_blank">附件预览</a>';
}
return template;
}
},{
field: "docName",
title: "文件名称",
template: function (item) {
let docId = item.docId;
let docName = item.docName
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(docId) + '" target="_blank">'+docName+'</a>';
return template;
}
}],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field == "factoryCode") {
// cell_label 表示子级节点 ,that 表示此 grid
var cell_label = "groupCode",that = grid;
// locked 表示是否为固定列
var locked = that.isCellLocked(cell_label);
// tr 表示 locked 和非 locked 的行,index 表示此行的第几列
var tr,index;
// 获取此 model 元素信息
var item = e.items[0];
var _uid = item.uid;
if (locked) {
tr = $(".k-grid-content-locked tr[data-uid="+ _uid +"]");
index = $("th[data-field='"+cell_label+"']").data("index");
} else {
tr = $(".k-grid-content tr[data-uid="+ _uid +"]");
index = parseInt($("th[data-field='"+cell_label+"']").data("index")) - that.lockedHeader.find("th").length;
}
// 获取子 cell(td)
var td = tr.children("td:eq("+index+")");
// 触发 td.click 事件,
td.trigger("click");
}
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
//e.preventDefault();
//let btnNode = $(this);
//禁用按钮
//btnNode.attr("disabled", true);
//saveResult(btnNode);
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'update'
|| e.eiInfo.extAttr.methodName == 'insert') {
query();
}
},
onRowClick: function (e) {
/*var block = detailGrid.getEiBlock();
if (block != null) {
block.setRows([]);
detailGrid.setEiBlock(block);
}
var info = new EiInfo()
var parentId = e.model['planInfoNo'];
info.set("parentId", parentId);
EiCommunicator.send("HPSC004", "queryDetail", info, {
onSuccess: function (ei) {//返回结果集
detailGrid.setEiInfo(ei);
}, onFail: function (ei) {
}
}, {async: false});*/
},
}
}
});
let query = function () { resultGrid.dataSource.page(1);}
/**
* 文件上传
*
* @param id
*/
function uploadFile(id) {
JSColorbox.open({
href: "HPXS099?methodName=initLoad",
title: "<div style='text-align: center;'>附件上传</div>",
width: "60%",
height: "50%",
callbackName: uploadFileCallback
});
}
/**
* 附件上传回调
*
* @param e
*/
function uploadFileCallback(e) {
let result = new EiInfo();
let docId = e.response.docId;
let docName = e.response.docName;
let docSize = e.response.docSize;
let docTag = e.response.docTag;
let docUrl = e.response.docUrl;
result.set("result-0-docId",docId);
result.set("result-0-docName",docName);
result.set("result-0-docSize",docSize);
result.set("result-0-docTag",docTag);
result.set("result-0-realPath",docUrl);
EiCommunicator.send("HPXS003", "insert", result, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
resultGrid.dataSource.page(1);
},
onFail: function (ei) {
// 发生异常
NotificationUtil("执行失败,原因[" + ei + "]", "error");
}
}, {
async: false
});
}
/**
* 删除
*/
function deleteFunc() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC002A", "delete", true);
}
})
}
/**
* 日期判断
* @param model 当前数据map
* @param rows 数据集合list
* @returns {boolean} 结束时间是否大于开始时间
*/
function check_time(model,rows){
for (var i=0;i<rows.length;i++){
if (model.planInfoNo == rows[i][5]) {
var start_time = rows[i][22];
var end_time = rows[i][23];
if (end_time < start_time) {
return false;
}
}
}
return true;
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/3/25
Time: 16:17
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ 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="企业log管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="文件名称" blockId="inqu_status" ename="docName" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="docId" primaryKey="true" cname="文件标识ID" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFColumn cname="文件名称" ename="docName" align="center" width="150" readonly="true" required="false" enable="false"/>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="150" readonly="true" required="false" enable="false"/>
<EF:EFColumn cname="创建时间" ename="createdTime" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="150" readonly="true" required="false"
enable="false"/>
<EF:EFColumn cname="修改人" ename="updatedName" align="center" width="150" readonly="true" required="false" enable="false"/>
<EF:EFColumn cname="修改时间" ename="updatedTime" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="150" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFUpload = {
uploadFile: {
success: function(e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
$("#fileDocId").val(docId);
NotificationUtil("附件上传成功");
//console.log($("#fileDocId").val())
//saveTemp(e);
try {
parent.JSColorbox.setValueCallback(e);
} catch (e){
}
},
}
};
});
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/3/25
Time: 18:17
To change this template use File | Settings | File Templates.
--%>
<!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="result">
<EF:EFUpload blockId="result" ename="uploadFile" docTag="hk_fileLog" path="log"/>
</EF:EFRegion>
<EF:EFInput ename="fileDocId" cname="" hidden="true"/>
</EF:EFPage>
\ No newline at end of file
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