|
@@ -1,6 +1,9 @@
|
|
|
package com.ecnu.platform.port
|
|
|
|
|
|
import com.ecnu.alg.pojo.port.inputs.AlgBollard
|
|
|
+import com.three.common.exception.ParamException
|
|
|
+import com.three.common.utils.IdWorker
|
|
|
+import com.three.common.utils.StringUtil
|
|
|
import com.three.common.vo.PageResult
|
|
|
import com.three.data_api.dm.annos.BizApiMethod
|
|
|
import com.three.data_api.dm.annos.Doc4MethodRes
|
|
@@ -9,6 +12,7 @@ import com.three.data_api.dm.entity.AuqResult
|
|
|
import com.three.redis.utils.RedisUtil
|
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
|
|
|
|
+
|
|
|
class BollardService {
|
|
|
|
|
|
public static final String AlgBollardKey = "port:AlgBollard:"
|
|
@@ -26,4 +30,25 @@ class BollardService {
|
|
|
auqResult.setResult(pageResult)
|
|
|
return auqResult
|
|
|
}
|
|
|
+
|
|
|
+ @BizApiMethod(matchedApis = ThreeConstant.BIZ_API_NAME, desc = "新增缆桩信息")
|
|
|
+ void create(Map<String, Object> map) throws Exception {
|
|
|
+ // 先删除缆桩
|
|
|
+ redisUtil.del(redisUtil.getKeyByPrefix(AlgBollardKey + "*"))
|
|
|
+ for (int i = 1; i <= 40; i++) {
|
|
|
+ AlgBollard algBollard = new AlgBollard()
|
|
|
+ algBollard.setGkey(IdWorker.generateIdStr())
|
|
|
+ algBollard.setId(String.format("%02d", i) + "#")
|
|
|
+ algBollard.setLocation(50 + (i - 1) * 50)
|
|
|
+ redisUtil.set(AlgBollardKey + algBollard.getGkey(), algBollard)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @BizApiMethod(matchedApis = ThreeConstant.BIZ_API_NAME, desc = "删除缆桩信息")
|
|
|
+ void delete(Map<String, Object> map) throws Exception {
|
|
|
+ if (StringUtil.isBlankStr(map.get("gkey"))) {
|
|
|
+ throw new ParamException("主键(gkey)不可以为空")
|
|
|
+ }
|
|
|
+ redisUtil.del(AlgBollardKey + map.get("gkey"))
|
|
|
+ }
|
|
|
}
|