Browse Source

加入商铺会员

java110 5 years ago
parent
commit
16f71152c2
18 changed files with 915 additions and 19 deletions
  1. 90 0
      java110-bean/src/main/java/com/java110/dto/shopVipAccount/ShopVipAccountDto.java
  2. 67 0
      java110-bean/src/main/java/com/java110/po/shopVipAccount/ShopVipAccountPo.java
  3. 1 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  4. 121 0
      java110-db/src/main/resources/mapper/acct/ShopVipAccountServiceDaoImplMapper.xml
  5. 17 19
      java110-generator/src/main/resources/newBack/template_1.json
  6. 53 0
      java110-interface/src/main/java/com/java110/intf/acct/IShopVipAccountInnerServiceSMO.java
  7. 107 0
      service-acct/src/main/java/com/java110/acct/api/ShopVipAccountApi.java
  8. 17 0
      service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/IDeleteShopVipAccountBMO.java
  9. 16 0
      service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/IGetShopVipAccountBMO.java
  10. 17 0
      service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/ISaveShopVipAccountBMO.java
  11. 17 0
      service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/IUpdateShopVipAccountBMO.java
  12. 34 0
      service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/impl/DeleteShopVipAccountBMOImpl.java
  13. 44 0
      service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/impl/GetShopVipAccountBMOImpl.java
  14. 38 0
      service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/impl/SaveShopVipAccountBMOImpl.java
  15. 34 0
      service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/impl/UpdateShopVipAccountBMOImpl.java
  16. 61 0
      service-acct/src/main/java/com/java110/acct/dao/IShopVipAccountServiceDao.java
  17. 98 0
      service-acct/src/main/java/com/java110/acct/dao/impl/ShopVipAccountServiceDaoImpl.java
  18. 83 0
      service-acct/src/main/java/com/java110/acct/smo/impl/ShopVipAccountInnerServiceSMOImpl.java

+ 90 - 0
java110-bean/src/main/java/com/java110/dto/shopVipAccount/ShopVipAccountDto.java

