| @@ -218,7 +218,6 @@ public class BaseController { | |||||
| if (member == null) { | if (member == null) { | ||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | throw new MallinkException(ErrorCode.USER_IS_EMPTY); | ||||
| } | } | ||||
| setCUserBasicChild(member); | |||||
| RedisCacheUtils.cache(objectCommonRedisTemplate, key, member, seconds); | RedisCacheUtils.cache(objectCommonRedisTemplate, key, member, seconds); | ||||
| } | } | ||||
| @@ -276,13 +275,5 @@ public class BaseController { | |||||
| return ipaddress; | return ipaddress; | ||||
| } | } | ||||
| private void setCUserBasicChild(WxCUserBasicInfo basicInfo){ | |||||
| WxCUserBasicChild child = new WxCUserBasicChild(); | |||||
| child.setCUserId(basicInfo.getId()); | |||||
| child.setTenantId(basicInfo.getFinalTenantId()); | |||||
| List<WxCUserBasicChild> list = wxCUserBasicChildService.findList(child); | |||||
| basicInfo.setChildrenList(list); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,122 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.UserBasicInfoAddress; | |||||
| import com.iformall.domain.po.WxCUserBasicChild; | |||||
| import com.iformall.service.UserBasicInfoAddressService; | |||||
| import com.iformall.service.WxCUserBasicChildService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.List; | |||||
| @RestController | |||||
| @RequestMapping("api/userBasicInfoAddress") | |||||
| @Api(description = "会员子女相关接口") | |||||
| public class UserBasicInfoChildController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxCUserBasicChildService wxCUserBasicChildService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxCUserBasicChild userBasicChild, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::list"); | |||||
| if (null == userBasicChild) { | |||||
| userBasicChild = new WxCUserBasicChild(); | |||||
| } | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| userBasicChild.setCUserId(memberId); | |||||
| userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); | |||||
| PageInfo<WxCUserBasicChild> page = wxCUserBasicChildService.listAsPage(userBasicChild, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @PostMapping("saveOrUpdate") | |||||
| public ResultData saveOrUpdate(@RequestBody WxCUserBasicChild userBasicChild) { | |||||
| logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::saveOrUpdate"); | |||||
| if(userBasicChild == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| userBasicChild.setCUserId(memberId); | |||||
| userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); | |||||
| wxCUserBasicChildService.saveOrUpdate(userBasicChild); | |||||
| return new ResultData(); | |||||
| } | |||||
| @PostMapping("saveList") | |||||
| public ResultData saveOrUpdate(@RequestBody List<WxCUserBasicChild> userBasicChilds) { | |||||
| logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::saveOrUpdate"); | |||||
| if(userBasicChilds == null || userBasicChilds.isEmpty()){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| for (WxCUserBasicChild userBasicChild:userBasicChilds) { | |||||
| userBasicChild.setCUserId(memberId); | |||||
| userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); | |||||
| wxCUserBasicChildService.saveOrUpdate(userBasicChild); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("删除") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::delete"); | |||||
| if(id == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "Id为空"); | |||||
| } | |||||
| WxCUserBasicChild userBasicChild = new WxCUserBasicChild(); | |||||
| userBasicChild.setId(id); | |||||
| userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); | |||||
| wxCUserBasicChildService.updDelById(userBasicChild); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("查询") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] UserBasicInfoChildController::findById"); | |||||
| if(id == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "Id为空"); | |||||
| } | |||||
| WxCUserBasicChild userBasicChild = new WxCUserBasicChild(); | |||||
| userBasicChild.setId(id); | |||||
| userBasicChild.setTenantId(getTenantInfo().getFinalTenantId()); | |||||
| userBasicChild = wxCUserBasicChildService.findById(userBasicChild); | |||||
| return new ResultData(userBasicChild); | |||||
| } | |||||
| } | |||||
| @@ -537,7 +537,6 @@ public class WxUserGrantController extends BaseController { | |||||
| userVo.setWeight(wxCUserBasicInfo.getWeight()); | userVo.setWeight(wxCUserBasicInfo.getWeight()); | ||||
| userVo.setAddress(wxCUserBasicInfo.getAddress()); | userVo.setAddress(wxCUserBasicInfo.getAddress()); | ||||
| userVo.setStatus(wxCUserBasicInfo.getStatus()); | userVo.setStatus(wxCUserBasicInfo.getStatus()); | ||||
| userVo.setChildrenList(wxCUserBasicInfo.getChildrenList()); | |||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("userinfo error.",e); | logger.error("userinfo error.",e); | ||||
| @@ -696,8 +695,6 @@ public class WxUserGrantController extends BaseController { | |||||
| record.setAddress(wxCUserBasicInfo.getAddress()); | record.setAddress(wxCUserBasicInfo.getAddress()); | ||||
| record.setUpdateDate(new Date()); | record.setUpdateDate(new Date()); | ||||
| record.setFinalTenantId(tenantEntity.getFinalTenantId()); | record.setFinalTenantId(tenantEntity.getFinalTenantId()); | ||||
| record.setChildrenList(wxCUserBasicInfo.getChildrenList()); | |||||
| record.setUpdChild(true); | |||||
| wxCUserBasicInfoService.update(record); | wxCUserBasicInfoService.update(record); | ||||
| try{ | try{ | ||||
| @@ -161,9 +161,6 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<WxCUserBasicChild> childrenList; | private List<WxCUserBasicChild> childrenList; | ||||
| @TableField(exist = false) | |||||
| private boolean updChild = false; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String tagIds; | private String tagIds; | ||||
| @@ -15,5 +15,8 @@ public interface WxCUserBasicChildService { | |||||
| int updDelById(WxCUserBasicChild record); | int updDelById(WxCUserBasicChild record); | ||||
| int deleteByUserBasicId(WxCUserBasicChild record); | int deleteByUserBasicId(WxCUserBasicChild record); | ||||
| WxCUserBasicChild findById(WxCUserBasicChild userBasicChild); | |||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @@ -57,4 +58,9 @@ public class WxCUserBasicChildServiceImpl implements WxCUserBasicChildService { | |||||
| public int deleteByUserBasicId(WxCUserBasicChild record) { | public int deleteByUserBasicId(WxCUserBasicChild record) { | ||||
| return wxCUserBasicChildMapper.deleteByUserBasicId(record); | return wxCUserBasicChildMapper.deleteByUserBasicId(record); | ||||
| } | } | ||||
| @Override | |||||
| public WxCUserBasicChild findById(WxCUserBasicChild userBasicChild) { | |||||
| return wxCUserBasicChildMapper.selectOne(new QueryWrapper<>(userBasicChild)); | |||||
| } | |||||
| } | } | ||||
| @@ -756,21 +756,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| @Override | @Override | ||||
| public void update(WxCUserBasicInfo record) { | public void update(WxCUserBasicInfo record) { | ||||
| if(record.isUpdChild()){ | |||||
| WxCUserBasicChild childvo = new WxCUserBasicChild(); | |||||
| childvo.setCUserId(record.getId()); | |||||
| childvo.setTenantId(record.getFinalTenantId()); | |||||
| wxCUserBasicChildService.deleteByUserBasicId(childvo); | |||||
| List<WxCUserBasicChild> childrenList = record.getChildrenList(); | |||||
| if(childrenList != null && childrenList.size() > 0){ | |||||
| for (WxCUserBasicChild child:childrenList) { | |||||
| child.setId(null); | |||||
| child.setTenantId(record.getFinalTenantId()); | |||||
| child.setCUserId(record.getId()); | |||||
| wxCUserBasicChildService.saveOrUpdate(child); | |||||
| } | |||||
| } | |||||
| } | |||||
| wxCUserBasicInfoMapper.updateById(record); | wxCUserBasicInfoMapper.updateById(record); | ||||
| } | } | ||||
| @@ -496,7 +496,6 @@ public class TtUserGrantController extends BaseController { | |||||
| userVo.setSex(wxCUserBasicInfo.getSex()); | userVo.setSex(wxCUserBasicInfo.getSex()); | ||||
| userVo.setAddress(wxCUserBasicInfo.getAddress()); | userVo.setAddress(wxCUserBasicInfo.getAddress()); | ||||
| userVo.setStatus(wxCUserBasicInfo.getStatus()); | userVo.setStatus(wxCUserBasicInfo.getStatus()); | ||||
| userVo.setChildrenList(wxCUserBasicInfo.getChildrenList()); | |||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("userinfo error.",e); | logger.error("userinfo error.",e); | ||||