zhang
5 天以前 29aa7746640d7d0c0f01f3e0d3f23ef3250086a7
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/CodeServiceImpl.java
@@ -18,6 +18,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -53,6 +54,9 @@
        Code code = CODE_ID_CACHE.get(id);
        if (code == null) {
            code = this.getById(id);
            if (code != null) {
                CODE_ID_CACHE.put(id, code);
            }
        }
        return code;
    }
@@ -62,6 +66,9 @@
        Code code = CODE_DATA_CACHE.get(data);
        if (code == null) {
            code = this.selectByData(data);
            if (null != code) {
                CODE_DATA_CACHE.put(data, code);
            }
        }
        return code;
    }
@@ -172,8 +179,8 @@
        Double maxY = Double.parseDouble(String.valueOf(map.get("max_y")));
        // 缩放后需要的偏移量
        double scaleOffsetX = width *  (1 -CodeUtils.ADAPTATION_SCALE) / 2;
        double scaleOffsetY = height *  (1 -CodeUtils.ADAPTATION_SCALE) / 2;
        double scaleOffsetX = width * (1 - CodeUtils.ADAPTATION_SCALE) / 2;
        double scaleOffsetY = height * (1 - CodeUtils.ADAPTATION_SCALE) / 2;
        List<Code> codeList = this.list();
        for (Code code : codeList) {
@@ -201,4 +208,18 @@
        return this.baseMapper.selectDistinctCountFromY();
    }
    @Override
    public List<Code> getAllLocCode() {
        List<Long> ids = this.baseMapper.selectAllLocCode();
        List<Code> codeList = new ArrayList<>();
        for (Long id : ids) {
            Code byId = this.getById(id);
            if (byId != null) {
                codeList.add(byId);
            }
        }
        return codeList;
    }
}