增加鸿鹏机械APP接口的目录和部分相关代码

parent 8fef1e5d
package com.baosight.hpjx.hp.mt.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
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.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 鸿鹏机械APP移动端接口调用处
*/
public class ServiceHPMT001 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 生产管理-整体概览
*
* @param inInfo
* @return
*/
public EiInfo pmOverview(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String queryMonth = MapUtils.getString(queryMap, "queryMonth");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("queryMonth", queryMonth);
sqlMap.put("companyCode", companyCode);
List<Map> row1 = this.dao.query("HPMT001.pmOverview1", sqlMap);
List<Map> row2 = this.dao.query("HPMT001.pmOverview2", sqlMap);
List<Map> rows = new ArrayList<>();
Map resultMap = new HashMap();
if (BeanUtil.isEmpty(row1.get(0))) {
resultMap.put("targetWt", 0);
} else {
resultMap.put("targetWt", row1.get(0).get("targetWt"));
}
if (BeanUtil.isEmpty(row2.get(0))) {
resultMap.put("actualWt", 0);
} else {
resultMap.put("actualWt", row2.get(0).get("actualWt"));
}
rows.add(resultMap);
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
return outInfo;
}
/**
* 生产管理-基地对标
*
* @param inInfo
* @return
*/
public EiInfo pmBenchmarking(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String queryMonth = MapUtils.getString(queryMap, "queryMonth");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("queryMonth", queryMonth);
sqlMap.put("companyCode", companyCode);
List<Map> rows = this.dao.query("HPMT001.pmBenchmarking", sqlMap);
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows);
outInfo.setBlock(eiBlock);
return outInfo;
}
}
<?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="HPMT001">
<select id="pmOverview1" resultClass="java.util.HashMap">
SELECT
CAST(SUM(NUM*UNIT_WT) AS DECIMAL(15,3)) AS targetWt
FROM
hpjx.t_hpsc004
WHERE
PROJ_CODE IN
(
SELECT
PROJ_CODE
FROM
(
SELECT
COMPANY_CODE,
PROJ_CODE,
REPLACE(PLAN_COMPLETION_DATE,'/','') AS PLAN_COMPLETION_DATE
FROM
hpjx.t_hpsc003
WHERE
LENGTH(PLAN_COMPLETION_DATE) > 6
) AS T
WHERE
SUBSTR(PLAN_COMPLETION_DATE,1,6) = #queryMonth#
AND COMPANY_CODE = #companyCode#
)
</select>
<select id="pmOverview2" resultClass="java.util.HashMap">
SELECT
CAST(SUM(AMOUNT*WEIGHT) AS DECIMAL(15,3)) AS actualWt
FROM
hpjx.t_hpkc003
WHERE
SUBSTR(DOCUMENT_DATE,1,6) = #queryMonth#
AND COMPANY_CODE = #companyCode#
</select>
<select id="pmBenchmarking" resultClass="java.util.HashMap">
SELECT
T1.DOCUMENT_DATE,
T1.FACTORY_NAME,
SUM(T1.ACTUAL_TOTAL_AMOUNT) AS ACTUAL_TOTAL_AMOUNT,
SUM(T1.ACTUAL_TOTAL_WT) AS ACTUAL_TOTAL_WT,
SUM(T2.TARGET_TOTAL_WT) AS TARGET_TOTAL_WT
FROM
(
SELECT
SUBSTR(T1.DOCUMENT_DATE,1,6) AS DOCUMENT_DATE,
T1.PROJ_CODE,
T1.PROJ_NAME,
T2.FACTORY_NAME,
SUM(T1.AMOUNT) AS ACTUAL_TOTAL_AMOUNT,
SUM(T1.WEIGHT) AS ACTUAL_TOTAL_WT
FROM
hpjx.t_hpkc003 AS T1
LEFT JOIN
(
SELECT
PROD_ORDER_NO,
FACTORY_NAME
FROM
hpjx.t_hpsc005a
WHERE
COMPANY_CODE = #companyCode#
GROUP BY
PROD_ORDER_NO) AS T2
ON
T1.PROD_ORDER_NO = T2.PROD_ORDER_NO
WHERE
SUBSTR(T1.DOCUMENT_DATE,1,6) = #queryMonth#
GROUP BY
T1.PROJ_CODE ) AS T1
LEFT JOIN
(
SELECT
PROJ_CODE,
CAST(SUM(NUM*UNIT_WT) AS DECIMAL(15,3)) AS TARGET_TOTAL_WT
FROM
hpjx.t_hpsc004
WHERE
PROJ_CODE IN
(
SELECT
PROJ_CODE
FROM
(
SELECT
COMPANY_CODE,
PROJ_CODE,
REPLACE(PLAN_COMPLETION_DATE,'/','') AS PLAN_COMPLETION_DATE
FROM
hpjx.t_hpsc003
WHERE
LENGTH(PLAN_COMPLETION_DATE) > 6) AS T
WHERE
SUBSTR(PLAN_COMPLETION_DATE,1,6) = #queryMonth#
AND COMPANY_CODE = #companyCode#)
GROUP BY
PROJ_CODE ) AS T2
ON
T1.PROJ_CODE = T2.PROJ_CODE
GROUP BY
T1.FACTORY_NAME
</select>
</sqlMap>
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