提交实物代码

new-dev
袁野 2 years ago
parent 2b5a42f1c7
commit 3accfad213
  1. 62
      hai-bweb/src/main/java/com/bweb/controller/CommonController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java
  3. 233
      hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsRegionFreightController.java
  4. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  5. 518
      hai-cweb/src/main/java/com/cweb/controller/CommonController.java
  6. 206
      hai-cweb/src/main/java/com/cweb/controller/Goods/DeliveryAddressController.java
  7. 44
      hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java
  8. 2
      hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java
  9. 18
      hai-service/src/main/java/com/hai/config/CommonConfig.java
  10. 3
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  11. 77
      hai-service/src/main/java/com/hai/goods/service/DeliveryAddressService.java
  12. 2
      hai-service/src/main/java/com/hai/goods/service/GoodsDetailService.java
  13. 77
      hai-service/src/main/java/com/hai/goods/service/GoodsLogisticsService.java
  14. 89
      hai-service/src/main/java/com/hai/goods/service/GoodsRegionFreightService.java
  15. 69
      hai-service/src/main/java/com/hai/goods/service/impl/DeliveryAddressServiceImpl.java
  16. 6
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java
  17. 88
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsLogisticsServiceImpl.java
  18. 186
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsRegionFreightServiceImpl.java
  19. 2
      hai-service/src/main/java/com/hai/service/CommonService.java
  20. 19
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  21. 4
      hai-service/src/main/resources/dev/commonConfig.properties

