Commit fe217118 authored by 38823's avatar 38823

机易查优化

parent 2a7d4461
......@@ -2,17 +2,20 @@ package com.hand.hls.hlcm.hlinteface.controllers;
import com.alibaba.fastjson.JSONObject;
import com.hand.hap.system.controllers.BaseController;
import com.hand.hls.hlcm.hlinteface.mapper.JYCInterfaceMapper;
import leaf.database.service.DatabaseServiceFactory;
import leaf.utils.ObjectRegistryHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import com.google.common.util.concurrent.RateLimiter;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import leaf.database.service.BusinessModelService;
import uncertain.composite.CompositeMap;
import java.io.IOException;
......@@ -24,6 +27,8 @@ public class JYCInterfaceController extends BaseController {
private static final String WJ="wj";
private static final String BM_PATH="cont.jyc_equno_query" ;
private static final String WJFL_FIELD="WJFL" ;
@Autowired
JYCInterfaceMapper jYCInterfaceMapper;
DatabaseServiceFactory dsf = ObjectRegistryHolder.getInstanceOfType(DatabaseServiceFactory.class);
CompositeMap context = new CompositeMap();
public boolean checkInterfacePara(String equNo,String type,String reqClientIp,JSONObject resultjson){
......@@ -68,26 +73,23 @@ public class JYCInterfaceController extends BaseController {
if (equNo != null) {
param.put("machine_number", equNo);
}
BusinessModelService bms = dsf.getModelService(BM_PATH, context);
CompositeMap result = bms.queryAsMap(param);
//BusinessModelService bms = dsf.getModelService(BM_PATH, context);
List<Map> result = jYCInterfaceMapper.selectJycList(equNo);
if (result != null) {
List<CompositeMap> valueList = result.getChilds();
if (valueList != null) {
if(valueList.size()>0){
Map map = result.get(0);
if (!ObjectUtils.isEmpty(map)) {
existsFlag = true;
CompositeMap child=valueList.get(0);
JSONObject JYCResponseBody= new JSONObject();
JYCResponseBody.put("equNm",child.getString("equnm"));
JYCResponseBody.put("brandName",child.getString("brandname"));
JYCResponseBody.put("equMdl",child.getString("equmdl"));
JYCResponseBody.put("vinNo",child.getString("vinno"));
JYCResponseBody.put("machineNo",child.getString("machineno"));
JYCResponseBody.put("status",child.getString("status"));
JYCResponseBody.put("equNm",map.get("EQUNM"));
JYCResponseBody.put("brandName",map.get("BRANDNAME"));
JYCResponseBody.put("equMdl",map.get("EQUMDL"));
JYCResponseBody.put("vinNo",map.get("VINNO"));
JYCResponseBody.put("machineNo",map.get("MACHINENO"));
JYCResponseBody.put("status",map.get("STATUS"));
JYCResponseBody.put("platform",WJFL_FIELD);
resultjson.put("JYCResponseBody",JYCResponseBody);
resultjson.put("ResponseCode","01");
resultjson.put("ResponseMsg","交易正常");
}
/*for (CompositeMap child : valueList) {3
existsFlag = true;
if (child == null) {
......
package com.hand.hls.hlcm.hlinteface.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public interface JYCInterfaceMapper {
public List<Map> selectJycList(@Param("machineNumber") String machineNumber);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hand.hls.hlcm.hlinteface.mapper.JYCInterfaceMapper">
<select id="selectJycList" parameterType="java.lang.String" resultType="java.util.Map">
select nvl(t2.equnm,'') equnm,
nvl(t2.brandname,'')brandname,
nvl(t2.equmdl,'')equmdl,
nvl(t2.vinno,'')vinno,
nvl(t2.machineno,'')machineno,
t2.status
from (select t1.*
from (
select li.LEASE_NAME equnm,
li.brand_value brandname,
li.PATTERN equmdl,
nvl(li.machine_number, li.machine_number_70) vinno,
cc.sign_contract_status sign_contract_status,
null machineno,
CASE
WHEN CC.CONTRACT_STATUS = 'NEW' and
cc.sign_contract_status in ('SIGN','SIGNING') then
'2'
else '2' end status,
cc.creation_date creation_date
from con_contract cc, prj_project_lease_item li
where cc.project_id = li.project_id
and cc.data_class = 'NORMAL'
and cc.contract_status not in ('TERMINATE','ET','REPUR','CANCEL','TERMINATING')
and cc.sign_contract_status not in ('NEW','SIGN_RETURN')
and cc.division != '95'
and (li.machine_number=#{machineNumber} or li.machine_number_70=#{machineNumber})
union
select lil.ASSET_NAME equnm,
li.brand_value brandname,
lil.SPECIFICATION equmdl,
lil.ASSET_NUM vinno,
cc.sign_contract_status sign_contract_status,
null machineno,
CASE
WHEN CC.CONTRACT_STATUS = 'NEW' and
cc.sign_contract_status in ('SIGN','SIGNING') then
'2'
else '2' end status,
cc.creation_date creation_date
from con_contract cc,
prj_project_lease_item li,
prj_project_lease_item_list lil
where cc.project_id = li.project_id
and cc.data_class = 'NORMAL'
and cc.contract_status not in ('TERMINATE','ET','REPUR','CANCEL','TERMINATING')
and cc.sign_contract_status not in ('NEW','SIGN_RETURN')
and li.project_lease_item_id = lil.project_lease_item_id
and cc.division != '95'
and lil.ASSET_NUM=#{machineNumber}
) t1
order by nvl(t1.creation_date, to_date('2000-01-01', 'yyyy-mm-dd')) desc) t2
where rownum = 1
</select>
</mapper>
\ No newline at end of file
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