| @@ -0,0 +1,107 @@ | |||
| package com.iformall.controller.basic; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.enums.EnumSupplierMathStatus; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("merchantPoi") | |||
| public class TtMerchantPoiController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private TtMerchantPoiService ttMerchantPoiService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "列表") | |||
| public ResultData list(@ModelAttribute TtMerchantPoi record, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::list"); | |||
| if (null == record) record = new TtMerchantPoi(); | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
| final PageInfo<TtMerchantPoi> page = ttMerchantPoiService.listAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "查询") | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::findById"); | |||
| if(id == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| TtMerchantPoi record = ttMerchantPoiService.getById(id); | |||
| return new ResultData(record); | |||
| } | |||
| @ApiOperation("更新商户接口") | |||
| @PostMapping("updateById") | |||
| @SystemControllerLog(description = "更新") | |||
| public ResultData updateById(@RequestBody TtMerchantPoi record) { | |||
| logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::updateById"); | |||
| if(record.getId() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| TtMerchantPoi merchantPoi = ttMerchantPoiService.getById(record.getId()); | |||
| if(merchantPoi == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到修改的数据"); | |||
| } | |||
| if(!EnumSupplierMathStatus.match_update.getCode().equals(merchantPoi.getMatchStatus()) | |||
| && !EnumSupplierMathStatus.match_fail.getCode().equals(merchantPoi.getMatchStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该状态不允许修改"); | |||
| } | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| ttMerchantPoiService.updateById(record); | |||
| return new ResultData(record); | |||
| } | |||
| @ApiOperation("新建匹配任务") | |||
| @PostMapping("match") | |||
| @SystemControllerLog(description = "新建匹配任务") | |||
| public ResultData match(@RequestBody List<Long> ids) { | |||
| logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::match"); | |||
| if(ids == null || ids.isEmpty()){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| return ttMerchantPoiService.match(getTenantInfo(),ids); | |||
| } | |||
| @ApiOperation("重新匹配任务") | |||
| @PostMapping("matchAgain") | |||
| @SystemControllerLog(description = "重新匹配任务") | |||
| public ResultData matchAgain(@RequestBody Long id) { | |||
| logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::matchAgain"); | |||
| if(id == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| return ttMerchantPoiService.matchAgain(getTenantInfo(),id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,63 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| @TableName(value = "tt_merchant_poi") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class TtMerchantPoi extends TenantEntity { | |||
| protected Long id;//merchant_id | |||
| @io.swagger.annotations.ApiModelProperty(value=" merchant_id",name="supplierExtId") | |||
| private String supplierExtId; | |||
| @io.swagger.annotations.ApiModelProperty(value="poi名称 商户名",name="poiName") | |||
| private String poiName; | |||
| @io.swagger.annotations.ApiModelProperty(value="省",name="province") | |||
| private String province; | |||
| @io.swagger.annotations.ApiModelProperty(value="市",name="city") | |||
| private String city; | |||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="address") | |||
| private String address; | |||
| @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") | |||
| private Float longitude; | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| private Float latitude; | |||
| @io.swagger.annotations.ApiModelProperty(value="高德POI ID",name="amapId") | |||
| private String amapId; | |||
| @io.swagger.annotations.ApiModelProperty(value="其他信息",name="extra") | |||
| private String extra; | |||
| @io.swagger.annotations.ApiModelProperty(value="高德POI ID/抖音POIID",name="poiId") | |||
| private String poiId; | |||
| @io.swagger.annotations.ApiModelProperty(value="抖音平台任务ID",name="taskId") | |||
| private String taskId; | |||
| @io.swagger.annotations.ApiModelProperty(value="匹配状态,0-等待匹配,1-正在匹配,2-匹配成功,3-匹配失败",name="matchStatus") | |||
| private Integer matchStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="匹配状态描述",name="mismatchStatusDesc") | |||
| private String mismatchStatusDesc; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| } | |||
| @@ -46,7 +46,7 @@ public class WxBatchOrder extends TenantEntity { | |||
| if(EnumAppPlat.WX.equals(appPlat)){ | |||
| }else if (EnumAppPlat.TOUTIAO.equals(appPlat)){ | |||
| return Constant.mainPageUrl + "?type=dt&couponOrderId=" + id; | |||
| return Constant.mainPageUrl + "?type=dt&orderId=" + id; | |||
| } | |||
| return null; | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumSupplierMathStatus { | |||
| match_update(-1, "等待重新匹配"), | |||
| match_wait(0, "等待匹配"), | |||
| match_ing(1, "正在匹配"), | |||
| match_success(2, "匹配成功"), | |||
| match_fail(3, "匹配失败"), | |||
| ; | |||
| public static EnumSupplierMathStatus getEnum(Integer code) { | |||
| for (EnumSupplierMathStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumSupplierMathStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.TtMerchantPoi; | |||
| import java.util.List; | |||
| public interface TtMerchantPoiMapper extends CommonMapper<TtMerchantPoi, Long> { | |||
| List<TtMerchantPoi> findList(TtMerchantPoi record); | |||
| List<Long> findIdList(TtMerchantPoi record); | |||
| List<String> findTaskIdList(TtMerchantPoi record); | |||
| int deleteByUpdate(Long id); | |||
| } | |||
| @@ -55,4 +55,5 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| Map<String,Object> findShopMerchant(@Param("id")Long id); | |||
| int deleteByUpdate(Long id); | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.TtMerchantPoi; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.douyin.web.api.TtWebService; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface TtMerchantPoiService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<TtMerchantPoi> listAsPage(TtMerchantPoi record, Integer pageIndex, Integer pageSize); | |||
| TtMerchantPoi getById(Long id); | |||
| int updateById(TtMerchantPoi record); | |||
| ResultData match(TenantEntity tenantInfo, List<Long> ids); | |||
| ResultData matchAgain(TenantEntity tenantInfo, Long id); | |||
| TtWebService getTtWebService(TenantEntity tenantInfo); | |||
| } | |||
| @@ -0,0 +1,215 @@ | |||
| package com.iformall.service.impl; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.douyin.web.api.TtWebService; | |||
| import com.iformall.douyin.web.bean.TtSupplierMatch; | |||
| import com.iformall.douyin.web.bean.TtSupplierMatchList; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumSupplierMathStatus; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.MaUtil; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Service | |||
| public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| TtMerchantPoiMapper ttMerchantPoiMapper; | |||
| @Autowired | |||
| WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| WxAppinfoMapper wxAppinfoMapper; | |||
| @Autowired | |||
| MaUtil maUtil; | |||
| @Override | |||
| public PageInfo<TtMerchantPoi> listAsPage(TtMerchantPoi record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttMerchantPoiMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public TtMerchantPoi getById(Long id) { | |||
| return ttMerchantPoiMapper.selectById(id); | |||
| } | |||
| @Override | |||
| public int updateById(TtMerchantPoi record) { | |||
| return ttMerchantPoiMapper.updateById(record); | |||
| } | |||
| @Override | |||
| public ResultData match(TenantEntity tenantInfo, List<Long> ids) { | |||
| TtMerchantPoi merchantPoiQ = new TtMerchantPoi(); | |||
| merchantPoiQ.updateTenantInfo(tenantInfo); | |||
| merchantPoiQ.setIds(ids); | |||
| List<TtMerchantPoi> merchantPois = ttMerchantPoiMapper.findList(merchantPoiQ); | |||
| if(merchantPois != null && merchantPois.size() > 0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"数据中存在已发起的店铺,请勿重复发起"); | |||
| } | |||
| WxMerchant merchantQ = new WxMerchant(); | |||
| merchantQ.updateTenantInfo(tenantInfo); | |||
| merchantQ.setIds(ids); | |||
| List<WxMerchant> merchants = wxMerchantMapper.findList(merchantQ); | |||
| if(merchants == null || merchants.isEmpty()){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到数据"); | |||
| } | |||
| Date now = new Date(); | |||
| WxMall mall = wxMallMapper.getByTenantId(tenantInfo.getTenantId()); | |||
| List<TtMerchantPoi> merchantPoiList = new ArrayList<>(); | |||
| for (WxMerchant merchant:merchants) { | |||
| TtMerchantPoi poi = new TtMerchantPoi(); | |||
| poi.setId(merchant.getId()); | |||
| poi.updateTenantInfo(mall); | |||
| poi.setSupplierExtId(merchant.getId().toString()); | |||
| poi.setPoiName(merchant.getName()); | |||
| poi.setProvince(mall.getProvince()); | |||
| poi.setCity(mall.getCity()); | |||
| poi.setAddress(mall.getAddr()); | |||
| poi.setLongitude(mall.getLongitude() == null?null:mall.getLongitude().floatValue()); | |||
| poi.setLatitude(mall.getLatitude() == null?null:mall.getLatitude().floatValue()); | |||
| poi.setMatchStatus(EnumSupplierMathStatus.match_update.getCode()); | |||
| poi.setCreateDate(now); | |||
| poi.setUpdateDate(now); | |||
| ttMerchantPoiMapper.insert(poi); | |||
| merchantPoiList.add(poi); | |||
| } | |||
| String taskId = supplierMatch(tenantInfo, merchantPoiList); | |||
| if(StringUtils.isBlank(taskId)){ | |||
| return new ResultData(ErrorCode.SYS_METHOD_NOT_SUPPORT.getCode(),"提交抖音失败,请在列表中重新发起匹配"); | |||
| } | |||
| TtMerchantPoi updPoi = new TtMerchantPoi(); | |||
| updPoi.setTaskId(taskId); | |||
| updPoi.setMatchStatus(EnumSupplierMathStatus.match_ing.getCode()); | |||
| updPoi.setUpdateDate(new Date()); | |||
| int update = ttMerchantPoiMapper.update(updPoi, new QueryWrapper<>(merchantPoiQ)); | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public ResultData matchAgain(TenantEntity tenantInfo, Long id) { | |||
| TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(id); | |||
| if(merchantPoi == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到数据"); | |||
| } | |||
| if(EnumSupplierMathStatus.match_fail.getCode().equals(merchantPoi.getMatchStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请修改信息后再提交匹配"); | |||
| } | |||
| if(!EnumSupplierMathStatus.match_update.getCode().equals(merchantPoi.getMatchStatus())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该状态不允许提交匹配"); | |||
| } | |||
| List<TtMerchantPoi> merchantPoiList = new ArrayList<>(); | |||
| merchantPoiList.add(merchantPoi); | |||
| String taskId = supplierMatch(tenantInfo,merchantPoiList); | |||
| if(StringUtils.isBlank(taskId)){ | |||
| return new ResultData(ErrorCode.SYS_METHOD_NOT_SUPPORT.getCode(),"提交抖音失败,请重新发起匹配"); | |||
| } | |||
| TtMerchantPoi updPoi = new TtMerchantPoi(); | |||
| updPoi.setId(id); | |||
| updPoi.setTaskId(taskId); | |||
| updPoi.setMatchStatus(EnumSupplierMathStatus.match_ing.getCode()); | |||
| updPoi.setUpdateDate(new Date()); | |||
| ttMerchantPoiMapper.updateById(merchantPoi); | |||
| return new ResultData(); | |||
| } | |||
| private String supplierMatch(TenantEntity tenantInfo, List<TtMerchantPoi> merchantPoiList){ | |||
| TtSupplierMatchList matchList = new TtSupplierMatchList(); | |||
| for (TtMerchantPoi poi:merchantPoiList) { | |||
| TtSupplierMatch match = new TtSupplierMatch(); | |||
| match.setSupplierExtId(poi.getSupplierExtId()); | |||
| match.setPoiName(poi.getPoiName()); | |||
| match.setProvince(poi.getProvince()); | |||
| match.setCity(poi.getCity()); | |||
| match.setAddress(poi.getAddress()); | |||
| match.setLongitude(poi.getLongitude()); | |||
| match.setLatitude(poi.getLatitude()); | |||
| match.setAmapId(poi.getAmapId()); | |||
| matchList.getMatchDataList().add(match); | |||
| } | |||
| String taskId = null; | |||
| try { | |||
| taskId = getTtWebService(tenantInfo).getShopMatchService().supplierMatch(matchList); | |||
| } catch (WxErrorException e) { | |||
| logger.error("发起店铺匹配POI同步任务error"+e.getMessage()); | |||
| } | |||
| return taskId; | |||
| } | |||
| @Override | |||
| public TtWebService getTtWebService(TenantEntity tenantInfo){ | |||
| WxAppinfo appinfoQ = new WxAppinfo(); | |||
| appinfoQ.updateTenantInfo(tenantInfo); | |||
| appinfoQ.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||
| appinfoQ.setType(EnumAppType.A.getCode()); | |||
| WxAppinfo appinfo = wxAppinfoMapper.selectOne(new QueryWrapper<>(appinfoQ)); | |||
| TtWebService ttWebService = maUtil.getTtWebService(appinfo); | |||
| if (StringUtils.isBlank(appinfo.getAccessToken())) { | |||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||
| updateWebAccessToken(appinfo, ttWebService); | |||
| } else { | |||
| // 检查token是否已过期, 1小时就重新获取 | |||
| Date curDate = new Date(); | |||
| if (curDate.getTime() > appinfo.getLastTokenTime().getTime() + Constant.H_EXPIRE) { | |||
| updateWebAccessToken(appinfo, ttWebService); | |||
| } | |||
| } | |||
| return ttWebService; | |||
| } | |||
| private void updateWebAccessToken(WxAppinfo appinfo, TtWebService ttWebService) { | |||
| try { | |||
| String accessToken = ttWebService.getAccessToken(true); | |||
| WxAppinfo updateApp = new WxAppinfo(); | |||
| updateApp.setId(appinfo.getId()); | |||
| updateApp.setAccessToken(accessToken); | |||
| updateApp.setLastTokenTime(new Date()); | |||
| updateApp.setExpiresIn(7200); | |||
| appinfo.setAccessToken(updateApp.getAccessToken()); | |||
| appinfo.setLastTokenTime(updateApp.getLastTokenTime()); | |||
| appinfo.setExpiresIn(updateApp.getExpiresIn()); | |||
| wxAppinfoMapper.updateById(updateApp); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @@ -1684,7 +1684,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } catch (Exception e) { | |||
| logger.error("核销记账失败"+e.getMessage(),e); | |||
| } | |||
| }else if(wxPayOrder != null){ | |||
| } | |||
| if(wxPayOrder != null){ | |||
| WxSharingOrderDto wxSharingOrderDto = new WxSharingOrderDto(); | |||
| wxSharingOrderDto.setCUserId(wxPayOrder.getCUserId()); | |||
| wxSharingOrderDto.setMerchantId(merchantId); | |||
| @@ -48,6 +48,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| TtMerchantPoiMapper ttMerchantPoiMapper; | |||
| @Autowired | |||
| WxShopMapper wxShopMapper; | |||
| @@ -355,7 +358,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxMerchantMapper.deleteById(id); | |||
| wxMerchantMapper.deleteByUpdate(id); | |||
| ttMerchantPoiMapper.deleteByUpdate(id); | |||
| // wxMerchantMapper.deleteById(id); | |||
| } | |||
| @@ -0,0 +1,99 @@ | |||
| <?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="com.iformall.mapper.TtMerchantPoiMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.TtMerchantPoi"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
| <result column="supplier_ext_id" jdbcType="VARCHAR" property="supplierExtId"/> | |||
| <result column="poi_name" jdbcType="VARCHAR" property="poiName"/> | |||
| <result column="province" jdbcType="VARCHAR" property="province"/> | |||
| <result column="city" jdbcType="VARCHAR" property="city"/> | |||
| <result column="address" jdbcType="VARCHAR" property="address"/> | |||
| <result column="longitude" jdbcType="float" property="longitude"/> | |||
| <result column="latitude" jdbcType="float" property="latitude"/> | |||
| <result column="amap_id" jdbcType="VARCHAR" property="amapId"/> | |||
| <result column="extra" jdbcType="VARCHAR" property="extra"/> | |||
| <result column="poi_id" jdbcType="VARCHAR" property="poiId"/> | |||
| <result column="task_id" jdbcType="VARCHAR" property="taskId"/> | |||
| <result column="match_status" jdbcType="INTEGER" property="matchStatus"/> | |||
| <result column="mismatch_status_desc" jdbcType="VARCHAR" property="mismatchStatusDesc"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`supplier_ext_id`,`poi_name`,`province`,`city`,`address`, | |||
| `longitude`,`latitude`,`amap_id`,`extra`,`poi_id`,`task_id`,`match_status`,`mismatch_status_desc`, | |||
| `create_date`,`update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where is_del = 0 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != supplierExtId and '' != supplierExtId"> | |||
| and `supplier_ext_id` = #{supplierExtId} | |||
| </if> | |||
| <if test=" null != poiId and ''!= poiId "> | |||
| and `poi_id` = #{poiId} | |||
| </if> | |||
| <if test=" null != poiName and ''!= poiName "> | |||
| and `poi_name` like concat('%', #{poiName},'%') | |||
| </if> | |||
| <if test=" null != taskId and ''!= taskId "> | |||
| and `task_id` = #{taskId} | |||
| </if> | |||
| <if test=" null != matchStatus"> | |||
| and `match_status` = #{matchStatus} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and `id` in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.TtMerchantPoi" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from tt_merchant_poi | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findIdList" parameterType="com.iformall.domain.po.TtMerchantPoi" resultType="Long"> | |||
| select id | |||
| from tt_merchant_poi | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findTaskIdList" parameterType="com.iformall.domain.po.TtMerchantPoi" resultType="String"> | |||
| select distinct task_id | |||
| from tt_merchant_poi | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <update id="deleteByUpdate" parameterType="Long"> | |||
| update tt_merchant_poi set is_del = 1 | |||
| where id = #{id} | |||
| </update> | |||
| </mapper> | |||
| @@ -397,4 +397,9 @@ | |||
| </if> | |||
| </select> | |||
| <update id="deleteByUpdate" parameterType="Long"> | |||
| update wx_merchant set is_del = 1 | |||
| where id = #{id} | |||
| </update> | |||
| </mapper> | |||