Commit 9fc56f2d authored by 刘林's avatar 刘林

fix(jg):处理使用登记证顺延问题

parent 9de456eb
......@@ -216,16 +216,26 @@
</select>
<select id="initUseRegistrationCodeIntoRedis" resultType="java.util.Map">
SELECT SUBSTR(t.use_registration_code, 1, 5) AS prefix,
SUBSTR(MAX(t.use_registration_code), 6, 5) AS code
FROM tzs_jg_use_registration_manage t
LEFT JOIN tzs_jg_use_registration tjur on tjur.use_registration_code = t.use_registration_code
WHERE LENGTH(t.use_registration_code) = 14
AND SUBSTR(t.use_registration_code, 1, 1) IN ('容', '锅', '管', '瓶', '梯', '起', '索', '游', '车')
AND TRIM(t.use_registration_code) LIKE concat('%(',#{year},')')
AND (tjur.reg_type IS NULL OR tjur.reg_type = '2' OR tjur.reg_type = '0')
AND tjur.is_delete = 0
GROUP BY SUBSTR(t.use_registration_code, 1, 5)
SELECT
SUBSTR(t.use_registration_code, 1, 5) AS prefix,
SUBSTR(MAX(t.use_registration_code), 6, 5) AS code
FROM
tzs_jg_use_registration_manage t
LEFT JOIN
tzs_jg_use_registration tjur
ON tjur.use_registration_code = t.use_registration_code
AND (tjur.reg_type IS NULL OR tjur.reg_type = '2' OR tjur.reg_type = '0')
AND tjur.is_delete = 0
LEFT JOIN
tzs_jg_vehicle_information v
ON v.use_registration_code = t.use_registration_code
and v.reg_type = '0'
WHERE
LENGTH(t.use_registration_code) = 14
AND SUBSTR(t.use_registration_code, 1, 1) IN ('容', '锅', '管', '瓶', '梯', '起', '索', '游', '车')
AND TRIM(t.use_registration_code) LIKE concat('%(',#{year},')')
GROUP BY
SUBSTR(t.use_registration_code, 1, 5)
HAVING code <![CDATA[ <> ]]> '00000'
ORDER BY prefix
</select>
......
......@@ -774,11 +774,22 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
jgUseRegistrationManageMapper.initUseRegistrationCodeIntoRedis(currentYearSuffix)
.forEach(resultMap ->
Optional.ofNullable(resultMap)
.ifPresent(map -> setValueWithExpiration(map.get("prefix"), map.get("code"), endOfYear))
.ifPresent(map -> setValueWithoutExpiration(map.get("prefix"), map.get("code")))
);
}
/**
* redis 设置不过期的 key
*
* @param key key
* @param value value
*/
public void setValueWithoutExpiration(String key, String value) {
ValueOperations<String, String> valueOps = redisTemplate.opsForValue();
valueOps.set(key, value);
}
/**
* redis设置key
*
* @param key key
......
......@@ -249,7 +249,7 @@ public class GenerateCodeServiceImpl implements IGenerateCodeService {
if (lockKey.equals(LOCK_KEY_DR)) {
setValueWithMonthlyExpiration(sequenceKey, String.valueOf(formattedSequence));
} else {
setValueWithYearlyExpiration(sequenceKey, String.valueOf(formattedSequence));
setValueWithoutExpiration(sequenceKey, String.valueOf(formattedSequence));
}
String generatedSequence = sequenceKey + formattedSequence;
......
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