| | |
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.springframework.web.bind.annotation.RequestParam;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.service.AdminUserService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/upload")
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderProcessService orderProcessService;
|
| | | |
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | | |
| | |
|
| | | // private static final String PAYSUCCESS = "支付成功";
|
| | | // private static final String ORDERCLOSE="订单关闭";
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 新后台端 上传订单文件
|
| | | * @param file excel文件
|
| | | * @param uid 当前用户id
|
| | | * @param request
|
| | | * @param response
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "uploadOrderFile")
|
| | | public void uploadOrderFile(@RequestParam("file") CommonsMultipartFile file, Long uid,
|
| | | HttpServletRequest request, HttpServletResponse response, PrintWriter out) {
|
| | | |
| | | response.setHeader("Access-Control-Allow-Origin", "*");
|
| | | response.setHeader("Access-Control-Allow-Methods", "*");
|
| | | |
| | | AdminUser admin = adminUserService.selectByPrimaryKey(uid);
|
| | | if (admin == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户验证未通过"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("上传文件不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | List<TaoBaoOrder> orderList = TaoBaoOrderUtil.parseOrder(file.getInputStream());
|
| | | |
| | | orderProcessService.processOrder(TaoBaoOrderUtil.classifyTaoBaoOrderByOrderId(orderList));
|
| | | |
| | | out.print(JsonUtil.loadTrueResult("上传成功"));
|
| | | |
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadFalseResult("上传异常"));
|
| | | }
|
| | | }
|
| | | |
| | | }
|