@@ -0,0 +1,90 @@
+package com.java110.dto.shopVipAccount;
+
+import com.java110.dto.PageDto;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 会员账户数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class ShopVipAccountDto extends PageDto implements Serializable {
+
+    private String amount;
+private String vipAcctId;
+private String vipId;
+private String acctType;
+private String shopId;
+private String acctName;
+private String storeId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getAmount() {
+        return amount;
+    }
+public void setAmount(String amount) {
+        this.amount = amount;
+    }
+public String getVipAcctId() {
+        return vipAcctId;
+    }
+public void setVipAcctId(String vipAcctId) {
+        this.vipAcctId = vipAcctId;
+    }
+public String getVipId() {
+        return vipId;
+    }
+public void setVipId(String vipId) {
+        this.vipId = vipId;
+    }
+public String getAcctType() {
+        return acctType;
+    }
+public void setAcctType(String acctType) {
+        this.acctType = acctType;
+    }
+public String getShopId() {
+        return shopId;
+    }
+public void setShopId(String shopId) {
+        this.shopId = shopId;
+    }
+public String getAcctName() {
+        return acctName;
+    }
+public void setAcctName(String acctName) {
+        this.acctName = acctName;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 67 - 0
java110-bean/src/main/java/com/java110/po/shopVipAccount/ShopVipAccountPo.java

@@ -0,0 +1,67 @@
+package com.java110.po.shopVipAccount;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class ShopVipAccountPo implements Serializable {
+
+    private String amount;
+private String vipAcctId;
+private String vipId;
+private String acctType;
+private String statusCd = "0";
+private String shopId;
+private String acctName;
+private String storeId;
+public String getAmount() {
+        return amount;
+    }
+public void setAmount(String amount) {
+        this.amount = amount;
+    }
+public String getVipAcctId() {
+        return vipAcctId;
+    }
+public void setVipAcctId(String vipAcctId) {
+        this.vipAcctId = vipAcctId;
+    }
+public String getVipId() {
+        return vipId;
+    }
+public void setVipId(String vipId) {
+        this.vipId = vipId;
+    }
+public String getAcctType() {
+        return acctType;
+    }
+public void setAcctType(String acctType) {
+        this.acctType = acctType;
+    }
+public String getStatusCd() {
+        return statusCd;
+    }
+public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+public String getShopId() {
+        return shopId;
+    }
+public void setShopId(String shopId) {
+        this.shopId = shopId;
+    }
+public String getAcctName() {
+        return acctName;
+    }
+public void setAcctName(String acctName) {
+        this.acctName = acctName;
+    }
+public String getStoreId() {
+        return storeId;
+    }
+public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+
+
+}

+ 1 - 0
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java

@@ -203,6 +203,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_applyId = "29";
     public static final String CODE_PREFIX_prId = "30";
     public static final String CODE_PREFIX_acctId = "31";
+    public static final String CODE_PREFIX_vipAcctId = "32";
 
 
     /**

+ 121 - 0
java110-db/src/main/resources/mapper/acct/ShopVipAccountServiceDaoImplMapper.xml

@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="shopVipAccountServiceDaoImpl">
+
+
+    <!-- 保存会员账户信息 add by wuxw 2018-07-03 -->
+    <insert id="saveShopVipAccountInfo" parameterType="Map">
+        insert into shop_vip_account(
+        amount,vip_acct_id,vip_id,acct_type,shop_id,acct_name,store_id
+        ) values (
+        #{amount},#{vipAcctId},#{vipId},#{acctType},#{shopId},#{acctName},#{storeId}
+        )
+    </insert>
+
+
+    <!-- 查询会员账户信息 add by wuxw 2018-07-03 -->
+    <select id="getShopVipAccountInfo" parameterType="Map" resultType="Map">
+        select t.amount,t.vip_acct_id,t.vip_acct_id vipAcctId,t.vip_id,t.vip_id vipId,t.acct_type,t.acct_type
+        acctType,t.status_cd,t.status_cd statusCd,t.shop_id,t.shop_id shopId,t.acct_name,t.acct_name
+        acctName,t.store_id,t.store_id storeId
+        from shop_vip_account t
+        where 1 =1
+        <if test="amount !=null and amount != ''">
+            and t.amount= #{amount}
+        </if>
+        <if test="vipAcctId !=null and vipAcctId != ''">
+            and t.vip_acct_id= #{vipAcctId}
+        </if>
+        <if test="vipId !=null and vipId != ''">
+            and t.vip_id= #{vipId}
+        </if>
+        <if test="acctType !=null and acctType != ''">
+            and t.acct_type= #{acctType}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            and t.shop_id= #{shopId}
+        </if>
+        <if test="acctName !=null and acctName != ''">
+            and t.acct_name= #{acctName}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+
+    </select>
+
+
+    <!-- 修改会员账户信息 add by wuxw 2018-07-03 -->
+    <update id="updateShopVipAccountInfo" parameterType="Map">
+        update shop_vip_account t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="amount !=null and amount != ''">
+            , t.amount= #{amount}
+        </if>
+        <if test="vipId !=null and vipId != ''">
+            , t.vip_id= #{vipId}
+        </if>
+        <if test="acctType !=null and acctType != ''">
+            , t.acct_type= #{acctType}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            , t.shop_id= #{shopId}
+        </if>
+        <if test="acctName !=null and acctName != ''">
+            , t.acct_name= #{acctName}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            , t.store_id= #{storeId}
+        </if>
+        where 1=1
+        <if test="vipAcctId !=null and vipAcctId != ''">
+            and t.vip_acct_id= #{vipAcctId}
+        </if>
+
+    </update>
+
+    <!-- 查询会员账户数量 add by wuxw 2018-07-03 -->
+    <select id="queryShopVipAccountsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from shop_vip_account t
+        where 1 =1
+        <if test="amount !=null and amount != ''">
+            and t.amount= #{amount}
+        </if>
+        <if test="vipAcctId !=null and vipAcctId != ''">
+            and t.vip_acct_id= #{vipAcctId}
+        </if>
+        <if test="vipId !=null and vipId != ''">
+            and t.vip_id= #{vipId}
+        </if>
+        <if test="acctType !=null and acctType != ''">
+            and t.acct_type= #{acctType}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            and t.shop_id= #{shopId}
+        </if>
+        <if test="acctName !=null and acctName != ''">
+            and t.acct_name= #{acctName}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+
+
+    </select>
+
+</mapper>

+ 17 - 19
java110-generator/src/main/resources/newBack/template_1.json

@@ -1,32 +1,30 @@
 {
   "autoMove": true,
-  "id": "prId",
-  "name": "contractChangePlanRoom",
-  "desc": "合同房屋变更",
-  "shareParam": "storeId",
-  "shareColumn": "store_id",
-  "shareName": "store",
-  "tableName": "contract_change_plan_room",
+  "id": "vipAcctId",
+  "name": "shopVipAccount",
+  "desc": "会员账户",
+  "shareParam": "shopId",
+  "shareColumn": "shop_id",
+  "shareName": "acct",
+  "tableName": "shop_vip_account",
   "param": {
-    "prId": "pr_id",
-    "planId": "plan_id",
-    "contractId": "contract_id",
-    "roomId": "room_id",
-    "roomName": "room_name",
-    "ownerId": "owner_id",
-    "ownerName": "owner_name",
-    "operate": "operate",
+    "vipAcctId": "vip_acct_id",
+    "vipId": "vip_id",
+    "acctName": "acct_name",
+    "acctType": "acct_type",
+    "amount": "amount",
+    "shopId": "shop_id",
     "storeId": "store_id",
     "statusCd": "status_cd"
   },
   "required": [
     {
-      "code": "planId",
-      "msg": "计划不能为空"
+      "code": "vipId",
+      "msg": "会员不能为空"
     },
     {
-      "code": "roomId",
-      "msg": "房屋不能为空"
+      "code": "amount",
+      "msg": "金额不能为空"
     }
   ]
 }

+ 53 - 0
java110-interface/src/main/java/com/java110/intf/acct/IShopVipAccountInnerServiceSMO.java

@@ -0,0 +1,53 @@
+package com.java110.intf.acct;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.shopVipAccount.ShopVipAccountDto;
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * @ClassName IShopVipAccountInnerServiceSMO
+ * @Description 会员账户接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "acct-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/shopVipAccountApi")
+public interface IShopVipAccountInnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveShopVipAccount", method = RequestMethod.POST)
+    public int saveShopVipAccount(@RequestBody ShopVipAccountPo shopVipAccountPo);
+
+    @RequestMapping(value = "/updateShopVipAccount", method = RequestMethod.POST)
+    public int updateShopVipAccount(@RequestBody  ShopVipAccountPo shopVipAccountPo);
+
+    @RequestMapping(value = "/deleteShopVipAccount", method = RequestMethod.POST)
+    public int deleteShopVipAccount(@RequestBody  ShopVipAccountPo shopVipAccountPo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param shopVipAccountDto 数据对象分享
+     * @return ShopVipAccountDto 对象数据
+     */
+    @RequestMapping(value = "/queryShopVipAccounts", method = RequestMethod.POST)
+    List<ShopVipAccountDto> queryShopVipAccounts(@RequestBody ShopVipAccountDto shopVipAccountDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param shopVipAccountDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryShopVipAccountsCount", method = RequestMethod.POST)
+    int queryShopVipAccountsCount(@RequestBody ShopVipAccountDto shopVipAccountDto);
+}

+ 107 - 0
service-acct/src/main/java/com/java110/acct/api/ShopVipAccountApi.java

@@ -0,0 +1,107 @@
+package com.java110.store.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.acct.bmo.shopVipAccount.IDeleteShopVipAccountBMO;
+import com.java110.acct.bmo.shopVipAccount.IGetShopVipAccountBMO;
+import com.java110.acct.bmo.shopVipAccount.ISaveShopVipAccountBMO;
+import com.java110.acct.bmo.shopVipAccount.IUpdateShopVipAccountBMO;
+import com.java110.dto.shopVipAccount.ShopVipAccountDto;
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+@RequestMapping(value = "/shopVipAccount")
+public class ShopVipAccountApi {
+
+    @Autowired
+    private ISaveShopVipAccountBMO saveShopVipAccountBMOImpl;
+    @Autowired
+    private IUpdateShopVipAccountBMO updateShopVipAccountBMOImpl;
+    @Autowired
+    private IDeleteShopVipAccountBMO deleteShopVipAccountBMOImpl;
+
+    @Autowired
+    private IGetShopVipAccountBMO getShopVipAccountBMOImpl;
+
+    /**
+     * 微信保存消息模板
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /shopVipAccount/saveShopVipAccount
+     * @path /app/shopVipAccount/saveShopVipAccount
+     */
+    @RequestMapping(value = "/saveShopVipAccount", method = RequestMethod.POST)
+    public ResponseEntity<String> saveShopVipAccount(@RequestBody JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "vipId", "请求报文中未包含vipId");
+        Assert.hasKeyAndValue(reqJson, "amount", "请求报文中未包含amount");
+
+
+        ShopVipAccountPo shopVipAccountPo = BeanConvertUtil.covertBean(reqJson, ShopVipAccountPo.class);
+        return saveShopVipAccountBMOImpl.save(shopVipAccountPo);
+    }
+
+    /**
+     * 微信修改消息模板
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /shopVipAccount/updateShopVipAccount
+     * @path /app/shopVipAccount/updateShopVipAccount
+     */
+    @RequestMapping(value = "/updateShopVipAccount", method = RequestMethod.POST)
+    public ResponseEntity<String> updateShopVipAccount(@RequestBody JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "vipId", "请求报文中未包含vipId");
+        Assert.hasKeyAndValue(reqJson, "amount", "请求报文中未包含amount");
+        Assert.hasKeyAndValue(reqJson, "vipAcctId", "vipAcctId不能为空");
+
+
+        ShopVipAccountPo shopVipAccountPo = BeanConvertUtil.covertBean(reqJson, ShopVipAccountPo.class);
+        return updateShopVipAccountBMOImpl.update(shopVipAccountPo);
+    }
+
+    /**
+     * 微信删除消息模板
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /shopVipAccount/deleteShopVipAccount
+     * @path /app/shopVipAccount/deleteShopVipAccount
+     */
+    @RequestMapping(value = "/deleteShopVipAccount", method = RequestMethod.POST)
+    public ResponseEntity<String> deleteShopVipAccount(@RequestBody JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
+
+        Assert.hasKeyAndValue(reqJson, "vipAcctId", "vipAcctId不能为空");
+
+
+        ShopVipAccountPo shopVipAccountPo = BeanConvertUtil.covertBean(reqJson, ShopVipAccountPo.class);
+        return deleteShopVipAccountBMOImpl.delete(shopVipAccountPo);
+    }
+
+    /**
+     * 微信删除消息模板
+     *
+     * @param shopId 小区ID
+     * @return
+     * @serviceCode /shopVipAccount/queryShopVipAccount
+     * @path /app/shopVipAccount/queryShopVipAccount
+     */
+    @RequestMapping(value = "/queryShopVipAccount", method = RequestMethod.GET)
+    public ResponseEntity<String> queryShopVipAccount(@RequestParam(value = "shopId", required = false) String shopId,
+                                                      @RequestParam(value = "page") int page,
+                                                      @RequestParam(value = "row") int row) {
+        ShopVipAccountDto shopVipAccountDto = new ShopVipAccountDto();
+        shopVipAccountDto.setPage(page);
+        shopVipAccountDto.setRow(row);
+        shopVipAccountDto.setShopId(shopId);
+        return getShopVipAccountBMOImpl.get(shopVipAccountDto);
+    }
+}

