| @@ -14,8 +14,10 @@ import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxAppinfo; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.domain.po.WxCUserCar; | |||
| import com.simple.service.WxAppinfoService; | |||
| import com.simple.service.WxCUserBasicInfoService; | |||
| import com.simple.service.WxCUserCarService; | |||
| import com.simple.service.WxCUserService; | |||
| import com.simple.utils.CheckUtil; | |||
| @@ -51,6 +53,9 @@ public class WxUserGrantController extends BaseController { | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCUserCarService wxCUserCarService; | |||
| @@ -249,7 +254,6 @@ public class WxUserGrantController extends BaseController { | |||
| wxCUserService.saveOrUpdate(user); | |||
| resultMap.put("msg","授权手机成功!"); | |||
| resultMap.put("phone",phoneNoInfo.getPhoneNumber()); | |||
| return new ResultData(resultMap); | |||
| } else { | |||
| return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap); | |||
| } | |||
| @@ -257,6 +261,19 @@ public class WxUserGrantController extends BaseController { | |||
| this.logger.error(e.getMessage(), e); | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解密并保存出错", resultMap); | |||
| } | |||
| // update wx_c_user_basic_info | |||
| List<WxCUserBasicInfo> list = wxCUserBasicInfoService.findByPhone(user.getTenantId(), user.getPhone()); | |||
| if (list.size() > 0) { | |||
| WxCUserBasicInfo basicInfo = list.get(0); | |||
| try { | |||
| wxCUserBasicInfoService.updateObj(basicInfo, user.getId()); | |||
| } catch (Exception e) { | |||
| } | |||
| } | |||
| return new ResultData(resultMap); | |||
| } | |||
| /** | |||
| @@ -0,0 +1,20 @@ | |||
| package com.simple.domain.vo; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| /** | |||
| * Created by syf on 2018/8/30. | |||
| */ | |||
| public class CUserBaseVo extends WxCUserBasicInfo { | |||
| private Long newId; | |||
| public Long getNewId() { | |||
| return newId; | |||
| } | |||
| public void setNewId(Long newId) { | |||
| this.newId = newId; | |||
| } | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.domain.vo.CUserBaseVo; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -16,6 +17,8 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| List<WxCUserBasicInfo> list(WxCUserBasicInfoDto record); | |||
| void updateScore(WxCUserBasicInfo record); | |||
| void updateNewId(CUserBaseVo record); | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| @@ -8,11 +8,12 @@ import org.springframework.web.multipart.MultipartFile; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxCUserBasicInfoService { | |||
| /** | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| @@ -20,53 +21,64 @@ public interface WxCUserBasicInfoService { | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxCUserBasicInfo getById(Long id); | |||
| /** | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCUserBasicInfo record); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void updateObj(WxCUserBasicInfo record, Long newId); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| PageInfo<WxCUserBasicInfo> list(WxCUserBasicInfoDto record, Integer pageIndex, Integer pageSize); | |||
| List<WxCUserBasicInfo> findByPhone(String tenantId, String phone); | |||
| /** | |||
| * 修改会员积分 | |||
| * | |||
| * @param record | |||
| */ | |||
| void updateScore(WxCUserBasicInfo record); | |||
| /** | |||
| * 根据性别查询数量 | |||
| * @param sex | |||
| * 根据性别查询数量 | |||
| * | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 根据年龄查询数量 | |||
| * | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| PageInfo<Map<String, Object>> queryListMap(WxCUserBasicInfoDto wxCUserBasicInfo, Integer pageNum, Integer pageSize); | |||
| @@ -10,6 +10,7 @@ import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCUserBasicInfo; | |||
| import com.simple.domain.vo.CUserBaseVo; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.mapper.WxCUserBasicInfoMapper; | |||
| import com.simple.mapper.WxCUserMapper; | |||
| @@ -54,13 +55,18 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.list(record)); | |||
| } | |||
| @Override | |||
| public List<WxCUserBasicInfo> findByPhone(String tenantId, String phone) { | |||
| WxCUserBasicInfo basicQ = new WxCUserBasicInfo(); | |||
| basicQ.setTenantId(tenantId); | |||
| basicQ.setPhone(phone); | |||
| return wxCUserBasicInfoMapper.select(basicQ); | |||
| } | |||
| @Override | |||
| public void updateScore(WxCUserBasicInfo record) { | |||
| wxCUserBasicInfoMapper.updateScore(record); | |||
| } | |||
| @Override | |||
| public WxCUserBasicInfo getById(Long id) { | |||
| @@ -79,6 +85,14 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| } | |||
| @Override | |||
| public void updateObj(WxCUserBasicInfo record, Long newId) { | |||
| CUserBaseVo userBaseVo = new CUserBaseVo(); | |||
| org.springframework.beans.BeanUtils.copyProperties(record, userBaseVo); | |||
| userBaseVo.setNewId(newId); | |||
| wxCUserBasicInfoMapper.updateNewId(userBaseVo); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxCUserBasicInfoMapper.deleteByPrimaryKey(id); | |||
| @@ -88,7 +102,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| @Override | |||
| public long findCountBySex(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountBySex(dto); | |||
| } | |||
| @@ -129,8 +129,12 @@ | |||
| </select> | |||
| <update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo"> | |||
| update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} | |||
| and c_user_id=#{cUserId} | |||
| and id=#{cUserId} | |||
| </update> | |||
| <update id="updateNewId" parameterType="com.simple.domain.vo.CUserBaseVo"> | |||
| update wx_c_user_basic_info set id=#{newId} where tenant_id=#{tenantId} | |||
| and id = #{id} | |||
| </update> | |||
| <select id="findCountBySex" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||