Prechádzať zdrojové kódy

Merge branch 'dev' of http://47.101.143.145:8090/77975466/pco into dev

# Conflicts:
#	sp-server/app.pid
qzyReal 3 rokov pred
rodič
commit
4e3bc3dcff

+ 6 - 0
app/apis/api.js

@@ -138,5 +138,11 @@ export default {
 	},
 	getDeclareList(data){
 		return ajax.get('/api/getDeclareList', data)
+	},
+	getAccountInfo(){
+		return ajax.get('/api/getAccountInfo')
+	},
+	getDiscountInfo(){
+		return ajax.get('/api/getDiscountInfo')
 	}
 }

+ 22 - 13
app/pages.json

@@ -93,13 +93,13 @@
 				"navigationBarTitleText": ""
 			}
 
-		}, 
+		},
 		{
 			"path": "pages/business-order/report",
 			"style": {
 				"navigationBarTitleText": ""
 			}
-		
+
 		},
 		{
 			"path": "pages/business-order/surePay",
@@ -108,7 +108,7 @@
 			}
 
 		},
-		
+
 		{
 			"path": "pages/business-order/sureOut",
 			"style": {
@@ -171,15 +171,15 @@
 				"navigationBarTitleText": ""
 				//"navigationStyle":"custom"
 			}
-		
+
 		},
 		{
 			"path": "pages/declare/addDeclareSuccess",
 			"style": {
 				"navigationBarTitleText": "",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
-		
+
 		},
 		{
 			"path": "pages/disinfect/addDisinfect",
@@ -187,31 +187,40 @@
 				"navigationBarTitleText": ""
 				//"navigationStyle":"custom"
 			}
-		
+
 		},
 		{
 			"path": "pages/disinfect/addDisinfectSuccess",
 			"style": {
 				"navigationBarTitleText": "",
-				"navigationStyle":"custom"
+				"navigationStyle": "custom"
 			}
-		
+
 		},
 		{
-			"path": "pages/account/index",
+			"path": "pages/wx/account-pay",
 			"style": {
 				"navigationBarTitleText": ""
 			}
-		
+
 		},
 		{
 			"path": "pages/business-entering/declare-select",
 			"style": {
 				"navigationBarTitleText": ""
 			}
-		
+
+		},
+		{
+			"path": "pages/account/account-redirect",
+			"style": {
+				"navigationBarTitleText": "",
+				"navigationStyle": "custom"
+			}
+
 		}
