Commit 3e01d464 by 宋祥

Merge branch 'fixBug-sx' of http://129.211.46.84:8800/platform/hg-smart into master-dc

parents 6ba30236 d22f5a97
......@@ -79,10 +79,10 @@ public class CommonConstant {
public static class AuthFilter {
// 企业权限
public static final String[] ACCOUNT = {"HGXSUser", "HGPZ009", "HGPZ020", "HGPZ020A", "HGPZ021"};
public static final String[] ACCOUNT = {"HGXSUser", "HGPZ009", "HGPZ020", "HGPZ020A", "HGPZ021",};
// 数据权限
public static final String[] DATA = {"HGXSUser", "HGXSOrg", "HGXSUserGroup", "HGPZ009", "HGPZ020", "HGPZ021",
"HGPZ010.query"};
"HGPZ010.query","HGSB010.queryMax"};
}
/**
......
......@@ -3,9 +3,12 @@ package com.baosight.hggp.core.extapp.decheng.api;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hggp.hg.sb.domain.HGSB010;
import com.baosight.hggp.util.HttpUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.hggp.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;
......@@ -32,10 +35,12 @@ public class SbOpenApi {
*/
public static JSONArray list(EiInfo eiInfo) throws IOException, InstantiationException,
IllegalAccessException {
EiInfo eiInfo1 = new EiInfo();
eiInfo1.set(HGSB010.FIELD_CREATED_TIME,eiInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB010.FIELD_CREATED_TIME));
Map headerMap = new HashMap();
headerMap.put("x-token", SbTokenApi.getToken());
String url = PlatApplicationContext.getProperty("hpjx.url");
String result = HttpUtils.post(url+"/S_HP_SB_01", headerMap, JSON.toJSONString(eiInfo),
String result = HttpUtils.post(url+"/S_HP_SB_01", headerMap, JSON.toJSONString(eiInfo1),
HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【鸿鹏】获取设备日志列表失败");
......
......@@ -286,7 +286,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyCode(hgcw013List.get(0).getCompanyCode());
hgcw012.setCompanyName(hgcw013List.get(0).getCompanyName());
hgcw012.setReviewStatus(0);
hgcw012.setBillState(0);
hgcw012.setBillState(1);
hgcw012.setBillTybe(1);
hgcw012.setContractType(ContractTypeEnum.LZHT.getCode());
//hgcw012.setSigningDate(DateUtils.shortDate());
......@@ -387,7 +387,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyCode(hgcw013List.get(0).getCompanyCode());
hgcw012.setCompanyName(hgcw013List.get(0).getCompanyName());
hgcw012.setReviewStatus(0);
hgcw012.setBillState(0);
hgcw012.setBillState(1);
hgcw012.setBillTybe(1);
hgcw012.setContractType(ContractTypeEnum.CGSH.getCode());
//hgcw012.setSigningDate(DateUtils.shortDate());
......@@ -520,7 +520,7 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyCode(hgcw013List.get(0).getCompanyCode());
hgcw012.setCompanyName(hgcw013List.get(0).getCompanyName());
hgcw012.setReviewStatus(ReviewStatusEnum.UNREVIEWED.getCode());
hgcw012.setBillState(0);
hgcw012.setBillState(1);
hgcw012.setBillTybe(1);
hgcw012.setContractType(ContractTypeEnum.ZLHT.getCode());
//hgcw012.setSigningDate(DateUtils.shortDate());
......
......@@ -582,8 +582,8 @@ public class HGSB004 extends DaoEPBase {
setInspecDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_INSPEC_DATE))), inspecDate));
setInspecCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INSPEC_CODE)), inspecCode));
setPlanCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_CODE)), planCode));
setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_START_DATE)), planStartDate));
setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_END_DATE)), planEndDate));
setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_PLAN_START_DATE))), planStartDate));
setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_PLAN_END_DATE))), planEndDate));
setInspecUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INSPEC_USER_ID)), inspecUserId));
setInspecUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INSPEC_USER_NAME)), inspecUserName));
setCheckStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CHECK_STATUS)), checkStatus));
......
......@@ -581,8 +581,8 @@ public class HGSB005 extends DaoEPBase {
setUpkeepDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_UPKEEP_DATE))), upkeepDate));
setUpkeepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPKEEP_CODE)), upkeepCode));
setPlanCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_CODE)), planCode));
setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_START_DATE)), planStartDate));
setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_END_DATE)), planEndDate));
setPlanStartDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_PLAN_START_DATE))), planStartDate));
setPlanEndDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_PLAN_END_DATE))), planEndDate));
setUpkeepUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPKEEP_USER_ID)), upkeepUserId));
setUpkeepUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPKEEP_USER_NAME)), upkeepUserName));
setCheckStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CHECK_STATUS)), checkStatus));
......
......@@ -27,6 +27,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
......@@ -97,11 +98,15 @@ public class ServiceHGSB001 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "设备台账",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HGSB001> resultRows = MapUtils.toDaoEPBases(inInfo,HGSB001.class);
List<String> groupCodes = resultRows.stream().map(HGSB001::getGroupCode).collect(Collectors.toList());
List<Org> groupOrgs = HGXSTools.XsOrg.list(groupCodes);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGSB001 hgsb001 = new HGSB001();
hgsb001.fromMap(resultRows.get(i));
for (HGSB001 hgsb001 : resultRows) {
Map<String, Org> orgMap = groupOrgs.stream().filter(org -> org.getOrgId().equals(hgsb001.getGroupCode())).collect(Collectors.toMap(Org::getOrgId, org -> org));
if (!orgMap.isEmpty()){
hgsb001.setFactoryCode(orgMap.get(hgsb001.getGroupCode()).getFactoryCode());
}
if (hgsb001.getId() == null || hgsb001.getId() == 0) {
this.add(hgsb001);
} else {
......
......@@ -14,9 +14,11 @@ import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections4.CollectionUtils;
import java.io.IOException;
import java.util.*;
......@@ -176,10 +178,21 @@ public class ServiceHGSB010 extends ServiceEPBase {
public EiInfo add(EiInfo inInfo){
try {
Map paramMap = EiInfoUtils.getFirstRow(inInfo);
Map<String, Object> paramMap = EiInfoUtils.getFirstRow(inInfo);
String accountCode = MapUtils.getString(paramMap, HGPZ009.FIELD_ACCOUNT_CODE);
paramMap.put("notAuth",true);
List<Map> mapList = DaoBase.getInstance().query("HGSB010.queryMax", paramMap);
if (CollectionUtils.isEmpty(mapList)){
String year = DateUtils.shortDate().substring(0, 4);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB010.FIELD_CREATED_TIME, year+"0101000000");
} else {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB010.FIELD_CREATED_TIME, mapList.get(0).get(HGSB010.FIELD_CREATED_TIME));
}
JSONArray jsonArray = SbOpenApi.list(inInfo);
User user = HGXSTools.XsUser.getByLogin(paramMap.get(User.FIELD_LOGIN_NAME).toString());
User user = null;
if (paramMap.containsKey(User.FIELD_LOGIN_NAME)){
user = HGXSTools.XsUser.getByLogin(paramMap.get(User.FIELD_LOGIN_NAME).toString());
}
List<Map> list = jsonArray.stream().map(o -> (Map) o).collect(Collectors.toList());
for (Map map:list) {
HGSB010 hgsb010 = new HGSB010();
......@@ -187,9 +200,10 @@ public class ServiceHGSB010 extends ServiceEPBase {
if (user!=null){
hgsb010.setCompanyCode(user.getAccountCode());
}else {
accountCode = accountCode.length() == 0?"Q24072514":accountCode;
hgsb010.setCompanyCode(accountCode);
}
dao.insert(HGSB010.INSERT, hgsb010);
DaoUtils.insert(HGSB010.INSERT, hgsb010, false);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + jsonArray.size() + "]条数据新增成功!");
......
......@@ -179,6 +179,9 @@
<isNotEmpty prepend=" AND " property="address">
ADDRESS = #address#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceCodes">
DEVICE_CODE IN <iterate close=")" open="(" conjunction="," property="deviceCodes">#deviceCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......
......@@ -164,12 +164,13 @@
SELECT <include refid="column001"/>
FROM ${hggpSchema}.HGSB004A A
LEFT JOIN ${hggpSchema}.HGSB004 B ON A.PARENT_ID = B.ID
WHERE 1=1 <include refid="condition" />
WHERE 1=1 and B.DELETE_FLAG = 0
<include refid="condition" />
UNION ALL
SELECT <include refid="column002"/>
from ${hggpSchema}.HGSB002A A
join ${hggpSchema}.HGSB002 B on A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0'
where 1 = 1
join ${hggpSchema}.HGSB002 B on A.PARENT_ID = B.ID
where 1 = 1 AND B.DELETE_FLAG = 0
and PLAN_END_DATE &lt; DATE_FORMAT(CURDATE(), '%Y%m%d')
AND B.PLAN_STATUS = '1' and B.TASK_STATUS = '0' AND B.PLAN_TYPE = '1'
<include refid="authCondition"/>
......
......@@ -169,14 +169,15 @@
FROM (
SELECT <include refid="column001"/>
FROM ${hggpSchema}.HGSB005A A
JOIN ${hggpSchema}.HGSB005 B ON A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0' WHERE 1=1
JOIN ${hggpSchema}.HGSB005 B ON A.PARENT_ID = B.ID
WHERE 1=1 and B.DELETE_FLAG = 0
<include refid="authCondition"/>
<include refid="condition" />
UNION ALL
SELECT <include refid="column002"/>
from ${hggpSchema}.HGSB002A A
join ${hggpSchema}.HGSB002 B on A.PARENT_ID = B.ID AND B.DELETE_FLAG = '0'
where 1 = 1
join ${hggpSchema}.HGSB002 B on A.PARENT_ID = B.ID
where 1 = 1 AND B.DELETE_FLAG = 0
AND PLAN_END_DATE &lt; DATE_FORMAT(CURDATE(), '%Y%m%d')
AND B.PLAN_STATUS = '1' AND TASK_STATUS = '0' AND B.PLAN_TYPE = '2'
<include refid="authCondition"/>
......
......@@ -482,4 +482,10 @@
) a
order by a.DEVICE_CODE
</select>
<select id="queryMax" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
MAX(CREATED_TIME) as "createdTime"
FROM ${hggpSchema}.HGSB010 WHERE 1=1 AND DELETE_FLAG = 0
</select>
</sqlMap>
\ No newline at end of file
......@@ -317,10 +317,10 @@ public class ServiceHGSC007 extends ServiceEPBase {
if (queryRow.containsKey("depositDate")) {
queryRow.put("depositDate", DateUtils.formatShort(queryRow.get("depositDate")));
}
queryRow.put("processNames",Arrays.asList("组立","油漆","埋弧盖面","抛丸除锈","拼装","焊接"));
queryRow.put("processNames",Arrays.asList("切割下料","烧焊","车加工","铣加工","动平衡","装配"));
// List<Map> result = DaoBase.getInstance().query("HGSC007.queryBySunWt", queryRow);
List<HashMap<String, Object>> result = (List<HashMap<String, Object>>)DaoBase.getInstance().query("HGSC007.queryBySunWt", queryRow);
List<String> processNamesList = Arrays.asList("组立", "油漆", "埋弧盖面", "抛丸除锈", "拼装", "焊接");
List<String> processNamesList = Arrays.asList("切割下料","烧焊","车加工","铣加工","动平衡","装配"); //"组立", "油漆", "埋弧盖面", "抛丸除锈", "拼装", "焊接"
List<Object> resultList = new ArrayList<>();
for (String processNames:processNamesList){
for(Map<String, Object> item :result){
......
......@@ -1138,7 +1138,7 @@
a.finish_date as completeDate,
ROUND(ifnull(sum(a.total_weight),0)/1000, 4) as totalWeight,
ROUND(ifnull(sum(a.finish_weight),0)/1000, 4) as finishWeight,
ROUND(ifnull(sum(a.finish_weight),0) / ifnull(sum(a.total_weight),0) / 1000, 4)*100 as schedule,
ifnull(sum(a.finish_weight),0) / ifnull(sum(a.total_weight),0) * 100 as schedule,
a.updated_time as updatedTime
from (
select
......
......@@ -677,7 +677,7 @@ public class HGSCTools {
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal quantitySum = list.stream().map(HGSC005A::getQuantity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
return finishQuantitySum.divide(quantitySum, 3, RoundingMode.HALF_UP);
return finishQuantitySum.divide(quantitySum, 3, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
})));
hgsc005List.forEach(hgsc005 -> {
hgsc005.setFinishRate(MapUtils.isNotEmpty(finishRateMap)
......
package com.baosight.hggp.hg.wd.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
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;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
......@@ -46,6 +47,7 @@ public class HGWD001 extends DaoEPBase {
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_RELEASE_DATE = "releaseDate"; /* 发布时间*/
public static final String FIELD_FILE_PATH = "filePath"; /* 文件路径*/
public static final String FIELD_FILE_ID_PATH = "filePath"; /* 文件ID路径*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -104,6 +106,7 @@ public class HGWD001 extends DaoEPBase {
private String remark = " "; /* 备注*/
private String releaseDate = " "; /* 发布时间*/
private String filePath = " ";
private String fileIdPath = " ";
/**
* initialize the metadata.
......@@ -211,6 +214,10 @@ public class HGWD001 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_FILE_PATH);
eiColumn.setDescName("文件路径");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FILE_ID_PATH);
eiColumn.setDescName("文件ID路径");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -603,6 +610,15 @@ public class HGWD001 extends DaoEPBase {
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getFileIdPath() {
return fileIdPath;
}
public void setFileIdPath(String fileIdPath) {
this.fileIdPath = fileIdPath;
}
/**
* get the value from Map.
*
......@@ -636,6 +652,7 @@ public class HGWD001 extends DaoEPBase {
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setReleaseDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RELEASE_DATE)), releaseDate));
setFilePath(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_PATH)), filePath));
setFileIdPath(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID_PATH)), fileIdPath));
}
/**
......@@ -670,6 +687,7 @@ public class HGWD001 extends DaoEPBase {
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_RELEASE_DATE, StringUtils.toString(releaseDate, eiMetadata.getMeta(FIELD_RELEASE_DATE)));
map.put(FIELD_FILE_PATH, StringUtils.toString(filePath, eiMetadata.getMeta(FIELD_FILE_PATH)));
map.put(FIELD_FILE_ID_PATH, StringUtils.toString(fileIdPath, eiMetadata.getMeta(FIELD_FILE_ID_PATH)));
return map;
}
......
......@@ -516,18 +516,19 @@ public class ServiceHGWD001 extends ServiceEPBase {
queryMap.get(HGWD001.FIELD_PARENT_ID));
}*/
// 要复制目录集合
if (Objects.nonNull(detail2Rows)){
String parentId = detail2Rows.get(0).getFileId().length()>0?detail2Rows.get(0).getFileId():detail2Rows.get(0).getProjCode();
if (Objects.nonNull(detail2Rows)) {
String parentId = detail2Rows.get(0).getFileId().length() > 0 ? detail2Rows.get(0).getFileId()
: detail2Rows.get(0).getProjCode();
if (!StringUtils.isNull(result2Rows)) {
result2Rows.forEach(hgwd001 -> {
hgwd001.setParentId(parentId);
hgwd001.setFilePath(detail2Rows.get(0).getFilePath()+"/"+hgwd001.getFileName());
hgwd001.setFilePath(detail2Rows.get(0).getFilePath() + "/" + hgwd001.getFileName());
hgwd001.setFileIdPath(detail2Rows.get(0).getFileIdPath() + "/" + hgwd001.getFileId());
});
// 查询添加子节点
addNode(result2Rows);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作复制文件成功!");
} catch (Exception e) {
......@@ -546,7 +547,8 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd001s.forEach(o -> {
if (o.getParentId().equals(hgwd001.getFileId())) {
o.setParentId(fileId);
o.setFilePath(hgwd001.getFilePath()+"/"+o.getFileName());
o.setFilePath(hgwd001.getFilePath() + "/" + o.getFileName());
o.setFileIdPath(hgwd001.getFileIdPath() + "/" + o.getFileId());
}
});
}
......
......@@ -388,6 +388,27 @@ public class ServiceHGWD001D extends TreeService {
}
/**
* 搜索树
*
* @param inInfo
* @return
*/
public EiInfo searchTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 查询有权限的目录和备件目录,管理员不做限制
if (!HgWdUtils.HgWd009.isManager()) {
queryMap.put("userId", UserSessionUtils.getLoginName());
}
List<HGWD001> nodeWds = dao.query(HGWD001.QUERY, queryMap);
// 查询父级结构
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "搜索节点失败");
}
return inInfo;
}
/**
* 设置叶子节点是否可以展开
*
* @param nodes
......
......@@ -13,10 +13,12 @@ import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD005;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -24,7 +26,11 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -84,11 +90,13 @@ public class ServiceHGWD001E extends ServiceEPBase {
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
// 设置项目信息
this.setProjectInfo(hgwd001);
if (wd001 == null){
String filePath = setFilePath(hgsc001,edcm01Map.get("app.sc.projectSource"));
hgwd001.setFilePath(filePath+"/"+hgwd001.getFileName());
}else {
hgwd001.setFilePath(wd001.getFilePath()+"/"+hgwd001.getFileName());
if (wd001 == null) {
String filePath = setFilePath(hgsc001, edcm01Map.get("app.sc.projectSource"));
hgwd001.setFilePath(filePath + "/" + hgwd001.getFileName());
hgwd001.setFileIdPath(setFileIdPath(hgsc001));
} else {
hgwd001.setFilePath(wd001.getFilePath() + "/" + hgwd001.getFileName());
hgwd001.setFileIdPath(wd001.getFilePath() + "/" + hgwd001.getFileId());
}
if (hgwd001.getId() == null || hgwd001.getId() == 0) {
this.add(hgwd001);
......@@ -182,4 +190,8 @@ public class ServiceHGWD001E extends ServiceEPBase {
String filePath = edcm01List.stream().filter(map -> map.get("itemCode").equals(hgsc001.getProjectSource())).findAny().get().get("itemCname").toString();
return filePath+"/"+hgsc001.getProjName();
}
private String setFileIdPath(HGSC001 hgsc001) {
return hgsc001.getProjectSource() + "/" + hgsc001.getProjCode();
}
}
......@@ -78,19 +78,22 @@ public class ServiceHGWD001F extends ServiceEPBase {
HGWD001 hgwd001 = new HGWD001();
hgwd001.fromMap(resultRow);
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
if (wd001 == null){
if (wd001 == null) {
AssertUtils.isEmpty(Collections.singleton(hgwd001), "项目编号不能为空");
String filePath = setFilePath(hgsc001,edcm01Map.get("app.sc.projectSource"));
hgwd001.setFilePath(filePath+"/"+hgwd001.getFileName());
}else {
hgwd001.setFilePath(wd001.getFilePath()+"/"+hgwd001.getFileName());
String filePath = setFilePath(hgsc001, edcm01Map.get("app.sc.projectSource"));
hgwd001.setFilePath(filePath + "/" + hgwd001.getFileName());
hgwd001.setFileIdPath(setFileIdPath(hgsc001));
} else {
hgwd001.setFilePath(wd001.getFilePath() + "/" + hgwd001.getFileName());
hgwd001.setFileIdPath(wd001.getFilePath() + "/" + hgwd001.getFileId());
}
if (hgwd001.getId() == null || hgwd001.getId() == 0) {
this.add(hgwd001);
} else {
String wd001FilePath = wd001 == null? setFilePath(hgsc001,edcm01Map.get("app.sc.projectSource")):wd001.getFilePath();
this.modify(hgwd001,wd001FilePath,edcm01Map);
String wd001FilePath = wd001 == null ? setFilePath(hgsc001, edcm01Map.get("app.sc.projectSource"))
: wd001.getFilePath();
String wd001FileIdPath = wd001 == null ? setFileIdPath(hgsc001) : wd001.getFileIdPath();
this.modify(hgwd001, wd001FilePath, wd001FileIdPath, edcm01Map);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -124,9 +127,10 @@ public class ServiceHGWD001F extends ServiceEPBase {
* 修改操作
* @param hgwd001 文件信息
* @param wd001FilePath 文件路径
* @param wd001FileIdPath 文件ID路径
* @param edcm01Map 小代碼
*/
public void modify(HGWD001 hgwd001,String wd001FilePath,Map<String, List<Map<String, Object>>> edcm01Map) {
public void modify(HGWD001 hgwd001,String wd001FilePath, String wd001FileIdPath, Map<String, List<Map<String, Object>>> edcm01Map) {
HGWD001 wd001out =HGWDTools.HgWd001.get(hgwd001.getId());
HGWD001A hgwd001a = new HGWD001A();
hgwd001a.setCompanyCode(hgwd001.getCompanyCode());
......@@ -150,26 +154,35 @@ public class ServiceHGWD001F extends ServiceEPBase {
}
DaoUtils.update(HGWD001.UPDATE, hgwd001);
updateFilePath(hgwd001,wd001out,wd001FilePath);
updateFilePath(hgwd001,wd001out,wd001FilePath, wd001FileIdPath);
}
public void updateFilePath(HGWD001 hgwd001,HGWD001 wd001out,String wd001FilePath) {
public void updateFilePath(HGWD001 hgwd001,HGWD001 wd001out,String wd001FilePath, String wd001FileIdPath) {
List<Map> childList = HGWDTools.HgWd001.queryFileChild(hgwd001.getFileId());
List<String> childFileIdList = Optional.ofNullable(childList).orElse(new ArrayList<>()).stream()
.filter(map -> !hgwd001.getFileId().equals(map.get(HGWD001.FIELD_FILE_ID)))
.map(map -> map.get(HGWD001.FIELD_FILE_ID).toString()).collect(Collectors.toList());
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD",childFileIdList);
Map<String, List<HGWD099>> listMap = Optional.ofNullable(hgwd099List).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(HGWD099::getBizId,Collectors.toList()));
int end =wd001out ==null ? 0: wd001out.getFilePath().length()+1;
List<HGWD099> hgwd099List = HGWDTools.HgWd099.queryByBiz("WD", childFileIdList);
Map<String, List<HGWD099>> listMap = Optional.ofNullable(hgwd099List).orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGWD099::getBizId, Collectors.toList()));
int end = wd001out == null ? 0 : wd001out.getFilePath().length() + 1;
int endFileIdPathIndex = wd001out == null ? 0 : wd001out.getFileIdPath().length() + 1;
if (childList != null && childList.size() > 0) {
for (Map child : childList) {
HGWD001 childOut = new HGWD001();
childOut.fromMap(child);
if (!hgwd001.getFileId().equals(childOut.getFileId())){
if (!hgwd001.getFileId().equals(childOut.getFileId())) {
String filePathEnd = child.get(HGWD001.FIELD_FILE_PATH).toString().substring(end);
String fileIdPathEnd = child.get(HGWD001.FIELD_FILE_ID_PATH).toString()
.substring(endFileIdPathIndex);
StringBuffer filePath = new StringBuffer();
filePath.append(wd001FilePath).append("/").append(hgwd001.getFileName()).append("/").append(filePathEnd);
filePath.append(wd001FilePath).append("/").append(hgwd001.getFileName()).append("/")
.append(filePathEnd);
childOut.setFilePath(filePath.toString());
StringBuffer fileIdPath = new StringBuffer();
fileIdPath.append(wd001FileIdPath).append("/").append(hgwd001.getFileId()).append("/")
.append(fileIdPathEnd);
childOut.setFileIdPath(fileIdPath.toString());
DaoUtils.update(HgWdSqlConstant.HgWd001.UPDATE_FILE_PATH, childOut);
if (listMap.containsKey(childOut.getFileId())){
for (HGWD099 hgwd099: listMap.get(childOut.getFileId())) {
......@@ -186,4 +199,8 @@ public class ServiceHGWD001F extends ServiceEPBase {
String filePath = edcm01List.stream().filter(map -> map.get("itemCode").equals(hgsc001.getProjectSource())).findAny().get().get("itemCname").toString();
return filePath+"/"+hgsc001.getProjName();
}
private String setFileIdPath(HGSC001 hgsc001) {
return hgsc001.getProjectSource() + "/" + hgsc001.getProjCode();
}
}
......@@ -3,11 +3,11 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
......@@ -16,10 +16,8 @@ import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
......@@ -58,26 +56,23 @@ public class ServiceHGWD002 extends ServiceBase {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
// 未选择文件目录时,返回空
String projCode = MapUtils.getString(queryRow, HGWD001.FIELD_PROJ_CODE);
String fileId = MapUtils.getString(queryRow, HGWD001.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
return inInfo;
}
String projCode = MapUtils.getString(queryRow, HGWD001.FIELD_PROJ_CODE);
// 判断是否备件制造图
boolean isSpare = HgWdUtils.HgWd001.isSpare(fileId, projCode);
boolean isManager = HgWdUtils.HgWd009.isManager();
// 仅查询已发布的文件
queryRow.put(HGWD001.FIELD_STATUS, HgWdConstant.FileStatus.S_1);
// 管理员、无权限的目录不做权限验证
if (!isSpare && !isManager) {
queryRow.put(User.FIELD_USER_ID, UserSessionUtils.getUserId());
// 顶级分类目录
if (ProjectSourceEnum.getByCode(fileId) != null) {
queryRow.put("projectSource", fileId);
} else {
queryRow.put("parentId", fileId);
}
// 查询有权限的子集目录
List<String> childrenIds = HgWdUtils.HgWd001.queryChildrenId(fileId, isManager, isSpare);
if (CollectionUtils.isEmpty(childrenIds)) {
return inInfo;
// 管理员或者备件制造图
if (HgWdUtils.HgWd001.isAuth(fileId, projCode)) {
queryRow.put("userId", UserSessionUtils.getLoginName());
}
queryRow.put("fileIds", childrenIds);
inInfo = super.query(inInfo, HGWD002.QUERY, new HGWD002());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
......@@ -5,6 +5,7 @@ import com.baosight.hggp.common.ChangeTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
......@@ -58,8 +59,8 @@ public class ServiceHGWD099 extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "查询",operDesc = "文档库-附件清单A-查询")
@Override
@OperationLogAnnotation(operModul = "附件清单",operType = "查询",operDesc = "文档库-附件清单A-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -68,15 +69,15 @@ public class ServiceHGWD099 extends ServiceEPBase {
if (StringUtils.isBlank(parentId)) {
return inInfo;
}
// 查询子节点
List<HGWD001> children = HgWdUtils.HgWd001.queryChildren(parentId, projCode);
if (CollectionUtils.isEmpty(children)) {
return inInfo;
// 顶级分类目录
ProjectSourceEnum projectSourceEnum = ProjectSourceEnum.getByCode(parentId);
if (projectSourceEnum != null) {
queryRow.put("projectSource", parentId);
}
// 管理员或者备件制造图
if (HgWdUtils.HgWd001.isAuth(parentId, projCode)) {
queryRow.put("userId", UserSessionUtils.getLoginName());
}
// 需要包含自身
queryRow.put("bizIds", children.stream().map(HGWD001::getFileId).collect(Collectors.toList()));
queryRow.remove(HGWD099.FIELD_BIZ_ID);
inInfo.getBlock(EiConstant.queryBlock).getRow(ACConstants.ROW_CODE_0).remove(HGWD001.FIELD_PARENT_ID);
inInfo = super.query(inInfo, HGWD099.QUERY, new HGWD099());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
......@@ -27,7 +27,8 @@
STATUS as "status", <!-- 状态 -->
REMARK as "remark", <!-- 备注 -->
RELEASE_DATE as "releaseDate", <!-- 发布时间 -->
FILE_PATH as "filePath" <!-- 文件路径 -->
FILE_PATH as "filePath", <!-- 文件路径 -->
FILE_ID_PATH as "fileIdPath" <!-- 文件路径 -->
</sql>
<sql id="condition">
......@@ -206,12 +207,13 @@
STATUS, <!-- 状态 -->
REMARK, <!-- 备注 -->
RELEASE_DATE,
FILE_PATH
FILE_PATH,
FILE_ID_PATH
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #projCode#, #projName#, #projectSource#,
#leafLevel#, #parentId#, #fileId#, #fileType#, #fileName#,
#docVersion#, #status#, #remark#, #releaseDate#, #filePath#
#docVersion#, #status#, #remark#, #releaseDate#, #filePath#, #fileIdPath#
)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGWD001
......@@ -234,6 +236,7 @@
REMARK = #remark#, <!-- 备注 -->
RELEASE_DATE = #releaseDate#, <!--发布时间-->
FILE_PATH = #filePath#,
FILE_ID_PATH = #fileIdPath#,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
......@@ -261,6 +264,7 @@
UPDATE ${hggpSchema}.HGWD001
SET
FILE_PATH = #filePath#,
FILE_ID_PATH = #fileIdPath#,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
......@@ -277,7 +281,8 @@
FILE_ID as "fileId", <!-- 文件ID -->
FILE_TYPE as "fileType", <!-- 文件类型 -->
FILE_NAME as "fileName", <!-- 文件名称 -->
FILE_PATH as "filePath"
FILE_PATH as "filePath",
FILE_ID_PATH as "fileIdPath"
FROM ${hggpSchema}.HGWD001
WHERE 1=1
<isNotEmpty prepend=" AND " property="accountCode">
......@@ -317,7 +322,8 @@
PARENT_ID as "parentId",
DELETE_FLAG as "isDeleted",
LEAF_LEVEL as "leafLevel",
FILE_PATH as "filePath"
FILE_PATH as "filePath",
FILE_ID_PATH as "fileIdPath"
FROM ${hggpSchema}.HGWD001
WHERE 1=1
<isEmpty prepend=" AND " property="deletedQuery">
......@@ -336,7 +342,7 @@
order by CREATED_TIME asc
</select>
<!-- 查询节点,包含自身 -->
<!-- 查询节点,包含自身 -->
<select id="queryChildren" resultClass="com.baosight.hggp.hg.wd.domain.HGWD001">
SELECT
<include refid="column"/>
......@@ -348,6 +354,7 @@
)
</isNotEmpty>
</select>
<!--档库所有子节点树查询-->
<select id="queryFileChild" resultClass="java.util.HashMap">
SELECT
......@@ -355,7 +362,8 @@
T3.FILE_ID AS "fileId",
T3.FILE_TYPE AS "fileType",
T3.PARENT_ID as "parentId",
T3.FILE_PATH as "filePath"
T3.FILE_PATH as "filePath",
T3.FILE_ID_PATH as "fileIdPath"
FROM (
SELECT
@CODES AS CODES,
......@@ -400,7 +408,8 @@
FILE_ID as "fileId", <!-- 文件ID -->
FILE_TYPE as "fileType", <!-- 文件类型 -->
FILE_NAME as "fileName", <!-- 文件名称 -->
FILE_PATH as "filePath"
FILE_PATH as "filePath",
FILE_ID_PATH as "fileIdPath"
from (
SELECT
PROJ_CODE, <!-- 项目编码 -->
......@@ -410,7 +419,8 @@
'' as "FILE_ID", <!-- 文件ID -->
'' as "FILE_TYPE", <!-- 文件类型 -->
'' as "FILE_NAME", <!-- 文件名称 -->
project_source as "FILE_PATH"
PROJECT_SOURCE as "FILE_PATH",
PROJ_CODE as "fileIdPath"
FROM ${hggpSchema}.HGSC001 T WHERE 1=1
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
......@@ -438,7 +448,8 @@
FILE_ID, <!-- 文件ID -->
FILE_TYPE, <!-- 文件类型 -->
FILE_NAME, <!-- 文件名称 -->
FILE_PATH
FILE_PATH,
FILE_ID_PATH
FROM ${hggpSchema}.HGWD001 T WHERE 1=1
<include refid="condition"/>
) a
......
......@@ -41,9 +41,6 @@
<isNotEmpty prepend=" AND " property="projName">
A.PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileIds">
A.FILE_ID IN <iterate open="(" conjunction="," close=")" property="fileIds">#fileIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="fileType">
A.FILE_TYPE = #fileType#
</isNotEmpty>
......@@ -56,9 +53,6 @@
<isNotEmpty prepend=" AND " property="docName">
B.DOC_NAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
B.BIZ_ID IN (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 WHERE USER_ID = #userId#)
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
B.CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
......@@ -73,6 +67,24 @@
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<!-- projectSource和parentId只能同时存在一个, APPROVAL_STATUS=2:已审核 -->
<isNotEmpty prepend=" AND " property="projectSource">
EXISTS (SELECT PROJ_CODE FROM ${hggpSchema}.HGSC001 M WHERE M.PROJ_CODE = A.PROJ_CODE
AND APPROVAL_STATUS = 2 AND A.PROJECT_SOURCE = #projectSource#
)
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
FIND_IN_SET(A.FILE_ID, (SELECT ${hggpSchema}.queryWdTreeInfo(#parentId#)))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE M.FILE_ID = A.FILE_ID
AND M.DELETE_FLAG = 0 AND M.USER_ID = #userId#
)
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......@@ -90,7 +102,7 @@
FROM ${hggpSchema}.HGWD001 A
INNER JOIN ${hggpSchema}.HGWD099 B ON A.FILE_ID = B.BIZ_ID
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
......@@ -99,7 +111,7 @@
FROM ${hggpSchema}.HGWD001 A
INNER JOIN ${hggpSchema}.HGWD099 B ON A.FILE_ID = B.BIZ_ID
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
</sqlMap>
<?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">
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGWD099">
<sql id="column">
......@@ -38,9 +38,6 @@
<isNotEmpty prepend=" AND " property="bizId">
BIZ_ID = #bizId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bizIds">
BIZ_ID IN <iterate close=")" open="(" conjunction="," property="bizIds">#bizIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
......@@ -50,15 +47,9 @@
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docVersion">
DOC_VERSION = #docVersion#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="releaseDate">
RELEASE_DATE = #releaseDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
BIZ_ID = #parentId#
</isNotEmpty>
<isEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = 0
</isEmpty>
......@@ -96,6 +87,24 @@
<isNotEmpty prepend=" AND " property="bizIds">
BIZ_ID in <iterate close=")" open="(" conjunction="," property="bizIds">#bizIds[]#</iterate>
</isNotEmpty>
<!-- projectSource和parentId只能同时存在一个, APPROVAL_STATUS=2:已审核 -->
<isNotEmpty prepend=" AND " property="projectSource">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD001 M, ${hggpSchema}.HGSC001 N
WHERE M.FILE_ID = T.BIZ_ID AND M.PROJ_CODE = N.PROJ_CODE
AND M.DELETE_FLAG = 0 AND N.APPROVAL_STATUS = 2
AND N.PROJECT_SOURCE = #projectSource#
)
</isNotEmpty>
<isEmpty property="projectSource">
<isNotEmpty prepend=" AND " property="parentId">
FIND_IN_SET(BIZ_ID, (SELECT ${hggpSchema}.queryWdTreeInfo(#parentId#)))
</isNotEmpty>
</isEmpty>
<isNotEmpty prepend=" AND " property="userId">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE M.FILE_ID = T.BIZ_ID
AND M.DELETE_FLAG = 0 AND M.USER_ID = #userId#
)
</isNotEmpty>
</sql>
<sql id="orderBy">
......@@ -112,7 +121,7 @@
<select id="query" resultClass="com.baosight.hggp.hg.wd.domain.HGWD099">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGWD099
FROM ${hggpSchema}.HGWD099 T
WHERE 1=1
<include refid="customCondition"/>
<include refid="orderBy"/>
......@@ -120,7 +129,7 @@
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${hggpSchema}.HGWD099
FROM ${hggpSchema}.HGWD099 T
WHERE 1=1
<include refid="customCondition"/>
</select>
......
......@@ -8,7 +8,6 @@ import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
......@@ -30,6 +29,21 @@ public class HgWdUtils {
public static class HgWd001 {
/**
* 管理员和备件制造图不需要权限控制
*
* @param treeId 树节点ID
* @param projCode 项目编码
* @return true:需要权限
*/
public static boolean isAuth(String treeId, String projCode) {
boolean isManager = HgWdUtils.HgWd009.isManager();
if (isManager) {
return false;
}
return !HgWdUtils.HgWd001.isSpare(treeId, projCode);
}
/**
* 是否备件制造图
*
* @param treeId
......
package com.baosight.hggp.hg.yx.domain;
import com.baosight.hggp.util.DateUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
......@@ -481,7 +482,7 @@ public class HGYX011 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setSurveyDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SURVEY_DATE)), surveyDate));
setSurveyDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_SURVEY_DATE))), surveyDate));
setDistrict(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DISTRICT)), district));
setPolicyEnv(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_POLICY_ENV)), policyEnv));
setEconomyEnv(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ECONOMY_ENV)), economyEnv));
......
package com.baosight.hggp.hg.yx.domain;
import com.baosight.hggp.util.DateUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
......@@ -462,7 +463,7 @@ public class HGYX012 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setSurveyDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SURVEY_DATE)), surveyDate));
setSurveyDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_SURVEY_DATE))), surveyDate));
setDistrict(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DISTRICT)), district));
setClient(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CLIENT)), client));
setBuyMotive(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BUY_MOTIVE)), buyMotive));
......
package com.baosight.hggp.hg.yx.domain;
import com.baosight.hggp.util.DateUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
......@@ -465,7 +466,7 @@ public class HGYX013 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setSurveyDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SURVEY_DATE)), surveyDate));
setSurveyDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_SURVEY_DATE))), surveyDate));
setDistrict(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DISTRICT)), district));
setProductName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRODUCT_NAME)), productName));
setQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_QUANTITY)), quantity));
......
package com.baosight.hggp.hg.yx.domain;
import com.baosight.hggp.util.DateUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
......@@ -458,7 +459,7 @@ public class HGYX014 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setSurveyDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SURVEY_DATE)), surveyDate));
setSurveyDate(StringUtils.defaultIfEmpty(StringUtils.toString(DateUtils.formatShort(map.get(FIELD_SURVEY_DATE))), surveyDate));
setDistrict(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DISTRICT)), district));
setProductGoodBad(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRODUCT_GOOD_BAD)), productGoodBad));
setPriceGoodBad(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRICE_GOOD_BAD)), priceGoodBad));
......
......@@ -119,7 +119,7 @@ module.exports = {
sumWtdataList:['dayWeight','monthWeight','yearWeight'],
getByProcessSumWtList:[],
queryBySunWtList:[],
queryBySunWtDate:['组立','油漆','埋弧盖面','抛丸除锈','拼装','焊接'],
queryBySunWtDate:['切割下料','烧焊','车加工','铣加工','动平衡','装配'], //'组立','油漆','埋弧盖面','抛丸除锈','拼装','焊接'
};
},
watch:{
......
......@@ -54,10 +54,10 @@
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="planQty" cname="计划数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="purQty" cname="采购计划数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="purWeight" cname="采购计划重量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="planQty" cname="材料计划数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="planWeight" cname="材料计划重量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -9,9 +9,9 @@
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-primaryId" cname="主表id" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-companyCode" cname="仓库编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-companyName" cname="公司名称" colWidth="3" type="hidden"/>
<%-- <EF:EFInput ename="inqu_status-0-companyName" cname="公司名称" colWidth="3" type="hidden"/>--%>
<EF:EFInput ename="inqu_status-0-status" cname="状态" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-planDate" cname="计划日期" colWidth="3" type="hidden"/>
<%-- <EF:EFInput ename="inqu_status-0-planDate" cname="计划日期" colWidth="3" type="hidden"/>--%>
<EF:EFInput ename="inqu_status-0-planNo" cname="计划单号" colWidth="3" type="hidden"/>
<EF:EFInput ename="source" cname="数据来源" colWidth="3" type="hidden"/>
<div class="row">
......@@ -44,10 +44,10 @@
</EF:EFComboColumn>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" required="true"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="planQty" cname="计划数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购计划数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="purWeight" cname="采购计划重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="planQty" cname="材料计划数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="planWeight" cname="材料计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" width="80" align="center" required="true"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}" required="true"/>
......
......@@ -63,17 +63,17 @@
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center" defaultValue="0">
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('0','2','4','5')"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="supCode" cname="供应商名称" width="120" align="left" defaultValue=""
filter="contains" required="true">
<EF:EFComboColumn ename="supCode" cname="供应商名称" readonly="true" width="120" align="left"
defaultValue="" filter="contains" required="true">
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="120" align="center" hidden="true"/>
<EF:EFComboColumn ename="purUserId" cname="采购员" width="120" align="left" defaultValue=""
filter="contains" required="true" columnTemplate="#=valueField# - #=textField#"
itemTemplate="#=valueField# - #=textField#">
<EF:EFOptions blockId="user_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员姓名" enable="false" width="120" align="center" hidden="true"/>
<%-- <EF:EFComboColumn ename="purUserId" cname="采购员" readonly="true" width="120" align="left" defaultValue=""--%>
<%-- filter="contains" required="true" columnTemplate="#=valueField# - #=textField#"--%>
<%-- itemTemplate="#=valueField# - #=textField#">--%>
<%-- <EF:EFOptions blockId="user_block_id" valueField="valueField" textField="textField"/>--%>
<%-- </EF:EFComboColumn>--%>
<EF:EFColumn ename="purUserName" cname="采购员姓名" readonly="true" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false"
defaultValue="0" sumType="page"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"
......
......@@ -92,13 +92,11 @@ let checkParam = function () {
}
let supCode = $("#inqu_status-0-supCode").val();
if (isBlank(supCode)) {
message("供应商不能为空");
return;
return "供应商不能为空";
}
let purUserId = $("#inqu_status-0-purUserId").val();
if (isBlank(purUserId)) {
message("采购员不能为空");
return;
return "采购员不能为空";
}
return "";
}
\ No newline at end of file
......@@ -65,12 +65,12 @@
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="120" align="center" hidden="true"/>
<EF:EFComboColumn ename="purUserId" cname="采购员" width="120" align="left" defaultValue=""
filter="contains" required="true" columnTemplate="#=valueField# - #=textField#"
itemTemplate="#=valueField# - #=textField#">
<EF:EFOptions blockId="user_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员姓名" enable="false" width="120" align="center" hidden="true"/>
<%-- <EF:EFComboColumn ename="purUserId" cname="采购员" width="120" align="left" defaultValue=""--%>
<%-- filter="contains" required="true" columnTemplate="#=valueField# - #=textField#"--%>
<%-- itemTemplate="#=valueField# - #=textField#">--%>
<%-- <EF:EFOptions blockId="user_block_id" valueField="valueField" textField="textField"/>--%>
<%-- </EF:EFComboColumn>--%>
<EF:EFColumn ename="purUserName" cname="采购员" width="120" align="center"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}"
......
......@@ -155,7 +155,7 @@ function choiceFunc() {
}
JSColorbox.open({
href: "HGCW016A?methodName=initLoad&inqu_status-0-hiddenConditions=1" +
"&inqu_status-0-billState=1" +
"&inqu_status-0-reviewStatus=1" +
"&inqu_status-0-mainId=" + mainId +
"&efParentFormEname=HGCW016",
title: "<div style='text-align: center;'>采购收票</div>",
......
......@@ -54,27 +54,29 @@
</div>
<div id="right-pane" class="i-fit-height">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="项目代码" ename="projCode" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库id" ename="parentId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库id" ename="fileId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="类型" ename="type" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="层级" ename="leafLevel" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="是否是文件" ename="leafType" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库名称" ename="fileName" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="父级Id" ename="orgParentId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="登录用户" ename="userId" blockId="inqu_status" row="0" colWidth="3" value="${loginName}" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden" value="WD"/>
<EF:EFInput cname="附件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3" />
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="状态" colWidth="3">
<div class="row">
<EF:EFInput ename="fileName" cname="目录名称" blockId="inqu_status" row="0" colWidth="3"
readonly="true"/>
<EF:EFInput ename="docName" cname="附件名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="filePath" cname="文件路径" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect ename="status" cname="状态" blockId="inqu_status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hgwd.status"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFDateSpan startCname="修改时间" endCname="至" blockId="inqu_status" row="0"
startName="updateDateFrom" endName="updateDateTo" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="false">
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
<EF:EFInput cname="文件路径" ename="filePath" blockId="inqu_status" row="0" colWidth="3" />
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息" fitHeight="true">
......@@ -84,9 +86,9 @@
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="180" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="150" align="center" sort="false"/>
<EF:EFColumn ename="docName" cname="附件名称" enable="false" width="200"/>
<EF:EFColumn ename="changeContent" cname="变更内容" enable="false" width="200" sort="false"/>
<EF:EFColumn ename="filePath" cname="文件路径" enable="false" width="200"/>
<EF:EFColumn ename="docType" cname="附件类型" enable="false" width="110" align="center"/>
<EF:EFColumn ename="changeContent" cname="变更内容" enable="false" width="200" align="center"/>
<EF:EFColumn ename="filePath" cname="文件路径" enable="false" width="200" align="center"/>
<EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center"
defaultValue="0" hidden="false">
......
......@@ -20,7 +20,7 @@ let download = function () {
* @param row
*/
let singleDownload = function (row) {
let fileId = $("#inqu_status-0-parentId").val();
let fileId = $("#inqu_status-0-fileId").val();
let inInfo = new EiInfo();
inInfo.set("result-0-fileId", fileId);
inInfo.set("result-0-docId", row['docId']);
......
......@@ -124,7 +124,8 @@ $(function () {
return ' <span class="' + icon + '" style="padding-right: 8px"> </span> <span class="titleClass" title="' + item.label + '">' + title + '</span>'
},
loadComplete: function (options) {
// 树节点查询
$("#search").on("click", treeSearch);
},
selectTreeNode: {
fileId: '',
......@@ -340,3 +341,65 @@ let showPreview = function (docId) {
let fileId = IPLATUI.EFTree.docTree.selectTreeNode.fileId;
addRecordWindow(fileId, docId);
}
/**
* 树节点查询
*/
let treeSearch = function (){
let tree = $("#docTree").data("kendoTreeView");
let leafName = $("#searchText").val();
if (leafName == null || leafName.trim() === '') {
tree.reload("root");
return
}
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-fileName", leafName);
EiCommunicator.send("HGWD001D", "searchTree", inInfo, {
onSuccess: function (res) {
if (res.status === -1) {
message(res.msg);
return;
}
// 获取所有满足条件的子节点路径
const allPath = res.get("allPath")
if (allPath.length <= 0) {
return;
}
tree.reload("root");
// 根据路径一层层展开树节点,先剔除重复的节点
let expandNodes = []
for (let path of allPath) {
for (let index = 0; index < path.length - 1; index++) {
if (-1 === expandNodes.indexOf(path[index])) {
expandNodes.push(path[index]);
}
}
}
expandTreeNodeList(tree, expandNodes);
}, onFail: function (res) {
IPLAT.alert(res.msg);
}
});
}
/**
* 批量展开树节点
*
* @param tree
* @param nodeIds
*/
function expandTreeNodeList(tree, nodeIds) {
if (nodeIds.length === 0 || tree == null) {
// 所有节点都已展开完毕,结束递归
return;
}
const orgId = nodeIds[0];
let barDataItem = tree.dataSource.get(orgId);
if (barDataItem) {
tree.expandPath(nodeIds)
} else {
setTimeout(() => {
expandTreeNodeList(tree, nodeIds)
}, 100)
}
}
\ No newline at end of file
......@@ -9,6 +9,12 @@
<div id="splitter" class="i-fit-height">
<div id="left-pane" class="i-fit-height">
<EF:EFRegion title="文档目录树" id="tree" fitHeight="true">
<%-- <div class="row" style="display: block">--%>
<%-- <div class="col-md-8" style="display:flex;align-items: center">--%>
<%-- <EF:EFInput ename="searchText" colWidth="8" inline="true"/>--%>
<%-- <EF:EFButton ename="search" class="fa fa-search" layout="2"/>--%>
<%-- </div>--%>
<%-- </div>--%>
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="tree_name" textField="text" valueField="label"
hasChildren="leaf" pid="parentId" serviceName="HGWD001D" methodName="queryTree"
......
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