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
......
...@@ -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