Commit 9c3b8c01 authored by 332784038@qq.com's avatar 332784038@qq.com

Merge remote-tracking branch 'origin/release' into release

parents bdce383c d7578025
......@@ -188,6 +188,8 @@ public interface ErrorCodeConstants {
ErrorCode CUSTOMER_APPROVAL_IN_PROCESSING = new ErrorCode(1004006043, "customer.approval.in.processing");
ErrorCode AREA_CODE_NOT_NULL = new ErrorCode(1004006044, "area.code.not.null");
ErrorCode CURRENCY_ID_NOT_NULL = new ErrorCode(1004006045, "currency.id.not.null");
}
......
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ecw.controller.admin.region;
import cn.iocoder.yudao.framework.apollo.core.event.ChannelDataEvent;
import cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -26,6 +27,7 @@ import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants.*;
import cn.iocoder.yudao.module.ecw.controller.admin.region.vo.*;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
......@@ -217,4 +219,22 @@ public class RegionController {
List<RegionDO> cityList = regionService.getCityListByParentId(parentId);
return success(RegionConvert.INSTANCE.convertList(cityList));
}
@GetMapping("/check/dest-currency/area-code/")
@ApiOperation("检查国家区域是否与手机号国家区号一致")
@ApiImplicitParams({
@ApiImplicitParam(name = "currencyId", value = "国家ID", required = true, example = "1024", dataTypeClass = Long.class),
@ApiImplicitParam(name = "areaCode", value = "手机国家区号", required = true, example = "86", dataTypeClass = String.class)
})
public CommonResult<Boolean> checkDestCurrencyAndAreaCode(@RequestParam("currencyId") Long currencyId,
@RequestParam("areaCode") String areaCode) {
if (currencyId == null) {
return CommonResult.error(CURRENCY_ID_NOT_NULL);
}
if (StringUtils.isBlank(areaCode)) {
return CommonResult.error(AREA_CODE_NOT_NULL);
}
return success(regionService.countByIdAndAreaCode(currencyId, areaCode));
}
}
......@@ -10,7 +10,9 @@ import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.ecw.service.region.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -25,6 +27,8 @@ import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants.AREA_CODE_NOT_NULL;
import static cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants.CURRENCY_ID_NOT_NULL;
@Api(tags = "app-web - 国家城市管理")
@RestController
......@@ -130,6 +134,24 @@ public class AppRegionController {
return success(RegionConvert.INSTANCE.convertList(cityList));
}
@GetMapping("/check/dest-currency/area-code/")
@ApiOperation("检查国家区域是否与手机号国家区号一致")
@ApiImplicitParams({
@ApiImplicitParam(name = "currencyId", value = "国家ID", required = true, example = "1024", dataTypeClass = Long.class),
@ApiImplicitParam(name = "areaCode", value = "手机国家区号", required = true, example = "86", dataTypeClass = String.class)
})
public CommonResult<Boolean> checkDestCurrencyAndAreaCode(@RequestParam("currencyId") Long currencyId,
@RequestParam("areaCode") String areaCode) {
if (currencyId == null) {
return CommonResult.error(CURRENCY_ID_NOT_NULL);
}
if (StringUtils.isBlank(areaCode)) {
return CommonResult.error(AREA_CODE_NOT_NULL);
}
return success(regionService.countByIdAndAreaCode(currencyId, areaCode));
}
private RegionRespVO buildChildTree(RegionRespVO pNode, List<RegionRespVO> allDatas){
List<RegionRespVO> childs = new ArrayList<>();
for(RegionRespVO itemNode : allDatas) {
......
......@@ -44,6 +44,14 @@ public interface RegionService {
*/
RegionDO getRegion(Long id);
/**
* 根据国家id和手机国家区号统计数值,判断区号是否与国家一致
* @param id
* @param areaCode
* @return
*/
Boolean countByIdAndAreaCode(Long id, String areaCode);
/**
* 获得区域设置列表
*
......
package cn.iocoder.yudao.module.ecw.service.region;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.ecw.controller.admin.region.vo.*;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -31,12 +35,12 @@ public class RegionServiceImpl implements RegionService {
@Override
public Long createRegion(RegionCreateReqVO createReqVO) {
if (Objects.equals(createReqVO.getType(), "1") || Objects.equals(createReqVO.getType(), "3")){
if (StringUtils.isBlank(createReqVO.getLabelCode())){
if (Objects.equals(createReqVO.getType(), "1") || Objects.equals(createReqVO.getType(), "3")) {
if (StringUtils.isBlank(createReqVO.getLabelCode())) {
throw exception(REGION_LABEL_CODE_NOT_NULL);
}
String[] codes = createReqVO.getLabelCode().split(StrUtil.DASHED);
if (codes.length < 2){
if (codes.length < 2) {
throw exception(REGION_LABEL_CODE_COUNTRY_AND_CITY_AND_AIR_COUNTRY);
}
}
......@@ -49,12 +53,12 @@ public class RegionServiceImpl implements RegionService {
@Override
public void updateRegion(RegionUpdateReqVO updateReqVO) {
if (Objects.equals(updateReqVO.getType(), "1") || Objects.equals(updateReqVO.getType(), "3")){
if (StringUtils.isBlank(updateReqVO.getLabelCode())){
if (Objects.equals(updateReqVO.getType(), "1") || Objects.equals(updateReqVO.getType(), "3")) {
if (StringUtils.isBlank(updateReqVO.getLabelCode())) {
throw exception(REGION_LABEL_CODE_NOT_NULL);
}
String[] codes = updateReqVO.getLabelCode().split(StrUtil.DASHED);
if (codes.length < 2){
if (codes.length < 2) {
throw exception(REGION_LABEL_CODE_COUNTRY_AND_CITY_AND_AIR_COUNTRY);
}
}
......@@ -94,6 +98,13 @@ public class RegionServiceImpl implements RegionService {
return regionMapper.selectById(id);
}
@Override
public Boolean countByIdAndAreaCode(Long id, String areaCode) {
Long count = regionMapper.selectCount(new LambdaQueryWrapper<RegionDO>().eq(RegionDO::getId, id).eq(RegionDO::getAreaCode, areaCode));
return Objects.nonNull(count) && count > 0L;
}
@Override
public List<RegionDO> getRegionList(Collection<Long> ids) {
return regionMapper.selectBatchIds(ids);
......
......@@ -121,9 +121,7 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"from ecw_offer o ",
"left join ecw_customer_contacts cc on (o.relation = 1 and cc.id = o.consignor_id) or (o.relation = 2 and cc.id = o.consignee_id) ",
"<when test = 'pageVO.sourceIds != null and pageVO.sourceIds.size() > 0'>",
"left join ecw_customer user on user.id = o.relation_id ",
"</when>",
"left join ecw_customer user on user.id = o.relation_id ",
"left join system_user u on u.id = o.follow_up_salesman_id ",
"left join ecw_region s on o.objective_id = s.id ",
"left join ecw_warehouse_line line on o.line_id = line.id ",
......
......@@ -300,4 +300,8 @@ customer.approval.in.processing=
order.overseas.warehouse.update.is.or.no=
order.is.overseas.warehouse.order=
order.not.is.overseas.warehouse.order=
\ No newline at end of file
order.not.is.overseas.warehouse.order=
area.code.not.null=
currency.id.not.null=
\ No newline at end of file
......@@ -1107,4 +1107,8 @@ customer.approval.in.processing=Non-main customer approval is in progress and ca
order.overseas.warehouse.update.is.or.no=Please select order overseas warehouse modification Yes or No
order.is.overseas.warehouse.order=This order is already an overseas warehouse order
order.not.is.overseas.warehouse.order=This order is already a non overseas warehouse order
\ No newline at end of file
order.not.is.overseas.warehouse.order=This order is already a non overseas warehouse order
area.code.not.null=The national mobile phone area code cannot be empty
currency.id.not.null=The country ID cannot be empty
\ No newline at end of file
......@@ -1107,4 +1107,8 @@ customer.approval.in.processing=\u975E\u4E3B\u5BA2\u6237\u5BA1\u6279\u6B63\u5728
order.overseas.warehouse.update.is.or.no=\u8bf7\u9009\u62e9\u8ba2\u5355\u6d77\u5916\u4ed3\u4fee\u6539\u662f\u6216\u5426
order.is.overseas.warehouse.order=\u8be5\u8ba2\u5355\u5df2\u7ecf\u662f\u6d77\u5916\u4ed3\u8ba2\u5355
order.not.is.overseas.warehouse.order=\u8be5\u8ba2\u5355\u5df2\u7ecf\u662f\u975e\u6d77\u5916\u4ed3\u8ba2\u5355
\ No newline at end of file
order.not.is.overseas.warehouse.order=\u8be5\u8ba2\u5355\u5df2\u7ecf\u662f\u975e\u6d77\u5916\u4ed3\u8ba2\u5355
area.code.not.null=\u56fd\u5bb6\u624b\u673a\u533a\u53f7\u4e0d\u80fd\u4e3a\u7a7a
currency.id.not.null=\u56fd\u5bb6id\u4e0d\u80fd\u4e3a\u7a7a
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment