init
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package com.eactive.eai.common.pushinfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.common.dao.BaseDAO;
|
||||
import com.eactive.eai.common.dao.DAOException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.pushinfo.loader.PushInfoDetailLoader;
|
||||
import com.eactive.eai.common.pushinfo.loader.PushInfoLoader;
|
||||
import com.eactive.eai.common.pushinfo.mapper.PushInfoDetailMapper;
|
||||
import com.eactive.eai.common.pushinfo.mapper.PushInfoMapper;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.data.entity.onl.pushinfo.PushInfo;
|
||||
import com.eactive.eai.data.entity.onl.pushinfo.PushInfoDetail;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class PushInfoDAO extends BaseDAO {
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
@Autowired
|
||||
private PushInfoLoader pushInfoLoader;
|
||||
|
||||
@Autowired
|
||||
private PushInfoMapper pushInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private PushInfoDetailLoader pushInfoDetailLoader;
|
||||
|
||||
@Autowired
|
||||
private PushInfoDetailMapper pushInfoDetailMapper;
|
||||
|
||||
public void insertPushInfo(PushInfoVO pushInfoVO) throws DAOException {
|
||||
try {
|
||||
PushInfo entity = pushInfoMapper.toEntity(pushInfoVO);
|
||||
pushInfoLoader.save(entity);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICKE118"), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void batchInsertPushInfoDetail(List<PushInfoDetailVO> pushInfoDetailVoList) throws DAOException {
|
||||
try {
|
||||
List<PushInfoDetail> list = new ArrayList<>();
|
||||
pushInfoDetailVoList.forEach(vo -> list.add(pushInfoDetailMapper.toEntity(vo)) );
|
||||
pushInfoDetailLoader.saveAll(list);
|
||||
} catch (Exception e) {
|
||||
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICKE118"), e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getPushInfoDetailCount() {
|
||||
return pushInfoDetailLoader.count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.eactive.eai.common.pushinfo;
|
||||
|
||||
public class PushInfoDetailVO {
|
||||
public enum Result { success, fail};
|
||||
|
||||
private String guid;
|
||||
private String userId;
|
||||
private String sessionId;
|
||||
private String instanceId;
|
||||
private String wsocRemoteAddr;
|
||||
private Result pushResult;
|
||||
private String errorContent;
|
||||
//YYYYMMDDHHMI24SS
|
||||
private String pushDatetime;
|
||||
|
||||
public PushInfoDetailVO() {
|
||||
|
||||
}
|
||||
public PushInfoDetailVO(String guid) {
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public PushInfoDetailVO(String guid, String userId, String sessionId, String instanceId, String wsocRemoteAddr,
|
||||
Result pushResult, String errorContent, String pushDatetime) {
|
||||
this.guid = guid;
|
||||
this.userId = userId;
|
||||
this.sessionId = sessionId;
|
||||
this.instanceId = instanceId;
|
||||
this.wsocRemoteAddr = wsocRemoteAddr;
|
||||
this.pushResult = pushResult;
|
||||
this.errorContent = errorContent;
|
||||
this.pushDatetime = pushDatetime;
|
||||
}
|
||||
|
||||
|
||||
public String getGuid() {
|
||||
return guid;
|
||||
}
|
||||
|
||||
public void setGuid(String guid) {
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public String getInstanceId() {
|
||||
return instanceId;
|
||||
}
|
||||
|
||||
public void setInstanceId(String instanceId) {
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
|
||||
|
||||
public String getWsocRemoteAddr() {
|
||||
return wsocRemoteAddr;
|
||||
}
|
||||
|
||||
public void setWsocRemoteAddr(String wsocRemoteAddr) {
|
||||
this.wsocRemoteAddr = wsocRemoteAddr;
|
||||
}
|
||||
|
||||
public Result getPushResult() {
|
||||
return pushResult;
|
||||
}
|
||||
public String getPushResultInfo() {
|
||||
return pushResult==null?"":pushResult.toString();
|
||||
}
|
||||
|
||||
public void setPushResult(Result pushResult) {
|
||||
this.pushResult = pushResult;
|
||||
}
|
||||
|
||||
public String getErrorContent() {
|
||||
return errorContent;
|
||||
}
|
||||
|
||||
public void setErrorContent(String errorContent) {
|
||||
this.errorContent = errorContent;
|
||||
}
|
||||
|
||||
public String getPushDatetime() {
|
||||
return pushDatetime;
|
||||
}
|
||||
|
||||
public void setPushDatetime(String pushDatetime) {
|
||||
this.pushDatetime = pushDatetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PushInfoDetailVO [guid=" + guid + ", userId=" + userId + ", sessionId=" + sessionId + ", instanceId="
|
||||
+ instanceId + ", wsocRemoteAddr=" + wsocRemoteAddr + ", pushResult=" + pushResult + ", errorContent="
|
||||
+ errorContent + ", pushDatetime=" + pushDatetime + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.eactive.eai.common.pushinfo;
|
||||
|
||||
public class PushInfoVO {
|
||||
|
||||
private String guid;
|
||||
private String pushDvsnCode;
|
||||
private String pushTarget;
|
||||
private int pushTargetCount;
|
||||
//YYYYMMDDHHMI24SS
|
||||
private String pushDateTime;
|
||||
|
||||
public PushInfoVO() {
|
||||
|
||||
}
|
||||
|
||||
public PushInfoVO(String guid) {
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public PushInfoVO(String guid, String pushDvsnCode, String pushTarget, int pushTargetCount, String pushDateTime) {
|
||||
this.guid = guid;
|
||||
this.pushDvsnCode = pushDvsnCode;
|
||||
this.pushTarget = pushTarget;
|
||||
this.pushTargetCount = pushTargetCount;
|
||||
this.pushDateTime = pushDateTime;
|
||||
}
|
||||
|
||||
public String getGuid() {
|
||||
return guid;
|
||||
}
|
||||
|
||||
public void setGuid(String guid) {
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public String getPushDvsnCode() {
|
||||
return pushDvsnCode;
|
||||
}
|
||||
|
||||
public void setPushDvsnCode(String pushDvsnCode) {
|
||||
this.pushDvsnCode = pushDvsnCode;
|
||||
}
|
||||
|
||||
public String getPushTarget() {
|
||||
return pushTarget;
|
||||
}
|
||||
|
||||
public void setPushTarget(String pushTarget) {
|
||||
this.pushTarget = pushTarget;
|
||||
}
|
||||
|
||||
public int getPushTargetCount() {
|
||||
return pushTargetCount;
|
||||
}
|
||||
|
||||
public void setPushTargetCount(int pushTargetCount) {
|
||||
this.pushTargetCount = pushTargetCount;
|
||||
}
|
||||
|
||||
public String getPushDateTime() {
|
||||
return pushDateTime;
|
||||
}
|
||||
|
||||
public void setPushDateTime(String pushDateTime) {
|
||||
this.pushDateTime = pushDateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PushInfoVO [guid=" + guid + ", pushDvsnCode=" + pushDvsnCode + ", pushTarget=" + pushTarget
|
||||
+ ", pushTargetCount=" + pushTargetCount + ", pushDateTime=" + pushDateTime + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.eactive.eai.common.pushinfo.mapper;
|
||||
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.common.pushinfo.PushInfoDetailVO;
|
||||
import com.eactive.eai.common.pushinfo.PushInfoDetailVO.Result;
|
||||
import com.eactive.eai.data.entity.onl.pushinfo.PushInfoDetail;
|
||||
import com.eactive.eai.data.mapper.BaseMapperConfig;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
@Mapper(config = BaseMapperConfig.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface PushInfoDetailMapper extends GenericMapper<PushInfoDetailVO, PushInfoDetail> {
|
||||
|
||||
@Mapping(source = "guid", target = "guid")
|
||||
@Mapping(source = "userid", target = "userId")
|
||||
@Mapping(source = "sessionId", target = "sessionId")
|
||||
@Mapping(source = "instanceId", target = "instanceId")
|
||||
@Mapping(source = "wsocRemoteAddr", target = "wsocRemoteAddr")
|
||||
@Mapping(source = "pushResult", target = "pushResult")
|
||||
@Mapping(source = "errorContent", target = "errorContent")
|
||||
@Mapping(source = "pushDatetime", target = "pushDatetime")
|
||||
@Override
|
||||
PushInfoDetailVO toVo(PushInfoDetail entity);
|
||||
|
||||
@Mapping(source = "pushResult", target = "pushResult")
|
||||
@InheritInverseConfiguration
|
||||
PushInfoDetail toEntity(PushInfoDetailVO vo);
|
||||
|
||||
default Result mapStringToResult(String pushResult) {
|
||||
return Result.valueOf(pushResult);
|
||||
}
|
||||
|
||||
default String mapResultToString(Result result) {
|
||||
return result.name();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.eactive.eai.common.pushinfo.mapper;
|
||||
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.common.pushinfo.PushInfoVO;
|
||||
import com.eactive.eai.data.entity.onl.pushinfo.PushInfo;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface PushInfoMapper extends GenericMapper<PushInfoVO, PushInfo> {
|
||||
@Mapping(source = "guid", target = "guid")
|
||||
@Mapping(source = "pushDatetime", target = "pushDateTime")
|
||||
@Mapping(source = "pushDvsnCd", target = "pushDvsnCode")
|
||||
@Mapping(source = "pushTarget", target = "pushTarget")
|
||||
@Mapping(source = "pushTargetCount", target = "pushTargetCount")
|
||||
@Override
|
||||
PushInfoVO toVo(PushInfo entity);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
PushInfo toEntity(PushInfoVO vo);
|
||||
}
|
||||
Reference in New Issue
Block a user