yanliming пре 4 година
родитељ
комит
67014b0ff8

+ 8 - 0
common/src/main/java/com/jpsoft/bus/modules/base/entity/PaymentInfo.java

@@ -53,4 +53,12 @@ public class PaymentInfo {
     private Date updateTime;
     @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;
+
+    @ApiModelProperty(value = "是否开启微信支付")
+    private Boolean isOpenWechat;
+    @ApiModelProperty(value = "是否开启支付宝支付")
+    private Boolean isOpenAlipay;
+
+    @ApiModelProperty(value = "对应公司")
+    private String companyName;
 }

+ 17 - 3
common/src/main/resources/mapper/base/PaymentInfo.xml

@@ -20,6 +20,8 @@
 			<result property="updateBy" column="update_by" />
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
+			<result property="isOpenWechat" column="is_open_wechat" />
+			<result property="isOpenAlipay" column="is_open_alipay" />
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.bus.modules.base.entity.PaymentInfo">
 	<!--
@@ -29,7 +31,7 @@
 	-->
 	<![CDATA[
 		insert into base_payment_info
-	    (id_,company_id,name_,wechat_notify_url,alipay_notify_url,app_id,sub_app_secret,mch_id,sub_app_id,sub_mch_id,app_auth_token,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,company_id,name_,wechat_notify_url,alipay_notify_url,app_id,sub_app_secret,mch_id,sub_app_id,sub_mch_id,app_auth_token,create_by,create_time,update_by,update_time,del_flag,is_open_wechat,is_open_alipay)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -48,6 +50,8 @@
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
+,#{isOpenWechat,jdbcType= NUMERIC }
+,#{isOpenAlipay,jdbcType= NUMERIC }
 		)
 	]]>
 	</insert>
@@ -102,6 +106,12 @@
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
+			<if test="isOpenWechat!=null">
+				is_open_wechat=#{isOpenWechat,jdbcType= NUMERIC },
+			</if>
+			<if test="isOpenAlipay!=null">
+				is_open_alipay=#{isOpenAlipay,jdbcType= NUMERIC },
+			</if>
 		</set>
 	where id_=#{id}
 	</update>
@@ -119,8 +129,12 @@
 			select * from base_payment_info
 		]]>
 		<where>
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+			del_flag = false
+			<if test="searchParams.name != null">
+				and name_ like #{searchParams.name}
+			</if>
+			<if test="searchParams.companyId != null">
+				and company_id = #{searchParams.companyId}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 59 - 4
web/src/main/java/com/jpsoft/bus/modules/base/controller/PaymentInfoController.java

@@ -1,6 +1,8 @@
 package com.jpsoft.bus.modules.base.controller;
 
 import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.bus.entity.CompanyInfo;
+import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
 import com.jpsoft.bus.modules.common.dto.MessageResult;
 import com.jpsoft.bus.modules.common.dto.Sort;
 import com.jpsoft.bus.modules.base.entity.PaymentInfo;
@@ -27,6 +29,9 @@ public class PaymentInfoController {
     @Autowired
     private PaymentInfoService paymentInfoService;
 
+    @Autowired
+    private CompanyInfoService companyInfoService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<PaymentInfo> create(){
@@ -196,7 +201,7 @@ public class PaymentInfoController {
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     public MessageResult<Map> pageList(
-            String id,
+            String companyId,String name,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -209,17 +214,67 @@ public class PaymentInfoController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("id_","asc"));
+        sortList.add(new Sort("create_time","desc"));
+
+        if (StringUtils.isNotEmpty(companyId)) {
+            searchParams.put("companyId",companyId);
+        }
 
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+        if (StringUtils.isNotEmpty(name)) {
+            searchParams.put("name","%"+name+"%");
         }
 
         Page<PaymentInfo> page = paymentInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
+        for (PaymentInfo paymentInfo:page) {
+            CompanyInfo companyInfo = companyInfoService.get(paymentInfo.getCompanyId());
+            if(companyInfo!=null){
+                paymentInfo.setCompanyName(companyInfo.getName());
+            }
+        }
+
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));
 
         return msgResult;
     }
+
+    @ApiOperation(value="修改是否支持微信支付宝支付")
+    @PostMapping("updateWechatPayOrAliPay")
+    public MessageResult<Integer> updateWechatPayOrAliPay(String id,Boolean wechatPay,Boolean aliPay, @RequestAttribute String subject) {
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            PaymentInfo paymentInfo = paymentInfoService.get(id);
+
+            if(paymentInfo!=null){
+                if(wechatPay!=null) {
+                    paymentInfo.setIsOpenWechat(wechatPay);
+                }
+                if(aliPay!=null) {
+                    paymentInfo.setIsOpenAlipay(aliPay);
+                }
+
+                paymentInfo.setUpdateBy(subject);
+                paymentInfo.setUpdateTime(new Date());
+
+                int count = paymentInfoService.update(paymentInfo);
+
+                msgResult.setResult(true);
+                msgResult.setData(count);
+            }
+            else{
+                msgResult.setResult(false);
+                msgResult.setMessage("更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }