| @@ -2,6 +2,7 @@ package com.iformall.controller.basic; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.annotation.UserDataRuleAnnotation; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| @@ -291,6 +292,16 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(has); | |||
| } | |||
| @ApiOperation("查看是否存在商户名称相同记录") | |||
| @GetMapping("/hasMerchantEncode") | |||
| @SystemControllerLog(description = "商户-查看是否存在商户编码相同记录") | |||
| @TenantIgnore | |||
| public ResultData hasMerchantEncode(@ModelAttribute WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::hasMerchantEncode{}"+wxMerchant.toString()); | |||
| boolean has = wxMerchantService.hasMerchant(wxMerchant); | |||
| return new ResultData(has); | |||
| } | |||
| @ApiOperation("商户会员消费分页列表接口") | |||
| @GetMapping("userTradeList") | |||
| @ApiImplicitParams({ | |||
| @@ -0,0 +1,3 @@ | |||
| ALTER TABLE `wx_merchant` | |||
| ADD COLUMN `encode` varchar(50) COMMENT '唯一编码' AFTER `name`, | |||
| ADD UNIQUE INDEX `code_unique`(`encode`) USING BTREE; | |||
| @@ -193,6 +193,9 @@ public class AliPayController extends BaseController { | |||
| */ | |||
| @RequestMapping(value = "/notify") | |||
| public String __Notify(@RequestParam Map<String, Object> paramMap) throws Exception { | |||
| logger.info("alipay notify ======{}:"+paramMap); | |||
| String msgMethod = (String) paramMap.get("msg_method"); | |||
| if (StringUtils.isBlank(msgMethod)) { | |||
| logger.error("alipay notify notify error. msg_method empity:"+paramMap); | |||
| @@ -235,7 +238,8 @@ public class AliPayController extends BaseController { | |||
| String mallId = jo.getString("mall_id"); | |||
| String mallName = jo.getString("mall_name"); | |||
| WxMerchant merchant = wxMerchantService.getById(Long.parseLong(mallStoreId)); | |||
| // WxMerchant merchant = wxMerchantService.getById(Long.parseLong(mallStoreId)); | |||
| WxMerchant merchant = wxMerchantService.getMerchantByEncode(mallStoreId); | |||
| if(merchant == null){ | |||
| logger.error("alipay notify . 找不到门店:"+paramMap); | |||
| return "fail"; | |||
| @@ -273,7 +277,8 @@ public class AliPayController extends BaseController { | |||
| String mallId = jo.getString("mall_id"); | |||
| String mallName = jo.getString("mall_name"); | |||
| WxMerchant merchant = wxMerchantService.getById(Long.parseLong(mallStoreId)); | |||
| // WxMerchant merchant = wxMerchantService.getById(Long.parseLong(mallStoreId)); | |||
| WxMerchant merchant = wxMerchantService.getMerchantByEncode(mallStoreId); | |||
| if(merchant == null){ | |||
| logger.error("alipay notify . 找不到门店:"+paramMap); | |||
| return "fail"; | |||
| @@ -103,6 +103,7 @@ public enum ErrorCode{ | |||
| MERCHANT_CAR_NOT_DEL(2015, "停车商户不能被删除"), | |||
| MERCHANT_BUSER_NOT_VALID(2016, "商户用户不存在或已被禁用"), | |||
| MERCHANT_HASRENTCONTRACT(2017,"该商户存在计租中合同"), | |||
| MERCHANT_CODE_IS_FOUND(2018, "商户编码已存在"), | |||
| /** | |||
| * 券 | |||
| */ | |||
| @@ -46,30 +46,33 @@ public class WxMerchant extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private Long rentContractId; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户编码",name="encode") | |||
| @Excel(name="商户编码",width = 20,orderNum = "1") | |||
| private String encode; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||
| @Excel(name="商户名",width = 20,orderNum = "1") | |||
| @Excel(name="商户名",width = 20,orderNum = "2") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="联系人",name="linkPerson") | |||
| @Excel(name="联系人",width = 20,orderNum = "2") | |||
| @Excel(name="联系人",width = 20,orderNum = "3") | |||
| private String linkPerson; | |||
| @io.swagger.annotations.ApiModelProperty(value="联系方式",name="linkPhone") | |||
| @Excel(name="联系方式",width = 20,orderNum = "3") | |||
| @Excel(name="联系方式",width = 20,orderNum = "4") | |||
| private String linkPhone; | |||
| @TableField(exist = false) | |||
| @Excel(name="租期开始时间",width = 20,format="yyyy-MM-dd",orderNum = "4") | |||
| @Excel(name="租期开始时间",width = 20,format="yyyy-MM-dd",orderNum = "5") | |||
| @io.swagger.annotations.ApiModelProperty(value="租期开始时间",name="rentalStartDate") | |||
| private Date rentalStartDate; | |||
| @TableField(exist = false) | |||
| @Excel(name="租期结束时间",width = 20,format="yyyy-MM-dd",orderNum = "5") | |||
| @Excel(name="租期结束时间",width = 20,format="yyyy-MM-dd",orderNum = "6") | |||
| @io.swagger.annotations.ApiModelProperty(value="租期结束时间",name="rentalEndDate") | |||
| private Date rentalEndDate; | |||
| @Excel(name="商户状态",width = 20,orderNum = "6",replace = {"停用_0","正常_1"}) | |||
| @Excel(name="商户状态",width = 20,orderNum = "7",replace = {"停用_0","正常_1"}) | |||
| @io.swagger.annotations.ApiModelProperty(value="状态1可用0停用",name="status") | |||
| private Integer status; | |||
| @@ -81,55 +84,55 @@ public class WxMerchant extends TenantEntity { | |||
| } | |||
| @TableField(exist = false) | |||
| @Excel(name="账户类型",width = 20,orderNum = "7",replace = {"_null","商户号_0","微信号_1","OPENID_3"}) | |||
| @Excel(name="账户类型",width = 20,orderNum = "8",replace = {"_null","商户号_0","微信号_1","OPENID_3"}) | |||
| @io.swagger.annotations.ApiModelProperty(value="账户类型",name="accountTypeValue") | |||
| private Integer accountTypeValue; | |||
| @TableField(exist = false) | |||
| @Excel(name="账户号",width = 20,orderNum = "8") | |||
| @Excel(name="账户号",width = 20,orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="账户ID",name="accountId") | |||
| private String accountId; | |||
| @TableField(exist = false) | |||
| @Excel(name="账户名",width = 20,orderNum = "9") | |||
| @Excel(name="账户名",width = 20,orderNum = "10") | |||
| @io.swagger.annotations.ApiModelProperty(value="账户名",name="accountName") | |||
| private String accountName; | |||
| @Excel(name="创建时间",width = 20,format="yyyy-MM-dd",orderNum = "10") | |||
| @Excel(name="创建时间",width = 20,format="yyyy-MM-dd",orderNum = "11") | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @Excel(name="是否展示",width = 20,orderNum = "11",replace = {"否_0","是_1"}) | |||
| @Excel(name="是否展示",width = 20,orderNum = "12",replace = {"否_0","是_1"}) | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "isPublic") | |||
| private Integer isPublic; | |||
| @Excel(name = "待缴提醒", width = 20, orderNum = "12") | |||
| @Excel(name = "待缴提醒", width = 20, orderNum = "13") | |||
| @io.swagger.annotations.ApiModelProperty(value = "待缴提醒", name = "billSetting") | |||
| private Integer billSetting; | |||
| @TableField(exist = false) | |||
| @Excel(name = "业态", width = 20, orderNum = "13") | |||
| @Excel(name = "业态", width = 20, orderNum = "14") | |||
| @io.swagger.annotations.ApiModelProperty(value="经营业态ID:参照wx_business表",name="businessId") | |||
| private String businessName; | |||
| @TableField(exist = false) | |||
| @Excel(name = "子业态", width = 20, orderNum = "14") | |||
| @Excel(name = "子业态", width = 20, orderNum = "15") | |||
| @io.swagger.annotations.ApiModelProperty(value="子业态",name="subBusinessId") | |||
| private String subBusinessName; | |||
| @TableField(exist = false) | |||
| @Excel(name = "商铺", width = 20, orderNum = "15") | |||
| @Excel(name = "商铺", width = 20, orderNum = "16") | |||
| private String shopsStr; | |||
| @TableField(exist = false) | |||
| @Excel(name = "管理员", width = 20, orderNum = "16") | |||
| @Excel(name = "管理员", width = 20, orderNum = "17") | |||
| private String usersStr; | |||
| @Excel(name = "主谈人", width = 20, orderNum = "17") | |||
| @Excel(name = "主谈人", width = 20, orderNum = "18") | |||
| @io.swagger.annotations.ApiModelProperty(value = "主谈人", name = "talkUserMain") | |||
| private String talkUserMain; | |||
| @Excel(name = "辅谈人", width = 20, orderNum = "18") | |||
| @Excel(name = "辅谈人", width = 20, orderNum = "19") | |||
| @io.swagger.annotations.ApiModelProperty(value = "辅谈人", name = "talkUserAux") | |||
| private String talkUserAux; | |||
| @@ -20,6 +20,8 @@ public class WxMerchantVo extends TenantEntity { | |||
| private String merchantImgUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||
| private String merchantName; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantEncode") | |||
| private String merchantEncode; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户联系方式",name="linkPhone") | |||
| private String merchantLinkPhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户状态1可用0停用",name="status") | |||
| @@ -6,6 +6,7 @@ import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -27,6 +28,7 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| List<Map<String,Object>> findBusByFloorId(Map<String, Object> params); | |||
| int hasMerchant(WxMerchant wxMerchant); | |||
| int hasMerchantEncode(WxMerchant wxMerchant); | |||
| List<WxMerchant> findListVo(WxMerchant record); | |||
| @@ -49,4 +51,6 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| void increaseCashCount(WxMerchant record); | |||
| void reSetCashCount(WxMerchant record); | |||
| WxMerchant getMerchantByEncode(@Param("encode")String encode); | |||
| } | |||
| @@ -142,6 +142,9 @@ public interface WxMerchantService { | |||
| ResultData useAccount(WxProfitSharingReceiver wxProfitSharingReceiver); | |||
| boolean hasMerchant(WxMerchant wxMerchant); | |||
| boolean hasMerchantEncode(WxMerchant wxMerchant); | |||
| WxMerchant getMerchantByEncode(String encode); | |||
| Optional<WxMerchant> findByName(String name); | |||
| @@ -156,4 +159,5 @@ public interface WxMerchantService { | |||
| void disableMerchat(Long id); | |||
| List<Long> getMerchantShopIds(Long merchantId); | |||
| } | |||
| @@ -82,7 +82,8 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| record.setUpdateTime(now); | |||
| //TODO 第三方获取门店(标识可能发生变化) | |||
| WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getMallStoreId())); | |||
| // WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getMallStoreId())); | |||
| WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getMallStoreId()); | |||
| if(wxMerchant != null){ | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| }else{ | |||
| @@ -82,7 +82,8 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| record.setUpdateTime(now); | |||
| //TODO 第三方获取门店(标识可能发生变化) | |||
| WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getWxShopNumber())); | |||
| // WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getWxShopNumber())); | |||
| WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getWxShopNumber()); | |||
| if(wxMerchant != null){ | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| }else{ | |||
| @@ -332,6 +332,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| if (hasMerchant(wxMerchant)) { | |||
| return new ResultData(ErrorCode.MERCHANT_NAME_IS_FOUND); | |||
| } | |||
| if (hasMerchantEncode(wxMerchant)) { | |||
| return new ResultData(ErrorCode.MERCHANT_CODE_IS_FOUND); | |||
| } | |||
| //保存商户商铺的关联 | |||
| List<Long> shopidlist = wxMerchant.getShopids(); | |||
| if (shopidlist.isEmpty()) { | |||
| @@ -453,6 +456,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| if (hasMerchant(wxMerchant)) { | |||
| return new ResultData(ErrorCode.MERCHANT_NAME_IS_FOUND); | |||
| } | |||
| if (hasMerchantEncode(wxMerchant)) { | |||
| return new ResultData(ErrorCode.MERCHANT_CODE_IS_FOUND); | |||
| } | |||
| } | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Date date = new Date(); | |||
| @@ -775,6 +781,20 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return wxMerchantMapper.hasMerchant(wxMerchant) > 0 ? true : false; | |||
| } | |||
| @Override | |||
| public boolean hasMerchantEncode(WxMerchant wxMerchant) { | |||
| if(StringUtils.isBlank(wxMerchant.getEncode())){ | |||
| return true; | |||
| }else{ | |||
| return wxMerchantMapper.hasMerchant(wxMerchant) > 0 ? true : false; | |||
| } | |||
| } | |||
| @Override | |||
| public WxMerchant getMerchantByEncode(String encode){ | |||
| return wxMerchantMapper.getMerchantByEncode(encode); | |||
| } | |||
| @Override | |||
| public Optional<WxMerchant> findByName(String name) { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| @@ -90,7 +90,8 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| record.setSourceType(EnumThirdOrderType.RMB_PAY.getCode()); | |||
| //TODO 第三方获取门店(标识可能发生变化) | |||
| WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getShopNumber())); | |||
| // WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getShopNumber())); | |||
| WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getShopNumber()); | |||
| if(wxMerchant != null){ | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| }else{ | |||
| @@ -262,7 +263,8 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||
| record.setSourceType(EnumThirdOrderType.CREDIT_PAY.getCode()); | |||
| //TODO 第三方获取门店(标识可能发生变化) | |||
| WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getShopNumber())); | |||
| // WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getShopNumber())); | |||
| WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getShopNumber()); | |||
| if(wxMerchant != null){ | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| }else{ | |||
| @@ -7,6 +7,7 @@ | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
| <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="encode" jdbcType="VARCHAR" property="encode"/> | |||
| <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| @@ -41,13 +42,13 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | |||
| `id`,`tenant_id`,`parent_tenant_id`,`img_url`,`name`,`encode`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | |||
| `business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`, | |||
| `introduction`,`action_desc`,`is_del`,`talk_user_main`,`talk_user_aux`,link_line_phone,credit_locked,cash_out_number,cash_out_count,cash_out_last_time | |||
| </sql> | |||
| <sql id="allColumnsVo"> | |||
| m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`, | |||
| m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`, | |||
| m.`business_id`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`, | |||
| m.`introduction`,m.`action_desc`,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,r.rental_start_date,r.rental_end_date,m.cash_out_number,m.cash_out_count,m.cash_out_last_time | |||
| </sql> | |||
| @@ -70,6 +71,10 @@ | |||
| and `img_url` like concat('%', #{imgUrl},'%') | |||
| </if> | |||
| <if test=" null != encode and ''!=encode "> | |||
| and `encode` like concat('%', #{encode},'%') | |||
| </if> | |||
| <if test=" null != name and ''!=name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| @@ -216,6 +221,12 @@ | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </select> | |||
| <select id="getMerchantByEncode" parameterType="String" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_merchant where encode = #{encode} | |||
| </select> | |||
| <sql id="dataRule"> | |||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||
| @@ -261,6 +272,10 @@ | |||
| <if test=" null != name and '' != name "> | |||
| and m.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != encode and '' != encode "> | |||
| and m.`encode` like concat('%', #{encode},'%') | |||
| </if> | |||
| <if test=" null != linkPhone and '' != linkPhone "> | |||
| and m.`link_phone` like concat('%', #{linkPhone},'%') | |||
| @@ -353,7 +368,7 @@ | |||
| <sql id="allMerchantVoColumns"> | |||
| distinct m.id,m.img_url,m.name,m.link_phone,m.status,m.business_id, | |||
| distinct m.id,m.img_url,m.name,m.encode,m.link_phone,m.status,m.business_id, | |||
| m.is_public,m.email,m.title,m.cover_picture,m.sub_business_id, | |||
| m.shop_type,m.introduction,m.action_desc,bu.title as business_name,m.link_line_phone,m.top_time | |||
| </sql> | |||
| @@ -383,6 +398,7 @@ | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/> | |||
| <result column="name" jdbcType="VARCHAR" property="merchantName"/> | |||
| <result column="encode" jdbcType="VARCHAR" property="merchantEncode"/> | |||
| <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/> | |||
| <result column="status" jdbcType="VARCHAR" property="merchantStatus"/> | |||
| <result column="business_id" jdbcType="INTEGER" property="businessId"/> | |||
| @@ -509,6 +525,13 @@ | |||
| and `id` != #{id} | |||
| </if> | |||
| </select> | |||
| <select id="hasMerchantEncode" parameterType="com.iformall.domain.po.WxMerchant" resultType="int"> | |||
| select count(*) from wx_merchant where `encode`=#{encode} | |||
| <if test=" null != id"> | |||
| and `id` != #{id} | |||
| </if> | |||
| </select> | |||
| <update id="updateCreditLocked" parameterType="com.iformall.domain.po.WxMerchant"> | |||
| update wx_merchant set credit_locked = #{creditLocked} where tenant_id = #{tenantId} | |||
| @@ -516,7 +539,7 @@ | |||
| <select id="userTradeList" parameterType="com.iformall.domain.po.WxMerchant" resultType="com.iformall.domain.vo.WxMerchantTradeVo"> | |||
| SELECT m.id, m.`img_url` cover, m.`name` merchantName, m.`link_person` linkName, | |||
| SELECT m.id, m.`img_url` cover, m.`name` merchantName,m.`encode` merchantEncode, m.`link_person` linkName, | |||
| ifnull(consume.consumeCount,0) consumeCount,ifnull(consume.consumeCountP,0) as consumeCountP, | |||
| ifnull(consume.tradeAmt,0) tradeAmt | |||
| FROM wx_merchant m | |||