Browse Source

权限管理,道闸接口

qzyReal 3 years ago
parent
commit
4694f449ad

File diff suppressed because it is too large
+ 0 - 74
pco_system.sql


+ 1 - 1
sp-admin/sa-frame/menu-list-sp.js

@@ -32,7 +32,7 @@ window.menuList.unshift(
 		info: '对系统角色权限的分配等设计,敏感度较高,请谨慎授权',
 		childList: [
 			{id: 'role-list', name: '角色列表', url: 'sa-view-sp/sp-role/role-list.html', info: '管理系统各种角色'},
-			{id: 'menu-list', name: '菜单列表', url: 'sa-view-sp/sp-role/menu-list.html', info: '所有菜单项预览'},
+			// {id: 'menu-list', name: '菜单列表', url: 'sa-view-sp/sp-role/menu-list.html', info: '所有菜单项预览'},
 			{id: 'admin-list', name: '管理员列表', url: 'sa-view-sp/sp-admin/admin-list.html', info: '所有管理员账号'},
 			{id: 'admin-add', name: '管理员添加', url: 'sa-view-sp/sp-admin/admin-add.html', info: '添加一个管理员'},
 			// {id: 'apilog-list', name: '请求日志监控', url: 'sa-view-sp/sp-apilog/api-log-list.html', info: '记录本系统所有的api请求'},

+ 5 - 3
sp-admin/sa-frame/menu-list.js

@@ -38,12 +38,14 @@ var menuList =	[
 	},
 	{
 		id: 'tb-business',
-		name: '业务登记',
+		name: '业务录入管理',
 		icon: 'el-icon-folder-opened',
 		info: '业务登记表数据的维护',
 		childList: [
-			{id: 'tb-business-list', name: '业务登记', url: 'sa-view/tb-business/tb-business-list.html'},
-			{id: 'tb-business-add', name: '业务查询', url: 'sa-view/tb-business/tb-business-add.html'},
+			{id: 'tb-business-list', name: '业务列表', url: 'sa-view/tb-business/tb-business-list.html'},
+			{id: 'tb-business-add', name: '录入业务', url: 'sa-view/tb-business/tb-business-add.html', isShow: false},
+			{id: 'tb-business-confirm', name: '业务确认', url: 'sa-view/tb-business/tb-business-list.html', isShow: false},
+			{id: 'tb-business-pay', name: '业务支付', url: 'sa-view/tb-business/tb-business-list.html', isShow: false},
 		]
 	},
 	{

+ 1 - 1
sp-admin/sa-view-sp/sp-role/menu-setup.html

@@ -161,7 +161,7 @@
 						})
 					},
 					getCurrPer(){
-						sa.ajax('/SpRolePermission/getPcodeByCurrRid',function(resp){
+						sa.ajax('/SpRolePermission/getCustomerPcCode',function(resp){
 							let cuList=resp.data;
 							let menu_list=	this.filterMenu(menuList,cuList);
 							this.handler(menu_list);

+ 7 - 16
sp-admin/sa-view/tb-business/tb-business-list.html

@@ -29,8 +29,8 @@
 				</el-form>
 				<!-- ------------- 快捷按钮 ------------- -->
 				<div class="fast-btn">
-					<el-button size="mini" type="primary" v-if="perCode.indexOf('tb-business-add')!=-1||adminId=='1'"  @click="add()">新增</el-button>
-					<el-button size="mini" type="primary" v-if="perCode.indexOf('tb-business-confirm')!=-1||adminId=='1'"  @click="confirmBatch()">确认</el-button>
+					<el-button size="mini" type="primary" v-if="perCode.indexOf('tb-business-add')!=-1"  @click="add()">新增</el-button>
+					<el-button size="mini" type="primary" v-if="perCode.indexOf('tb-business-confirm')!=-1"  @click="confirmBatch()">确认</el-button>
 					<el-button size="mini" type="success"  @click="getBySelect()">查看</el-button>
 					<el-button size="mini" type="danger"  @click="deleteByIds()">删除</el-button>
 					<!-- <el-button size="mini" type="warning" icon="el-icon-download" @click="sa.exportExcel()">导出</el-button> -->
@@ -54,12 +54,12 @@
 					<sa-td  name="确认" prop="confirmInput" type="enum" :jv="{0: '未确认[#ff0000]', 1: '已确认[#005500]'}"></sa-td>
 					<el-table-column label="操作" fixed="right"  width="240px">
 						<template slot-scope="s">
-							<el-button class="c-btn" type="primary" v-if="s.row.confirmInput==0&&(perCode.indexOf('tb-business-confirm')!=-1||adminId=='1')"  @click="confirmFn(s.row)">确认</el-button>
-							<el-button class="c-btn" type="success" v-if="s.row.confirmInput==1&&(perCode.indexOf('tb-business-pay')!=-1||(adminId=='1'&&s.row.payStatus==1))" @click="payFn(s.row)">支付</el-button>
+							<el-button class="c-btn" type="primary" v-if="s.row.confirmInput==0&&perCode.indexOf('tb-business-confirm')!=-1"  @click="confirmFn(s.row)">确认</el-button>
+							<el-button class="c-btn" type="success" v-if="s.row.confirmInput==1&&perCode.indexOf('tb-business-pay')!=-1&&s.row.payStatus==1" @click="payFn(s.row)">支付</el-button>
 									<el-button class="c-btn" type="success" v-if="adminId=='1'&&s.row.payStatus==2" @click="adminSurePayFn(s.row)">确认支付</el-button>
 							<el-button class="c-btn" type="success"  @click="get(s.row)">查看</el-button>
-							<el-button class="c-btn" type="primary" v-if="s.row.confirmInput==0"  @click="update(s.row)">修改</el-button>
-							<el-button class="c-btn" type="danger"  v-if="s.row.payStatus==1" @click="del(s.row)">删除</el-button>
+							<el-button class="c-btn" type="primary" v-if="s.row.confirmInput==0&&perCode.indexOf('tb-business-add')!=-1"  @click="update(s.row)">修改</el-button>
+							<el-button class="c-btn" type="danger"  v-if="s.row.payStatus==1&&perCode.indexOf('tb-business-add')!=-1" @click="del(s.row)">删除</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
@@ -180,15 +180,6 @@
 							return sa.msg('至少选择一条未确认数据')
 						}
 					},
-					getCustomer(){
-						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
-							let id=resp.data;
-							if(id!=='1'){
-								this.getPcodeByCurrRid();
-							}
-							this.adminId=id;
-						}.bind(this));
-					},
 					getPcodeByCurrRid(){
 						sa.ajax('/SpRolePermission/getPcodeByCurrRid',function(resp){
 							this.perCode=resp.data;
@@ -282,7 +273,7 @@
 				created: function() {
 					this.f5();
 					sa.onInputEnter();
-					this.getCustomer();
+					this.getPcodeByCurrRid();
 				}
 			})
 		</script>

+ 5 - 3
sp-server/sp-server.iml

@@ -34,9 +34,6 @@
     <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.8.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.3.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.2" level="project" />
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.2" level="project" />
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.2" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.2" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.2" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.2" level="project" />
@@ -102,5 +99,10 @@
     <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.1" level="project" />
     <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.73" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.3.3.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: com.auth0:java-jwt:3.3.0" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.2" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.2" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.2" level="project" />
+    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
   </component>
 </module>

+ 24 - 0
sp-server/src/main/java/com/pj/api/open/OpenFilter.java

@@ -0,0 +1,24 @@
+package com.pj.api.open;
+
+import cn.hutool.core.util.StrUtil;
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.*;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@Slf4j
+@WebFilter(filterName = "openFilter", urlPatterns = "/open/*")
+public class OpenFilter implements Filter {
+    @Override
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+        HttpServletRequest request = (HttpServletRequest) servletRequest;
+        HttpServletResponse response = (HttpServletResponse) servletResponse;
+        response.setContentType("application/json;charset=utf-8");
+        response.setHeader("Access-Control-Allow-Origin", "*");
+        String dataType = request.getHeader("DataType");
+        request.getRequestDispatcher("/open/"+dataType).forward(request,response);
+    }
+}

+ 37 - 0
sp-server/src/main/java/com/pj/api/open/ResultJson.java

@@ -0,0 +1,37 @@
+package com.pj.api.open;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+@AllArgsConstructor
+@NoArgsConstructor
+public class ResultJson {
+    /**
+     * 操作状态,大于等于0 为成功
+     */
+    private int status;
+    /**
+     * 状态描述
+     */
+    private String message;
+    /**
+     * 0 不允许,1 允许
+     */
+    private int canpass;
+    /**
+     * 不允许放行的原因
+     */
+    private String reason;
+
+    public static ResultJson success(){
+        return new ResultJson(1,"ok",1,"");
+    }
+    public static ResultJson error(String reason){
+        return new ResultJson(1,"ok",0,reason);
+    }
+
+}

+ 27 - 0
sp-server/src/main/java/com/pj/api/open/bo/CheckCarNumberBO.java

@@ -0,0 +1,27 @@
+package com.pj.api.open.bo;
+
+import com.sun.scenario.effect.ImageData;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+@Data
+@Accessors(chain = true)
+public class CheckCarNumberBO implements Serializable {
+    /**
+     * 当前设别车牌的通道名称
+     */
+   private String ChannelName;
+    private String     CarNumber;
+    /**
+     * 1 入场 2 出场
+     */
+    private int  InOrOut;
+    private String     ImageData;
+    /**
+     * 操作员
+     */
+    private String OperationUserName;
+
+}

+ 91 - 0
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -0,0 +1,91 @@
+package com.pj.api.open.service;
+
+import cn.hutool.core.util.NumberUtil;
+import com.pj.api.open.ResultJson;
+import com.pj.api.open.bo.CheckCarNumberBO;
+import com.pj.current.config.PartConfig;
+import com.pj.project.tb_business.TbBusiness;
+import com.pj.project.tb_business.TbBusinessService;
+import com.pj.project.tb_costomer.TbCostomer;
+import com.pj.project.tb_costomer.TbCostomerService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
+import java.util.Date;
+
+@Service
+@Transactional
+public class OpenService {
+    @Resource
+    private TbBusinessService tbBusinessService;
+    @Resource
+    private TbCostomerService tbCostomerService;
+
+    @Resource
+    private PartConfig partConfig;
+
+    public ResultJson checkCarNumber(CheckCarNumberBO checkCarNumberBO) {
+        String carNo=checkCarNumberBO.getCarNumber();
+       TbBusiness tbBusiness= tbBusinessService.findCarTheNewRecord(carNo);
+       if (tbBusiness==null||tbBusiness.getOutDayTime()!=null){
+           return ResultJson.error("无业务登记记录");
+       }
+        if (tbBusiness.getConfirmInput()==0){
+            return ResultJson.error("业务订单未确认,请先确认");
+        }
+      int inOrOut= checkCarNumberBO.getInOrOut();
+       if (inOrOut==1){
+           if (tbBusiness.getRealInDay()==null){
+               //入场
+               tbBusiness.setRealInTime(new Date()).setInChannel(checkCarNumberBO.getChannelName());
+               tbBusinessService.updateById(tbBusiness);
+               return ResultJson.success();
+           }else {
+               return ResultJson.error("车辆已入场");
+           }
+       }else{
+           if (tbBusiness.getOutDayTime()==null){
+              TbCostomer tbCostomer= tbCostomerService.getById(tbBusiness.getCustomerId());
+              handlerOut(tbBusiness,checkCarNumberBO);
+              if (tbCostomer.getPayType()==2){
+                  return ResultJson.success();
+              }else {
+                  if (tbBusiness.getPayStatus() != 3) {
+                      return ResultJson.error("车辆未缴费");
+                  }
+              }
+               return ResultJson.success();
+           }else {
+               return ResultJson.error("车辆已离场");
+           }
+       }
+
+    }
+
+    private void handlerOut(TbBusiness tbBusiness, CheckCarNumberBO checkCarNumberBO) {
+        LocalDateTime inTime=  tbBusiness.getRealInTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+       LocalDateTime outTime=LocalDateTime.now();
+       LocalDateTime zero=LocalDateTime.of(LocalDate.now(), LocalTime.of(0,0,0));
+       long days= ChronoUnit.DAYS.between(inTime,outTime);
+        BigDecimal basePrice=partConfig.getBasePrice();
+        BigDecimal extraPirce=partConfig.getExtraPrice();
+       BigDecimal price= basePrice.add(basePrice.multiply(new BigDecimal(days)));
+        if (outTime.isBefore(partConfig.getNightEnd())&&outTime.isAfter(zero)){
+            price=  price.add(extraPirce);
+        }
+        tbBusiness.setPartMoney(price);
+       long minutes= ChronoUnit.MINUTES.between(inTime,outTime);
+       if (minutes<=partConfig.getFreeMinutes()){
+           tbBusiness.setPartMoney(new BigDecimal(0));
+       }
+       tbBusiness.setPartTime(minutes).setOutDayTime(new Date()).setOutChannel(checkCarNumberBO.getChannelName());
+       tbBusinessService.updateById(tbBusiness);
+    }
+}

+ 31 - 0
sp-server/src/main/java/com/pj/api/open/web/OpenController.java

@@ -0,0 +1,31 @@
+package com.pj.api.open.web;
+
+import com.pj.api.open.ResultJson;
+import com.pj.api.open.bo.CheckCarNumberBO;
+import com.pj.api.open.service.OpenService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RequestMapping(value = "open")
+@RestController
+@Slf4j
+public class OpenController {
+    @Resource
+    OpenService openService;
+
+    @PostMapping(value = "req")
+    public ResultJson req() {
+        return ResultJson.success();
+    }
+    @PostMapping(value = "CheckCarNumber")
+    public ResultJson checkPass(@RequestBody CheckCarNumberBO checkCarNumberBO) {
+        log.info("check car number");
+        openService.checkCarNumber(checkCarNumberBO);
+        return ResultJson.success();
+    }
+}

+ 20 - 0
sp-server/src/main/java/com/pj/current/config/PartConfig.java

@@ -0,0 +1,20 @@
+package com.pj.current.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "part-config")
+public class PartConfig {
+    private BigDecimal basePrice;
+    private BigDecimal extraPrice;
+    private LocalDateTime  nightEnd;
+    private long freeMinutes;
+
+}

+ 6 - 5
sp-server/src/main/java/com/pj/current/satoken/StpInterfaceImpl.java

@@ -12,6 +12,8 @@ import com.pj.project4sp.role4permission.SpRolePermissionService;
 import cn.dev33.satoken.stp.StpInterface;
 import cn.dev33.satoken.stp.StpUtil;
 
+import javax.annotation.Resource;
+
 /**
  * 自定义Sa-Token权限认证接口扩展 
  * 
@@ -21,7 +23,7 @@ import cn.dev33.satoken.stp.StpUtil;
 @Component	
 public class StpInterfaceImpl implements StpInterface {
 
-	@Autowired
+	@Resource
 	SpAdminMapper spAdminMapper;
 	
 	@Autowired
@@ -31,10 +33,9 @@ public class StpInterfaceImpl implements StpInterface {
 	@Override
 	public List<String> getPermissionList(Object loginId, String loginType) {
 		if(loginType.equals(StpUtil.TYPE)) {
-		SpAdmin spAdmin= spAdminMapper.getById(Long.valueOf( loginId.toString()));
-		String roleIds=spAdmin.getRoleId();
-		List<String>list=spRolePermissionService.getPcodeByRid(roleIds);
-		return 	list;
+			SpAdmin spAdmin= spAdminMapper.getById(Long.valueOf( loginId.toString()));
+			String roleIds=spAdmin.getRoleId();
+			return spRolePermissionService.getPcodeByRid(roleIds);
 		}
 		return null;
 	}

+ 10 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -128,6 +128,11 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
 	 * 实际进境时间 
 	 */
 	private Date realInTime;
+	/**
+	 * 入场通道
+	 */
+	private String inChannel;
+
 
 	/**
 	 * 支付状态(1=未支付,2=已支付,3=运营人员确认支付)
@@ -149,6 +154,10 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
 	 * 离境时间 
 	 */
 	private Date outDayTime;
+	/**
+	 * 出场通道
+	 */
+	private String outChannel;
 
 
 	/**
@@ -159,7 +168,7 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
 	/**
 	 * 停车时常(分) 
 	 */
-	private Integer partTime;
+	private Long partTime;
 	private BigDecimal itemPrice;
 	private BigDecimal totalMoney;
 	private Date createTime;

+ 57 - 45
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -10,6 +10,7 @@ import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.constants.UserTypeEnum;
@@ -27,6 +28,8 @@ import com.pj.project.tb_item.TbItemService;
 import com.pj.project.tb_item_type.TbItemType;
 import com.pj.project.tb_item_type.TbItemTypeService;
 import com.pj.project4sp.admin.SpAdmin;
+import com.pj.project4sp.role.SpRoleUtil;
+import com.pj.project4sp.role4permission.SpRolePermissionService;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -61,64 +64,65 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     private TbItemTypeService tbItemTypeService;
     @Resource
     private TbBusinessItemService tbBusinessItemService;