@ -7,9 +7,12 @@ import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.common.utils.RedisUtil; import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig;
import com.hai.config.TuanYouConfig; import com.hai.config.TuanYouConfig;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.SecConfig; import com.hai.entity.SecConfig;
import com.hai.entity.SecDictionary; import com.hai.entity.SecDictionary;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.model.*; import com.hai.model.*;
import com.hai.service.CommonService; import com.hai.service.CommonService;
import com.hai.service.SecConfigService; import com.hai.service.SecConfigService;
@ -45,6 +48,9 @@ public class CommonController {
@Resource @Resource
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Resource
private GoodsLogisticsService logisticsService;
@RequestMapping(value="/getRedisValueByType",method= RequestMethod.GET) @RequestMapping(value="/getRedisValueByType",method= RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询redis中的value") @ApiOperation(value = "查询redis中的value")
@ -384,5 +390,61 @@ public class CommonController {
} }
} }
@RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据快递单号查询物流信息")
public ResponseData getLogisticsMsg(@RequestParam(name = "num", required = true) String num) {
try {
Object data = redisUtil.get("logisticsMsg" + num);
if (data == null) {
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(num);
if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) {
GoodsLogistics logistics = logisticsService.editLogistics((JSONObject) jsonObjects.get("data"));
redisUtil.set("logisticsMsg" + num , logistics ,21600);
return ResponseMsgUtil.success(logistics);
}
return ResponseMsgUtil.success(jsonObjects);
} else {
return ResponseMsgUtil.success(data);
}
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getRegional", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取区域信息")
public ResponseData getRegional() {
try {
Object data = redisUtil.get("regionalB");
if (data == null) {
List<JSONObject> jsonObjects = commonService.getRegional("key" , "title" , "children");
redisUtil.set("regionalB", jsonObjects);
return ResponseMsgUtil.success(jsonObjects);
} else {
return ResponseMsgUtil.success(data);
}
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -164,7 +164,7 @@ public class GoodsDetailController {
@RequestMapping(value = "/findGoodsDetailById", method = RequestMethod.GET) @RequestMapping(value = "/findGoodsDetailById", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询商品列表") @ApiOperation(value = "查询商品")
public ResponseData findGoodsDetailById( public ResponseData findGoodsDetailById(
@RequestParam(value = "id", required = true) Long id @RequestParam(value = "id", required = true) Long id
) { ) {

@ -0,0 +1,233 @@
package com.bweb.controller.Goods;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsRegionFreight;
import com.hai.entity.HighGoodsType;
import com.hai.entity.SecRegion;
import com.hai.goods.service.GoodsRegionFreightService;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.CommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Controller
@RequestMapping(value = "/regionFreight")
@Api(value = "区域运费业务")
public class GoodsRegionFreightController {
Logger log = LoggerFactory.getLogger(GoodsRegionFreightController.class);
@Resource
private GoodsRegionFreightService regionFreightService;
@Autowired
private UserCenter userCenter;
@Resource
private CommonService commonService;
@RequestMapping(value = "/getListRegionFreight", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getListRegionFreight(
@RequestParam(value = "regionName", required = false) String regionName,
@RequestParam(value = "regionId", required = false) String regionId,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
Map<String, Object> map = new HashMap<>();
map.put("regionName", regionName);
map.put("regionId", regionId);
PageHelper.startPage(pageNum,pageSize);
List<GoodsRegionFreight> list = regionFreightService.getRegionFreightList(map);
return ResponseMsgUtil.success(new PageInfo<>(list));
} catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/insertRegionFreight", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增产品")
public ResponseData insertRegionFreight(@RequestBody GoodsRegionFreight regionFreight, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (regionFreight == null ||
regionFreight.getRegionId() == null ||
regionFreight.getFreightPrice() == null ||
regionFreight.getFreePostPrice() == null
) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
GoodsRegionFreight goodsRegionFreight = regionFreightService.findRegionFreightByRegionId(regionFreight.getRegionId());
if (goodsRegionFreight != null) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前区域已经配置!");
}
SecRegion region = commonService.getRegionsById(Long.valueOf(regionFreight.getRegionId()));
if (region == null) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "区域错误!");
}
regionFreight.setRegionName(region.getRegionName());
regionFreight.setOpId(userInfoModel.getSecUser().getId());
regionFreight.setStatus(1);
regionFreight.setOpName(userInfoModel.getSecUser().getLoginName());
regionFreight.setCreateTime(new Date());
regionFreight.setUpdateTime(new Date());
regionFreightService.insertRegionFreight(regionFreight);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/updateRegionFreight", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改产品")
public ResponseData updateRegionFreight(@RequestBody GoodsRegionFreight regionFreight, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (regionFreight == null ||
regionFreight.getId() == null ||
regionFreight.getRegionId() == null ||
regionFreight.getFreightPrice() == null ||
regionFreight.getFreePostPrice() == null
) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
GoodsRegionFreight goodsRegionFreight = regionFreightService.findRegionFreightById(regionFreight.getId());
GoodsRegionFreight freightByRegionId = regionFreightService.findRegionFreightByRegionId(regionFreight.getRegionId());
if (goodsRegionFreight != null && !Objects.equals(freightByRegionId.getId(), goodsRegionFreight.getId())) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前区域已经配置!");
}
SecRegion region = commonService.getRegionsById(Long.valueOf(regionFreight.getRegionId()));
if (region == null) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "区域错误!");
}
if (goodsRegionFreight == null) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息!");
}
regionFreight.setRegionName(region.getRegionName());
regionFreight.setOpId(userInfoModel.getSecUser().getId());
regionFreight.setStatus(goodsRegionFreight.getStatus());
regionFreight.setOpName(userInfoModel.getSecUser().getLoginName());
regionFreight.setCreateTime(goodsRegionFreight.getCreateTime());
regionFreight.setUpdateTime(new Date());
regionFreightService.updateRegionFreight(regionFreight);
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findRegionFreightById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品")
public ResponseData findRegionFreightById(
@RequestParam(value = "id", required = true) Long id
) {
try {
GoodsRegionFreight goodsRegionFreight = regionFreightService.findRegionFreightById(id);
if (goodsRegionFreight == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息");
}
return ResponseMsgUtil.success(goodsRegionFreight);
} catch (Exception e) {
log.error("GoodsDetailController --> findGoodsDetailById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/deleteRegionFreight", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除")
public ResponseData deleteRegionFreight(
@RequestParam(value = "id", required = true) Long id
) {
try {
GoodsRegionFreight goodsRegionFreight = regionFreightService.findRegionFreightById(id);
if (goodsRegionFreight == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息");
}
regionFreightService.deleteRegionFreight(goodsRegionFreight.getId());
return ResponseMsgUtil.success("删除成功");
} catch (Exception e) {
log.error("GoodsDetailController --> findGoodsDetailById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -11,6 +11,7 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.config.WeChatQrcodeUtils; import com.hai.config.WeChatQrcodeUtils;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.goods.service.GoodsRegionFreightService;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.*; import com.hai.service.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -31,20 +32,20 @@ import java.util.Map;
@RestController @RestController
@RequestMapping(value="/common") @RequestMapping(value = "/common")
@Api(value="共用接口") @Api(value = "共用接口")
public class CommonController { public class CommonController {
Logger log = LoggerFactory.getLogger(CommonController.class); Logger log = LoggerFactory.getLogger(CommonController.class);
@Resource
private CommonService commonService;
@Resource @Resource
private SecConfigService secConfigService; private CommonService commonService;
@Resource @Resource
private BsCompanyService bsCompanyService; private SecConfigService secConfigService;
@Resource
private BsCompanyService bsCompanyService;
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@ -52,190 +53,188 @@ public class CommonController {
@Resource @Resource
private BsIntegralRebateService bsIntegralRebateService; private BsIntegralRebateService bsIntegralRebateService;
@RequestMapping(value="/getDredgeProvince",method= RequestMethod.GET) @Resource
@ResponseBody private GoodsRegionFreightService goodsRegionFreightService;
@ApiOperation(value = "查询已开通的省份")
public ResponseData getDredgeProvince(){ @RequestMapping(value = "/getDredgeProvince", method = RequestMethod.GET)
try { @ResponseBody
List<BsCompany> list = bsCompanyService.getCompany(new HashMap<>()); @ApiOperation(value = "查询已开通的省份")
List<Map<String,Object>> mapList = new ArrayList<>(); public ResponseData getDredgeProvince() {
Map<String,Object> map; try {
if (list.size() > 0) { List<BsCompany> list = bsCompanyService.getCompany(new HashMap<>());
for (BsCompany company : list) { List<Map<String, Object>> mapList = new ArrayList<>();
map = new HashMap<>(); Map<String, Object> map;
if (StringUtils.isNotBlank(company.getRegionId())) { if (list.size() > 0) {
map.put("companyId", company.getId()); for (BsCompany company : list) {
map.put("regionId", company.getRegionId()); map = new HashMap<>();
SecRegion secRegion = commonService.getRegionsById(Long.parseLong(company.getRegionId())); if (StringUtils.isNotBlank(company.getRegionId())) {
if (secRegion != null) { map.put("companyId", company.getId());
map.put("regionName", secRegion.getRegionName()); map.put("regionId", company.getRegionId());
} SecRegion secRegion = commonService.getRegionsById(Long.parseLong(company.getRegionId()));
mapList.add(map); if (secRegion != null) {
} map.put("regionName", secRegion.getRegionName());
} }
} mapList.add(map);
return ResponseMsgUtil.success(mapList); }
} catch (Exception e) { }
return ResponseMsgUtil.exception(e); }
} return ResponseMsgUtil.success(mapList);
} } catch (Exception e) {
return ResponseMsgUtil.exception(e);
@RequestMapping(value="/getRegionsByParentId",method= RequestMethod.GET) }
@ResponseBody }
@ApiOperation(value = "分级查询区域信息")
public ResponseData getRegionsByParentId(@RequestParam(name = "regionId", required = false) Long regionId){ @RequestMapping(value = "/getRegionsByParentId", method = RequestMethod.GET)
try { @ResponseBody
if (regionId == null){ @ApiOperation(value = "分级查询区域信息")
return ResponseMsgUtil.success(commonService.getCities()); public ResponseData getRegionsByParentId(@RequestParam(name = "regionId", required = false) Long regionId) {
} try {
return ResponseMsgUtil.success(commonService.getRegionsByParentId(regionId)); if (regionId == null) {
} catch (Exception e) { return ResponseMsgUtil.success(commonService.getCities());
return ResponseMsgUtil.exception(e); }
} return ResponseMsgUtil.success(commonService.getRegionsByParentId(regionId));
} } catch (Exception e) {
return ResponseMsgUtil.exception(e);
@RequestMapping(value="/getParentInfosByRegionId",method= RequestMethod.GET) }
@ResponseBody }
@ApiOperation(value = "查询父级区域信息")
public ResponseData getParentInfosByRegionId(@RequestParam(name = "regionId", required = true) Long regionId) { @RequestMapping(value = "/getParentInfosByRegionId", method = RequestMethod.GET)
try { @ResponseBody
return ResponseMsgUtil.success(commonService.getParentInfoByRegionId(regionId)); @ApiOperation(value = "查询父级区域信息")
} catch (Exception e) { public ResponseData getParentInfosByRegionId(@RequestParam(name = "regionId", required = true) Long regionId) {
return ResponseMsgUtil.exception(e); try {
} return ResponseMsgUtil.success(commonService.getParentInfoByRegionId(regionId));
} } catch (Exception e) {
return ResponseMsgUtil.exception(e);
@RequestMapping(value="/getRegionsById",method= RequestMethod.GET) }
@ResponseBody }
@ApiOperation(value = "查询区域详细信息")
public ResponseData getRegionsById(@RequestParam(name = "regionId", required = true) Long regionId){ @RequestMapping(value = "/getRegionsById", method = RequestMethod.GET)
try { @ResponseBody
return ResponseMsgUtil.success(commonService.getRegionsById(regionId)); @ApiOperation(value = "查询区域详细信息")
} catch (Exception e) { public ResponseData getRegionsById(@RequestParam(name = "regionId", required = true) Long regionId) {
return ResponseMsgUtil.exception(e); try {
} return ResponseMsgUtil.success(commonService.getRegionsById(regionId));
} } catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
@RequestMapping(value="/getDictionaries",method= RequestMethod.GET) }
@ResponseBody
@ApiOperation(value = "查询数据字典")
public ResponseData getDictionaries(){ @RequestMapping(value = "/getDictionaries", method = RequestMethod.GET)
try { @ResponseBody
return ResponseMsgUtil.success(commonService.getDictionaries()); @ApiOperation(value = "查询数据字典")
} catch (Exception e) { public ResponseData getDictionaries() {
return ResponseMsgUtil.exception(e); try {
} return ResponseMsgUtil.success(commonService.getDictionaries());
} } catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getDictionaryByCodeType",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据 码值类型 查询数据字典") @RequestMapping(value = "/getDictionaryByCodeType", method = RequestMethod.GET)
public ResponseData getDictionaryByCodeType(@RequestParam(name = "codeType", required = true) String codeType) { @ResponseBody
try { @ApiOperation(value = "根据 码值类型 查询数据字典")
public ResponseData getDictionaryByCodeType(@RequestParam(name = "codeType", required = true) String codeType) {
return ResponseMsgUtil.success(commonService.getDictionarys(codeType)); try {
} catch (Exception e) { return ResponseMsgUtil.success(commonService.getDictionarys(codeType));
log.error("CommonController --> getDictionaryByCodeType() error!", e);
return ResponseMsgUtil.exception(e); } catch (Exception e) {
} log.error("CommonController --> getDictionaryByCodeType() error!", e);
} return ResponseMsgUtil.exception(e);
}
@RequestMapping(value="/mappingSysNameOl",method = RequestMethod.GET) }
@ResponseBody
@ApiOperation(value = "根据 码值类型 查询数据字典") @RequestMapping(value = "/mappingSysNameOl", method = RequestMethod.GET)
public ResponseData mappingSysNameOl(@RequestParam(name = "codeType", required = true) String codeType) { @ResponseBody
try { @ApiOperation(value = "根据 码值类型 查询数据字典")
public ResponseData mappingSysNameOl(@RequestParam(name = "codeType", required = true) String codeType) {
return ResponseMsgUtil.success(commonService.mappingSysNameOl(codeType)); try {
} catch (Exception e) { return ResponseMsgUtil.success(commonService.mappingSysNameOl(codeType));
log.error("CommonController --> getDictionaryByCodeType() error!", e);
return ResponseMsgUtil.exception(e); } catch (Exception e) {
} log.error("CommonController --> getDictionaryByCodeType() error!", e);
} return ResponseMsgUtil.exception(e);
}
@RequestMapping(value="/getDictionaryByCodeTypeOl",method = RequestMethod.GET) }
@ResponseBody
@ApiOperation(value = "根据 码值类型 查询数据字典") @RequestMapping(value = "/getDictionaryByCodeTypeOl", method = RequestMethod.GET)
public ResponseData getDictionaryByCodeTypeOl(@RequestParam(name = "codeType", required = true) String codeType) { @ResponseBody
try { @ApiOperation(value = "根据 码值类型 查询数据字典")
public ResponseData getDictionaryByCodeTypeOl(@RequestParam(name = "codeType", required = true) String codeType) {
return ResponseMsgUtil.success(secConfigService.findByCodeType(codeType)); try {
} catch (Exception e) { return ResponseMsgUtil.success(secConfigService.findByCodeType(codeType));
log.error("CommonController --> getDictionaryByCodeType() error!", e);
return ResponseMsgUtil.exception(e); } catch (Exception e) {
} log.error("CommonController --> getDictionaryByCodeType() error!", e);
} return ResponseMsgUtil.exception(e);
}
@RequestMapping(value="/updateDictionary",method = RequestMethod.GET) }
@ResponseBody
@ApiOperation(value = "根据 码值类型 查询数据字典") @RequestMapping(value = "/updateDictionary", method = RequestMethod.GET)
public ResponseData updateDictionary( @ResponseBody
@RequestParam(name = "codeType", required = true) String codeType, @ApiOperation(value = "根据 码值类型 查询数据字典")
@RequestParam(name = "codeValue", required = true) String codeValue public ResponseData updateDictionary(@RequestParam(name = "codeType", required = true) String codeType, @RequestParam(name = "codeValue", required = true) String codeValue) {
) { try {
try {
SecConfig secConfig = secConfigService.findByCodeType(codeType);
SecConfig secConfig = secConfigService.findByCodeType(codeType); secConfig.setCodeValue(codeValue);
secConfig.setCodeValue(codeValue); secConfigService.updateSecConfig(secConfig);
secConfigService.updateSecConfig(secConfig);
return ResponseMsgUtil.success("修改成功");
return ResponseMsgUtil.success("修改成功"); } catch (Exception e) {
} catch (Exception e) { log.error("CommonController --> getDictionaryByCodeType() error!", e);
log.error("CommonController --> getDictionaryByCodeType() error!", e); return ResponseMsgUtil.exception(e);
return ResponseMsgUtil.exception(e); }
} }
}
@RequestMapping(value = "/getDictionaryByCodeTypeAndExt", method = RequestMethod.GET)
@RequestMapping(value="/getDictionaryByCodeTypeAndExt",method = RequestMethod.GET) @ResponseBody
@ResponseBody @ApiOperation(value = "根据 码值类型 查询数据字典")
@ApiOperation(value = "根据 码值类型 查询数据字典") public ResponseData getDictionaryByCodeTypeAndExt(@RequestParam(name = "codeType", required = true) String codeType, String ext1) {
public ResponseData getDictionaryByCodeTypeAndExt(@RequestParam(name = "codeType", required = true) String codeType, String ext1) { try {
try {
return ResponseMsgUtil.success(commonService.getDictionarysAndExt(codeType, ext1));
return ResponseMsgUtil.success(commonService.getDictionarysAndExt(codeType,ext1));
} catch (Exception e) {
} catch (Exception e) { log.error("CommonController --> getDictionaryByCodeType() error!", e);
log.error("CommonController --> getDictionaryByCodeType() error!", e); return ResponseMsgUtil.exception(e);
return ResponseMsgUtil.exception(e); }
} }
}
@RequestMapping(value = "/getIdAndNameByCodeType", method = RequestMethod.GET)
@RequestMapping(value="/getIdAndNameByCodeType",method = RequestMethod.GET) @ResponseBody
@ResponseBody @ApiOperation(value = "根据 码值类型 查询数据字典的id和name")
@ApiOperation(value = "根据 码值类型 查询数据字典的id和name") public ResponseData getIdAndNameByCodeType(@RequestParam(name = "codeType", required = true) String codeType) {
public ResponseData getIdAndNameByCodeType(@RequestParam(name = "codeType", required = true) String codeType) { try {
try {
return ResponseMsgUtil.success(commonService.getIdAndName(codeType));
return ResponseMsgUtil.success(commonService.getIdAndName(codeType));
} catch (Exception e) {
} catch (Exception e) { log.error("CommonController --> getIdAndNameByCodeType() error!", e);
log.error("CommonController --> getIdAndNameByCodeType() error!", e); return ResponseMsgUtil.exception(e);
return ResponseMsgUtil.exception(e); }
} }
}
@RequestMapping(value = "/getDictionaryByCodeTypeAndValue", method = RequestMethod.GET)
@RequestMapping(value="/getDictionaryByCodeTypeAndValue",method = RequestMethod.GET) @ResponseBody
@ResponseBody @ApiOperation(value = "根据码值类型及value查询数据字典")
@ApiOperation(value = "根据码值类型及value查询数据字典") public ResponseData getDictionaryByCodeType(@RequestParam(name = "codeType", required = true) String codeType, @RequestParam(name = "codeValue", required = true) String codeValue) {
public ResponseData getDictionaryByCodeType(@RequestParam(name = "codeType", required = true) String codeType, try {
@RequestParam(name = "codeValue", required = true) String codeValue) {
try { return ResponseMsgUtil.success(commonService.mappingSysCode(codeType, codeValue));
return ResponseMsgUtil.success(commonService.mappingSysCode(codeType,codeValue)); } catch (Exception e) {
log.error("CommonController --> getDictionaryByCodeTypeAndValue() error!", e);
} catch (Exception e) { return ResponseMsgUtil.exception(e);
log.error("CommonController --> getDictionaryByCodeTypeAndValue() error!", e); }
return ResponseMsgUtil.exception(e); }
}
} @RequestMapping(value = "/findSecConfigByType", method = RequestMethod.GET)
@RequestMapping(value="/findSecConfigByType",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "根据码值类型查询数据") @ApiOperation(value = "根据码值类型查询数据")
public ResponseData findSecConfigByType(@RequestParam(name = "codeType", required = true) String codeType) { public ResponseData findSecConfigByType(@RequestParam(name = "codeType", required = true) String codeType) {
@ -253,44 +252,41 @@ public class CommonController {
@RequestMapping(value = "/findByLatAndLng", method = RequestMethod.GET) @RequestMapping(value = "/findByLatAndLng", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取定位信息") @ApiOperation(value = "获取定位信息")
public ResponseData findByLatAndLng( public ResponseData findByLatAndLng(@RequestParam(name = "lng", required = true) String lng, @RequestParam(name = "lat", required = true) String lat) {
@RequestParam(name = "lng", required = true) String lng,
@RequestParam(name = "lat", required = true) String lat
) {
try { try {
JSONObject jsonObjectR = commonService.findByLatAndLng(lng , lat); JSONObject jsonObjectR = commonService.findByLatAndLng(lng, lat);
if (!jsonObjectR.getString("status").equals("0")) { if (!jsonObjectR.getString("status").equals("0")) {
log.error("findByLatAndLng error!", "定位错误,请重新定位" ); log.error("findByLatAndLng error!", "定位错误,请重新定位");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位");
} }
JSONObject object = commonService.findByLatAndLng(lng , lat).getJSONObject("result").getJSONObject("addressComponent"); JSONObject object = commonService.findByLatAndLng(lng, lat).getJSONObject("result").getJSONObject("addressComponent");
ApiCity apiCity = commonService.findCityByName(object.getString("city")); ApiCity apiCity = commonService.findCityByName(object.getString("city"));
if (apiCity == null) { if (apiCity == null) {
log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); log.error("findByLatAndLng error!", "当前城市暂未开通任何服务");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市");
} }
BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode()); BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode());
if (company == null) { if (company == null) {
log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); log.error("findByLatAndLng error!", "当前城市暂未开通任何服务");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市");
} }
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("cityName" , apiCity.getCityName()); jsonObject.put("cityName", apiCity.getCityName());
jsonObject.put("provinceName" , apiCity.getProvinceName()); jsonObject.put("provinceName", apiCity.getProvinceName());
jsonObject.put("regionId" , company.getRegionId()); jsonObject.put("regionId", company.getRegionId());
jsonObject.put("companyName" , company.getName()); jsonObject.put("companyName", company.getName());
jsonObject.put("companyId" , company.getId()); jsonObject.put("companyId", company.getId());
return ResponseMsgUtil.success(jsonObject); return ResponseMsgUtil.success(jsonObject);
@ -300,43 +296,41 @@ public class CommonController {
} }
} }
@RequestMapping(value = "/findCompanyByCityName", method = RequestMethod.GET) @RequestMapping(value = "/findCompanyByCityName", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取定位信息") @ApiOperation(value = "获取定位信息")
public ResponseData findCompanyByCityName( public ResponseData findCompanyByCityName(@RequestParam(name = "cityName", required = true) String cityName) {
@RequestParam(name = "cityName", required = true) String cityName try {
) {
try {
ApiCity apiCity = commonService.findCityByName(cityName); ApiCity apiCity = commonService.findCityByName(cityName);
if (apiCity == null) { if (apiCity == null) {
log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); log.error("findByLatAndLng error!", "当前城市暂未开通任何服务");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市");
} }
BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode()); BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode());
if (company == null) { if (company == null) {
log.error("findByLatAndLng error!", "当前城市暂未开通任何服务" ); log.error("findByLatAndLng error!", "当前城市暂未开通任何服务");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前城市暂未开通任何服务,请选择其他城市");
} }
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("cityName" , apiCity.getCityName()); jsonObject.put("cityName", apiCity.getCityName());
jsonObject.put("provinceName" , apiCity.getProvinceName()); jsonObject.put("provinceName", apiCity.getProvinceName());
jsonObject.put("regionId" , company.getRegionId()); jsonObject.put("regionId", company.getRegionId());
jsonObject.put("companyName" , company.getName()); jsonObject.put("companyName", company.getName());
jsonObject.put("companyId" , company.getId()); jsonObject.put("companyId", company.getId());
return ResponseMsgUtil.success(jsonObject); return ResponseMsgUtil.success(jsonObject);
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e); log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }
} }
@RequestMapping(value = "/getRebateIntegral", method = RequestMethod.POST) @RequestMapping(value = "/getRebateIntegral", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ -346,26 +340,23 @@ public class CommonController {
System.out.println(object); System.out.println(object);
if (object.getInteger("type") == null || if (object.getInteger("type") == null || object.getLong("companyId") == null || object.getBigDecimal("price") == null) {
object.getLong("companyId") == null || log.error("CommonController -> getRebateIntegral() error!", "请求参数校验失败");
object.getBigDecimal("price") == null
) {
log.error("CommonController -> getRebateIntegral() error!","请求参数校验失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
} }
// 查询订单来源 // 查询订单来源
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("type" , object.getInteger("type")); map.put("type", object.getInteger("type"));
map.put("companyId" , object.getLong("companyId")); map.put("companyId", object.getLong("companyId"));
BsIntegralRebate bsIntegralRebate = bsIntegralRebateService.findIntegralRebateByMap(map); BsIntegralRebate bsIntegralRebate = bsIntegralRebateService.findIntegralRebateByMap(map);
if (bsIntegralRebate == null) { if (bsIntegralRebate == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无积分返利活动"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂无积分返利活动");
} }
BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP ); BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale(0, BigDecimal.ROUND_HALF_UP);
return ResponseMsgUtil.success(integralNum); return ResponseMsgUtil.success(integralNum);
@ -385,8 +376,8 @@ public class CommonController {
if (data == null) { if (data == null) {
List<JSONObject> jsonObjects = commonService.getRegional(); List<JSONObject> jsonObjects = commonService.getRegional("code" , "name" , "childs");
redisUtil.set("regional" , jsonObjects); redisUtil.set("regional", jsonObjects);
return ResponseMsgUtil.success(jsonObjects); return ResponseMsgUtil.success(jsonObjects);
@ -395,7 +386,19 @@ public class CommonController {
} }
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getRegionFreight", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取区域运费")
public ResponseData getRegionFreight(@RequestParam(name = "regionId", required = true) String regionId) {
try {
return ResponseMsgUtil.success(goodsRegionFreightService.getRegionFreight(regionId));
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e); log.error("HighOrderController --> unionStagingPay() error!", e);
@ -403,5 +406,4 @@ public class CommonController {
} }
} }
} }

@ -0,0 +1,206 @@
package com.cweb.controller.Goods;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.GoodsDeliveryAddress;
import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsShoppingCart;
import com.hai.entity.GoodsSku;
import com.hai.goods.model.ShoppingCartModel;
import com.hai.goods.service.DeliveryAddressService;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Controller
@RequestMapping(value = "/deliveryAddress")
@Api(value = "收货地址")
public class DeliveryAddressController {
Logger log = LoggerFactory.getLogger(DeliveryAddressController.class);
@Resource
private DeliveryAddressService deliveryAddressService;
@Autowired
private UserCenter userCenter;
@RequestMapping(value = "/getDeliveryAddressList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询收货地址列表")
public ResponseData getDeliveryAddressList(
HttpServletRequest request
) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
map.put("userId", userInfoModel.getHighUser().getId());
return ResponseMsgUtil.success(deliveryAddressService.getDeliveryAddressList(map));
} catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/insertDeliveryAddress", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增收货地址")
public ResponseData insertDeliveryAddress(@RequestBody GoodsDeliveryAddress deliveryAddress, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (deliveryAddress == null ||
deliveryAddress.getAddress() == null ||
deliveryAddress.getWhetherDefault() == null ||
deliveryAddress.getConsignee() == null ||
deliveryAddress.getPhone() == null ||
deliveryAddress.getRegionName() == null ||
deliveryAddress.getRegionId() == null
) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
deliveryAddress.setUserId(userInfoModel.getHighUser().getId());
deliveryAddress.setCreateTime(new Date());
deliveryAddress.setUpdateTime(new Date());
deliveryAddressService.insertDeliveryAddress(deliveryAddress);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/updateDeliveryAddress", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改收货地址")
public ResponseData updateDeliveryAddress(@RequestBody GoodsDeliveryAddress deliveryAddress, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (deliveryAddress == null ||
deliveryAddress.getId() == null ||
deliveryAddress.getAddress() == null ||
deliveryAddress.getWhetherDefault() == null ||
deliveryAddress.getConsignee() == null ||
deliveryAddress.getPhone() == null ||
deliveryAddress.getRegionName() == null ||
deliveryAddress.getRegionId() == null
) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
if (deliveryAddress.getWhetherDefault()) {
deliveryAddressService.cleanDeliveryAddressDefault(deliveryAddress.getUserId());
}
GoodsDeliveryAddress goodsDeliveryAddress = deliveryAddressService.findDeliveryAddressById(deliveryAddress.getId());
if (goodsDeliveryAddress == null) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前收货地址异常!");
}
deliveryAddress.setUserId(userInfoModel.getHighUser().getId());
deliveryAddress.setCreateTime(goodsDeliveryAddress.getCreateTime());
deliveryAddress.setUpdateTime(new Date());
deliveryAddressService.updateDeliveryAddress(deliveryAddress);
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("GoodsDetailController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findDeliveryAddressById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询收货地址详情")
public ResponseData findDeliveryAddressById(
@RequestParam(value = "id", required = true) Long id
) {
try {
GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(id);
if (deliveryAddress == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相信息");
}
return ResponseMsgUtil.success(deliveryAddress);
} catch (Exception e) {
log.error("GoodsDetailController --> findGoodsDetailById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/deleteShoppingCart", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除购物车信息")
public ResponseData deleteShoppingCart(
@RequestParam(value = "id", required = true) Long id, HttpServletRequest request
) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(id);
if (deliveryAddress == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息");
}
if (!Objects.equals(userInfoModel.getHighUser().getId(), deliveryAddress.getUserId())) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户信息错误");
}
deliveryAddressService.deleteDeliveryAddress(id);
return ResponseMsgUtil.success("删除成功");
} catch (Exception e) {
log.error("GoodsDetailController --> findGoodsDetailById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,5 +1,6 @@
package com.cweb.controller.Goods; package com.cweb.controller.Goods;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
@ -7,11 +8,15 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig;
import com.hai.entity.GoodsDetail; import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.GoodsSku; import com.hai.entity.GoodsSku;
import com.hai.goods.model.GoodsModel; import com.hai.goods.model.GoodsModel;
import com.hai.goods.service.GoodsDetailService; import com.hai.goods.service.GoodsDetailService;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.goods.service.GoodsSkuService; import com.hai.goods.service.GoodsSkuService;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
@ -39,9 +44,15 @@ public class GoodsController {
@Resource @Resource
private GoodsDetailService goodsDetailService; private GoodsDetailService goodsDetailService;
@Autowired
private RedisUtil redisUtil;
@Autowired @Autowired
private UserCenter userCenter; private UserCenter userCenter;
@Resource
private GoodsLogisticsService logisticsService;
@Resource @Resource
private HighGoodsTypeService highGoodsTypeService; private HighGoodsTypeService highGoodsTypeService;
@ -166,5 +177,38 @@ public class GoodsController {
} }
} }
@RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据快递单号查询物流信息")
public ResponseData getLogisticsMsg(@RequestParam(name = "num", required = true) String num) {
try {
Object data = redisUtil.get("logisticsMsg" + num);
if (data == null) {
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(num);
if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) {
GoodsLogistics logistics = logisticsService.editLogistics((JSONObject) jsonObjects.get("data"));
redisUtil.set("logisticsMsg" + num , logistics ,21600);
redisUtil.set("logisticsMsgOl" + num , logistics ,21600);
return ResponseMsgUtil.success(logistics);
}
return ResponseMsgUtil.success(jsonObjects);
} else {
return ResponseMsgUtil.success(data);
}
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -86,7 +86,7 @@ public class ShoppingCartController {
} }
return ResponseMsgUtil.success(new PageInfo<>(shoppingCartModels)); return ResponseMsgUtil.success(shoppingCartModels);
} catch (Exception e) { } catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e); log.error("GoodsDetailController --> getListUser() error!", e);

@ -1,5 +1,12 @@
package com.hai.config; package com.hai.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.HttpUtils;
import com.hai.common.utils.HttpsUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import sun.font.FontDesignMetrics; import sun.font.FontDesignMetrics;
@ -10,6 +17,7 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
@ -164,6 +172,16 @@ public class CommonConfig {
} }
} }
public static JSONObject getLogisticsMsg(String num) {
String appcode = "f9ace4c915054ca697a76fb9a4e1e8c0";
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "APPCODE " + appcode);
Map<String, String> querys = new HashMap<>();
querys.put("number", num);
return HttpsUtils.doGet("https://express3.market.alicloudapi.com/express3" , querys ,headers);
}
} }

