Authored by mlge

种草 相关修改;config 增加uic 内部访问域名

... ... @@ -38,16 +38,16 @@ public class GrassLabelController {
@ResponseBody
public ApiResponse addUpGrassLabel(@RequestBody GrassLabelReq req){
logger.info("enter getRedpacketList,req={}",req);
ilabelService.addUpLabel(req);
return new ApiResponse.ApiResponseBuilder().build();
return ilabelService.addUpLabel(req);
}
@RequestMapping("/deleteGrassLabel")
@ResponseBody
public ApiResponse deleteGrassLabel(@RequestBody GrassLabelReq req){
logger.info("enter updatePacketStatus,req = {}", req);
ilabelService.deleteLabel(req);
return new ApiResponse.ApiResponseBuilder().build();
return ilabelService.deleteLabel(req);
}
@RequestMapping("/getAllGrassLabelInfo")
... ...
... ... @@ -38,9 +38,9 @@ public class LabelGroupController {
@RequestMapping("/addUpLabelGroup")
@ResponseBody
public ApiResponse addUpLabelGroup(@RequestBody LabelGroupReq req){
logger.info("enter getRedpacketList,req={}",req);
labelGroupService.addUpLabelGroup(req);
return new ApiResponse.ApiResponseBuilder().build();
logger.info("enter addUpLabelGroup,req={}",req);
return labelGroupService.addUpLabelGroup(req);
}
@RequestMapping("/deleteLabelGroup")
... ...
... ... @@ -14,7 +14,7 @@ public interface IlabelGroupService {
PageResponseVO<LabelGroupBo> getLabelGroupList(LabelGroupReq req);
void addUpLabelGroup(LabelGroupReq req);
ApiResponse addUpLabelGroup(LabelGroupReq req);
int deleteLabelGroup(LabelGroupReq req);
... ...
package com.yohobuy.platform.grass.service;
import com.yohobuy.platform.dal.grass.model.GrassLabel;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.GrassLabelReq;
import com.yohobuy.platform.model.grass.request.LabelGroupReq;
... ... @@ -15,9 +16,9 @@ import java.util.List;
public interface IlabelService {
PageResponseVO<GrassLabelBo> getGrassLabelList(GrassLabelReq req);
void addUpLabel(GrassLabelReq req);
ApiResponse addUpLabel(GrassLabelReq req);
void deleteLabel(GrassLabelReq req);
ApiResponse deleteLabel(GrassLabelReq req);
List<GrassLabelBo> getAllGrassLabelInfo();
}
... ...
... ... @@ -46,7 +46,7 @@ public class GrassUserServiceImpl implements IGrassUserService{
@Autowired
private ServiceCaller serviceCaller;
@Value("${uic.url:http://uic.yohoops.org/uic}")
@Value("${uic.service.url:http://uic.yohoops.org/uic}")
private String uicUrl;
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO;
import com.yohobuy.platform.dal.grass.model.LabelGroup;
import com.yohobuy.platform.grass.service.IlabelGroupService;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.LabelGroupReq;
import com.yohobuy.platform.model.grass.response.LabelGroupBo;
... ... @@ -47,23 +48,31 @@ public class LabelGroupServiceImpl implements IlabelGroupService {
}
@Override
public void addUpLabelGroup(LabelGroupReq req) {
logger.info("enter addUpLabelGroup req={}", req);
Integer id = req.getId();
LabelGroup record = new LabelGroup();
record.setId(id);
record.setGroupName(req.getGroupName());
record.setStatus(req.getStatus());
if(id != null && id > 0 ){//修改
record.setUpdateTime(DateUtil.getCurrentTimeSeconds());
grassLabelGroupDAO.updateByPrimaryKeySelective(record);
logger.info("addUpLabelGroup update success! req={}, record={}", req, record);
}else{//新增
record.setCreateTime(DateUtil.getCurrentTimeSeconds());
record.setLabelAmount(0);
grassLabelGroupDAO.insert(record);
logger.info("addUpLabelGroup insert success! req={}, record={}", req, record);
public ApiResponse addUpLabelGroup(LabelGroupReq req) {
try{
logger.info("enter addUpLabelGroup req={}", req);
Integer id = req.getId();
LabelGroup record = new LabelGroup();
record.setId(id);
record.setGroupName(req.getGroupName());
record.setStatus(req.getStatus());
if(id != null && id > 0 ){//修改
record.setUpdateTime(DateUtil.getCurrentTimeSeconds());
grassLabelGroupDAO.updateByPrimaryKeySelective(record);
logger.info("addUpLabelGroup update success! req={}, record={}", req, record);
}else{//新增
record.setCreateTime(DateUtil.getCurrentTimeSeconds());
record.setLabelAmount(0);
grassLabelGroupDAO.insert(record);
logger.info("addUpLabelGroup insert success! req={}, record={}", req, record);
}
return new ApiResponse.ApiResponseBuilder().message("success").build();
}catch (Exception e){
logger.warn("");
return new ApiResponse.ApiResponseBuilder().code(201).message("error").build();
}
}
@Override
... ...
... ... @@ -3,12 +3,14 @@ package com.yohobuy.platform.grass.service.impl;
import com.yohobuy.platform.common.util.BeanTool;
import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.dal.grass.IGrassArticleLabelDao;
import com.yohobuy.platform.dal.grass.IGrassLabelDAO;
import com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO;
import com.yohobuy.platform.dal.grass.model.GrassLabel;
import com.yohobuy.platform.dal.grass.model.LabelGroup;
import com.yohobuy.platform.grass.service.IlabelGroupService;
import com.yohobuy.platform.grass.service.IlabelService;
import com.yohobuy.platform.model.common.ApiResponse;
import com.yohobuy.platform.model.common.PageResponseVO;
import com.yohobuy.platform.model.grass.request.GrassLabelReq;
import com.yohobuy.platform.model.grass.request.LabelGroupReq;
... ... @@ -36,6 +38,9 @@ public class LabelServiceImpl implements IlabelService {
@Autowired
private IGrassLabelGroupDAO labelGroupDAO;
@Autowired
private IGrassArticleLabelDao grassArticleLabelDao;
@Override
public PageResponseVO<GrassLabelBo> getGrassLabelList(GrassLabelReq req) {
logger.info("enter getGrassLabelList req={} ", req);
... ... @@ -58,37 +63,53 @@ public class LabelServiceImpl implements IlabelService {
}
@Override
public void addUpLabel(GrassLabelReq req) {
logger.info("enter addUpLabel req={}", req);
Integer id = req.getId();
GrassLabel record = new GrassLabel();
record.setId(id);
record.setLabelName(req.getLabelName());
record.setGroupId(req.getGroupId());
record.setStatus(req.getStatus());
if(id != null){//修改
record.setUpdateTime(DateUtil.getCurrentTimeSeconds());
GrassLabel oldGrassLabel = grassLabelDAO.selectByPrimaryKey(id);
if(oldGrassLabel.getGroupId().intValue() != req.getGroupId().intValue() ){//分组改变了,对应的分组的统计需要改下
labelGroupDAO.updateLabelNum(oldGrassLabel.getGroupId(), false);//减1
labelGroupDAO.updateLabelNum(req.getGroupId(), true);//加1
public ApiResponse addUpLabel(GrassLabelReq req) {
try{
logger.info("enter addUpLabel req={}", req);
Integer id = req.getId();
GrassLabel record = new GrassLabel();
record.setId(id);
record.setLabelName(req.getLabelName());
record.setGroupId(req.getGroupId());
record.setStatus(req.getStatus());
if(id != null){//修改
record.setUpdateTime(DateUtil.getCurrentTimeSeconds());
GrassLabel oldGrassLabel = grassLabelDAO.selectByPrimaryKey(id);
if(oldGrassLabel.getGroupId().intValue() != req.getGroupId().intValue() ){//分组改变了,对应的分组的统计需要改下
labelGroupDAO.updateLabelNum(oldGrassLabel.getGroupId(), false);//减1
labelGroupDAO.updateLabelNum(req.getGroupId(), true);//加1
}
grassLabelDAO.updateByPrimaryKeySelective(record);
logger.info("addUpLabel update success! req={},oldGrassLabel={}",req,oldGrassLabel);
}else{//新增
record.setCreateTime(DateUtil.getCurrentTimeSeconds());
grassLabelDAO.insert(record);
//组对应的数量加1
labelGroupDAO.updateLabelNum(req.getGroupId(), true);
logger.info("addUpLabel insert success! req={}",req);
}
grassLabelDAO.updateByPrimaryKeySelective(record);
logger.info("addUpLabel update success! req={},oldGrassLabel={}",req,oldGrassLabel);
}else{//新增
record.setCreateTime(DateUtil.getCurrentTimeSeconds());
grassLabelDAO.insert(record);
//组对应的数量加1
labelGroupDAO.updateLabelNum(req.getGroupId(), true);
logger.info("addUpLabel insert success! req={}",req);
return new ApiResponse.ApiResponseBuilder().build();
}catch (Exception e){
logger.warn("addUpLabel req={} error, e{}",req, e);
return new ApiResponse.ApiResponseBuilder().code(201).build();
}
}
@Override
public void deleteLabel(GrassLabelReq req) {
public ApiResponse deleteLabel(GrassLabelReq req) {
logger.info("enter deleteLabel req={} ",req);
grassLabelDAO.deleteByPrimaryKey(req.getId());
Integer labelId = req.getId();
//文章 关联了 标签 则不允许删除
int count = grassArticleLabelDao.countByLabelId(labelId);
if(count > 0 ){
logger.info("deleteLabel req={} error! bind with articles ",req);
return new ApiResponse.ApiResponseBuilder().code(201).message("标签与文章绑定,不能删除").build();
}
grassLabelDAO.deleteByPrimaryKey(labelId);
labelGroupDAO.updateLabelNum(req.getGroupId(),false);
return new ApiResponse.ApiResponseBuilder().message("success").build();
}
@Override
... ...
... ... @@ -246,4 +246,4 @@ qq.serverUri = /v2/index.php
qq.secretId = AKID6dwpKadiQgbDpXDtyNhppIHPO5qPv5GK
qq.secretKey = ACJkH9mg0DBA1PYpf0E7f3g534wBsQaW
uic.url = http://java-yoho-uic.test3.ingress.dev.yohocorp.com/uic
uic.service.url = http://java-yoho-uic.test3.ingress.dev.yohocorp.com/uic
... ...
... ... @@ -232,4 +232,4 @@ qq.serverUri = ${qq.serverUri}
qq.secretId = ${qq.secretId}
qq.secretKey = ${qq.secretKey}
uic.url=${uic.url}
\ No newline at end of file
uic.service.url=${uic.service.url}
\ No newline at end of file
... ...
... ... @@ -26,7 +26,7 @@
<body class="easyui-layout" >
<div region="north" style="height: 200px;">
<script>
document.write(addHead('内容管理', '内容审核'));
document.write(addHead('种草管理', '内容审核'));
</script>
<div style="margin-left: 20px;margin-top: 10px">
... ...
... ... @@ -26,7 +26,7 @@
<body class="easyui-layout" >
<div region="north" style="height: 200px;">
<script>
document.write(addHead('运营管理', '标签分组管理'));
document.write(addHead('种草管理', '标签分组管理'));
</script>
<div style="margin-left: 20px;margin-top: 10px">
... ... @@ -251,7 +251,7 @@
height: 120
});
} else {
$.messager.alert("失败", data.message, "error");
$.messager.alert("失败","操作失败,请检查分组名称是否已存在", "error");
}
}
});
... ...
... ... @@ -26,7 +26,7 @@
<body class="easyui-layout" >
<div region="north" style="height: 200px;">
<script>
document.write(addHead('运营管理', '标签管理'));
document.write(addHead('种草管理', '标签管理'));
</script>
<div style="margin-left: 20px;margin-top: 10px">
... ...