Commit 3eab31b3 by liuyang

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

parents adfbba97 d5890325
...@@ -7,6 +7,7 @@ import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst; ...@@ -7,6 +7,7 @@ import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst;
import com.baosight.hggp.core.extapp.decheng.model.DcChance; import com.baosight.hggp.core.extapp.decheng.model.DcChance;
import com.baosight.hggp.core.extapp.decheng.model.DcContractList; import com.baosight.hggp.core.extapp.decheng.model.DcContractList;
import com.baosight.hggp.core.extapp.decheng.model.DcDeptList; import com.baosight.hggp.core.extapp.decheng.model.DcDeptList;
import com.baosight.hggp.core.extapp.decheng.model.DcProductList;
import com.baosight.hggp.core.extapp.decheng.model.DcUser; import com.baosight.hggp.core.extapp.decheng.model.DcUser;
import com.baosight.hggp.core.extapp.decheng.model.DcUserList; import com.baosight.hggp.core.extapp.decheng.model.DcUserList;
import com.baosight.hggp.core.extapp.decheng.utils.DcApiUtils; import com.baosight.hggp.core.extapp.decheng.utils.DcApiUtils;
...@@ -139,4 +140,21 @@ public class DcOpenApi { ...@@ -139,4 +140,21 @@ public class DcOpenApi {
DcApiUtils.handleMessage(JSONObject.parseObject(result)); DcApiUtils.handleMessage(JSONObject.parseObject(result));
} }
/**
* 产品管理-列表
*
* @param pageIndex 当前页
*/
public static Pager<DcProductList> productList(int pageIndex) throws IOException {
JSONArray dataJsons = new JSONArray();
dataJsons.add(DcApiUtils.buildValueJson("pageindex", pageIndex));
dataJsons.add(DcApiUtils.buildValueJson("pagesize", 100));
String param = JSON.toJSONString(DcApiUtils.buildParamJson(dataJsons));
String result = HttpUtils.post(DeChengConst.PRODUCT_BILLLIST, param, HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】获取产品管理列表失败");
}
return DcApiUtils.handleResult(result, DcProductList.class);
}
} }
...@@ -57,6 +57,11 @@ public class DeChengConst { ...@@ -57,6 +57,11 @@ public class DeChengConst {
public static final String INTERACTION_ADD = "http://106.15.43.147:6099/sysa/mobilephone/officemanage/interaction/add.asp"; public static final String INTERACTION_ADD = "http://106.15.43.147:6099/sysa/mobilephone/officemanage/interaction/add.asp";
/** /**
* 产品管理-列表
*/
public static final String PRODUCT_BILLLIST = "http://106.15.43.147:6099/sysa/mobilephone/salesmanage/product/billlist.asp";
/**
* API状态码 * API状态码
* *
* @author:songx * @author:songx
......
package com.baosight.hggp.core.extapp.decheng.model;
import lombok.Data;
/**
* 合同信息
*
* @author:songx
* @date:2024/8/9,16:41
*/
@Data
public class DcProductList {
/**
* 产品标识
*/
private String ord;
/**
* 产品名称
*/
private String cpname;
/**
* 产品编号
*/
private String cpbh;
/**
* 产品型号
*/
private String cpxh;
/**
* 产品单位
*/
private String unit;
/**
* 产品分类
*/
private String fenlei;
}
...@@ -162,7 +162,7 @@ public class ServiceHGSC101 extends ServiceEPBase { ...@@ -162,7 +162,7 @@ public class ServiceHGSC101 extends ServiceEPBase {
Map updateMap = new HashMap(); Map updateMap = new HashMap();
updateMap.put(HGSC001.FIELD_proj_code, projCode); updateMap.put(HGSC001.FIELD_proj_code, projCode);
updateMap.put(HGSC001.FIELD_proj_name, dcContractList.getTitle()); updateMap.put(HGSC001.FIELD_proj_name, dcContractList.getTitle());
DaoUtils.update(HgScSqlConstant.HgSc001.UPDATE_PROJ_NAME, dbSc001); DaoUtils.update(HgScSqlConstant.HgSc001.UPDATE_PROJ_NAME, updateMap);
} }
} }
} }
......
...@@ -235,7 +235,6 @@ public class HGSCTools { ...@@ -235,7 +235,6 @@ public class HGSCTools {
*/ */
public static class Hgsc001 { public static class Hgsc001 {
/** /**
* *
* @param code * @param code
......
package com.baosight.hggp.hg.wd.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:Hgwd005.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-09-23 16:43:17 create
*/
public class HGWD005 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
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_NAME = "updatedName"; /* 记录修改名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 记录修改时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 0-未删除,1-已删除*/
public static final String FIELD_PRODUCT_CODE = "productCode"; /* 产品编号*/
public static final String FIELD_PRODUCT_NAME = "productName"; /* 产品名称*/
public static final String FIELD_PRODUCT_MODEL = "productModel"; /* 产品型号*/
public static final String FIELD_UNIT = "unit"; /* 产品单位*/
public static final String FIELD_CLASSIFY = "classify"; /* 产品分类*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_IS_PROJECT_MANAGER = "isProjectManager"; /* 是否项目经理,0=否,1=是*/
public static final String FIELD_EXT_ID = "extId"; /* 外部系统主键ID*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
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_NAME = "UPDATED_NAME"; /* 记录修改名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 记录修改时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 0-未删除,1-已删除*/
public static final String COL_PRODUCT_CODE = "PRODUCT_CODE"; /* 产品编号*/
public static final String COL_PRODUCT_NAME = "PRODUCT_NAME"; /* 产品名称*/
public static final String COL_PRODUCT_MODEL = "PRODUCT_MODEL"; /* 产品型号*/
public static final String COL_UNIT = "UNIT"; /* 产品单位*/
public static final String COL_CLASSIFY = "CLASSIFY"; /* 产品分类*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_IS_PROJECT_MANAGER = "IS_PROJECT_MANAGER"; /* 是否项目经理,0=否,1=是*/
public static final String COL_EXT_ID = "EXT_ID"; /* 外部系统主键ID*/
public static final String QUERY = "HGWD005.query";
public static final String COUNT = "HGWD005.count";
public static final String INSERT = "HGWD005.insert";
public static final String UPDATE = "HGWD005.update";
public static final String DELETE = "HGWD005.delete";
private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 记录创建者*/
private String createdName = " "; /* 记录创建名称*/
private String createdTime = " "; /* 记录创建时间*/
private String updatedBy = " "; /* 记录修改者*/
private String updatedName = " "; /* 记录修改名称*/
private String updatedTime = " "; /* 记录修改时间*/
private Integer deleteFlag; /* 0-未删除,1-已删除*/
private String productCode = " "; /* 产品编号*/
private String productName = " "; /* 产品名称*/
private String productModel = " "; /* 产品型号*/
private String unit = " "; /* 产品单位*/
private String classify = " "; /* 产品分类*/
private String remark = " "; /* 备注*/
private String extId = " "; /* 外部系统主键ID*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码");
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_NAME);
eiColumn.setDescName("记录修改名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("记录修改时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("0-未删除,1-已删除");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRODUCT_CODE);
eiColumn.setDescName("产品编号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRODUCT_NAME);
eiColumn.setDescName("产品名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRODUCT_MODEL);
eiColumn.setDescName("产品型号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UNIT);
eiColumn.setDescName("产品单位");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CLASSIFY);
eiColumn.setDescName("产品分类");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_IS_PROJECT_MANAGER);
eiColumn.setDescName("是否项目经理,0=否,1=是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EXT_ID);
eiColumn.setDescName("外部系统主键ID");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGWD005() {
initMetaData();
}
/**
* get the id .
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id .
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 企业编码.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 企业编码.
*
* @param accountCode - 企业编码
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* 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 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 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 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 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 productCode - 产品编号.
* @return the productCode
*/
public String getProductCode() {
return this.productCode;
}
/**
* set the productCode - 产品编号.
*
* @param productCode - 产品编号
*/
public void setProductCode(String productCode) {
this.productCode = productCode;
}
/**
* get the productName - 产品名称.
* @return the productName
*/
public String getProductName() {
return this.productName;
}
/**
* set the productName - 产品名称.
*
* @param productName - 产品名称
*/
public void setProductName(String productName) {
this.productName = productName;
}
/**
* get the productModel - 产品型号.
* @return the productModel
*/
public String getProductModel() {
return this.productModel;
}
/**
* set the productModel - 产品型号.
*
* @param productModel - 产品型号
*/
public void setProductModel(String productModel) {
this.productModel = productModel;
}
/**
* get the unit - 产品单位.
* @return the unit
*/
public String getUnit() {
return this.unit;
}
/**
* set the unit - 产品单位.
*
* @param unit - 产品单位
*/
public void setUnit(String unit) {
this.unit = unit;
}
/**
* get the classify - 产品分类.
* @return the classify
*/
public String getClassify() {
return this.classify;
}
/**
* set the classify - 产品分类.
*
* @param classify - 产品分类
*/
public void setClassify(String classify) {
this.classify = classify;
}
/**
* 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 extId - 外部系统主键ID.
* @return the extId
*/
public String getExtId() {
return this.extId;
}
/**
* set the extId - 外部系统主键ID.
*
* @param extId - 外部系统主键ID
*/
public void setExtId(String extId) {
this.extId = extId;
}
/**
* 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));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
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));
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));
setProductCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRODUCT_CODE)), productCode));
setProductName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRODUCT_NAME)), productName));
setProductModel(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRODUCT_MODEL)), productModel));
setUnit(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UNIT)), unit));
setClassify(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CLASSIFY)), classify));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setExtId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EXT_ID)), extId));
}
/**
* 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_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
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_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_PRODUCT_CODE, StringUtils.toString(productCode, eiMetadata.getMeta(FIELD_PRODUCT_CODE)));
map.put(FIELD_PRODUCT_NAME, StringUtils.toString(productName, eiMetadata.getMeta(FIELD_PRODUCT_NAME)));
map.put(FIELD_PRODUCT_MODEL, StringUtils.toString(productModel, eiMetadata.getMeta(FIELD_PRODUCT_MODEL)));
map.put(FIELD_UNIT, StringUtils.toString(unit, eiMetadata.getMeta(FIELD_UNIT)));
map.put(FIELD_CLASSIFY, StringUtils.toString(classify, eiMetadata.getMeta(FIELD_CLASSIFY)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_EXT_ID, StringUtils.toString(extId, eiMetadata.getMeta(FIELD_EXT_ID)));
return map;
}
}
...@@ -198,8 +198,10 @@ public class ServiceHGWD003 extends ServiceEPBase { ...@@ -198,8 +198,10 @@ public class ServiceHGWD003 extends ServiceEPBase {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 文档管理员不做校验 // 文档管理员不做校验
if (HgWdUtils.HgWd009.isManager(UserSessionUtils.getLoginName())) { if (HgWdUtils.HgWd009.isManager(UserSessionUtils.getLoginName())) {
inInfo.set("isProjectManager", CommonConstant.YesNo.YES_1); inInfo.set("isManager", CommonConstant.YesNo.YES_1);
return inInfo; return inInfo;
} else {
inInfo.set("isManager", CommonConstant.YesNo.NO_0);
} }
queryMap.put(HGWD003.FIELD_USER_ID, UserSessionUtils.getLoginName()); queryMap.put(HGWD003.FIELD_USER_ID, UserSessionUtils.getLoginName());
List<HGWD003> dbWd003s = dao.query(HgWdSqlConstant.HgWd003.GET_BY_USER, queryMap); List<HGWD003> dbWd003s = dao.query(HgWdSqlConstant.HgWd003.GET_BY_USER, queryMap);
......
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.extapp.decheng.model.DcContractList;
import com.baosight.hggp.core.extapp.decheng.model.DcProductList;
import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.core.utils.ThreadUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.domain.HGWD005;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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.collections.CollectionUtils;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* 产品列表
*
* @author:songx
* @date:2024/5/9,11:04
*/
@Slf4j
public class ServiceHGWD005 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGWD005().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGWD005.QUERY, new HGWD005());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 同步德诚产品信息
*
* @param inInfo
* @return
*/
public EiInfo syncDcProduct(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String accountCode = MapUtils.getString(queryMap, HGPZ009.FIELD_ACCOUNT_CODE);
AssertUtils.isEmpty(accountCode, "企业编码不能为空");
ThreadUtils.FIXED_THREAD.execute(() -> {
try {
syncDcProductData(accountCode);
} catch (Exception e) {
log.error("同步德诚产品信息失败:{}", e.getMessage(), e);
}
});
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("同步德诚产品信息成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "同步德诚产品信息失败");
}
return inInfo;
}
/**
* 同步德诚产品信息
*
* @param accountCode
*/
private void syncDcProductData(String accountCode) throws IOException {
int pageIndex = 1;
while (true) {
// 超过1000次不在执行
if (pageIndex > 1000) {
break;
}
Pager<DcProductList> pager = DcOpenApi.productList(pageIndex);
List<DcProductList> dcProductLists = pager.getData();
if (CollectionUtils.isEmpty(dcProductLists) || pageIndex > pager.getTotalPages()) {
break;
}
// 写入数据
saveProductData(accountCode, dcProductLists);
pageIndex++;
}
}
/**
* 写入产品信息
*
* @param accountCode
* @param dcProductLists
*/
private void saveProductData(String accountCode, List<DcProductList> dcProductLists) {
for (DcProductList dcProductList : dcProductLists) {
HGWD005 dbWd005 = HGWDTools.HgWd005.get(dcProductList.getOrd());
if (dbWd005 == null) {
dbWd005 = new HGWD005();
dbWd005.setAccountCode(accountCode);
dbWd005.setDepCode(accountCode);
dbWd005.setExtId(dcProductList.getOrd());
dbWd005.setProductCode(dcProductList.getCpbh());
dbWd005.setProductName(dcProductList.getCpname());
dbWd005.setProductModel(dcProductList.getCpxh());
dbWd005.setUnit(dcProductList.getUnit());
dbWd005.setClassify(dcProductList.getFenlei());
DaoUtils.insert(HGWD005.INSERT, dbWd005);
} else {
Map updateMap = new HashMap();
updateMap.put(HGWD005.FIELD_ID, dbWd005.getId());
updateMap.put(HGWD005.FIELD_PRODUCT_NAME, dcProductList.getCpname());
updateMap.put(HGWD005.FIELD_PRODUCT_MODEL, dcProductList.getCpxh());
updateMap.put(HGWD005.FIELD_UNIT, dcProductList.getUnit());
updateMap.put(HGWD005.FIELD_CLASSIFY, dcProductList.getFenlei());
DaoUtils.update(HGWD005.UPDATE, updateMap);
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGWD005">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
PRODUCT_CODE as "productCode", <!-- 产品编号 -->
PRODUCT_NAME as "productName", <!-- 产品名称 -->
PRODUCT_MODEL as "productModel", <!-- 产品型号 -->
UNIT as "unit", <!-- 产品单位 -->
CLASSIFY as "classify", <!-- 产品分类 -->
REMARK as "remark", <!-- 备注 -->
EXT_ID as "extId" <!-- 外部系统主键ID -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
PRODUCT_CODE = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
PRODUCT_NAME = #productName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productModel">
PRODUCT_MODEL = #productModel#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="classify">
CLASSIFY = #classify#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="extId">
EXT_ID = #extId#
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.ctdy.Hgwd005">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGWD005
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGWD005
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGWD005 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
PRODUCT_CODE, <!-- 产品编号 -->
PRODUCT_NAME, <!-- 产品名称 -->
PRODUCT_MODEL, <!-- 产品型号 -->
UNIT, <!-- 产品单位 -->
CLASSIFY, <!-- 产品分类 -->
REMARK, <!-- 备注 -->
EXT_ID <!-- 外部系统主键ID -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #productCode#, #productName#, #productModel#, #unit#, #classify#, #remark#,
#extId#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGWD005 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGWD005
SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
PRODUCT_NAME = #productName#, <!-- 产品名称 -->
PRODUCT_MODEL = #productModel#, <!-- 产品型号 -->
UNIT = #unit#, <!-- 产品单位 -->
CLASSIFY = #classify#, <!-- 产品分类 -->
WHERE ID = #id#
</update>
</sqlMap>
...@@ -5,11 +5,14 @@ import com.baosight.hggp.core.dao.DaoUtils; ...@@ -5,11 +5,14 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi; import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cw.domain.HGCW999; import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant; import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A; import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.domain.HGWD003; import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD005;
import com.baosight.hggp.hg.wd.domain.HGWD009; import com.baosight.hggp.hg.wd.domain.HGWD009;
import com.baosight.hggp.hg.wd.domain.HGWD099; import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
...@@ -213,6 +216,29 @@ public class HGWDTools { ...@@ -213,6 +216,29 @@ public class HGWDTools {
} }
/**
* 产品信息
*
* @author:songx
* @date:2024/8/28,17:40
*/
public static class HgWd005 {
/**
* 外部系统标识
*
* @param extId
* @return
*/
public static HGWD005 get(String extId) {
AssertUtils.isNull(extId, "项目Code不能为空!");
Map queryMap = new HashMap();
queryMap.put(HGWD005.FIELD_EXT_ID, extId);
List<HGWD005> results = DaoBase.getInstance().query(HGWD005.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
public static class HgWd099 { public static class HgWd099 {
public static List<HGWD099> getByDocId(String bizType, String docId) { public static List<HGWD099> getByDocId(String bizType, String docId) {
......
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