|
|
@@ -1,837 +0,0 @@
|
|
|
-package com.uas.platform.b2b.controller;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.uas.platform.b2b.dao.CommonDao;
|
|
|
-import com.uas.platform.b2b.dao.PurchaseApBillOutDao;
|
|
|
-import com.uas.platform.b2b.dao.PurchaseApCheckItemInfoDao;
|
|
|
-import com.uas.platform.b2b.model.*;
|
|
|
-import com.uas.platform.b2b.search.SearchService;
|
|
|
-import com.uas.platform.b2b.service.*;
|
|
|
-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.exception.IllegalOperatorException;
|
|
|
-import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
-import com.uas.platform.core.model.Constant;
|
|
|
-import com.uas.platform.core.model.PageInfo;
|
|
|
-import com.uas.platform.core.model.PageParams;
|
|
|
-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.apache.poi.ss.usermodel.Cell;
|
|
|
-import org.apache.poi.ss.usermodel.Row;
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
-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.web.bind.annotation.*;
|
|
|
-import org.springframework.web.servlet.ModelAndView;
|
|
|
-
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.InputStream;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.text.DecimalFormat;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
-/**
|
|
|
- *
|
|
|
- * 航天开票
|
|
|
- *
|
|
|
- */
|
|
|
-
|
|
|
-@SuppressWarnings("deprecation")
|
|
|
-@Controller
|
|
|
-@RequestMapping("/sale/apBillOut")
|
|
|
-public class SaleApBillOutController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ErpProdIODetailService erpProdIODetailService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- PurchaseApCheckService purchaseApCheckService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private VendorService vendorService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private UserService userService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SearchService searchService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private PurchaseApCheckItemInfoDao PurchaseApCheckItemInfoDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private PurchaseApBillOutService purchaseApBillOutService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private CommonDao commonDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private PurchaseApBillOutDao purchaseApBillOutDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SOAPConsoleService sOAPConsoleService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private PiaoPlusService piaoPlusService;
|
|
|
-
|
|
|
- private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
-
|
|
|
- /**
|
|
|
- * 打印对账单,增加打印次数
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- // 此方法只是更新了打印次数 目前处于弃用状态
|
|
|
- @RequestMapping(value = "/printCount/{id}", method = RequestMethod.POST)
|
|
|
- @ResponseBody
|
|
|
- public ResponseEntity<String> printCount(@PathVariable("id") Long id) {
|
|
|
- purchaseApCheckService.print(id);
|
|
|
- logger.log("开票单", "打印开票单单据", id.toString());
|
|
|
- return new ResponseEntity<String>(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 得到所有的供应商信息便于筛选
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/getAllCustomers", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public Set<Object> getAllApChecksCustomers() {
|
|
|
- Set<Object> set = new HashSet<>();
|
|
|
- // 判断当前用户是否被客户分配
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
- // 不是管理员也没被分配客户是直接返回空
|
|
|
- if (filter != null && filter.getDistribute() == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- Set<Role> roles = SystemSession.getUser().getRoles();
|
|
|
- boolean isSys = false;
|
|
|
- for (Role role : roles) {
|
|
|
- if (role.getIssys() == 1) {
|
|
|
- isSys = true;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!SystemSession.getUser().isSys() && !isSys) { // 不是管理员,被分配客户时
|
|
|
- List<Vendor> vendors = userService.findChooseVendor(SystemSession.getUser().getUserUU());
|
|
|
- if (!CollectionUtils.isEmpty(vendors)) {
|
|
|
- for (Vendor v : vendors) {
|
|
|
- if (v.getApcheck().equals(Constant.YES)) {// 只有开通了B2B对账的才筛选
|
|
|
- set.add(v.getMyEnterprise().getEnName()); // 这里添加客户名称
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- return null;
|
|
|
- }
|
|
|
- } else {
|
|
|
- List<Vendor> vendors = vendorService.findMyCustomers();
|
|
|
- for (Vendor vendor : vendors) {
|
|
|
- set.add(vendor.getMyEnterprise().getEnName());
|
|
|
- }
|
|
|
- }
|
|
|
- return set;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping(value = "/getDoneByKeywords", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public Set<PurchaseApCheckItemInfo> getDoneApchecksByDate(Long fromDate, Long endDate, String keyword) {
|
|
|
- List<Long> distributes = null;
|
|
|
- // 判断当前用户是否被客户分配
|
|
|
- if (!SystemSession.getUser().isSys()) {
|
|
|
- List<Vendor> vendors = userService.findChooseVendor(SystemSession.getUser().getUserUU());
|
|
|
- distributes = new ArrayList<Long>();
|
|
|
- if (!CollectionUtils.isEmpty(vendors)) {
|
|
|
- for (Vendor v : vendors) {
|
|
|
- distributes.add(v.getMyEnUU());
|
|
|
- }
|
|
|
- } else {
|
|
|
- return null;
|
|
|
- }
|
|
|
- }
|
|
|
- List<PurchaseApCheckItem> purchaseApCheckItems = purchaseApCheckService.findDoneApCheckItems(distributes, keyword, fromDate, endDate); //erpProdIODetailService.findDoneXlsApChecks(distributes, keyword, fromDate, endDate);
|
|
|
-
|
|
|
- Set<PurchaseApCheckItemInfo> apCheckItems = new HashSet<PurchaseApCheckItemInfo>();
|
|
|
- for (PurchaseApCheckItem purchaseApCheckItem : purchaseApCheckItems ){
|
|
|
- Long id = purchaseApCheckItem.getId();
|
|
|
- PurchaseApCheckItemInfo item = PurchaseApCheckItemInfoDao.findOne(id);
|
|
|
- apCheckItems.add(item);
|
|
|
- }
|
|
|
- return apCheckItems;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存生成的开票单主记录
|
|
|
- */
|
|
|
- @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap saveApBillOut(@RequestBody String json) {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- List<String> alters = new ArrayList<String>();
|
|
|
- JSONObject jsonObject = JSON.parseObject(json);
|
|
|
- //提取数据来源单据信息
|
|
|
- String sourceInfos = jsonObject.getString("sourceInfos");
|
|
|
- List<HashMap<String, Object>> sourceInfoList = FlexJsonUtils.fromJsonArray(sourceInfos, HashMap.class);
|
|
|
- jsonObject.remove("sourceInfos");
|
|
|
- json = jsonObject.toJSONString();
|
|
|
- PurchaseApBillOut apBillOut = FlexJsonUtils.fromJson(json, PurchaseApBillOut.class);
|
|
|
- if (apBillOut != null) {
|
|
|
- for (PurchaseApBillOutItem item : apBillOut.getItems()) {
|
|
|
- List<PurchaseApBillOutItem> items = purchaseApBillOutService
|
|
|
- .findBySourceTableAndSourceId(item.getSourceTable(), item.getSourceId());
|
|
|
- for (PurchaseApBillOutItem newitem : items) {
|
|
|
- if (newitem.getApBillOut().getCheckStatus().equals("未开票")) {
|
|
|
- alters.add(newitem.getApBillOut().getCode());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (alters.size() > 0) {
|
|
|
- map.put("alters", alters);
|
|
|
- throw new IllegalOperatorException("开票单" + alters + "存在未开票的单据,请先进行开票!");
|
|
|
- } else {
|
|
|
- apBillOut = purchaseApBillOutService.save(apBillOut,sourceInfoList);
|
|
|
-
|
|
|
- logger.log("开票单", "多个单据生成同一张开票单", apBillOut.getRemark(), null, apBillOut.getId());
|
|
|
- map.put("id", apBillOut.getId());
|
|
|
- return map;
|
|
|
- }
|
|
|
- } else {
|
|
|
- throw new IllegalOperatorException("保存失败!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获得开票单,对应id
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public PurchaseApBillOut getCreatedPurchaseApBillOutById(@PathVariable("id") Long id) {
|
|
|
- logger.log("开票单", "查看单个开票单", null, null, id);
|
|
|
- return purchaseApBillOutService.findById(id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 作为卖家,获取全部开票单(全部)
|
|
|
- *
|
|
|
- * @param params
|
|
|
- * @param searchFilter
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public SPage<PurchaseApBillOut> getAllApBillOuts(PageParams params, String searchFilter) {
|
|
|
- logger.log("开票单", "获取全部开票单据");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为买家
|
|
|
- pageParams.getFilters().put("pabo_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- // TODO 其他过滤条件
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
- if (filter != null && filter.getDistribute() == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
- for (Object object : filter.getDistribute()) {
|
|
|
- list.add(object);
|
|
|
- }
|
|
|
- pageParams.getFilters().put("pabo_custuu", new MultiValue(list, true));
|
|
|
- }
|
|
|
- // 排序条件
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("pabo_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseApBillOutIds(keyword, pageParams);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 作为卖家,获取开票单(未开票)
|
|
|
- */
|
|
|
- @RequestMapping(params = RequestState.TODO, method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public SPage<PurchaseApBillOut> getTodoApBillOuts(PageParams params, String searchFilter) {
|
|
|
- logger.log("开票单", "获取未开票的开票单据");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为买家
|
|
|
- pageParams.getFilters().put("pabo_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- // TODO 其他过滤条件
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
- if (filter != null && filter.getDistribute() == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
- for (Object object : filter.getDistribute()) {
|
|
|
- list.add(object);
|
|
|
- }
|
|
|
- pageParams.getFilters().put("pabo_custuu", new MultiValue(list, true));
|
|
|
- }
|
|
|
- pageParams.getFilters().put("pabo_checkstatus", "未开票");
|
|
|
- // 排序条件
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- // 如果日期为空,设置的默认时间2000/1/1 1:1:1
|
|
|
- sortList.add(new Sort("pabo_recorddate", false, Type.LONG, new Long(946659661)));
|
|
|
- sortList.add(new Sort("pabo_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseApBillOutIds(keyword, pageParams);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 作为卖家,获取开票单(已开票)
|
|
|
- */
|
|
|
- @RequestMapping(params = RequestState.DONE, method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public SPage<PurchaseApBillOut> getDoneApBillOuts(PageParams params, String searchFilter) {
|
|
|
- logger.log("开票单", "获取已开票的开票单据");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为买家
|
|
|
- pageParams.getFilters().put("pabo_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- // TODO 其他过滤条件
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
- if (filter != null && filter.getDistribute() == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
- for (Object object : filter.getDistribute()) {
|
|
|
- list.add(object);
|
|
|
- }
|
|
|
- pageParams.getFilters().put("pabo_custuu", new MultiValue(list, true));
|
|
|
- }
|
|
|
- pageParams.getFilters().put("pabo_checkstatus", "已开票");
|
|
|
- // 排序条件
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("pabo_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseApBillOutIds(keyword, pageParams);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 作为卖家,获取开票单(已作废)
|
|
|
- */
|
|
|
- @RequestMapping(params = RequestState.END, method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public SPage<PurchaseApBillOut> getEndApBillOuts(PageParams params, String searchFilter) {
|
|
|
- logger.log("开票单", "获取已作废开票单据");
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(searchFilter);
|
|
|
- String keyword = jsonObject.getString("keyword");
|
|
|
- com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为买家
|
|
|
- pageParams.getFilters().put("pabo_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- // TODO 其他过滤条件
|
|
|
- SearchFilter filter = userService.distribute();
|
|
|
- if (filter != null && filter.getDistribute() == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
- for (Object object : filter.getDistribute()) {
|
|
|
- list.add(object);
|
|
|
- }
|
|
|
- pageParams.getFilters().put("pabo_custuu", new MultiValue(list, true));
|
|
|
- }
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
- //list.add("不同意");
|
|
|
- list.add("已作废");
|
|
|
- pageParams.getFilters().put("pabo_checkstatus", new MultiValue(list, true));
|
|
|
- // 排序条件
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("pabo_id", false, Type.LONG, new Long(1)));
|
|
|
- pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
- return searchService.searchPurchaseApBillOutIds(keyword, pageParams);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出 - 全部
|
|
|
- *
|
|
|
- * @param searchFilter
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/allxls", method = RequestMethod.GET)
|
|
|
- public ModelAndView exportApBillOut(String searchFilter) {
|
|
|
- SearchFilter filter = FlexJsonUtils.fromJson(searchFilter, SearchFilter.class);
|
|
|
- PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
- pageInfo.sorting("recordDate", Direction.DESC);
|
|
|
- pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
- ModelAndView modelAndView = new ModelAndView();
|
|
|
- modelAndView.addObject("dateFormat", dateFormat);
|
|
|
- modelAndView.addObject("state", "全部");
|
|
|
- modelAndView.addObject("data",
|
|
|
- purchaseApBillOutService.findAllByPageInfo(pageInfo, filter.getKeyword(), filter).getContent());
|
|
|
- modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApBillOut", "开票单列表_全部"));
|
|
|
- logger.log("开票单", "导出Excel列表", "导出全部Excel列表");
|
|
|
- return modelAndView;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出 - 已开票
|
|
|
- *
|
|
|
- * @param searchFilter
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/allxls", params = RequestState.DONE, method = RequestMethod.GET)
|
|
|
- public ModelAndView exportApBillOutDone(String searchFilter) {
|
|
|
- SearchFilter filter = FlexJsonUtils.fromJson(searchFilter, SearchFilter.class);
|
|
|
- PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
- pageInfo.sorting("recordDate", Direction.DESC);
|
|
|
- pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
- ModelAndView modelAndView = new ModelAndView();
|
|
|
- modelAndView.addObject("dateFormat", dateFormat);
|
|
|
- modelAndView.addObject("state", "已开票");
|
|
|
- modelAndView.addObject("data",
|
|
|
- purchaseApBillOutService.findDoneByPageInfo(pageInfo, filter.getKeyword(), filter).getContent());
|
|
|
- modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApBillOut", "开票单列表_已开票"));
|
|
|
- logger.log("开票单", "导出Excel列表", "导出已开票Excel列表");
|
|
|
- return modelAndView;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出 - 未开票
|
|
|
- *
|
|
|
- * @param searchFilter
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/allxls", params = RequestState.TODO, method = RequestMethod.GET)
|
|
|
- public ModelAndView exportApBillOutTodo(String searchFilter) {
|
|
|
- SearchFilter filter = FlexJsonUtils.fromJson(searchFilter, SearchFilter.class);
|
|
|
- PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
- pageInfo.sorting("recordDate", Direction.DESC);
|
|
|
- pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
- ModelAndView modelAndView = new ModelAndView();
|
|
|
- modelAndView.addObject("dateFormat", dateFormat);
|
|
|
- modelAndView.addObject("state", "未开票");
|
|
|
- modelAndView.addObject("data",
|
|
|
- purchaseApBillOutService.findTodoByPageInfo(pageInfo, filter.getKeyword(), filter).getContent());
|
|
|
- modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApBillOut", "开票单列表_未开票"));
|
|
|
- logger.log("开票单", "导出Excel列表", "导出未开票Excel列表");
|
|
|
- return modelAndView;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出 - 已作废
|
|
|
- *
|
|
|
- * @param searchFilter
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/allxls", params = RequestState.END, method = RequestMethod.GET)
|
|
|
- public ModelAndView exportApBillOutEnd(String searchFilter) {
|
|
|
- SearchFilter filter = FlexJsonUtils.fromJson(searchFilter, SearchFilter.class);
|
|
|
- PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
- pageInfo.sorting("recordDate", Direction.DESC);
|
|
|
- pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
- ModelAndView modelAndView = new ModelAndView();
|
|
|
- modelAndView.addObject("dateFormat", dateFormat);
|
|
|
- modelAndView.addObject("state", "已作废");
|
|
|
- modelAndView.addObject("data",
|
|
|
- purchaseApBillOutService.findEndByPageInfo(pageInfo, filter.getKeyword(), filter).getContent());
|
|
|
- modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApBillOut", "开票单列表_已作废"));
|
|
|
- logger.log("开票单", "导出Excel列表", "导出已作废Excel列表");
|
|
|
- return modelAndView;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 全部导出
|
|
|
- *
|
|
|
- * @param keyword
|
|
|
- * @param fromDate
|
|
|
- * @param endDate
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/xls", method = RequestMethod.GET)
|
|
|
- public ModelAndView export(String keyword, Long fromDate, Long endDate) {
|
|
|
- List<Long> distributes = null;
|
|
|
- // 判断当前用户是否被客户分配
|
|
|
- if (!SystemSession.getUser().isSys()) {
|
|
|
- List<Vendor> vendors = userService.findChooseVendor(SystemSession.getUser().getUserUU());
|
|
|
- distributes = new ArrayList<Long>();
|
|
|
- if (!CollectionUtils.isEmpty(vendors)) {
|
|
|
- for (Vendor v : vendors) {
|
|
|
- distributes.add(v.getMyEnUU());
|
|
|
- }
|
|
|
- } else {
|
|
|
- return null;
|
|
|
- }
|
|
|
- }
|
|
|
- ModelAndView modelAndView = new ModelAndView();
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
- modelAndView.addObject("dateFormat", dateFormat);
|
|
|
- modelAndView.addObject("data", erpProdIODetailService.findXlsApChecks(distributes, keyword, fromDate, endDate));
|
|
|
- modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApCheck", "客户应收对账单"));
|
|
|
- logger.log("客户应收对账单", "导出Excel列表", "导出全部Excel列表");
|
|
|
- return modelAndView;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/doExcel", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public void doTaxCodeExcel() {
|
|
|
- Workbook workbook = null;
|
|
|
- InputStream is = null;
|
|
|
- try {
|
|
|
- is = new FileInputStream("C:\\Users\\黄诚天\\Desktop\\税收分类编码.xlsx");
|
|
|
- workbook = new XSSFWorkbook(is);
|
|
|
- } catch (java.io.IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- Sheet sheet = workbook.getSheetAt(0);
|
|
|
- int rowNum = sheet.getLastRowNum();
|
|
|
- Row headerRow = sheet.getRow(0);
|
|
|
- DecimalFormat df = new DecimalFormat("#.##");
|
|
|
- if (headerRow != null) {
|
|
|
- for (int r = 1; r <= rowNum; r++) {
|
|
|
- Row row = sheet.getRow(r);
|
|
|
- if (row != null && row.getCell(0) != null && row.getCell(0).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
- String a = "",b,c,d,e,f,g,h = "";
|
|
|
-
|
|
|
- if (row.getCell(0) != null) {
|
|
|
- row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- a = row.getCell(0).getStringCellValue().trim();
|
|
|
-
|
|
|
- a = df.format(Double.parseDouble(a));
|
|
|
- }
|
|
|
-
|
|
|
- if (row.getCell(1) != null) {
|
|
|
- row.getCell(1).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- b = row.getCell(1).getStringCellValue().trim();
|
|
|
- } else {
|
|
|
- b = "";
|
|
|
- }
|
|
|
-
|
|
|
- if (row.getCell(2) != null) {
|
|
|
- row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- c = row.getCell(2).getStringCellValue().trim();
|
|
|
- } else {
|
|
|
- c = "";
|
|
|
- }
|
|
|
-
|
|
|
- if (row.getCell(3) != null) {
|
|
|
- row.getCell(3).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- d = row.getCell(3).getStringCellValue().trim();
|
|
|
- } else {
|
|
|
- d = "";
|
|
|
- }
|
|
|
-
|
|
|
- if (row.getCell(4) != null) {
|
|
|
- row.getCell(4).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- e = row.getCell(4).getStringCellValue().trim();
|
|
|
- } else {
|
|
|
- e = "";
|
|
|
- }
|
|
|
-
|
|
|
- if (row.getCell(5) != null) {
|
|
|
- row.getCell(5).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- f = row.getCell(5).getStringCellValue().trim();
|
|
|
- } else {
|
|
|
- f = "";
|
|
|
- }
|
|
|
-
|
|
|
- if (row.getCell(6) != null) {
|
|
|
- row.getCell(6).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- g = row.getCell(6).getStringCellValue().trim();
|
|
|
- } else {
|
|
|
- g = "";
|
|
|
- }
|
|
|
-
|
|
|
- if (row.getCell(7) != null) {
|
|
|
- row.getCell(7).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- h = row.getCell(7).getStringCellValue().trim();
|
|
|
-
|
|
|
- h = df.format(Double.parseDouble(a));
|
|
|
- }
|
|
|
-
|
|
|
- //purchaseApBillOutDao.saveData(a,b,c,d,e,f,g,h);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除未开票单
|
|
|
- * @param id
|
|
|
- */
|
|
|
- @RequestMapping(value = "/deleteApBillOut/{id}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public void deleteApBillOut(@PathVariable("id") Long id){
|
|
|
- purchaseApBillOutService.deleteApBillOut(id);
|
|
|
- logger.log("开票单", "删除开票单", null, null, id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 开具发票
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/invoiceIssued/{id}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap invoiceIssued(@PathVariable("id") Long id) {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- map = purchaseApBillOutService.doBillOut(id);
|
|
|
- if (map.get("dbError") != null) {
|
|
|
- logger.log("开票单", "开具发票", (String)map.get("dbError"), null, id);
|
|
|
- }
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 启动开票服务
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/startBillOut", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap startBillOut() {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- map = sOAPConsoleService.startBillOut();
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 关闭开票服务
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/closeBillOut", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap closeBillOut() {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- map = sOAPConsoleService.closeBillOut();
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取每种发票的库存信息
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/getRepertoryMessage", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap getRepertoryMessage() {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- map = sOAPConsoleService.getRepertoryMessage();
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 发票打印
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/invoicePrint/{id}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap invoicePrint(@PathVariable("id") Long id){
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
|
|
|
- if (apBillOut == null) {
|
|
|
- map.put("error", "不存在此开票单");
|
|
|
- return map;
|
|
|
- }
|
|
|
- map = sOAPConsoleService.invoicePrint(apBillOut, 0);
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 清单打印
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/listPrint/{id}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap listPrint(@PathVariable("id") Long id){
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
|
|
|
- if (apBillOut == null) {
|
|
|
- map.put("error", "不存在此开票单");
|
|
|
- return map;
|
|
|
- }
|
|
|
- map = sOAPConsoleService.listPrint(apBillOut);
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 发票作废
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/InvoiceCancel/{id}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap InvoiceCancel(@PathVariable("id") Long id){
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
|
|
|
- if (apBillOut == null) {
|
|
|
- map.put("error", "不存在此开票单");
|
|
|
- return map;
|
|
|
- }
|
|
|
- map = purchaseApBillOutService.invoiceCancel(apBillOut);//sOAPConsoleService.InvoiceCancel(apBillOut);
|
|
|
- if (map.get("dbError") != null) {
|
|
|
- logger.log("开票单", "开具发票", (String)map.get("dbError"), null, id);
|
|
|
- map.remove("dbError");
|
|
|
- map.put("error","开票失败,系统错误,请联系管理员");
|
|
|
- }
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询发票信息
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/queryInvoiceMessage/{id}/{qdbz}/{dybz}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap queryInvoiceMessage(@PathVariable("id") Long id,
|
|
|
- @PathVariable("qdbz") Integer qdbz,
|
|
|
- @PathVariable("dybz") Integer dybz){
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
|
|
|
- if (apBillOut == null) {
|
|
|
- map.put("error", "不存在此开票单");
|
|
|
- return map;
|
|
|
- }
|
|
|
- map = sOAPConsoleService.queryInvoiceMessage(apBillOut,qdbz,dybz);
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询库存信息
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/queryRepertyMessage", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap queryRepertyMessage() {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- map = sOAPConsoleService.queryRepertyMessage();
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询下一发票机库存信息
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/queryNextRepertyMessage", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap queryNextRepertyMessage() {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- map = sOAPConsoleService.queryNextRepertyMessage();
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 发票上传
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/invoiceUpload/{id}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap invoiceUpload(@PathVariable("id") Long id){
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
|
|
|
- if (apBillOut == null) {
|
|
|
- map.put("error", "不存在此开票单");
|
|
|
- return map;
|
|
|
- }
|
|
|
- map = sOAPConsoleService.invoiceUpload(apBillOut);
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 发票状态更新
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/invoiceStatusUpdate", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap invoiceStatusUpdate() {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- map = sOAPConsoleService.invoiceStatusUpdate();
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 单张发票查询
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/singleInvoiceQuery/{id}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap singleInvoiceQuery(@PathVariable("id") Long id){
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
|
|
|
- if (apBillOut == null) {
|
|
|
- map.put("error", "不存在此开票单");
|
|
|
- return map;
|
|
|
- }
|
|
|
- map = sOAPConsoleService.singleInvoiceQuery(apBillOut);
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 金税设备查询
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/taxEquipmentQuery", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap taxEquipmentQuery(){
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- map = sOAPConsoleService.taxEquipmentQuery();
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取分类编码信息
|
|
|
- * @param spbm
|
|
|
- * @param version
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping(value = "/taxCode/{spbm}/{version}", method = RequestMethod.GET)
|
|
|
- @ResponseBody
|
|
|
- public ModelMap taxCode(@PathVariable("spbm") String spbm,
|
|
|
- @PathVariable("version") String version){
|
|
|
- ModelMap map = new ModelMap();
|
|
|
- PurchaseApBillOutTaxCode taxCode = purchaseApBillOutService.getTaxCode(spbm, version);
|
|
|
- if (taxCode == null) {
|
|
|
- map.put("error", "不存在此分类信息,请尽快联系管理员");
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- //科学计数转数字
|
|
|
- String spbmStr = taxCode.getSpbm();
|
|
|
- BigDecimal db = new BigDecimal(spbmStr);
|
|
|
- String ii = db.toPlainString();
|
|
|
- Long spbmLong = Long.parseLong(ii);
|
|
|
-
|
|
|
- //数字转科学计数
|
|
|
- String spbmBackStr = new BigDecimal(spbmLong).stripTrailingZeros().toString();
|
|
|
-
|
|
|
- map.put("taxCode", taxCode);
|
|
|
- map.put("spbmstr", spbmStr);
|
|
|
- map.put("spbmLong", spbmLong);
|
|
|
- map.put("spbmBackStr", spbmBackStr);
|
|
|
-
|
|
|
- return map;
|
|
|
- }
|
|
|
-}
|