|
|
@@ -5,15 +5,19 @@ package com.goafanti.order.controller;
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.goafanti.admin.service.AttachmentService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.enums.AttachmentType;
|
|
|
+import com.goafanti.common.model.Attachment;
|
|
|
import com.goafanti.common.utils.LoggerUtils;
|
|
|
import com.goafanti.order.bo.TemporaryReceivablesBo;
|
|
|
import com.goafanti.order.service.OrderReceivablesService;
|
|
|
@@ -24,6 +28,8 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
|
|
|
|
|
|
@Resource
|
|
|
private OrderReceivablesService orderReceivablesService;
|
|
|
+ @Resource
|
|
|
+ private AttachmentService attachmentService;
|
|
|
/**
|
|
|
* 新增预计回款信息
|
|
|
* @param t
|
|
|
@@ -109,4 +115,31 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
|
|
|
res.data(orderReceivablesService.batchImport());
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载回款批量导入Excel模板
|
|
|
+ *
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/downloadTemplate", method = RequestMethod.GET)
|
|
|
+ public Result downloadTemplateFile(HttpServletResponse response, String sign) {
|
|
|
+ Result res = new Result();
|
|
|
+ AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
+ if (attachmentType == AttachmentType.RECEIVABLES_TEMPLATE) {
|
|
|
+ String fileName = "";
|
|
|
+ Attachment af = attachmentService.selectByReceivbles(sign);
|
|
|
+ if (null == af) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.FILE_NON_EXISTENT, "", "找不到文件!"));
|
|
|
+ } else {
|
|
|
+ String path = af.getFilePath();
|
|
|
+ String suffix = path.substring(path.lastIndexOf("."));
|
|
|
+ fileName = AttachmentType.RECEIVABLES_TEMPLATE.getDesc() + suffix;
|
|
|
+ downloadFile(response, fileName, path);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|