+ 17 - 0
service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/IDeleteShopVipAccountBMO.java

@@ -0,0 +1,17 @@
+package com.java110.acct.bmo.shopVipAccount;
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import org.springframework.http.ResponseEntity;
+
+public interface IDeleteShopVipAccountBMO {
+
+
+    /**
+     * 修改会员账户
+     * add by wuxw
+     * @param shopVipAccountPo
+     * @return
+     */
+    ResponseEntity<String> delete(ShopVipAccountPo shopVipAccountPo);
+
+
+}

+ 16 - 0
service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/IGetShopVipAccountBMO.java

@@ -0,0 +1,16 @@
+package com.java110.acct.bmo.shopVipAccount;
+import com.java110.dto.shopVipAccount.ShopVipAccountDto;
+import org.springframework.http.ResponseEntity;
+public interface IGetShopVipAccountBMO {
+
+
+    /**
+     * 查询会员账户
+     * add by wuxw
+     * @param  shopVipAccountDto
+     * @return
+     */
+    ResponseEntity<String> get(ShopVipAccountDto shopVipAccountDto);
+
+
+}

+ 17 - 0
service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/ISaveShopVipAccountBMO.java

@@ -0,0 +1,17 @@
+package com.java110.acct.bmo.shopVipAccount;
+
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import org.springframework.http.ResponseEntity;
+public interface ISaveShopVipAccountBMO {
+
+
+    /**
+     * 添加会员账户
+     * add by wuxw
+     * @param shopVipAccountPo
+     * @return
+     */
+    ResponseEntity<String> save(ShopVipAccountPo shopVipAccountPo);
+
+
+}