@ -127,4 +127,7 @@ public class CommonSysConfig {
private String wxH5AppId; private String wxH5AppId;
private String wxH5AppSecret; private String wxH5AppSecret;
private String LogisticsAppKey;
private String logisticsAppSecret;
} }

@ -0,0 +1,77 @@
package com.hai.goods.service;
import com.hai.entity.GoodsDeliveryAddress;
import java.util.List;
import java.util.Map;
/**
* @serviceName deliveryAddressService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 收货地址业务
* @createTime 17:33 2023/4/13
**/
public interface DeliveryAddressService {
/**
* @Author Sum1Dream
* @Name insertGoodsDeliveryAddress
* @Description // 新增收货地址
* @Date 15:08 2023/4/11
* @Param [GoodsDeliveryAddress]
* @Return void
*/
void insertDeliveryAddress(GoodsDeliveryAddress deliveryAddress);
/**
* @Author Sum1Dream
* @Name updateGoodsDeliveryAddress
* @Description // 更新收货地址
* @Date 15:14 2023/4/11
* @Param [GoodsDeliveryAddress]
* @Return void
*/
void updateDeliveryAddress(GoodsDeliveryAddress deliveryAddress);
/**
* @Author Sum1Dream
* @Name getGoodsDeliveryAddressList
* @Description // 查询收货地址
* @Date 15:17 2023/4/11
* @Param [map]
* @Return java.util.List<com.hai.entity.GoodsDeliveryAddress>
*/
List<GoodsDeliveryAddress> getDeliveryAddressList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name findGoodsDeliveryAddressById
* @Description // 根据id查询详情
* @Date 16:19 2023/4/11
* @Param [id]
* @Return com.hai.entity.GoodsDeliveryAddress
*/
GoodsDeliveryAddress findDeliveryAddressById(Long id);
/**
* @Author Sum1Dream
* @Name deleteDeliveryAddress
* @Description // 删除收货地址
* @Date 17:37 2023/4/13
* @Param [id]
* @Return void
*/
void deleteDeliveryAddress(Long id);
/**
* @Author Sum1Dream
* @Name cleanDeliveryAddressDefault
* @Description // 清空所有的默认收货地址
* @Date 10:33 2023/4/17
* @Param [userId]
* @Return void
*/
void cleanDeliveryAddressDefault(Long userId);
}

