From 0ffc55f78dfb3cc561540af2d033e64c2f4f2e68 Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期二, 29 八月 2023 09:57:08 +0800 Subject: [PATCH] 新增商家管理模块 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/VolunteerMerchantDao.java | 10 + springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerMerchantServiceImpl.java | 215 ++++++++++++++++++++++- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/VolunteerMerchantService.java | 23 ++ springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java | 38 ++++ springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/VolunteerMerchantApi.java | 71 +++++++ springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerMerchantMapper.xml | 69 +++++++ springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/VolunteerMerchantApi.java | 70 +++++++ 7 files changed, 474 insertions(+), 22 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java index afd9189..3cdb075 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java +++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java @@ -11580,7 +11580,45 @@ @GetMapping("/VolunteerIntegralMerchant/order/conditionData") public R conditionData(@RequestParam("id") String id); + /***************************************************************************************************************** + * + * + * 路北社区商家管理 + * + * + *****************************************************************************************************************/ + /** + * 分页查询 + * @param + * @return + */ + @GetMapping("/VolunteerMerchant/getList") + public R volunteerMerchantGetList(@RequestParam("pageNum") int pageNum, + @RequestParam("pageSize") int pageSize, + @RequestParam(value = "merchantState", required = false) String merchantState, + @RequestParam(value = "merchantType", required = false) String merchantType, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "communityId", required = false) String communityId); + + /** + * 新增 + * @param + * @return + */ + @PostMapping("/VolunteerMerchant/insert") + public R insertVolunteerMerchant(@RequestBody VolunteerMerchantVO vtvo); + @PostMapping("/VolunteerMerchant/update") + public R updateVolunteerMerchant(@RequestBody VolunteerMerchantVO vtvo); + + + @DeleteMapping("/VolunteerMerchant/delete") + public R deleteVolunteerMerchant(@RequestParam("pageNum") String id); + + @GetMapping("/VolunteerMerchant/getUser") + public R volunteerMerchantGetUser(@RequestParam("pageNum") String communityId, + @RequestParam("pageNum") String userName, + @RequestParam("pageNum") String userPhone); } diff --git a/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/VolunteerMerchantApi.java b/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/VolunteerMerchantApi.java new file mode 100644 index 0000000..cffab27 --- /dev/null +++ b/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/VolunteerMerchantApi.java @@ -0,0 +1,70 @@ +package com.panzhihua.community_backstage.api; + +import com.panzhihua.common.controller.BaseController; +import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.VolunteerMerchantVO; +import com.panzhihua.common.service.community.CommunityService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@Slf4j +@RestController +@RequestMapping("/VolunteerMerchant") +public class VolunteerMerchantApi extends BaseController +{ + + @Resource + private CommunityService vtService; + + /** + * 分页查询 + * @param + * @return + */ + @GetMapping("/getList") + public R volunteerMerchantGetList(@RequestParam("pageNum") int pageNum, + @RequestParam("pageSize") int pageSize, + @RequestParam(value = "merchantState", required = false) String merchantState, + @RequestParam(value = "merchantType", required = false) String merchantType, + @RequestParam(value = "name", required = false) String name) + { + return vtService.volunteerMerchantGetList(pageNum, pageSize,merchantState,merchantType,name,getCommunityId()+""); + } + + /** + * 新增 + * @param + * @return + */ + @PostMapping("/insert") + public R insertVolunteerMerchant(@RequestBody VolunteerMerchantVO vtvo) + { + return vtService.insertVolunteerMerchant(vtvo); + } + + + @PostMapping("/update") + public R updateVolunteerMerchant(@RequestBody VolunteerMerchantVO vtvo) + { + return vtService.updateVolunteerMerchant(vtvo); + } + + + @DeleteMapping("/delete") + public R deleteVolunteerMerchant(@RequestParam("id") String id) + { + return vtService.deleteVolunteerMerchant(id); + } + + + @GetMapping("/getUser") + public R volunteerMerchantGetUser(@RequestParam("userName") String userName, + @RequestParam("userPhone") String userPhone) + { + return R.ok(vtService.volunteerMerchantGetUser(getCommunityId()+"",userName,userPhone)); + } + + +} diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/VolunteerMerchantApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/VolunteerMerchantApi.java new file mode 100644 index 0000000..a2bf60c --- /dev/null +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/VolunteerMerchantApi.java @@ -0,0 +1,71 @@ +package com.panzhihua.service_community.api; + +import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.VolunteerMerchantVO; +import com.panzhihua.service_community.service.VolunteerMerchantService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@Slf4j +@RestController +@RequestMapping("/VolunteerMerchant") +public class VolunteerMerchantApi +{ + + @Resource + private VolunteerMerchantService vtService; + + /** + * 分页查询 + * @param + * @return + */ + @GetMapping("/getList") + public R volunteerMerchantGetList(@RequestParam("pageNum") int pageNum, + @RequestParam("pageSize") int pageSize, + @RequestParam(value = "merchantState", required = false) String merchantState, + @RequestParam(value = "merchantType", required = false) String merchantType, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "communityId", required = false) String communityId) + { + return vtService.volunteerMerchantGetList(pageNum, pageSize,merchantState,merchantType,name,communityId); + } + + /** + * 新增 + * @param + * @return + */ + @PostMapping("/insert") + public R insertVolunteerMerchant(@RequestBody VolunteerMerchantVO vtvo) + { + return vtService.insertVolunteerMerchant(vtvo); + } + + + @PostMapping("/update") + public R updateVolunteerMerchant(@RequestBody VolunteerMerchantVO vtvo) + { + return vtService.updateVolunteerMerchant(vtvo); + } + + + @DeleteMapping("/delete") + public R deleteVolunteerMerchant(@RequestParam("id") String id) + { + return vtService.deleteVolunteerMerchant(id); + } + + + @GetMapping("/getUser") + public R volunteerMerchantGetUser(@RequestParam("communityId") String communityId, + @RequestParam("userName") String userName, + @RequestParam("userPhone") String userPhone) + { + return R.ok(vtService.getUser(communityId,userName,userPhone)); + } + + +} diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/VolunteerMerchantDao.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/VolunteerMerchantDao.java index 55db5b7..f8598e8 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/VolunteerMerchantDao.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/VolunteerMerchantDao.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.panzhihua.common.model.vos.community.VolunteerMerchantVO; import com.panzhihua.common.model.vos.community.VolunteerTypeVO; +import com.panzhihua.service_community.entity.SysUser; import com.panzhihua.service_community.entity.VolunteerMerchant; import com.panzhihua.service_community.entity.VolunteerType; import org.apache.ibatis.annotations.Mapper; @@ -37,6 +38,15 @@ int delete(@Param("id") String id); + /** + * 根据电话号码 或者姓名查询用户 + * @param + * @return + */ + SysUser getUser(@Param("communityId") String communityId, + @Param("userName") String userName, + @Param("userPhone") String userPhone); + diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/VolunteerMerchantService.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/VolunteerMerchantService.java index 7e1d1f7..53872ad 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/VolunteerMerchantService.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/VolunteerMerchantService.java @@ -2,9 +2,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.vos.R; -import com.panzhihua.common.model.vos.community.VolunteerTypeVO; +import com.panzhihua.common.model.vos.community.VolunteerMerchantVO; +import com.panzhihua.service_community.entity.SysUser; import com.panzhihua.service_community.entity.VolunteerMerchant; -import com.panzhihua.service_community.entity.VolunteerType; public interface VolunteerMerchantService extends IService<VolunteerMerchant> { @@ -13,15 +13,28 @@ * @param * @return */ - R volunteerMerchantGetList(int pageNum,int pageSize,String type); + R volunteerMerchantGetList(int pageNum,int pageSize, + String merchantState, + String merchantType, + String name, + String communityId); /** * 新增 * @param * @return */ - R insertVolunteerMerchant(VolunteerTypeVO volunteerTypeVO); + R insertVolunteerMerchant(VolunteerMerchantVO vtvo); - R updateVolunteerMerchant(VolunteerTypeVO volunteerTypeVO); + R updateVolunteerMerchant(VolunteerMerchantVO vtvo); R deleteVolunteerMerchant(String id); + + + /** + * 根据电话号码 或者姓名查询用户 + * @param + * @return + */ + R getUser(String communityId,String userName,String userPhone); + } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerMerchantServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerMerchantServiceImpl.java index addcff6..b432ad6 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerMerchantServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerMerchantServiceImpl.java @@ -3,9 +3,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.VolunteerMerchantVO; import com.panzhihua.common.model.vos.community.VolunteerTypeVO; +import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.dao.VolunteerMerchantDao; import com.panzhihua.service_community.dao.VolunteerTypeDao; +import com.panzhihua.service_community.entity.SysUser; import com.panzhihua.service_community.entity.VolunteerActivity; import com.panzhihua.service_community.entity.VolunteerMerchant; import com.panzhihua.service_community.entity.VolunteerType; @@ -20,33 +23,213 @@ public class VolunteerMerchantServiceImpl extends ServiceImpl<VolunteerMerchantDao, VolunteerMerchant> implements VolunteerMerchantService { @Override - public R volunteerMerchantGetList(int pageNum, int pageSize, String type) { - return null; + public R volunteerMerchantGetList(int pageNum, int pageSize, String merchantState, + String merchantType, String name, String communityId) { + Page page=new Page<VolunteerMerchant>(pageNum,pageSize); + return R.ok(baseMapper.getList(page, merchantState,merchantType,name,communityId)); } @Override - public R insertVolunteerMerchant(VolunteerTypeVO volunteerTypeVO) { - return null; + public R insertVolunteerMerchant(VolunteerMerchantVO vtvo) + { + if(vtvo==null) + { + return R.fail("参数不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getName())) + { + return R.fail("商家姓名不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getBusinessType())) + { + return R.fail("商家类型不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getLogoUrl())) + { + return R.fail("商家logo封面不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getAddress())) + { + return R.fail("商家地址不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getLat())) + { + return R.fail("商家经纬度不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getUserId())) + { + return R.fail("管理员不能为空"); + } + + + if(vtvo.getBusinessStartTime()==null || vtvo.getBusinessEndTime()==null ) + { + return R.fail("营业时间不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getMerchantType())) + { + return R.fail("营业状态不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getServiceCall())) + { + return R.fail("对外服务电话不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getMerchantContent())) + { + return R.fail("商家简介不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getMerchantUrl())) + { + return R.fail("商家图片不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getLegalPersonName())) + { + return R.fail("法人代表不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getLegalPersonPhone())) + { + return R.fail("法人联系电话不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getLegalPersonIdCard())) + { + return R.fail("法人身份证不能为空"); + } + + int num= baseMapper.insertData(vtvo); + if(num>0) + { + return R.ok(); + } + return R.fail("添加失败"); } @Override - public R updateVolunteerMerchant(VolunteerTypeVO volunteerTypeVO) { - return null; + public R updateVolunteerMerchant(VolunteerMerchantVO vtvo) + { + if(vtvo==null) + { + return R.fail("参数不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getName())) + { + return R.fail("商家姓名不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getBusinessType())) + { + return R.fail("商家类型不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getLogoUrl())) + { + return R.fail("商家logo封面不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getAddress())) + { + return R.fail("商家地址不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getLat())) + { + return R.fail("商家经纬度不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getUserId())) + { + return R.fail("管理员不能为空"); + } + + + if(vtvo.getBusinessStartTime()==null || vtvo.getBusinessEndTime()==null ) + { + return R.fail("营业时间不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getMerchantType())) + { + return R.fail("营业状态不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getServiceCall())) + { + return R.fail("对外服务电话不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getMerchantContent())) + { + return R.fail("商家简介不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getMerchantUrl())) + { + return R.fail("商家图片不能为空"); + } + + + if(StringUtils.isEmpty(vtvo.getLegalPersonName())) + { + return R.fail("法人代表不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getLegalPersonPhone())) + { + return R.fail("法人联系电话不能为空"); + } + + if(StringUtils.isEmpty(vtvo.getLegalPersonIdCard())) + { + return R.fail("法人身份证不能为空"); + } + + + int num= baseMapper.Update(vtvo); + if(num>0) + { + return R.ok(); + } + return R.fail("添加失败"); } @Override public R deleteVolunteerMerchant(String id) { - return null; + int num= baseMapper.delete(id); + if(num>0) + { + return R.ok(); + } + return R.fail("添加失败"); + } + + @Override + public R getUser(String communityId, String userName, String userPhone) + { + return R.ok(baseMapper.getUser(communityId,userName,userPhone)); } -// @Override -// public R volunteerTypeDelete(String id) { -// int num= baseMapper.volunteerTypeDelete(id); -// if(num>0) -// { -// return R.ok(); -// } -// return R.fail("添加失败"); -// } } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerMerchantMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerMerchantMapper.xml index 0e92452..295df1a 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerMerchantMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/VolunteerMerchantMapper.xml @@ -72,7 +72,7 @@ and merchant_type=#{merchantType} </if> <if test="name !=null "> - and name=#{name} + and (volunteer_merchant.name like concat('%',#{name},'%')) </if> </where> order by creation_time desc @@ -281,4 +281,71 @@ delete from volunteer_merchant where id=#{id} </delete> + <select id="getUser" resultType="com.panzhihua.service_community.entity.SysUser"> + SELECT + user_id, + account, + password, + openid, + session_key, + unionid, + phone, + nick_name, + name, + community_id, + sex, + id_card, + birthday, + image_url, + type, + job, + is_volunteer, + is_partymember, + status, + create_at, + last_login_time, + tags, + family_id, + face_url, + face_state, + reject_reson, + area_id, + card_photo_front, + card_photo_back, + family_book, + continuous_landing_days, + is_tips, + work_status, + work_start_time, + work_end_time, + big_age_tips, + plaintext_password, + street_id, + relation_name, + app_id, + is_accept, + binding_check_unit_id, + love_integral + FROM sys_user + <where> + 1=1 + <if test="communityId!=null"> + and community_id=#{communityId} + </if> + + <if test="userName!=null"> + and (sys_user.name like concat('%',#{userName},'%')) + </if> + + <if test="userPhone!=null"> + and (sys_user.phone like concat('%',#{userPhone},'%')) + </if> + and + </where> + </select> + + + + + </mapper> -- Gitblit v1.7.1