+ 17 - 0
service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/IUpdateShopVipAccountBMO.java

@@ -0,0 +1,17 @@
+package com.java110.acct.bmo.shopVipAccount;
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import org.springframework.http.ResponseEntity;
+
+public interface IUpdateShopVipAccountBMO {
+
+
+    /**
+     * 修改会员账户
+     * add by wuxw
+     * @param shopVipAccountPo
+     * @return
+     */
+    ResponseEntity<String> update(ShopVipAccountPo shopVipAccountPo);
+
+
+}

+ 34 - 0
service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/impl/DeleteShopVipAccountBMOImpl.java

@@ -0,0 +1,34 @@
+package com.java110.acct.bmo.shopVipAccount.impl;
+
+import com.java110.acct.bmo.shopVipAccount.IDeleteShopVipAccountBMO;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.intf.acct.IShopVipAccountInnerServiceSMO;
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("deleteShopVipAccountBMOImpl")
+public class DeleteShopVipAccountBMOImpl implements IDeleteShopVipAccountBMO {
+
+    @Autowired
+    private IShopVipAccountInnerServiceSMO shopVipAccountInnerServiceSMOImpl;
+
+    /**
+     * @param shopVipAccountPo 数据
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> delete(ShopVipAccountPo shopVipAccountPo) {
+
+        int flag = shopVipAccountInnerServiceSMOImpl.deleteShopVipAccount(shopVipAccountPo);
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 44 - 0
service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/impl/GetShopVipAccountBMOImpl.java

@@ -0,0 +1,44 @@
+package com.java110.acct.bmo.shopVipAccount.impl;
+
+import com.java110.acct.bmo.shopVipAccount.IGetShopVipAccountBMO;
+import com.java110.dto.shopVipAccount.ShopVipAccountDto;
+import com.java110.intf.acct.IShopVipAccountInnerServiceSMO;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service("getShopVipAccountBMOImpl")
+public class GetShopVipAccountBMOImpl implements IGetShopVipAccountBMO {
+
+    @Autowired
+    private IShopVipAccountInnerServiceSMO shopVipAccountInnerServiceSMOImpl;
+
+    /**
+     * @param shopVipAccountDto
+     * @return 订单服务能够接受的报文
+     */
+    public ResponseEntity<String> get(ShopVipAccountDto shopVipAccountDto) {
+
+
+        int count = shopVipAccountInnerServiceSMOImpl.queryShopVipAccountsCount(shopVipAccountDto);
+
+        List<ShopVipAccountDto> shopVipAccountDtos = null;
+        if (count > 0) {
+            shopVipAccountDtos = shopVipAccountInnerServiceSMOImpl.queryShopVipAccounts(shopVipAccountDto);
+        } else {
+            shopVipAccountDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) shopVipAccountDto.getRow()), count, shopVipAccountDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        return responseEntity;
+    }
+
+}

+ 38 - 0
service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/impl/SaveShopVipAccountBMOImpl.java

@@ -0,0 +1,38 @@
+package com.java110.acct.bmo.shopVipAccount.impl;
+
+import com.java110.acct.bmo.shopVipAccount.ISaveShopVipAccountBMO;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.acct.IShopVipAccountInnerServiceSMO;
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("saveShopVipAccountBMOImpl")
+public class SaveShopVipAccountBMOImpl implements ISaveShopVipAccountBMO {
+
+    @Autowired
+    private IShopVipAccountInnerServiceSMO shopVipAccountInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param shopVipAccountPo
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> save(ShopVipAccountPo shopVipAccountPo) {
+
+        shopVipAccountPo.setVipAcctId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_vipAcctId));
+        int flag = shopVipAccountInnerServiceSMOImpl.saveShopVipAccount(shopVipAccountPo);
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 34 - 0
service-acct/src/main/java/com/java110/acct/bmo/shopVipAccount/impl/UpdateShopVipAccountBMOImpl.java

@@ -0,0 +1,34 @@
+package com.java110.acct.bmo.shopVipAccount.impl;
+
+import com.java110.acct.bmo.shopVipAccount.IUpdateShopVipAccountBMO;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.intf.acct.IShopVipAccountInnerServiceSMO;
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("updateShopVipAccountBMOImpl")
+public class UpdateShopVipAccountBMOImpl implements IUpdateShopVipAccountBMO {
+
+    @Autowired
+    private IShopVipAccountInnerServiceSMO shopVipAccountInnerServiceSMOImpl;
+
+    /**
+     * @param shopVipAccountPo
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> update(ShopVipAccountPo shopVipAccountPo) {
+
+        int flag = shopVipAccountInnerServiceSMOImpl.updateShopVipAccount(shopVipAccountPo);
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 61 - 0
service-acct/src/main/java/com/java110/acct/dao/IShopVipAccountServiceDao.java

@@ -0,0 +1,61 @@
+package com.java110.acct.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 会员账户组件内部之间使用,没有给外围系统提供服务能力
+ * 会员账户服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ *
+ * Created by wuxw on 2016/12/27.
+ */
+public interface IShopVipAccountServiceDao {
+
+
+    /**
+     * 保存 会员账户信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveShopVipAccountInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询会员账户信息(instance过程)
+     * 根据bId 查询会员账户信息
+     * @param info bId 信息
+     * @return 会员账户信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getShopVipAccountInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改会员账户信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateShopVipAccountInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询会员账户总数
+     *
+     * @param info 会员账户信息
+     * @return 会员账户数量
+     */
+    int queryShopVipAccountsCount(Map info);
+
+}

+ 98 - 0
service-acct/src/main/java/com/java110/acct/dao/impl/ShopVipAccountServiceDaoImpl.java

@@ -0,0 +1,98 @@
+package com.java110.acct.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.acct.dao.IShopVipAccountServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 会员账户服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("shopVipAccountServiceDaoImpl")
+//@Transactional
+public class ShopVipAccountServiceDaoImpl extends BaseServiceDao implements IShopVipAccountServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(ShopVipAccountServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存会员账户信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveShopVipAccountInfo(Map info) throws DAOException {
+        logger.debug("保存会员账户信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("shopVipAccountServiceDaoImpl.saveShopVipAccountInfo",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存会员账户信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+
+    /**
+     * 查询会员账户信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getShopVipAccountInfo(Map info) throws DAOException {
+        logger.debug("查询会员账户信息 入参 info : {}",info);
+
+        List<Map> businessShopVipAccountInfos = sqlSessionTemplate.selectList("shopVipAccountServiceDaoImpl.getShopVipAccountInfo",info);
+
+        return businessShopVipAccountInfos;
+    }
+
+
+    /**
+     * 修改会员账户信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateShopVipAccountInfo(Map info) throws DAOException {
+        logger.debug("修改会员账户信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("shopVipAccountServiceDaoImpl.updateShopVipAccountInfo",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改会员账户信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+     /**
+     * 查询会员账户数量
+     * @param info 会员账户信息
+     * @return 会员账户数量
+     */
+    @Override
+    public int queryShopVipAccountsCount(Map info) {
+        logger.debug("查询会员账户数据 入参 info : {}",info);
+
+        List<Map> businessShopVipAccountInfos = sqlSessionTemplate.selectList("shopVipAccountServiceDaoImpl.queryShopVipAccountsCount", info);
+        if (businessShopVipAccountInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessShopVipAccountInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 83 - 0
service-acct/src/main/java/com/java110/acct/smo/impl/ShopVipAccountInnerServiceSMOImpl.java

@@ -0,0 +1,83 @@
+package com.java110.acct.smo.impl;
+
+
+import com.java110.acct.dao.IShopVipAccountServiceDao;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.shopVipAccount.ShopVipAccountDto;
+import com.java110.intf.acct.IShopVipAccountInnerServiceSMO;
+import com.java110.po.shopVipAccount.ShopVipAccountPo;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @ClassName FloorInnerServiceSMOImpl
+ * @Description 会员账户内部服务实现类
+ * @Author wuxw
+ * @Date 2019/4/24 9:20
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@RestController
+public class ShopVipAccountInnerServiceSMOImpl extends BaseServiceSMO implements IShopVipAccountInnerServiceSMO {
+
+    @Autowired
+    private IShopVipAccountServiceDao shopVipAccountServiceDaoImpl;
+
+
+    @Override
+    public int saveShopVipAccount(@RequestBody ShopVipAccountPo shopVipAccountPo) {
+        int saveFlag = 1;
+        shopVipAccountServiceDaoImpl.saveShopVipAccountInfo(BeanConvertUtil.beanCovertMap(shopVipAccountPo));
+        return saveFlag;
+    }
+
+    @Override
+    public int updateShopVipAccount(@RequestBody ShopVipAccountPo shopVipAccountPo) {
+        int saveFlag = 1;
+        shopVipAccountServiceDaoImpl.updateShopVipAccountInfo(BeanConvertUtil.beanCovertMap(shopVipAccountPo));
+        return saveFlag;
+    }
+
+    @Override
+    public int deleteShopVipAccount(@RequestBody ShopVipAccountPo shopVipAccountPo) {
+        int saveFlag = 1;
+        shopVipAccountPo.setStatusCd("1");
+        shopVipAccountServiceDaoImpl.updateShopVipAccountInfo(BeanConvertUtil.beanCovertMap(shopVipAccountPo));
+        return saveFlag;
+    }
+
+    @Override
+    public List<ShopVipAccountDto> queryShopVipAccounts(@RequestBody ShopVipAccountDto shopVipAccountDto) {
+
+        //校验是否传了 分页信息
+
+        int page = shopVipAccountDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            shopVipAccountDto.setPage((page - 1) * shopVipAccountDto.getRow());
+        }
+
+        List<ShopVipAccountDto> shopVipAccounts = BeanConvertUtil.covertBeanList(shopVipAccountServiceDaoImpl.getShopVipAccountInfo(BeanConvertUtil.beanCovertMap(shopVipAccountDto)), ShopVipAccountDto.class);
+
+        return shopVipAccounts;
+    }
+
+
+    @Override
+    public int queryShopVipAccountsCount(@RequestBody ShopVipAccountDto shopVipAccountDto) {
+        return shopVipAccountServiceDaoImpl.queryShopVipAccountsCount(BeanConvertUtil.beanCovertMap(shopVipAccountDto));
+    }
+
+    public IShopVipAccountServiceDao getShopVipAccountServiceDaoImpl() {
+        return shopVipAccountServiceDaoImpl;
+    }
+
+    public void setShopVipAccountServiceDaoImpl(IShopVipAccountServiceDao shopVipAccountServiceDaoImpl) {
+        this.shopVipAccountServiceDaoImpl = shopVipAccountServiceDaoImpl;
+    }
+}