|
|
@@ -0,0 +1,124 @@
|
|
|
+package com.uas.platform.b2b.mall2.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.uas.platform.b2b.model.*;
|
|
|
+import com.uas.platform.b2b.search.SearchService;
|
|
|
+import com.uas.platform.b2b.service.AttachService;
|
|
|
+import com.uas.platform.b2b.service.OrderRedDotService;
|
|
|
+import com.uas.platform.b2b.service.PurchaseProofingService;
|
|
|
+import com.uas.platform.b2b.service.UserService;
|
|
|
+import com.uas.platform.b2b.support.JxlsExcelView;
|
|
|
+import com.uas.platform.b2b.support.SystemSession;
|
|
|
+import com.uas.platform.b2b.support.UsageBufferedLogger;
|
|
|
+import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
+import com.uas.platform.core.model.PageInfo;
|
|
|
+import com.uas.platform.core.model.PageParams;
|
|
|
+import com.uas.platform.core.model.Status;
|
|
|
+import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
|
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
+import com.uas.platform.core.web.bind.RequestState;
|
|
|
+import com.uas.search.b2b.model.MultiValue;
|
|
|
+import com.uas.search.b2b.model.SPage;
|
|
|
+import com.uas.search.b2b.model.Sort;
|
|
|
+import com.uas.search.b2b.model.Sort.Type;
|
|
|
+import com.uas.search.b2b.util.SearchConstants;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Sort.Direction;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 卖家获取对应的客户打样申请单
|
|
|
+ *
|
|
|
+ * @author suntg
|
|
|
+ *
|
|
|
+ */
|
|
|
+@SuppressWarnings("deprecation")
|
|
|
+@Controller("mall2.SaleSampleController")
|
|
|
+@RequestMapping("/mall2/sale/sample")
|
|
|
+public class SaleSampleController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseProofingService purchaseProofingService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 作为卖家,在平台上对客户打样申请进行送样
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/{id}/send", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public ResponseEntity<String> sendSample(@RequestBody String json, @PathVariable("id") Long id) {
|
|
|
+ PurchaseProofingSend proofingSend = FlexJsonUtils.fromJson(json, PurchaseProofingSend.class);
|
|
|
+ PurchaseProofingItem proofingItem = new PurchaseProofingItem();
|
|
|
+ proofingItem.setId(id);
|
|
|
+ proofingSend.setProofingItem(proofingItem);
|
|
|
+ proofingSend.setItemId(id);
|
|
|
+
|
|
|
+ // 如果有附件,初始化一下附件的数据
|
|
|
+ if (!CollectionUtils.isEmpty(proofingSend.getAttachs())) {
|
|
|
+ proofingSend.getAttachs().forEach(attach -> {
|
|
|
+ attach.setDate(new Date());
|
|
|
+ attach.setDescription("送样单附件");
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ proofingSend = purchaseProofingService.send(proofingSend);
|
|
|
+ logger.log("客户打样申请", "对客户打样申请送样", "送样单号:" + proofingSend.getCode());
|
|
|
+ return new ResponseEntity<String>(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取计数统计
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/counts", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ModelMap getCounts() {
|
|
|
+ ModelMap modelMap = new ModelMap();
|
|
|
+ Long vendUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ SearchFilter distribute = userService.distribute();
|
|
|
+ Collection enUUs = null;
|
|
|
+ if (distribute != null && distribute.getDistribute() != null) {
|
|
|
+ enUUs = distribute.getDistribute();
|
|
|
+ }
|
|
|
+ modelMap.put("todo", purchaseProofingService.countTodoProofing(vendUU, enUUs));
|
|
|
+ modelMap.put("done", purchaseProofingService.countDoneProofing(vendUU, enUUs));
|
|
|
+ modelMap.put("invalid", purchaseProofingService.countInvalidProofing(vendUU, enUUs));
|
|
|
+ return modelMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 作为卖家,获取送样申请明细的送样单
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/{id}/send", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ModelMap getProofingSends(@PathVariable("id") Long id) {
|
|
|
+ List<PurchaseProofingSend> sends = purchaseProofingService.findSendsByItemId(id);
|
|
|
+ logger.log("客户打样申请", "获取打样申请的送样信息,送样单明细id:" + id);
|
|
|
+ ModelMap modelMap = new ModelMap();
|
|
|
+ modelMap.put("data", sends);
|
|
|
+ return modelMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|