@ -2,6 +2,7 @@ package com.hai.goods.service;
import com.hai.entity.ApiMchProduct; import com.hai.entity.ApiMchProduct;
import com.hai.entity.GoodsDetail; import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsLogistics;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -55,4 +56,5 @@ public interface GoodsDetailService {
* @Return com.hai.entity.GoodsDetail * @Return com.hai.entity.GoodsDetail
*/ */
GoodsDetail findGoodsDetailById(Long id); GoodsDetail findGoodsDetailById(Long id);
} }

@ -0,0 +1,77 @@
package com.hai.goods.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.GoodsLogistics;
import java.util.List;
import java.util.Map;
/**
* @serviceName GoodsLogisticsService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 物流信息业务
* @createTime 18:39 2023/4/13
**/
public interface GoodsLogisticsService {
/**
* @Author Sum1Dream
* @Name insertGoodsLogistics
* @Description // 新增物流信息
* @Date 15:08 2023/4/11
* @Param [GoodsLogistics]
* @Return void
*/
void insertGoodsLogistics(GoodsLogistics goodsLogistics);
/**
* @Author Sum1Dream
* @Name updateGoodsLogistics
* @Description // 更新物流信息
* @Date 15:14 2023/4/11
* @Param [GoodsLogistics]
* @Return void
*/
void updateGoodsLogistics(GoodsLogistics goodsLogistics);
/**
* @Author Sum1Dream
* @Name getGoodsLogisticsList
* @Description // 查询物流信息列表
* @Date 15:17 2023/4/11
* @Param [map]
* @Return java.util.List<com.hai.entity.GoodsLogistics>
*/
List<GoodsLogistics> getGoodsLogisticsList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name findGoodsLogisticsById
* @Description // 根据id查询物流信息
* @Date 16:19 2023/4/11
* @Param [id]
* @Return com.hai.entity.GoodsLogistics
*/
GoodsLogistics findGoodsLogisticsById(Long id);
/**
* @Author Sum1Dream
* @Name findGoodsLogisticsByNum
* @Description // 根据快递单号查询物流信息
* @Date 11:41 2023/4/14
* @Param [num]
* @Return com.hai.entity.GoodsLogistics
*/
GoodsLogistics findGoodsLogisticsByNum(String num);
/**
* @Author Sum1Dream
* @Name editLogistics
* @Description // 编辑物流信息
* @Date 11:33 2023/4/14
* @Param [goodsLogistics]
* @Return void
*/
GoodsLogistics editLogistics(JSONObject object);
}