+    @Autowired
+    SpRolePermissionService spRolePermissionService;
 
     /**
      * 增
      */
-  public   void addOrUpdate(TbBusiness t) {
-       t.setCreateBy(StpUserUtil.getAdmin().getName());
+    public void addOrUpdate(TbBusiness t) {
+        t.setCreateBy(StpUserUtil.getAdmin().getName());
         createCar(t.getCardNo(), t.getCardSize(), t.getGoodsName());
-        TbDriver tbDriver=  createDriver(t.getDriverIdCard(),t.getDriverName(),t.getDriverPhone());
+        TbDriver tbDriver = createDriver(t.getDriverIdCard(), t.getDriverName(), t.getDriverPhone());
         t.setDriverId(tbDriver.getId());
-        String customerId=t.getCustomerId();
+        String customerId = t.getCustomerId();
         if (!StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-          TbCostomer tbCostomer= tbCostomerService.getById(customerId);
-          t.setCustomerName(tbCostomer.getName());
-        }else {
+            TbCostomer tbCostomer = tbCostomerService.getById(customerId);
+            t.setCustomerName(tbCostomer.getName());
+        } else {
             t.setConfirmInputBy(StpUserUtil.getAdmin().getName()).setConfirmInput(1).setConfirmInputTime(new Date());
         }
-      if (StrUtil.isEmpty(t.getNo())) {
-          t.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm"))+RandomUtil.randomNumbers(4));
-      }
-      List<TbBusinessItem>items=  JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
-      if(StrUtil.isEmpty(t.getId())){
-          t.setCreateTime(new Date());
-      }
-      saveOrUpdate(t);
-      tbBusinessItemService.removeByBusinessId(t.getId());
-      BigDecimal price=new BigDecimal(0);
-      for (TbBusinessItem item : items) {
-          Integer num = item.getNum();
-          TbItem tbItem = tbItemService.getById(item.getItemId());
-          price = price.add(NumberUtil.mul(num, tbItem.getPrice()));
-          TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
-          item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode())
-                  .setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
-                  .setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
-                  .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num,tbItem.getPrice()));
-      }
-      t.setItemPrice(price);
-      this.saveOrUpdate(t);
-      tbBusinessItemService.saveBatch(items);
+        if (StrUtil.isEmpty(t.getNo())) {
+            t.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
+        }
+        List<TbBusinessItem> items = JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
+        if (StrUtil.isEmpty(t.getId())) {
+            t.setCreateTime(new Date());
+        }
+        saveOrUpdate(t);
+        tbBusinessItemService.removeByBusinessId(t.getId());
+        BigDecimal price = new BigDecimal(0);
+        for (TbBusinessItem item : items) {
+            Integer num = item.getNum();
+            TbItem tbItem = tbItemService.getById(item.getItemId());
+            price = price.add(NumberUtil.mul(num, tbItem.getPrice()));
+            TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
+            item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode())
+                    .setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
+                    .setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
+                    .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num, tbItem.getPrice()));
+        }
+        t.setItemPrice(price);
+        this.saveOrUpdate(t);
+        tbBusinessItemService.saveBatch(items);
     }
 
 
