Authored by mlge

Merge branch 'dev-csm-split-1126' of http://git.yoho.cn/platform/platform-cms in…

…to dev-csm-split-1126
... ... @@ -176,6 +176,22 @@ public class MakePromotionController {
return responseBean;
}
@RequestMapping("/updateNotEffectMakePromotion")
@ResponseBody
public Integer updateNotEffectMakePromotion(MakePromotionReq makePromotionReq) {
logger.info("enter updateNotEffectMakePromotion with param is {}", makePromotionReq);
Integer updateResult = makePromotionService.updateNotEffectMakePromotion(makePromotionReq);
return updateResult;
}
@RequestMapping("/addMakePromotion")
@ResponseBody
public Integer addMakePromotion(MakePromotionReq makePromotionReq) {
logger.info("enter addMakePromotion with param is {}", makePromotionReq);
Integer result = makePromotionService.addMakePromotion(makePromotionReq);
return result;
}
/**
* 获取专区活动相关商品列表
*/
... ...
... ... @@ -63,7 +63,7 @@ public class SpecialController {
* @return
*/
// @RequestMapping(params = "method=getStyleListSel")
@RequestMapping(params = "/getStyleListSel")
@RequestMapping("/getStyleListSel")
@ResponseBody
public JSONArray getStyleListSel(EnumTypeRequestBean enumTypeRequestBean) {
logger.info("begin getStyleListSel");
... ...
package com.yohobuy.platform.cms.restapi;
import com.yohobuy.platform.cms.service.VersionService;
import com.yohobuy.platform.common.page.PageRequest;
import com.yohobuy.platform.model.cms.bo.AppVersionClientTypeBO;
import com.yohobuy.platform.model.cms.bo.AppVersionEditPageBO;
import com.yohobuy.platform.model.cms.bo.AppVersionIndexBo;
import com.yohobuy.platform.model.cms.bo.AppVersionWarningBo;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.common.PageRequestBO;
... ... @@ -17,8 +13,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* APP版本
... ...
... ... @@ -1238,6 +1238,12 @@ public class ResourcesServiceImpl implements ResourcesService {
addressArray.add(addAddress("go.vipInfo","会员中心页"));
addressArray.add(addAddress("go.vipexclusivepro","会员专享列表"));
addressArray.add(addAddress("go.minealliance","联盟"));
addressArray.add(addAddress("go.miniapp", "跳转到小程序"));
addressArray.add(addAddress("go.collagehome", "拼团首页"));
addressArray.add(addAddress("go.switchchannel", "频道切换"));
addressArray.add(addAddress("go.mineredpackage", "我的红包"));
addressArray.add(addAddress("go.ufo", "UFO落地页"));
addressArray.add(addAddress("go.bargainlist", "砍价商品列表"));
return addressArray;
}
... ...
... ... @@ -73,14 +73,35 @@ public class SpecialServiceImpl implements ISpecialService {
//头部Banner(上)
special.setBannerImg(ImagesHelper.getImageUrl(jsonObjectList.get(0).get("img").toString(), 480, 280, 0, ImagesConstant.BUCKET_ERP_COUPONIMG));
special.setHeight1(jsonObjectList.get(0).get("height").toString());
if (jsonObjectList.size() > 1) {
//头部Banner(下)
special.setImg2(ImagesHelper.getImageUrl(jsonObjectList.get(1).get("img").toString(), 480, 280, 0, ImagesConstant.BUCKET_ERP_COUPONIMG));
special.setHeight2(jsonObjectList.get(1).get("height").toString());
}
if (jsonObjectList.size() > 2) {
//详情页图片
special.setImg3(ImagesHelper.getImageUrl(jsonObjectList.get(2).get("img").toString(), 480, 280, 0, ImagesConstant.BUCKET_ERP_COUPONIMG));
for (int j = 1; j < jsonObjectList.size(); j++) {
if (jsonObjectList.get(j).containsKey("flag")) {
String flag = jsonObjectList.get(j).getString("flag");
String img, height;
if(jsonObjectList.get(j).containsKey("img")) {
img = ImagesHelper.getImageUrl(jsonObjectList.get(j).get("img").toString(), 480, 280, 0, ImagesConstant.BUCKET_ERP_COUPONIMG);
} else {
img = "";
}
if (jsonObjectList.get(j).containsKey("height")) {
height = jsonObjectList.get(j).get("height").toString();
} else {
height = "";
}
//头部Banner(下)
if(StringUtils.equals(flag, "head2")) {
special.setImg2(img);
special.setHeight2(height);
}
//app banner
if(StringUtils.equals(flag, "appBanner")) {
special.setImg4(img);
special.setHeight4(height);
}
//详情页图片
if(StringUtils.equals(flag, "detail")) {
special.setImg3(img);
}
}
}
}
// 专区对应商品数量
... ... @@ -173,12 +194,22 @@ public class SpecialServiceImpl implements ISpecialService {
obj = new JSONObject();
obj.put("img", ImagesHelper.getImageRelativeUrl(req.getImg2(), ImagesConstant.BUCKET_ERP_COUPONIMG));
obj.put("height", req.getHeight2());
obj.put("flag", "head2");
jsonObjectList.add(obj);
}
//详情页图片
if (StringUtils.isNotEmpty(req.getImg3())) {
obj = new JSONObject();
obj.put("img", ImagesHelper.getImageRelativeUrl(req.getImg3(), ImagesConstant.BUCKET_ERP_COUPONIMG));
obj.put("flag", "detail");
jsonObjectList.add(obj);
}
//appBanner
if (StringUtils.isNotEmpty(req.getImg4())) {
obj = new JSONObject();
obj.put("img", ImagesHelper.getImageRelativeUrl(req.getImg4(), ImagesConstant.BUCKET_ERP_COUPONIMG));
obj.put("height", req.getHeight4());
obj.put("flag", "appBanner");
jsonObjectList.add(obj);
}
// 转义
... ...
... ... @@ -7,6 +7,7 @@ import com.yohobuy.platform.common.convert.Convert;
import com.yohobuy.platform.common.error.ErrorCode;
import com.yohobuy.platform.common.exception.PlatformException;
import com.yohobuy.platform.common.util.IntegerUtils;
import com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorDetailMapper;
import com.yohobuy.platform.dal.operations.model.ActivtyTemplatedFloorDetail;
import com.yohobuy.platform.model.operations.ActivtyTemplatedFloorBo;
import com.yohobuy.platform.model.operations.ActivtyTemplatedFloorDetailBo;
... ... @@ -18,6 +19,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Set;
... ... @@ -30,7 +32,7 @@ public final class ActivityTemplatedFloorDetailHelper {
private static Logger logger = LoggerFactory.getLogger(ActivityTemplatedFloorDetailHelper.class);
public static Set<Integer> paramTypeIntSet = Sets.newHashSet(TempCompParamType.number.getIntVal(),
TempCompParamType.string.getIntVal(),TempCompParamType.image.getIntVal());
TempCompParamType.string.getIntVal(),TempCompParamType.image.getIntVal(),TempCompParamType.date.getIntVal());
private static final Convert convert = new BeanConvert();
... ... @@ -266,8 +268,7 @@ public final class ActivityTemplatedFloorDetailHelper {
}
private static void MergeWithComp(ActivtyTemplatedFloorDetailBo floorDetailBo,
public static void MergeWithComp(ActivtyTemplatedFloorDetailBo floorDetailBo,
int atId,int floorId,int level,
TemplatedComponentBo componentBo){
... ... @@ -280,7 +281,7 @@ public final class ActivityTemplatedFloorDetailHelper {
floorDetailBo.setLevel(level);
}
private static void MergeWithComponentParam(ActivtyTemplatedFloorDetailBo floorDetailBo,TemplatedComponentParamBo paramBo){
public static void MergeWithComponentParam(ActivtyTemplatedFloorDetailBo floorDetailBo,TemplatedComponentParamBo paramBo){
floorDetailBo.setParamType(paramBo.getType());
floorDetailBo.setParamId(paramBo.getId());
... ...
... ... @@ -8,12 +8,16 @@ import com.yohobuy.platform.model.common.api.OperationName;
import com.yohobuy.platform.model.operations.ActivtyTemplatedBo;
import com.yohobuy.platform.model.operations.request.ActivityTemplatedPageBo;
import com.yohobuy.platform.operations.service.impl.ActivtyTemplatedService;
import com.yohobuy.platform.operations.util.HttpUtil;
import org.apache.commons.lang3.StringUtils;
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.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
... ... @@ -73,7 +77,7 @@ public class ActivtyTemplatedController extends BasicController{
@RequestMapping(value = "/getActivtyTemplated")
@ResponseBody
public ApiResponse getActivtyTemplated(Integer id){
public ApiResponse getActivtyTemplated(@RequestParam("id") Integer id){
logger.info("ActivtyTemplatedController.getActivtyTemplated id {}",id);
if (id == null){
return handleParamIsNull();
... ... @@ -89,7 +93,7 @@ public class ActivtyTemplatedController extends BasicController{
@RequestMapping(value = "/getActivtyTemplatedBaseInfo")
@ResponseBody
public ApiResponse getActivtyTemplatedBaseInfo(Integer id){
public ApiResponse getActivtyTemplatedBaseInfo(@RequestParam("id") Integer id){
logger.info("ActivtyTemplatedController.getActivtyTemplatedBaseInfo id {}",id);
if (id == null){
return handleParamIsNull();
... ... @@ -144,7 +148,7 @@ public class ActivtyTemplatedController extends BasicController{
@RequestMapping(value = "/deleteActivtyTemplated")
@ResponseBody
public ApiResponse deleteActivtyTemplated(Integer id){
public ApiResponse deleteActivtyTemplated(@RequestParam("id") Integer id){
if (id == null){
return handleParamIsNull();
}
... ... @@ -158,7 +162,7 @@ public class ActivtyTemplatedController extends BasicController{
@RequestMapping(value = "/resumeActivtyTemplated")
@ResponseBody
public ApiResponse resumeActivtyTemplated(Integer id){
public ApiResponse resumeActivtyTemplated(@RequestParam("id") Integer id){
if (id == null){
return handleParamIsNull();
}
... ... @@ -187,7 +191,7 @@ public class ActivtyTemplatedController extends BasicController{
@RequestMapping(value = "/open")
@ResponseBody
public ApiResponse open(Integer id){
public ApiResponse open(@RequestParam("id") Integer id){
logger.info("ActivtyTemplatedController.open id {}",id);
if (id == null){
return handleParamIsNull();
... ... @@ -203,7 +207,7 @@ public class ActivtyTemplatedController extends BasicController{
@RequestMapping(value = "/close")
@ResponseBody
public ApiResponse close(Integer id){
public ApiResponse close(@RequestParam("id") Integer id){
logger.info("ActivtyTemplatedController.close id {}",id);
if (id == null){
return handleParamIsNull();
... ... @@ -219,7 +223,7 @@ public class ActivtyTemplatedController extends BasicController{
@RequestMapping(value = "/clone")
@ResponseBody
public ApiResponse clone(Integer id){
public ApiResponse clone(@RequestParam("id") Integer id){
logger.info("ActivtyTemplatedController.clone id {}",id);
if (id == null){
return handleParamIsNull();
... ... @@ -250,4 +254,32 @@ public class ActivtyTemplatedController extends BasicController{
.build();
}
@RequestMapping(value = "/checkUrl")
@ResponseBody
public ApiResponse checkUrl(@RequestParam("url") String url){
boolean result = true;
try{
logger.info("in checkUrl, url {}", url);
if (StringUtils.isBlank(url)){
return new ApiResponse(FAIL, Message.buildApiMessage("URL","检查", Message.FAIL));
}
HttpUtil.doGet(url);
}catch (Exception e){
logger.warn("in checkUrl, occur error", e);
result = false;
}
return new ApiResponse.ApiResponseBuilder()
.code(SUCCESS)
.data(result)
.message(Message.buildApiMessage("URL","检查", Message.SUCCESS))
.build();
}
@RequestMapping(value = "/layout")
@CrossOrigin(origins="*", maxAge = 3600)
public String layout(Integer id, Integer shareid){
return "redirect:/html/activeModule/layout.html?id=" + id + "&shareid=" + shareid;
}
}
... ...
... ... @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yohobuy.platform.model.common.ApiResponse;
... ... @@ -58,7 +59,7 @@ public class ConsultController {
*/
@RequestMapping("/batchDel")
@ResponseBody
public ApiResponse batchDel(String id) {
public ApiResponse batchDel(@RequestParam("id")String id) {
try {
return new ApiResponse.ApiResponseBuilder().code(200).message("success").data(consultService.batchDel(id)).build();
} catch (ServiceException e) {
... ... @@ -74,7 +75,7 @@ public class ConsultController {
*/
@RequestMapping("/delByUid")
@ResponseBody
public ApiResponse delByUid(String uid) {
public ApiResponse delByUid(@RequestParam("uid") String uid) {
try {
return new ApiResponse.ApiResponseBuilder().code(200).message("success").data(consultService.delByUid(uid)).build();
} catch (ServiceException e) {
... ... @@ -90,7 +91,7 @@ public class ConsultController {
*/
@RequestMapping("/del")
@ResponseBody
public ApiResponse del(String id) {
public ApiResponse del(@RequestParam("id") String id) {
try {
return new ApiResponse.ApiResponseBuilder().code(200).message("success").data(consultService.del(id)).build();
} catch (ServiceException e) {
... ... @@ -106,7 +107,7 @@ public class ConsultController {
*/
@RequestMapping("/restore")
@ResponseBody
public ApiResponse restore(String id) {
public ApiResponse restore(@RequestParam("id") String id) {
try {
return new ApiResponse.ApiResponseBuilder().code(200).message("success").data(consultService.restore(id)).build();
} catch (ServiceException e) {
... ...
package com.yohobuy.platform.operations.service;
import com.yoho.service.model.request.AreaReqBO;
import com.yoho.service.model.response.AreaRspBo;
import com.yohobuy.platform.model.operations.request.AreaReqBO;
import com.yohobuy.platform.model.operations.AreaRspBo;
import java.util.List;
... ...
... ... @@ -93,6 +93,28 @@ public class ActivtyTemplatedFloorDetailService implements BaseService<ActivtyTe
}
/**
* 新加方法 不需要递归组件 忽略组件中套组件
* @param atfdList
* @return
*/
public void insertDetailBatch(List<ActivtyTemplatedFloorDetailBo> atfdList){
List<ActivtyTemplatedFloorDetail> commonDetails = Lists.newArrayList();
for(ActivtyTemplatedFloorDetailBo detailBo : atfdList) {
if (!IntegerUtils.withInBizSign(detailBo.getParamType())) {
continue;
}
if (ActivityTemplatedFloorDetailHelper.paramTypeIntSet.contains(detailBo.getParamType())){
ActivtyTemplatedFloorDetail param = convert.convertFrom(detailBo,new ActivtyTemplatedFloorDetail(),ActivtyTemplatedFloorDetail.class);
ActivityTemplatedFloorDetailHelper.fillStautsOfSingle(FloorDetailStatus.open,param);
commonDetails.add(param);
}
}
if (CollectionUtils.isNotEmpty(commonDetails)){
atfdMapper.insertBatch(commonDetails);
}
}
/**
* 跳开老数据,老数据有id
* @param atfdList
* @return
... ...
package com.yohobuy.platform.operations.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.yohobuy.platform.common.convert.BeanConvert;
import com.yohobuy.platform.common.convert.Convert;
import com.yohobuy.platform.common.error.ErrorCode;
... ... @@ -10,24 +11,31 @@ import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.common.util.IntegerUtils;
import com.yohobuy.platform.dal.cms.IWebShareDao;
import com.yohobuy.platform.dal.cms.model.WebShare;
import com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorDetailMapper;
import com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorMapper;
import com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorTableMapper;
import com.yohobuy.platform.dal.operations.ActivtyTemplatedMapper;
import com.yohobuy.platform.dal.operations.model.ActivtyTemplated;
import com.yohobuy.platform.dal.operations.model.ActivtyTemplatedFloor;
import com.yohobuy.platform.dal.operations.model.ActivtyTemplatedFloorDetail;
import com.yohobuy.platform.dal.operations.model.ActivtyTemplatedFloorTable;
import com.yohobuy.platform.model.cms.bo.WebShareBO;
import com.yohobuy.platform.model.common.CheckResult;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.operations.ActivtyTemplatedBo;
import com.yohobuy.platform.model.operations.ActivtyTemplatedFloorBo;
import com.yohobuy.platform.model.operations.*;
import com.yohobuy.platform.model.operations.consistant.ActivtyTemplatedStatus;
import com.yohobuy.platform.model.operations.consistant.FloorDetailStatus;
import com.yohobuy.platform.model.operations.consistant.LogActionType;
import com.yohobuy.platform.model.operations.consistant.TempCompParamType;
import com.yohobuy.platform.model.operations.request.ActivityTemplatedPageBo;
import com.yohobuy.platform.model.users.response.UserInfoResponseBO;
import com.yohobuy.platform.common.helper.mvc.LogInUserHelper;
import com.yohobuy.platform.operations.constants.CommonStatus;
import com.yohobuy.platform.operations.constants.LayoutStatus;
import com.yohobuy.platform.operations.convert.ActivtyTemplatedConvert;
import com.yohobuy.platform.operations.convert.ActivtyTemplatedFloorConvert;
import com.yohobuy.platform.operations.helper.ActTempFloorHelper;
import com.yohobuy.platform.operations.helper.ActivityTemplatedFloorDetailHelper;
import com.yohobuy.platform.operations.service.check.ActivtyTemplatedCheckService;
import com.yohobuy.platform.operations.service.check.WebShareCheckService;
import org.apache.commons.collections.CollectionUtils;
... ... @@ -70,6 +78,12 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
@Autowired
private ActivtyTemplatedFloorMapper atfMapper;
@Autowired
private ActivtyTemplatedFloorTableMapper atftMapper;
@Autowired
private ActivtyTemplatedFloorDetailMapper atfdMapper;
private static Convert convert = new BeanConvert();
@Value("${activity.url:http://activity.yoho.cn/feature/}")
... ... @@ -231,13 +245,14 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
if(!otherInfoCR.isValidateResult()){
throw new PlatformException(otherInfoCR.getErrorMsg().getErrorMsg(), ErrorCode.req_param_illegal);
}
int result = doUpdate(bo);
upateActivityTemplate(bo);
// int result = doUpdate(bo);
//
// if (result > 0) {
// logService.recordLog(bo.getId(), LogActionType.update, JSON.toJSONString(bo));
// }
return 1;
if (result > 0) {
logService.recordLog(bo.getId(), LogActionType.update, JSON.toJSONString(bo));
}
return result;
}
@Override
... ... @@ -380,6 +395,123 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
return true;
}
private void upateActivityTemplate(ActivtyTemplatedBo bo) throws PlatformException{
if (!isExists(bo.getId())){
logger.error("{}.doUpdate ,can not query record,bo.id {}",getClass().getSimpleName(),bo.getId());
return;
}
//1.修改活动主表activty_templated的相关值
ActivtyTemplated activtyTemplated= ActivtyTemplatedConvert.bo2Do(bo);
activtyTemplated.setIsDel(0);
activtyTemplated.setUpdateTime(DateUtil.getCurrentTimeSeconds());
activtyTemplated.setUpdateUser(this.buildOperatorInfo());
activtyTemplatedMapper.updateByPrimaryKeySelective(activtyTemplated);
//2.根据模板ID依次删除除主表外其他表的相关数据,activty_templated_floor,activty_templated_floor_detail,activty_templated_floor_table
atfMapper.deleteByTempId(bo.getId());
atftMapper.deleteByTempId(bo.getId());
atfdMapper.deleteByTempId(bo.getId());
//3.依次将相关数据插入以上相关表中
List<ActivtyTemplatedFloor> atfList = Lists.newArrayList();
List<ActivtyTemplatedFloorTable> atftList = Lists.newArrayList();
for(ActivtyTemplatedFloorBo floorBo: bo.getFloors()){
//处理activty_templated_floor表数据
ActivtyTemplatedFloor atf = ActivtyTemplatedFloorConvert.bo2Do(floorBo);
atf.setActivtyTemplatedId(bo.getId());
//activty_templated_floor表数据入库
atfMapper.insertSelective(atf);
//处理activty_templated_floor_table表数据
if (StringUtils.isNotBlank(floorBo.getTableComp())){
ActivtyTemplatedFloorTable table = new ActivtyTemplatedFloorTable();
table.setStatus(1);
table.setActivtyTemplatedId(bo.getId());
table.setFloorId(atf.getId());
table.setTableComp(floorBo.getTableComp());
atftList.add(table);
}
//处理activty_templated_floor_detail表数据并入库
floorBo.setId(atf.getId());
List<ActivtyTemplatedFloorDetail> atfdp = Lists.newArrayList();
if (CollectionUtils.isNotEmpty(floorBo.getParams())) {
atfdp = ActivityTemplatedFloorDetailHelper.buildDetailsOfFloor(bo.getId(), FloorDetailStatus.open.getIntVal(), floorBo);
}
if (CollectionUtils.isNotEmpty(atfdp)){
atfdMapper.insertBatch(atfdp);
}
List<ActivtyTemplatedFloorDetailBo> atfdc = Lists.newArrayList();
if (CollectionUtils.isNotEmpty(floorBo.getComponents())){
atfdc = buildDetailBo(bo.getId(), floorBo.getId(), floorBo.getComponents());
}
if (CollectionUtils.isNotEmpty(atfdc)){
atfdService.insertDetailBatch(atfdc);
}
}
//activty_templated_floor_table表数据批量入库
if (CollectionUtils.isNotEmpty(atftList)){
atftMapper.insertBatch(atftList);
}
}
/**
* 新加方法 不需要递归组件 忽略组件中套组件
* @param atId
* @param floorId
* @param components
* @return
* @throws PlatformException
*/
public List<ActivtyTemplatedFloorDetailBo> buildDetailBo(int atId,int floorId, List<TemplatedComponentBo> components) throws PlatformException {
List<ActivtyTemplatedFloorDetailBo> result = Lists.newArrayList();
for(TemplatedComponentBo componentBo: components){
result.addAll(buidDetailBoFromComponent(atId, floorId, componentBo));
}
return result;
}
/**
* 新加方法 不需要递归组件 忽略组件中套组件
* @param atId
* @param floorId
* @param componentBo
* @return
*/
public List<ActivtyTemplatedFloorDetailBo> buidDetailBoFromComponent(int atId, int floorId, TemplatedComponentBo componentBo){
List<ActivtyTemplatedFloorDetailBo> result = Lists.newArrayList();
List<TemplatedComponentParamBo> params = componentBo.getParams();
if(CollectionUtils.isNotEmpty(params)) {
for (TemplatedComponentParamBo paramBo : params) {
ActivtyTemplatedFloorDetailBo floorDetailBo = new ActivtyTemplatedFloorDetailBo();
ActivityTemplatedFloorDetailHelper.MergeWithComponentParam(floorDetailBo,paramBo);
ActivityTemplatedFloorDetailHelper.MergeWithComp(floorDetailBo,atId,floorId,0,componentBo);
if(ActivityTemplatedFloorDetailHelper.paramTypeIntSet.contains(paramBo.getType())){
result.add(floorDetailBo);
}else if (TempCompParamType.component.getIntVal() == paramBo.getType()){
ActivtyTemplatedFloorDetail param = convert.convertFrom(floorDetailBo,new ActivtyTemplatedFloorDetail(),ActivtyTemplatedFloorDetail.class);
ActivityTemplatedFloorDetailHelper.fillStautsOfSingle(FloorDetailStatus.open,param);
atfdMapper.insertSelective(param);
List<TemplatedComponentBo> components = componentBo.getComponents();
for (TemplatedComponentBo tcp : components){
List<ActivtyTemplatedFloorDetailBo> childAtfd = Lists.newArrayList();
List<TemplatedComponentParamBo> tcpb = tcp.getParams();
if (CollectionUtils.isNotEmpty(tcpb)){
for (TemplatedComponentParamBo tp : tcpb){
ActivtyTemplatedFloorDetailBo fdb = new ActivtyTemplatedFloorDetailBo();
ActivityTemplatedFloorDetailHelper.MergeWithComponentParam(fdb,tp);
ActivityTemplatedFloorDetailHelper.MergeWithComp(fdb,atId,floorId,0,tcp);
fdb.setPid(param.getId());
childAtfd.add(fdb);
}
}
atfdService.insertDetailBatch(childAtfd);
}
}
}
}
return result;
}
private int doUpdate(ActivtyTemplatedBo bo) throws PlatformException {
//activity templated main body, update one
... ...
package com.yohobuy.platform.operations.service.impl;
import com.yoho.service.model.request.AreaReqBO;
import com.yoho.service.model.response.AreaRspBo;
import com.yohobuy.platform.model.operations.request.AreaReqBO;
import com.yohobuy.platform.model.operations.AreaRspBo;
import com.yohobuy.platform.dal.users.IAreaNewDao;
import com.yohobuy.platform.dal.users.model.AreaNew;
import com.yohobuy.platform.operations.service.IAreaService;
... ...
... ... @@ -170,9 +170,9 @@ public class ImageCheckServiceImpl implements ImageCheckService {
}
String fileMode = finalStr.substring(15, 17);
if(fileMode.equals("01")) {
newBucket ="yhb-img-01";
newBucket ="yhb-img01";
}else if (fileMode.equals("02")){
newBucket ="yhb-img-02";
newBucket ="yhb-img02";
}
}else {
newBucket = request.getBucket();
... ...
package com.yohobuy.platform.operations.util;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import javax.activation.MimetypesFileTypeMap;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
/**
* Created by zhouxiang on 2017/2/8.
*/
public class HttpUtil {
private final static Logger logger = LoggerFactory.getLogger(HttpUtil.class);
/**
* 上传素材
* @param path
... ... @@ -98,4 +117,72 @@ public class HttpUtil {
return result;
}
public static HttpResponse doGet(String url) throws Exception {
logger.debug("in HttpUtil.doGet url {}", url);
HttpResponse result= null;
Exception exception = null;
try {
HttpClient httpclient = new DefaultHttpClient();
//Secure Protocol implementation.
SSLContext ctx = SSLContext.getInstance("SSL");
//Implementation of a trust manager for X509 certificates
X509TrustManager tm = new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] xcs,
String string) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] xcs,
String string) throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ClientConnectionManager ccm = httpclient.getConnectionManager();
//register https protocol in httpclient's scheme registry
SchemeRegistry sr = ccm.getSchemeRegistry();
sr.register(new Scheme("https", 443, ssf));
HttpGet httpget = new HttpGet(url);
httpget.setHeader("accept", "*/*");
httpget.setHeader("connection", "Keep-Alive");
httpget.setHeader("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
result = httpclient.execute(httpget);
try {
HttpEntity entity = result.getEntity();
String content = EntityUtils.toString(entity);
logger.info("ContentLength {}", entity.getContentLength());
EntityUtils.consume(entity);
} catch (Exception e) {
exception = e;
} finally {
httpclient.getConnectionManager().shutdown();
}
} catch (NoSuchAlgorithmException e) {
exception = e;
logger.warn("in doGet , occur NoSuchAlgorithmException");
} catch (Exception ex) {
exception = ex;
logger.warn("in doGet , occur other Exception");
}finally {
if (exception != null){
throw exception;
}
return result;
}
}
}
... ...
... ... @@ -27,6 +27,15 @@ search.server.address=http://192.168.102.216:8080/yohosearch/
# qiniu config
qiniu.accesskey=atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m
qiniu.secretkey=pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm
qiniu.accesskey.cmsimg01=BwWhoJN536BnV3CzlE20AjNKC9O2bP0l5tFpKsDU
qiniu.secretkey.cmsimg01=_x2VtO7fEmylgjojmLi7qwTBtRm30S8BrO0FxOPK
qiniu.accesskey.yohomars=cY9B5ZgON_7McTS5zV5nTeRyQ98MOcVD7W4eGVbE
qiniu.secretkey.yohomars=RduqgmK7cAtaQvdIa1ax_zzmMsnv9ac-Ka0uF6wG
qiniu.accesskey.yohoimimgs=EJhU5jwtkfMm3k5RTeOCH9_jc0A0o-mIfD3Iba5J
qiniu.secretkey.yohoimimgs=qAns6jrf9pg6bHNvS1IcKi-pnVBWV46pbpFWKwJ7
#who add this item? whatever, it's used
qiniu.bucket=test
... ...
... ... @@ -416,6 +416,7 @@ datasources:
- com.yohobuy.platform.dal.users.YohoCoinActivityDao
- com.yohobuy.platform.dal.users.IPermitLoginUser
- com.yohobuy.platform.dal.product.RecommendSknMapper
- com.yohobuy.platform.dal.users.IAreaNewDao
yh_community:
servers:
... ...
... ... @@ -417,6 +417,8 @@ datasources:
- com.yohobuy.platform.dal.users.YohoCoinActivityDao
- com.yohobuy.platform.dal.users.IPermitLoginUser
- com.yohobuy.platform.dal.product.RecommendSknMapper
- com.yohobuy.platform.dal.users.IAreaNewDao
yh_community:
servers:
... ...