@ -0,0 +1,89 @@
package com.hai.goods.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.GoodsRegionFreight;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* @serviceName GoodsRegionFreightService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 区域运费业务
* @createTime 15:11 2023/4/14
**/
public interface GoodsRegionFreightService {
/**
* @Author Sum1Dream
* @Name insertRegionFreight
* @Description // 新增
* @Date 15:08 2023/4/11
* @Param [RegionFreight]
* @Return void
*/
void insertRegionFreight(GoodsRegionFreight regionFreight);
/**
* @Author Sum1Dream
* @Name updateRegionFreight
* @Description // 更新
* @Date 15:14 2023/4/11
* @Param [RegionFreight]
* @Return void
*/
void updateRegionFreight(GoodsRegionFreight regionFreight);
/**
* @Author Sum1Dream
* @Name getRegionFreightList
* @Description // 查询列表
* @Date 15:17 2023/4/11
* @Param [map]
* @Return java.util.List<com.hai.entity.GoodsDetail>
*/
List<GoodsRegionFreight> getRegionFreightList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name findGoodsDetailById
* @Description // 查询详情
* @Date 16:19 2023/4/11
* @Param [id]
* @Return com.hai.entity.GoodsDetail
*/
GoodsRegionFreight findRegionFreightById(Long id);
/**
* @Author Sum1Dream
* @Name findRegionFreightByRegionId
* @Description // 获取区域运费根据区域编码
* @Date 19:08 2023/4/14
* @Param [regionId]
* @Return com.hai.entity.GoodsRegionFreight
*/
GoodsRegionFreight findRegionFreightByRegionId(String regionId);
/**
* @Author Sum1Dream
* @Name DeleteRegionFreight
* @Description // 删除
* @Date 15:09 2023/4/13
* @Param [id]
* @Return void
*/
void deleteRegionFreight(Long id);
/**
* @Author Sum1Dream
* @Name getRegionFreight
* @Description // 获取运费
* @Date 19:03 2023/4/14
* @Param [regionId]
* @Return java.math.BigDecimal
*/
JSONObject getRegionFreight(String regionId) throws Exception;
}

