| @@ -21,6 +21,7 @@ import com.iformall.domain.vo.GaoDePoiInfo; | |||||
| import com.iformall.domain.vo.MerchantPoiT; | import com.iformall.domain.vo.MerchantPoiT; | ||||
| import com.iformall.domain.vo.MerchantPoiTNew; | import com.iformall.domain.vo.MerchantPoiTNew; | ||||
| import com.iformall.domain.vo.WxCardPriceTemplate; | import com.iformall.domain.vo.WxCardPriceTemplate; | ||||
| import com.iformall.enums.EnumMerchantCreateFrom; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.TtMerchantPoiService; | import com.iformall.service.TtMerchantPoiService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| @@ -306,7 +307,7 @@ public class AsyncTask { | |||||
| } | } | ||||
| } | } | ||||
| private static final String[] poiImportFields = new String[]{"门店名称", "门店ID", "城市", "详细地址","管理员手机号","富茂系统商户ID", "富茂系统商户名称","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注","POI导入日志"}; | |||||
| private static final String[] poiImportFields = new String[]{"门店名称", "门店ID", "城市", "详细地址","管理员手机号","富茂系统商户ID", "富茂系统商户名称","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","初始化商户日志","高德匹配备注","POI导入日志"}; | |||||
| public void exportExcelPoiDataAddLocationForNew(TenantEntity tenantEntity,String gaodeKey,File file,HttpServletRequest request, HttpServletResponse response) throws Exception { | public void exportExcelPoiDataAddLocationForNew(TenantEntity tenantEntity,String gaodeKey,File file,HttpServletRequest request, HttpServletResponse response) throws Exception { | ||||
| ImportParams params = new ImportParams(); | ImportParams params = new ImportParams(); | ||||
| @@ -435,35 +436,68 @@ public class AsyncTask { | |||||
| } | } | ||||
| @Async | @Async | ||||
| public void importMerchantInit(boolean isAllNew,File file, MallUserInfo user, String importKey,HttpServletRequest request, HttpServletResponse response) { | |||||
| public void importMerchantInit(File file, MallUserInfo user, String importKey,HttpServletRequest request, HttpServletResponse response) { | |||||
| // 需要验证 | // 需要验证 | ||||
| String[] needFields = new String[]{"门店名称", "门店ID", "城市", "详细地址"}; | String[] needFields = new String[]{"门店名称", "门店ID", "城市", "详细地址"}; | ||||
| ExcelImportResult<MerchantPoiTNew> datalist = handleImportFile(null,file,MerchantPoiTNew.class,poiImportFields,needFields,new AsyncTask.PoiNewExcelHandler()); | ExcelImportResult<MerchantPoiTNew> datalist = handleImportFile(null,file,MerchantPoiTNew.class,poiImportFields,needFields,new AsyncTask.PoiNewExcelHandler()); | ||||
| if (null == datalist) { | if (null == datalist) { | ||||
| return ; | return ; | ||||
| } | } | ||||
| //如果不是覆盖,则查询商户中 | |||||
| //查询所有匹配了poi的 | |||||
| //查询所有来客创建的商户 | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(user); | |||||
| merchantQ.setCreateFrom(EnumMerchantCreateFrom.DOUYIN_LAIKE.getCode()); | |||||
| Map<String, WxMerchant> createMerchantMap = wxMerchantService.findMerchantMapByCreateFromId(merchantQ); | |||||
| if (null == createMerchantMap) { | |||||
| createMerchantMap = new HashMap<String, WxMerchant>(); | |||||
| } | |||||
| //查询所有已经匹配了poi的商户 | |||||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | TtMerchantPoi poiQ = new TtMerchantPoi(); | ||||
| poiQ.updateTenantInfo(user); | poiQ.updateTenantInfo(user); | ||||
| Map<String,TtMerchantPoi> poiMerchantMap = ttMerchantPoiService.queryPoiMerchantMap(poiQ); | Map<String,TtMerchantPoi> poiMerchantMap = ttMerchantPoiService.queryPoiMerchantMap(poiQ); | ||||
| if (null == poiMerchantMap) { | |||||
| poiMerchantMap = new HashMap<String,TtMerchantPoi>(); | |||||
| } | |||||
| List<MerchantPoiTNew> successList = datalist.getList(); | List<MerchantPoiTNew> successList = datalist.getList(); | ||||
| if(successList.size() > 0) { | if(successList.size() > 0) { | ||||
| try { | try { | ||||
| successList.parallelStream().forEach(poiBase -> { | |||||
| try { | |||||
| if (null != poiMerchantMap) { | |||||
| TtMerchantPoi tp = poiMerchantMap.get(poiBase.getPoiId()); | |||||
| if (null != tp && ) { | |||||
| } | |||||
| } | |||||
| wxMerchantService.initMerchantByPoi(poiBase.getPoiName(), poiBase.getPoiId()); | |||||
| for (int i = 0 ; i < successList.size(); i ++) { | |||||
| try { | |||||
| MerchantPoiTNew poiBase = successList.get(i); | |||||
| WxMerchant createM = createMerchantMap.get(poiBase.getPoiId()); | |||||
| boolean create = true; | |||||
| if (null != createM ) { | |||||
| create = false; | |||||
| if (createM.getId() > 0 ) { | |||||
| poiBase.setMerchantId(String.valueOf(createM.getId())); | |||||
| poiBase.setMerchantName(createM.getName()); | |||||
| poiBase.setInitMerchantRemark("已存在该POI创建的商户,无需重复创建"); | |||||
| }else { | |||||
| poiBase.setMerchantName(createM.getName()); | |||||
| poiBase.setInitMerchantRemark("初始化商户失败,已存在多个该POI创建的商户"); | |||||
| } | |||||
| }else { | |||||
| TtMerchantPoi poi = poiMerchantMap.get(poiBase.getPoiId()); | |||||
| if (null != poi) { | |||||
| create = false; | |||||
| if (poi.getId() > 0 ) { | |||||
| poiBase.setMerchantId(String.valueOf(poi.getId())); | |||||
| poiBase.setMerchantName(poi.getPoiName()); | |||||
| poiBase.setInitMerchantRemark("已存在该POI创建的商户,无需重复创建"); | |||||
| }else { | |||||
| poiBase.setMerchantName(poi.getPoiName()); | |||||
| poiBase.setInitMerchantRemark("初始化商户失败,该POI匹配了多个商户"); | |||||
| } | |||||
| } | |||||
| } | |||||
| if (create) { | |||||
| wxMerchantService.initMerchantByPoi(poiBase.getPoiName(), poiBase.getPoiId()); | |||||
| } | |||||
| } catch (UnknownSessionException ue) { | } catch (UnknownSessionException ue) { | ||||
| logger.error("session :"+ue.getMessage(),ue); | logger.error("session :"+ue.getMessage(),ue); | ||||
| } | } | ||||
| }); | |||||
| } | |||||
| stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); | stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); | ||||
| exportExcel(request, response, successList,MerchantPoiTNew.class, "POI导入-结果.xlsx"); | exportExcel(request, response, successList,MerchantPoiTNew.class, "POI导入-结果.xlsx"); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -0,0 +1,2 @@ | |||||
| alter table wx_merchant add column create_from int(1) NOT NULL DEFAULT 1 COMMENT '创建来源EnumMerchantCreateFrom' ; | |||||
| alter table wx_merchant add column create_from_id varchar(100) COMMENT '创建来源编号' ; | |||||
| @@ -150,6 +150,12 @@ public class WxMerchant extends TenantEntity { | |||||
| // @Excel(name = "辅谈人", width = 20, orderNum = "17") | // @Excel(name = "辅谈人", width = 20, orderNum = "17") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "辅谈人", name = "talkUserAux") | @io.swagger.annotations.ApiModelProperty(value = "辅谈人", name = "talkUserAux") | ||||
| private String talkUserAux; | private String talkUserAux; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "创建来源EnumMerchantCreateFrom", name = "createFrom") | |||||
| private Integer createFrom; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "创建来源Id", name = "createFromId") | |||||
| private String createFromId; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "startTime") | @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "startTime") | ||||
| @@ -48,10 +48,13 @@ public class MerchantPoiTNew implements Serializable { | |||||
| @Excel(name = "富茂系统纬度", width = 20, orderNum = "12") | @Excel(name = "富茂系统纬度", width = 20, orderNum = "12") | ||||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统纬度",name="latitude") | @io.swagger.annotations.ApiModelProperty(value="富茂系统纬度",name="latitude") | ||||
| private BigDecimal latitude; | private BigDecimal latitude; | ||||
| @Excel(name = "高德匹配备注", width = 20, orderNum = "13") | |||||
| @Excel(name = "初始化商户日志", width = 20, orderNum = "13") | |||||
| @io.swagger.annotations.ApiModelProperty(value="初始化商户日志",name="initMerchantRemark") | |||||
| private String initMerchantRemark; | |||||
| @Excel(name = "高德匹配备注", width = 20, orderNum = "14") | |||||
| @io.swagger.annotations.ApiModelProperty(value="高德匹配备注",name="gaodeRemark") | @io.swagger.annotations.ApiModelProperty(value="高德匹配备注",name="gaodeRemark") | ||||
| private String gaodeRemark; | private String gaodeRemark; | ||||
| @Excel(name = "POI导入日志", width = 20, orderNum = "14") | |||||
| @Excel(name = "POI导入日志", width = 20, orderNum = "15") | |||||
| @io.swagger.annotations.ApiModelProperty(value="POI导入日志",name="importRemark") | @io.swagger.annotations.ApiModelProperty(value="POI导入日志",name="importRemark") | ||||
| private String importRemark; | private String importRemark; | ||||
| } | } | ||||
| @@ -0,0 +1,36 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumMerchantCreateFrom { | |||||
| CREATE(1, "手动创建"), | |||||
| DOUYIN_LAIKE(2, "抖音来客"); | |||||
| public static EnumMerchantCreateFrom getEnum(Integer code) { | |||||
| for (EnumMerchantCreateFrom value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumMerchantCreateFrom(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -215,6 +215,7 @@ public interface WxMerchantService { | |||||
| WxMerchant findBrandAdmin(TenantEntity tenantEntity, Long brandId); | WxMerchant findBrandAdmin(TenantEntity tenantEntity, Long brandId); | ||||
| Map<Long, WxMerchant> findMerchantMap(WxMerchant merchantQ); | Map<Long, WxMerchant> findMerchantMap(WxMerchant merchantQ); | ||||
| Map<String,WxMerchant> findMerchantMapByCreateFromId(WxMerchant merchantQ); | |||||
| WxMerchant findParkMerchant(WxPark wxPark); | WxMerchant findParkMerchant(WxPark wxPark); | ||||
| @@ -2087,6 +2087,33 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| return merchantMap; | return merchantMap; | ||||
| } | } | ||||
| @Override | |||||
| public Map<String, WxMerchant> findMerchantMapByCreateFromId(WxMerchant merchantQ) { | |||||
| List<WxMerchant> list = this.findList(merchantQ); | |||||
| if(null != list){ | |||||
| Map<String,WxMerchant> merchantMap = new HashMap<>(); | |||||
| for (int i = 0 ; i < list.size(); i++ ){ | |||||
| WxMerchant m = list.get(i); | |||||
| if (StringUtils.isNotBlank(m.getCreateFromId())) { | |||||
| WxMerchant cm = merchantMap.get(m.getCreateFromId()); | |||||
| if (null != cm) { | |||||
| WxMerchant _m = new WxMerchant(); | |||||
| _m.setId(-1L); | |||||
| _m.setName("该编码已创建了多个商户"); | |||||
| merchantMap.put(m.getCreateFromId(), _m); | |||||
| }else { | |||||
| merchantMap.put(m.getCreateFromId(), m); | |||||
| } | |||||
| } | |||||
| } | |||||
| if (merchantMap.size() > 0 ){ | |||||
| return merchantMap; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @Override | @Override | ||||
| public WxMerchant findParkMerchant(WxPark wxPark) { | public WxMerchant findParkMerchant(WxPark wxPark) { | ||||
| @@ -48,12 +48,16 @@ | |||||
| <result column="cash_out_number" jdbcType="INTEGER" property="cashOutNumber"/> | <result column="cash_out_number" jdbcType="INTEGER" property="cashOutNumber"/> | ||||
| <result column="cash_out_count" jdbcType="INTEGER" property="cashOutCount"/> | <result column="cash_out_count" jdbcType="INTEGER" property="cashOutCount"/> | ||||
| <result column="cash_out_last_time" jdbcType="TIMESTAMP" property="cashOutLastTime"/> | <result column="cash_out_last_time" jdbcType="TIMESTAMP" property="cashOutLastTime"/> | ||||
| <result column="create_from" jdbcType="INTEGER" property="createFrom"/> | |||||
| <result column="create_from_id" jdbcType="VARCHAR" property="createFromId"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <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.`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.`is_private`,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.search_card_by_phone,m.credit_locked,m.credit_locked,m.entry_amount,m.cash_out_count,m.cash_out_last_time | |||||
| 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.search_card_by_phone,m.credit_locked,m.credit_locked,m.entry_amount,m.cash_out_count, | |||||
| m.cash_out_last_time,m.create_from,m.create_from_id | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -168,6 +172,15 @@ | |||||
| <if test=" null != creditLocked "> | <if test=" null != creditLocked "> | ||||
| and m.`credit_locked` = #{creditLocked} | and m.`credit_locked` = #{creditLocked} | ||||
| </if> | </if> | ||||
| <if test=" null != createFrom "> | |||||
| and m.`create_from` = #{createFrom} | |||||
| </if> | |||||
| <if test=" null != createFromId and '' != createFromId"> | |||||
| and m.`create_from_id` = #{createFromId} | |||||
| </if> | |||||
| <if test=" null != adminTypes and adminTypes.size > 0"> | <if test=" null != adminTypes and adminTypes.size > 0"> | ||||
| and m.`is_admin` in | and m.`is_admin` in | ||||
| <foreach collection="adminTypes" index="index" item="typeItem" open="(" separator="," close=")"> | <foreach collection="adminTypes" index="index" item="typeItem" open="(" separator="," close=")"> | ||||