Merge remote-tracking branch 'origin/master'

This commit is contained in:
yuyang 2022-03-03 14:21:03 +08:00
commit 1d6b47cb7e
13 changed files with 43 additions and 15 deletions

View File

@ -1,6 +1,7 @@
package com.xhpc.card.mapper;
import com.xhpc.card.pojo.XhpcOperator;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -36,4 +37,13 @@ public interface XhpcOperatorMapper {
*/
List<XhpcOperator> selectAll(String tenantId);
/**
* query XhpcOperator according corpNo
*
* @author WH
* @date 2022/3/2 14:57
* @since version-1.0
*/
XhpcOperator selectOneByCorpNoAndTenantId(@Param("corpNo") String corpNo, @Param("tenantId") String tenantId);
}

View File

@ -355,7 +355,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
case 3:
XhpcCustomersPersonnel xhpcCustomersPersonnel = xhpcCustomersPersonnelMapper.selectByAccount(bindCardInfo.getUserAccount());
Long customersId = xhpcCustomersPersonnel.getCustomersId();
xhpcCustomersPersonnel.setCustomersId(customersId);
xhpcIcCardInfo.setUserId(customersId);
break;
default:
return R.fail("没有此用户类型");
@ -508,7 +508,7 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
String log = tIccardLog.getLog();
CardLogInfo cardLogInfo = JSONUtil.toBean(log, CardLogInfo.class);
CardLogInfo.CardInfoDTO cardInfo = cardLogInfo.getCardInfo();
XhpcOperator operator = xhpcOperatorMapper.selectByPrimaryKey(Long.valueOf(cardInfo.getCorpNo()));
XhpcOperator operator = xhpcOperatorMapper.selectOneByCorpNoAndTenantId(cardInfo.getCorpNo(), tokenService.getLoginUser().getSysUser().getTenantId());
dataDTO.setGrantOperatorName(operator.getName());
dataDTO.setCardSerialNumber(tIccardLog.getUniqueid());
dataDTO.setOperate(Integer.valueOf(tIccardLog.getOperate()));

View File

@ -58,7 +58,7 @@
and account like concat('%',#{queryCondition.userAccount},'%')
</if>
<if test="userIdList!=null and userIdList.size()!=0">
and communitiy_personnel_id not in
and community_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
@ -74,7 +74,7 @@
and account like concat('%',#{queryCondition.userAccount},'%')
</if>
<if test="userIdList!=null and userIdList.size()!=0">
and communitiy_personnel_id not in
and community_personnel_id not in
<foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>

View File

@ -60,6 +60,14 @@
FROM xhpc_operator
where tenant_id = #{tenantId}
</select>
<select id="selectOneByCorpNoAndTenantId" resultType="com.xhpc.card.pojo.XhpcOperator">
select
<include refid="Base_Column_List"/>
from xhpc_operator
where
corp_no = #{corpNo}
and tenant_id = #{tenantId}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from xhpc_operator

View File

@ -87,7 +87,7 @@
xhpc_invoice
<where>
del_flag IS NULL
<if test="creator!=null">
<if test="creator!=null and creator!='' ">
and creator = #{creator}
</if>
<if test="creatorType!=null">

View File

@ -59,7 +59,7 @@ public class OrderDataLogic implements ServiceLogic {
REDIS.setCacheMap(gunkey, cacheGun);
Long rdtime = (Long) cacheOrder.get("rdtime");
Map<String, Object> cachePile = REDIS.getCacheMap("pile:".concat(orderData.getPileNo()));
if (cachePile.get("version").equals("0B")) {
if (cachePile.get("version").equals("0C")) {
final String hex = orderData.getHex();
String cdhex = hex.substring(0xA2 * 2 + 4, hex.length() - 4);
if (cdhex.length() > 0) {

View File

@ -66,7 +66,7 @@ public class RateModelRequestLogic implements ServiceLogic {
String rateModel = translate(cacheRateModel);
String skey = "pile:".concat(pileNo).concat(".seqhex");
String resultStr;
if ("0A".equals(version))
if (!"0C".equals(version))
resultStr = "685E".concat(seqHex(skey)).concat(svc).concat(pileNo).concat(String.format("%04X",
stationRateModelId)).concat(rateModel);
else

View File

@ -52,7 +52,7 @@ public class RateModelValidateLogic implements ServiceLogic {
String hexCode = ServiceResult.HEX_00;
Long rateModelId;
String version = (String) cachePile.get("version");
if ("0A".equals(version)) rateModelId = Long.valueOf(Integer.parseInt(rateModelIdStr, 16));
if ("0C".equals(version)) rateModelId = Long.valueOf(HexUtils.reverseHexInt(rateModelIdStr));
else rateModelId = Long.valueOf(rateModelIdStr);
Long csRateModelId = rateModelId;
if (!charging) {

View File

@ -133,7 +133,7 @@ public class RealtimeDataLogic implements ServiceLogic {
Integer cacheStartSoc = (Integer) cacheOrder.get("startSoc");
if (cacheStartSoc == null && socInt != 0) cacheOrder.put("startSoc", socInt);
if (socInt != 0) cacheOrder.put("endSoc", socInt);
if (cachePile.get("version").equals("0B")) {
if (cachePile.get("version").equals("0C")) {
final String hex = realtimeData.getHex();
String cdhex = hex.substring(0x40 * 2 + 4, hex.length() - 4);
if (cdhex.length() > 0) {

View File

@ -119,7 +119,8 @@ public class ChargingPileServer {
cachePile.put("status", DISCONNECTED);
REDIS.setCacheMap(pkey, cachePile);
putemDisconn(pileNo, cachePile);
log.debug("remove handler [{}] for ({})", handler.getName(), pileNo);
log.debug("remove handler [{}] for ({}), now try to close conn..", handler.getName(), pileNo);
handler.closeConnection();
pileMap.remove(handler.getName());
versionMapper.remove(handler.getName());
}

View File

@ -30,9 +30,9 @@ public class RateModelTask {
if (rateModelIdStation != null) {
Set<String> pks = stationDto.getPiles();
if (pks != null) for (String pileNo : pks) {
Long rateModelIdPile = REDIS.getCacheMapValue(pileNo, "rateModelId");
String pk = "pile:".concat(pileNo);
Long rateModelIdPile = REDIS.getCacheMapValue(pk, "rateModelId");
if (!rateModelIdStation.equals(rateModelIdPile)) {
String pk = "pile:".concat(pileNo);
String gkPattern = ("gun:").concat(pk).concat("*");
Collection<String> gks = REDIS.keys(gkPattern);
boolean charging = false;

View File

@ -2,6 +2,7 @@ package com.xhpc.pp.utils.security;
import cn.hutool.core.date.DateUtil;
import com.xhpc.pp.utils.HexUtils;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@ -13,6 +14,7 @@ import static com.xhpc.common.core.utils.StringUtils.capitalize;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
import static com.xhpc.pp.utils.security.CP56Time2a.cp56toDate;
@Slf4j
public class CacheDataUtils {
public static Object reflectTranslate(Object srcobj, Class tarclz, Class srcclz, Field[] targetfields) throws IllegalAccessException, InvocationTargetException, InstantiationException {
@ -36,7 +38,12 @@ public class CacheDataUtils {
tarval = (Integer) tarval > 0 ? tarval : 0;
}
} else {
tarval = HexUtils.reverseHexInt(srcval);
try {
tarval = HexUtils.reverseHexInt(srcval);
} catch (java.lang.NumberFormatException e) { // todo 测试代码不应该在生产环境运行到这里
log.error("fatal!! 4 bytes (bin) number: {} - {}", tarfield.getName(), srcval);
tarval = 0;
}
}
} else if (tarFieldName.contains("ime")) {
tarval = DateUtil.format(cp56toDate(srcval), NORM_DATETIME_FORMAT);
@ -47,6 +54,8 @@ public class CacheDataUtils {
}
tarclz.getMethod("set".concat(capitalize(tarFieldName)), tarfield.getType()).invoke(tarobj, tarval);
} catch (NoSuchMethodException ignored) {
log.warn(" src[{}], tar[{}] NoSuchMethodException {}", tarclz.getName(),
srcclz.getName(), "set".concat(capitalize(tarFieldName)));
}
}
}

View File

@ -18,10 +18,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 172.31.183.135:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置