Authored by qinchao

新增接口,查询入驻商户list

package com.yoho.order.dal;
import com.yoho.order.model.StoredSeller;
import com.yoho.order.model.StoredSellerReqVo;
import com.yoho.order.model.TradeBills;
import com.yoho.order.model.TradeBillsReq;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface StoredSellerMapper {
//获取生效的信息
StoredSeller selectValidByUid(int uid);
int insert(StoredSeller storedSeller);
int updateStatusByUid(@Param("uid") int uid, @Param("validStatus") int validStatus, @Param("expectStatus") int expectStatus, @Param("updateTime") long updateTime);
/*int updateToQuitByPrimaryKey(@Param("id")int id,@Param("validStatus") int validStatus ,@Param("expectStatus") int expectStatus
,@Param("operatorUid") int operatorUid,@Param("operatorName") String operatorName
,@Param("quitTime") long quitTime,@Param("updateTime") long updateTime);*/
int selectCountByCondition(@Param("storedSellerReq") StoredSellerReqVo req);
List<StoredSeller> selectByConditionWithPage(@Param("storedSellerReq") StoredSellerReqVo req);
}
... ...
package com.yoho.order.model;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class StoredSeller {
//主键
private Integer id;
//uid ,索引
private Integer uid;
//生效状态:1 入驻 ; 0 已退驻
private Integer validStatus;
//证件姓名
private String certName;
//证件号码:身份证号码
private String certNo;
//操作员uid
private Integer operatorUid;
private Integer operatorName;
//入驻时间
private long enterTime;
//退驻时间
private long quitTime;
private long createTime;
private long updateTime;
}
... ...
package com.yoho.order.model;
import com.yoho.ufo.service.model.PageRequestBO;
import lombok.Data;
import lombok.ToString;
/**
* Created by craig.qin.
*/
@Data
@ToString
public class StoredSellerReqVo extends PageRequestBO{
private Integer uid;
private String mobile;
private String certNo;
///// status 入驻状态
private Integer validStatus;
}
... ...
<?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.yoho.order.dal.StoredSellerMapper" >
<resultMap id="BaseResultMap" type="com.yoho.order.model.StoredSeller" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="valid_status" property="validStatus" jdbcType="INTEGER" />
<result column="cert_no" property="certNo" jdbcType="VARCHAR" />
<result column="cert_name" property="certName" jdbcType="VARCHAR" />
<result column="operator_uid" property="operatorUid" jdbcType="INTEGER" />
<result column="operator_name" property="operatorName" jdbcType="VARCHAR" />
<result column="enter_time" property="enterTime" jdbcType="INTEGER" />
<result column="quit_time" property="quitTime" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, uid, valid_status,cert_no,cert_name,operator_uid,operator_name,enter_time,quit_time ,create_time, update_time
</sql>
<select id="selectValidByUid" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from stored_seller
where uid = #{uid} and valid_status = 1
order by id desc limit 1
</select>
<insert id="insert" parameterType="com.yoho.order.model.StoredSeller" >
insert into stored_seller (uid, valid_status,cert_no,cert_name,operator_uid,operator_name,enter_time,quit_time, create_time, update_time)
values (#{uid},#{validStatus},
#{certNo},#{certName},#{operatorUid},#{operatorName},
#{enterTime},#{quitTime},
#{createTime},#{updateTime})
</insert>
<update id="updateStatusByUid">
update stored_seller
set valid_status = #{validStatus},update_time = #{updateTime}
where uid = #{uid} and valid_status = #{expectStatus}
</update>
<!-- <update id="updateToQuitByPrimaryKey">
update stored_seller
set valid_status = #{validStatus},operator_uid = #{operatorUid},operator_name=#{operatorName},
quit_time = #{quitTime} ,update_time = #{updateTime}
where id = #{id} and valid_status = #{expectStatus}
</update>-->
<sql id="Query_Condition_Sql" >
<if test="storedSellerReq.uid != null">
and uid = #{storedSellerReq.uid}
</if>
<if test="storedSellerReq.certNo != null">
and cert_name = #{storedSellerReq.certNo}
</if>
<if test="storedSellerReq.validStatus != null ">
and valid_status = #{storedSellerReq.validStatus}
</if>
</sql>
<select id="selectCountByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.StoredSellerReqVo">
select count(id)
from stored_seller where 1=1
<include refid="Query_Condition_Sql" />
</select>
<select id="selectByConditionWithPage" resultMap="BaseResultMap" parameterType="com.yoho.order.model.StoredSellerReqVo">
select <include refid="Base_Column_List" />
from stored_seller where 1=1
<include refid="Query_Condition_Sql" />
order by id desc
limit #{storedSellerReq.start},#{storedSellerReq.size}
</select>
</mapper>
\ No newline at end of file
... ...
package com.yoho.ufo.order.controller;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.order.model.StoredSellerReqVo;
import com.yoho.order.model.TradeBillsReq;
import com.yoho.ufo.order.response.StoredSellerRespVo;
import com.yoho.ufo.order.service.ITradeBillsService;
import com.yoho.ufo.service.impl.UserHelper;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.order.req.ManualDealRequest;
import com.yohobuy.ufo.model.order.resp.TradeBillsResp;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/storedSeller")
public class StoredSellerController {
private static final Logger LOGGER = LoggerFactory.getLogger(StoredSellerController.class);
@Autowired
private ITradeBillsService billsTradeService;
@RequestMapping(value = "/queryStoredSeller")
public ApiResponse queryStoredSeller(StoredSellerReqVo req) {
LOGGER.info("queryStoredSeller in. req is {}", req);
PageResponseBO<StoredSellerRespVo> result = billsTradeService.queryStoredSeller(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
}
... ...
package com.yoho.ufo.order.response;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class StoredSellerRespVo {
//uid ,索引
private Integer uid;
//状态:
private Integer validStatus;
//状态描述:
private String validStatusDesc;
//证件姓名
private String certName;
//证件号码:身份证号码
private String certNo;
//手机号码
private String mobile;
//入驻时间
private Long enterTime;
//退驻时间
private Long quitTime;
//上架sku
private Integer selfSkuNum;
//违规次数
private Integer breakRuleTimes;
}
... ...
package com.yoho.ufo.order.service;
import com.yoho.order.model.StoredSellerReqVo;
import com.yoho.order.model.TradeBillsReq;
import com.yoho.ufo.order.response.StoredSellerRespVo;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.order.resp.TradeBillsResp;
... ... @@ -8,4 +10,7 @@ public interface ITradeBillsService {
PageResponseBO<TradeBillsResp> queryTradeBillsList(TradeBillsReq req);
PageResponseBO<StoredSellerRespVo> queryStoredSeller(StoredSellerReqVo req);
}
... ...
... ... @@ -6,13 +6,16 @@ import com.google.common.cache.CacheBuilder;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.error.exception.ServiceException;
import com.yoho.order.dal.StoredSellerMapper;
import com.yoho.order.dal.TradeBillsMapper;
import com.yoho.order.model.*;
import com.yoho.ufo.order.constant.MoneyTypeEnum;
import com.yoho.ufo.order.constant.TradeStatusEnum;
import com.yoho.ufo.order.response.StoredSellerRespVo;
import com.yoho.ufo.order.service.ITradeBillsService;
import com.yoho.ufo.service.impl.UserHelper;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo;
import com.yohobuy.ufo.model.order.resp.*;
import com.yohobuy.ufo.model.user.req.AuthorizeInfoReq;
... ... @@ -57,6 +60,60 @@ public class TradeBillsServiceImpl implements ITradeBillsService {
@Autowired
private TradeBillsMapper tradeBillsMapper;
@Autowired
private StoredSellerMapper storedSellerMapper;
@Override
public PageResponseBO<StoredSellerRespVo> queryStoredSeller(StoredSellerReqVo req){
if(req.getUid()==null&&StringUtils.isNotBlank(req.getMobile())){
Integer uid = getUidByMobile(req.getMobile());
if(uid!=null){
req.setUid(uid);
}
}
int total = storedSellerMapper.selectCountByCondition(req);
if(total == 0) {
return null;
}
List<StoredSeller> storedSellerList = storedSellerMapper.selectByConditionWithPage(req);
if(CollectionUtils.isEmpty(storedSellerList)) {
return null;
}
List<StoredSellerRespVo> respList = convertToStoreSellerResp(storedSellerList);
PageResponseBO<StoredSellerRespVo> result=new PageResponseBO<>();
result.setList(respList);
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
return result;
}
private List<StoredSellerRespVo> convertToStoreSellerResp(List<StoredSeller> ls ){
List<StoredSellerRespVo> respList = Lists.newArrayList();
for(StoredSeller item : ls) {
StoredSellerRespVo resp=new StoredSellerRespVo();
resp.setUid(item.getUid());
resp.setCertName(item.getCertName());
resp.setCertNo(item.getCertNo());
resp.setValidStatus(item.getValidStatus());
resp.setValidStatusDesc(StoredSellerStatusEnum.getDescriptionByCode(item.getValidStatus()));
resp.setMobile(getMobileByUidFromCache(item.getUid()));
resp.setEnterTime(item.getEnterTime()<=0?null:item.getEnterTime());
resp.setQuitTime(item.getQuitTime()<=0?null:item.getQuitTime());
resp.setSelfSkuNum(0);
resp.setBreakRuleTimes(0);
respList.add(resp);
}
return respList;
}
public PageResponseBO<TradeBillsResp> queryTradeBillsList(TradeBillsReq req) {
if(req.getMoneyType()!=null){
MoneyTypeEnum moneyTypeClass =MoneyTypeEnum.getMoneyTypeByCode(req.getMoneyType());
... ...
... ... @@ -32,6 +32,7 @@ datasources:
- com.yoho.order.dal.AreaMapper
- com.yoho.order.dal.OrderOperateRecordMapper
- com.yoho.order.dal.TradeBillsMapper
- com.yoho.order.dal.StoredSellerMapper
ufo_resource:
servers:
... ...