java110
2021-09-09 f3676b3cdd8d93a4d933a7356eac1a72a3041da0
优化代码
3个文件已添加
213 ■■■■■ 已修改文件
service-front/src/main/java/com/java110/front/components/undo/UndoComponent.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-front/src/main/java/com/java110/front/smo/undo/IUndoSMO.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-front/src/main/java/com/java110/front/smo/undo/impl/UndoSMOImpl.java 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-front/src/main/java/com/java110/front/components/undo/UndoComponent.java
New file
@@ -0,0 +1,37 @@
package com.java110.front.components.undo;
import com.java110.core.context.IPageData;
import com.java110.front.smo.store.IGetStoreSMO;
import com.java110.front.smo.store.IListStoreSMO;
import com.java110.front.smo.undo.IUndoSMO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
/**
 * 待办查询
 * <p>
 * add by wuxw
 * <p>
 * 2019-06-29
 */
@Component("undo")
public class UndoComponent {
    @Autowired
    private IUndoSMO undoSMOImpl;
    /**
     * 查询钥匙申请列表
     *
     * @param pd 页面数据封装
     * @return 返回 ResponseEntity 对象
     */
    public ResponseEntity<String> list(IPageData pd) {
        return undoSMOImpl.listUndos(pd);
    }
}
service-front/src/main/java/com/java110/front/smo/undo/IUndoSMO.java
New file
@@ -0,0 +1,33 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.front.smo.undo;
import com.java110.core.context.IPageData;
import com.java110.utils.exception.SMOException;
import org.springframework.http.ResponseEntity;
/**
 * @desc add by 吴学文 17:24
 */
public interface IUndoSMO {
    /**
     * 查询车辆进场信息
     * @param pd 页面数据封装
     * @return ResponseEntity 对象数据
     * @throws SMOException 业务代码层
     */
    ResponseEntity<String> listUndos(IPageData pd) throws SMOException;
}
service-front/src/main/java/com/java110/front/smo/undo/impl/UndoSMOImpl.java
New file
@@ -0,0 +1,143 @@
package com.java110.front.smo.undo.impl;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.component.AbstractComponentSMO;
import com.java110.core.context.IPageData;
import com.java110.entity.component.ComponentValidateResult;
import com.java110.front.smo.undo.IUndoSMO;
import com.java110.utils.constant.ServiceConstant;
import com.java110.utils.exception.SMOException;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
/**
 * 查询carInout服务类
 */
@Service("undoSMOImpl")
public class UndoSMOImpl extends AbstractComponentSMO implements IUndoSMO {
    @Autowired
    private RestTemplate restTemplate;
    @Override
    public ResponseEntity<String> listUndos(IPageData pd) throws SMOException {
        return businessProcess(pd);
    }
    @Override
    protected void validate(IPageData pd, JSONObject paramIn) {
        //Assert.hasKeyAndValue(paramIn, "communityId", "必填,请填写小区信息");
        super.validatePageInfo(pd);
        //super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.AGENT_HAS_LIST_CARINOUT);
    }
    @Override
    protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) {
        ComponentValidateResult result = super.validateStoreStaffCommunityRelationship(pd, restTemplate);
        paramIn.put("storeId", result.getStoreId());
        paramIn.put("userId", result.getUserId());
        paramIn.put("staffId", result.getUserId());
        JSONObject doing = new JSONObject();
        //查询 报修待办
        String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/ownerRepair.listStaffRepairs" + mapToUrlParam(paramIn);
        ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "",
                apiUrl,
                HttpMethod.GET);
        if (responseEntity.getStatusCode() == HttpStatus.OK) {
            JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
            doing.put("repair", paramOut.getString("total"));
        } else {
            doing.put("repair", "0");
        }
        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/auditUser.listAuditComplaints" + mapToUrlParam(paramIn);
        responseEntity = this.callCenterService(restTemplate, pd, "",
                apiUrl,
                HttpMethod.GET);
        if (responseEntity.getStatusCode() == HttpStatus.OK) {
            JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
            doing.put("complaint", paramOut.getString("total"));
        } else {
            doing.put("complaint", "0");
        }
        //采购待办
        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/auditUser.listAuditOrders" + mapToUrlParam(paramIn);
        responseEntity = this.callCenterService(restTemplate, pd, "",
                apiUrl,
                HttpMethod.GET);
        if (responseEntity.getStatusCode() == HttpStatus.OK) {
            JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
            doing.put("purchase", paramOut.getString("total"));
        } else {
            doing.put("purchase", "0");
        }
        //物品领用待办
        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/collection/getCollectionAuditOrder" + mapToUrlParam(paramIn);
        responseEntity = this.callCenterService(restTemplate, pd, "",
                apiUrl,
                HttpMethod.GET);
        if (responseEntity.getStatusCode() == HttpStatus.OK) {
            JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
            doing.put("collection", paramOut.getString("total"));
        } else {
            doing.put("collection", "0");
        }
        //contract/queryContractTask
        //合同起草待办
        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/contract/queryContractTask" + mapToUrlParam(paramIn);
        responseEntity = this.callCenterService(restTemplate, pd, "",
                apiUrl,
                HttpMethod.GET);
        if (responseEntity.getStatusCode() == HttpStatus.OK) {
            JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
            doing.put("contractApply", paramOut.getString("total"));
        } else {
            doing.put("contractApply", "0");
        }
        //contract/queryContractTask
        //合同变更
        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/contract/queryContractChangeTask" + mapToUrlParam(paramIn);
        responseEntity = this.callCenterService(restTemplate, pd, "",
                apiUrl,
                HttpMethod.GET);
        if (responseEntity.getStatusCode() == HttpStatus.OK) {
            JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
            doing.put("contractChange", paramOut.getString("total"));
        } else {
            doing.put("contractChange", "0");
        }
        //合同变更
        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/resourceStore.listAllocationStoreAuditOrders" + mapToUrlParam(paramIn);
        responseEntity = this.callCenterService(restTemplate, pd, "",
                apiUrl,
                HttpMethod.GET);
        if (responseEntity.getStatusCode() == HttpStatus.OK) {
            JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
            doing.put("allocation", paramOut.getString("total"));
        } else {
            doing.put("allocation", "0");
        }
        return ResultVo.createResponseEntity(doing);
    }
    public RestTemplate getRestTemplate() {
        return restTemplate;
    }
    public void setRestTemplate(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }
}