Demo entry 6687275

ApproveOrder

   

Submitted by Hello on Dec 27, 2017 at 04:35
Language: Java. Code size: 2.2 kB.

class ApproveOrder {
	public static void main(String[] args) {

		Order order = readDao.getOrderDetail(order);

		if (order.getWhoTheNext() != user.getContactId()){
			throw new RpcServerLogicalException(1,"无权审批");
		}

		if(order.getOperation() == YES) {

			order.setWhoConfirm(order.getWhoConfirm() + user.getContactId());
			order.setRequestStep(order.getRequestStep() + 1);

			if (order.getRequestStep() <= (alljuders.length()-1)) {
				order.setWhoTheNext(alljuders[order.getRequestStep()]);
				PushUtil.insertPushTable();
			} else {
				order.setWhoTheNext(0);
				order.setFinished(1);
				order.setRequestStep(order.getRequestStep()-1);
			}

			conn.updateFlow(order);

			conn.insertConfirm(order, user);

			if (order.getFinish() == 1 && order.getCc() != null) {
				for (int i = 0 ; i < readDao.selectFileCc().size() ; i++) {
					PushUtil.insertPushTable()
				}
				order.setFiledPeople(ccList);
				saveDao.updateFiledStatus(order, user);
			}

			if (order.getFinish() == 1) {

				switch(order.getRequestType()) {

					case Order.PURCHASE:

						order = readDao.selectContent(orderId);
						HttpUtils.httpsRequest("purchaseAmount", user.getAccessToken());
						if (Utils.isNotNull(result)) {
							if(resultJson.getString("respCode") != "000") {
								throw new Exception("");
							}
						} else {
							throw new Exception("");
						}

					case Order.INPUT:

						order = readDao.selectProduction(order);
						for(int i = 0; i < order.getInstanceParams().size(); i++){
							HttpUtils.httpsRequest("outInventory")
						}

					case Order.OUTPUT:

						order = readDao.selectProduction(order)
						for(int i = 0; i < order.getInstanceParams().size(); i++){
							HttpUtils.httpsRequest("outInventory")
						}

				}

			}

		} else if(order.getOperation() == NO){
			order.setRequestStep(order.getRequestStep() + 1)
			order.setWhoTheNext(0);
			order.setFinished(3);
			order.setWhoRefused(user.getContactId());
			saveDao.updateFlow(order);
			saveDao.insertConfirm(order, user);
			saveDao.insertRefuseRedPoint(order, user);
			PushUtil.insertPushTable();
		}
	}
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).