|
@@ -10,13 +10,9 @@ import java.util.*;
|
|
|
import com.yijia.common.core.domain.model.LoginUser;
|
|
|
import com.yijia.common.exception.CustomException;
|
|
|
import com.yijia.common.utils.SecurityUtils;
|
|
|
-import com.yijia.station.domain.PayOrder;
|
|
|
-import com.yijia.station.domain.StationClassesSummary;
|
|
|
-import com.yijia.station.domain.StationDeviceManage;
|
|
|
+import com.yijia.station.domain.*;
|
|
|
import com.yijia.station.mapper.PayOrderMapper;
|
|
|
-import com.yijia.station.service.IPayOrderService;
|
|
|
-import com.yijia.station.service.IStationClassesSummaryService;
|
|
|
-import com.yijia.station.service.IStationDeviceManageService;
|
|
|
+import com.yijia.station.service.*;
|
|
|
import com.yijia.station.utils.FeiEPrinterUtil;
|
|
|
import com.yijia.system.service.ISysUserService;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -33,8 +29,6 @@ import com.yijia.common.annotation.Log;
|
|
|
import com.yijia.common.core.controller.BaseController;
|
|
|
import com.yijia.common.core.domain.AjaxResult;
|
|
|
import com.yijia.common.enums.BusinessType;
|
|
|
-import com.yijia.station.domain.StationClassStructure;
|
|
|
-import com.yijia.station.service.IStationClassStructureService;
|
|
|
import com.yijia.common.utils.poi.ExcelUtil;
|
|
|
import com.yijia.common.core.page.TableDataInfo;
|
|
|
|
|
@@ -58,6 +52,8 @@ public class StationClassStructureController extends BaseController
|
|
|
private IStationDeviceManageService stationDeviceManageService;
|
|
|
@Autowired
|
|
|
private ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ private IStationPayService stationPayService;
|
|
|
/**
|
|
|
* 查询班结管理列表
|
|
|
*/
|
|
@@ -136,7 +132,6 @@ public class StationClassStructureController extends BaseController
|
|
|
return AjaxResult.success(stationClassStructureService.selectStationClassStructureById(id));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 新增班结管理
|
|
|
*/
|
|
@@ -407,6 +402,7 @@ public class StationClassStructureController extends BaseController
|
|
|
StationClassStructure scs =new StationClassStructure();
|
|
|
scs.setClassStructureNo(no);
|
|
|
scs.setStationId(stationId);
|
|
|
+ scs.setOrderType("1"); //油品
|
|
|
//汇总班结数据将汇总的数据插入到汇总数据中
|
|
|
StationClassStructure stationclass = stationClassStructureService.selectSummyClassStructure(scs);
|
|
|
if(stationclass!=null){
|
|
@@ -463,141 +459,162 @@ public class StationClassStructureController extends BaseController
|
|
|
stationClassesSummary.setClassesMan(stationclass.getClassStructureMan());
|
|
|
i=stationClassesSummaryService.insertStationClassesSummary(stationClassesSummary);
|
|
|
//班结成功,打印小票
|
|
|
- //查询班结小票数据
|
|
|
- StationClassStructure classStructure= new StationClassStructure();
|
|
|
- classStructure.setClassStructureNo(no);
|
|
|
- classStructure.setStationId(stationId);
|
|
|
- List<StationClassStructure> list= stationClassStructureService.listOilStructure(classStructure);
|
|
|
- //支付方式汇总数据
|
|
|
- List<StationClassStructure> paylist= stationClassStructureService.listPayStructure(classStructure);
|
|
|
- //查询出小票数据
|
|
|
- String content;
|
|
|
- content = "<CB>班结小票</CB><BR>";
|
|
|
- content += "--------------------------------<BR>";
|
|
|
- if(list!=null && list.size()>0 && paylist !=null && paylist.size()>0){
|
|
|
- if(list.get(0).getClassStartDate()!=null){
|
|
|
- content += "开始时间:"+dateFormat.format(list.get(0).getClassStartDate())+" <BR>";
|
|
|
- }else{
|
|
|
- content += "开始时间: <BR>";
|
|
|
- }
|
|
|
- content += "班结时间:"+dateFormat.format(list.get(0).getClassStructureDate())+" <BR>";
|
|
|
- content += "油品 笔 升数 金额<BR>";
|
|
|
+ //根据油站查询是否打印班结小票
|
|
|
+ StationPay stationPay =new StationPay();
|
|
|
+ stationPay.setStationId(stationId);
|
|
|
+ StationPay pay = stationPayService.selectStationPayOne(stationPay);
|
|
|
+ if(pay!=null && pay.getWsPrintFlag().equals("1")){
|
|
|
+ //查询班结小票数据
|
|
|
+ StationClassStructure classStructure= new StationClassStructure();
|
|
|
+ classStructure.setClassStructureNo(no);
|
|
|
+ classStructure.setStationId(stationId);
|
|
|
+ classStructure.setOrderType("1");// 油品
|
|
|
+ List<StationClassStructure> list= stationClassStructureService.listOilStructure(classStructure);
|
|
|
+ //支付方式汇总数据
|
|
|
+ List<StationClassStructure> paylist= stationClassStructureService.listPayStructure(classStructure);
|
|
|
+ //汇总非油品
|
|
|
+ StationClassStructure selectNoOil =new StationClassStructure();
|
|
|
+ selectNoOil.setClassStructureNo(no);
|
|
|
+ selectNoOil.setStationId(stationId);
|
|
|
+ selectNoOil.setOrderType("2");// 非油品
|
|
|
+ StationClassStructure search = stationClassStructureService.selectSummyClassStructure(selectNoOil);
|
|
|
+ //查询出小票数据
|
|
|
+ String content;
|
|
|
+ content = "<CB>班结小票</CB><BR>";
|
|
|
content += "--------------------------------<BR>";
|
|
|
-
|
|
|
- BigDecimal sumAmt = new BigDecimal(0);
|
|
|
- BigDecimal liters = new BigDecimal(0);
|
|
|
- BigDecimal coupon = new BigDecimal(0);
|
|
|
- BigDecimal ysAmt = new BigDecimal(0);
|
|
|
- BigDecimal dzAmt = new BigDecimal(0);
|
|
|
- int num = 0;
|
|
|
- int pageNum=0;
|
|
|
- for(StationClassStructure str : list){
|
|
|
- String orderLiter="";
|
|
|
- String amt="";
|
|
|
- String receivableAmt="";
|
|
|
- String orderno="";
|
|
|
- //打印小票数量
|
|
|
- if(str.getPrintNum()!=null){
|
|
|
- pageNum += str.getPrintNum();
|
|
|
- }
|
|
|
- if( str.getOrderLiters()==null){
|
|
|
- str.setOrderLiters(BigDecimal.valueOf(0));
|
|
|
- orderLiter="0";
|
|
|
- }else{
|
|
|
- liters=liters.add(str.getOrderLiters());
|
|
|
- orderLiter= str.getOrderLiters().toString();
|
|
|
- }
|
|
|
- //实收金额
|
|
|
- if( str.getAmt()==null){
|
|
|
- str.setAmt(BigDecimal.valueOf(0));
|
|
|
- amt="0";
|
|
|
- }else{
|
|
|
- sumAmt=sumAmt.add(str.getAmt());
|
|
|
- amt=str.getAmt().toString();
|
|
|
- }
|
|
|
- //应付金额
|
|
|
- if( str.getReceivableAmt()==null){
|
|
|
- str.setReceivableAmt(BigDecimal.valueOf(0));
|
|
|
- receivableAmt="0";
|
|
|
+ if(list!=null && list.size()>0 && paylist !=null && paylist.size()>0 ){
|
|
|
+ if(list.get(0).getClassStartDate()!=null){
|
|
|
+ content += "开始时间:"+dateFormat.format(list.get(0).getClassStartDate())+" <BR>";
|
|
|
}else{
|
|
|
- ysAmt=ysAmt.add(str.getReceivableAmt());
|
|
|
- receivableAmt=str.getReceivableAmt().toString();
|
|
|
+ content += "开始时间: <BR>";
|
|
|
}
|
|
|
- //到款金额
|
|
|
- if( str.getReceivedAmt()==null){
|
|
|
- str.setReceivedAmt(BigDecimal.valueOf(0));
|
|
|
- }else{
|
|
|
- dzAmt = dzAmt.add(str.getReceivedAmt());
|
|
|
- }
|
|
|
- //优惠金额
|
|
|
- if( str.getDiscountAmt()==null){
|
|
|
- str.setDiscountAmt(BigDecimal.valueOf(0));
|
|
|
- }else{
|
|
|
- coupon=coupon.add(str.getDiscountAmt());
|
|
|
+ content += "班结时间:"+dateFormat.format(list.get(0).getClassStructureDate())+" <BR>";
|
|
|
+ content += "油品 笔 升数 金额<BR>";
|
|
|
+ content += "--------------------------------<BR>";
|
|
|
+
|
|
|
+ BigDecimal sumAmt = new BigDecimal(0);
|
|
|
+ BigDecimal liters = new BigDecimal(0);
|
|
|
+ BigDecimal coupon = new BigDecimal(0);
|
|
|
+ BigDecimal ysAmt = new BigDecimal(0);
|
|
|
+ BigDecimal dzAmt = new BigDecimal(0);
|
|
|
+ int num = 0;
|
|
|
+ int pageNum=0;
|
|
|
+ for(StationClassStructure str : list){
|
|
|
+ String orderLiter="";
|
|
|
+ String amt="";
|
|
|
+ String receivableAmt="";
|
|
|
+ String orderno="";
|
|
|
+ //打印小票数量
|
|
|
+ if(str.getPrintNum()!=null){
|
|
|
+ pageNum += str.getPrintNum();
|
|
|
+ }
|
|
|
+ if( str.getOrderLiters()==null){
|
|
|
+ str.setOrderLiters(BigDecimal.valueOf(0));
|
|
|
+ orderLiter="0";
|
|
|
+ }else{
|
|
|
+ liters=liters.add(str.getOrderLiters());
|
|
|
+ orderLiter= str.getOrderLiters().toString();
|
|
|
+ }
|
|
|
+ //实收金额
|
|
|
+ if( str.getAmt()==null){
|
|
|
+ str.setAmt(BigDecimal.valueOf(0));
|
|
|
+ amt="0";
|
|
|
+ }else{
|
|
|
+ sumAmt=sumAmt.add(str.getAmt());
|
|
|
+ amt=str.getAmt().toString();
|
|
|
+ }
|
|
|
+ //应付金额
|
|
|
+ if( str.getReceivableAmt()==null){
|
|
|
+ str.setReceivableAmt(BigDecimal.valueOf(0));
|
|
|
+ receivableAmt="0";
|
|
|
+ }else{
|
|
|
+ ysAmt=ysAmt.add(str.getReceivableAmt());
|
|
|
+ receivableAmt=str.getReceivableAmt().toString();
|
|
|
+ }
|
|
|
+ //到款金额
|
|
|
+ if( str.getReceivedAmt()==null){
|
|
|
+ str.setReceivedAmt(BigDecimal.valueOf(0));
|
|
|
+ }else{
|
|
|
+ dzAmt = dzAmt.add(str.getReceivedAmt());
|
|
|
+ }
|
|
|
+ //优惠金额
|
|
|
+ if( str.getDiscountAmt()==null){
|
|
|
+ str.setDiscountAmt(BigDecimal.valueOf(0));
|
|
|
+ }else{
|
|
|
+ coupon=coupon.add(str.getDiscountAmt());
|
|
|
+ }
|
|
|
+ //订单数量
|
|
|
+ if( str.getOrderNo()==null){
|
|
|
+ str.setOrderNo(String.valueOf(0));
|
|
|
+ }else{
|
|
|
+ num= num+Integer.parseInt(str.getOrderNo());
|
|
|
+ orderno=str.getOrderNo().toString();
|
|
|
+ }
|
|
|
+ String oilname=addSpace(str.getOilName(),4);
|
|
|
+ orderno=addSpace(orderno,3);
|
|
|
+ orderLiter=addSpace(orderLiter,8);
|
|
|
+ receivableAmt=addSpace(receivableAmt,8);
|
|
|
+ content += oilname+" "+orderno+" "+orderLiter+" "+receivableAmt+"<BR>";
|
|
|
}
|
|
|
- //订单数量
|
|
|
- if( str.getOrderNo()==null){
|
|
|
- str.setOrderNo(String.valueOf(0));
|
|
|
- }else{
|
|
|
- num= num+Integer.parseInt(str.getOrderNo());
|
|
|
- orderno=str.getOrderNo().toString();
|
|
|
+ content += "--------------------------------<BR>";
|
|
|
+ String sumorder=addSpace(String.valueOf(num),3);
|
|
|
+ String oilliters=addSpace(String.valueOf(liters),9);
|
|
|
+ String oilYsAmt=addSpace(String.valueOf(ysAmt),9);
|
|
|
+ content += "合计 "+sumorder +" "+liters +" "+oilYsAmt+"<BR>";
|
|
|
+ content += " <BR>";
|
|
|
+ //按支付方式
|
|
|
+ content += "支付方式 笔 升数 金额<BR>";
|
|
|
+ for(StationClassStructure sc : paylist){
|
|
|
+ String orderno= sc.getOrderNo();
|
|
|
+ orderno =addSpace(orderno,3);
|
|
|
+ String orderLiter="";
|
|
|
+ if(sc.getOrderLiters()!=null){
|
|
|
+ orderLiter = sc.getOrderLiters().toString();
|
|
|
+ }else{
|
|
|
+ sc.setOrderLiters(BigDecimal.valueOf(0));
|
|
|
+ orderLiter= sc.getOrderLiters().toString();
|
|
|
+ }
|
|
|
+ orderLiter =addSpace(orderLiter,8);
|
|
|
+ String receivableAmt="";
|
|
|
+ if(sc.getReceivableAmt()!=null){
|
|
|
+ receivableAmt = sc.getReceivableAmt().toString();
|
|
|
+ }else{
|
|
|
+ sc.setReceivableAmt(BigDecimal.valueOf(0));
|
|
|
+ receivableAmt= sc.getReceivableAmt().toString();
|
|
|
+ }
|
|
|
+ content += sc.getPayType()+" "+orderno+" "+orderLiter+" "+receivableAmt+"<BR>";
|
|
|
}
|
|
|
- String oilname=addSpace(str.getOilName(),4);
|
|
|
- orderno=addSpace(orderno,3);
|
|
|
- orderLiter=addSpace(orderLiter,8);
|
|
|
- receivableAmt=addSpace(receivableAmt,8);
|
|
|
- content += oilname+" "+orderno+" "+orderLiter+" "+receivableAmt+"<BR>";
|
|
|
- }
|
|
|
- content += "--------------------------------<BR>";
|
|
|
- String sumorder=addSpace(String.valueOf(num),3);
|
|
|
- String oilliters=addSpace(String.valueOf(liters),9);
|
|
|
- String oilYsAmt=addSpace(String.valueOf(ysAmt),9);
|
|
|
- content += "合计 "+sumorder +" "+liters +" "+oilYsAmt+"<BR>";
|
|
|
- content += " <BR>";
|
|
|
- //按支付方式
|
|
|
- content += "支付方式 笔 升数 金额<BR>";
|
|
|
- for(StationClassStructure sc : paylist){
|
|
|
- String orderno= sc.getOrderNo();
|
|
|
- orderno =addSpace(orderno,3);
|
|
|
- String orderLiter="";
|
|
|
- if(sc.getOrderLiters()!=null){
|
|
|
- orderLiter = sc.getOrderLiters().toString();
|
|
|
- }else{
|
|
|
- sc.setOrderLiters(BigDecimal.valueOf(0));
|
|
|
- orderLiter= sc.getOrderLiters().toString();
|
|
|
+ content += "小票张数: "+pageNum+" 张<BR>";
|
|
|
+ content += "班结金额: "+ysAmt+" 元<BR>";
|
|
|
+ content += "优惠总额: "+coupon+" 元<BR>";
|
|
|
+ content += "实际支付: "+sumAmt+" 元<BR>";
|
|
|
+ content += "到款金额: "+dzAmt+"元<BR>";
|
|
|
+ if(pay.getIsNoOil()!=null && pay.getIsNoOil().equals("1")){
|
|
|
+ content += "--------------------------------<BR>";
|
|
|
+ if( search.getAmt()==null){
|
|
|
+ search.setAmt(BigDecimal.valueOf(0));
|
|
|
+ }
|
|
|
+ content +="非油总额: "+search.getAmt()+"元<BR>";
|
|
|
}
|
|
|
- orderLiter =addSpace(orderLiter,8);
|
|
|
- String receivableAmt="";
|
|
|
- if(sc.getReceivableAmt()!=null){
|
|
|
- receivableAmt = sc.getReceivableAmt().toString();
|
|
|
- }else{
|
|
|
- sc.setReceivableAmt(BigDecimal.valueOf(0));
|
|
|
- receivableAmt= sc.getReceivableAmt().toString();
|
|
|
+ content += "班结人: "+list.get(0).getClassStructureMan()+"<BR>";
|
|
|
+ content += "<BR>";
|
|
|
+ content += "--------------------------------<BR>";
|
|
|
+ content += "<BR>";
|
|
|
+ //查询打印机信息
|
|
|
+ Map params =new HashMap();
|
|
|
+ params.put("stationId", list.get(0).getStationId());
|
|
|
+ params.put("deviceType", "3");
|
|
|
+ Map mp = stationDeviceManageService.getPrinterSnByStationId(params);
|
|
|
+ if(mp!=null&&mp.containsKey("device_no") && mp.get("device_no")!= null && mp.get("device_no")!=""){
|
|
|
+ String sn = mp.get("device_no").toString();
|
|
|
+ FeiEPrinterUtil.printReceipt(sn, content);
|
|
|
+ }else {
|
|
|
+ logger.info("请正确配置打印机");
|
|
|
+ i=2;
|
|
|
}
|
|
|
- content += sc.getPayType()+" "+orderno+" "+orderLiter+" "+receivableAmt+"<BR>";
|
|
|
- }
|
|
|
- content += "小票张数: "+pageNum+" 张<BR>";
|
|
|
- content += "班结金额: "+ysAmt+" 元<BR>";
|
|
|
- content += "优惠总额: "+coupon+" 元<BR>";
|
|
|
- content += "实际支付: "+sumAmt+" 元<BR>";
|
|
|
- content += "到款金额: "+dzAmt+"元<BR>";
|
|
|
- content += "班结人: "+list.get(0).getClassStructureMan()+"<BR>";
|
|
|
- content += "<BR>";
|
|
|
- content += "--------------------------------<BR>";
|
|
|
- content += "<BR>";
|
|
|
- //查询打印机信息
|
|
|
- Map params =new HashMap();
|
|
|
- params.put("stationId", list.get(0).getStationId());
|
|
|
- params.put("deviceType", "3");
|
|
|
- Map mp = stationDeviceManageService.getPrinterSnByStationId(params);
|
|
|
- if(mp!=null&&mp.containsKey("device_no") && mp.get("device_no")!= null && mp.get("device_no")!=""){
|
|
|
- String sn = mp.get("device_no").toString();
|
|
|
- FeiEPrinterUtil.printReceipt(sn, content);
|
|
|
- }else {
|
|
|
- logger.info("请正确配置打印机");
|
|
|
- i=2;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
return toAjaxee(i);
|
|
|
}
|