| @@ -11,6 +11,7 @@ import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.WxBrand; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.enums.EnumDelFlag; | |||
| import com.iformall.enums.EnumMerchantAdmin; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.WxBrandService; | |||
| import com.iformall.service.WxMerchantService; | |||
| @@ -81,7 +82,7 @@ public class WxBrandController extends BaseController { | |||
| // wxMerchant.updateTenantInfo(wxBrand); | |||
| wxMerchant.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| wxMerchant.setBrand(wxBrand.getId()); | |||
| wxMerchant.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| List<WxMerchant> merchantList = wxMerchantService.findList(wxMerchant); | |||
| if(CollectionUtils.isNotEmpty(merchantList)){ | |||
| return new ResultData(Result.ERROR, "请先删除已绑定该品牌的商户。"); | |||
| @@ -213,6 +213,7 @@ public class WxMerchantController extends BaseController { | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setType(type); | |||
| wxMerchant.setCarVendorType(0); | |||
| wxMerchant.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| return new ResultData(wxMerchantService.queryIdAndNames(wxMerchant)); | |||
| } | |||
| @@ -9,10 +9,7 @@ import com.iformall.domain.po.WxBusiness; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.vo.WxBusinessDataVo; | |||
| import com.iformall.enums.EnumCouponContentType; | |||
| import com.iformall.enums.EnumCouponSourceType; | |||
| import com.iformall.enums.EnumRentContractAppStatus; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxBusinessService; | |||
| import com.iformall.service.WxMerchantService; | |||
| @@ -116,6 +113,7 @@ public class WxBusinessController extends BaseController { | |||
| WxMerchant merchantQ = new WxMerchant(); | |||
| merchantQ.updateTenantInfo(tenantEntity); | |||
| merchantQ.setBusinessId(b.getId()); | |||
| merchantQ.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| List<WxMerchant> merchantList = wxMerchantService.findList(merchantQ); | |||
| if (null != merchantList && merchantList.size() > 0 ) { | |||
| return new ResultData(Result.ERROR,"存在已关联的商户,不能删除"); | |||
| @@ -124,6 +122,7 @@ public class WxBusinessController extends BaseController { | |||
| WxMerchant merchantsubQ = new WxMerchant(); | |||
| merchantsubQ.updateTenantInfo(tenantEntity); | |||
| merchantsubQ.setSubBusinessId(b.getId()); | |||
| merchantsubQ.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| List<WxMerchant> merchantSubList = wxMerchantService.findList(merchantsubQ); | |||
| if (null != merchantSubList && merchantSubList.size() > 0 ) { | |||
| return new ResultData(Result.ERROR,"存在已关联的商户,不能删除"); | |||
| @@ -4,6 +4,7 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxMerchantProductVo; | |||
| import com.iformall.enums.EnumDateAmtType; | |||
| import com.iformall.enums.EnumMerchantAdmin; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.WxDateAmountRecordService; | |||
| @@ -151,6 +152,7 @@ public class DaliyAmountSchedule { | |||
| WxMerchant merchantQ = new WxMerchant(); | |||
| merchantQ.updateTenantInfo(mall.getTenantInfo()); | |||
| merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| merchantQ.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| List<WxMerchant> merchantList = wxMerchantMapper.findList(merchantQ); | |||
| if (merchantList.size()==0) { | |||
| @@ -285,6 +285,9 @@ public class WxMerchant extends TenantEntity { | |||
| private String coverPicture; | |||
| @io.swagger.annotations.ApiModelProperty(value="EnumMerchantAdmin",name="isAdmin") | |||
| private Integer isAdmin; | |||
| @TableField(exist = false) | |||
| private List<Integer> adminTypes; | |||
| @io.swagger.annotations.ApiModelProperty(value = "置顶时间", name = "topTime") | |||
| private Date topTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="微信二维码地址",name="qrCode") | |||
| @@ -1,5 +1,8 @@ | |||
| package com.iformall.enums; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| @@ -36,4 +39,11 @@ public enum EnumMerchantAdmin { | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| public static List<Integer> getOrdinaryTypes(){ | |||
| List<Integer> adminTypes = new ArrayList(); | |||
| adminTypes.add(PUBLIC_COMMON.code); | |||
| adminTypes.add(PUBLIC_ADMIN.code); | |||
| return adminTypes; | |||
| } | |||
| } | |||
| @@ -170,6 +170,7 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(tenantEntity); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| List<WxMerchant> merchants = wxMerchantMapper.findList(wxMerchant); | |||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| @@ -2716,6 +2716,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(tenantEntity); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| List<WxMerchant> merchants = wxMerchantMapper.findList(wxMerchant); | |||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| wxMerchantTradeDaily.updateTenantInfo(tenantEntity); | |||
| @@ -52,8 +52,10 @@ public class WxCouponOrderReservationServiceImpl implements WxCouponOrderReserva | |||
| if(EnumMerchantAdmin.REGIONAL.getCode().equals(merchant.getIsAdmin())){ | |||
| //通过区域商户id查询所有子商户 | |||
| List<Long> collect = wxMerchantRelationService.getRelationByRegionId(merchant.getId()); | |||
| if (!CollectionUtils.isEmpty(collect)){ | |||
| if (collect != null && collect.size() > 0){ | |||
| record.setReservationMerchantIdList(collect); | |||
| }else{ | |||
| record.setId(-999L); | |||
| } | |||
| record.setReservationMerchantId(null); | |||
| } | |||
| @@ -162,6 +162,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public PageInfo<WxMerchant> listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { | |||
| if(record.getIsAdmin() == null){ | |||
| record.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| } | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); | |||
| } | |||
| @@ -288,6 +291,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public List<Long> findIdList(WxMerchant record) { | |||
| if(record == null){ | |||
| record.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| } | |||
| return wxMerchantMapper.findIdList(record); | |||
| } | |||
| @@ -307,6 +313,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxMerchant.updateTenantInfo(tenantEntity); | |||
| wxMerchant.setIsPrivate(EnumYesOrNo.NO.getCode()); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| List<WxMerchant> wxMerchantList = wxMerchantMapper.findList(wxMerchant); | |||
| List<WxMerchantSimpleVo> collect = wxMerchantList.stream().map(x -> { | |||
| WxMerchantSimpleVo wxMerchantSimpleVo = new WxMerchantSimpleVo(); | |||
| @@ -575,6 +582,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| if(wxMerchant.getIsAdmin() == null) { | |||
| wxMerchant.setIsAdmin(EnumMerchantAdmin.PUBLIC_COMMON.getCode()); | |||
| } | |||
| if(EnumMerchantAdmin.REGIONAL.getCode().equals(wxMerchant.getIsAdmin())){ | |||
| wxMerchant.setIsPublic(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| wxMerchant.setUpdateDate(date); | |||
| wxMerchant.setCreateDate(date); | |||
| if (StringUtils.isNotBlank(wxMerchant.getCoverPicture())) { | |||
| @@ -1013,6 +1023,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public void exportData(WxMerchant wxMerchant, HttpServletRequest request, HttpServletResponse response) { | |||
| if(wxMerchant.getIsAdmin() == null){ | |||
| wxMerchant.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| } | |||
| List<WxMerchant> list = wxMerchantMapper.findList(wxMerchant); | |||
| WxBusiness bq = new WxBusiness(); | |||
| @@ -1145,6 +1159,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| private void initQueryParam(WxMerchant record,boolean hasRentContractInfo,Map<Long,WxRentContract> merchantRentMap) { | |||
| if(record.getIsAdmin() == null){ | |||
| record.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| } | |||
| if (hasRentContractInfo) { | |||
| WxRentContract wxRentContractQ = new WxRentContract(); | |||
| wxRentContractQ.updateTenantInfo(record); | |||
| @@ -1522,16 +1540,23 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| return findCouponMerchantVoList(couponIds, mallTenantEntity, null, hasShop); | |||
| } | |||
| private Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity mallTenantEntity,TtMerchantPoi poiQ,boolean hasShop) { | |||
| private Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity mallTenantEntity,List<Long> poiMerchantIds,boolean hasShop) { | |||
| Map<Long,List<WxMerchantVo>> retMap = new HashMap<Long,List<WxMerchantVo>>(); | |||
| if (null == couponIds || couponIds.size() <= 0) { | |||
| return retMap; | |||
| } | |||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(mallTenantEntity.getTenantId(), couponIds); | |||
| if(null != merchantIds && merchantIds.size() > 0 ) { | |||
| if (null == poiQ) { | |||
| poiQ = new TtMerchantPoi(); | |||
| List<Long> productMerchantIds = wxCouponMerchantMapper.findMerchantByProductIds(mallTenantEntity.getTenantId(), couponIds); | |||
| if(null != productMerchantIds && productMerchantIds.size() > 0 ) { | |||
| List<Long> merchantIds = null; | |||
| if (null != poiMerchantIds && poiMerchantIds.size() > 0 ){ | |||
| //取交集 | |||
| merchantIds = (List<Long>) CollectionUtils.intersection(poiMerchantIds, productMerchantIds); | |||
| } | |||
| if (null == merchantIds) { | |||
| return retMap; | |||
| } | |||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | |||
| poiQ.updateTenantInfo(mallTenantEntity); | |||
| poiQ.setIds(merchantIds); | |||
| List<TtMerchantPoi> poiList = ttMerchantPoiMapper.findList(poiQ); | |||
| @@ -1642,9 +1667,15 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| public List<WxMerchantVo> findMerchantVoList(Long couponId,String city,TenantEntity tenantEntity,boolean hasShop) { | |||
| List<Long> couponIds = new ArrayList<Long>(); | |||
| couponIds.add(couponId); | |||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | |||
| poiQ.setCity(city); | |||
| Map<Long,List<WxMerchantVo>> couponMerchantVoList = findCouponMerchantVoList(couponIds,tenantEntity,poiQ,hasShop); | |||
| List<Long> poiMerchantIds = null; | |||
| if (StringUtils.isNotBlank(city)) { | |||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | |||
| poiQ.setCity(city); | |||
| poiQ.updateTenantInfo(tenantEntity); | |||
| poiMerchantIds = ttMerchantPoiMapper.findIdList(poiQ); | |||
| } | |||
| Map<Long,List<WxMerchantVo>> couponMerchantVoList = findCouponMerchantVoList(couponIds,tenantEntity,poiMerchantIds,hasShop); | |||
| if (null != couponMerchantVoList) { | |||
| return couponMerchantVoList.get(couponId); | |||
| } | |||
| @@ -2030,6 +2061,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| wxMerchant.setTenantId(tenantEntity.getFinalTenantId()); | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchant.setBrand(brand); | |||
| wxMerchant.setAdminTypes(EnumMerchantAdmin.getOrdinaryTypes()); | |||
| List<WxMerchant> list = findList(wxMerchant); | |||
| if(list.size() > 0){ | |||
| return list.get(0); | |||
| @@ -168,6 +168,12 @@ | |||
| <if test=" null != creditLocked "> | |||
| and m.`credit_locked` = #{creditLocked} | |||
| </if> | |||
| <if test=" null != adminTypes and adminTypes.size > 0"> | |||
| and m.`is_admin` in | |||
| <foreach collection="adminTypes" index="index" item="typeItem" open="(" separator="," close=")"> | |||
| #{typeItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and m.id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||