| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE `mallink`.`wx_merchant` | |||
| ADD COLUMN `is_private` smallint(2) DEFAULT 0 AFTER `is_public`; | |||
| @@ -56,10 +56,7 @@ public class WxCreditHistoryController extends BaseController { | |||
| @ApiImplicitParam(name = "userId", value = "会员Id", dataType = "long", paramType = "query", required = true)}) | |||
| public ResultData findByMerchantIdAndSpend(Long merchantId, String spendStr,Long userId) { | |||
| log.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend"); | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setStatus(EnumYesOrNo.YES.getCode()); | |||
| wxMerchant.setId(getLoginBUser().getMerchantId()); | |||
| wxMerchant = wxMerchantService.findOne(wxMerchant); | |||
| WxMerchant wxMerchant = wxMerchantService.selectById(getLoginBUser().getMerchantId()); | |||
| //普通商户只允许查询自己的消费金额所增加的积分 | |||
| if (EnumMerchantAdmin.PUBLIC_COMMON.getCode().equals(wxMerchant.getIsAdmin()) | |||
| && merchantId.longValue() != getLoginBUser().getMerchantId().longValue()) { | |||
| @@ -102,11 +99,9 @@ public class WxCreditHistoryController extends BaseController { | |||
| wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId()); | |||
| wxCreditHistory.setFinalTenantId(getTenantInfo().getFinalTenantId()); | |||
| wxCreditHistory.setOperatorId(getLoginBUser().getId()); | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setId(getLoginBUser().getMerchantId()); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| WxMerchant merchant = wxMerchantService.findOne(wxMerchant); | |||
| if(merchant == null){ | |||
| WxMerchant merchant = wxMerchantService.selectById(getLoginBUser().getMerchantId()); | |||
| if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND); | |||
| } | |||
| //消费积分:取当前人的商户ID | |||
| @@ -139,9 +139,7 @@ public class WxMerchantController extends BaseController { | |||
| // hasPermission | |||
| WxMerchantBUser user = getLoginBUser(); | |||
| CUser buser = getCUser(); | |||
| WxMerchant merchant = new WxMerchant(); | |||
| merchant.setId(user.getMerchantId()); | |||
| WxMerchant wxMerchant = wxMerchantService.findOne(merchant); | |||
| WxMerchant wxMerchant = wxMerchantService.selectById(user.getMerchantId()); | |||
| if ( wxMerchant != null && buser.getPhone().equals(wxMerchant.getLinkPhone()) ) { | |||
| if (StringUtils.isBlank(phone)) { | |||
| phone = wxMerchant.getLinkPhone(); | |||
| @@ -207,9 +205,7 @@ public class WxMerchantController extends BaseController { | |||
| public boolean hasPermission() { | |||
| WxMerchantBUser user = getLoginBUser(); | |||
| CUser buser = getCUser(); | |||
| WxMerchant merchant = new WxMerchant(); | |||
| merchant.setId(user.getMerchantId()); | |||
| WxMerchant wxMerchant = wxMerchantService.findOne(merchant); | |||
| WxMerchant wxMerchant = wxMerchantService.selectById(user.getMerchantId()); | |||
| return wxMerchant != null && wxMerchant.getLinkPhone().equals(buser.getPhone()); | |||
| } | |||
| @@ -142,7 +142,7 @@ public interface WxMerchantService { | |||
| WxMerchantVo findMerchantById(TenantEntity tenantEntity,Long id); | |||
| WxMerchant findOne(WxMerchant wxMerchant); | |||
| WxMerchant findListOne(WxMerchant wxMerchant); | |||
| void exportData(WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response); | |||
| @@ -2658,7 +2658,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(tenantEntity); | |||
| wxMerchant.setStatus(1); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| List<WxMerchant> merchants = wxMerchantMapper.findList(wxMerchant); | |||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| wxMerchantTradeDaily.updateTenantInfo(tenantEntity); | |||
| @@ -900,8 +900,8 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| private int spendCredit(WxCreditHistory record) { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setStatus(1); | |||
| wxMerchant.setId(record.getMerchantId()); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| List<WxMerchant> wxMerchantList = wxMerchantMapper.findList(wxMerchant); | |||
| if (wxMerchantList == null || wxMerchantList.size() == 0) { | |||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| @@ -153,6 +153,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | |||
| if(record.getIsPrivate() == null){ | |||
| record.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | |||
| } | |||
| @@ -272,6 +275,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public List<WxMerchant> findList(WxMerchant record) { | |||
| if(record.getIsPrivate() == null){ | |||
| record.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| return wxMerchantMapper.findList(record); | |||
| } | |||
| @@ -279,6 +285,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| public List<WxMerchantSimpleVo> findList(TenantEntity tenantEntity) { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(tenantEntity); | |||
| if(wxMerchant.getIsPrivate() == null){ | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| List<WxMerchant> wxMerchantList = wxMerchantMapper.findList(wxMerchant); | |||
| List<WxMerchantSimpleVo> collect = wxMerchantList.stream().map(x -> { | |||
| @@ -919,12 +928,19 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| @Override | |||
| public WxMerchant findOne(WxMerchant wxMerchant) { | |||
| return wxMerchantMapper.selectOne(new QueryWrapper(wxMerchant)); | |||
| public WxMerchant findListOne(WxMerchant wxMerchant) { | |||
| List<WxMerchant> list = wxMerchantMapper.findList(wxMerchant); | |||
| if(list != null && !list.isEmpty()){ | |||
| list.get(0); | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public void exportData(WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response) { | |||
| if(wxMerchant.getIsPrivate() == null){ | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| List<WxMerchant> list = wxMerchantMapper.findList(wxMerchant); | |||
| list.stream().forEach(m->{ | |||
| @@ -1167,6 +1183,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public PageInfo<WxMerchant> listVoAsPage(WxMerchant record, Integer pageIndex, Integer pageSize,boolean hasRentContractInfo) { | |||
| if(record.getIsPrivate() == null){ | |||
| record.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| Map<Long,WxRentContract> merchantRentMap = new HashMap<Long,WxRentContract>(); | |||
| initQueryParam(record,hasRentContractInfo, merchantRentMap); | |||
| PageInfo<WxMerchant> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | |||
| @@ -23,6 +23,7 @@ | |||
| <result column="brand" jdbcType="VARCHAR" property="brand"/> | |||
| <result column="type" jdbcType="SMALLINT" property="type"/> | |||
| <result column="is_public" jdbcType="SMALLINT" property="isPublic"/> | |||
| <result column="is_private" jdbcType="SMALLINT" property="isPrivate"/> | |||
| <result column="email" jdbcType="VARCHAR" property="email"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/> | |||
| @@ -50,7 +51,7 @@ | |||
| <sql id="allColumns"> | |||
| 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.`business_types`,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.`tt_qr_code`, | |||
| m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.`is_private`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`, | |||
| m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked,m.entry_amount,m.cash_out_count,m.cash_out_last_time | |||
| </sql> | |||
| @@ -132,6 +133,9 @@ | |||
| <if test=" null != isPublic "> | |||
| and m.`is_public` = #{isPublic} | |||
| </if> | |||
| <if test=" null != isPrivate "> | |||
| and m.`is_private` = #{isPrivate} | |||
| </if> | |||
| <if test=" null != email "> | |||
| and m.`email` = #{email} | |||
| </if> | |||
| @@ -256,6 +260,9 @@ | |||
| <if test=" null != isPublic"> | |||
| and m.`is_public` = #{isPublic} | |||
| </if> | |||
| <if test=" null != isPrivate"> | |||
| and m.`is_private` = #{isPrivate} | |||
| </if> | |||
| <if test=" null != id"> | |||
| and m.`id` = #{id} | |||
| @@ -377,7 +384,7 @@ | |||
| <select id="findShopMerchant" parameterType="Long" resultType="hashmap"> | |||
| select | |||
| 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.`business_types`,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.`tt_qr_code`, | |||
| m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.`is_private`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`, | |||
| m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked | |||
| from wx_merchant m where m.id = #{id} | |||
| </select> | |||
| @@ -386,7 +393,7 @@ | |||
| select | |||
| m.`id`,m.`tenant_id` tenantId,m.`parent_tenant_id` parentTenantId,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.`business_types`,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.`tt_qr_code`, | |||
| m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.`is_private`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`, | |||
| m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked | |||
| from wx_merchant m where m.id = #{id} and m.is_del = 0 | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||