Commit 5b81e3c8 by wancheng

app驾驶舱代码优化

parent dce7ab27
...@@ -318,6 +318,9 @@ public class ServiceHPMT003 extends ServiceBase { ...@@ -318,6 +318,9 @@ public class ServiceHPMT003 extends ServiceBase {
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("factorycode", factorycode); sqlMap.put("factorycode", factorycode);
List<Map> rows = this.dao.query("HPMT003.queryMaxDate", sqlMap); List<Map> rows = this.dao.query("HPMT003.queryMaxDate", sqlMap);
if(rows.get(0).get("registerDate")==null){
rows.get(0).put("registerDate",DateUtils.yesterday());
}
List<Map> maps = new ArrayList<>(); List<Map> maps = new ArrayList<>();
resultMap.put("result",rows); resultMap.put("result",rows);
resultMap.put("status",EiConstant.STATUS_SUCCESS); resultMap.put("status",EiConstant.STATUS_SUCCESS);
......
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
case when ifnull(YGL,0) = 0 then '0.00T' case when ifnull(YGL,0) = 0 then '0.00T'
else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as RJCL else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as RJCL
from (select from (select
(select count(*) FROM hpjx.T_HPPZ014 (select sum(USER_COUNT)
where COMPANY_CODE = #companyCode# and REG_DATE = #date# and FACTORY_CODE = #factorycode# FROM hpjx.t_hpsc008
group by FACTORY_CODE) as YGL, where COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode# ) as YGL,
0 as JHCL, 0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001 (select sum(WEIGHT)
where COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode# FROM hpjx.t_hpsc008
group by FACTORY_CODE) as SJCL where COMPANY_CODE = #companyCode# and REGISTER_DATE = #date# and FACTORY_CODE = #factorycode# ) as SJCL
from dual) a from dual) a
</select> </select>
...@@ -28,13 +28,11 @@ ...@@ -28,13 +28,11 @@
case when ifnull(YGL,0) = 0 then '0.00T' case when ifnull(YGL,0) = 0 then '0.00T'
else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as LJRJCL else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as LJRJCL
from (select from (select
(select count(*) FROM hpjx.T_HPPZ014 (select sum(USER_COUNT) FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and left(REG_DATE,6) = left(#date#,6) and REG_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,6) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# ) as YGL,
group by FACTORY_CODE,left(REG_DATE,6)) as YGL,
0 as JHCL, 0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001 (select sum(WEIGHT) FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,6) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,6) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# ) as SJCL
group by FACTORY_CODE,left(REGISTER_DATE,6)) as SJCL
from dual) a from dual) a
</select> </select>
...@@ -46,13 +44,15 @@ ...@@ -46,13 +44,15 @@
case when ifnull(YGL,0) = 0 then '0.00T' case when ifnull(YGL,0) = 0 then '0.00T'
else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as NLJRJCL else concat(format(ifnull(SJCL,0)/ifnull(YGL,0),2),'T') end as NLJRJCL
from (select from (select
(select count(*) FROM hpjx.T_HPPZ014 (select
where COMPANY_CODE = #companyCode# and left(REG_DATE,4) = left(#date#,4) and REG_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# sum(USER_COUNT)
group by FACTORY_CODE,left(REG_DATE,4)) as YGL, FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,4) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# ) as YGL,
0 as JHCL, 0 as JHCL,
(select sum(WEIGHT) FROM hpjx.T_HPXS001 (select
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,4) = left(#date#,4) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# sum(WEIGHT)
group by FACTORY_CODE,left(REGISTER_DATE,4)) as SJCL FROM hpjx.t_hpsc008
where COMPANY_CODE = #companyCode# and left(REGISTER_DATE,6) = left(#date#,4) and REGISTER_DATE <![CDATA[<=]]> #date# and FACTORY_CODE = #factorycode# ) as SJCL
from dual) a from dual) a
</select> </select>
......
...@@ -8,6 +8,7 @@ import com.baosight.hpjx.core.security.UserSessionUtils; ...@@ -8,6 +8,7 @@ import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ013; import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.sc.domain.HPSC008; import com.baosight.hpjx.hp.sc.domain.HPSC008;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.ErrorCodeUtils; import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants; import com.baosight.hpjx.util.contants.ACConstants;
...@@ -191,7 +192,12 @@ public class ServiceHPSC008 extends ServiceEPBase { ...@@ -191,7 +192,12 @@ public class ServiceHPSC008 extends ServiceEPBase {
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
List<Map> result = this.dao.query("HPSC008.queryMaxDate", sqlMap); List<Map> result = this.dao.query("HPSC008.queryMaxDate", sqlMap);
String registerDate = (String) result.get(0).get("registerDate"); String registerDate = "";
if(result==null||result.size()==0||result.get(0).get("registerDate")==null){
registerDate = DateUtils.yesterday();
}else{
registerDate = (String) result.get(0).get("registerDate");
}
registerDate = registerDate.substring(0,4)+"-"+registerDate.substring(4,6)+"-"+registerDate.substring(6,8); registerDate = registerDate.substring(0,4)+"-"+registerDate.substring(4,6)+"-"+registerDate.substring(6,8);
inInfo.set("registerDate",registerDate); inInfo.set("registerDate",registerDate);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
...@@ -62,6 +62,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -62,6 +62,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
} }
/** /**
* 获取前一天日期字符串(yyyy-MM-dd)
*
* @return
*/
public static String yesterday() {
return LocalDate.now().minusDays(1).format(DATE);
}
/**
* 获取日期字符串(yyyy-MM-dd) * 获取日期字符串(yyyy-MM-dd)
* *
* @return * @return
......
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