Commit 01764cd3 by songyinghui

feat: 活码批量分组

parent bc4f3641
package com.gic.haoban.manage.api.service.hm;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.base.api.common.PageResult2;
import com.gic.haoban.manage.api.dto.hm.HmClerkRelationDTO;
import com.gic.haoban.manage.api.dto.hm.HmQrcodeDTO;
......@@ -132,4 +133,13 @@ public interface HmQrcodeApiService {
* @date 2022-07-13 17:09:56
*/
List<HmClerkRelationDTO> getHmClerkByHmId(Long hmId);
/**
* 批量修改活码分组
* @param hmIds
* @param groupId
* @return
*/
ServiceResponse<Boolean> batchUpdateHmQrcodeGroup(List<Long> hmIds, Long groupId);
}
......@@ -177,5 +177,13 @@ public interface TabHaobanHmQrcodeMapper {
* @date 2022-07-12 15:10:09
*/
int getTotalByEnterpriseId(@Param("enterpriseId") String enterpriseId);
/**
* 批量修改 活码所属分组
* @param ids
* @param groupId
* @return
*/
int batchUpdateQrCodeGroup(@Param("ids") List<Long> ids, @Param("groupId") Long groupId);
}
......@@ -166,4 +166,12 @@ public interface HmQrcodeService {
* @date 2022-07-12 15:08:35
*/
int getTotalByEnterpriseId(String enterpriseId);
/**
* 批量修改活码分组
* @param hmIds
* @param groupId
* @return
*/
int batchUpdateQrcodeGroup(List<Long> hmIds, Long groupId);
}
......@@ -115,4 +115,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
public int getTotalByEnterpriseId(String enterpriseId) {
return tabHaobanHmQrcodeMapper.getTotalByEnterpriseId(enterpriseId);
}
public int batchUpdateQrcodeGroup(List<Long> hmIds, Long groupId){
return tabHaobanHmQrcodeMapper.batchUpdateQrCodeGroup(hmIds, groupId);
}
}
package com.gic.haoban.manage.service.service.out.impl.hm;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
......@@ -570,4 +572,20 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
public List<HmClerkRelationDTO> getHmClerkByHmId(Long hmId) {
return EntityUtil.changeEntityListNew(HmClerkRelationDTO.class,hmClerkRelationService.getHmClerkByHmId(hmId));
}
/**
* 批量修改活码分组
*
* @param hmIds
* @param groupId
* @return
*/
@Override
public ServiceResponse<Boolean> batchUpdateHmQrcodeGroup(List<Long> hmIds, Long groupId) {
if (CollectionUtils.isEmpty(hmIds) || groupId == null){
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_2.getCode()+"", HaoBanErrCodeCommon.ERR_2.getMsg());
}
int updateCount = hmQrcodeService.batchUpdateQrcodeGroup(hmIds, groupId);
return ServiceResponse.success(updateCount > 0);
}
}
......@@ -344,5 +344,16 @@
where status_flag != 0
and enterprise_id = #{enterpriseId}
</select>
<update id="batchUpdateQrCodeGroup">
update tab_haoban_hm_qrcode
set hm_group_id = #{groupId},
update_time = now()
where hm_id in
<foreach collection="ids" open="(" close=")" item="id" separator=",">
#{id}
</foreach>
</update>
</mapper>
......@@ -12,6 +12,7 @@ import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.api.service.hm.HmGroupApiService;
import com.gic.haoban.manage.api.service.hm.HmPageApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import org.junit.Test;
......@@ -20,6 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Arrays;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class HmPageServiceTest {
......@@ -101,4 +105,17 @@ public class HmPageServiceTest {
welcomeRelationService.updateWelcomeRelation(welcomeRelationBo);
}
@Autowired
private HmQrcodeApiService qrcodeApiService;
@Test
public void batchUpdateQrcode(){
List<Long> ids = Arrays.asList(418494104339988481L, 418494104339988482L);
long grouoId = 420219621589671937L;
ServiceResponse<Boolean> booleanServiceResponse = qrcodeApiService.batchUpdateHmQrcodeGroup(ids, grouoId);
System.out.println(JSON.toJSONString(booleanServiceResponse));
}
}
......@@ -3,6 +3,7 @@ package com.gic.haoban.manage.web.controller.hm;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
......@@ -19,6 +20,7 @@ import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.api.util.DataHttpUtil;
import com.gic.haoban.manage.web.dto.HmOverviewDTO;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.hm.HmQrcodeUpdateQO;
import com.gic.haoban.manage.web.qo.hm.data.HmDetailClerkListQO;
import com.gic.haoban.manage.web.qo.hm.data.HmTrendQO;
import com.gic.haoban.manage.web.vo.hm.HmDetailClerkListVO;
......@@ -201,5 +203,12 @@ public class HmQrcodeController {
}
@RequestMapping(path = "/update/qrcode/group")
public RestResponse<?> batchUpdateQrcodeGroup(@RequestBody HmQrcodeUpdateQO qrcodeUpdateQo){
ServiceResponse<Boolean> serviceResponse = hmQrcodeApiService.batchUpdateHmQrcodeGroup(qrcodeUpdateQo.getHmIds(), qrcodeUpdateQo.getGroupId());
return RestResponse.successResult(serviceResponse.getResult());
}
}
package com.gic.haoban.manage.web.qo.hm;
import java.io.Serializable;
import java.util.List;
/**
* @Author MUSI
* @Date 2022/7/13 6:54 PM
* @Description
* @Version
**/
public class HmQrcodeUpdateQO implements Serializable {
private static final long serialVersionUID = -1636719509633485056L;
private List<Long> hmIds;
private Long groupId;
public List<Long> getHmIds() {
return hmIds;
}
public void setHmIds(List<Long> hmIds) {
this.hmIds = hmIds;
}
public Long getGroupId() {
return groupId;
}
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
}
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