-
-    private TbDriver createDriver(String idCardNo,String name,String phone) {
-        TbDriver tbDriver=tbDriverService.findByIdCardNo(idCardNo);
-        if (tbDriver==null){
-            tbDriver=new TbDriver();
+    private TbDriver createDriver(String idCardNo, String name, String phone) {
+        TbDriver tbDriver = tbDriverService.findByIdCardNo(idCardNo);
+        if (tbDriver == null) {
+            tbDriver = new TbDriver();
             tbDriver.setCreateTime(new Date()).setIdCard(idCardNo).setName(name).setPhone(phone);
             tbDriverService.save(tbDriver);
         }
-        return  tbDriver;
+        return tbDriver;
 
     }
 
     private TbCar createCar(String cardNo, String carSize, String goodsName) {
         TbCar tbCar = tbCarService.findByCardNo(cardNo);
         if (tbCar == null) {
-             tbCar = new TbCar();
+            tbCar = new TbCar();
         }
         tbCar.setCardNo(cardNo).setCardSize(carSize).setLastGoodsName(goodsName);
         tbCarService.saveOrUpdate(tbCar);
@@ -135,8 +139,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
 
     public void pay(String id, String payTicket) {
-        TbBusiness tbBusiness=  this.getById(id);
-        SpAdmin admin=StpUserUtil.getAdmin();
+        TbBusiness tbBusiness = this.getById(id);
+        SpAdmin admin = StpUserUtil.getAdmin();
         tbBusiness.setPayStatus(2).setPayBy(admin.getName())
                 .setPayBy(StpUserUtil.getAdmin().getName())
                 .setPayTicket(payTicket)
@@ -149,19 +153,27 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     }
 
     public void confirm(List<String> ids) {
-        ids.forEach(id->{
-            TbBusiness business=this.getById(id);
+        ids.forEach(id -> {
+            TbBusiness business = this.getById(id);
             business.setConfirmInput(1).setConfirmInputTime(new Date()).setConfirmInputBy(StpUserUtil.getAdmin().getName());
             this.updateById(business);
         });
     }
 
     public void adminConfirmPay(List<String> ids) {
-        ids.forEach(id->{
-            TbBusiness business=this.getById(id);
-             business.setAdminConfirmPayTime(new Date()).setAdminConfirmPay(1).setAdminConfirmPayBy(StpUserUtil.getAdmin().getName())
-                 .setPayStatus(3);
+        ids.forEach(id -> {
+            TbBusiness business = this.getById(id);
+            business.setAdminConfirmPayTime(new Date()).setAdminConfirmPay(1).setAdminConfirmPayBy(StpUserUtil.getAdmin().getName())
+                    .setPayStatus(3);
             this.updateById(business);
         });
     }
+
+    public TbBusiness findCarTheNewRecord(String carNo) {
+        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
+        ew.eq("card_no", carNo);
+        ew.orderByDesc("id");
+        List<TbBusiness> list = this.list(ew);
+        return list.isEmpty() ? null : list.get(0);
+    }
 }

+ 8 - 0
sp-server/src/main/java/com/pj/project4sp/role4permission/SpRolePermissionController.java

@@ -61,6 +61,14 @@ public class SpRolePermissionController {
 	@RequestMapping("getPcodeByCurrRid")
 	public AjaxJson getPcodeByCurrRid(){
 		String roleId = SpRoleUtil.getCurrRoleId();
+
+		List<Object> list = spRolePermissionService.getPcodeByRid2(roleId);
+		return AjaxJson.getSuccessData(list);
+	}
+	/** 拉取菜单id列表  根据当前用户roleId  */
+	@RequestMapping("getCustomerPcCode")
+	public AjaxJson getCustomerPcCode(){
+		String roleId = SpRoleUtil.getCurrRoleId();
 		List<SpRole>roles= spRoleMapper.getByIds(StrUtil.splitTrim(roleId,",").stream().map(Long::valueOf).collect(Collectors.toList()));
 		long count=roles.stream().filter(spRole -> StrUtil.equals(spRole.getType(), RoleEnum.ADMIN_ROLE.getType())).count();
 		if (count>0){

+ 5 - 0
sp-server/src/main/resources/application-dev.yml

@@ -46,3 +46,8 @@ spring:
     myconfig:
         # 本项目部署到的服务器域名(文件上传等等模块  要用到)
         domain: http://127.0.0.1:8099
+part-config:
+    base-price: 30 #基础费用
+    extra-price: 10 #过夜额外收费
+    night-end: 6:00:00 #夜间结束时间
+    free-minutes: 20

Some files were not shown because too many files changed in this diff