-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1224 from khoahp/rc-1.7-issue-fix
Rc 1.7 issue fix
- Loading branch information
Showing
28 changed files
with
8,008 additions
and
7,724 deletions.
There are no files selected for viewing
2,347 changes: 1,175 additions & 1,172 deletions
2,347
hooks/opencps-hook/docroot/WEB-INF/src/content/Language.properties
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
hooks/opencps-hook/docroot/WEB-INF/src/content/Language_en.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
2,066
hooks/opencps-hook/docroot/WEB-INF/src/content/Language_vi.properties
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
286 changes: 150 additions & 136 deletions
286
portlets/opencps-portlet/docroot/WEB-INF/src/org/opencps/backend/scheduler/Daily.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
Oops, something went wrong.