98 lines
3.1 KiB
Java
98 lines
3.1 KiB
Java
package seed.user.bbs.service;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import egovframework.rte.fdl.cmmn.AbstractServiceImpl;
|
|
|
|
import seed.dao.BbsCommentDAO;
|
|
import seed.dao.BbsDataDAO;
|
|
import seed.map.T_BBS_COMMENT;
|
|
import seed.map.T_BBS_DATA;
|
|
import seed.map.T_MEMBER;
|
|
import seed.map.T_POINT;
|
|
import seed.utils.SeedUtils;
|
|
|
|
@Service
|
|
public class UserBbsCommentServiceImpl extends AbstractServiceImpl implements UserBbsCommentService{
|
|
|
|
@Autowired
|
|
private BbsCommentDAO bbsCommentDAO;
|
|
|
|
@Autowired
|
|
private BbsDataDAO bbsDataDAO;
|
|
|
|
//UserBbsController
|
|
public Long getBbsCommentListCnt(Integer bbsDataIdx){
|
|
|
|
return bbsCommentDAO.getBbsCommentListCnt(bbsDataIdx);
|
|
}
|
|
|
|
//UserBbsController
|
|
public List<T_BBS_COMMENT> getBbsCommentList(Integer bbsDataIdx, int page, int row, String[] qryColumns){
|
|
|
|
return bbsCommentDAO.getBbsCommentList(bbsDataIdx, ((page-1) * row), row, qryColumns);
|
|
}
|
|
|
|
//UserBbsController
|
|
@Transactional
|
|
public boolean setBbsCommentRegProc(T_BBS_COMMENT tBbsComment, Integer memberIdx, String memberIp){
|
|
|
|
boolean success = false;
|
|
|
|
T_MEMBER tMember = new T_MEMBER();
|
|
tMember.setMemberIdx(memberIdx);
|
|
|
|
tBbsComment.settMember(tMember);
|
|
tBbsComment.setBbsCommentRegDate(new Date());
|
|
tBbsComment.setBbsCommentMemberIp(memberIp);
|
|
|
|
if(bbsCommentDAO.setBbsCommentRegProc(tBbsComment)){
|
|
T_BBS_DATA tBbsDataDB = bbsDataDAO.getBbsDataForm(tBbsComment.gettBbsData().getBbsDataIdx());
|
|
tBbsDataDB.setBbsCommentCount(tBbsDataDB.getBbsCommentCount()+1);
|
|
success = bbsDataDAO.setBbsDataModProc(tBbsDataDB);
|
|
|
|
if(SeedUtils.setReplaceNull(tBbsDataDB.gettBbsSet().getBbsSetPoint()).equals("Y")){
|
|
//코멘트 포인트
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
T_POINT tPoint = new T_POINT();
|
|
|
|
tPoint.setPointSetIdx(tBbsDataDB.getBbsDataIdx());
|
|
tPoint.setPointDataIdx(tBbsComment.getBbsCommentIdx());
|
|
tPoint.setPointRegdate(sdf.format(new Date()));
|
|
tPoint.setMemberIp(memberIp);
|
|
tPoint.setMemberIdx(memberIdx);
|
|
tPoint.setSiteIdx(tBbsDataDB.gettBbsSet().gettSite().getSiteIdx());
|
|
tPoint.setFuncType("COMMENT");
|
|
tPoint.setPointScore(tBbsDataDB.gettBbsSet().getBbsSetPointWrite());
|
|
bbsDataDAO.setBbsPointProc(tPoint);
|
|
}
|
|
}
|
|
|
|
return success;
|
|
}
|
|
|
|
//UserBbsController
|
|
@Transactional
|
|
public boolean setBbsCommentDelProc(Integer bbsCommentIdx){
|
|
|
|
boolean success = false;
|
|
|
|
T_BBS_COMMENT tBbsComment = bbsCommentDAO.getBbsCommentForm(bbsCommentIdx);
|
|
|
|
if(bbsCommentDAO.setBbsCommentDelProc(tBbsComment)){
|
|
T_BBS_DATA tBbsDataDB = bbsDataDAO.getBbsDataForm(tBbsComment.gettBbsData().getBbsDataIdx());
|
|
tBbsDataDB.setBbsCommentCount(tBbsDataDB.getBbsCommentCount()-1);
|
|
success = bbsDataDAO.setBbsDataModProc(tBbsDataDB);
|
|
}
|
|
|
|
return success;
|
|
}
|
|
}
|