-		
+
+
 	],
 	"globalStyle": {
 		"navigationBarTextStyle": "white",

+ 68 - 0
app/pages/account/account-redirect.vue

@@ -0,0 +1,68 @@
+<template>
+	<view class="box">
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				id:''
+			}
+		},
+		onLoad(options) {
+			this.id=options.id;
+		},
+		created() {
+			this.$common.showLoading('正在加载...')
+		},
+		mounted() {
+			this.getRedirectUri();
+		},
+		beforeDestroy() {
+			this.$common.hidingLoading()
+		},
+		methods: {
+			getRedirectUri() {
+				this.$api.getRedirectUrl({path:'/pages/wx/account-pay',state:this.id}).then(resp => {
+					window.location.href = resp.data;
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background-color: #fff;
+	}
+
+	.box {
+		display: flex;
+		flex: 1;
+		align-items: center;
+		justify-content: center;
+		flex-direction: column;
+		padding: 100rpx 0;
+
+		.text {
+			color: #191919;
+			font-size: 36rpx;
+			font-weight: bold;
+			margin-top: 40rpx;
+		}
+
+		.count-down-box {
+			display: flex;
+			flex: 1;
+			align-items: center;
+			justify-content: center;
+			margin-top: 30rpx;
+
+			text {
+				margin-left: 20rpx;
+			}
+		}
+	}
+</style>

+ 1 - 1
app/pages/index/index.vue

@@ -126,7 +126,7 @@
 			},
 			toAccount() {
 				if (this.customerId !== '1') {
-					this.$common.to('/pages/account/index')
+					this.$common.to('/pages/account/account-redirect')
 				}
 			},
 			getStoreInfo() {

+ 2 - 2
app/utils/request.js

@@ -1,6 +1,6 @@
-const server = 'http://127.0.0.1:8099/pro';
+// const server = 'http://127.0.0.1:8099/pro';
 // const server = 'http://47.101.143.145/pro';
- // const server = 'https://dxkaa1.bgigc.com/pro';
+const server = 'https://dxkaa1.bgigc.com/pro';
 
 import common from '../common/js/common.js';
 

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-5728
+25968

+ 12 - 1
sp-server/src/main/java/com/pj/api/h5/ApiController.java

@@ -114,10 +114,21 @@ public class ApiController {
 
     @GetMapping(value = "getDeclareList")
     public AjaxJson getDeclareList() {
-        SoMap so=SoMap.getRequestSoMap();
+        SoMap so = SoMap.getRequestSoMap();
         return AjaxJson.getSuccessData(apiService.getDeclareList(so.startPage()));
     }
 
+    @GetMapping(value = "getAccountInfo")
+    public AjaxJson getAccountInfo() {
+        return AjaxJson.getSuccessData(apiService.getAccountInfo(StpUserUtil.getCustomerId()));
+    }
+    @GetMapping(value = "getDiscountInfo")
+    public AjaxJson getDiscountInfo() {
+        SoMap so = SoMap.getRequestSoMap();
+        so.put("status",1);
+        so.put("sortType",5);
+        return AjaxJson.getSuccessData(apiService.getDiscountInfo(so));
+    }
     @PostMapping(value = "addDeclare")
     public AjaxJson addDeclare(@RequestBody TbDeclare tbDeclare) {
         apiService.addDeclare(tbDeclare);

+ 16 - 0
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -6,6 +6,8 @@ import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import com.pj.api.bo.InOutRecordBO;
 import com.pj.current.satoken.StpUserUtil;
+import com.pj.project.tb_account.TbAccount;
+import com.pj.project.tb_account.TbAccountService;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_business_car.TbBusinessCar;
@@ -14,6 +16,8 @@ import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_declare.TbDeclare;
 import com.pj.project.tb_declare.TbDeclareService;
+import com.pj.project.tb_discount.TbDiscount;
+import com.pj.project.tb_discount.TbDiscountService;
 import com.pj.project.tb_disinfect.TbDisinfect;
 import com.pj.project.tb_disinfect.TbDisinfectService;
 import com.pj.project.tb_district.TbDistrict;
@@ -58,6 +62,10 @@ public class ApiService {
     @Resource
     @Lazy
     private TbDisinfectService tbDisinfectService;
+    @Resource
+    private TbAccountService accountService;
+    @Resource
+    private TbDiscountService tbDiscountService;
 
     public List<InOutRecordBO> getInOutRecord(SoMap so) {
         List<TbPassRecord> passRecords = tbPassRecordService.getList(so);
@@ -155,4 +163,12 @@ public class ApiService {
     public List<TbDeclare> getDeclareList(SoMap so) {
         return tbDeclareService.getList(so);
     }
+
+    public TbAccount getAccountInfo(String customerId) {
+        return accountService.getByCustomerId(customerId);
+    }
+
+    public List<TbDiscount> getDiscountInfo(SoMap so) {
+        return tbDiscountService.getList(so);
+    }
 }

+ 17 - 0
sp-server/src/main/java/com/pj/api/wx/bo/AccountChargeBO.java

@@ -0,0 +1,17 @@
+package com.pj.api.wx.bo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class AccountChargeBO implements Serializable {
+    private String id;
+    /**
+     * 充值金额
+     */
+    private BigDecimal c;
+}

+ 14 - 2
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -16,18 +16,21 @@ import com.pj.api.wx.bo.*;
 import com.pj.api.wx.vo.PrePayVO;
 import com.pj.current.config.MyConfig;
 import com.pj.current.config.WxConfig;
+import com.pj.project.tb_account.TbAccountService;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_business_car.TbBusinessCar;
 import com.pj.project.tb_business_car.TbBusinessCarService;
 import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
+import com.pj.project.tb_charge_record.TbChargeRecord;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_fee_statistics.TbFeeStatisticsService;
 import com.pj.project.tb_pay_record.TbPayRecord;
 import com.pj.project.tb_pay_record.TbPayRecordService;
 import com.pj.utils.cache.RedisUtil;
+import lombok.experimental.Accessors;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Async;
@@ -66,6 +69,8 @@ public class WxService {
     TbBusinessItemService tbBusinessItemService;
     @Resource
     TbFeeStatisticsService tbFeeStatisticsService;
+    @Resource
+    private TbAccountService tbAccountService;
 
     /**
      * 统一下单接口
@@ -151,14 +156,16 @@ public class WxService {
             return ip;
         }
     }
+
     TimedCache<String, Integer> NotifyCache = CacheUtil.newTimedCache(360000);
+
     @Async
     public void WxNotify(NotifyBO notifyBO) throws Exception {
         String outTradeNo = notifyBO.getOutTradeNo();
-        if (NotifyCache.get(outTradeNo)!=null) {
+        if (NotifyCache.get(outTradeNo) != null) {
             return;
         }
-        NotifyCache.put(outTradeNo,1);
+        NotifyCache.put(outTradeNo, 1);
         String total_fee = notifyBO.getTotalFee();
         BigDecimal money = new BigDecimal(total_fee).divide(new BigDecimal(100), 2, BigDecimal.ROUND_UP);
         log.info("wx pay notify;{}", JSONUtil.toJsonStr(notifyBO));
@@ -202,6 +209,11 @@ public class WxService {
                         .setCustomerId(tbCostomer.getId()).setCustomerName(tbCostomer.getName());
                 tbPayRecordService.save(payRecord);
             }
+            String a = attach.getA();
+            if (StrUtil.isNotEmpty(a)) {
+                AccountChargeBO chargeBO = JSONUtil.toBean(a, AccountChargeBO.class);
+                tbAccountService.recharge(chargeBO.getId(), chargeBO.getC(), TbChargeRecord.Ch.WECHAT.getType(), money);
+            }
         }
     }
 

+ 5 - 3
sp-server/src/main/java/com/pj/current/SaPlusStartup.java

@@ -6,6 +6,7 @@ import java.util.Date;
 
 import com.pj.current.config.WxConfig;
 import com.pj.current.task.TokenTask;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@@ -19,6 +20,7 @@ import javax.annotation.Resource;
  * @author kong
  */
 @Component
+@Slf4j
 public class SaPlusStartup implements CommandLineRunner {
 
     @Value("${spring.application.name:sa-plus}")
@@ -41,14 +43,14 @@ public class SaPlusStartup implements CommandLineRunner {
 
     @Override
     public void run(String... args) throws Exception {
-        tokenTask.run();
-        threadPoolTaskScheduler.scheduleAtFixedRate(tokenTask, wxConfig.getFlushSecond() * 1000);
+       // tokenTask.run();
+        //threadPoolTaskScheduler.scheduleAtFixedRate(tokenTask, wxConfig.getFlushSecond() * 1000);
         String ip = InetAddress.getLocalHost().getHostAddress();
         String str = "\n------------- " + applicationName + " (" + active + ") 启动成功 --by " + getNow() + " -------------\n" +
                 "\t- Local:   http://localhost:" + port + path + "\n" +
                 "\t- Local2:  http://127.0.0.1:" + port + path + "\n" +
                 "\t- Network: http://" + ip + ":" + port + path + "\n";
-        System.out.println(str);
+        log.info("启动信息:{}",str);
     }
 
 

+ 13 - 5
sp-server/src/main/java/com/pj/project/tb_account/TbAccountService.java

@@ -43,7 +43,7 @@ public class TbAccountService extends ServiceImpl<TbAccountMapper, TbAccount> im
     @Resource
     TbChargeRecordService tbChargeRecordService;
 
-    TbAccount getByCustomerId(String customerId) {
+    public TbAccount getByCustomerId(String customerId) {
         QueryWrapper<TbAccount> ew = new QueryWrapper<>();
         ew.eq("customer_id", customerId);
         TbAccount account = this.getOne(ew);
@@ -69,16 +69,24 @@ public class TbAccountService extends ServiceImpl<TbAccountMapper, TbAccount> im
 
     public void recharge(String customerId, String money) {
         TbAccount account = this.getByCustomerId(customerId);
-        BigDecimal total = NumberUtil.add(account.getTotalMoney(), money);
-        BigDecimal act = NumberUtil.add(account.getActMoney(), money);
+        recharge(account, TbChargeRecord.Ch.PC.getType(), new BigDecimal(money),new BigDecimal(money));
+    }
+
+    public void recharge(String id,BigDecimal money,String chargeType,BigDecimal payMoney){
+        TbAccount account = this.getById(id);
+        recharge(account, chargeType, money,payMoney);
+    }
+    public void recharge(TbAccount account, String chargeType, BigDecimal money,BigDecimal payMoney) {
+        BigDecimal total = new BigDecimal(Base64.decodeStr(account.getTotalMoney())).add(money);
         account.setTotalMoney(Base64.encode(total.toString()));
-        account.setActMoney(Base64.encode(act.toString()));
         this.updateById(account);
+        String customerId = account.getCustomerId();
         TbChargeRecord record = new TbChargeRecord();
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
-        record.setChargeChannel(TbChargeRecord.Ch.PC.getType()).setMoney(new BigDecimal(money)).setChargePeople(StpUserUtil.getAdmin().getName())
+        record.setChargeChannel(chargeType).setMoney(money).setPayMoney(payMoney)
                 .setCreateTime(new Date()).setNo(DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomNumbers(4))
                 .setCustomerId(customerId).setCustomerName(tbCostomer.getName());
         tbChargeRecordService.save(record);
+
     }
 }

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_charge_record/TbChargeRecord.java

@@ -59,6 +59,10 @@ public class TbChargeRecord extends Model<TbChargeRecord> implements Serializabl
      * 充值金额
      */
     private BigDecimal money;
+    /**
+     * 支付金额
+     */
+    private BigDecimal payMoney;
 
     /**
      * 充值渠道

+ 18 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomer.java

@@ -5,9 +5,11 @@ import java.util.Date;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.AllArgsConstructor;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
+import lombok.Getter;
 import lombok.experimental.Accessors;
 
 /**
@@ -33,6 +35,7 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
 	 * 此模块对应的权限码 
 	 */
 	public static final String PERMISSION_CODE = "tb-costomer";
+	public static final String PARTNER_PERMISSION_CODE = "tb-partner";
 	public static final String PERMISSION_INFO = "tb-costomer-maintain";
 
 	// ---------- 表中字段 ----------
@@ -99,6 +102,21 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
 	 * 结账方式(1=现结,2=月结)[j]
 	 */
 	private int payType;
+	/**
+	 * 类型0、理货员;1、消杀;2、装卸
+	 */
+	private int type;
+
+	@Getter
+	@AllArgsConstructor
+	public static enum CustomerEnum{
+		BUSINESS_TYPE(0,"理货员"),
+		DISINFECT_TYPE(1,"消杀"),
+		TAKE_TYPE(2,"装卸");
+		private int type;
+		private String desc;
+	}
+
 
 
 

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerController.java

@@ -59,6 +59,13 @@ public class TbCostomerController {
 		int line = tbCostomerService.update(t);
 		return AjaxJson.getByLine(line);
 	}
+	/** 改 */
+	@RequestMapping("update/partner")
+	@SaCheckPermission(TbCostomer.PARTNER_PERMISSION_CODE)
+	public AjaxJson updatePartner(TbCostomer t){
+		int line = tbCostomerService.update(t);
+		return AjaxJson.getByLine(line);
+	}
 
 	/** 查 - 根据id */  
 	@RequestMapping("getById")

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.xml

@@ -79,6 +79,8 @@
 			<if test=' this.has("creareTime") '> and creare_time = #{creareTime} </if>
 			<if test=' this.has("judgeStatus") '> and judge_status = #{judgeStatus} </if>
 			<if test=' this.has("judgeTime") '> and judge_time = #{judgeTime} </if>
+			<if test=' this.has("type") '> and type = #{type} </if>
+			<if test=' this.has("partner") '> and type != 0 </if>
 			<if test=' this.has("judgeContent") '> and judge_content = #{judgeContent} </if>
             <if test=' this.has("current") '>
                 <if test=' current != 0 '>and judge_status = #{current}</if>

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java

@@ -115,7 +115,7 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
      */
     int update(TbCostomer t) {
         if (!validateName(t)) {
-            throw new RuntimeException("该企业名称已存在");
+            throw new RuntimeException("名称已存在");
         }
         this.updateById(t);
         return 1;

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_discount/TbDiscountMapper.xml

@@ -69,7 +69,7 @@
 			<when test='sortType == 2'> title desc </when>
 			<when test='sortType == 3'> type desc </when>
 			<when test='sortType == 4'> discount desc </when>
-			<when test='sortType == 5'> money desc </when>
+			<when test='sortType == 5'> money asc </when>
 			<when test='sortType == 6'> status desc </when>
 			<when test='sortType == 7'> create_time desc </when>
 			<otherwise> id desc </otherwise>

+ 36 - 26
sp-server/src/main/java/com/pj/project/tb_discount/TbDiscountService.java

@@ -16,37 +16,47 @@ import org.springframework.transaction.annotation.Transactional;
 
 /**
  * Service: tb_discount -- 折扣管理
- * @author qzy 
+ *
+ * @author qzy
  */
 @Service
 @Transactional
 public class TbDiscountService extends ServiceImpl<TbDiscountMapper, TbDiscount> implements IService<TbDiscount> {
 
-	/** 底层 Mapper 对象 */
-	@Autowired
-	TbDiscountMapper tbDiscountMapper;
+    /**
+     * 底层 Mapper 对象
+     */
+    @Autowired
+    TbDiscountMapper tbDiscountMapper;
+
+    /**
+     * 增
+     */
+    int add(TbDiscount t) {
+        return tbDiscountMapper.add(t);
+    }
+
+    /**
+     * 删
+     */
+    int delete(Long id) {
+        return tbDiscountMapper.delete(id);
+    }
+
+    /**
+     * 改
+     */
+    int update(TbDiscount t) {
+        return tbDiscountMapper.update(t);
+    }
+
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    public List<TbDiscount> getList(SoMap so) {
+        return tbDiscountMapper.getList(so);
+    }
 
-	/** 增 */
-	int add(TbDiscount t){
-		return tbDiscountMapper.add(t);
-	}
-
-	/** 删 */
-	int delete(Long id){
-		return tbDiscountMapper.delete(id);
-	}
-
-	/** 改 */
-	int update(TbDiscount t){
-		return tbDiscountMapper.update(t);
-	}
-
-
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<TbDiscount> getList(SoMap so) {
-		return tbDiscountMapper.getList(so);	
-	}
-	
 
 }