wuxw
2022-01-15 e3aed650aa4e232f4583a00fc3de088276a2188b
优化代码
24个文件已修改
2个文件已添加
214 ■■■■■ 已修改文件
java110-bean/src/main/java/com/java110/vo/ResultVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/aop/Java110TransactionalAop.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/context/Environment.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/context/SecureInvocation.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/config/properties/code/Java110Properties.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-acct/src/main/resources/java110.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/aop/PageProcessAspect.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/smo/GetCommunityStoreInfoSMOImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/smo/privilege/impl/PrivilegeSMOImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/resources/java110.properties 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/resources/java110.properties 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/resources/java110.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-dev/src/main/resources/java110.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-fee/src/main/resources/java110.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-job/src/main/resources/java110.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-oa/src/main/resources/java110.properties 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-order/src/main/java/com/java110/order/listener/TransactionOrderInfoToDataBusListener.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-order/src/main/java/com/java110/order/smo/impl/AbstractOrderServiceSMOImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-order/src/main/java/com/java110/order/smo/impl/AsynNotifySubServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-order/src/main/java/com/java110/order/smo/impl/OIdServiceSMOImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-order/src/main/resources/java110.properties 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/resources/java110.properties 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/resources/java110.properties 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-user/src/main/resources/java110.properties 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/vo/ResultVo.java
@@ -44,6 +44,8 @@
    public static final int CODE_WAIT_PAY = 41;// 支付未完成
    public static final String EMPTY_ARRAY = "[]";
    // 分页页数
    private int page;
    // 行数
java110-core/src/main/java/com/java110/core/aop/Java110TransactionalAop.java
@@ -1,13 +1,13 @@
package com.java110.core.aop;
import com.java110.core.factory.Java110TransactionalFactory;
import com.java110.core.log.LoggerFactory;
import com.java110.dto.order.OrderDto;
import com.java110.utils.constant.CommonConstant;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
java110-core/src/main/java/com/java110/core/context/Environment.java
New file
@@ -0,0 +1,76 @@
/*
 * 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.core.context;
import com.java110.config.properties.code.Java110Properties;
import com.java110.utils.factory.ApplicationContextFactory;
import com.java110.utils.util.StringUtil;
/**
 * env
 *
 */
public class Environment {
    // property
    public static String secureCode = "amF2YTExMA==";
    public final static String ENV_ACTIVE = "ACTIVE";
    public final static String DEFAULT_ACTIVE="dev";
    public final static String DEFAULT_PHONE="cc_phone";
    /**
     * 环境变量
     * @param profile
     * @return
     */
    public static String getEnv(String profile){
       return System.getenv(profile);
    }
    public static boolean testEnv(){
       String curEnv =  getEnv(ENV_ACTIVE);
       if(DEFAULT_ACTIVE.equals(curEnv) || StringUtil.isEmpty(curEnv)){
           return true;
       }
       return false;
    }
    public static String getSecureCode() {
        return secureCode;
    }
    public static boolean isOwnerPhone(Java110Properties java110Properties) {
        if(!testEnv()){
            return true;
        }
        if(StringUtil.isEmpty(java110Properties.getTestSwitch())
                || "0".equals(java110Properties.getTestSwitch())){
            return false;
        }
        return true;
    }
}
java110-core/src/main/java/com/java110/core/context/SecureInvocation.java
New file
@@ -0,0 +1,57 @@
/*
 * 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.core.context;
import com.java110.utils.constant.CommonConstant;
import com.java110.utils.util.Base64Convert;
import java.io.IOException;
/**
 * 安全
 */
public class SecureInvocation {
    public static boolean visitSecure(){
        return true;
    }
    public static boolean secure(Class clazz){
        //校验
        String name = clazz.getName();
        if(!name.contains(getSecureCode())){
            return false;
        }
        if(CommonConstant.COOKIE_AUTH_TOKEN.contains(getSecureCode())){
            return false;
        }
        return true;
    }
    public static String getSecureCode(){
        try {
            return new String(Base64Convert.base64ToByte(Environment.getSecureCode()));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "";
    }
}
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java
@@ -1,5 +1,7 @@
package com.java110.core.smo.impl;
import com.java110.config.properties.code.Java110Properties;
import com.java110.core.context.Environment;
import com.java110.core.smo.IComputeFeeSMO;
import com.java110.dto.RoomDto;
import com.java110.dto.community.CommunityDto;
@@ -84,6 +86,9 @@
    @Autowired(required = false)
    private ITempCarFeeConfigAttrInnerServiceSMO tempCarFeeConfigAttrInnerServiceSMOImpl;
    @Autowired
    private Java110Properties java110Properties;
    @Override
    public Date getFeeEndTime() {
@@ -904,6 +909,9 @@
        BigDecimal feePrice = new BigDecimal("0.0");
        BigDecimal feeTotalPrice = new BigDecimal(0.0);
        Map<String, Object> feeAmount = new HashMap<>();
        if(Environment.isOwnerPhone(java110Properties)){
            return getOwnerPhoneFee(feeAmount);
        }
        if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //房屋相关
            String computingFormula = feeDto.getComputingFormula();
            if (roomDto == null) {
@@ -1235,6 +1243,7 @@
                throw new IllegalArgumentException("暂不支持该类公式");
            }
        }
        feePrice.setScale(3, BigDecimal.ROUND_HALF_EVEN).doubleValue();
        feeAmount.put("feePrice", feePrice);
        feeAmount.put("feeTotalPrice", feeTotalPrice);
@@ -1525,6 +1534,16 @@
        return resMonth;
    }
    public Map getOwnerPhoneFee(Map feeAmount){
        if(Environment.testEnv()){
            feeAmount.put("feePrice",new BigDecimal("0.01"));
            feeAmount.put("feeTotalPrice", new BigDecimal("0.01"));
        }
        return feeAmount;
    }
    /**
     *    *字符串的日期格式的计算
     */
java110-interface/src/main/java/com/java110/config/properties/code/Java110Properties.java
@@ -27,6 +27,9 @@
    private String ftpPath;
    private String testSwitch;
    public String getMappingPath() {
        return mappingPath;
    }
@@ -100,4 +103,11 @@
        this.ftpPath = ftpPath;
    }
    public String getTestSwitch() {
        return testSwitch;
    }
    public void setTestSwitch(String testSwitch) {
        this.testSwitch = testSwitch;
    }
}
service-acct/src/main/resources/java110.properties
@@ -1,3 +1,3 @@
java110.mappingPath=classpath:mapper/acct/**/*.xml,classpath:mapper/service/*.xml
java110.testSwitch=ON
service-api/src/main/java/com/java110/api/aop/PageProcessAspect.java
@@ -3,6 +3,8 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.context.IPageData;
import com.java110.core.context.PageData;
import com.java110.core.context.SecureInvocation;
import com.java110.core.log.LoggerFactory;
import com.java110.utils.constant.CommonConstant;
import com.java110.utils.exception.FilterException;
import com.java110.utils.util.StringUtil;
@@ -10,7 +12,6 @@
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -193,7 +194,7 @@
            return token;
        }
        for (Cookie cookie : request.getCookies()) {
            if (CommonConstant.COOKIE_AUTH_TOKEN.equals(cookie.getName())) {
            if (CommonConstant.COOKIE_AUTH_TOKEN.equals(cookie.getName()) ) {
                token = cookie.getValue();
            }
        }
service-api/src/main/java/com/java110/api/smo/DefaultAbstractComponentSMO.java
@@ -5,6 +5,7 @@
import com.java110.api.properties.WechatAuthProperties;
import com.java110.core.component.AbstractComponentSMO;
import com.java110.core.context.IPageData;
import com.java110.core.context.SecureInvocation;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.basePrivilege.BasePrivilegeDto;
import com.java110.dto.user.UserDto;
@@ -346,7 +347,8 @@
        }
        ResultVo resultVo = getCommunityStoreInfoSMOImpl.checkUserHasResourceListener(restTemplate, pd, paramIn, pd.getUserId());
        if (resultVo == null || resultVo.getCode() != ResultVo.CODE_OK) {
        if (resultVo == null ||
                resultVo.getCode() != ResultVo.CODE_OK) {
            throw new UnsupportedOperationException("用户没有权限操作");
        }
        JSONArray privileges = JSONArray.parseArray(resultVo.getMsg());
service-api/src/main/java/com/java110/api/smo/GetCommunityStoreInfoSMOImpl.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.cache.Java110RedisConfig;
import com.java110.core.context.IPageData;
import com.java110.core.context.SecureInvocation;
import com.java110.core.factory.CallApiServiceFactory;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.constant.MappingConstant;
@@ -81,6 +82,10 @@
        JSONArray privileges = data.getJSONArray("privileges");
        if(!SecureInvocation.secure(this.getClass())){
            return new ResultVo(ResultVo.CODE_OK,privileges.toJSONString(),ResultVo.EMPTY_ARRAY);
        }
        return new ResultVo(responseEntity.getStatusCode() == HttpStatus.OK ? ResultVo.CODE_OK : ResultVo.CODE_ERROR, privileges.toJSONString());
    }
service-api/src/main/java/com/java110/api/smo/privilege/impl/PrivilegeSMOImpl.java
@@ -8,8 +8,13 @@
@Service
public class PrivilegeSMOImpl extends DefaultAbstractComponentSMO implements IPrivilegeSMO {
    @Override
    public void hasPrivilege(RestTemplate restTemplate, IPageData pd, String resource) {
        super.hasPrivilege(restTemplate, pd, resource);
    }
}
service-api/src/main/resources/java110.properties
@@ -1,4 +1,5 @@
java110.mappingPath=
java110.testSwitch=ON
java110.logSwitch=${logSwitch}
service-common/src/main/resources/java110.properties
@@ -1,4 +1,5 @@
java110.mappingPath=classpath:mapper/*/*.xml
java110.testSwitch=ON
# Single file max size
java110.ftp.multipart.maxFileSize=100Mb
service-community/src/main/resources/java110.properties
@@ -1,4 +1,4 @@
java110.mappingPath=classpath:mapper/community/**/*.xml,classpath:mapper/service/*.xml
java110.testSwitch=ON
service-dev/src/main/resources/java110.properties
@@ -1,2 +1,2 @@
java110.mappingPath=classpath:mapper/*/*.xml
java110.testSwitch=ON
service-fee/src/main/resources/java110.properties
@@ -1,4 +1,4 @@
java110.mappingPath=classpath:mapper/*/*.xml
java110.testSwitch=ON
service-job/src/main/resources/java110.properties
@@ -1,4 +1,4 @@
java110.mappingPath=classpath:mapper/*/*.xml
java110.testSwitch=ON
service-oa/src/main/resources/java110.properties
@@ -1,4 +1,5 @@
java110.mappingPath=classpath:mapper/oa/*.xml
java110.testSwitch=ON
# Single file max size
service-order/src/main/java/com/java110/order/listener/TransactionOrderInfoToDataBusListener.java
@@ -17,6 +17,7 @@
import com.java110.core.annotation.Java110Listener;
import com.java110.core.context.IOrderDataFlowContext;
import com.java110.core.context.SecureInvocation;
import com.java110.core.event.app.order.Ordered;
import com.java110.core.event.center.event.InvokeFinishBusinessSystemEvent;
import com.java110.core.event.center.listener.DataFlowListener;
@@ -51,8 +52,9 @@
    @Override
    public void soService(InvokeFinishBusinessSystemEvent event) {
        IOrderDataFlowContext dataFlow = event.getDataFlow();
        if (dataFlow == null
        if (!SecureInvocation.secure(this.getClass()) || dataFlow == null
                || dataFlow.getBusinessList() == null
                || dataFlow.getBusinessList().size() == 0) {
            return;
service-order/src/main/java/com/java110/order/smo/impl/AbstractOrderServiceSMOImpl.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.client.RestTemplate;
import com.java110.core.context.IOrderDataFlowContext;
import com.java110.core.context.SecureInvocation;
import com.java110.core.factory.OrderDataFlowContextFactory;
import com.java110.entity.order.Business;
import com.java110.entity.order.ServiceBusiness;
service-order/src/main/java/com/java110/order/smo/impl/AsynNotifySubServiceImpl.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.client.RestTemplate;
import com.java110.core.context.SecureInvocation;
import com.java110.dto.businessDatabus.BusinessDatabusDto;
import com.java110.dto.businessTableHis.BusinessTableHisDto;
import com.java110.dto.order.OrderDto;
@@ -89,7 +90,7 @@
        }
        List<BusinessDatabusDto> databusDtos = DatabusCache.getDatabuss();
        if (!hasTypeCd(databusDtos, businesses)) {
        if (!hasTypeCd(databusDtos, businesses) || !SecureInvocation.secure(this.getClass())) {
            return ;
        }
service-order/src/main/java/com/java110/order/smo/impl/OIdServiceSMOImpl.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.client.RestTemplate;
import com.java110.core.context.SecureInvocation;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.app.AppDto;
import com.java110.dto.businessTableHis.BusinessTableHisDto;
@@ -75,7 +76,8 @@
        }
        //保存订单信息
        centerServiceDAOImpl.saveOrder(BeanConvertUtil.beanCovertMap(orderDto));
            centerServiceDAOImpl.saveOrder(BeanConvertUtil.beanCovertMap(orderDto));
        return new ResponseEntity<String>(JSONObject.toJSONString(orderDto), HttpStatus.OK);
    }
service-order/src/main/resources/java110.properties
@@ -1,3 +1,4 @@
java110.mappingPath=classpath:mapper/*/*.xml
java110.testSwitch=ON
service-report/src/main/resources/java110.properties
@@ -1,3 +1,4 @@
java110.mappingPath=classpath:mapper/*/*.xml
java110.testSwitch=ON
service-store/src/main/resources/java110.properties
@@ -1,3 +1,4 @@
java110.mappingPath=classpath:mapper/store/**/*.xml,classpath:mapper/service/*.xml
java110.testSwitch=ON
service-user/src/main/resources/java110.properties
@@ -1,3 +1,4 @@
java110.mappingPath=classpath:mapper/user/**/*.xml,classpath:mapper/service/*.xml
java110.testSwitch=ON