Commit ef8e87bc by liuyang

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

parents fc350c39 8de5987c
...@@ -16,7 +16,6 @@ import com.baosight.hggp.util.StringUtils; ...@@ -16,7 +16,6 @@ import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -50,8 +49,8 @@ public class DcOpenApi { ...@@ -50,8 +49,8 @@ public class DcOpenApi {
* *
* @param pageIndex 当前页 * @param pageIndex 当前页
*/ */
public static Pager<DcUserList> userList(int pageIndex) public static Pager<DcUserList> userList(int pageIndex) throws IOException, InstantiationException,
throws IOException, InstantiationException, IllegalAccessException { IllegalAccessException {
JSONObject paramJson = DcApiUtils.buildParamJson(pageIndex); JSONObject paramJson = DcApiUtils.buildParamJson(pageIndex);
String result = HttpUtils.post(DeChengConst.USER_LIST, DcApiUtils.buildHeader(), JSON.toJSONString(paramJson), String result = HttpUtils.post(DeChengConst.USER_LIST, DcApiUtils.buildHeader(), JSON.toJSONString(paramJson),
HttpUtils.JSON_MEDIA_TYPE); HttpUtils.JSON_MEDIA_TYPE);
...@@ -84,7 +83,7 @@ public class DcOpenApi { ...@@ -84,7 +83,7 @@ public class DcOpenApi {
* @param endTime 结束日期 20240820 * @param endTime 结束日期 20240820
* @param pageIndex 当前页 * @param pageIndex 当前页
*/ */
public static List<DcChance> chanceList(String startTime, String endTime, int pageIndex) throws IOException { public static Pager<DcChance> chanceList(String startTime, String endTime, int pageIndex) throws IOException {
JSONArray dataJsons = new JSONArray(); JSONArray dataJsons = new JSONArray();
dataJsons.add(DcApiUtils.buildValueJson("a_date_0", startTime)); dataJsons.add(DcApiUtils.buildValueJson("a_date_0", startTime));
dataJsons.add(DcApiUtils.buildValueJson("a_date_1", endTime)); dataJsons.add(DcApiUtils.buildValueJson("a_date_1", endTime));
...@@ -103,7 +102,7 @@ public class DcOpenApi { ...@@ -103,7 +102,7 @@ public class DcOpenApi {
* *
* @param pageIndex 当前页 * @param pageIndex 当前页
*/ */
public static List<DcContractList> contactList(int pageIndex) throws IOException { public static Pager<DcContractList> contactList(int pageIndex) throws IOException {
JSONArray dataJsons = new JSONArray(); JSONArray dataJsons = new JSONArray();
dataJsons.add(DcApiUtils.buildValueJson("pageindex", pageIndex)); dataJsons.add(DcApiUtils.buildValueJson("pageindex", pageIndex));
dataJsons.add(DcApiUtils.buildValueJson("pagesize", 100)); dataJsons.add(DcApiUtils.buildValueJson("pagesize", 100));
......
...@@ -191,12 +191,24 @@ public class DcApiUtils { ...@@ -191,12 +191,24 @@ public class DcApiUtils {
* @param result * @param result
* @return * @return
*/ */
public static <T> List<T> handleResult(String result, Class<T> clazz) { public static <T> Pager<T> handleResult(String result, Class<T> clazz) {
JSONObject resultJson = JSONObject.parseObject(result); JSONObject resultJson = JSONObject.parseObject(result);
// 异常处理 // 异常处理
handleMessage(resultJson); handleMessage(resultJson);
// 获取结果数据集
JSONObject bodyJson = resultJson.getJSONObject("body");
JSONObject sourceJson = bodyJson.getJSONObject("source");
JSONObject tableJson = sourceJson.getJSONObject("table");
// 构建结果数据集 // 构建结果数据集
return buildTableData(resultJson, clazz); Pager pager = new Pager<T>();
pager.setData(buildTableData(tableJson, clazz));
// 分页数据
JSONObject pageJson = tableJson.getJSONObject("page");
pager.setPageIndex(pageJson.getInteger("pageindex"));
pager.setPageSize(pageJson.getInteger("pagesize"));
pager.setTotalRows(pageJson.getInteger("recordcount"));
pager.setTotalPages(pageJson.getInteger("pagecount"));
return pager;
} }
/** /**
...@@ -221,15 +233,12 @@ public class DcApiUtils { ...@@ -221,15 +233,12 @@ public class DcApiUtils {
/** /**
* 构建数据集 * 构建数据集
* *
* @param resultJson * @param tableJson
* @param clazz * @param clazz
* @param <T> * @param <T>
* @return * @return
*/ */
public static <T> List<T> buildTableData(JSONObject resultJson, Class<T> clazz) { public static <T> List<T> buildTableData(JSONObject tableJson, Class<T> clazz) {
JSONObject bodyJson = resultJson.getJSONObject("body");
JSONObject sourceJson = bodyJson.getJSONObject("source");
JSONObject tableJson = sourceJson.getJSONObject("table");
JSONArray colJsons = tableJson.getJSONArray("cols"); JSONArray colJsons = tableJson.getJSONArray("cols");
JSONArray rowJsons = tableJson.getJSONArray("rows"); JSONArray rowJsons = tableJson.getJSONArray("rows");
return rowJsons.stream().map(item -> { return rowJsons.stream().map(item -> {
......
...@@ -109,13 +109,11 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -109,13 +109,11 @@ public class ServiceHGCG003B extends ServiceBase {
this.editData(fCg003Bs, dbCg003BMap, dbCg002AMap, cg003, dbCg002BMap); this.editData(fCg003Bs, dbCg003BMap, dbCg002AMap, cg003, dbCg002BMap);
} else { } else {
// 写入数据 // 写入数据
for (int i = 0; i < fCg003Bs.size(); i++) { for (HGCG003B fCg003B : fCg003Bs) {
HGCG003B hgcg003B = fCg003Bs.get(i); if (fCg003B.getId() == null || fCg003B.getId() == 0) {
if (hgcg003B.getId() == null || hgcg003B.getId() == 0) { this.addData(fCg003B, cg003);
// 修改数据
this.addData(hgcg003B, cg003);
} else { } else {
this.updateData(hgcg003B); this.updateData(fCg003B);
} }
} }
//修改主表信息 //修改主表信息
......
...@@ -633,6 +633,8 @@ public class HGSqlConstant { ...@@ -633,6 +633,8 @@ public class HGSqlConstant {
public class HgXsUser { public class HgXsUser {
// 查询 // 查询
public static final String GET_BY_LOGIN = "HGXSUser.getByLogin";
// 查询
public static final String QUERY = "HGXSUser.query"; public static final String QUERY = "HGXSUser.query";
// 查询 // 查询
public static final String COUNT = "HGXSUser.count"; public static final String COUNT = "HGXSUser.count";
......
...@@ -14,6 +14,8 @@ public class HgScSqlConstant { ...@@ -14,6 +14,8 @@ public class HgScSqlConstant {
*/ */
public static class HgSc001 { public static class HgSc001 {
// 获取
public static final String GET_BY_CODE = "HGSC001.get";
// 德诚修改 // 德诚修改
public static final String UPDATE_FOR_DC = "HGSC001.updateForDc"; public static final String UPDATE_FOR_DC = "HGSC001.updateForDc";
// 修改项目名称 // 修改项目名称
......
...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sc.service; ...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.core.dao.DaoUtils; 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.extapp.decheng.model.DcContractList; import com.baosight.hggp.core.extapp.decheng.model.DcContractList;
import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.core.utils.ThreadUtils; import com.baosight.hggp.core.utils.ThreadUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009; import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
...@@ -125,12 +126,13 @@ public class ServiceHGSC101 extends ServiceEPBase { ...@@ -125,12 +126,13 @@ public class ServiceHGSC101 extends ServiceEPBase {
if (pageIndex > 1000) { if (pageIndex > 1000) {
break; break;
} }
List<DcContractList> zbContracts = DcOpenApi.contactList(pageIndex); Pager<DcContractList> pager = DcOpenApi.contactList(pageIndex);
if (CollectionUtils.isEmpty(zbContracts)) { List<DcContractList> dcContractLists = pager.getData();
if (CollectionUtils.isEmpty(dcContractLists) || pageIndex > pager.getTotalPages()) {
break; break;
} }
// 写入合同数据 // 写入合同数据
saveContractData(accountCode, zbContracts); saveContractData(accountCode, dcContractLists);
pageIndex++; pageIndex++;
} }
} }
...@@ -139,27 +141,27 @@ public class ServiceHGSC101 extends ServiceEPBase { ...@@ -139,27 +141,27 @@ public class ServiceHGSC101 extends ServiceEPBase {
* 写入合同信息 * 写入合同信息
* *
* @param accountCode * @param accountCode
* @param zbContracts * @param dcContractLists
*/ */
private void saveContractData(String accountCode, List<DcContractList> zbContracts) { private void saveContractData(String accountCode, List<DcContractList> dcContractLists) {
// 查询帐套信息 // 查询帐套信息
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode); HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
String prefix = dbPz009.getLoginPrefix(); String prefix = dbPz009.getLoginPrefix();
for (DcContractList zbContract : zbContracts) { for (DcContractList dcContractList : dcContractLists) {
String projCode = prefix + zbContract.getOrd(); String projCode = prefix + dcContractList.getOrd();
HGSC001 dbSc001 = HGSCTools.Hgsc001.queryByCode(projCode); HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode);
if (dbSc001 == null) { if (dbSc001 == null) {
dbSc001 = new HGSC001(); dbSc001 = new HGSC001();
dbSc001.setAccountCode(accountCode); dbSc001.setAccountCode(accountCode);
dbSc001.setDepCode(accountCode); dbSc001.setDepCode(accountCode);
dbSc001.setDepName(dbPz009.getAccountName()); dbSc001.setDepName(dbPz009.getAccountName());
dbSc001.setProjCode(projCode); dbSc001.setProjCode(projCode);
dbSc001.setProjName(zbContract.getTitle()); dbSc001.setProjName(dcContractList.getTitle());
DaoUtils.insert(HGSC001.INSERT, dbSc001); DaoUtils.insert(HGSC001.INSERT, dbSc001);
} else { } else {
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, zbContract.getTitle()); updateMap.put(HGSC001.FIELD_proj_name, dcContractList.getTitle());
DaoUtils.insert(HgScSqlConstant.HgSc001.UPDATE_PROJ_NAME, dbSc001); DaoUtils.insert(HgScSqlConstant.HgSc001.UPDATE_PROJ_NAME, dbSc001);
} }
} }
......
...@@ -2,6 +2,37 @@ ...@@ -2,6 +2,37 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/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="HGSC001"> <sqlMap namespace="HGSC001">
<sql id="column">
id as "id",
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
subcontract_code as "subcontractCode", <!-- 分包商编码 -->
subcontract_name as "subcontractName", <!-- 分包商名称 -->
genral_contract_code as "genralContractCode", <!-- 总包商编码 -->
genral_contract_name as "genralContractName", <!-- 总包商名称 -->
party_pm_name as "partyPmName", <!-- 甲方项目经理名称 -->
party_pm_hpone as "partyPmHpone", <!-- 甲方项目经理联系电话 -->
contract_name as "contractName", <!-- 合同名称 -->
contract_work_txt as "contractWorkTxt", <!-- 合同工作量 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
proj_type as "projType", <!-- 项目性质 -->
proj_status as "projStatus", <!-- 项目状态 0:在建;1:完工 -->
approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
permiss_start_date as "permissStartDate", <!-- 准许开工日期 -->
start_date as "startDate", <!-- 开工日期 -->
end_date as "endDate", <!-- 完工日期 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition"> <sql id="condition">
<include refid="HGXSDataAuth.authCondition"/> <include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
...@@ -98,38 +129,18 @@ ...@@ -98,38 +129,18 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="get" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC001
WHERE PROJ_CODE = #projCode
</select>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001"> <select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT SELECT
id as "id", <include refid="column"/>
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
subcontract_code as "subcontractCode", <!-- 分包商编码 -->
subcontract_name as "subcontractName", <!-- 分包商名称 -->
genral_contract_code as "genralContractCode", <!-- 总包商编码 -->
genral_contract_name as "genralContractName", <!-- 总包商名称 -->
party_pm_name as "partyPmName", <!-- 甲方项目经理名称 -->
party_pm_hpone as "partyPmHpone", <!-- 甲方项目经理联系电话 -->
contract_name as "contractName", <!-- 合同名称 -->
contract_work_txt as "contractWorkTxt", <!-- 合同工作量 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
proj_type as "projType", <!-- 项目性质 -->
proj_status as "projStatus", <!-- 项目状态 0:在建;1:完工 -->
approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
permiss_start_date as "permissStartDate", <!-- 准许开工日期 -->
start_date as "startDate", <!-- 开工日期 -->
end_date as "endDate", <!-- 完工日期 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC001 WHERE 1=1 FROM ${hggpSchema}.HGSC001 WHERE 1=1
<include refid="customCondition" /> <include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
......
package com.baosight.hggp.hg.sc.tools; package com.baosight.hggp.hg.sc.tools;
import cn.hutool.core.bean.BeanUtil; import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.*; import com.baosight.hggp.common.CheckStatusEnum;
import com.baosight.hggp.common.ComputeTypeEnum;
import com.baosight.hggp.common.HandleStatusEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
...@@ -13,18 +16,37 @@ import com.baosight.hggp.hg.pz.domain.HGPZ004; ...@@ -13,18 +16,37 @@ import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ005A; import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.*; import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.domain.HGSC003;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC004B;
import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sc.domain.HGSC099;
import com.baosight.hggp.hg.sj.domain.HGSJ001; import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.hg.sj.tools.HGSJTools; import com.baosight.hggp.hg.sj.tools.HGSJTools;
import com.baosight.hggp.hg.zl.domain.HGZL002; import com.baosight.hggp.hg.zl.domain.HGZL002;
import com.baosight.hggp.hg.zl.domain.HGZL004; import com.baosight.hggp.hg.zl.domain.HGZL004;
import com.baosight.hggp.hg.zl.tools.HGZLTools; import com.baosight.hggp.hg.zl.tools.HGZLTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.FileUtils;
import com.baosight.iplat4j.core.ProjectInfo; import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -33,12 +55,24 @@ import org.apache.commons.lang3.StringUtils; ...@@ -33,12 +55,24 @@ import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.baosight.hggp.common.AssignStatusEnum.*; import cn.hutool.core.bean.BeanUtil;
import static com.baosight.hggp.common.AssignStatusEnum.ASSIGNED;
import static com.baosight.hggp.common.AssignStatusEnum.PARTIAL_ASSIGN;
import static com.baosight.hggp.common.AssignStatusEnum.UNASSIGN;
import static java.math.BigDecimal.ROUND_DOWN; import static java.math.BigDecimal.ROUND_DOWN;
/** /**
...@@ -196,6 +230,20 @@ public class HGSCTools { ...@@ -196,6 +230,20 @@ public class HGSCTools {
*/ */
public static class Hgsc001 { public static class Hgsc001 {
/**
*
* @param code
* @return
*/
public static HGSC001 getByCode(String code) {
AssertUtils.isNull(code, "项目Code不能为空!");
Map queryMap = new HashMap();
queryMap.put(HGSC001.FIELD_proj_code, code);
List<HGSC001> results = DaoBase.getInstance().query(HgScSqlConstant.HgSc001.GET_BY_CODE, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/** /**
* *
* @param code * @param code
...@@ -203,8 +251,10 @@ public class HGSCTools { ...@@ -203,8 +251,10 @@ public class HGSCTools {
*/ */
public static HGSC001 queryByCode(String code) { public static HGSC001 queryByCode(String code) {
AssertUtils.isNull(code, "项目Code不能为空!"); AssertUtils.isNull(code, "项目Code不能为空!");
List<HGSC001> results = DaoBase.getInstance().query(HGSC001.QUERY, new HashMap<String,Object>(){ List<HGSC001> results = DaoBase.getInstance().query(HGSC001.QUERY, new HashMap<String, Object>() {
{put("projCode",code);} {
put("projCode", code);
}
}); });
return CollectionUtils.isEmpty(results) ? null : results.get(0); return CollectionUtils.isEmpty(results) ? null : results.get(0);
} }
......
...@@ -150,34 +150,34 @@ public class ServiceHGXSOrg extends ServiceBase { ...@@ -150,34 +150,34 @@ public class ServiceHGXSOrg extends ServiceBase {
private void syncDcDeptData(String accountCode) throws IOException, InstantiationException, IllegalAccessException { private void syncDcDeptData(String accountCode) throws IOException, InstantiationException, IllegalAccessException {
int pageIndex = 1; int pageIndex = 1;
Pager<DcDeptList> pager = DcOpenApi.deptList(pageIndex); Pager<DcDeptList> pager = DcOpenApi.deptList(pageIndex);
List<DcDeptList> zbDepts = pager.getData(); List<DcDeptList> dcDeptLists = pager.getData();
if (CollectionUtils.isEmpty(zbDepts)) { if (CollectionUtils.isEmpty(dcDeptLists)) {
return; return;
} }
// 写入合同数据 // 写入合同数据
syncDcDeptData(accountCode, zbDepts); syncDcDeptData(accountCode, dcDeptLists);
} }
/** /**
* 写入部门信息 * 写入部门信息
* *
* @param accountCode * @param accountCode
* @param zbDepts * @param dcDeptLists
*/ */
private void syncDcDeptData(String accountCode, List<DcDeptList> zbDepts) { private void syncDcDeptData(String accountCode, List<DcDeptList> dcDeptLists) {
// 查询帐套信息 // 查询帐套信息
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode); HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
for (DcDeptList zbDept : zbDepts) { for (DcDeptList dcDeptList : dcDeptLists) {
String orgId = dbPz009.getLoginPrefix() + zbDept.getNodeId(); String orgId = dbPz009.getLoginPrefix() + dcDeptList.getNodeId();
Org dbOrg = HGXSTools.XsOrg.get(orgId); Org dbOrg = HGXSTools.XsOrg.get(orgId);
if (dbOrg == null) { if (dbOrg == null) {
dbOrg = new Org(); dbOrg = new Org();
dbOrg.setOrgId(orgId); dbOrg.setOrgId(orgId);
this.syncDcDeptAdd(accountCode, zbDept, dbOrg, dbPz009); this.syncDcDeptAdd(accountCode, dcDeptList, dbOrg, dbPz009);
} else { } else {
Map updateMap = new HashMap(); Map updateMap = new HashMap();
updateMap.put(Org.FIELD_ORG_ID, orgId); updateMap.put(Org.FIELD_ORG_ID, orgId);
updateMap.put(Org.FIELD_ORG_CNAME, zbDept.getNodeText()); updateMap.put(Org.FIELD_ORG_CNAME, dcDeptList.getNodeText());
updateMap.put(Org.FIELD_REC_REVISOR, "System"); updateMap.put(Org.FIELD_REC_REVISOR, "System");
updateMap.put(Org.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime()); updateMap.put(Org.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime());
updateMap.put(Org.FIELD_IS_DELETED, DeleteFlagEnum.UN_REMOVE.getCode().toString()); updateMap.put(Org.FIELD_IS_DELETED, DeleteFlagEnum.UN_REMOVE.getCode().toString());
...@@ -194,16 +194,16 @@ public class ServiceHGXSOrg extends ServiceBase { ...@@ -194,16 +194,16 @@ public class ServiceHGXSOrg extends ServiceBase {
* @param dbOrg * @param dbOrg
* @param dbPz009 * @param dbPz009
*/ */
private void syncDcDeptAdd(String accountCode, DcDeptList zbDept, Org dbOrg, HGPZ009 dbPz009) { private void syncDcDeptAdd(String accountCode, DcDeptList dcDeptList, Org dbOrg, HGPZ009 dbPz009) {
String orgId = dbOrg.getOrgId(); String orgId = dbOrg.getOrgId();
dbOrg.setAccountCode(accountCode); dbOrg.setAccountCode(accountCode);
dbOrg.setOrgEname(orgId); dbOrg.setOrgEname(orgId);
dbOrg.setOrgCname(zbDept.getNodeText()); dbOrg.setOrgCname(dcDeptList.getNodeText());
dbOrg.setOrgType(OrgTypeEnum.DEPT.getCode()); dbOrg.setOrgType(OrgTypeEnum.DEPT.getCode());
dbOrg.setParentOrgId("-1".equals(zbDept.getParentId()) dbOrg.setParentOrgId("-1".equals(dcDeptList.getParentId())
? accountCode : dbPz009.getLoginPrefix() + zbDept.getParentId()); ? accountCode : dbPz009.getLoginPrefix() + dcDeptList.getParentId());
dbOrg.setEstablishDate("20240101"); dbOrg.setEstablishDate("20240101");
dbOrg.setSortIndex(zbDept.getFullSort()); dbOrg.setSortIndex(dcDeptList.getFullSort());
dbOrg.setCompanyCode(accountCode); dbOrg.setCompanyCode(accountCode);
dbOrg.setCompanyName(dbPz009.getAccountName()); dbOrg.setCompanyName(dbPz009.getAccountName());
dbOrg.setRecCreator("System"); dbOrg.setRecCreator("System");
......
...@@ -238,12 +238,12 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -238,12 +238,12 @@ public class ServiceHGXSUser extends ServiceBase {
break; break;
} }
Pager<DcUserList> pager = DcOpenApi.userList(pageIndex); Pager<DcUserList> pager = DcOpenApi.userList(pageIndex);
List<DcUserList> zbUsers = pager.getData(); List<DcUserList> dcUserLists = pager.getData();
if (CollectionUtils.isEmpty(zbUsers) || pageIndex > pager.getTotalPages()) { if (CollectionUtils.isEmpty(dcUserLists) || pageIndex > pager.getTotalPages()) {
break; break;
} }
// 写入合同数据 // 写入合同数据
syncDcUserData(accountCode, zbUsers); syncDcUserData(accountCode, dcUserLists);
pageIndex++; pageIndex++;
} }
} }
...@@ -252,14 +252,14 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -252,14 +252,14 @@ public class ServiceHGXSUser extends ServiceBase {
* 写入用户信息 * 写入用户信息
* *
* @param accountCode * @param accountCode
* @param ZbUserLists * @param dcUserLists
*/ */
private void syncDcUserData(String accountCode, List<DcUserList> ZbUserLists) { private void syncDcUserData(String accountCode, List<DcUserList> dcUserLists) {
// 查询帐套信息 // 查询帐套信息
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode); HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
for (DcUserList zbUserList : ZbUserLists) { for (DcUserList dcUserList : dcUserLists) {
try { try {
syncDcUserSingle(dbPz009, zbUserList.getOrd()); syncDcUserSingle(dbPz009, dcUserList.getOrd());
} catch (Exception e) { } catch (Exception e) {
log.error("同步德诚用户失败:{}", e.getMessage(), e); log.error("同步德诚用户失败:{}", e.getMessage(), e);
} }
...@@ -281,7 +281,7 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -281,7 +281,7 @@ public class ServiceHGXSUser extends ServiceBase {
} }
String userId = dbPz009.getLoginPrefix() + ord; String userId = dbPz009.getLoginPrefix() + ord;
// 判断用户是否存在 // 判断用户是否存在
User dbUser = HGXSTools.XsUser.get(userId); User dbUser = HGXSTools.XsUser.getByLogin(userId);
if (dbUser == null) { if (dbUser == null) {
this.syncDcSingleUserAdd(zbUser, dbPz009, userId); this.syncDcSingleUserAdd(zbUser, dbPz009, userId);
} else { } else {
...@@ -297,8 +297,7 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -297,8 +297,7 @@ public class ServiceHGXSUser extends ServiceBase {
* @param userId * @param userId
* @throws Exception * @throws Exception
*/ */
private void syncDcSingleUserAdd(DcUser zbUser, HGPZ009 dbPz009, String userId) private void syncDcSingleUserAdd(DcUser zbUser, HGPZ009 dbPz009, String userId) throws Exception {
throws Exception {
// 新增用户 // 新增用户
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, zbUser.getName(), zbUser.getSex(), zbUser.getEmail(), HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, zbUser.getName(), zbUser.getSex(), zbUser.getEmail(),
zbUser.getCardid()); zbUser.getCardid());
......
...@@ -57,8 +57,7 @@ ...@@ -57,8 +57,7 @@
SELECT SELECT
<include refid="column"/> <include refid="column"/>
FROM ${platSchema}.TXSOG01 FROM ${platSchema}.TXSOG01
WHERE 1=1 WHERE ORG_ID = #orgId#
AND ORG_ID = #orgId#
</select> </select>
<!-- 查询组织信息 --> <!-- 查询组织信息 -->
......
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/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="HGXSUser"> <sqlMap namespace="HGXSUser">
<sql id="column">
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
</sql>
<sql id="condition"> <sql id="condition">
<isNotEmpty prepend=" AND " property="loginName"> <isNotEmpty prepend=" AND " property="loginName">
LOGIN_NAME = #loginName# LOGIN_NAME = #loginName#
...@@ -21,15 +31,17 @@ ...@@ -21,15 +31,17 @@
</sql> </sql>
<!-- 查询用户信息 --> <!-- 查询用户信息 -->
<select id="getByLogin" resultClass="com.baosight.hggp.hg.xs.domain.User">
SELECT
<include refid="column"/>
FROM ${platSchema}.XS_USER
WHERE LOGIN_NAME = #loginName#
</select>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hggp.hg.xs.domain.User"> <select id="query" resultClass="com.baosight.hggp.hg.xs.domain.User">
SELECT SELECT
USER_ID as "userId", <!-- 用户id --> <include refid="column"/>
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
FROM ${platSchema}.XS_USER FROM ${platSchema}.XS_USER
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
......
...@@ -121,11 +121,11 @@ public class HGXSTools { ...@@ -121,11 +121,11 @@ public class HGXSTools {
* *
* @return * @return
*/ */
public static User get(String loginName) { public static User getByLogin(String loginName) {
AssertUtils.isEmpty(loginName, "用户登录名不能为空"); AssertUtils.isEmpty(loginName, "用户登录名不能为空");
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("loginName", loginName); paramMap.put("loginName", loginName);
List<User> results = DaoBase.getInstance().query(HGSqlConstant.HgXsUser.QUERY, paramMap); List<User> results = DaoBase.getInstance().query(HGSqlConstant.HgXsUser.GET_BY_LOGIN, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0); return CollectionUtils.isEmpty(results) ? null : results.get(0);
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" sumType="page" <EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" sumType="page"
required="true"/> required="true"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="100" align="center" <EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="100" align="center"
required="true"> copy="true" required="true">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod"/> <EF:EFCodeOption codeName="hggp.cg.calculationMethod"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/> <EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
......
...@@ -108,7 +108,6 @@ $(function () { ...@@ -108,7 +108,6 @@ $(function () {
//系数 //系数
let coefficient = inventRecordBoxBlockId[i]['param10Field'] let coefficient = inventRecordBoxBlockId[i]['param10Field']
calUnitWeight(e.items[0],e.items[0].length,e.items[0].width,e.items[0].thick,coefficient); calUnitWeight(e.items[0],e.items[0].length,e.items[0].width,e.items[0].thick,coefficient);
break break
} }
} }
......
...@@ -49,12 +49,13 @@ ...@@ -49,12 +49,13 @@
sumType="page"/> sumType="page"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" width="120" align="right" format="{0:N3}" sumType="page" <EF:EFColumn ename="receiveWeight" cname="收货重量" width="120" align="right" format="{0:N3}" sumType="page"
required="true"/> required="true"/>
<EF:EFColumn ename="receiveUnitWeight" cname="收货单重" enable="false" width="120" align="right" <EF:EFColumn ename="receiveUnitWeight" cname="收货单重" width="120" align="right" format="{0:N3}"
format="{0:N3}"/> required="true"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="false" width="120" align="center"> <EF:EFComboColumn ename="calculationMethod" cname="计算方式" width="120" align="center" required="true"
copy="true">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod"/> <EF:EFCodeOption codeName="hggp.cg.calculationMethod"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" enable="false" width="120" align="right" format="{0:C3}"/> <EF:EFColumn ename="price" cname="单价" width="120" align="right" format="{0:C3}" required="true"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="120" align="right" format="{0:C3}" <EF:EFColumn ename="amount" cname="金额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/> sumType="page"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center"> <EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
......
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