GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
fujun
/
dxCard-service
Browse code
我的资料增加是否送卡人字段
master
1 parent
6744b33
commit
4581b7e98d6f3b211e1117de69ed424884efab81
YFJ
authored
16 days ago
Patch
Showing
1 changed file
jeecg-boot-module/jeecg-module-service/src/main/java/org/jeecg/modules/service/controller/AuthUserController.java
Ignore Space
Show notes
View
jeecg-boot-module/jeecg-module-service/src/main/java/org/jeecg/modules/service/controller/AuthUserController.java
package org.jeecg.modules.service.controller; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryRuleEnum; import org.jeecg.common.util.oConvertUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.service.dto.AuthUserUpdateDTO; import org.jeecg.modules.service.dto.CardApplicationDTO; import org.jeecg.modules.service.entity.AuthUser; import org.jeecg.modules.service.service.IAuthUserService; import org.jeecg.modules.service.vo.*; import org.jeecg.modules.system.entity.CardApplicationCustomers; import org.jeecg.modules.system.entity.CardDeliveryPerson; import org.jeecg.modules.system.mapper.CardDeliveryPersonMapper; import org.jeecg.modules.system.service.ICardApplicationCustomersService; import org.jeecg.modules.system.service.ICardDeliveryPersonService; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecg.common.system.base.controller.JeecgController; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSON; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; import org.jeecg.common.aspect.annotation.AutoLog; import org.apache.shiro.authz.annotation.RequiresPermissions; /** * @Description: 微信用户档案 * @Author: jeecg-boot * @Date: 2025-09-28 * @Version: V1.0 */ @Tag(name="微信用户档案") @RestController @RequestMapping("/service/authUser") @Slf4j public class AuthUserController extends JeecgController<AuthUser, IAuthUserService> { @Autowired private IAuthUserService authUserService; @Autowired private ICardApplicationCustomersService cardApplicationCustomersService; @Autowired private ICardDeliveryPersonService cardDeliveryPersonService; /** *我的-推荐用户列表 */ @RequestMapping(value = "/recommendUser", method = RequestMethod.GET) public Result<RecommendUserVO> recommendUser(@RequestParam (name = "userId") String userId) { if (StringUtils.isBlank(userId)){ return Result.error("用户id不能为空"); } RecommendUserVO vo = authUserService.recommendUser(userId); return Result.OK(vo); } /** *我的-参团信息 */ @RequestMapping(value = "/myGroupMemberList", method = RequestMethod.GET) public Result<List<MyGroupMemberVO>> myGroupMemberList(@RequestParam (name = "userId") String userId) { if (StringUtils.isBlank(userId)){ return Result.error("用户id不能为空"); } List<MyGroupMemberVO> list = authUserService.myGroupMemberList(userId); return Result.OK(list); } /** * 我的资料 */ @RequestMapping(value = "/detail", method = RequestMethod.GET) public Result<AuthUserVO> detail(@RequestParam (name = "id",required=false) String id) { AuthUserVO vo = new AuthUserVO(); AuthUser authUser = authUserService.getById(id); if (authUser == null){ return Result.error("用户不存在"); } BeanUtils.copyProperties(authUser,vo); vo.setIsCardMan(false); if (authUser.getWxPhone() != null){ QueryWrapper<CardDeliveryPerson> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("phone", authUser.getWxPhone()); CardDeliveryPerson cardDeliveryPerson = cardDeliveryPersonService.getOne(queryWrapper); if (cardDeliveryPerson != null){ vo.setIsCardMan(true); } } return Result.OK(vo); } @RequestMapping(value = "/update", method = RequestMethod.POST) public Result<?> update(@RequestBody AuthUserUpdateDTO authUserUpdateDTO) { AuthUser authUser = authUserService.getById(authUserUpdateDTO.getId()); authUser.setAvatar(authUserUpdateDTO.getAvatar()); authUser.setWxName(authUserUpdateDTO.getName()); authUser.setProvince(authUserUpdateDTO.getProvince()); authUser.setCity(authUserUpdateDTO.getCity()); authUser.setArea(authUserUpdateDTO.getArea()); authUser.setAddress(authUserUpdateDTO.getAddress()); authUserService.updateById(authUser); return Result.OK("修改成功"); } /** * 开卡任务 */ @RequestMapping(value = "/dispatchUser", method = RequestMethod.GET) public Result<List<DispatchUserVO>> dispatchUser(@RequestParam (name = "userId") String userId) { if (StringUtils.isBlank(userId)){ return Result.error("用户id不能为空"); } List<DispatchUserVO> list = authUserService.dispatchUser(userId); return Result.OK(list); } /** * 开卡任务详情 */ @RequestMapping(value = "/dispatchUserDetail", method = RequestMethod.GET) public Result<DispatchDetailVO> dispatchUserDetail(@RequestParam (name = "id") String id) { if (StringUtils.isBlank(id)){ return Result.error("预约单id不能为空"); } DispatchDetailVO vo = authUserService.dispatchUserDetail(id); return Result.OK(vo); } /** * 办卡 */ @RequestMapping(value = "/cardApplication", method = RequestMethod.POST) public Result<?> cardApplication(@RequestBody CardApplicationDTO cardApplicationDTO) { CardApplicationCustomers cardApplicationCustomers = cardApplicationCustomersService.getById(cardApplicationDTO.getId()); if (cardApplicationCustomers == null){ return Result.error("预约单不存在"); } if (cardApplicationCustomers.getStatus().equals("2")){ return Result.error("该预约单已处理"); } cardApplicationCustomers.setStatus("2"); cardApplicationCustomers.setTransactionPhone(cardApplicationDTO.getTransactionPhone()); cardApplicationCustomers.setAmount(cardApplicationDTO.getAmount()); cardApplicationCustomersService.updateById(cardApplicationCustomers); return Result.OK("提交办卡成功"); } }
package org.jeecg.modules.service.controller; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryRuleEnum; import org.jeecg.common.util.oConvertUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.service.dto.AuthUserUpdateDTO; import org.jeecg.modules.service.dto.CardApplicationDTO; import org.jeecg.modules.service.entity.AuthUser; import org.jeecg.modules.service.service.IAuthUserService; import org.jeecg.modules.service.vo.*; import org.jeecg.modules.system.entity.CardApplicationCustomers; import org.jeecg.modules.system.entity.CardDeliveryPerson; import org.jeecg.modules.system.mapper.CardDeliveryPersonMapper; import org.jeecg.modules.system.service.ICardApplicationCustomersService; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecg.common.system.base.controller.JeecgController; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSON; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; import org.jeecg.common.aspect.annotation.AutoLog; import org.apache.shiro.authz.annotation.RequiresPermissions; /** * @Description: 微信用户档案 * @Author: jeecg-boot * @Date: 2025-09-28 * @Version: V1.0 */ @Tag(name="微信用户档案") @RestController @RequestMapping("/service/authUser") @Slf4j public class AuthUserController extends JeecgController<AuthUser, IAuthUserService> { @Autowired private IAuthUserService authUserService; @Autowired private ICardApplicationCustomersService cardApplicationCustomersService; @Autowired private CardDeliveryPersonMapper cardDeliveryPersonMapper; /** *我的-推荐用户列表 */ @RequestMapping(value = "/recommendUser", method = RequestMethod.GET) public Result<RecommendUserVO> recommendUser(@RequestParam (name = "userId") String userId) { if (StringUtils.isBlank(userId)){ return Result.error("用户id不能为空"); } RecommendUserVO vo = authUserService.recommendUser(userId); return Result.OK(vo); } /** *我的-参团信息 */ @RequestMapping(value = "/myGroupMemberList", method = RequestMethod.GET) public Result<List<MyGroupMemberVO>> myGroupMemberList(@RequestParam (name = "userId") String userId) { if (StringUtils.isBlank(userId)){ return Result.error("用户id不能为空"); } List<MyGroupMemberVO> list = authUserService.myGroupMemberList(userId); return Result.OK(list); } /** * 我的资料 */ @RequestMapping(value = "/detail", method = RequestMethod.GET) public Result<AuthUserVO> detail(@RequestParam (name = "id",required=false) String id) { AuthUserVO vo = new AuthUserVO(); AuthUser authUser = authUserService.getById(id); if (authUser == null){ return Result.error("用户不存在"); } BeanUtils.copyProperties(authUser,vo); vo.setIsCardMan(false); if (authUser.getWxPhone() != null){ QueryWrapper<CardDeliveryPerson> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("phone", authUser.getWxPhone()); CardDeliveryPerson cardDeliveryPerson = cardDeliveryPersonMapper.selectOne(queryWrapper); if (cardDeliveryPerson != null){ vo.setIsCardMan(true); } } return Result.OK(vo); } @RequestMapping(value = "/update", method = RequestMethod.POST) public Result<?> update(@RequestBody AuthUserUpdateDTO authUserUpdateDTO) { AuthUser authUser = authUserService.getById(authUserUpdateDTO.getId()); authUser.setAvatar(authUserUpdateDTO.getAvatar()); authUser.setWxName(authUserUpdateDTO.getName()); authUser.setProvince(authUserUpdateDTO.getProvince()); authUser.setCity(authUserUpdateDTO.getCity()); authUser.setArea(authUserUpdateDTO.getArea()); authUser.setAddress(authUserUpdateDTO.getAddress()); authUserService.updateById(authUser); return Result.OK("修改成功"); } /** * 开卡任务 */ @RequestMapping(value = "/dispatchUser", method = RequestMethod.GET) public Result<List<DispatchUserVO>> dispatchUser(@RequestParam (name = "userId") String userId) { if (StringUtils.isBlank(userId)){ return Result.error("用户id不能为空"); } List<DispatchUserVO> list = authUserService.dispatchUser(userId); return Result.OK(list); } /** * 开卡任务详情 */ @RequestMapping(value = "/dispatchUserDetail", method = RequestMethod.GET) public Result<DispatchDetailVO> dispatchUserDetail(@RequestParam (name = "id") String id) { if (StringUtils.isBlank(id)){ return Result.error("预约单id不能为空"); } DispatchDetailVO vo = authUserService.dispatchUserDetail(id); return Result.OK(vo); } /** * 办卡 */ @RequestMapping(value = "/cardApplication", method = RequestMethod.POST) public Result<?> cardApplication(@RequestBody CardApplicationDTO cardApplicationDTO) { CardApplicationCustomers cardApplicationCustomers = cardApplicationCustomersService.getById(cardApplicationDTO.getId()); if (cardApplicationCustomers == null){ return Result.error("预约单不存在"); } if (cardApplicationCustomers.getStatus().equals("2")){ return Result.error("该预约单已处理"); } cardApplicationCustomers.setStatus("2"); cardApplicationCustomers.setTransactionPhone(cardApplicationDTO.getTransactionPhone()); cardApplicationCustomers.setAmount(cardApplicationDTO.getAmount()); cardApplicationCustomersService.updateById(cardApplicationCustomers); return Result.OK("提交办卡成功"); } }
Show line notes below