@ -0,0 +1,69 @@
package com.hai.goods.service.impl;
import com.hai.dao.GoodsDeliveryAddressMapper;
import com.hai.entity.GoodsDeliveryAddress;
import com.hai.entity.GoodsDeliveryAddressExample;
import com.hai.goods.service.DeliveryAddressService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("deliveryAddressService")
public class DeliveryAddressServiceImpl implements DeliveryAddressService {
@Resource
private GoodsDeliveryAddressMapper deliveryAddressMapper;
@Override
public void insertDeliveryAddress(GoodsDeliveryAddress deliveryAddress) {
deliveryAddressMapper.insert(deliveryAddress);
}
@Override
public void updateDeliveryAddress(GoodsDeliveryAddress deliveryAddress) {
deliveryAddressMapper.updateByPrimaryKey(deliveryAddress);
}
@Override
public List<GoodsDeliveryAddress> getDeliveryAddressList(Map<String, Object> map) {
GoodsDeliveryAddressExample example = new GoodsDeliveryAddressExample();
GoodsDeliveryAddressExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
}
return deliveryAddressMapper.selectByExample(example);
}
@Override
public GoodsDeliveryAddress findDeliveryAddressById(Long id) {
return deliveryAddressMapper.selectByPrimaryKey(id);
}
@Override
public void deleteDeliveryAddress(Long id) {
deliveryAddressMapper.deleteByPrimaryKey(id);
}
@Override
public void cleanDeliveryAddressDefault(Long userId) {
Map<String , Object> map = new HashMap<>();
map.put("userId" , userId);
List<GoodsDeliveryAddress> list = getDeliveryAddressList(map);
if (list.size()>1) {
for (GoodsDeliveryAddress deliveryAddress : list) {
deliveryAddress.setWhetherDefault(false);
updateDeliveryAddress(deliveryAddress);
}
}
}
}

