| @@ -131,11 +131,16 @@ public class WxMerchantController extends BaseController { | |||
| @ApiOperation("子商户列表查询") | |||
| @GetMapping("/subMerchantList") | |||
| @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 subMerchantList() { | |||
| public ResultData subMerchantList(@ModelAttribute WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::subMerchantList"); | |||
| List<WxMerchant> merchants = wxMerchantService.subMerchantList(); | |||
| return new ResultData(merchants); | |||
| if (null == wxMerchant) wxMerchant = new WxMerchant(); | |||
| wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); | |||
| PageInfo<WxMerchant> pageInfo = wxMerchantService.subMerchantList(wxMerchant, pageNum, pageSize); | |||
| return new ResultData(pageInfo); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @@ -8,6 +8,7 @@ import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; | |||
| import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl; | |||
| import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; | |||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxTags; | |||
| @@ -239,7 +240,7 @@ public class AsyncTask { | |||
| public void exportExcelPoiDataAddLocationForNew(String gaodeKey,File file,HttpServletRequest request, HttpServletResponse response) throws Exception { | |||
| ImportParams params = new ImportParams(); | |||
| // 需要验证 | |||
| String[] headers = new String[]{"门店名称", "门店ID", "城市", "详细地址","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注", "富茂系统商户ID", "富茂系统商户名称"}; | |||
| String[] headers = new String[]{"富茂系统商户ID", "富茂系统商户名称","门店名称", "门店ID", "城市", "详细地址","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注"}; | |||
| params.setImportFields(headers); | |||
| IExcelDataHandler<MerchantPoiTNew> handler = new AsyncTask.PoiNewExcelHandler(); | |||
| handler.setNeedHandlerFields(new String[]{"门店名称", "门店ID", "城市", "详细地址"}); | |||
| @@ -265,34 +266,38 @@ public class AsyncTask { | |||
| List<MerchantPoiTNew> successList = datalist.getList(); | |||
| //List<MerchantPoiTNew> failList = datalist.getFailList(); | |||
| if(null != successList && successList.size() > 0 ) { | |||
| List<MerchantPoiTNew> tlist = new ArrayList<MerchantPoiTNew>(); | |||
| try { | |||
| successList.parallelStream().forEach(poiBase -> { | |||
| try { | |||
| GaoDePoiInfo gaodeInfo = ttMerchantPoiService.queryGaoDePoiInfo(gaodeKey, poiBase.getPoiCity()+poiBase.getPoiAddress()); | |||
| if (null != gaodeInfo) { | |||
| if (gaodeInfo.isSuccess()) { | |||
| poiBase.setProvince(gaodeInfo.getProvince()); | |||
| poiBase.setCity(gaodeInfo.getCity()); | |||
| poiBase.setAddress(poiBase.getPoiAddress()); | |||
| poiBase.setLongitude(gaodeInfo.getLongitude()); | |||
| poiBase.setLatitude(gaodeInfo.getLatitude()); | |||
| poiBase.setGaodeRemark("匹配成功"); | |||
| }else { | |||
| poiBase.setGaodeRemark("匹配失败,"+gaodeInfo.getErrMsg()); | |||
| } | |||
| }else { | |||
| poiBase.setGaodeRemark("未匹配到信息"); | |||
| } | |||
| tlist.add(poiBase); | |||
| if (StringUtils.isNotBlank(poiBase.getProvince()) && StringUtils.isNotBlank(poiBase.getCity()) | |||
| && StringUtils.isNotBlank(poiBase.getAddress()) && null != poiBase.getLongitude() && null != poiBase.getLatitude()) { | |||
| //do nothing | |||
| }else { | |||
| GaoDePoiInfo gaodeInfo = ttMerchantPoiService.queryGaoDePoiInfo(gaodeKey, poiBase.getPoiCity()+poiBase.getPoiAddress()); | |||
| if (null != gaodeInfo) { | |||
| if (gaodeInfo.isSuccess()) { | |||
| poiBase.setProvince(gaodeInfo.getProvince()); | |||
| poiBase.setCity(gaodeInfo.getCity()); | |||
| poiBase.setAddress(poiBase.getPoiAddress()); | |||
| poiBase.setLongitude(gaodeInfo.getLongitude()); | |||
| poiBase.setLatitude(gaodeInfo.getLatitude()); | |||
| poiBase.setGaodeRemark("匹配成功"); | |||
| }else { | |||
| poiBase.setGaodeRemark("匹配失败,"+gaodeInfo.getErrMsg()); | |||
| } | |||
| }else { | |||
| poiBase.setGaodeRemark("未匹配到信息"); | |||
| } | |||
| } | |||
| } catch (UnknownSessionException ue) { | |||
| logger.error("session :"+ue.getMessage()); | |||
| poiBase.setGaodeRemark("查询高德API失败"); | |||
| } | |||
| }); | |||
| ExportParams exportParams = new ExportParams(); | |||
| //exportParams.setCreateHeadRows(true); | |||
| //exportParams.setExclusions(headers); | |||
| Workbook workBook = ExcelExportUtil.exportExcel(exportParams, MerchantPoiTNew.class, tlist); | |||
| Workbook workBook = ExcelExportUtil.exportExcel(exportParams, MerchantPoiTNew.class, successList); | |||
| exportExcel(request, response, workBook, "POI匹配模版-高德.xls"); | |||
| } catch (Exception e) { | |||
| logger.error("更新地理信息失败:"+e.getMessage(),e); | |||
| @@ -316,10 +321,10 @@ public class AsyncTask { | |||
| public void importExcelPoiDataForNew(File file, MallUserInfo user, String importKey) { | |||
| ImportParams params = new ImportParams(); | |||
| // 需要验证 | |||
| String[] headers = new String[]{"门店名称", "门店ID", "城市", "详细地址","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注", "富茂系统商户ID", "富茂系统商户名称"}; | |||
| String[] headers = new String[]{"富茂系统商户ID", "富茂系统商户名称","门店名称", "门店ID", "城市", "详细地址","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注"}; | |||
| params.setImportFields(headers); | |||
| IExcelDataHandler<MerchantPoiTNew> handler = new AsyncTask.PoiNewExcelHandler(); | |||
| handler.setNeedHandlerFields(new String[]{"富茂商户ID","来客门店ID","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度"}); | |||
| handler.setNeedHandlerFields(new String[]{"富茂系统商户ID","门店ID","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度"}); | |||
| params.setNeedVerify(true); | |||
| ExcelImportResult<MerchantPoiTNew> datalist = null; | |||
| @@ -428,5 +428,7 @@ public class WxMerchant extends TenantEntity { | |||
| private Integer hasCarVendor; | |||
| @TableField(exist = false) | |||
| private Integer noCarVendor; | |||
| @TableField(exist = false) | |||
| private List<Long> merchantIds; | |||
| } | |||
| @@ -12,50 +12,42 @@ import java.math.BigDecimal; | |||
| @Data | |||
| public class MerchantPoiTNew implements Serializable { | |||
| @Excel(name = "门店名称", width = 20, orderNum = "1") | |||
| @Excel(name="富茂系统商户ID",width = 20,orderNum = "1") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统商户ID",name="merchantId") | |||
| private String merchantId; | |||
| @Excel(name="富茂系统商户名称",width = 20,orderNum = "2") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统商户名称",name="merchantName") | |||
| private String merchantName; | |||
| @Excel(name = "门店名称", width = 20, orderNum = "3") | |||
| @io.swagger.annotations.ApiModelProperty(value="来客门店名称",name="poiName") | |||
| private String poiName; | |||
| @Excel(name="门店ID",width = 20,orderNum = "2") | |||
| @Excel(name="门店ID",width = 20,orderNum = "4") | |||
| @io.swagger.annotations.ApiModelProperty(value="来客门店ID",name="poiId") | |||
| private String poiId; | |||
| @Excel(name = "城市", width = 20, orderNum = "3") | |||
| @Excel(name = "城市", width = 20, orderNum = "5") | |||
| @io.swagger.annotations.ApiModelProperty(value="来客门店城市",name="poiCity") | |||
| private String poiCity; | |||
| @Excel(name = "详细地址", width = 20, orderNum = "4") | |||
| @Excel(name = "详细地址", width = 20, orderNum = "6") | |||
| @io.swagger.annotations.ApiModelProperty(value="来客门店详细地址",name="poiAddress") | |||
| private String poiAddress; | |||
| @Excel(name = "富茂系统省份", width = 20, orderNum = "5") | |||
| @Excel(name = "富茂系统省份", width = 20, orderNum = "7") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统省份",name="province") | |||
| private String province; | |||
| @Excel(name = "富茂系统城市", width = 20, orderNum = "6") | |||
| @Excel(name = "富茂系统城市", width = 20, orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统城市",name="city") | |||
| private String city; | |||
| @Excel(name = "富茂系统地址", width = 20, orderNum = "7") | |||
| @Excel(name = "富茂系统地址", width = 20, orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统地址",name="address") | |||
| private String address; | |||
| @Excel(name="富茂系统经度",width = 20,orderNum = "8") | |||
| @Excel(name="富茂系统经度",width = 20,orderNum = "10") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统经度",name="longitude") | |||
| private BigDecimal longitude; | |||
| @Excel(name = "富茂系统纬度", width = 20, orderNum = "9") | |||
| @Excel(name = "富茂系统纬度", width = 20, orderNum = "11") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统纬度",name="latitude") | |||
| private BigDecimal latitude; | |||
| @Excel(name = "高德匹配备注", width = 20, orderNum = "10") | |||
| @Excel(name = "高德匹配备注", width = 20, orderNum = "12") | |||
| @io.swagger.annotations.ApiModelProperty(value="高德匹配备注",name="gaodeRemark") | |||
| private String gaodeRemark; | |||
| @Excel(name="富茂系统商户ID",width = 20,orderNum = "11") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统商户ID",name="merchantId") | |||
| private String merchantId; | |||
| @Excel(name="富茂系统商户名称",width = 20,orderNum = "12") | |||
| @io.swagger.annotations.ApiModelProperty(value="富茂系统商户名称",name="merchantName") | |||
| private String merchantName; | |||
| } | |||
| @@ -4,9 +4,6 @@ import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| 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; | |||
| @@ -61,5 +58,4 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| List<WxMerchant> getMerchantListByIds(@Param("relationIds") List<Long> relationIds); | |||
| List<WxMerchant> getSubMerchantListByIds(@Param("merchantIds") List<Long> merchantIds); | |||
| } | |||
| @@ -218,6 +218,6 @@ public interface WxMerchantService { | |||
| List<WxMerchant> relationList(Long regionId); | |||
| List<WxMerchant> subMerchantList(); | |||
| PageInfo<WxMerchant> subMerchantList(WxMerchant wxMerchant, Integer pageNum, Integer pageSize); | |||
| } | |||
| @@ -2076,9 +2076,11 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| * 查询剩余子商户 | |||
| */ | |||
| @Override | |||
| public List<WxMerchant> subMerchantList() { | |||
| public PageInfo<WxMerchant> subMerchantList(WxMerchant wxMerchant, Integer pageNum, Integer pageSize) { | |||
| //查询已经被选择了的子商户 | |||
| List<Long> merchantIds = wxMerchantRelationService.getRelationByRegionId(null); | |||
| return wxMerchantMapper.getSubMerchantListByIds(merchantIds); | |||
| wxMerchant.setMerchantIds(merchantIds); | |||
| PageInfo<WxMerchant> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(wxMerchant)); | |||
| return pageInfo; | |||
| } | |||
| } | |||
| @@ -180,6 +180,12 @@ | |||
| #{notInIdItem} | |||
| </foreach> | |||
| </if> | |||
| <if test="merchantIds != null and merchantIds.size > 0"> | |||
| and m.id NOT IN | |||
| <foreach collection="merchantIds" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| @@ -462,16 +468,4 @@ | |||
| </if> | |||
| </select> | |||
| <select id="getSubMerchantListByIds" resultType="com.iformall.domain.po.WxMerchant"> | |||
| select <include refid="allColumns"/> | |||
| from wx_merchant m | |||
| where m.is_del=0 and m.is_admin=4 | |||
| <if test="merchantIds != null and merchantIds.size > 0"> | |||
| and m.id NOT IN | |||
| <foreach collection="merchantIds" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| </mapper> | |||