Skip to content

Commit

Permalink
Merge pull request #898 from support-project/dev_next
Browse files Browse the repository at this point in the history
Dev next
  • Loading branch information
koda-masaru authored Oct 10, 2017
2 parents 95f6119 + 01f79fa commit 287b787
Show file tree
Hide file tree
Showing 106 changed files with 3,745 additions and 900 deletions.
Binary file modified document/database/A5M2_knowledge.pdf
Binary file not shown.
413 changes: 243 additions & 170 deletions document/database/knowledge.a5er

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.support-project</groupId>
<artifactId>knowledge</artifactId>
<version>1.11.1-SNAPSHOT</version>
<version>1.12.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>knowledge</name>
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/org/support/project/knowledge/bat/AggregateBat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.support.project.knowledge.bat;

import org.apache.commons.lang.ClassUtils;
import org.support.project.common.log.Log;
import org.support.project.common.log.LogFactory;
import org.support.project.knowledge.logic.AggregateLogic;

public class AggregateBat extends AbstractBat {
/** ログ */
private static final Log LOG = LogFactory.getLog(AggregateBat.class);

public static void main(String[] args) throws Exception {
try {
initLogName("AggregateBat.log");
configInit(ClassUtils.getShortClassName(AggregateBat.class));

AggregateBat bat = new AggregateBat();
bat.dbInit();
bat.start();

finishInfo();
} catch (Exception e) {
LOG.error("any error", e);
throw e;
}
}

/**
* 処理の実行
* @throws Exception Exception
*/
public void start() throws Exception {
AggregateLogic aggregateLogic = AggregateLogic.get();
aggregateLogic.startAggregate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public static void main(String[] args) throws Exception {
public void start() throws UnsupportedEncodingException, MessagingException, InvalidKeyException, NoSuchAlgorithmException,
NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
MailLogic.get().startSendMails();
MailsDao.get().physicalDeleteOnOldData();
int deletecount = MailsDao.get().physicalDeleteOnOldData();
LOG.info("delete old mails. [count]" + deletecount);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.support.project.knowledge.control.admin;

import org.support.project.di.DI;
import org.support.project.di.Instance;
import org.support.project.knowledge.control.Control;

@DI(instance = Instance.Prototype)
public class AggregateControl extends Control {

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.support.project.knowledge.logic.GroupLogic;
import org.support.project.knowledge.logic.KeywordLogic;
import org.support.project.knowledge.logic.KnowledgeLogic;
import org.support.project.knowledge.logic.LikeLogic;
import org.support.project.knowledge.logic.MarkdownLogic;
import org.support.project.knowledge.logic.TagLogic;
import org.support.project.knowledge.logic.TargetLogic;
Expand Down Expand Up @@ -661,8 +662,7 @@ public Boundary stocks() throws InvalidParamException {
@Post(subscribeToken="knowledge")
public Boundary like() throws InvalidParamException {
Long knowledgeId = super.getPathLong(Long.valueOf(-1));
KnowledgeLogic knowledgeLogic = KnowledgeLogic.get();
Long count = knowledgeLogic.addLike(knowledgeId, getLoginedUser(), getLocale());
Long count = LikeLogic.get().addLike(knowledgeId, getLoginedUser(), getLocale());
LikeCount likeCount = new LikeCount();
likeCount.setKnowledgeId(knowledgeId);
likeCount.setCount(count);
Expand All @@ -676,11 +676,9 @@ public Boundary like() throws InvalidParamException {
@Post(subscribeToken="knowledge")
public Boundary likecomment() throws InvalidParamException {
Long commentNo = super.getPathLong(Long.valueOf(-1));
KnowledgeLogic knowledgeLogic = KnowledgeLogic.get();
Long count = knowledgeLogic.addLikeComment(commentNo, getLoginedUser(), getLocale());
Long count = LikeLogic.get().addLikeComment(commentNo, getLoginedUser(), getLocale());
LikeCount likeCount = new LikeCount();
likeCount.setCount(count);

return send(likeCount);
}

Expand Down
24 changes: 22 additions & 2 deletions src/main/java/org/support/project/knowledge/dao/ActivitiesDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.List;

import org.support.project.aop.Aspect;
import org.support.project.common.log.Log;
import org.support.project.common.log.LogFactory;
import org.support.project.di.Container;
import org.support.project.di.DI;
import org.support.project.di.Instance;
Expand All @@ -15,6 +17,8 @@
*/
@DI(instance = Instance.Singleton)
public class ActivitiesDao extends GenActivitiesDao {
/** ログ */
private static final Log LOG = LogFactory.getLog(ActivitiesDao.class);

/** SerialVersion */
private static final long serialVersionUID = 1L;
Expand All @@ -36,10 +40,9 @@ public List<ActivitiesEntity> selectOnNos(List<Long> activityNos) {
sql.append("SELECT *, USERS.USER_NAME FROM ACTIVITIES INNER JOIN USERS ON (ACTIVITIES.USER_ID = USERS.USER_ID) ");
sql.append("WHERE ACTIVITY_NO IN (");
boolean appended = false;
for (Long no : activityNos) {
for (@SuppressWarnings("unused") Long no : activityNos) {
if (appended) {
sql.append(", ");

}
sql.append("?");
appended = true;
Expand Down Expand Up @@ -70,6 +73,23 @@ public ActivitiesEntity selectBefore(Integer userId, String target, int... kinds
sql.append(") ORDER BY INSERT_DATETIME DESC LIMIT 1 OFFSET 0");
return executeQuerySingle(sql.toString(), ActivitiesEntity.class, params.toArray(new Object[0]));
}
/**
* 指定のアクティビティの件数を取得
* @param kind
* @param targetId
* @return
*/
public long selectCountByTarget(int kind, Long targetId) {
String target = String.valueOf(targetId);
String sql = "SELECT COUNT(*) FROM ACTIVITIES WHERE KIND = ? AND TARGET = ?";
return executeQuerySingle(sql, Long.class, kind, target);
}
@Aspect(advice = org.support.project.ormapping.transaction.Transaction.class)
public void removeAll() {
LOG.warn("Remove all activities");
String sql = "DELETE FROM ACTIVITIES";
executeUpdate(sql);
}



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.support.project.knowledge.dao;

import org.support.project.di.Container;
import org.support.project.di.DI;
import org.support.project.di.Instance;

import org.support.project.knowledge.dao.gen.GenMailHookIgnoreConditionsDao;

/**
* メールから投稿の際の除外条件
*/
@DI(instance = Instance.Singleton)
public class MailHookIgnoreConditionsDao extends GenMailHookIgnoreConditionsDao {

/** SerialVersion */
private static final long serialVersionUID = 1L;
/**
* Get instance from DI container.
* @return instance
*/
public static MailHookIgnoreConditionsDao get() {
return Container.getComp(MailHookIgnoreConditionsDao.class);
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.support.project.knowledge.dao;

import org.support.project.di.Container;
import org.support.project.di.DI;
import org.support.project.di.Instance;

import org.support.project.knowledge.dao.gen.GenNotificationStatusDao;

/**
* いいねの通知状態
*/
@DI(instance = Instance.Singleton)
public class NotificationStatusDao extends GenNotificationStatusDao {

/** SerialVersion */
private static final long serialVersionUID = 1L;
/**
* Get instance from DI container.
* @return instance
*/
public static NotificationStatusDao get() {
return Container.getComp(NotificationStatusDao.class);
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.List;

import org.support.project.aop.Aspect;
import org.support.project.common.log.Log;
import org.support.project.common.log.LogFactory;
import org.support.project.di.Container;
import org.support.project.di.DI;
import org.support.project.di.Instance;
Expand All @@ -14,6 +16,8 @@
*/
@DI(instance = Instance.Singleton)
public class PointKnowledgeHistoriesDao extends GenPointKnowledgeHistoriesDao {
/** LOG */
private static final Log LOG = LogFactory.getLog(PointKnowledgeHistoriesDao.class);

/** SerialVersion */
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -53,6 +57,13 @@ public int selectBeforePoint(Long knowledgeId, int... types) {
}
return point;
}

@Aspect(advice = org.support.project.ormapping.transaction.Transaction.class)
public void removeAll() {
LOG.warn("Remove all point knowledge histories");
String sql = "DELETE FROM POINT_KNOWLEDGE_HISTORIES";
executeUpdate(sql);
}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public List<PointUserHistoriesEntity> selectOnUser(Integer userId, int limit, in
return executeQueryList(sql, PointUserHistoriesEntity.class, userId, limit, offset);
}

@Aspect(advice = org.support.project.ormapping.transaction.Transaction.class)
public void removeAll() {
LOG.warn("Remove all point user histories");
String sql = "DELETE FROM POINT_USER_HISTORIES";
executeUpdate(sql);
}



}
Loading

0 comments on commit 287b787

Please sign in to comment.