|
@@ -15,6 +15,7 @@ import com.iamberry.rst.faces.product.ProductService;
|
|
import com.iamberry.rst.util.JdServiceUtil;
|
|
import com.iamberry.rst.util.JdServiceUtil;
|
|
import com.iamberry.rst.utils.AdminUtils;
|
|
import com.iamberry.rst.utils.AdminUtils;
|
|
import com.iamberry.rst.utils.StitchAttrUtil;
|
|
import com.iamberry.rst.utils.StitchAttrUtil;
|
|
|
|
+import com.iamberry.rst.utils.UploadFileUtils;
|
|
import com.iamberry.wechat.tools.NameUtils;
|
|
import com.iamberry.wechat.tools.NameUtils;
|
|
import com.iamberry.wechat.tools.ResponseJson;
|
|
import com.iamberry.wechat.tools.ResponseJson;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
@@ -25,10 +26,15 @@ import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Random;
|
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 发票管理
|
|
* 发票管理
|
|
@@ -64,17 +70,18 @@ public class BillingController {
|
|
@RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
|
|
@RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
|
|
ModelAndView mv = new ModelAndView("ei/ei_billing_list");
|
|
ModelAndView mv = new ModelAndView("ei/ei_billing_list");
|
|
|
|
|
|
|
|
+ Admin admin = AdminUtils.getLoginAdmin();
|
|
|
|
+ Integer adminDept = admin.getAdminDept(); // 1:技术组 2:销售组(销售部) 3:客服组(客服运营部) 4:运营组 5:财务部 6工厂生产部 7.管理部8工厂仓库部
|
|
|
|
+
|
|
PagedResult<Billing> pagedResult = billingService.getBillingPage(pageNO, pageSize, billing, totalNum == 0);
|
|
PagedResult<Billing> pagedResult = billingService.getBillingPage(pageNO, pageSize, billing, totalNum == 0);
|
|
if (totalNum != 0) {
|
|
if (totalNum != 0) {
|
|
pagedResult.setTotal(totalNum);
|
|
pagedResult.setTotal(totalNum);
|
|
}
|
|
}
|
|
|
|
|
|
-// String path = request.getSession().getServletContext().getRealPath("/");
|
|
|
|
-// boolean flag = nuoNuoServiceUtil.invoGetByNuoNuo(path);
|
|
|
|
-
|
|
|
|
StitchAttrUtil.getSa()
|
|
StitchAttrUtil.getSa()
|
|
.addDatePro("yyyy-MM-dd HH:mm:ss","startDate","endDate")
|
|
.addDatePro("yyyy-MM-dd HH:mm:ss","startDate","endDate")
|
|
.setModelAndView(billing, mv, "/admin/customerBasic/listCustomerBasic", pagedResult);
|
|
.setModelAndView(billing, mv, "/admin/customerBasic/listCustomerBasic", pagedResult);
|
|
|
|
+ mv.addObject("adminDept",adminDept);
|
|
return mv;
|
|
return mv;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -195,32 +202,94 @@ public class BillingController {
|
|
return new ResponseJson(200, "添加成功", 200);
|
|
return new ResponseJson(200, "添加成功", 200);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * to发票上传
|
|
|
|
+ * @param request
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping("/to_upload")
|
|
|
|
+ @RequiresPermissions("ei:billing:add")
|
|
|
|
+ public ModelAndView toUpload(HttpServletRequest request,Integer billId) throws Exception {
|
|
|
|
+ ModelAndView mv = new ModelAndView("ei/ei_billing_upload");
|
|
|
|
+ mv.addObject("billId",billId);
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 重新开票
|
|
|
|
|
|
+ * 发票上传
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- @RequestMapping("/re_invoice")
|
|
|
|
|
|
+ @RequestMapping("/upload_invoice")
|
|
@RequiresPermissions("ei:billing:add")
|
|
@RequiresPermissions("ei:billing:add")
|
|
- public ResponseJson reInvoice(HttpServletRequest request,Integer billId) throws Exception {
|
|
|
|
|
|
+ public ResponseJson uploadInvoice(HttpServletRequest request,Integer billId, @RequestParam("file") CommonsMultipartFile file) {
|
|
ResponseJson rj = new ResponseJson();
|
|
ResponseJson rj = new ResponseJson();
|
|
Billing billing = billingService.getBillingById(billId);
|
|
Billing billing = billingService.getBillingById(billId);
|
|
- PlatformInfo platformInfo = platformInfoService.getPlatformInfoById(billing.getPlatId());
|
|
|
|
- if(platformInfo == null){
|
|
|
|
- rj = new ResponseJson(500, "查询所属平台失败", 500);
|
|
|
|
|
|
+ if(billing == null){
|
|
|
|
+ rj = new ResponseJson(500, "未查询到该发票信息", 500);
|
|
return rj;
|
|
return rj;
|
|
}
|
|
}
|
|
- BillingItem billingItem = new BillingItem();
|
|
|
|
- billingItem.setBillId(billId);
|
|
|
|
- List<BillingItem> billingItemList = billingItemService.getBillingItemList(billingItem);
|
|
|
|
- billing.setBillingItemList(billingItemList);
|
|
|
|
|
|
+ if(billing.getBillStatus() == 4){
|
|
|
|
+ rj = new ResponseJson(500, "该发票已推送,无法重新上传。", 500);
|
|
|
|
+ return rj;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String uuid = UUID.randomUUID().toString().substring(0,5);
|
|
|
|
|
|
- rj = new ResponseJson(500, "查询所属平台失败", 500);
|
|
|
|
|
|
+ String realPath = request.getSession().getServletContext().getRealPath("/");
|
|
|
|
+
|
|
|
|
+ String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().toString().lastIndexOf("."));
|
|
|
|
+ String name = billing.getBillOrderNo()+"-"+uuid+suffix;
|
|
|
|
+ String path = "";
|
|
|
|
+ try{
|
|
|
|
+ path = UploadFileUtils.eiUploadFile(realPath,name,file);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ return new ResponseJson(500, "上传PDF失败", 500);
|
|
|
|
+ }
|
|
|
|
+ rj = new ResponseJson(200, "上传发票成功", 200);
|
|
|
|
+ rj.addResponseKeyValue("path",path);
|
|
|
|
+ return rj;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 发票上传
|
|
|
|
+ * @param request
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping("/update_file")
|
|
|
|
+ @RequiresPermissions("ei:billing:add")
|
|
|
|
+ public ResponseJson updateFile(HttpServletRequest request,Billing bl) {
|
|
|
|
+ ResponseJson rj = new ResponseJson();
|
|
|
|
+ Billing billing = billingService.getBillingById(bl.getBillId());
|
|
|
|
+ if(bl.getBillInvoiceFileUrl() == null || "".equals(bl.getBillInvoiceFileUrl())){
|
|
|
|
+ rj = new ResponseJson(500, "上传路径为空", 500);
|
|
|
|
+ return rj;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(billing.getBillStatus() == 4){
|
|
|
|
+ rj = new ResponseJson(500, "该发票已推送,无法重新上传。", 500);
|
|
|
|
+ return rj;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bl.setBillStatus(2);
|
|
|
|
+ Integer flag = billingService.update(bl);
|
|
|
|
+
|
|
|
|
+ if(flag < 1){
|
|
|
|
+ return new ResponseJson(500, "修改发票信息失败", 500);
|
|
|
|
+ }
|
|
|
|
+ rj = new ResponseJson(200, "上传发票成功", 200);
|
|
return rj;
|
|
return rj;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询发票详情
|
|
* 查询发票详情
|
|
* @param request
|
|
* @param request
|
|
@@ -276,9 +345,14 @@ public class BillingController {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
if(jdPushLog.getPushLogStatus() == 1){
|
|
if(jdPushLog.getPushLogStatus() == 1){
|
|
|
|
+ Billing billing = new Billing();
|
|
|
|
+ billing.setBillId(pushLog.getBillId());
|
|
|
|
+ billing.setBillStatus(4);
|
|
|
|
+ Integer flag = billingService.update(billing);
|
|
return new ResponseJson(200, "上传发票成功", 200);
|
|
return new ResponseJson(200, "上传发票成功", 200);
|
|
}else{
|
|
}else{
|
|
return new ResponseJson(500, "上传发票失败,"+jdPushLog.getPushLogResultMsg(), 500);
|
|
return new ResponseJson(500, "上传发票失败,"+jdPushLog.getPushLogResultMsg(), 500);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|