|
@@ -224,112 +224,116 @@ public class MobileFlowServiceImpl implements MobileFlowService {
|
|
|
public ModelMap auditDocuments(Long id, String description, Integer dealtype) {
|
|
public ModelMap auditDocuments(Long id, String description, Integer dealtype) {
|
|
|
ModelMap map = new ModelMap();
|
|
ModelMap map = new ModelMap();
|
|
|
AppFlowOperation op = appFlowOperationDao.findOne(id);
|
|
AppFlowOperation op = appFlowOperationDao.findOne(id);
|
|
|
- if (op.getResult() == null || !op.getResult().equals(MobileStatus.AUDITED.getPhrase())) {
|
|
|
|
|
- op.setStatus(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
- op.setStatuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
- op.setDescription(description);
|
|
|
|
|
- op.setDealtime(new Date());
|
|
|
|
|
- ApprovalLog applog = approvalLogDao.findOne(op.getKeyvalue());
|
|
|
|
|
- applog.setStatus(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
- applog.setStatuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
- if (dealtype.equals(MobileStatus.AGREED.getValue())) {
|
|
|
|
|
- op.setResult(MobileStatus.AGREED.getPhrase());
|
|
|
|
|
- }
|
|
|
|
|
- if (dealtype.equals(MobileStatus.NOTAGREED.getValue())) {
|
|
|
|
|
- op.setResult(MobileStatus.NOTAGREED.getPhrase());
|
|
|
|
|
- }
|
|
|
|
|
- op = appFlowOperationDao.save(op);
|
|
|
|
|
-
|
|
|
|
|
- // 生成日志记录
|
|
|
|
|
- MobileAuditLog log = new MobileAuditLog();
|
|
|
|
|
- log.setDealname(op.getNodedealname());
|
|
|
|
|
- log.setDealresult(op.getResult());
|
|
|
|
|
- log.setDealtime(log.getDealtime());
|
|
|
|
|
- log.setDealuu(op.getNodedealuu());
|
|
|
|
|
- log.setInstanceid(op.getId());
|
|
|
|
|
- log.setEnuu(op.getEnuu());
|
|
|
|
|
- mobileAuditLogDao.save(log);
|
|
|
|
|
|
|
+ if (op == null) {
|
|
|
|
|
+ map.put("error", "单据不存在,可能已被删除!");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (op.getResult() == null || !op.getResult().equals(MobileStatus.AUDITED.getPhrase())) {
|
|
|
|
|
+ op.setStatus(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
+ op.setStatuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
+ op.setDescription(description);
|
|
|
|
|
+ op.setDealtime(new Date());
|
|
|
|
|
+ ApprovalLog applog = approvalLogDao.findOne(op.getKeyvalue());
|
|
|
|
|
+ applog.setStatus(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
+ applog.setStatuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
+ if (dealtype.equals(MobileStatus.AGREED.getValue())) {
|
|
|
|
|
+ op.setResult(MobileStatus.AGREED.getPhrase());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dealtype.equals(MobileStatus.NOTAGREED.getValue())) {
|
|
|
|
|
+ op.setResult(MobileStatus.NOTAGREED.getPhrase());
|
|
|
|
|
+ }
|
|
|
|
|
+ op = appFlowOperationDao.save(op);
|
|
|
|
|
|
|
|
- // 如果后面有其他节点,继续生成单据,通向下一个,并且记录审核记录(已通过才继续)
|
|
|
|
|
- if (op.getResult().equals(MobileStatus.AGREED.getPhrase())) {
|
|
|
|
|
- Integer maxNode = approvalFlowService.getMaxNodeByEnuuAndAppName(op.getEnuu(), op.getCaller());
|
|
|
|
|
- if (maxNode != null) {
|
|
|
|
|
- if (op.getNodelevel() < maxNode) {
|
|
|
|
|
- FlowNode node = approvalFlowService.getNodeInfoByEnuuAndAppNameAndNodelev(op.getEnuu(),
|
|
|
|
|
- op.getCaller(), op.getNodelevel() + 1);
|
|
|
|
|
- AppFlowOperation oper = new AppFlowOperation();
|
|
|
|
|
- oper.setCaller(op.getCaller());
|
|
|
|
|
- oper.setDealname(op.getDealname());
|
|
|
|
|
- oper.setDealuu(op.getDealuu());
|
|
|
|
|
- oper.setEnuu(op.getEnuu());
|
|
|
|
|
- oper.setKeyvalue(op.getKeyvalue());
|
|
|
|
|
- oper.setNodedealname(node.getEmname());
|
|
|
|
|
- oper.setNodedealuu(node.getEmcode());
|
|
|
|
|
- oper.setNodelevel(node.getNodelev());
|
|
|
|
|
- oper.setNodename(node.getNodename());
|
|
|
|
|
- oper.setProcessnote(
|
|
|
|
|
- "[" + op.getNodedealname() + "]" + op.getResult() + " 备注:" + op.getDescription());
|
|
|
|
|
- oper.setRecorddate(op.getRecorddate());
|
|
|
|
|
- oper.setSourceid(op.getSourceid());
|
|
|
|
|
- oper.setStatus(MobileStatus.UNAUDIT.getPhrase());
|
|
|
|
|
- oper.setStatuscode(MobileStatus.UNAUDIT.name());
|
|
|
|
|
- oper = appFlowOperationDao.save(oper);
|
|
|
|
|
- if (oper.getId() != null) {
|
|
|
|
|
- map.put("success", true);
|
|
|
|
|
- } else {
|
|
|
|
|
- map.put("success", false);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (op.getNodelevel() == maxNode) { // 如果为最后一个,原单据状态变为已审批
|
|
|
|
|
- if (op.getCaller().equals(MobileStatus.VACATION.getPhrase())) {// 请假单
|
|
|
|
|
- Vacation va = vacationDao.findOne(op.getSourceid());
|
|
|
|
|
- va.setVa_statuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
- va.setVa_status(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
- vacationDao.save(va);
|
|
|
|
|
- map.put("success", true);
|
|
|
|
|
- }
|
|
|
|
|
- if (op.getCaller().equals(MobileStatus.WORKDAILY.getPhrase())) {// 工作日报
|
|
|
|
|
- WorkDaily wo = workDailyDao.findOne(op.getSourceid());
|
|
|
|
|
- wo.setWd_statuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
- wo.setWd_status(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
- workDailyDao.save(wo);
|
|
|
|
|
- map.put("success", true);
|
|
|
|
|
- }
|
|
|
|
|
- if (op.getCaller().equals(MobileStatus.WORKOVERTIME.getPhrase())) {// 加班申请
|
|
|
|
|
- WorkOvertime wot = workOvertimeDao.findOne(op.getSourceid());
|
|
|
|
|
- wot.setWo_statuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
- wot.setWo_status(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
- workOvertimeDao.save(wot);
|
|
|
|
|
- map.put("success", true);
|
|
|
|
|
- }
|
|
|
|
|
- if (op.getCaller().equals(MobileStatus.FEEPLEASE.getPhrase())) {// 出差单
|
|
|
|
|
- FeePlease fee = feePleaseDao.findOne(op.getSourceid());
|
|
|
|
|
- fee.setFp_statuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
- fee.setFp_status(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
- feePleaseDao.save(fee);
|
|
|
|
|
- map.put("success", true);
|
|
|
|
|
- }
|
|
|
|
|
- if (op.getCaller().equals(MobileStatus.SIGNAPP.getPhrase())) {// 申诉单
|
|
|
|
|
- SignApp app = signAppDao.findOne(op.getSourceid());
|
|
|
|
|
- app.setStatus(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
- app.setStatuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
- signAppDao.save(app);
|
|
|
|
|
|
|
+ // 生成日志记录
|
|
|
|
|
+ MobileAuditLog log = new MobileAuditLog();
|
|
|
|
|
+ log.setDealname(op.getNodedealname());
|
|
|
|
|
+ log.setDealresult(op.getResult());
|
|
|
|
|
+ log.setDealtime(log.getDealtime());
|
|
|
|
|
+ log.setDealuu(op.getNodedealuu());
|
|
|
|
|
+ log.setInstanceid(op.getId());
|
|
|
|
|
+ log.setEnuu(op.getEnuu());
|
|
|
|
|
+ mobileAuditLogDao.save(log);
|
|
|
|
|
|
|
|
- // 插入数据到打卡记录中
|
|
|
|
|
- SignCard card = new SignCard();
|
|
|
|
|
- card.setCl_address(app.getAddress());
|
|
|
|
|
- card.setCl_date(app.getSigntime());
|
|
|
|
|
- card.setCl_emname(app.getEmname());
|
|
|
|
|
- card.setCl_phone(app.getMobile());
|
|
|
|
|
- card.setEmcode(app.getEmuu());
|
|
|
|
|
- card.setEnuu(app.getUu());
|
|
|
|
|
- card = signCardDao.save(card);
|
|
|
|
|
- if (card.getId() != null) {
|
|
|
|
|
|
|
+ // 如果后面有其他节点,继续生成单据,通向下一个,并且记录审核记录(已通过才继续)
|
|
|
|
|
+ if (op.getResult().equals(MobileStatus.AGREED.getPhrase())) {
|
|
|
|
|
+ Integer maxNode = approvalFlowService.getMaxNodeByEnuuAndAppName(op.getEnuu(), op.getCaller());
|
|
|
|
|
+ if (maxNode != null) {
|
|
|
|
|
+ if (op.getNodelevel() < maxNode) {
|
|
|
|
|
+ FlowNode node = approvalFlowService.getNodeInfoByEnuuAndAppNameAndNodelev(op.getEnuu(),
|
|
|
|
|
+ op.getCaller(), op.getNodelevel() + 1);
|
|
|
|
|
+ AppFlowOperation oper = new AppFlowOperation();
|
|
|
|
|
+ oper.setCaller(op.getCaller());
|
|
|
|
|
+ oper.setDealname(op.getDealname());
|
|
|
|
|
+ oper.setDealuu(op.getDealuu());
|
|
|
|
|
+ oper.setEnuu(op.getEnuu());
|
|
|
|
|
+ oper.setKeyvalue(op.getKeyvalue());
|
|
|
|
|
+ oper.setNodedealname(node.getEmname());
|
|
|
|
|
+ oper.setNodedealuu(node.getEmcode());
|
|
|
|
|
+ oper.setNodelevel(node.getNodelev());
|
|
|
|
|
+ oper.setNodename(node.getNodename());
|
|
|
|
|
+ oper.setProcessnote(
|
|
|
|
|
+ "[" + op.getNodedealname() + "]" + op.getResult() + " 备注:" + op.getDescription());
|
|
|
|
|
+ oper.setRecorddate(op.getRecorddate());
|
|
|
|
|
+ oper.setSourceid(op.getSourceid());
|
|
|
|
|
+ oper.setStatus(MobileStatus.UNAUDIT.getPhrase());
|
|
|
|
|
+ oper.setStatuscode(MobileStatus.UNAUDIT.name());
|
|
|
|
|
+ oper = appFlowOperationDao.save(oper);
|
|
|
|
|
+ if (oper.getId() != null) {
|
|
|
map.put("success", true);
|
|
map.put("success", true);
|
|
|
} else {
|
|
} else {
|
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (op.getNodelevel() == maxNode) { // 如果为最后一个,原单据状态变为已审批
|
|
|
|
|
+ if (op.getCaller().equals(MobileStatus.VACATION.getPhrase())) {// 请假单
|
|
|
|
|
+ Vacation va = vacationDao.findOne(op.getSourceid());
|
|
|
|
|
+ va.setVa_statuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
+ va.setVa_status(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
+ vacationDao.save(va);
|
|
|
|
|
+ map.put("success", true);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (op.getCaller().equals(MobileStatus.WORKDAILY.getPhrase())) {// 工作日报
|
|
|
|
|
+ WorkDaily wo = workDailyDao.findOne(op.getSourceid());
|
|
|
|
|
+ wo.setWd_statuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
+ wo.setWd_status(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
+ workDailyDao.save(wo);
|
|
|
|
|
+ map.put("success", true);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (op.getCaller().equals(MobileStatus.WORKOVERTIME.getPhrase())) {// 加班申请
|
|
|
|
|
+ WorkOvertime wot = workOvertimeDao.findOne(op.getSourceid());
|
|
|
|
|
+ wot.setWo_statuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
+ wot.setWo_status(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
+ workOvertimeDao.save(wot);
|
|
|
|
|
+ map.put("success", true);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (op.getCaller().equals(MobileStatus.FEEPLEASE.getPhrase())) {// 出差单
|
|
|
|
|
+ FeePlease fee = feePleaseDao.findOne(op.getSourceid());
|
|
|
|
|
+ fee.setFp_statuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
+ fee.setFp_status(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
+ feePleaseDao.save(fee);
|
|
|
|
|
+ map.put("success", true);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (op.getCaller().equals(MobileStatus.SIGNAPP.getPhrase())) {// 申诉单
|
|
|
|
|
+ SignApp app = signAppDao.findOne(op.getSourceid());
|
|
|
|
|
+ app.setStatus(MobileStatus.AUDITED.getPhrase());
|
|
|
|
|
+ app.setStatuscode(MobileStatus.AUDITED.name());
|
|
|
|
|
+ signAppDao.save(app);
|
|
|
|
|
+
|
|
|
|
|
+ // 插入数据到打卡记录中
|
|
|
|
|
+ SignCard card = new SignCard();
|
|
|
|
|
+ card.setCl_address(app.getAddress());
|
|
|
|
|
+ card.setCl_date(app.getSigntime());
|
|
|
|
|
+ card.setCl_emname(app.getEmname());
|
|
|
|
|
+ card.setCl_phone(app.getMobile());
|
|
|
|
|
+ card.setEmcode(app.getEmuu());
|
|
|
|
|
+ card.setEnuu(app.getUu());
|
|
|
|
|
+ card = signCardDao.save(card);
|
|
|
|
|
+ if (card.getId() != null) {
|
|
|
|
|
+ map.put("success", true);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ map.put("success", false);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|