Authored by chenchao

add pay error code

fix province compare with code
... ... @@ -65,6 +65,7 @@ public class TradeBills {
//打款关联id
private Integer dealRelateId = 0;
private String payErrorCode;
@Deprecated
public enum Status {
... ...
... ... @@ -20,9 +20,11 @@
<result column="deal_time" jdbcType="INTEGER" property="dealTime" />
<result column="deal_relate_id" jdbcType="INTEGER" property="dealRelateId" />
<result column="deal_user_name" jdbcType="VARCHAR" property="dealUserName" />
<result column="pay_error_code" jdbcType="VARCHAR" property="payErrorCode" />
</resultMap>
<sql id="Base_Column_List">
id,uid, order_code,paid_order_code, user_type,pay_type,trade_type,income_outcome,amount,system_amount,trade_status,create_time,deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name
id,uid, order_code,paid_order_code, user_type,pay_type,trade_type,income_outcome,amount,system_amount,trade_status,create_time,
deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name,pay_error_code
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
... ... @@ -42,10 +44,11 @@
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.TradeBills" useGeneratedKeys="true">
insert into trade_bills (id, uid, order_code, paid_order_code, user_type,pay_type,trade_type,
income_outcome,amount,system_amount,trade_status,create_time
,deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name)
,deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name,pay_error_code)
values (#{id},#{uid},#{orderCode},#{paidOrderCode},#{userType},#{payType},#{tradeType},
#{incomeOutcome},#{amount},#{systemAmount},
#{tradeStatus},#{createTime},#{dealUid},#{dealStatus},#{dealTime},#{dealRelateId},#{dealUserName})
#{tradeStatus},#{createTime},#{dealUid},#{dealStatus},
#{dealTime},#{dealRelateId},#{dealUserName},#{payErrorCode})
</insert>
<!-- 买家只显示补偿款收入 ,卖家只显示货款收入
... ...
... ... @@ -574,12 +574,14 @@ public class SellerOrderController {
@RequestParam(name="orderCode") Long orderCode,
@RequestParam(name="consignee") String consignee,
@RequestParam(name="area")String area,
@RequestParam(name="areaCode")String areaCode,
@RequestParam(name="address")String address,
@RequestParam(name="mobile")String mobile
){
OrderAddressReq req = OrderAddressReq.builder().uid(uid).orderCode(orderCode).consignee(consignee)
.area(area).address(address)
.mobile(mobile)
.areaCode(areaCode)
.fromPlatform(false)
.build();
logger.info("ufo.sellerOrder.modifyDeliverAddress enter,req {}", req);
... ...
... ... @@ -8,6 +8,7 @@ import com.yohoufo.dal.order.AppraiseAddressMapper;
import com.yohoufo.dal.order.model.AppraiseAddress;
import com.yohobuy.ufo.model.order.resp.AppraiseAddressInfo;
import com.yohoufo.order.model.response.AppraiseAddressResp;
import com.yohoufo.order.utils.AddressHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -69,7 +70,7 @@ public class AppraiseAddressService {
if (StringUtils.isEmpty(areaCode) || areaCode.length() < 2) {
return null;
}
String provinceCode = areaCode.substring(0, 2);
String provinceCode = AddressHelper.getProvinceCode(areaCode);
Map<Integer, AppraiseAddress> map = buildCodeAppraiseAddressMap();
AppraiseAddress address = map.get(Integer.valueOf(provinceCode));
return address;
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.req.OrderAddressReq;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.UserInfoHiddenHelper;
import com.yohoufo.order.utils.AddressHelper;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -87,12 +88,6 @@ public class CommomAddressService {
}
static boolean isSameProvince(String sourceArea, String area){
final String separator = " ";
List<String> changedUnionAreas = Splitter.on(separator).splitToList(area);
List<String> sourceUnionAreas = Splitter.on(separator).splitToList(sourceArea);
return changedUnionAreas.get(0).equals(sourceUnionAreas.get(0));
}
/**
* 把变的信息项更新
... ... @@ -106,17 +101,23 @@ public class CommomAddressService {
chkSelfChangeTimes(fromPlatform, dbAddressInfo.getSelfModifyTimes());
boolean changed = false;
String area;
String sourceAreaCode;
String changedAreaCode;
//控制省级不能修改
//极端情况 dbAddressInfo 没有area时,使用现在的数据作为补充
if(!fromPlatform
&& StringUtils.isNotBlank(dbAddressInfo.getArea())
&& StringUtils.isNotBlank(area=changedAddress.getArea())
&& !StringUtils.equals(area=area.trim(),dbAddressInfo.getArea())){
if (!isSameProvince(dbAddressInfo.getArea(), area)){
if(StringUtils.isNotBlank(sourceAreaCode = dbAddressInfo.getAreaCode())
&& StringUtils.isNotBlank(changedAreaCode = changedAddress.getAreaCode())
&& !StringUtils.equals(sourceAreaCode,changedAreaCode)){
if (!fromPlatform
&& !AddressHelper.isSameProvince(sourceAreaCode, changedAreaCode)){
logger.warn("in convertAddressInfoFrontRequest province changed ");
throw new UfoServiceException(400, "不允许修改省份");
}
if (StringUtils.isBlank(changedAddress.getArea())){
throw new UfoServiceException(400, "四级地址为空");
}
}
//前提条件:没有修改的信息 依旧使用了包含隐藏位的数据
//所以才有一开始的校验:使用隐藏的地址和请求体比对
... ...
... ... @@ -20,4 +20,16 @@ public class AddressHelper {
}
return false;
}
final static int indexOfProvince = 2;
public static String getProvinceCode(String areaCode){
String provinceCode = areaCode.substring(0, indexOfProvince);
return provinceCode;
}
public static boolean isSameProvince(String sourceAreaCode, String changedAreaCode){
String sourceProvince = AddressHelper.getProvinceCode(sourceAreaCode);
String changedProvince = AddressHelper.getProvinceCode(changedAreaCode);
return sourceProvince.equals(changedProvince);
}
}
... ...