dingxin 6 år sedan
förälder
incheckning
13c11d967c
27 ändrade filer med 887 tillägg och 179 borttagningar
  1. 14
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/perproties/PayNotifyPerproties.java
  2. 17
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/config/BillQuartz.java
  3. 31
    11
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/AliPayController.java
  4. 47
    17
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/WxPayController.java
  5. 18
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaUserLicenseOrderMapper.java
  6. 3
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpBillInvoice.java
  7. 3
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpBillOrder.java
  8. 2
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/AliPayServiceI.java
  9. 7
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserLicenseService.java
  10. 25
    5
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/WxPayServiceI.java
  11. 12
    16
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/AliPayServiceImpl.java
  12. 6
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BillServiceImpl.java
  13. 32
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserLicenseServiceImpl.java
  14. 248
    60
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/WxPayServiceImpl.java
  15. 8
    4
      CODE/smart-community/app-api/src/main/resources/application.yml
  16. 7
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  17. 69
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpShopTypeController.java
  18. 6
    1
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShopSetting.java
  19. 6
    1
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShopType.java
  20. 7
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITpShopTypeService.java
  21. 31
    2
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpShopTypeServiceImpl.java
  22. 34
    0
      VUECODE/smart-property-manage/src/api/shopType.js
  23. 14
    0
      VUECODE/smart-property-manage/src/router/index.js
  24. 37
    1
      VUECODE/smart-property-manage/src/store/modules/shopType.js
  25. 11
    45
      VUECODE/smart-property-manage/src/views/shop/shopSetting.vue
  26. 91
    0
      VUECODE/smart-property-manage/src/views/shop/shopSettingAdd.vue
  27. 101
    0
      VUECODE/smart-property-manage/src/views/shop/shopSettingEdit.vue

+ 14
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/perproties/PayNotifyPerproties.java Visa fil

@@ -4,6 +4,8 @@ import lombok.Data;
4 4
 import org.springframework.boot.context.properties.ConfigurationProperties;
5 5
 import org.springframework.stereotype.Component;
6 6
 
7
+import java.math.BigDecimal;
8
+
7 9
 /**
8 10
  * 支付回调地址配置
9 11
  * @author weiximei
@@ -14,13 +16,23 @@ import org.springframework.stereotype.Component;
14 16
 public class PayNotifyPerproties {
15 17
 
16 18
     /**
17
-     * 微信回调
19
+     * 微信回调 物业缴费
18 20
      */
19 21
     private String wxBillNotify;
20 22
 
21 23
     /**
22
-     * 支付宝回调
24
+     * 支付宝回调 物业缴费
23 25
      */
24 26
     private String aliBillNotify;
25 27
 
28
+    /**
29
+     * 微信回调 车缴费
30
+     */
31
+    private String wxCarNotify;
32
+
33
+    /**
34
+     * 支付宝回调 车缴费
35
+     */
36
+    private String aliCarNotify;
37
+
26 38
 }

+ 17
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/config/BillQuartz.java Visa fil

@@ -1,7 +1,9 @@
1 1
 package com.community.huiju.config;
2 2
 
3
+import com.community.huiju.dao.TaUserLicenseOrderMapper;
3 4
 import com.community.huiju.dao.TpBillInvoiceMapper;
4 5
 import com.community.huiju.dao.TpBillOrderMapper;
6
+import com.community.huiju.model.TaUserLicenseOrder;
5 7
 import com.community.huiju.model.TpBillInvoice;
6 8
 import com.community.huiju.model.TpBillOrder;
7 9
 import lombok.extern.slf4j.Slf4j;
@@ -25,9 +27,13 @@ public class BillQuartz {
25 27
     @Autowired
26 28
     private TpBillInvoiceMapper tpBillInvoiceMapper;
27 29
 
30
+    @Autowired
31
+    private TaUserLicenseOrderMapper taUserLicenseOrderMapper;
32
+
28 33
     @Scheduled(cron = "0 0/10 * * * ?")
29 34
     public void billInvoice() {
30 35
         log.info("定时任务,扫描订单,超过 10 分未付款则,关闭订单!");
36
+        // 物业缴费
31 37
         List<TpBillOrder> billOrderList = tpBillOrderMapper.selectCloseOrder();
32 38
         if (!billOrderList.isEmpty()) {
33 39
             // 把缴费单变为未交费
@@ -44,6 +50,17 @@ public class BillQuartz {
44 50
             });
45 51
 
46 52
         }
53
+
54
+        // 车缴费订单
55
+        List<TaUserLicenseOrder> userLicenseOrders = taUserLicenseOrderMapper.selectCloseOrder();
56
+        if (!userLicenseOrders.isEmpty()) {
57
+            userLicenseOrders.forEach(e-> {
58
+                e.setOrderStatus("3");
59
+                taUserLicenseOrderMapper.updateByPrimaryKeySelective(e);
60
+            });
61
+        }
62
+
63
+
47 64
     }
48 65
 
49 66
 }

+ 31
- 11
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/AliPayController.java Visa fil

@@ -19,10 +19,7 @@ import org.slf4j.LoggerFactory;
19 19
 import org.springframework.beans.factory.annotation.Autowired;
20 20
 import org.springframework.beans.factory.annotation.Value;
21 21
 import org.springframework.cloud.context.config.annotation.RefreshScope;
22
-import org.springframework.web.bind.annotation.PathVariable;
23
-import org.springframework.web.bind.annotation.RequestMapping;
24
-import org.springframework.web.bind.annotation.RequestMethod;
25
-import org.springframework.web.bind.annotation.RestController;
22
+import org.springframework.web.bind.annotation.*;
26 23
 
27 24
 import javax.servlet.http.HttpServletRequest;
28 25
 import javax.servlet.http.HttpServletResponse;
@@ -57,15 +54,17 @@ public class AliPayController {
57 54
 	private String ALIPAY_PUBLIC_KEY;
58 55
 	
59 56
 	@ApiOperation(value = "统一下单", notes = "统一下单")
60
-	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "billInvoiceId", value = "账单Id"),
57
+	@ApiImplicitParams({
58
+			@ApiImplicitParam(paramType = "path", dataType = "String", name = "outTradeNo", value = "订单号"),
59
+			@ApiImplicitParam(paramType = "form", dataType = "String", name = "type", value = "订单类型:type: 类型(car 车缴费, bill 物业缴费)"),
61 60
 			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token") })
62 61
 	@RequestMapping(value = "/aliPayOrder/{outTradeNo}",method = RequestMethod.GET)
63
-	public ResponseBean wxUnifiedOrder(@PathVariable("outTradeNo") String outTradeNo, HttpSession session){
62
+	public ResponseBean wxUnifiedOrder(@PathVariable("outTradeNo") String outTradeNo, @RequestParam("type") String type, HttpSession session){
64 63
 		ResponseBean responseBean = new ResponseBean();
65 64
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
66 65
 		String resp = "";
67 66
 		try {
68
-			resp = aliPayService.AliPayOrder(outTradeNo,userElement);
67
+			resp = aliPayService.AliPayOrder(outTradeNo, type,userElement);
69 68
 		} catch (Exception e) {
70 69
 			e.printStackTrace();
71 70
 			responseBean.addError(e.getMessage());
@@ -75,9 +74,24 @@ public class AliPayController {
75 74
 		return responseBean;
76 75
 	}
77 76
 	
78
-	@ApiOperation(value = "支付宝手机订单支付完成后回调", notes = "支付宝手机订单支付完成后回调")
79
-	@RequestMapping(value = "/aliPayNotify",method = RequestMethod.POST)
80
-	public void aliPayNotify(HttpServletRequest request, HttpServletResponse response){
77
+	@ApiOperation(value = "支付宝手机订单支付完成后回调 物业缴费", notes = "支付宝手机订单支付完成后回调")
78
+	@RequestMapping(value = "/aliPayBillNotify",method = RequestMethod.POST)
79
+	public void aliPayBillNotify(HttpServletRequest request, HttpServletResponse response){
80
+		wxNotify(request, Constant.PAY_TYPE_BILL);
81
+	}
82
+
83
+	@ApiOperation(value = "支付宝手机订单支付完成后回调 车缴费", notes = "支付宝手机订单支付完成后回调 车缴费")
84
+	@RequestMapping(value = "/aliPayCarNotify",method = RequestMethod.POST)
85
+	public void aliPayCarNotify(HttpServletRequest request, HttpServletResponse response){
86
+		wxNotify(request, Constant.PAY_TYPE_CAR);
87
+	}
88
+
89
+	/**
90
+	 * 支付回调
91
+	 * @param request
92
+	 * @param type
93
+	 */
94
+	private void wxNotify(HttpServletRequest request, String type) {
81 95
 		System.out.println("alipay result  start =======");
82 96
 		Map<String,String> params = new HashMap<String,String>();
83 97
 		Map requestParams = request.getParameterMap();
@@ -98,7 +112,12 @@ public class AliPayController {
98 112
 			boolean flag = AlipaySignature.rsaCheckV1(params, ALIPAY_PUBLIC_KEY, CHARSET_UTF8,"RSA2");
99 113
 			if (flag){
100 114
 				params.put("pay_type","2");
101
-				wxPayService.wxNotify(params);
115
+				if (Constant.PAY_TYPE_BILL.equals(type)) {
116
+					wxPayService.wxBillNotify(params);
117
+				} else if (Constant.PAY_TYPE_CAR.equals(type)){
118
+					wxPayService.wxCarNotify(params);
119
+				}
120
+
102 121
 			}
103 122
 		} catch (AlipayApiException e) {
104 123
 			e.printStackTrace();
@@ -106,4 +125,5 @@ public class AliPayController {
106 125
 			e.printStackTrace();
107 126
 		}
108 127
 	}
128
+
109 129
 }

+ 47
- 17
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/WxPayController.java Visa fil

@@ -70,14 +70,32 @@ public class WxPayController {
70 70
 		return responseBean;
71 71
 	}
72 72
 	
73
-	@ApiOperation(value = "手机订单支付完成后回调", notes = "手机订单支付完成后回调")
74
-	@RequestMapping(value = "/wxNotify",method = RequestMethod.POST)
75
-	public String wxNotify(HttpServletRequest request, HttpServletResponse response){
73
+	@ApiOperation(value = "手机订单支付完成后回调 物业缴费", notes = "手机订单支付完成后回调 物业缴费")
74
+	@RequestMapping(value = "/wxBillNotify",method = RequestMethod.POST)
75
+	public String wxBillNotify(HttpServletRequest request, HttpServletResponse response){
76
+		return wxNotify(request, Constant.PAY_TYPE_BILL);
77
+	}
78
+
79
+
80
+	@ApiOperation(value = "手机订单支付完成后回调 车缴费", notes = "手机订单支付完成后回调 车缴费")
81
+	@RequestMapping(value = "/wxCarNotify",method = RequestMethod.POST)
82
+	public String wxCarNotify(HttpServletRequest request, HttpServletResponse response){
83
+
84
+		return wxNotify(request, Constant.PAY_TYPE_CAR);
85
+	}
86
+
87
+	/**
88
+	 * 微信支付回调
89
+	 * @param request
90
+	 * @param type
91
+	 * @return
92
+	 */
93
+	private String wxNotify(HttpServletRequest request, String type) {
76 94
 		String failResult = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>" + "<return_msg><![CDATA[失败]]></return_msg>" + "</xml> ";
77 95
 		String successResult = "<xml>" + "<return_code><![CDATA[SUCCESS]]></return_code>" + "<return_msg><![CDATA[OK]]></return_msg>" + "</xml> ";
78 96
 		InputStream inStream;
79 97
 		try {
80
-			
98
+
81 99
 			inStream = request.getInputStream();
82 100
 			ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
83 101
 			byte[] buffer = new byte[1024];
@@ -85,21 +103,27 @@ public class WxPayController {
85 103
 			while ((len = inStream.read(buffer)) != -1) {
86 104
 				outSteam.write(buffer, 0, len);
87 105
 			}
88
-			
106
+
89 107
 			// 获取微信调用我们notify_url的返回信息
90 108
 			String result = new String(outSteam.toByteArray(), "utf-8");
91 109
 			WXPayUtil.getLogger().info("wxnotify:微信支付----result----=" + result);
92
-			
110
+
93 111
 			// 关闭流
94 112
 			outSteam.close();
95 113
 			inStream.close();
96
-			
114
+
97 115
 			// xml转换为map
98 116
 			Map<String, String> resultMap = WXPayUtil.xmlToMap(result);
99 117
 			if (WXPayConstants.SUCCESS.equalsIgnoreCase(resultMap.get("result_code"))) {
100 118
 				//处理业务逻辑 修改订单状态等
101 119
 				resultMap.put("pay_type","0");
102
-				String state = wxPayService.wxNotify(resultMap);
120
+				String state = "";
121
+				if (Constant.PAY_TYPE_CAR.equals(type)) {
122
+					state = wxPayService.wxCarNotify(resultMap);
123
+				} else if (Constant.PAY_TYPE_BILL.equals(type)) {
124
+					state = wxPayService.wxBillNotify(resultMap);
125
+				}
126
+
103 127
 				if (state.equals("success")){
104 128
 					log.info("微信支付成功。。");
105 129
 					return successResult;
@@ -107,14 +131,16 @@ public class WxPayController {
107 131
 			}else{
108 132
 				return failResult;
109 133
 			}
110
-			
134
+
111 135
 		} catch (Exception e) {
112 136
 			log.error("手机支付回调通知失败",e);
113 137
 			return failResult;
114
-			
138
+
115 139
 		}
140
+
116 141
 		return failResult;
117 142
 	}
143
+
118 144
 	
119 145
 	@ApiOperation(value = "订单查询", notes = "订单查询")
120 146
 	@ApiImplicitParams({
@@ -137,17 +163,20 @@ public class WxPayController {
137 163
 	
138 164
 	@ApiOperation(value = "准备开始支付", notes = "准备开始支付")
139 165
 	@ApiImplicitParams({
140
-			@ApiImplicitParam(paramType = "body", dataType = "Integer", name = "billInvoiceIdList", value = "账单Id集合"),
166
+			@ApiImplicitParam(paramType = "body", dataType = "String", name = "parameter", value = "idArray:账单Id集合, type: 类型(car 车缴费, bill 物业缴费), extensionMonth: 延期月份,也就是延期几个月!只有在 车缴费的时候才有效"),
141 167
 			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
142 168
 	})
143 169
 	@RequestMapping(value = "/wxStartPay",method = RequestMethod.POST)
144
-	public ResponseBean wxStartPay(@RequestBody String billInvoiceIdList, HttpSession session){
170
+	public ResponseBean wxStartPay(@RequestBody String parameter, HttpSession session){
145 171
 		ResponseBean responseBean = new ResponseBean();
146 172
 		try {
147 173
 			UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
148
-			 Integer[] integers = JSONObject.parseArray(billInvoiceIdList).toArray(new Integer[]{});
174
+			JSONObject jsonObject = JSONObject.parseObject(parameter);
175
+			Integer[] integers = jsonObject.getJSONArray("idArray").toArray(new Integer[]{});
176
+			String type = jsonObject.getString("type");
177
+			Integer extensionMonth = jsonObject.getInteger("extensionMonth");
149 178
 
150
-			String outTradeNo = wxPayService.wxStartPay( Arrays.asList(integers), userElement);
179
+			String outTradeNo = wxPayService.wxStartPay(Arrays.asList(integers), type, extensionMonth,userElement);
151 180
 			Map<String,Object> resultMap = Maps.newHashMap();
152 181
 			resultMap.put("outTradeNo", outTradeNo);
153 182
 			responseBean.addSuccess(resultMap);
@@ -161,15 +190,16 @@ public class WxPayController {
161 190
 	
162 191
 	@ApiOperation(value = "取消支付", notes = "取消支付")
163 192
 	@ApiImplicitParams({
164
-			@ApiImplicitParam(paramType = "path", dataType = "Integer", name = "outTradeNo", value = "订单号"),
193
+			@ApiImplicitParam(paramType = "path", dataType = "String", name = "outTradeNo", value = "订单号"),
194
+			@ApiImplicitParam(paramType = "form", dataType = "String", name = "outTradeNo", value = "type: 类型(car 车缴费, bill 物业缴费)"),
165 195
 			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
166 196
 	})
167 197
 	@RequestMapping(value = "/wxCancelPay/{outTradeNo}",method = RequestMethod.POST)
168
-	public ResponseBean wxCancelPay(@PathVariable("outTradeNo") String outTradeNo, HttpSession session){
198
+	public ResponseBean wxCancelPay(@PathVariable("outTradeNo") String outTradeNo, @RequestParam("type") String type,HttpSession session){
169 199
 		ResponseBean responseBean = new ResponseBean();
170 200
 		try {
171 201
 			UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
172
-			wxPayService.wxCancelPay(outTradeNo,userElement);
202
+			wxPayService.wxCancelPay(outTradeNo, type,userElement);
173 203
 		} catch (Exception e) {
174 204
 			e.printStackTrace();
175 205
 			responseBean.addError(e.getMessage());

+ 18
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaUserLicenseOrderMapper.java Visa fil

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TaUserLicenseOrder;
4
+import com.community.huiju.model.TpBillOrder;
4 5
 import org.apache.ibatis.annotations.Mapper;
5 6
 import org.apache.ibatis.annotations.Param;
6 7
 import org.apache.ibatis.annotations.ResultMap;
@@ -29,4 +30,21 @@ public interface TaUserLicenseOrderMapper {
29 30
     @ResultMap("BaseResultMap")
30 31
     @Select("select * from ta_user_license_order where community_id = #{communityId} and ta_user_id = #{userId} and order_status = 1")
31 32
     List<TaUserLicenseOrder> selectRecords(@Param("communityId") Integer communityId, @Param("userId") Integer userId);
33
+
34
+    /**
35
+     * 根据订单号查询
36
+     * @param orderNo
37
+     * @return
38
+     */
39
+    @ResultMap("BaseResultMap")
40
+    @Select("select * from ta_user_license_order where order_number=#{orderNo}")
41
+    List<TaUserLicenseOrder> selectByOrderNumber(String orderNo);
42
+
43
+    /**
44
+     * 可关闭的订单
45
+     * @return
46
+     */
47
+    @ResultMap("BaseResultMap")
48
+    @Select("SELECT t.* from ta_user_license_order t where TIMESTAMPDIFF(MINUTE,create_date,now()) >= 10 and t.order_status in (0,2)")
49
+    List<TaUserLicenseOrder> selectCloseOrder();
32 50
 }

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpBillInvoice.java Visa fil

@@ -47,7 +47,7 @@ public class TpBillInvoice {
47 47
     /**
48 48
      * 转换后金额,用于支付
49 49
      */
50
-    private String sumPayPrice;
50
+    private Double sumPayPrice;
51 51
 
52 52
     public Integer getId() {
53 53
         return id;
@@ -193,11 +193,11 @@ public class TpBillInvoice {
193 193
         this.payType = payType;
194 194
     }
195 195
 
196
-    public String getSumPayPrice() {
196
+    public Double getSumPayPrice() {
197 197
         return sumPayPrice;
198 198
     }
199 199
 
200
-    public void setSumPayPrice(String sumPayPrice) {
200
+    public void setSumPayPrice(Double sumPayPrice) {
201 201
         this.sumPayPrice = sumPayPrice;
202 202
     }
203 203
 }

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpBillOrder.java Visa fil

@@ -35,7 +35,7 @@ public class TpBillOrder {
35 35
     /**
36 36
      * 订单总额
37 37
      */
38
-    private String sumPrice;
38
+    private Double sumPrice;
39 39
 
40 40
     /**
41 41
      * 缴费单集合
@@ -138,11 +138,11 @@ public class TpBillOrder {
138 138
         this.billList = billList;
139 139
     }
140 140
 
141
-    public String getSumPrice() {
141
+    public Double getSumPrice() {
142 142
         return sumPrice;
143 143
     }
144 144
 
145
-    public void setSumPrice(String sumPrice) {
145
+    public void setSumPrice(Double sumPrice) {
146 146
         this.sumPrice = sumPrice;
147 147
     }
148 148
 }

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/AliPayServiceI.java Visa fil

@@ -9,8 +9,9 @@ public interface AliPayServiceI {
9 9
 	 * 微信支付统一下单
10 10
 	 * @return
11 11
 	 * @param outTradeNo
12
+	 * @param type  类型(car 车缴费, bill 物业缴费)
12 13
 	 * @param userElement
13 14
 	 */
14
-	String AliPayOrder(String outTradeNo, UserElement userElement) throws Exception;
15
+	String AliPayOrder(String outTradeNo, String type, UserElement userElement) throws Exception;
15 16
 	
16 17
 }

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserLicenseService.java Visa fil

@@ -16,6 +16,13 @@ public interface ITaUserLicenseService {
16 16
      */
17 17
     ResponseBean associatedLicense(UserElement userElement, String carNo);
18 18
 
19
+    /**
20
+     * 用户查询车牌
21
+     * @param carNo
22
+     * @return
23
+     */
24
+    ResponseBean getLicense(UserElement userElement, String carNo);
25
+
19 26
     /**
20 27
      * 获取用户所有车牌
21 28
      * @param userElement

+ 25
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/WxPayServiceI.java Visa fil

@@ -16,11 +16,11 @@ public interface WxPayServiceI {
16 16
 	Map<String, String> wxUnifiedOrder(String outTradeNo, String type, UserElement userElement) throws Exception;
17 17
 	
18 18
 	/**
19
-	 * 支付成功的回调
19
+	 * 支付成功的回调 物业缴费
20 20
 	 * @return
21 21
 	 * @param resultMap
22 22
 	 */
23
-	String wxNotify(Map<String, String> resultMap) throws Exception;
23
+	String wxBillNotify(Map<String, String> resultMap) throws Exception;
24 24
 	
25 25
 	/**
26 26
 	 * 订单查询
@@ -30,16 +30,36 @@ public interface WxPayServiceI {
30 30
 	
31 31
 	/**
32 32
 	 * 准备支付
33
-	 * @param billInvoiceIdArray
33
+	 * @param idArray 账单的id
34 34
 	 * @param userElement
35
+	 * @param type 订单类型  car 车缴费 , bill 物业缴费
36
+	 * @param extensionMonth 延期月份,也就是延期几个月!
37
+	 *                        	只有在 车缴费的时候才有效
35 38
 	 * @throws Exception
36 39
 	 */
37
-	String wxStartPay(List<Integer> billInvoiceIdArray, UserElement userElement) throws Exception;
40
+	String wxStartPay(List<Integer> idArray, String type,  Integer extensionMonth, UserElement userElement) throws Exception;
38 41
 	
39 42
 	/**
40 43
 	 * 取消支付
41 44
 	 * @param outTradeNo 订单号
45
+	 * @param type  订单类型  car 车缴费 , bill 物业缴费
42 46
 	 * @param userElement
43 47
 	 */
44
-	void wxCancelPay(String outTradeNo, UserElement userElement) throws Exception;
48
+	void wxCancelPay(String outTradeNo, String type, UserElement userElement) throws Exception;
49
+
50
+	/**
51
+	 * 支付成功的回调 车缴费
52
+	 * @param resultMap
53
+	 * @return
54
+	 */
55
+	String wxCarNotify(Map<String, String> resultMap);
56
+
57
+	/**
58
+	 * 根据订单类型获取 金额 和 回调地址
59
+	 * @param type
60
+	 * @param orderNo
61
+	 * @return
62
+	 * @throws Exception
63
+	 */
64
+	Map<String,Object> getOrderPriceAndNotifyUrl(String type, String orderNo) throws Exception;
45 65
 }

+ 12
- 16
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/AliPayServiceImpl.java Visa fil

@@ -6,6 +6,7 @@ import com.alipay.api.DefaultAlipayClient;
6 6
 import com.alipay.api.domain.AlipayTradeAppPayModel;
7 7
 import com.alipay.api.request.AlipayTradeAppPayRequest;
8 8
 import com.alipay.api.response.AlipayTradeAppPayResponse;
9
+import com.community.commom.constant.Constant;
9 10
 import com.community.commom.session.UserElement;
10 11
 import com.community.huiju.common.perproties.PayNotifyPerproties;
11 12
 import com.community.huiju.common.wxpay.HfWxConfig;
@@ -18,6 +19,7 @@ import com.community.huiju.model.TaUser;
18 19
 import com.community.huiju.model.TpBillInvoice;
19 20
 import com.community.huiju.model.TpBillOrder;
20 21
 import com.community.huiju.service.AliPayServiceI;
22
+import com.community.huiju.service.WxPayServiceI;
21 23
 import org.apache.commons.collections.CollectionUtils;
22 24
 import org.slf4j.Logger;
23 25
 import org.slf4j.LoggerFactory;
@@ -28,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
28 30
 
29 31
 import java.math.BigDecimal;
30 32
 import java.util.List;
33
+import java.util.Map;
31 34
 
32 35
 import static com.alipay.api.AlipayConstants.CHARSET_UTF8;
33 36
 
@@ -68,7 +71,8 @@ public class AliPayServiceImpl implements AliPayServiceI {
68 71
 	private String ALIPAY_PUBLIC_KEY;
69 72
 
70 73
 	@Autowired
71
-	private PayNotifyPerproties payNotifyPerproties;
74
+	private WxPayServiceI wxPayServiceI;
75
+
72 76
 
73 77
 	/**
74 78
 	 * 支付宝统一下单
@@ -79,18 +83,10 @@ public class AliPayServiceImpl implements AliPayServiceI {
79 83
 	 */
80 84
 	@Override
81 85
 	@Transactional(rollbackFor = Exception.class)
82
-	public String AliPayOrder(String outTradeNo, UserElement userElement) throws Exception {
83
-		Integer userId = userElement.getId();
84
-
85
-		//获取支付金额
86
-		List<TpBillOrder> billOrderList = tpBillOrderMapper.selectByOrderBumber(outTradeNo);
87
-		if (CollectionUtils.isEmpty(billOrderList)){
88
-			throw new Exception("订单不存在");
89
-		}
90
-
91
-		// 计算金额
92
-		Integer payPrice = billOrderList.stream().mapToInt(e -> tpBillInvoiceMapper.selectByPrimaryKey(e.getTpBillInvoiceId()).getPayPrice()).sum();
86
+	public String AliPayOrder(String outTradeNo, String type, UserElement userElement) throws Exception {
93 87
 
88
+		String typeName = Constant.PAY_TYPE_BILL.equals(type) ? "物业缴费" : Constant.PAY_TYPE_CAR.equals(type) ? "车缴费" : "缴费";
89
+		Map<String, Object> orderPriceAndNotifyUrl = wxPayServiceI.getOrderPriceAndNotifyUrl(type, outTradeNo);
94 90
 		
95 91
 		//下单
96 92
 		AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", ALI_APP_ID, APP_PRIVATE_KEY, "json", CHARSET_UTF8, ALIPAY_PUBLIC_KEY, "RSA2");
@@ -98,14 +94,14 @@ public class AliPayServiceImpl implements AliPayServiceI {
98 94
 		AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
99 95
 		//SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
100 96
 		AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
101
-		model.setBody("缴费");
102
-		model.setSubject("缴费");
97
+		model.setBody(typeName);
98
+		model.setSubject(typeName);
103 99
 		model.setOutTradeNo(outTradeNo);
104 100
 		model.setTimeoutExpress("30m");
105
-		model.setTotalAmount(BigDecimal.valueOf(Long.valueOf(payPrice)).divide(new BigDecimal(100)).toString());
101
+		model.setTotalAmount(BigDecimal.valueOf(Long.valueOf(String.valueOf(orderPriceAndNotifyUrl.get("payPrice")))).divide(new BigDecimal(100)).toString());
106 102
 		model.setProductCode("QUICK_MSECURITY_PAY");
107 103
 		request.setBizModel(model);
108
-		request.setNotifyUrl(payNotifyPerproties.getAliBillNotify());
104
+		request.setNotifyUrl(String.valueOf(orderPriceAndNotifyUrl.get("notifyUrl")));
109 105
 		try {
110 106
 			//这里和普通的接口调用不同,使用的是sdkExecute
111 107
 			AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);

+ 6
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BillServiceImpl.java Visa fil

@@ -71,7 +71,7 @@ public class BillServiceImpl implements BillServiceI {
71 71
 		List<Map<String,Object>> billsList = tpBillInvoiceMapper.getBillsList(userElement.getCommunityId(), userElement.getRoomNoId(), payType);
72 72
 		billsList.forEach(e-> {
73 73
 			String payPrice = String.valueOf(e.get("payPrice"));
74
-			String payPriceDouble = BigDecimal.valueOf(Long.valueOf(payPrice)).divide(new BigDecimal(100)).toString();
74
+			Double payPriceDouble = Double.valueOf(payPrice) / 100;
75 75
 			e.put("payPrice", payPriceDouble);
76 76
 		});
77 77
 		Map<String,Object> result = Maps.newHashMap();
@@ -89,7 +89,7 @@ public class BillServiceImpl implements BillServiceI {
89 89
 	public Map<String, Object> getBillInvoiceDetail(Integer communityId,Integer billInvoiceId) {
90 90
 		Map<String, Object> billInvoiceDetail = tpBillInvoiceMapper.getBillInvoiceDetail(communityId, billInvoiceId);
91 91
 		String payPrice = String.valueOf(billInvoiceDetail.get("payPrice"));
92
-		String payPriceDouble = BigDecimal.valueOf(Long.valueOf(payPrice)).divide(new BigDecimal(100)).toString();
92
+		Double payPriceDouble = Double.valueOf(payPrice) / 100;
93 93
 		billInvoiceDetail.put("payPrice", payPriceDouble);
94 94
 		return billInvoiceDetail;
95 95
 	}
@@ -110,10 +110,10 @@ public class BillServiceImpl implements BillServiceI {
110 110
 
111 111
 			// 缴费组
112 112
 			List<TpBillInvoice> tpBillInvoices = orderList.stream().map(billOrder -> tpBillInvoiceMapper.selectByIdBillInvoiceInfo(billOrder.getTpBillInvoiceId())).collect(Collectors.toList());
113
-			tpBillInvoices.forEach( billInvoice -> billInvoice.setSumPayPrice(BigDecimal.valueOf(Long.valueOf(billInvoice.getPayPrice())).divide(new BigDecimal(100)).toString()));
113
+			tpBillInvoices.forEach( billInvoice -> billInvoice.setSumPayPrice(Double.valueOf(billInvoice.getPayPrice() + "") / 100));
114 114
 
115 115
 			// 所有缴费组的总额
116
-			String billCountPrice = BigDecimal.valueOf(Long.valueOf(tpBillInvoices.stream().map(billCount -> billCount.getPayPrice()).count())).divide(new BigDecimal(100)).toString();
116
+			Double billCountPrice = Double.valueOf(tpBillInvoices.stream().map(billCount -> billCount.getPayPrice()).count() + "") / 100;
117 117
 
118 118
 
119 119
 			e.setBillList(tpBillInvoices);
@@ -143,10 +143,10 @@ public class BillServiceImpl implements BillServiceI {
143 143
 		}
144 144
 		// 每个缴费单数据
145 145
 		List<TpBillInvoice> tpBillInvoices = billOrderList.stream().map(e -> tpBillInvoiceMapper.selectByIdBillInvoiceInfo(e.getTpBillInvoiceId())).collect(Collectors.toList());
146
-		tpBillInvoices.forEach(e -> e.setSumPayPrice(BigDecimal.valueOf(Long.valueOf(e.getPayPrice())).divide(new BigDecimal(100)).toString()));
146
+		tpBillInvoices.forEach(e -> e.setSumPayPrice(Double.valueOf(e.getPayPrice() + "") / 100));
147 147
 
148 148
 		// 这个订单总额
149
-		String billCountPrice = BigDecimal.valueOf(Long.valueOf(tpBillInvoices.stream().map(e -> e.getPayPrice()).count())).divide(new BigDecimal(100)).toString();
149
+		Double billCountPrice = Double.valueOf(tpBillInvoices.stream().map(e -> e.getPayPrice()).count() + "") / 100;
150 150
 
151 151
 		// 因为订单号是多条,取第一条即可
152 152
 		TpBillOrder tpBillOrder = billOrderList.get(0);

+ 32
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserLicenseServiceImpl.java Visa fil

@@ -10,6 +10,7 @@ import com.community.huiju.service.ITaUserLicenseService;
10 10
 import lombok.extern.slf4j.Slf4j;
11 11
 import org.springframework.beans.factory.annotation.Autowired;
12 12
 import org.springframework.stereotype.Service;
13
+import org.springframework.transaction.annotation.Transactional;
13 14
 
14 15
 import java.math.BigDecimal;
15 16
 import java.text.ParseException;
@@ -35,6 +36,7 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
35 36
     private IFuShiService iFuShiService;
36 37
 
37 38
     @Override
39
+    @Transactional(rollbackFor = Exception.class)
38 40
     public ResponseBean associatedLicense(UserElement userElement, String carNo) {
39 41
         ResponseBean responseBean = new ResponseBean();
40 42
 
@@ -55,11 +57,14 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
55 57
         if (null == taUserLicense.getId()) {
56 58
             rows = taUserLicenseMapper.insertSelective(taUserLicense);
57 59
         } else {
60
+            taUserLicense.setUpdateUser(userElement.getId());
61
+            taUserLicense.setUpdateDate(new Date());
58 62
             rows = taUserLicenseMapper.updateByPrimaryKeySelective(taUserLicense);
59 63
         }
60 64
 
61 65
 
62 66
         if (rows > 0) {
67
+            taUserLicense.setUnitPrice(String.valueOf(Double.valueOf(taUserLicense.getUnitPrice()) / 100));
63 68
             responseBean.addSuccess(taUserLicense);
64 69
             return responseBean;
65 70
         }
@@ -68,8 +73,24 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
68 73
         return responseBean;
69 74
     }
70 75
 
76
+    @Override
77
+    @Transactional(rollbackFor = Exception.class)
78
+    public ResponseBean getLicense(UserElement userElement, String carNo) {
79
+        ResponseBean responseBean = new ResponseBean();
80
+        TaUserLicense taUserLicense = taUserLicenseMapper.selectByUserIdAndCommunityIdAndLicensePlate(userElement.getCommunityId(), userElement.getId(), carNo);
81
+        if (null != taUserLicense) {
82
+            taUserLicense = getTaUserLicense(carNo, taUserLicense);
83
+            taUserLicense.setUpdateUser(userElement.getId());
84
+            taUserLicense.setUpdateDate(new Date());
85
+            taUserLicenseMapper.updateByPrimaryKeySelective(taUserLicense);
86
+        }
87
+
88
+        responseBean.addSuccess(taUserLicense);
89
+        return responseBean;
90
+    }
71 91
 
72 92
     @Override
93
+    @Transactional(rollbackFor = Exception.class)
73 94
     public ResponseBean getAllUserLicense(UserElement userElement) {
74 95
         ResponseBean responseBean = new ResponseBean();
75 96
         List<TaUserLicense> taUserLicenses = taUserLicenseMapper.selectAllByCommunityIdAndUserId(userElement.getCommunityId(), userElement.getId());
@@ -79,7 +100,10 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
79 100
 
80 101
         taUserLicenses = taUserLicenses.stream().map(e-> {
81 102
             TaUserLicense taUserLicense = getTaUserLicense(e.getLicensePlate(), e);
103
+            taUserLicense.setUpdateUser(userElement.getId());
104
+            taUserLicense.setUpdateDate(new Date());
82 105
             taUserLicenseMapper.updateByPrimaryKeySelective(taUserLicense);
106
+            taUserLicense.setUnitPrice(String.valueOf(Double.valueOf(taUserLicense.getUnitPrice()) / 100));
83 107
             return taUserLicense;
84 108
         }).collect(Collectors.toList());
85 109
 
@@ -105,10 +129,16 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
105 129
 
106 130
         // 获取到的车牌信息
107 131
         Map<String,Object> map = (Map<String,Object>)resultCar;
132
+        Integer dataType = (Integer) map.get("DataType");
133
+        if (dataType.intValue() != 1) {
134
+            throw new WisdomException("该车牌不是月租车!");
135
+        }
136
+
108 137
         Map<String,Object> jsonParam = (Map<String, Object>) map.get("JsonParam");
109 138
 
110 139
         taUserLicense.setLicensePlate(carNo);
111
-        taUserLicense.setUnitPrice(BigDecimal.valueOf(Long.valueOf(String.valueOf(jsonParam.get("Cost")))).multiply(new BigDecimal(100)).toString());
140
+        String price = String.valueOf(Double.valueOf(((BigDecimal) jsonParam.get("Cost")).toString()) * 100);
141
+        taUserLicense.setUnitPrice(price.substring(0, price.lastIndexOf(".")));
112 142
         taUserLicense.setCreateDate(new Date());
113 143
         taUserLicense.setParkingLot(String.valueOf(jsonParam.get("ParkingName")));
114 144
 
@@ -123,6 +153,7 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
123 153
     }
124 154
 
125 155
     @Override
156
+    @Transactional(rollbackFor = Exception.class)
126 157
     public ResponseBean deleteUserLicense(UserElement userElement, Integer licenseId) {
127 158
         ResponseBean responseBean = new ResponseBean();
128 159
 

+ 248
- 60
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/WxPayServiceImpl.java Visa fil

@@ -1,5 +1,7 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
3 5
 import com.community.commom.session.UserElement;
4 6
 import com.community.huiju.common.perproties.PayNotifyPerproties;
5 7
 import com.community.huiju.common.wxpay.HfWxConfig;
@@ -9,17 +11,23 @@ import com.community.huiju.common.wxpay.WXPayUtil;
9 11
 import com.community.huiju.dao.*;
10 12
 import com.community.huiju.exception.WisdomException;
11 13
 import com.community.huiju.model.*;
14
+import com.community.huiju.service.IFuShiService;
15
+import com.community.huiju.service.ITaUserLicenseService;
12 16
 import com.community.huiju.service.WxPayServiceI;
13 17
 import com.google.common.collect.Lists;
14 18
 import com.google.common.collect.Maps;
15 19
 import org.apache.commons.collections.CollectionUtils;
20
+import org.apache.commons.lang.StringUtils;
16 21
 import org.slf4j.Logger;
17 22
 import org.slf4j.LoggerFactory;
18 23
 import org.springframework.beans.factory.annotation.Autowired;
19 24
 import org.springframework.stereotype.Service;
20 25
 import org.springframework.transaction.annotation.Transactional;
21 26
 
27
+import java.math.BigDecimal;
22 28
 import java.time.Instant;
29
+import java.time.LocalDateTime;
30
+import java.time.ZoneId;
23 31
 import java.util.*;
24 32
 import java.util.concurrent.atomic.AtomicReference;
25 33
 import java.util.stream.Collectors;
@@ -63,6 +71,19 @@ public class WxPayServiceImpl implements WxPayServiceI {
63 71
 	@Autowired
64 72
 	private PayNotifyPerproties payNotifyPerproties;
65 73
 
74
+	@Autowired
75
+	private TaUserLicenseOrderMapper taUserLicenseOrderMapper;
76
+
77
+	@Autowired
78
+	private IFuShiService iFuShiService;
79
+
80
+	@Autowired
81
+	private TaUserLicenseMapper taUserLicenseMapper;
82
+
83
+	@Autowired
84
+	private ITaUserLicenseService iTaUserLicenseService;
85
+
86
+
66 87
 	/**
67 88
 	 * 微信支付统一下单
68 89
 	 *
@@ -78,9 +99,11 @@ public class WxPayServiceImpl implements WxPayServiceI {
78 99
 
79 100
 		Map<String, Object> orderPriceAndNotifyUrl = getOrderPriceAndNotifyUrl(type, orderNo);
80 101
 
102
+		String typeName = Constant.PAY_TYPE_BILL.equals(type) ? "物业缴费" : Constant.PAY_TYPE_CAR.equals(type) ? "车缴费" : "缴费";
103
+
81 104
 		//下单
82 105
 		Map<String, String> data = new HashMap<String, String>();
83
-		data.put("body", "缴费");
106
+		data.put("body", typeName);
84 107
 		//商品号唯一
85 108
 		data.put("out_trade_no", orderNo);
86 109
 		data.put("device_info", "");
@@ -111,15 +134,10 @@ public class WxPayServiceImpl implements WxPayServiceI {
111 134
 		secondSignData.put("package", "Sign=WXPay");
112 135
 		secondSignData.put("sign", WXPayUtil.generateSignature(secondSignData, config.getKey(), WXPayConstants.SignType.MD5));
113 136
 
114
-		log.info("订单: {}, 状态变更为正在支付", orderNo);
137
+		log.info("订单: {},订单类型: {}, 状态变更为正在支付", orderNo, type);
115 138
 
116 139
 		// 更改订单状态 为正在支付
117
-		List<TpBillOrder> billOrders = tpBillOrderMapper.selectByOrderBumber(orderNo);
118
-		billOrders.forEach(e-> {
119
-			e.setOrderStatus("3");
120
-			tpBillOrderMapper.updateByPrimaryKeySelective(e);
121
-		});
122
-
140
+		updateOrderStatus(orderNo, type, "2");
123 141
 		return secondSignData;
124 142
 	}
125 143
 
@@ -130,11 +148,12 @@ public class WxPayServiceImpl implements WxPayServiceI {
130 148
 	 * @return
131 149
 	 * @throws Exception
132 150
 	 */
133
-	private Map<String,Object> getOrderPriceAndNotifyUrl(String type, String orderNo) throws Exception {
151
+	@Override
152
+	public Map<String,Object> getOrderPriceAndNotifyUrl(String type, String orderNo) throws Exception {
134 153
 		Map<String,Object> orderMap = Maps.newHashMap();
135 154
 
136 155
 		// 物业缴费
137
-		if ("bill".equals(type)) {
156
+		if (Constant.PAY_TYPE_BILL.equals(type)) {
138 157
 			//获取支付金额
139 158
 			List<TpBillOrder> billOrderList = tpBillOrderMapper.selectByOrderBumber(orderNo);
140 159
 			if (CollectionUtils.isEmpty(billOrderList)){
@@ -147,20 +166,36 @@ public class WxPayServiceImpl implements WxPayServiceI {
147 166
 				}
148 167
 			});
149 168
 			// 计算金额
150
-			Integer payPrice = billOrderList.stream().mapToInt(e -> tpBillInvoiceMapper.selectByPrimaryKey(e.getTpBillInvoiceId()).getPayPrice()).sum();
151
-
169
+			Long payPrice = billOrderList.stream().mapToLong(e -> tpBillInvoiceMapper.selectByPrimaryKey(e.getTpBillInvoiceId()).getPayPrice()).sum();
152 170
 			orderMap.put("orderNo", orderNo);
153 171
 			orderMap.put("payPrice", String.valueOf(payPrice));
154 172
 			orderMap.put("notifyUrl", payNotifyPerproties.getWxBillNotify());
155 173
 
156
-		} else if ("car".equals(type)) {
174
+		} else if (Constant.PAY_TYPE_CAR.equals(type)) { // 车缴费
175
+			List<TaUserLicenseOrder> userLicenseOrders = taUserLicenseOrderMapper.selectByOrderNumber(orderNo);
176
+			if (CollectionUtils.isEmpty(userLicenseOrders)) {
177
+				throw new Exception("订单不存在");
178
+			}
179
+			// 检测订单是否 已关闭
180
+			userLicenseOrders.forEach(e-> {
181
+				if ("3".equals(e.getOrderStatus())) {
182
+					throw new WisdomException("无法支付已关闭的订单!");
183
+				}
184
+			});
157 185
 
186
+			// 总额
187
+			Long payPrice = userLicenseOrders.stream().map(e -> Long.parseLong(e.getExtensionPrice())).count();
188
+			orderMap.put("orderNo", orderNo);
189
+			orderMap.put("payPrice", String.valueOf(payPrice));
190
+			orderMap.put("notifyUrl", payNotifyPerproties.getWxCarNotify());
158 191
 		}
159 192
 
160 193
 		return orderMap;
161 194
 	}
162 195
 
163 196
 
197
+
198
+
164 199
 	/**
165 200
 	 * 支付成功的回调
166 201
 	 *
@@ -169,7 +204,7 @@ public class WxPayServiceImpl implements WxPayServiceI {
169 204
 	 */
170 205
 	@Override
171 206
 	@Transactional(rollbackFor = Exception.class)
172
-	public String wxNotify(Map<String, String> resultMap) throws Exception {
207
+	public String wxBillNotify(Map<String, String> resultMap) throws Exception {
173 208
 		String outTradeNo = resultMap.get("out_trade_no");
174 209
 		List<TpBillOrder> billOrderList = tpBillOrderMapper.selectByOrderBumber(outTradeNo);
175 210
 		if (CollectionUtils.isEmpty(billOrderList)){
@@ -227,14 +262,10 @@ public class WxPayServiceImpl implements WxPayServiceI {
227 262
 //			tpMessageMapper.updateByPrimaryKeySelective(tpMessage);
228 263
 		}
229 264
 
230
-		log.info("订单: {}, 状态变更为支付成功", outTradeNo);
265
+		log.info("订单: {},订单类型: {}, 状态变更为支付成功", outTradeNo, Constant.PAY_TYPE_BILL);
231 266
 
232 267
 		// 更改订单状态 为支付成功
233
-		List<TpBillOrder> billOrders = tpBillOrderMapper.selectByOrderBumber(outTradeNo);
234
-		billOrders.forEach(e-> {
235
-			e.setOrderStatus("1");
236
-			tpBillOrderMapper.updateByPrimaryKeySelective(e);
237
-		});
268
+		updateOrderStatus(outTradeNo, Constant.PAY_TYPE_BILL, "1");
238 269
 
239 270
 		return "success";
240 271
 	}
@@ -256,44 +287,117 @@ public class WxPayServiceImpl implements WxPayServiceI {
256 287
 	
257 288
 	@Override
258 289
 	@Transactional(rollbackFor = Exception.class)
259
-	public String wxStartPay(List<Integer> billInvoiceIdArray, UserElement userElement) throws Exception {
290
+	public String wxStartPay(List<Integer> idArray, String type, Integer extensionMonth, UserElement userElement) throws Exception {
291
+		if (StringUtils.isBlank(type)) {
292
+			throw new WisdomException("type 不能为空!");
293
+		}
260 294
 
261
-		// 如果是家属/租客, 应该用业主的用户id
295
+		// 缴费的用户
262 296
 		TaUser taUser = taUserMapper.selectByPrimaryKey(userElement.getId());
263 297
 
264 298
 		Random random = new Random();
265 299
 		String orderNo = String.valueOf(System.currentTimeMillis()) + random.nextInt();
266 300
 
267
-		//获取支付金额
268
-		for (Integer billInvoiceId : billInvoiceIdArray) {
269
-			TpBillInvoice tpBillInvoice = tpBillInvoiceMapper.selectByPrimaryKey(billInvoiceId);
270
-			if (null == tpBillInvoice){
271
-				throw new Exception("订单不存在");
272
-			}else if (!tpBillInvoice.getBillStatus().equals("0")){
273
-				throw new Exception("正在支付的订单");
301
+		// 创建订单
302
+		createOrder(idArray, type, taUser, userElement, orderNo, extensionMonth, null);
303
+
304
+		return orderNo;
305
+	}
306
+
307
+	/**
308
+	 * 创建订单
309
+	 * @param idArray
310
+	 * @param type
311
+	 * @param taUser
312
+	 * @param userElement
313
+	 * @param orderNo
314
+	 * @param extensionMonth 延期月份,也就是延期几个月!
315
+	 *                       	只有在 车缴费的时候才有效
316
+	 * @param paymentType 缴费方式 1是支付宝 2是微信支付
317
+	 * @throws Exception
318
+	 */
319
+	private void createOrder(List<Integer> idArray, String type, TaUser taUser, UserElement userElement, String orderNo, Integer extensionMonth, String paymentType) throws Exception {
320
+		// 物业缴费
321
+		if (Constant.PAY_TYPE_BILL.equals(type)) {
322
+			//获取支付金额
323
+			for (Integer billInvoiceId : idArray) {
324
+				TpBillInvoice tpBillInvoice = tpBillInvoiceMapper.selectByPrimaryKey(billInvoiceId);
325
+				if (null == tpBillInvoice){
326
+					throw new Exception("订单不存在");
327
+				}else if (!tpBillInvoice.getBillStatus().equals("0")){
328
+					throw new Exception("正在支付的订单");
329
+				}
330
+
331
+				TpBillOrder tpBillOrder = new TpBillOrder();
332
+				tpBillOrder.setCommunityId(userElement.getCommunityId());
333
+				tpBillOrder.setTpBillId(tpBillInvoice.getBillId());
334
+				tpBillOrder.setTpBillInvoiceId(tpBillInvoice.getId());
335
+				tpBillOrder.setCreateDate(new Date());
336
+				tpBillOrder.setCreateUser(userElement.getId());
337
+				tpBillOrder.setUpdateDate(new Date());
338
+				tpBillOrder.setUpdateUser(userElement.getId());
339
+				tpBillOrder.setOrderBumber(orderNo);
340
+				tpBillOrder.setPayPhone(taUser.getLoginName());
341
+				tpBillOrder.setOrderStatus("0");
342
+
343
+				tpBillOrderMapper.insertSelective(tpBillOrder);
344
+
274 345
 			}
346
+			// 修改缴费人, 修改为正在缴费
347
+			updateBillInvoiceBillStatus(idArray, taUser.getUserName(), "2");
275 348
 
276
-			TpBillOrder tpBillOrder = new TpBillOrder();
277
-			tpBillOrder.setCommunityId(userElement.getCommunityId());
278
-			tpBillOrder.setTpBillId(tpBillInvoice.getBillId());
279
-			tpBillOrder.setTpBillInvoiceId(tpBillInvoice.getId());
280
-			tpBillOrder.setCreateDate(new Date());
281
-			tpBillOrder.setCreateUser(userElement.getId());
282
-			tpBillOrder.setUpdateDate(new Date());
283
-			tpBillOrder.setUpdateUser(userElement.getId());
284
-			tpBillOrder.setOrderBumber(orderNo);
285
-			tpBillOrder.setPayPhone(taUser.getLoginName());
286
-			tpBillOrder.setOrderStatus("0");
349
+			// 车缴费
350
+		} else if (Constant.PAY_TYPE_CAR.equals(type)) {
351
+			if (null == extensionMonth && extensionMonth > 0) {
352
+				throw new Exception("延期月份不能为空,并且要大于0!");
353
+			}
287 354
 
288
-			tpBillOrderMapper.insertSelective(tpBillOrder);
355
+			for (Integer clicenseId : idArray) {
356
+				// 根据车牌id,查询车牌
357
+				TaUserLicense taUserLicense = taUserLicenseMapper.selectByPrimaryKey(clicenseId);
358
+				// 获取车牌最新信息
359
+				ResponseBean responseLicense = iTaUserLicenseService.getLicense(userElement, taUserLicense.getLicensePlate());
360
+				Object licenseData = responseLicense.getData();
361
+				if (null != licenseData && licenseData instanceof TaUserLicense) {
362
+					taUserLicense = (TaUserLicense) licenseData;
363
+				}
289 364
 
290
-		}
365
+				TaUserLicenseOrder taUserLicenseOrder = new TaUserLicenseOrder();
366
+				taUserLicenseOrder.setCommunityId(userElement.getCommunityId());
367
+				taUserLicenseOrder.setTaUserId(userElement.getId());
368
+				taUserLicenseOrder.setOrderNumber(orderNo);
369
+				taUserLicenseOrder.setOrderStatus("0");
370
+				taUserLicenseOrder.setCreateDate(new Date());
371
+				taUserLicenseOrder.setCreateUser(userElement.getId());
372
+				taUserLicenseOrder.setExtensionMonth(extensionMonth);
373
+
374
+				// 费用
375
+				String extensionPrice = BigDecimal.valueOf(Double.valueOf(taUserLicense.getUnitPrice()) / 100).multiply(BigDecimal.valueOf(extensionMonth)).toString();
376
+				String price = String.valueOf(Double.valueOf(extensionPrice) * 100);
377
+				taUserLicenseOrder.setExtensionPrice(price.substring(0, price.lastIndexOf(".")));
378
+
379
+				taUserLicenseOrder.setPaymentTel(taUser.getLoginName());
380
+				taUserLicenseOrder.setPaymentName(taUser.getUserName());
381
+				taUserLicenseOrder.setPaymentType(paymentType);
382
+
383
+				// 到期时间 (具体的到期时候,在支付回调里面以车辆管理系统为准)
384
+				LocalDateTime localDateTime = LocalDateTime.ofInstant(taUserLicense.getExpireDate().toInstant(), ZoneId.systemDefault());
385
+				localDateTime.plusMonths(extensionMonth);
386
+				taUserLicenseOrder.setExpireDate(Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()));
387
+				taUserLicenseOrder.setUnitPrice(taUserLicense.getUnitPrice());
388
+				taUserLicenseOrder.setParkingLot(taUserLicense.getParkingLot());
389
+				taUserLicenseOrder.setLicensePlate(taUserLicense.getLicensePlate());
390
+
391
+				// 插入数据
392
+				taUserLicenseOrderMapper.insertSelective(taUserLicenseOrder);
291 393
 
292
-		// 修改缴费人
293
-		 updateBillInvoiceBillStatus(billInvoiceIdArray, taUser.getUserName(), "3");
294
-		return orderNo;
394
+			}
395
+
396
+		}
295 397
 	}
296
-	
398
+
399
+
400
+
297 401
 	/**
298 402
 	 * 取消支付
299 403
 	 *
@@ -302,7 +406,19 @@ public class WxPayServiceImpl implements WxPayServiceI {
302 406
 	 */
303 407
 	@Override
304 408
 	@Transactional(rollbackFor = Exception.class)
305
-	public void wxCancelPay(String outTradeNo, UserElement userElement) throws Exception {
409
+	public void wxCancelPay(String outTradeNo, String type, UserElement userElement) throws Exception {
410
+
411
+		/**
412
+		 * 如果是车缴费订单,就只直接更新 订单状态为关闭
413
+		 */
414
+		// 如果是车缴费
415
+		if (Constant.PAY_TYPE_CAR.equals(type)) {
416
+			// 更改订单状态 为订单已关闭
417
+			updateOrderStatus(outTradeNo, type, "3");
418
+			return;
419
+		}
420
+
421
+		// --------------------------- 物业缴费 --------------------------------
306 422
 
307 423
 		//获取支付金额
308 424
 		List<TpBillOrder> billOrderList = tpBillOrderMapper.selectByOrderBumber(outTradeNo);
@@ -313,7 +429,7 @@ public class WxPayServiceImpl implements WxPayServiceI {
313 429
 		List<TpBillInvoice> billInvoiceList = Lists.newArrayList();
314 430
 		for (TpBillOrder tpBillOrder : billOrderList) {
315 431
 			TpBillInvoice billInvoice = tpBillInvoiceMapper.selectByPrimaryKey(tpBillOrder.getTpBillInvoiceId());
316
-			if (!billInvoice.getBillStatus().equals("3")){
432
+			if (!billInvoice.getBillStatus().equals("2")){
317 433
 				throw new Exception("不是正在支付的订单");
318 434
 			}
319 435
 			billInvoiceList.add(billInvoice);
@@ -324,25 +440,73 @@ public class WxPayServiceImpl implements WxPayServiceI {
324 440
 
325 441
 		//更新为 未支付状态
326 442
 		updateBillInvoiceBillStatus(billInvoiceIdList, "","0");
327
-		log.info("订单: {}, 状态变更为取消支付", outTradeNo);
443
+		log.info("订单: {}, 订单类型: {}, 状态变更为取消支付", outTradeNo, type);
328 444
 
329 445
 		// 更改订单状态 为订单已关闭
330
-		List<TpBillOrder> billOrders = tpBillOrderMapper.selectByOrderBumber(outTradeNo);
331
-		billOrders.forEach(e-> {
332
-			e.setOrderStatus("3");
333
-			tpBillOrderMapper.updateByPrimaryKeySelective(e);
446
+		updateOrderStatus(outTradeNo, type, "3");
447
+
448
+	}
449
+
450
+	@Override
451
+	public String wxCarNotify(Map<String, String> resultMap) {
452
+
453
+		String outTradeNo = resultMap.get("out_trade_no");
454
+		String pay_type = resultMap.get("pay_type");
455
+		String payTypeName = pay_type.equals("0") ? "微信支付" : pay_type.equals("2") ? "支付宝" : "未知";
456
+
457
+		List<TaUserLicenseOrder> userLicenseOrderList = taUserLicenseOrderMapper.selectByOrderNumber(outTradeNo);
458
+		if (CollectionUtils.isEmpty(userLicenseOrderList)){
459
+			return "不存在的订单";
460
+		}
461
+
462
+		log.info("订单:{},订单类型: {} 开始推送到 车辆管理系统 ", outTradeNo, Constant.PAY_TYPE_CAR);
463
+
464
+		TaUserLicenseOrder taUserLicenseOrder = userLicenseOrderList.get(0);
465
+		TaUser taUser = taUserMapper.selectByPrimaryKey(taUserLicenseOrder.getTaUserId());
466
+
467
+		// 推送到车辆管理系统
468
+		iFuShiService.apiThirdPartyMonthCardPay(taUser.getLoginName(), "2",
469
+				String.valueOf(taUserLicenseOrder.getExtensionMonth()),
470
+				payTypeName, taUserLicenseOrder.getLicensePlate(),
471
+				null, String.valueOf(Double.valueOf(taUserLicenseOrder.getExtensionPrice()) / 100));
472
+
473
+
474
+		userLicenseOrderList.forEach(e-> {
475
+			e.setPaymentType(pay_type);
476
+			UserElement userElement = new UserElement();
477
+			userElement.setCommunityId(e.getCommunityId());
478
+			userElement.setId(e.getTaUserId());
479
+			ResponseBean responseLicense = iTaUserLicenseService.getLicense(userElement, e.getLicensePlate());
480
+			Object licenseData = responseLicense.getData();
481
+			TaUserLicense taUserLicense = null;
482
+			if (null != licenseData && licenseData instanceof TaUserLicense) {
483
+				taUserLicense = (TaUserLicense) licenseData;
484
+			}
485
+
486
+			e.setExpireDate(taUserLicense.getExpireDate());
487
+
488
+			taUserLicenseOrderMapper.updateByPrimaryKeySelective(e);
489
+
334 490
 		});
491
+
492
+
493
+		log.info("订单: {},订单类型: {}, 状态变更为支付成功", outTradeNo, Constant.PAY_TYPE_CAR);
494
+
495
+		// 更改订单状态 为支付成功
496
+		updateOrderStatus(outTradeNo, Constant.PAY_TYPE_CAR, "1");
497
+
498
+		return "success";
335 499
 	}
336
-	
500
+
337 501
 	/**
338 502
 	 * 更新支付状态
339 503
 	 * @param billInvoiceIdList
340
-	 * @param billStatus
504
+	 * @param status
341 505
 	 */
342
-	private void updateBillInvoiceBillStatus(List<Integer> billInvoiceIdList, String billStatus) {
506
+	private void updateBillInvoiceBillStatus(List<Integer> billInvoiceIdList, String status) {
343 507
 		billInvoiceIdList.forEach(e -> {
344 508
 			TpBillInvoice tpBillInvoiceUpdate = new TpBillInvoice();
345
-			tpBillInvoiceUpdate.setBillStatus(billStatus);
509
+			tpBillInvoiceUpdate.setBillStatus(status);
346 510
 			tpBillInvoiceUpdate.setId(e);
347 511
 			tpBillInvoiceMapper.updateByPrimaryKeySelective(tpBillInvoiceUpdate);
348 512
 		});
@@ -353,16 +517,40 @@ public class WxPayServiceImpl implements WxPayServiceI {
353 517
 	 * 更新支付状态
354 518
 	 * @param billInvoiceIdList
355 519
 	 * @param userName 缴费人
356
-	 * @param billStatus
520
+	 * @param status
357 521
 	 */
358
-	private void updateBillInvoiceBillStatus(List<Integer> billInvoiceIdList, String userName, String billStatus) {
522
+	private void updateBillInvoiceBillStatus(List<Integer> billInvoiceIdList, String userName, String status) {
359 523
 		billInvoiceIdList.forEach(e -> {
360 524
 			TpBillInvoice tpBillInvoiceUpdate = new TpBillInvoice();
361
-			tpBillInvoiceUpdate.setBillStatus(billStatus);
525
+			tpBillInvoiceUpdate.setBillStatus(status);
362 526
 			tpBillInvoiceUpdate.setId(e);
363 527
 			tpBillInvoiceUpdate.setPayName(userName);
364 528
 			tpBillInvoiceMapper.updateByPrimaryKeySelective(tpBillInvoiceUpdate);
365 529
 		});
530
+	}
366 531
 
532
+	/**
533
+	 * 更改订单状态
534
+	 * @param orderNumber
535
+	 * @param type
536
+	 * @param status
537
+	 */
538
+	private void updateOrderStatus(String orderNumber, String type, String status){
539
+		// 物业缴费
540
+		if (Constant.PAY_TYPE_BILL.equals(type)) {
541
+			List<TpBillOrder> billOrders = tpBillOrderMapper.selectByOrderBumber(orderNumber);
542
+			billOrders.forEach(e-> {
543
+				e.setOrderStatus(status);
544
+				tpBillOrderMapper.updateByPrimaryKeySelective(e);
545
+			});
546
+
547
+			// 车缴费
548
+		} else if (Constant.PAY_TYPE_CAR.equals(type)) {
549
+			List<TaUserLicenseOrder> taUserLicenseOrders = taUserLicenseOrderMapper.selectByOrderNumber(orderNumber);
550
+			taUserLicenseOrders.forEach(e-> {
551
+				e.setOrderStatus(status);
552
+				taUserLicenseOrderMapper.updateByPrimaryKeySelective(e);
553
+			});
554
+		}
367 555
 	}
368 556
 }

+ 8
- 4
CODE/smart-community/app-api/src/main/resources/application.yml Visa fil

@@ -52,10 +52,14 @@ weixin:
52 52
 
53 53
 # 支付回调
54 54
 pay-notify:
55
-  wx-bill-notify: http://106.14.20.193:8086/app-api/wxNotify
56
-  ali-bill-notify: http://106.14.20.193:8086/app-api/aliPayNotify
57
-#  wx-bill-notify: http://ycapi.jcjyhn.com/app-api/wxNotify
58
-#  ali-bill-notify: http://ycapi.jcjyhn.com/app-api/aliPayNotify
55
+  wx-bill-notify: http://106.14.20.193:8086/app-api/wxBillNotify
56
+  ali-bill-notify: http://106.14.20.193:8086/app-api/aliPayBillNotify
57
+  wx-car-notify: http://106.14.20.193:8086/app-api/wxCarNotify
58
+  ali-car-notify: http://106.14.20.193:8086/app-api/aliPayCarNotify
59
+#  wx-bill-notify: http://ycapi.jcjyhn.com/app-api/wxBillNotify
60
+#  ali-bill-notify: http://ycapi.jcjyhn.com/app-api/aliPayBillNotify
61
+#  wx-car-notify: http://ycapi.jcjyhn.com/app-api/wxCarNotify
62
+#  ali-car-notify: http://ycapi.jcjyhn.com/app-api/aliPayCarNotify
59 63
 
60 64
 # 大苏
61 65
 da-su:

+ 7
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Visa fil

@@ -234,4 +234,11 @@ public class Constant {
234 234
 
235 235
     /** 用户待审核 **/
236 236
     public static final String TO_AUDIT = "0";
237
+
238
+    /** 缴费类型 物业 **/
239
+    public static final String PAY_TYPE_BILL = "bill";
240
+
241
+
242
+    /** 缴费类型 车缴费 **/
243
+    public static final String PAY_TYPE_CAR = "car";
237 244
 }

+ 69
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TpShopTypeController.java Visa fil

@@ -13,12 +13,15 @@ import io.swagger.annotations.ApiImplicitParams;
13 13
 import io.swagger.annotations.ApiOperation;
14 14
 import org.springframework.beans.factory.annotation.Autowired;
15 15
 import org.springframework.cloud.context.config.annotation.RefreshScope;
16
+import org.springframework.web.bind.annotation.PathVariable;
17
+import org.springframework.web.bind.annotation.RequestBody;
16 18
 import org.springframework.web.bind.annotation.RequestMapping;
17 19
 import org.springframework.web.bind.annotation.RequestMethod;
18 20
 import org.springframework.web.bind.annotation.RequestParam;
19 21
 import org.springframework.web.bind.annotation.RestController;
20 22
 
21 23
 import javax.servlet.http.HttpSession;
24
+import java.time.LocalDateTime;
22 25
 
23 26
 /**
24 27
  * <p>
@@ -51,4 +54,70 @@ public class TpShopTypeController extends BaseController {
51 54
 		responseBean = shopTypeService.getTypesList(userElement.getCommunityId(),pageNum,pageSize);
52 55
 		return responseBean;
53 56
 	}
57
+	
58
+	@ApiOperation(value = "添加商铺类型", notes = "添加商铺类型")
59
+	@ApiImplicitParams({
60
+			@ApiImplicitParam(paramType = "body", dataType = "TpShopType", name = "shopType", value = "商铺类型"),
61
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
62
+	})
63
+	@RequestMapping(value = "/shop/add/type",method = RequestMethod.POST)
64
+	public ResponseBean saveShopType(@RequestBody TpShopType shopType, HttpSession session){
65
+		ResponseBean responseBean = new ResponseBean();
66
+		UserElement userElement = getUserElement(session);
67
+		shopType.setCommunityId(userElement.getCommunityId());
68
+		shopType.setSource("self");
69
+		shopType.setCreateUser(userElement.getId());
70
+		shopType.setCreateDate(LocalDateTime.now());
71
+		boolean state  = shopTypeService.save(shopType);
72
+		if (state){
73
+			responseBean.addSuccess("添加成功");
74
+		}else{
75
+			responseBean.addError("添加失败");
76
+		}
77
+		return responseBean;
78
+	}
79
+	
80
+	@ApiOperation(value = "获取商铺类型", notes = "获取商铺类型")
81
+	@ApiImplicitParams({
82
+			@ApiImplicitParam(paramType = "path", dataType = "Integer", name = "id", value = "商铺类型Id"),
83
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
84
+	})
85
+	@RequestMapping(value = "/shop/get/type/{id}",method = RequestMethod.GET)
86
+	public ResponseBean getShopType(@PathVariable Integer id, HttpSession session){
87
+		ResponseBean responseBean = new ResponseBean();
88
+		UserElement userElement = getUserElement(session);
89
+		TpShopType tpShopType = shopTypeService.getById(id);
90
+		responseBean.addSuccess(tpShopType);
91
+		return responseBean;
92
+	}
93
+	
94
+	@ApiOperation(value = "更新商铺类型", notes = "更新商铺类型")
95
+	@ApiImplicitParams({
96
+			@ApiImplicitParam(paramType = "body", dataType = "TpShopType", name = "shopType", value = "商铺类型"),
97
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
98
+	})
99
+	@RequestMapping(value = "/shop/update/type",method = RequestMethod.POST)
100
+	public ResponseBean updateShopType(@RequestBody TpShopType shopType, HttpSession session){
101
+		ResponseBean responseBean = new ResponseBean();
102
+		UserElement userElement = getUserElement(session);
103
+		boolean state  = shopTypeService.updateById(shopType);
104
+		if (state){
105
+			responseBean.addSuccess("更新成功");
106
+		}else{
107
+			responseBean.addError("更新失败");
108
+		}
109
+		return responseBean;
110
+	}
111
+	
112
+	@ApiOperation(value = "删除商铺类型", notes = "删除商铺类型")
113
+	@ApiImplicitParams({
114
+			@ApiImplicitParam(paramType = "body", dataType = "String", name = "jsonString", value = "商铺id集合"),
115
+			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
116
+	})
117
+	@RequestMapping(value = "/shop/delete/type",method = RequestMethod.DELETE)
118
+	public ResponseBean deleteShopType(@RequestBody String jsonString, HttpSession session){
119
+		ResponseBean responseBean = new ResponseBean();
120
+		responseBean = shopTypeService.deleteShopType(jsonString);
121
+		return responseBean;
122
+	}
54 123
 }

+ 6
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShopSetting.java Visa fil

@@ -1,5 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
3 5
 import lombok.Data;
4 6
 import lombok.EqualsAndHashCode;
5 7
 import lombok.experimental.Accessors;
@@ -21,7 +23,10 @@ import java.time.LocalDateTime;
21 23
 public class TpShopSetting implements Serializable {
22 24
 
23 25
     private static final long serialVersionUID = 1L;
24
-
26
+    
27
+    @TableId(value = "id", type = IdType.AUTO)
28
+    private Integer id;
29
+    
25 30
     /**
26 31
      * 小区ID
27 32
      */

+ 6
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpShopType.java Visa fil

@@ -1,5 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
3 5
 import lombok.Data;
4 6
 import lombok.EqualsAndHashCode;
5 7
 import lombok.experimental.Accessors;
@@ -21,7 +23,10 @@ import java.time.LocalDateTime;
21 23
 public class TpShopType implements Serializable {
22 24
 
23 25
     private static final long serialVersionUID = 1L;
24
-
26
+    
27
+    @TableId(value = "id", type = IdType.AUTO)
28
+    private Integer id;
29
+    
25 30
     /**
26 31
      * 小区ID
27 32
      */

+ 7
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITpShopTypeService.java Visa fil

@@ -22,4 +22,11 @@ public interface ITpShopTypeService extends IService<TpShopType> {
22 22
 	 * @return
23 23
 	 */
24 24
 	ResponseBean getTypesList(Integer communityId, Integer pageNum, Integer pageSize);
25
+	
26
+	/**
27
+	 * 删除商铺类型
28
+	 * @param jsonString
29
+	 * @return
30
+	 */
31
+	ResponseBean deleteShopType(String jsonString);
25 32
 }

+ 31
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpShopTypeServiceImpl.java Visa fil

@@ -1,5 +1,7 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONArray;
4
+import com.alibaba.fastjson.JSONObject;
3 5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -49,6 +51,8 @@ public class TpShopTypeServiceImpl extends ServiceImpl<TpShopTypeMapper, TpShopT
49 51
 		//获取列表数据
50 52
 		QueryWrapper<TpShopType> queryWrapper = new QueryWrapper<>();
51 53
 		queryWrapper.eq("community_id",communityId);
54
+		queryWrapper.orderByAsc("sort");
55
+		queryWrapper.orderByAsc("create_date");
52 56
 		IPage<TpShopType> myPage = shopTypeMapper.selectPage(page,queryWrapper);
53 57
 		//获取商铺是否app显示
54 58
 		QueryWrapper<TpShopSetting> settingQueryWrapper = new QueryWrapper<>();
@@ -56,11 +60,36 @@ public class TpShopTypeServiceImpl extends ServiceImpl<TpShopTypeMapper, TpShopT
56 60
 		TpShopSetting shopSetting = shopSettingMapper.selectOne(settingQueryWrapper);
57 61
 		Map<String,Object> map = new HashMap<>();
58 62
 		map.put("dataList",myPage.getRecords());
59
-		map.put("pageNum",myPage.getCurrent());
60
-		map.put("pageSize",myPage.getPages());
61 63
 		map.put("total",myPage.getTotal());
62 64
 		map.put("shopSettingValue",null == shopSetting ? false : true);
63 65
 		responseBean.addSuccess(map);
64 66
 		return responseBean;
65 67
 	}
68
+	
69
+	/**
70
+	 * 删除商铺类型
71
+	 *
72
+	 * @param jsonString
73
+	 * @return
74
+	 */
75
+	@Override
76
+	public ResponseBean deleteShopType(String jsonString) {
77
+		ResponseBean responseBean = new ResponseBean();
78
+		StringBuffer message = new StringBuffer();
79
+		message.append("删除成功。");
80
+		JSONObject jsonObject = JSONObject.parseObject(jsonString);
81
+		JSONArray ids = jsonObject.getJSONArray("idArray");
82
+		for (Object id : ids){
83
+			//根据ID查询这个数据是否是系统创建,系统创建的不能删除,非系统创建的能删除
84
+			TpShopType shopType = shopTypeMapper.selectById(id.toString());
85
+			if (shopType.getSource().equals("sys")){
86
+				//系统创建不可删除
87
+				message.append(shopType.getTypeName() + "为系统创建,不可删除。");
88
+			}else{
89
+				shopTypeMapper.deleteById(id.toString());
90
+			}
91
+		}
92
+		responseBean.addSuccess(message.toString());
93
+		return responseBean;
94
+	}
66 95
 }

+ 34
- 0
VUECODE/smart-property-manage/src/api/shopType.js Visa fil

@@ -17,3 +17,37 @@ export function changeShopSetting(shopSettingValue) {
17 17
     }
18 18
   })
19 19
 }
20
+
21
+export function addShopType(listQuery) {
22
+  return request({
23
+    url: '/shop/add/type',
24
+    method: 'post',
25
+    data: listQuery
26
+  })
27
+}
28
+
29
+export function getShopType(id) {
30
+  return request({
31
+    url: '/shop/get/type/' + id,
32
+    method: 'get'
33
+  })
34
+}
35
+
36
+export function updateShopType(listQuery) {
37
+  return request({
38
+    url: '/shop/update/type',
39
+    method: 'post',
40
+    data: listQuery
41
+  })
42
+}
43
+
44
+export function deleteShopType(ids) {
45
+  return request({
46
+    url: '/shop/delete/type',
47
+    method: 'delete',
48
+    data: {
49
+      idArray: ids
50
+    }
51
+  })
52
+}
53
+

+ 14
- 0
VUECODE/smart-property-manage/src/router/index.js Visa fil

@@ -375,6 +375,20 @@ export const constantRouterMap = [
375 375
         name: 'shop-setting',
376 376
         meta: { title: '商铺配置', icon: 'table' }
377 377
       },
378
+      {
379
+        path: '/shop/setting/add',
380
+        component: () => import('@/views/shop/shopSettingAdd'),
381
+        name: 'shopSetting-add',
382
+        hidden: true,
383
+        meta: { title: '添加商铺类型', icon: 'table' }
384
+      },
385
+      {
386
+        path: '/shop/setting/edit',
387
+        component: () => import('@/views/shop/shopSettingEdit'),
388
+        name: 'shopSetting-edit',
389
+        hidden: true,
390
+        meta: { title: '修改商铺类型', icon: 'table' }
391
+      },
378 392
       {
379 393
         path: '/shop/index',
380 394
         component: () => import('@/views/shop/shopIndex'),

+ 37
- 1
VUECODE/smart-property-manage/src/store/modules/shopType.js Visa fil

@@ -1,4 +1,4 @@
1
-import { fetchShopTypeList, changeShopSetting } from '@/api/shopType'
1
+import { fetchShopTypeList, changeShopSetting, addShopType, getShopType, updateShopType, deleteShopType } from '@/api/shopType'
2 2
 
3 3
 const transaction = {
4 4
   namespaced: true,
@@ -29,6 +29,42 @@ const transaction = {
29 29
           reject(error)
30 30
         })
31 31
       })
32
+    },
33
+    AddShopType({ commit }, listQuery) {
34
+      return new Promise((resolve, reject) => {
35
+        addShopType(listQuery).then(response => {
36
+          resolve(response)
37
+        }).catch(error => {
38
+          reject(error)
39
+        })
40
+      })
41
+    },
42
+    GetShopType({ commit }, id) {
43
+      return new Promise((resolve, reject) => {
44
+        getShopType(id).then(response => {
45
+          resolve(response)
46
+        }).catch(error => {
47
+          reject(error)
48
+        })
49
+      })
50
+    },
51
+    UpdateShopType({ commit }, listQuery) {
52
+      return new Promise((resolve, reject) => {
53
+        updateShopType(listQuery).then(response => {
54
+          resolve(response)
55
+        }).catch(error => {
56
+          reject(error)
57
+        })
58
+      })
59
+    },
60
+    DeleteShopType({ commit }, ids) {
61
+      return new Promise((resolve, reject) => {
62
+        deleteShopType(ids).then(response => {
63
+          resolve(response)
64
+        }).catch(error => {
65
+          reject(error)
66
+        })
67
+      })
32 68
     }
33 69
   }
34 70
 }

+ 11
- 45
VUECODE/smart-property-manage/src/views/shop/shopSetting.vue Visa fil

@@ -15,7 +15,7 @@
15 15
     <div class="button">
16 16
       <el-button type="primary" @click="add">添加</el-button>
17 17
       <el-button type="warning" @click="edit">修改</el-button>
18
-      <el-button type="danger" @click="deleteAnnouncement">删除</el-button>
18
+      <el-button type="danger" @click="deleteShopType">删除</el-button>
19 19
     </div>
20 20
     <el-table
21 21
       v-loading="listLoading"
@@ -32,9 +32,6 @@
32 32
       <el-table-column prop="typeName" label="商铺类型" align="center"/>
33 33
       <el-table-column prop="sort" label="权重" align="center"/>
34 34
       <el-table-column prop="createDate" label="发布时间" align="center"><template slot-scope="scope">{{ formatDate(scope.row.createDate) }}</template></el-table-column>
35
-      <el-table-column prop="createUserName" label="发布人" align="center"/>
36
-      <el-table-column prop="updateDate" label="修改时间" align="center" ><template slot-scope="scope">{{ formatDate(scope.row.updateDate) }}</template></el-table-column>
37
-      <el-table-column prop="updateDateName" label="修改人" align="center"/>
38 35
     </el-table>
39 36
     <div class="block">
40 37
       <el-pagination
@@ -93,8 +90,6 @@ export default {
93 90
       this.listLoading = true
94 91
       this.FetchShopTypeList(this.listQuery).then((resData) => {
95 92
         this.shopTypeList = resData.dataList
96
-        this.listQuery.pageNum = resData.pageNum
97
-        this.listQuery.pageSize = resData.pageSize
98 93
         this.total = resData.total
99 94
         this.shopSettingValue = resData.shopSettingValue
100 95
         this.listLoading = false
@@ -130,7 +125,7 @@ export default {
130 125
     },
131 126
     // 添加公告
132 127
     add() {
133
-      this.$router.push({ name: 'announcement-add' })
128
+      this.$router.push({ name: 'shopSetting-add' })
134 129
     },
135 130
     edit(){// 编辑公告
136 131
       const ids = this.deleteIds
@@ -144,52 +139,23 @@ export default {
144 139
       }
145 140
        let ide= this.deleteIds[0]
146 141
        this.listQuery.id = ide
147
-      this.$store.dispatch('AnnouncementById', this.listQuery).then((res) => {
148
-        const resData = res.data
149
-        const announcement = resData.tpAnnouncement
150
-        const imgList = resData.studentList
151
-        this.listQuery = announcement
152
-        this.listQuery.announcementTitle = ''
153
-        console.log("1",this.listQuery.status)
154
-        if(this.listQuery.status == 0){
155
-          this.$message.error('已作废不可以修改')
156
-          return
157
-        } 
158
-       this.$router.push({ name: 'announcement-edit', query: { id: ide }})
159
-      }) 
160
-      },
161
-    deleteAnnouncement(){
162
-       let ide= this.deleteIds[0]
163
-       this.listQuery.id = ide 
164
-      this.$store.dispatch('AnnouncementById', this.listQuery).then((res) => {
165
-        const resData = res.data
166
-        const announcement = resData.tpAnnouncement
167
-        const imgList = resData.studentList
168
-        this.listQuery.status= announcement.status
169
-        console.log("1",this.listQuery.status)
170
-        if(this.listQuery.status == 0){
171
-          this.$message.error('已作废不可以作废')
172
-          return
173
-        }
174
-        this.deleteId()     
175
-      })    
142
+       this.$router.push({ name: 'shopSetting-edit', query: { id: ide }})
176 143
     },
177
-
178
-    deleteId(){
179
-       const ids = this.deleteIds
144
+    deleteShopType(){
145
+      const ids = this.deleteIds
180 146
       this.listLoading = true
181
-      console.log(ids)
182
-      this.$store.dispatch('DeleteAnnouncement', ids).then((res) => {
147
+      this.$store.dispatch('shopType/DeleteShopType', ids).then((res) => {
183 148
         this.listLoading = false
184
-        this.listQuery.announcementTitle = ''
149
+        this.$message({
150
+          message: res.message,
151
+          type: 'success'
152
+        })
185 153
         this.dataQuery()
186 154
       }).catch(() => {
187 155
         this.listLoading = false
188
-        console.log('error DeleteAnnouncement')
156
+        console.log('error DeleteShopType')
189 157
       })
190 158
     },
191
-
192
-
193 159
     clickTitle(id) {
194 160
       this.$router.push({ name: 'contentParticulars-details', query: { id: id }})
195 161
     },

+ 91
- 0
VUECODE/smart-property-manage/src/views/shop/shopSettingAdd.vue Visa fil

@@ -0,0 +1,91 @@
1
+<template>
2
+  <div class="root">
3
+    <el-form ref="ruleForm" :model="listQuery" :rules="rules" label-width="100px" class="add-ruleForm">
4
+      <el-form-item label="商铺类型" prop="typeName">
5
+        <el-input v-model="listQuery.typeName" style="width: 200px;"/>
6
+      </el-form-item>
7
+      <el-form-item label="权重" prop="sort">
8
+        <el-input v-model="listQuery.sort" style="width: 200px;"/>
9
+      </el-form-item>
10
+      <el-form-item>
11
+        <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
12
+        <el-button @click="resetForm('ruleForm')">重置</el-button>
13
+      </el-form-item>
14
+    </el-form>
15
+  </div>
16
+</template>
17
+
18
+<script>
19
+export default {
20
+  data() {
21
+    return {
22
+      listQuery: {
23
+        typeName: '',
24
+        sort: ''
25
+      },
26
+      rules: {
27
+        typeName: [
28
+          { required: true, message: '请输入商铺类型', trigger: 'blur' }
29
+        ]
30
+      }
31
+    }
32
+  },
33
+  mounted() {
34
+  },
35
+  methods: {
36
+    submitForm(formName) { // 提交
37
+      this.$refs[formName].validate((valid) => {
38
+        if (valid) {
39
+          this.addBuilding()
40
+        } else {
41
+          console.log('error submit!!')
42
+          return false
43
+        }
44
+      })
45
+    },
46
+    resetForm(formName) { // 重置
47
+      // 重置为未注册
48
+      this.isRegistered = true
49
+      // 重置为非户主
50
+      this.roleDisabled = false
51
+
52
+      console.log(this.isRegistered)
53
+      this.$refs[formName].resetFields()
54
+    },
55
+    addBuilding() {
56
+      // 加载框
57
+      const loading = this.$loading({
58
+        lock: true,
59
+        text: 'Loading',
60
+        spinner: 'el-icon-loading',
61
+        background: 'rgba(0, 0, 0, 0.7)'
62
+      })
63
+      this.$store.dispatch('shopType/AddShopType', this.listQuery).then((res) => {
64
+        if (res.code === '0') {
65
+          this.$message({
66
+            message: res.message,
67
+            type: 'success'
68
+          })
69
+          this.$router.push({ name: 'shop-setting' })
70
+          loading.close()
71
+          return
72
+        }
73
+        this.$message.error(res.message)
74
+        loading.close()
75
+      }).catch(() => {
76
+        loading.close()
77
+        console.log('error AddBuilding')
78
+      })
79
+    }
80
+  }
81
+}
82
+</script>
83
+
84
+<style scoped>
85
+.add-ruleForm{
86
+  width: 800px;
87
+  margin-left: auto;
88
+  margin-right: auto;
89
+  margin-top: 50px;
90
+}
91
+</style>

+ 101
- 0
VUECODE/smart-property-manage/src/views/shop/shopSettingEdit.vue Visa fil

@@ -0,0 +1,101 @@
1
+<template>
2
+  <div class="root">
3
+    <el-form ref="ruleForm" :model="listQuery" :rules="rules" label-width="100px" class="add-ruleForm">
4
+      <el-form-item label="商铺类型" prop="typeName">
5
+        <el-input v-model="listQuery.typeName" style="width: 200px;"/>
6
+      </el-form-item>
7
+      <el-form-item label="权重" prop="sort">
8
+        <el-input v-model="listQuery.sort" style="width: 200px;"/>
9
+      </el-form-item>
10
+      <el-form-item>
11
+        <el-button type="primary" @click="submitForm('ruleForm')">修改</el-button>
12
+      </el-form-item>
13
+    </el-form>
14
+  </div>
15
+</template>
16
+
17
+<script>
18
+export default {
19
+  data() {
20
+    return {
21
+      listQuery: {
22
+        id: '',
23
+        typeName: '',
24
+        sort: ''
25
+      },
26
+      rules: {
27
+        typeName: [
28
+          { required: true, message: '请输入商铺类型', trigger: 'blur' }
29
+        ]
30
+      }
31
+    }
32
+  },
33
+  mounted() {
34
+    this.listQuery.id = this.$route.query.id
35
+    this.getById()
36
+  },
37
+  methods: {
38
+    submitForm(formName) { // 提交
39
+      this.$refs[formName].validate((valid) => {
40
+        if (valid) {
41
+          this.updateBuilding()
42
+        } else {
43
+          console.log('error submit!!')
44
+          return false
45
+        }
46
+      })
47
+    },
48
+    resetForm(formName) { // 重置
49
+      // 重置为未注册
50
+      this.isRegistered = true
51
+      // 重置为非户主
52
+      this.roleDisabled = false
53
+
54
+      console.log(this.isRegistered)
55
+      this.$refs[formName].resetFields()
56
+    },
57
+    getById() {
58
+      this.$store.dispatch('shopType/GetShopType', this.listQuery.id).then((res) => {
59
+        console.log(res)
60
+        const typeData = res.data
61
+        this.listQuery.typeName = typeData.typeName
62
+        this.listQuery.sort = typeData.sort
63
+      })
64
+    },
65
+    updateBuilding() {
66
+      // 加载框
67
+      const loading = this.$loading({
68
+        lock: true,
69
+        text: 'Loading',
70
+        spinner: 'el-icon-loading',
71
+        background: 'rgba(0, 0, 0, 0.7)'
72
+      })
73
+      this.$store.dispatch('shopType/UpdateShopType', this.listQuery).then((res) => {
74
+        if (res.code === '0') {
75
+          this.$message({
76
+            message: res.message,
77
+            type: 'success'
78
+          })
79
+          this.$router.push({ name: 'shop-setting' })
80
+          loading.close()
81
+          return
82
+        }
83
+        this.$message.error(res.message)
84
+        loading.close()
85
+      }).catch(() => {
86
+        loading.close()
87
+        console.log('error updateBuilding')
88
+      })
89
+    }
90
+  }
91
+}
92
+</script>
93
+
94
+<style scoped>
95
+.add-ruleForm{
96
+  width: 800px;
97
+  margin-left: auto;
98
+  margin-right: auto;
99
+  margin-top: 50px;
100
+}
101
+</style>