diff --git a/fuintAdmin_zt/src/views/Site/index.vue b/fuintAdmin_zt/src/views/Site/index.vue index 0882cb4ab..dc66d57c1 100644 --- a/fuintAdmin_zt/src/views/Site/index.vue +++ b/fuintAdmin_zt/src/views/Site/index.vue @@ -165,11 +165,11 @@ - - + + - - + + @@ -180,6 +180,34 @@ >{{dict.label}} + + + + + + + 金额上限 + 时间上限 + + + + + + + + + + + + + + + + + @@ -349,10 +377,15 @@ parentId:'', deptType:'1', status:'qy', - leader_name:'', - leader_phone:'', + leaderName:'', + leaderPhone:'', // parentName:'请先选择父级节点', deptName: '', + turnoverLimit: '', + turnoverType: "1", + turnoverTime: '', + + }, filterText:'', xtitle:'', @@ -445,11 +478,11 @@ rolelist:'', // 表单校验 rules: { - leader_name: [ - { required: true, message: '不能为空', trigger: 'blur' }, + leaderName: [ + { required: true, message: '姓名不能为空', trigger: 'blur' }, ], - leader_phone: [ - { required: true, message: '不能为空', trigger: 'blur' }, + leaderPhone: [ + { required: true, message: '电话不能为空', trigger: 'blur' }, ], deptName: [ @@ -538,23 +571,31 @@ activecilck(data){ console.log('点树',data) + this.cleanUp() // 点击树之后 this.queryParams.deptId = data.id this.deptType = data.deptType // 新增节点 - if(this.activeName == 'info'){ + // if(this.activeName == 'info'){ this.appedit(data.id,data.label) - } + // } // 用户请求 - if(this.activeName == 'list'){ + // if(this.activeName == 'list'){ this.getList(); - } + // } }, cleanUp(){ this.ruleForm = { parentId:'', - depId:'', + deptType:'1', + status:'qy', + leaderName:'', + leaderPhone:'', + // parentName:'请先选择父级节点', deptName: '', + turnoverLimit: '', + turnoverType: "1", + turnoverTime: '', } }, handleChange(value) { @@ -588,8 +629,8 @@ }, //修改 - submitFormseide(){ - this.$refs[formName].validate((valid) => { + submitFormseide(ruleForm){ + this.$refs[ruleForm].validate((valid) => { if (valid) { deptedit(this.ruleForm).then(res=>{ @@ -663,8 +704,14 @@ let ancestors = res.data.ancestors.slice(2).toString(); console.log('Userlist:',res) this.parentName = res.data.parentName - this.ruleForm.parentId = res.data.parentId - this.ruleForm.status = res.data.status + this.ruleForm = res.data + // this.ruleForm.parentId = res.data.parentId + // this.ruleForm.status = res.data.status + // this.ruleForm.leaderName = res.data.leaderName + // this.ruleForm.leaderPhone = res.data.leaderPhone + // this.ruleForm.turnoverType = res.data.turnoverType + // this.ruleForm.turnoverTime = res.data.turnoverTime + // this.ruleForm.turnoverType = res.data.turnoverType if(res.data.status == 'qy'){ this.value10 = true }else { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java index b66e32d5c..0045b81c9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralSettingsServiceImpl.java @@ -19,8 +19,10 @@ import com.fuint.business.petrolStationManagement.entity.OilNumber; import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper; import com.fuint.business.storeInformation.entity.LJStore; import com.fuint.business.storeInformation.service.ILJStoreService; +import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.entity.UserBalance; import com.fuint.business.userManager.mapper.LJUserMapper; +import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.business.userManager.service.UserBalanceService; import com.fuint.business.userManager.vo.LJUserVo; import org.springframework.stereotype.Service; @@ -215,7 +217,8 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService { } } - + @Resource + LJUserGradeService ljUserGradeService; /** * 签到功能 @@ -230,11 +233,27 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService { Integer integer = todayIsSignIn(integralSettings.getStoreId()); if (integer == 0) { - - // 根据店铺id 查找连锁店id -// LJStore ljStore = iljStoreService.selectStoreByIdUni(integralSettings.getStoreId()); // 查询当前用户 LJUserVo ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(),integralSettings.getChainStoreId()); + + if (ObjectUtil.isEmpty(ljUserVos)) { + // 新增余额信息 + UserBalance userBalanceAdd = new UserBalance(); + userBalanceAdd.setMtUserId(nowAccountInfo.getId()); + userBalanceAdd.setChainStoreId(integralSettings.getChainStoreId()); + userBalanceAdd.setStoreId(integralSettings.getStoreId()); + userBalanceAdd.setCardBalance(0.0); + userBalanceAdd.setPoints(0); + userBalanceAdd.setGrowthValue(0); + userBalanceAdd.setConsumeNum(0); + LJUserGrade ljUserGrade = ljUserGradeService.selectUserGradeByStoreId(integralSettings.getStoreId()); + if (ObjectUtil.isNotEmpty(ljUserGrade) && ObjectUtil.isNotEmpty(ljUserGrade.getId())) { + userBalanceAdd.setGradeId(ljUserGrade.getId()); + } + // 新增会员余额信息 + userBalanceService.insertUserBalance(userBalanceAdd); + ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(),integralSettings.getChainStoreId()); + } ljUserVos.setChainStoreId(integralSettings.getChainStoreId()); ljUserVos.setStoreId(integralSettings.getStoreId()); // 查询积分配置 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HandoverRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HandoverRecordController.java index 1c7d74d57..0c433f604 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HandoverRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/HandoverRecordController.java @@ -11,6 +11,7 @@ import io.lettuce.core.dynamic.annotation.Param; import javax.annotation.Resource; +import java.util.Map; /** * 交班记录表(HandoverRecord)表控制层 @@ -102,5 +103,15 @@ public class HandoverRecordController extends BaseController { return getSuccessResult(handoverRecordService.handover()); } + /** + * 本地打印 + * @return + */ + @PostMapping("printLocally") + public ResponseObject printLocally(@RequestBody Map aa) { + handoverRecordService.printLocally(aa); + return getSuccessResult(true); + } + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java index 0b2720237..8f9b0d315 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/HandoverRecordService.java @@ -61,5 +61,7 @@ public interface HandoverRecordService { public Map handover(); + public void printLocally(Map aa); + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java index bc284c803..e30d2b962 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/HandoverRecordServiceImpl.java @@ -13,11 +13,13 @@ import com.fuint.business.store.mapper.MtStoreMapper; import com.fuint.business.store.service.StoreService; import com.fuint.business.userManager.mapper.LJUserMapper; import com.fuint.business.userManager.vo.LJUserVo; +import com.fuint.common.util.TscLibDll; import com.fuint.framework.exception.BusinessCheckException; import com.fuint.system.dict.entity.SysDictData; import com.fuint.system.dict.entity.SysDictType; import com.fuint.system.dict.service.ISysDictDataService; import com.fuint.system.dict.service.ISysDictTypeService; +import javafx.print.Printer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.fuint.common.util.TokenUtil; @@ -33,10 +35,7 @@ import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 交班记录表(HandoverRecord)表服务实现类 @@ -197,6 +196,7 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { return handoverMap; } + public Map orderSummary(String startTime, String endTime) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); // 油品订单(订单) 油品订单(退款) 油品订单(实收) 油品优惠(实收) 油品交易(实收) @@ -249,6 +249,13 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { boolean flag = true; for (Map stringObjectMap : mapList) { + if (ObjectUtil.isEmpty(map.get("payType"))) { + map.put("payType","other"); + } + if (ObjectUtil.isEmpty(stringObjectMap.get("payType"))) { + map.put("payType","other"); + + } if (map.get("payType").equals(stringObjectMap.get("payType"))) { BigDecimal paidAmount = new BigDecimal(stringObjectMap.get("paidAmount").toString()).add(new BigDecimal(map.get("paidAmount").toString())); BigDecimal refundAmount = new BigDecimal(stringObjectMap.get("refundAmount").toString()).add(new BigDecimal(map.get("refundAmount").toString())); @@ -381,4 +388,500 @@ public class HandoverRecordServiceImpl implements HandoverRecordService { return map; } + private static final String LOAD_LIBRARY = "TSCLIB"; + + //打印机 +// private static final String print_model = "58130IVC"; + @Override + public void printLocally(Map handover) { + + Map baseInfo = (Map)handover.get("baseInfo"); + Map orderSummary = (Map)handover.get("orderSummary"); + + // 支付方式汇总 + List> paymentAggregationMap = (List>)handover.get("paymentAggregation"); + // 油号统计 + List> oilNumberStatisticsMap = (List>)handover.get("oilNumberStatistics"); + // 油枪统计 + List> greaseGunStatisticsMap = (List>)handover.get("greaseGunStatistics"); + // 员工统计 + List> employeeStatisticsMap = (List>)handover.get("employeeStatistics"); + // 挂账详情 + List> billingDetailsMap = (List>)handover.get("billingDetails"); + // 挂账归还 + List> returnedToTheAccountMap = (List>)handover.get("returnedToTheAccount"); + + +// System.loadLibrary(LOAD_LIBRARY); + System.setProperty("jna.encoding", "GBK"); + // 获取默认打印机 + Printer printer = Printer.getDefaultPrinter(); + // 获取打印机的名称 + String printerName = printer.getName(); + TscLibDll.INSTANCE.openport(printerName); + + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("------------交班统计------------"); + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("油站名称:\t"+Optional.ofNullable(baseInfo.get("storeName")).orElse("未知油站")); + TscLibDll.INSTANCE.sendcommand("收银员:\t"+Optional.ofNullable(baseInfo.get("realName")).orElse("未知姓名")); + TscLibDll.INSTANCE.sendcommand("交班方式:\t"+Optional.ofNullable(baseInfo.get("handoverType")).orElse("未知")); + TscLibDll.INSTANCE.sendcommand("开始时间:\t"+Optional.ofNullable(baseInfo.get("startTime")).orElse("-")); + TscLibDll.INSTANCE.sendcommand("结束时间:\t"+Optional.ofNullable(baseInfo.get("endTime")).orElse("-")); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("当前版本:\t"+"V1.0.1"); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("**订单汇总**"); + TscLibDll.INSTANCE.sendcommand("类型\t金额"); + TscLibDll.INSTANCE.sendcommand("油品订单(订单):\t¥"+Optional.ofNullable(orderSummary.get("oilOrder")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("油品订单(退款):\t¥"+Optional.ofNullable(orderSummary.get("oilRefund")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("油品订单(实收):\t¥"+Optional.ofNullable(orderSummary.get("oilPaid")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("油品优惠(实收):\t¥"+Optional.ofNullable(orderSummary.get("oilDiacount")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("会员储值(订单):\t¥"+Optional.ofNullable(orderSummary.get("cardOrder")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("会员储值(退款):\t¥"+Optional.ofNullable(orderSummary.get("cardRefund")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("会员储值(实收):\t¥"+Optional.ofNullable(orderSummary.get("cardPaid")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("储值赠送(订单):\t¥"+Optional.ofNullable(orderSummary.get("cardGiftOrder")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("储值赠送(退款):\t¥"+Optional.ofNullable(orderSummary.get("cardGiftRefund")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("储值赠送(实际):\t¥"+Optional.ofNullable(orderSummary.get("cardGiftPaid")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("存油储值(订单):\t¥"+Optional.ofNullable(orderSummary.get("fuelOrder")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("存油储值(退款):\t¥"+Optional.ofNullable(orderSummary.get("fuelRefund")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("存油储值(实收):\t¥"+Optional.ofNullable(orderSummary.get("fuelPaid")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("普通收款(订单):\t¥"+Optional.ofNullable(orderSummary.get("goodsOrder")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("普通收款(退款):\t¥"+Optional.ofNullable(orderSummary.get("goodsRefund")).orElse("0")); + TscLibDll.INSTANCE.sendcommand("普通收款(实收):\t¥"+Optional.ofNullable(orderSummary.get("goodsPaid")).orElse("0")); + TscLibDll.INSTANCE.sendcommand(""); + + TscLibDll.INSTANCE.sendcommand("**退款汇总**"); + TscLibDll.INSTANCE.sendcommand("支付方式\t金额"); + List> paymentAggregationAll = paymentAggregation("all", paymentAggregationMap); + if (ObjectUtil.isNotEmpty(paymentAggregationAll)) { + for (Map stringObjectMap : paymentAggregationAll) { + if (Double.parseDouble(stringObjectMap.get("refundAmount").toString()) > 0) { + TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("refundAmount")).orElse("0")); + } + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+refundAggregateTotal(paymentAggregationAll)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand(""); + + TscLibDll.INSTANCE.sendcommand("**实收汇总**"); + TscLibDll.INSTANCE.sendcommand("支付方式\t金额"); + if (ObjectUtil.isNotEmpty(paymentAggregationAll)) { + for (Map stringObjectMap : paymentAggregationAll) { + if (Double.parseDouble(stringObjectMap.get("paidAmount").toString()) > 0) { + TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")); + } + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+totalTotalOfActualReceipts(paymentAggregationAll)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("**油品订单**"); + TscLibDll.INSTANCE.sendcommand("支付方式\t金额"); + List> paymentAggregationOil = paymentAggregation("oil", paymentAggregationMap); + + if (ObjectUtil.isNotEmpty(paymentAggregationOil)) { + for (Map stringObjectMap : paymentAggregationOil) { + TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")); + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+totalOilOrders(paymentAggregationOil)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("**商品订单**"); + TscLibDll.INSTANCE.sendcommand("支付方式\t金额"); + + List> paymentAggregationGoods = paymentAggregation("goods", paymentAggregationMap); + if (ObjectUtil.isNotEmpty(paymentAggregationGoods)) { + for (Map stringObjectMap : paymentAggregationGoods) { + TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")); + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+totalOfProductOrders(paymentAggregationGoods)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("**会员储值**"); + TscLibDll.INSTANCE.sendcommand("支付方式\t金额"); + List> paymentAggregationFg = paymentAggregation("fg", paymentAggregationMap); + + if (ObjectUtil.isNotEmpty(paymentAggregationFg)) { + for (Map stringObjectMap : paymentAggregationFg) { + TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")); + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+totalMemberStoredValue(paymentAggregationMap)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("**积分商城**"); + TscLibDll.INSTANCE.sendcommand("支付方式\t金额"); + List> paymentAggregationPoint = paymentAggregation("point", paymentAggregationMap); + + if (ObjectUtil.isNotEmpty(paymentAggregationPoint)) { + for (Map stringObjectMap : paymentAggregationPoint) { + TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")); + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+pointsMallStatistics(paymentAggregationPoint)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("**油号统计**"); + TscLibDll.INSTANCE.sendcommand("油号\t笔数\t升数\t金额"); + + if (ObjectUtil.isNotEmpty(oilNumberStatisticsMap)) { + for (Map stringObjectMap : oilNumberStatisticsMap) { + TscLibDll.INSTANCE.sendcommand( + Optional.ofNullable(stringObjectMap.get("oilName")).orElse("未知") + +"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0") + +"\t"+Optional.ofNullable(stringObjectMap.get("oilNum")).orElse("0") + +"\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")); + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t"+totalOilNumberStatistics(oilNumberStatisticsMap)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand("**优惠统计**"); + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("油品\t金额"); + + if (ObjectUtil.isNotEmpty(oilNumberStatisticsMap)) { + for (Map stringObjectMap : oilNumberStatisticsMap) { + TscLibDll.INSTANCE.sendcommand( + Optional.ofNullable(stringObjectMap.get("oilName")).orElse("未知") + +"\t¥"+Optional.ofNullable(stringObjectMap.get("paidDiscount")).orElse("0")); + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+discountStatisticsTotal(oilNumberStatisticsMap)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand("**油枪统计**"); + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("油枪\t笔数\t升数\t金额"); + if (ObjectUtil.isNotEmpty(greaseGunStatisticsMap)) { + for (Map stringObjectMap : greaseGunStatisticsMap) { + TscLibDll.INSTANCE.sendcommand( + Optional.ofNullable(stringObjectMap.get("gunName")).orElse("未知") + +"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0") + +"\t"+Optional.ofNullable(stringObjectMap.get("oilNum")).orElse("0") + +"\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")); + } + } + + + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t"+totalOfOilGunStatistics(greaseGunStatisticsMap)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("**员工统计**"); + TscLibDll.INSTANCE.sendcommand("员工姓名\t笔数\t金额"); + if (ObjectUtil.isNotEmpty(employeeStatisticsMap)) { + for (Map stringObjectMap : employeeStatisticsMap) { + TscLibDll.INSTANCE.sendcommand( + Optional.ofNullable(stringObjectMap.get("name")).orElse("未知") + +"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0") + +"\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")); + } + } + + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t"+totalOfEmployeeStatistics(employeeStatisticsMap)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand("**挂账统计**"); + TscLibDll.INSTANCE.sendcommand("·····挂账详情·····"); + + TscLibDll.INSTANCE.sendcommand("挂账单位\t笔数\t金额"); + if (ObjectUtil.isNotEmpty(billingDetailsMap)) { + for (Map stringObjectMap : billingDetailsMap) { + TscLibDll.INSTANCE.sendcommand( + Optional.ofNullable(stringObjectMap.get("name")).orElse("未知") + +"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0") + +"\t¥"+Optional.ofNullable(stringObjectMap.get("amount")).orElse("0")); + } + } + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+statisticsOfAccountDetails(billingDetailsMap)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + TscLibDll.INSTANCE.sendcommand("······归还详情······"); + TscLibDll.INSTANCE.sendcommand("挂账单位\t笔数\t金额"); + if (ObjectUtil.isNotEmpty(returnedToTheAccountMap)) { + for (Map stringObjectMap : returnedToTheAccountMap) { + TscLibDll.INSTANCE.sendcommand( + Optional.ofNullable(stringObjectMap.get("name")).orElse("未知") + +"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0") + +"\t¥"+Optional.ofNullable(stringObjectMap.get("amount")).orElse("0")); + } + } + + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand("合计:\t¥"+postedAccountReturnStatistics(returnedToTheAccountMap)); + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + + + + TscLibDll.INSTANCE.sendcommand("--------------------------------"); + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand(""); + TscLibDll.INSTANCE.sendcommand(""); + + TscLibDll.INSTANCE.closeport(); + } + public List> paymentAggregation(String flag, List> paymentAggregation) { + List> count = new ArrayList<>(); + + if (ObjectUtil.isNotEmpty(paymentAggregation)) { + for (Map res : paymentAggregation) { + if ("fg".equals(flag)) { + if ("card".equals(res.get("flag")) || "fuel".equals(res.get("flag"))) { + boolean flag2 = false; + for (Map coun : count) { + if (Objects.equals(res.get("payType"), coun.get("payType"))) { + coun.put("paidAmount", Double.valueOf(coun.get("paidAmount").toString()) + Double.valueOf(res.get("paidAmount").toString())); + flag2 = true; + } + } + if (!flag2) { + // 创建新的对象,以防修改原始数据 + Map newRes = new HashMap<>(res); + count.add(newRes); + } + } + } else if (Objects.equals(res.get("flag"), flag)) { + count.add(res); + } + } + } + + return count; + } + + private int findIndexByPayType(List> list, String payType) { + for (int i = 0; i < list.size(); i++) { + if (payType.equals(list.get(i).get("payType").toString())) { + return i; + } + } + return -1; + } + + + public String calculatePaymentMethod(String payType) { + switch (payType) { + case "ALIPAY": + return "支付宝"; + case "WECHAT": + return "微信"; + case "UNIONPAY": + return "银联二维码"; + case "CASH": + return "现金"; + default: + return "其他"; + } + } + + //退款汇总合计 + public BigDecimal refundAggregateTotal(List> paymentAggregation) { + BigDecimal totalRefundAmount = BigDecimal.ZERO; + + if (paymentAggregation != null && !paymentAggregation.isEmpty()) { + for (Map payment : paymentAggregation) { + if ("all".equals(payment.get("flag"))) { + BigDecimal refundAmount = new BigDecimal(String.valueOf(payment.get("refundAmount"))); + totalRefundAmount = totalRefundAmount.add(refundAmount); + } + } + } + + return totalRefundAmount; + } + + //实收汇总合计 + public BigDecimal totalTotalOfActualReceipts(List> paymentAggregation) { + BigDecimal totalPaidAmount = BigDecimal.ZERO; + + if (paymentAggregation != null && !paymentAggregation.isEmpty()) { + for (Map payment : paymentAggregation) { + if ("all".equals(payment.get("flag"))) { + BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount"))); + totalPaidAmount = totalPaidAmount.add(paidAmount); + } + } + } + + return totalPaidAmount; + } + + //油品订单合计 + public BigDecimal totalOilOrders(List> paymentAggregation) { + BigDecimal totalOilAmount = BigDecimal.ZERO; + + if (paymentAggregation != null && !paymentAggregation.isEmpty()) { + for (Map payment : paymentAggregation) { + if ("oil".equals(payment.get("flag"))) { + BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount"))); + totalOilAmount = totalOilAmount.add(paidAmount); + } + } + } + + return totalOilAmount; + } + + + // 商品订单合计 + public BigDecimal totalOfProductOrders(List> paymentAggregation) { + BigDecimal totalProductAmount = BigDecimal.ZERO; + + if (paymentAggregation != null && !paymentAggregation.isEmpty()) { + for (Map payment : paymentAggregation) { + if ("goods".equals(payment.get("flag"))) { + BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount"))); + totalProductAmount = totalProductAmount.add(paidAmount); + } + } + } + + return totalProductAmount; + } + + // 会员储值合计 + public BigDecimal totalMemberStoredValue(List> paymentAggregation) { + BigDecimal totalStoredValue = BigDecimal.ZERO; + + if (paymentAggregation != null && !paymentAggregation.isEmpty()) { + for (Map payment : paymentAggregation) { + if ("card".equals(payment.get("flag")) || "fuel".equals(payment.get("flag"))) { + BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount"))); + totalStoredValue = totalStoredValue.add(paidAmount); + } + } + } + + return totalStoredValue; + } + + // 积分商城统计 + public BigDecimal pointsMallStatistics(List> paymentAggregation) { + BigDecimal totalPointsMallAmount = BigDecimal.ZERO; + + if (paymentAggregation != null && !paymentAggregation.isEmpty()) { + for (Map payment : paymentAggregation) { + if ("point".equals(payment.get("flag"))) { + BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount"))); + totalPointsMallAmount = totalPointsMallAmount.add(paidAmount); + } + } + } + + return totalPointsMallAmount; + } + + // 油号统计合计 + public BigDecimal totalOilNumberStatistics(List> oilNumberStatistics) { + BigDecimal totalOilNumberAmount = BigDecimal.ZERO; + + if (oilNumberStatistics != null && !oilNumberStatistics.isEmpty()) { + for (Map statistics : oilNumberStatistics) { + BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount"))); + totalOilNumberAmount = totalOilNumberAmount.add(paidAmount); + } + } + + return totalOilNumberAmount; + } + + // 优惠统计合计 + public BigDecimal discountStatisticsTotal(List> oilNumberStatistics) { + BigDecimal totalDiscountAmount = BigDecimal.ZERO; + + if (oilNumberStatistics != null && !oilNumberStatistics.isEmpty()) { + for (Map statistics : oilNumberStatistics) { + BigDecimal paidDiscount = new BigDecimal(String.valueOf(statistics.get("paidDiscount"))); + totalDiscountAmount = totalDiscountAmount.add(paidDiscount); + } + } + + return totalDiscountAmount; + } + + // 油枪统计合计 + public BigDecimal totalOfOilGunStatistics(List> greaseGunStatistics) { + BigDecimal totalOilGunAmount = BigDecimal.ZERO; + + if (greaseGunStatistics != null && !greaseGunStatistics.isEmpty()) { + for (Map statistics : greaseGunStatistics) { + BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount"))); + totalOilGunAmount = totalOilGunAmount.add(paidAmount); + } + } + + return totalOilGunAmount; + } + + // 员工统计合计 + public BigDecimal totalOfEmployeeStatistics(List> employeeStatistics) { + BigDecimal totalEmployeeAmount = BigDecimal.ZERO; + + if (employeeStatistics != null && !employeeStatistics.isEmpty()) { + for (Map statistics : employeeStatistics) { + BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount"))); + totalEmployeeAmount = totalEmployeeAmount.add(paidAmount); + } + } + + return totalEmployeeAmount; + } + + // 挂账详情统计 + public BigDecimal statisticsOfAccountDetails(List> billingDetails) { + BigDecimal totalAccountDetailsAmount = BigDecimal.ZERO; + + if (billingDetails != null && !billingDetails.isEmpty()) { + for (Map details : billingDetails) { + BigDecimal amount = new BigDecimal(String.valueOf(details.get("amount"))); + totalAccountDetailsAmount = totalAccountDetailsAmount.add(amount); + } + } + + return totalAccountDetailsAmount; + } + + // 挂账归还统计 + public BigDecimal postedAccountReturnStatistics(List> returnedToTheAccount) { + BigDecimal totalReturnAmount = BigDecimal.ZERO; + + if (returnedToTheAccount != null && !returnedToTheAccount.isEmpty()) { + for (Map returnDetails : returnedToTheAccount) { + BigDecimal amount = new BigDecimal(String.valueOf(returnDetails.get("amount"))); + totalReturnAmount = totalReturnAmount.add(amount); + } + } + + return totalReturnAmount; + } + + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java index c54e69a06..161cf294f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/LJUserServiceImpl.java @@ -22,6 +22,7 @@ import com.fuint.common.util.TokenUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.*; /** @@ -107,12 +108,13 @@ public class LJUserServiceImpl extends ServiceImpl impleme return baseMapper.selectUserById(id); } + + @Override public LJUserVo getByUniApp(Integer chainStoreId) { - AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); - - return baseMapper.selectUserByIdUni(nowAccountInfo.getId(),chainStoreId); + LJUserVo ljUserVo = baseMapper.selectUserByIdUni(nowAccountInfo.getId(), chainStoreId); + return ljUserVo; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/util/TscLibDll.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/util/TscLibDll.java new file mode 100644 index 000000000..ca0aeac4f --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/util/TscLibDll.java @@ -0,0 +1,40 @@ +package com.fuint.common.util; + +import com.sun.jna.Library; +import com.sun.jna.Native; + +public interface TscLibDll extends Library { +// TscLibDll INSTANCE = (TscLibDll) Native.loadLibrary("TSCLIB", TscLibDll.class); + TscLibDll INSTANCE = Native.load("TSCLIB", TscLibDll.class); + + int about(); + + int openport(String pirnterName); + + int closeport(); + + int sendcommand(String printerCommand); + +// int sendBinaryData(byte[] printerCommand, int CommandLength); + + int setup(String width, String height, String speed, String density, String sensor, String vertical, String offset); + + int downloadpcx(String filename, String image_name); + + int barcode(String x, String y, String type, String height, String readable, String rotation, String narrow, String wide, String code); + + int printerfont(String x, String y, String fonttype, String rotation, String xmul, String ymul, String text); + + int clearbuffer(); + + int printlabel(String set, String copy); + + int windowsfont(int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, String content); + + int windowsfontUnicode(int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, byte[] content); + + int windowsfontUnicodeLengh(int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, byte[] content, int length); + + byte usbportqueryprinter(); + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java index 3356dc1c4..d4dcc8705 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java @@ -13,6 +13,7 @@ import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -63,6 +64,7 @@ public class SysDept extends BaseEntity /** 子部门 */ @TableField(exist = false) private List children = new ArrayList(); - - + private String turnoverType; + private BigDecimal turnoverLimit; + private Date turnoverTime; } diff --git a/fuintBackend/fuint-application/src/main/resources/TSCLIB.dll b/fuintBackend/fuint-application/src/main/resources/TSCLIB.dll new file mode 100644 index 000000000..79499e96d Binary files /dev/null and b/fuintBackend/fuint-application/src/main/resources/TSCLIB.dll differ diff --git a/fuintBackend/fuint-application/src/main/resources/TSCLIB.lib b/fuintBackend/fuint-application/src/main/resources/TSCLIB.lib new file mode 100644 index 000000000..531c38847 Binary files /dev/null and b/fuintBackend/fuint-application/src/main/resources/TSCLIB.lib differ diff --git a/fuintBackend/fuint-application/src/test/java/dyj.java b/fuintBackend/fuint-application/src/test/java/dyj.java new file mode 100644 index 000000000..8974db4e4 --- /dev/null +++ b/fuintBackend/fuint-application/src/test/java/dyj.java @@ -0,0 +1,118 @@ +import com.fuint.common.util.TscLibDll; +import com.fuint.fuintApplication; +import com.sun.jna.Library; +import com.sun.jna.Native; +import javafx.print.Printer; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.nio.charset.StandardCharsets; + +@RunWith(SpringJUnit4ClassRunner.class) +//@RunWith(SpringRunner.class) +@SpringBootTest(classes = fuintApplication.class) +@Transactional +public class dyj { + + private static final String LOAD_LIBRARY = "TSCLIB"; + + public interface TscLibDll extends Library { + TscLibDll INSTANCE = (TscLibDll) Native.loadLibrary("TSCLIB", TscLibDll.class); + + // 以下为dll函数库支持的方法,方法的作用与参数说明见附件【dll函数库api文档】 + int about (); + int openport (String pirnterName); + int closeport (); + int sendcommand (String printerCommand); + int setup (String width,String height,String speed,String density,String sensor,String vertical,String offset); + int downloadpcx (String filename,String image_name); + int barcode (String x,String y,String type,String height,String readable,String rotation,String narrow,String wide,String code); + int printerfont (String x,String y,String fonttype,String rotation,String xmul,String ymul,String text); + int clearbuffer (); + int printlabel (String set, String copy); + int formfeed (); + int nobackfeed (); + int windowsfont (int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, String content); + + + } + + @Test + public void tt() { +// TscLibDll.INSTANCE.openport("GP-58MB Series"); + +// System.loadLibrary(LOAD_LIBRARY); + System.setProperty("jna.encoding", "GBK"); +// TscLibDll.INSTANCE.about(); +// TscLibDll.INSTANCE.openport("TSC TTP-2410M"); + TscLibDll.INSTANCE.openport("GP-58MB Series"); + TscLibDll.INSTANCE.sendcommand("------------交班统计------------"); + +// // 2.设置打印机纸张规格 +// TscLibDll.INSTANCE.setup("100", "100", "5", "8", "0", "0", "0"); +// // 3.清除上次打印后的缓存 +// TscLibDll.INSTANCE.clearbuffer(); +// // 4.将字体写入暂存区准备打印 +// TscLibDll.INSTANCE.printerfont ("100", "10", "3", "0", "1", "1", "(JAVA) DLL Test!!"); +// // 5.调用打印机打印 +// TscLibDll.INSTANCE.printlabel("1", "1"); + // 6.断开和打印机的连接 + TscLibDll.INSTANCE.closeport(); + + + + // TscLibDll.INSTANCE.sendcommand("REM ***** This is a test by JAVA. *****"); + + // TscLibDll.INSTANCE.sendcommand("PUTPCX 550,10,\"UL.PCX\""); + +// TscLibDll.INSTANCE.barcode("100", "40", "128", "50", "1", "0", "2", "2", "123456789"); +// TscLibDll.INSTANCE.windowsfont(400, 200, 48, 0, 3, 1, "arial", "DEG 0"); +// TscLibDll.INSTANCE.windowsfont(400, 200, 48, 90, 3, 1, "arial", "DEG 90"); + } + + /** + * 蜂鸣 + */ + public static void buzzing(Printer printer) { + +// System.loadLibrary(LOAD_LIBRARY); +// +//// TscLibDll.INSTANCE.openport(printer.getName()); +// TscLibDll.INSTANCE.openport("GP-58MB Series"); +// +//// TscLibDll.INSTANCE.sendBinaryData(Command.BUZZING.getCommandBytes(), Command.BUZZING.getCommandBytes().length); +// TscLibDll.INSTANCE.closeport(); + } + +} +enum Command { + + /** 切纸 */ + CUT_PAPER(new byte[]{0x1D, 0x56, 1}), + /** 蜂鸣 */ + BUZZING(new byte[]{0x1B,0x42,2,6 }), + /** 水平居中 */ + ALINE_CENTER(new byte[]{0x1B,0x61,1 }), + /** 左对齐 */ + ALINE_LEFT(new byte[]{0x1B,0x61,0 }), + /** 右对齐 */ + ALINE_RIGHT(new byte[]{0x1B,0x61,2 }), + /** 行间距 */ + LINE_HEIGHT_DEFAULT(new byte[]{0x1B,0x32}), + /** 横向跳格 */ + SKIP_SPACE(new byte[]{0x1B,0x44,16,20,24,28 }); + + Command(byte[] commandBytes) { + this.commandBytes = commandBytes; + } + + private byte[] commandBytes; + + public byte[] getCommandBytes() { + return commandBytes; + } + +} diff --git a/fuintBackend/pom.xml b/fuintBackend/pom.xml index 803830099..364791d65 100644 --- a/fuintBackend/pom.xml +++ b/fuintBackend/pom.xml @@ -35,6 +35,22 @@ + + + + + + + + + + + net.java.dev.jna + jna + 5.10.0 + + + cn.hutool hutool-all diff --git a/fuintCashierWeb/src/api/cashier/handover.js b/fuintCashierWeb/src/api/cashier/handover.js index 0528f9339..85ebb04e2 100644 --- a/fuintCashierWeb/src/api/cashier/handover.js +++ b/fuintCashierWeb/src/api/cashier/handover.js @@ -23,3 +23,11 @@ export function addHandoverApi(data) { data: data }) } + +export function printLocallyApi(data) { + return request({ + url: '/business/handoverRecord/printLocally', + method: 'post', + data: data + }) +} diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/Handover.vue b/fuintCashierWeb/src/views/cashier/NewComponents/Handover.vue index 839cd2191..283ea0001 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/Handover.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/Handover.vue @@ -288,7 +288,7 @@
油枪统计
-
油号
+
油枪
笔数
升数
金额
@@ -371,8 +371,8 @@
交班
-
云打印
-
本地打印
+ +
本地打印
交班记录
@@ -382,7 +382,7 @@