Commit c1055a2d by pansy

bug : [1024243]Batch operation exception

parent 88056b89
......@@ -4,6 +4,9 @@ import com.pcloud.book.applet.dto.AppletGroupManageDTO;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.dto.UpdateActivityShowStateDTO;
import com.pcloud.book.skill.facade.request.GroupActivityClassifyVO;
import com.pcloud.book.skill.facade.request.GroupActivityShowStateVO;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
......@@ -18,6 +21,27 @@ import java.util.Map;
public interface PcloudGroupActivityBiz {
/**
* 批量分类
* 2020/6/22
* add by pansy
*/
void batchUpdateClassify(GroupActivityClassifyVO groupActivityClassifyVO);
/**
* 批量上下架
* 2020/6/22
* add by pansy
*/
void batchUpdateShowState(GroupActivityShowStateVO groupActivityShowStateVO);
/**
* 批量删除共读
* 2020/6/22
* add by pansy
*/
void deleteByIds(List<Long> ids);
/**
* 保存共读活动
*/
void saveGroupActivity(SaveGroupActivityRequestVO vo);
......
......@@ -49,6 +49,7 @@ import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.ResponseHandleUtil;
......@@ -123,6 +124,36 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
@Autowired
private RightsSettingItemDetailDao rightsSettingItemDetailDao;
@ParamLog("批量分类")
@Override
public void batchUpdateClassify(GroupActivityClassifyVO groupActivityClassifyVO) {
if (groupActivityClassifyVO == null || ListUtils.isEmpty(groupActivityClassifyVO.getIds())) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "参数为空");
}
if (!NumberUtil.isNumber(groupActivityClassifyVO.getFirstClassify())) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "请选择一级分类");
}
rightsSettingBiz.setClassifyAndLabel(groupActivityClassifyVO);
pcloudGroupActivityDao.batchUpdateShowState(groupActivityClassifyVO);
}
@ParamLog("批量上下架")
@Override
public void batchUpdateShowState(GroupActivityShowStateVO groupActivityShowStateVO) {
pcloudGroupActivityDao.batchUpdateShowState(groupActivityShowStateVO);
}
@ParamLog("批量删除共读模板")
@Override
public void deleteByIds(List<Long> ids) {
if (ListUtils.isEmpty(ids)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误!");
}
pcloudGroupActivityDao.deleteByIds(ids);
}
@ParamLog("保存共读活动")
@Override
public void saveGroupActivity(SaveGroupActivityRequestVO vo) {
......
......@@ -33,4 +33,9 @@ public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> {
Map<Long, GroupActivity4AppletDTO> getGroupClassifyByIds(List<Long> ids);
List<Long> getGroupClassifyIds(Map<String, Object> paraMap);
Map<Long, GroupActivity4AppletDTO> getThridPartByIds(List<Long> ids);
PcloudGroupActivity getById(Long id);
}
......@@ -95,4 +95,16 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity>
return super.getSqlSession().selectList("getGroupClassifyIds",paraMap);
}
@Override
public Map<Long, GroupActivity4AppletDTO> getThridPartByIds(List<Long> list) {
return super.getSqlSession().selectMap(getStatement("getThridPartByIds"), list,"id");
}
@Override
public PcloudGroupActivity getById(Long id){
return super.getSqlSession().selectOne(getStatement("getById"),id);
}
}
......@@ -32,6 +32,43 @@ public class PcloudGroupActivityFacade {
@Resource
private PcloudGroupActivityBiz pcloudGroupActivityBiz;
/**
* 2020/6/22
* add by pansy
*/
@ApiOperation("批量修改分类")
@PostMapping("batchUpdateClassify")
public ResponseDto<?> batchUpdateClassify(@RequestHeader("token") String token, @RequestBody GroupActivityClassifyVO groupActivityShowStateVO) throws PermissionException {
SessionUtil.getInfoToken4Redis(token);
pcloudGroupActivityBiz.batchUpdateClassify(groupActivityShowStateVO);
return new ResponseDto<>();
}
/**
* 2020/6/22
* add by pansy
*/
@ApiOperation("批量上下架")
@PostMapping("batchUpdateShowState")
public ResponseDto<Void> batchUpdateShowState(@RequestHeader("token") String token, @RequestBody GroupActivityShowStateVO groupActivityShowStateVO) throws PermissionException {
SessionUtil.getInfoToken4Redis(token);
pcloudGroupActivityBiz.batchUpdateShowState(groupActivityShowStateVO);
return new ResponseDto<>();
}
/**getTempleList
* 2020/6/22
* add by pansy
*/
@ApiOperation("批量删除")
@PostMapping("deleteByIds")
public ResponseDto<Void> deleteByIds(@RequestHeader("token") String token, @RequestBody List<Long> ids) throws PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
pcloudGroupActivityBiz.deleteByIds(ids);
return new ResponseDto<>();
}
@PostMapping("saveGroupActivity")
public ResponseDto<Void> saveGroupActivity(@RequestHeader("token") String token, @RequestBody SaveGroupActivityRequestVO vo) throws PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
......
......@@ -5,6 +5,7 @@ import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.utils.string.StringUtil;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.BeanUtils;
import io.swagger.annotations.ApiModel;
......@@ -65,11 +66,16 @@ public class UpdateGroupActivityRequestVO extends BaseTempletClassify {
if (null == id || StringUtil.isBlank(this.getName())
|| null == this.getProLabelId() || null == this.getDepLabelId()
|| null == this.getPurLabelId()
|| null == this.getBookGroupClassifyId()
|| null == this.getJoinType()
|| null == this.getGroupType()
|| null == this.getNumber()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请求参数缺失");
}
if("0".equals(this.getGroupType())){
if (null == this.getJoinType()
|| null == this.getBookGroupClassifyId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请求参数缺失");
}
}
}
/**
......
......@@ -79,19 +79,19 @@
<select id="getGroupClassifyIds" resultType="long" parameterType="map">
select book_group_classify_id from pcloud_group_activity
where
is_delete = 0 and is_show = 1
<if test="firstClassify != null">
and first_classify = #{firstClassify}
</if>
<if test="secondClassify != null">
and second_classify = #{secondClassify}
</if>
<if test="gradeLabelId != null">
and grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
and subject_label_id = #{subjectLabelId}
</if>
is_delete = 0 and is_show = 1
<if test="firstClassify != null">
and first_classify = #{firstClassify}
</if>
<if test="secondClassify != null">
and second_classify = #{secondClassify}
</if>
<if test="gradeLabelId != null">
and grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
and subject_label_id = #{subjectLabelId}
</if>
order by id desc
</select>
......@@ -274,11 +274,12 @@
SELECT
c.id,
a.id groupActivityId,
a.`name`,
c.classify_introduce AS `desc`,
a.join_type AS joinType,
c.classify AS name,
c.classify AS groupName,
b.user_number userNumber,
c.id classifyId,
b.classify_id classifyId,
c.book_group_id bookGroupId,
a.first_classify AS firstClassify,
a.second_classify AS secondClassify,
......@@ -587,4 +588,4 @@
ORDER BY a.id DESC
</select>
</mapper>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment