Skip to content

Commit

Permalink
Merge pull request #1224 from khoahp/rc-1.7-issue-fix
Browse files Browse the repository at this point in the history
Rc 1.7 issue fix
  • Loading branch information
khoahp authored Dec 2, 2016
2 parents ff72a83 + b0218af commit a0f80c5
Show file tree
Hide file tree
Showing 28 changed files with 8,008 additions and 7,724 deletions.
2,347 changes: 1,175 additions & 1,172 deletions hooks/opencps-hook/docroot/WEB-INF/src/content/Language.properties

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

##Language 28
you-do-not-have-any-notifications=Kh\u00f4ng c\u00f3 th\u00f4ng b\u00e1o.
2,066 changes: 1,042 additions & 1,024 deletions hooks/opencps-hook/docroot/WEB-INF/src/content/Language_vi.properties

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ private List<SendNotificationMessage> getListNoties(
notiMsg.setDossierId(dossierId);
notiMsg.setNotificationEventName(event);
notiMsg.setProcessOrderId(processOrderId);
notiMsg.setPaymentFileId(paymentFileId);
notiMsg.setType("SMS, INBOX, EMAIL");

SendNotificationMessage.InfoList info = new SendNotificationMessage.InfoList();
Expand All @@ -602,13 +603,14 @@ private List<SendNotificationMessage> getListNoties(
info.setUserId(citizen.getUserId());
info.setUserMail(citizen.getEmail());
info.setUserPhone(citizen.getTelNo());

info.setFullName(citizen.getFullName());
}

if (Validator.isNotNull(bussines)) {
info.setUserId(bussines.getUserId());
info.setUserMail(bussines.getEmail());
info.setUserPhone(bussines.getTelNo());
info.setFullName(bussines.getName());

}

Expand Down Expand Up @@ -637,6 +639,7 @@ private List<SendNotificationMessage> getListNoties(
notiMsg.setDossierId(dossierId);
notiMsg.setNotificationEventName(employEvent);
notiMsg.setProcessOrderId(processOrderId);
notiMsg.setPaymentFileId(paymentFileId);
notiMsg.setType("SMS, INBOX, EMAIL");

if (assignToUserId != 0) {
Expand All @@ -659,6 +662,7 @@ private List<SendNotificationMessage> getListNoties(
infoEmploy.setUserMail(employee.getEmail());
infoEmploy.setUserPhone(employee.getTelNo());
infoEmploy.setGroupId(groupId);
infoEmploy.setFullName(employee.getFullName());
}

infoListEmploy.add(infoEmploy);
Expand Down Expand Up @@ -696,6 +700,7 @@ private List<SendNotificationMessage> getListNoties(
infoEmploy.setUserMail(employee.getEmail());
infoEmploy.setUserPhone(employee.getTelNo());
infoEmploy.setGroupId(groupId);
infoEmploy.setFullName(employee.getFullName());

if (employEvent.contains(NotificationEventKeys.OFFICIALS.EVENT3)) {
infoEmploy.setGroup(NotificationEventKeys.GROUP4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,136 +1,150 @@
package org.opencps.backend.scheduler;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.opencps.backend.message.SendToEngineMsg;
import org.opencps.dossiermgt.model.Dossier;
import org.opencps.dossiermgt.service.DossierFileLocalServiceUtil;
import org.opencps.dossiermgt.service.DossierLocalServiceUtil;
import org.opencps.processmgt.model.ProcessOrder;
import org.opencps.processmgt.model.ProcessWorkflow;
import org.opencps.processmgt.model.WorkflowOutput;
import org.opencps.processmgt.service.ProcessOrderLocalServiceUtil;
import org.opencps.processmgt.service.ProcessWorkflowLocalServiceUtil;
import org.opencps.processmgt.service.WorkflowOutputLocalServiceUtil;
import org.opencps.processmgt.util.ProcessMgtUtil;
import org.opencps.processmgt.util.ProcessOrderUtils;
import org.opencps.util.PortletConstants;
import org.opencps.util.WebKeys;

import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.messaging.Message;
import com.liferay.portal.kernel.messaging.MessageBusUtil;
import com.liferay.portal.kernel.messaging.MessageListener;
import com.liferay.portal.kernel.messaging.MessageListenerException;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;


public class Daily implements MessageListener{

@Override
public void receive(Message message)
throws MessageListenerException {
_log.info("RUNNING _DAILY $$$$$" );

List<ProcessWorkflow> processWorkflows =
new ArrayList<ProcessWorkflow>();

List<ProcessOrder> processOrders = new ArrayList<ProcessOrder>();

Dossier dossier = null;

SchedulerUtils schedulerUtil = new SchedulerUtils();

try {
processWorkflows =
ProcessWorkflowLocalServiceUtil.getProcessWorkflowByEvent(SchedulerKeys.DAILY);

for (ProcessWorkflow processWorkflow : processWorkflows) {

processOrders =
ProcessOrderLocalServiceUtil.getProcessOrderByStep(processWorkflow.getPreProcessStepId());

if (processOrders.size() != 0) {
for (ProcessOrder processOrder : processOrders) {

_log.info("Scheduler _DAILY ########" + processWorkflow.getActionName() + "_" + processOrder.getDossierId());

long processWorkflowId = processWorkflow.getProcessWorkflowId();

long processOrderId = processOrder.getProcessOrderId();

long assignToUserId = ProcessMgtUtil.getAssignUser(processWorkflowId, processOrderId, processWorkflow.getPostProcessStepId());

long dossierId = processOrder.getDossierId();

dossier = DossierLocalServiceUtil.getDossier(dossierId);

Date receiveDate = dossier.getReceiveDatetime();

if (Validator.isNull(receiveDate)) {
receiveDate = ProcessOrderUtils.getRecevieDate(dossierId, processWorkflowId, 0);
}

schedulerUtil.validateAssignTask(
dossierId, processWorkflowId, processWorkflow.getPreProcessStepId());

Message msg = new Message();

SendToEngineMsg sendToEngineMsg = new SendToEngineMsg();

// sendToEngineMsg.setAction(WebKeys.ACTION);
sendToEngineMsg.setActionNote("auto-event");
sendToEngineMsg.setEvent(StringPool.BLANK);
sendToEngineMsg.setGroupId(dossier.getGroupId());
sendToEngineMsg.setCompanyId(dossier.getCompanyId());
sendToEngineMsg.setAssignToUserId(assignToUserId);
sendToEngineMsg.setActionUserId(0);
sendToEngineMsg.setDossierId(dossierId);
sendToEngineMsg.setEstimateDatetime(receiveDate);
sendToEngineMsg.setFileGroupId(processOrder.getFileGroupId());
//sendToEngineMsg.setPaymentValue(GetterUtil.getDouble(paymentValue));
sendToEngineMsg.setProcessOrderId(processOrderId);
sendToEngineMsg.setProcessWorkflowId(processWorkflowId);
sendToEngineMsg.setReceptionNo(Validator.isNotNull(dossier.getReceptionNo())
? dossier.getReceptionNo() : StringPool.BLANK);
sendToEngineMsg.setSignature(0);
sendToEngineMsg.setDossierStatus(dossier.getDossierStatus());
sendToEngineMsg.setActionDatetime(new Date());
sendToEngineMsg.setActorType(WebKeys.DOSSIER_ACTOR_SYSTEM);
sendToEngineMsg.setReceiveDate(receiveDate);

msg.put("msgToEngine", sendToEngineMsg);

MessageBusUtil.sendMessage(
"opencps/backoffice/engine/destination", msg);

List<WorkflowOutput> workflowOutputs =
WorkflowOutputLocalServiceUtil.getByProcessWF(processWorkflowId);

// Lat co trang trai sau khi gui thanh cong len jms va
// engine
DossierFileLocalServiceUtil.updateDossierFileResultSyncStatus(
0, dossierId, PortletConstants.DOSSIER_FILE_SYNC_STATUS_NOSYNC,
PortletConstants.DOSSIER_FILE_SYNC_STATUS_REQUIREDSYNC, 0,
workflowOutputs);

}

} else {

}

}
}
catch (Exception e) {
// TODO: handle exception
}

}

private Log _log = LogFactoryUtil.getLog(Daily.class);
}

package org.opencps.backend.scheduler;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.opencps.backend.message.SendToEngineMsg;
import org.opencps.backend.util.BackendUtils;
import org.opencps.dossiermgt.model.Dossier;
import org.opencps.dossiermgt.service.DossierFileLocalServiceUtil;
import org.opencps.dossiermgt.service.DossierLocalServiceUtil;
import org.opencps.processmgt.model.ProcessOrder;
import org.opencps.processmgt.model.ProcessWorkflow;
import org.opencps.processmgt.model.WorkflowOutput;
import org.opencps.processmgt.service.ProcessOrderLocalServiceUtil;
import org.opencps.processmgt.service.ProcessWorkflowLocalServiceUtil;
import org.opencps.processmgt.service.WorkflowOutputLocalServiceUtil;
import org.opencps.processmgt.util.ProcessMgtUtil;
import org.opencps.processmgt.util.ProcessOrderUtils;
import org.opencps.util.PortletConstants;
import org.opencps.util.WebKeys;

import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.messaging.Message;
import com.liferay.portal.kernel.messaging.MessageBusUtil;
import com.liferay.portal.kernel.messaging.MessageListener;
import com.liferay.portal.kernel.messaging.MessageListenerException;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.Validator;

public class Daily implements MessageListener {

@Override
public void receive(Message message)
throws MessageListenerException {

_log.info("RUNNING _DAILY $$$$$");

List<ProcessWorkflow> processWorkflows = new ArrayList<ProcessWorkflow>();

List<ProcessOrder> processOrders = new ArrayList<ProcessOrder>();

Dossier dossier = null;

SchedulerUtils schedulerUtil = new SchedulerUtils();

try {
processWorkflows =
ProcessWorkflowLocalServiceUtil.getProcessWorkflowByEvent(SchedulerKeys.DAILY);

for (ProcessWorkflow processWorkflow : processWorkflows) {

processOrders =
ProcessOrderLocalServiceUtil.getProcessOrderByStep(processWorkflow.getPreProcessStepId());

if (processOrders.size() != 0) {
for (ProcessOrder processOrder : processOrders) {

boolean preCondition = false;
preCondition =
BackendUtils.checkPreCondition(
processWorkflow.getPreCondition(), processOrder.getDossierId());

_log.info("Scheduler _DAILY ########" + processWorkflow.getActionName() +
"_" + processOrder.getDossierId());

if (preCondition) {
long processWorkflowId = processWorkflow.getProcessWorkflowId();

long processOrderId = processOrder.getProcessOrderId();

long assignToUserId =
ProcessMgtUtil.getAssignUser(
processWorkflowId, processOrderId,
processWorkflow.getPostProcessStepId());

long dossierId = processOrder.getDossierId();

dossier = DossierLocalServiceUtil.getDossier(dossierId);

Date receiveDate = dossier.getReceiveDatetime();

if (Validator.isNull(receiveDate)) {
receiveDate =
ProcessOrderUtils.getRecevieDate(
dossierId, processWorkflowId, 0);
}

schedulerUtil.validateAssignTask(
dossierId, processWorkflowId, processWorkflow.getPreProcessStepId());

Message msg = new Message();

SendToEngineMsg sendToEngineMsg = new SendToEngineMsg();

// sendToEngineMsg.setAction(WebKeys.ACTION);
sendToEngineMsg.setActionNote("auto-event");
sendToEngineMsg.setEvent(StringPool.BLANK);
sendToEngineMsg.setGroupId(dossier.getGroupId());
sendToEngineMsg.setCompanyId(dossier.getCompanyId());
sendToEngineMsg.setAssignToUserId(assignToUserId);
sendToEngineMsg.setActionUserId(0);
sendToEngineMsg.setDossierId(dossierId);
sendToEngineMsg.setEstimateDatetime(receiveDate);
sendToEngineMsg.setFileGroupId(processOrder.getFileGroupId());
// sendToEngineMsg.setPaymentValue(GetterUtil.getDouble(paymentValue));
sendToEngineMsg.setProcessOrderId(processOrderId);
sendToEngineMsg.setProcessWorkflowId(processWorkflowId);
sendToEngineMsg.setReceptionNo(Validator.isNotNull(dossier.getReceptionNo())
? dossier.getReceptionNo() : StringPool.BLANK);
sendToEngineMsg.setSignature(0);
sendToEngineMsg.setDossierStatus(dossier.getDossierStatus());
sendToEngineMsg.setActionDatetime(new Date());
sendToEngineMsg.setActorType(WebKeys.DOSSIER_ACTOR_SYSTEM);
sendToEngineMsg.setReceiveDate(receiveDate);

msg.put("msgToEngine", sendToEngineMsg);

MessageBusUtil.sendMessage("opencps/backoffice/engine/destination", msg);

List<WorkflowOutput> workflowOutputs =
WorkflowOutputLocalServiceUtil.getByProcessWF(processWorkflowId);

// Lat co trang trai sau khi gui thanh cong len jms
// va
// engine
DossierFileLocalServiceUtil.updateDossierFileResultSyncStatus(
0, dossierId, PortletConstants.DOSSIER_FILE_SYNC_STATUS_NOSYNC,
PortletConstants.DOSSIER_FILE_SYNC_STATUS_REQUIREDSYNC, 0,
workflowOutputs);
}
}

}
else {

}

}
}
catch (Exception e) {
// TODO: handle exception
}

}

private Log _log = LogFactoryUtil.getLog(Daily.class);
}
Loading

0 comments on commit a0f80c5

Please sign in to comment.