完善SEQN 生成算法
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.gzzn.omms.msgexchangeapi.dao;
|
package com.gzzn.omms.msgexchangeapi.dao;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
import com.gzzn.omms.msgexchangeapi.entity.Cmoutmsg;
|
import com.gzzn.omms.msgexchangeapi.entity.Cmoutmsg;
|
||||||
@@ -7,5 +8,10 @@ import com.gzzn.omms.msgexchangeapi.entity.Cmoutmsg;
|
|||||||
|
|
||||||
public interface CmoutmsgDao extends CrudRepository<Cmoutmsg, Long> {
|
public interface CmoutmsgDao extends CrudRepository<Cmoutmsg, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最大的id值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Query("select max(coutmsgsId) from Cmoutmsg")
|
||||||
|
public Integer findMaxId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,16 @@ public class CmoutmsgServiceImpl implements ICmoutmsgService {
|
|||||||
public Boolean sendSchdGetMsg(Date startDate,Date endDate)
|
public Boolean sendSchdGetMsg(Date startDate,Date endDate)
|
||||||
{
|
{
|
||||||
String nowtime = DateTimeUtil.gtFormatStr(new Date(), "yyMMddhhmmss", Locale.ENGLISH);
|
String nowtime = DateTimeUtil.gtFormatStr(new Date(), "yyMMddhhmmss", Locale.ENGLISH);
|
||||||
|
String seqn = "1";
|
||||||
|
|
||||||
|
//
|
||||||
|
Integer maxId = cmoutmsgDao.findMaxId();
|
||||||
|
if(maxId != null)
|
||||||
|
{
|
||||||
|
seqn = String.valueOf(maxId + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//构造消息
|
//构造消息
|
||||||
MSG rqfdMsg = new MSGBuilder().
|
MSG rqfdMsg = new MSGBuilder().
|
||||||
setMETA(
|
setMETA(
|
||||||
@@ -38,7 +48,7 @@ public class CmoutmsgServiceImpl implements ICmoutmsgService {
|
|||||||
.setTYPE(MESSAGETYPES.RQFD)
|
.setTYPE(MESSAGETYPES.RQFD)
|
||||||
.setSTYP(MESSAGESUBTYPES.NONE)
|
.setSTYP(MESSAGESUBTYPES.NONE)
|
||||||
.setDTTM(new BigInteger(nowtime))
|
.setDTTM(new BigInteger(nowtime))
|
||||||
.setSEQN(new BigInteger(nowtime))
|
.setSEQN(new BigInteger(seqn))
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
Reference in New Issue
Block a user