@ -1,9 +1,11 @@
package com.hai.goods.service.impl; package com.hai.goods.service.impl;
import com.hai.dao.GoodsDetailMapper; import com.hai.dao.GoodsDetailMapper;
import com.hai.dao.GoodsLogisticsMapper;
import com.hai.entity.ApiMerchantsExample; import com.hai.entity.ApiMerchantsExample;
import com.hai.entity.GoodsDetail; import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsDetailExample; import com.hai.entity.GoodsDetailExample;
import com.hai.entity.GoodsLogistics;
import com.hai.goods.service.GoodsDetailService; import com.hai.goods.service.GoodsDetailService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -19,6 +21,9 @@ public class GoodsDetailServiceImpl implements GoodsDetailService {
@Resource @Resource
private GoodsDetailMapper goodsDetailMapper; private GoodsDetailMapper goodsDetailMapper;
@Resource
private GoodsLogisticsMapper logisticsMapper;
@Override @Override
public void insertGoodsDetail(GoodsDetail goodsDetail) { public void insertGoodsDetail(GoodsDetail goodsDetail) {
goodsDetailMapper.insert(goodsDetail); goodsDetailMapper.insert(goodsDetail);
@ -53,4 +58,5 @@ public class GoodsDetailServiceImpl implements GoodsDetailService {
public GoodsDetail findGoodsDetailById(Long id) { public GoodsDetail findGoodsDetailById(Long id) {
return goodsDetailMapper.selectByPrimaryKey(id); return goodsDetailMapper.selectByPrimaryKey(id);
} }
} }

@ -0,0 +1,88 @@
package com.hai.goods.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.dao.GoodsLogisticsMapper;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.GoodsLogisticsExample;
import com.hai.goods.service.GoodsLogisticsService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("goodsLogisticsService")
public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
@Resource
private GoodsLogisticsMapper goodsLogisticsMapper;
@Override
public void insertGoodsLogistics(GoodsLogistics goodsLogistics) {
goodsLogisticsMapper.insert(goodsLogistics);
}
@Override
public void updateGoodsLogistics(GoodsLogistics goodsLogistics) {
goodsLogisticsMapper.updateByPrimaryKey(goodsLogistics);
}
@Override
public List<GoodsLogistics> getGoodsLogisticsList(Map<String, Object> map) {
return null;
}
@Override
public GoodsLogistics findGoodsLogisticsById(Long id) {
return goodsLogisticsMapper.selectByPrimaryKey(id);
}
@Override
public GoodsLogistics findGoodsLogisticsByNum(String num) {
GoodsLogisticsExample example = new GoodsLogisticsExample();
GoodsLogisticsExample.Criteria criteria = example.createCriteria();
criteria.andNumberEqualTo(num).andStatusEqualTo(1);
List<GoodsLogistics> logistics = goodsLogisticsMapper.selectByExample(example);
if (logistics.size() > 0) {
return logistics.get(0);
}
return null;
}
@Override
public GoodsLogistics editLogistics(JSONObject jsonObject) {
JSONObject info = (JSONObject) jsonObject.getJSONArray("info").get(0);
GoodsLogistics logistics = findGoodsLogisticsByNum(info.getString("mailNo"));
if (logistics == null) {
logistics = new GoodsLogistics();
}
logistics.setTaskNo(jsonObject.getString("orderNo"));
logistics.setTheLastTime(info.getDate("theLastTime"));
logistics.setTheLastMessage(info.getString("theLastMessage"));
logistics.setTakeTime(info.getString("takeTime"));
logistics.setNumber(info.getString("mailNo"));
logistics.setLogisticsStatus(info.getString("logisticsStatus"));
logistics.setExpressCompanyName(info.getString("logisticsCompanyName"));
logistics.setLogisticsStatusDesc(info.getString("logisticsStatusDesc"));
logistics.setLogisticsTraceDetails(info.getString("logisticsTraceDetailList"));
logistics.setStatus(1);
if ( logistics.getId() == null) {
logistics.setCreateTime(new Date());
insertGoodsLogistics(logistics);
} else {
updateGoodsLogistics(logistics);
}
return logistics;
}
}

@ -0,0 +1,186 @@
package com.hai.goods.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.dao.GoodsRegionFreightMapper;
import com.hai.entity.GoodsRegionFreight;
import com.hai.entity.GoodsRegionFreightExample;
import com.hai.entity.SecRegion;
import com.hai.goods.service.GoodsRegionFreightService;
import com.hai.service.CommonService;
import com.hai.service.SecConfigService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@Service("goodsRegionFreightService")
public class GoodsRegionFreightServiceImpl implements GoodsRegionFreightService {
@Resource
private GoodsRegionFreightMapper regionFreightMapper;
@Resource
private SecConfigService secConfigService;
@Resource
private CommonService commonService;
@Override
public void insertRegionFreight(GoodsRegionFreight regionFreight) {
regionFreightMapper.insert(regionFreight);
}
@Override
public void updateRegionFreight(GoodsRegionFreight regionFreight) {
regionFreightMapper.updateByPrimaryKey(regionFreight);
}
@Override
public List<GoodsRegionFreight> getRegionFreightList(Map<String, Object> map) {
GoodsRegionFreightExample example = new GoodsRegionFreightExample();
GoodsRegionFreightExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(map, "regionName") != null) {
criteria.andRegionNameLike("%" + MapUtils.getString(map, "regionName") + "%");
}
if (MapUtils.getString(map, "regionId") != null) {
criteria.andRegionIdEqualTo(MapUtils.getString(map, "regionId"));
}
criteria.andStatusEqualTo(1);
return regionFreightMapper.selectByExample(example);
}
@Override
public GoodsRegionFreight findRegionFreightById(Long id) {
return regionFreightMapper.selectByPrimaryKey(id);
}
@Override
public GoodsRegionFreight findRegionFreightByRegionId(String regionId) {
GoodsRegionFreightExample example = new GoodsRegionFreightExample();
example.createCriteria().andRegionIdEqualTo(regionId).andStatusEqualTo(1);
List<GoodsRegionFreight> list = regionFreightMapper.selectByExample(example);
if (list.size() > 0 ) {
return list.get(0);
}
return null;
}
@Override
public void deleteRegionFreight(Long id) {
regionFreightMapper.deleteByPrimaryKey(id);
}
@Override
public JSONObject getRegionFreight(String regionId) {
// 获取默认包邮价格 , 运费
BigDecimal freePostPrice = new BigDecimal(secConfigService.findByCodeType("FREE_POST_PRICE").getCodeValue());
BigDecimal freightPrice = new BigDecimal(secConfigService.findByCodeType("FREIGHT_PRICE").getCodeValue());
JSONObject jsonObject = new JSONObject();
// 查询当前登记
GoodsRegionFreight goodsRegionFreight = findRegionFreightByRegionId(regionId);
SecRegion region = commonService.getRegionsById(Long.parseLong(regionId));
if (region == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效区域编码!");
}
if (goodsRegionFreight != null) {
jsonObject.put("freePostPrice" , goodsRegionFreight.getFreePostPrice());
jsonObject.put("freightPrice" , goodsRegionFreight.getFreightPrice());
return jsonObject;
}
if (region.getParentId() == null) {
jsonObject.put("freePostPrice" , freePostPrice);
jsonObject.put("freightPrice" , freightPrice);
return jsonObject;
}
getRegionFreight(region.getParentId().toString());
return jsonObject;
}
// @Override
// public JSONObject getRegionFreight(String regionId) throws Exception {
//
// // 获取默认包邮价格 , 运费
// BigDecimal freePostPrice = new BigDecimal(secConfigService.findByCodeType("FREE_POST_PRICE").getCodeValue());
// BigDecimal freightPrice = new BigDecimal(secConfigService.findByCodeType("FREIGHT_PRICE").getCodeValue());
//
// JSONObject jsonObject = new JSONObject();
//
// // 查询当前登记
// GoodsRegionFreight goodsRegionFreight = findRegionFreightByRegionId(regionId);
//
// SecRegion region = commonService.getRegionsById(Long.parseLong(regionId));
//
// if (region == null) {
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无效区域编码!");
// }
//
// if (goodsRegionFreight != null) {
// jsonObject.put("freePostPrice" , goodsRegionFreight.getFreePostPrice());
// jsonObject.put("freightPrice" , goodsRegionFreight.getFreightPrice());
// return jsonObject;
// }
//
// if (region.getParentId() == null) {
// jsonObject.put("freePostPrice" , freePostPrice);
// jsonObject.put("freightPrice" , freightPrice);
// return jsonObject;
// }
//
// GoodsRegionFreight goodsRegionFreight1 = findRegionFreightByRegionId(region.getParentId().toString());
// SecRegion region1 = commonService.getRegionsById(region.getParentId());
//
// if (goodsRegionFreight1 != null) {
// jsonObject.put("freePostPrice" , goodsRegionFreight1.getFreePostPrice());
// jsonObject.put("freightPrice" , goodsRegionFreight1.getFreightPrice());
// return jsonObject;
// }
//
// if (region1.getParentId() == null) {
// jsonObject.put("freePostPrice" , freePostPrice);
// jsonObject.put("freightPrice" , freightPrice);
// return jsonObject;
// }
//
// GoodsRegionFreight goodsRegionFreight2 = findRegionFreightByRegionId(region1.getParentId().toString());
// SecRegion region2 = commonService.getRegionsById(region1.getParentId());
//
// if (goodsRegionFreight2 != null) {
// jsonObject.put("freePostPrice" , goodsRegionFreight2.getFreePostPrice());
// jsonObject.put("freightPrice" , goodsRegionFreight2.getFreightPrice());
// return jsonObject;
// }
//
// if (region2.getParentId() == null) {
// jsonObject.put("freePostPrice" , freePostPrice);
// jsonObject.put("freightPrice" , freightPrice);
// return jsonObject;
// }
//
// jsonObject.put("freePostPrice" , freePostPrice);
// jsonObject.put("freightPrice" , freightPrice);
//
// return jsonObject;
// }
}

@ -317,7 +317,7 @@ public interface CommonService {
* @Param [] * @Param []
* @Return com.alibaba.fastjson.JSONObject * @Return com.alibaba.fastjson.JSONObject
*/ */
List<JSONObject> getRegional(); List<JSONObject> getRegional(String code , String name ,String child);
/** /**
* @Author Sum1Dream * @Author Sum1Dream

@ -731,7 +731,7 @@ public class CommonServiceImpl implements CommonService {
} }
@Override @Override
public List<JSONObject> getRegional() { public List<JSONObject> getRegional(String code , String name , String child) {
// 获取父类 // 获取父类
List<SecRegion> regionListParent = getSecRegion(null); List<SecRegion> regionListParent = getSecRegion(null);
@ -740,8 +740,8 @@ public class CommonServiceImpl implements CommonService {
for (SecRegion secRegion : regionListParent) { for (SecRegion secRegion : regionListParent) {
JSONObject provinceObject = new JSONObject(); JSONObject provinceObject = new JSONObject();
provinceObject.put("code" , secRegion.getRegionId()); provinceObject.put(code , secRegion.getRegionId());
provinceObject.put("name" , secRegion.getRegionName()); provinceObject.put(name , secRegion.getRegionName());
List<SecRegion> regionList = getSecRegion(secRegion.getRegionId()); List<SecRegion> regionList = getSecRegion(secRegion.getRegionId());
@ -749,8 +749,8 @@ public class CommonServiceImpl implements CommonService {
List<JSONObject> jsonCity = new ArrayList<>(); List<JSONObject> jsonCity = new ArrayList<>();
for (SecRegion city : regionList) { for (SecRegion city : regionList) {
JSONObject objectCity = new JSONObject(); JSONObject objectCity = new JSONObject();
objectCity.put("code" , city.getRegionId()); objectCity.put(code , city.getRegionId());
objectCity.put("name" , city.getRegionName()); objectCity.put(name , city.getRegionName());
List<SecRegion> areaList = getSecRegion(city.getRegionId()); List<SecRegion> areaList = getSecRegion(city.getRegionId());
@ -758,15 +758,16 @@ public class CommonServiceImpl implements CommonService {
List<JSONObject> jsonArea = new ArrayList<>(); List<JSONObject> jsonArea = new ArrayList<>();
for (SecRegion area : areaList) { for (SecRegion area : areaList) {
JSONObject objectArea = new JSONObject(); JSONObject objectArea = new JSONObject();
objectArea.put("code" , area.getRegionId()); objectArea.put(code , area.getRegionId());
objectArea.put("name" , area.getRegionName()); objectArea.put(name , area.getRegionName());
objectArea.put("isLeaf" , true);
jsonArea.add(objectArea); jsonArea.add(objectArea);
} }
provinceObject.put("childs" , jsonArea); objectCity.put(child , jsonArea);
} }
jsonCity.add(objectCity); jsonCity.add(objectCity);
} }
provinceObject.put("childs" , jsonCity); provinceObject.put(child , jsonCity);
} }
jsonProvince.add(provinceObject); jsonProvince.add(provinceObject);

@ -119,3 +119,7 @@ wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
wxH5AppId=wxa075e8509802f826 wxH5AppId=wxa075e8509802f826
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5
logisticsAppKey=5d806a99fbcc48e19717beef11fa1700
logisticsAppSecret=5ba7552b194e4147b7db1c34143e3317

Loading…
Cancel
Save