feat: add core entities, controllers, services, and mappers across multi-module project
This commit is contained in:
commit
4335344af7
1456 files changed
+58308
No files matched your search
@@ -0,0 +1,111 @@
|
||||
package cn.unizk.controller;
|
||||
|
||||
|
||||
import cn.unizk.entity.po.JkPhysio;
|
||||
import cn.unizk.entity.po.JkStore;
|
||||
import cn.unizk.entity.po.MobileAppUser;
|
||||
import cn.unizk.entity.po.UserFreeTrialInfo;
|
||||
import cn.unizk.entity.vo.AppUserDetailsVO;
|
||||
import cn.unizk.entity.vo.MobileAppUserVO;
|
||||
import cn.unizk.entity.vo.ResultData;
|
||||
import cn.unizk.entity.vo.UniPage;
|
||||
import cn.unizk.exception.ServiceException;
|
||||
import cn.unizk.mapper.JkPhysioMapper;
|
||||
import cn.unizk.mapper.MobileAppUserMapper;
|
||||
import cn.unizk.mapper.StoreMapper;
|
||||
import cn.unizk.mapper.UserFreeTrialInfoMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author hao
|
||||
* @Date 2025/9/8 11:25
|
||||
* @Version 1.0
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/pc/wxUser")
|
||||
public class WxUserController {
|
||||
|
||||
/* @Resource
|
||||
private WxUserService wxUserService;
|
||||
*/
|
||||
@Resource
|
||||
private MobileAppUserMapper mobileAppUserMapper;
|
||||
@Resource
|
||||
private UserFreeTrialInfoMapper userFreeTrialInfoMapper;
|
||||
@Resource
|
||||
private JkPhysioMapper jkPhysioMapper;
|
||||
@Resource
|
||||
private StoreMapper storeMapper;
|
||||
|
||||
|
||||
@PostMapping("/list")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public Page<MobileAppUser> list(@RequestBody UniPage<MobileAppUserVO> uniPage){
|
||||
Page<MobileAppUser> page = (Page<MobileAppUser>) uniPage.getPage();
|
||||
LambdaQueryWrapper<MobileAppUser> queryWrapper = uniPage.buildQueryWrapper(query -> {
|
||||
boolean hasKeyword = StringUtils.isNotBlank(query.getKeyword());
|
||||
LambdaQueryWrapper<MobileAppUser> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(query.getId() != null, MobileAppUser::getId, query.getId())
|
||||
.and(hasKeyword,w -> {
|
||||
w.eq(hasKeyword, MobileAppUser::getPhoneNumber, query.getKeyword())
|
||||
.or()
|
||||
.like(hasKeyword, MobileAppUser::getNickname, query.getKeyword());
|
||||
});
|
||||
return wrapper;
|
||||
});
|
||||
return mobileAppUserMapper.selectPage(page,queryWrapper);
|
||||
}
|
||||
|
||||
@GetMapping("/getUserDetails")
|
||||
public AppUserDetailsVO getUserDetails(@RequestParam("appUserId") Integer appUserId){
|
||||
UserFreeTrialInfo userFreeTrialInfo = userFreeTrialInfoMapper.selectOne(new LambdaQueryWrapper<UserFreeTrialInfo>()
|
||||
.eq(UserFreeTrialInfo::getUserId, appUserId));
|
||||
MobileAppUser user = mobileAppUserMapper.selectById(appUserId);
|
||||
AppUserDetailsVO vo = new AppUserDetailsVO();
|
||||
if (user.getFirstPhysioId() != null && user.getFirstStoreId() != null){
|
||||
JkPhysio jkPhysio = jkPhysioMapper.selectById(user.getFirstPhysioId());
|
||||
JkStore jkStore = storeMapper.selectById(user.getFirstStoreId());
|
||||
vo.setFirstPhysioName(jkPhysio.getPhysioName());
|
||||
vo.setFirstStoreName(jkStore.getStoreName());
|
||||
}
|
||||
if (Objects.isNull(userFreeTrialInfo)){
|
||||
return vo;
|
||||
}
|
||||
vo.setSymptomPosition(userFreeTrialInfo.getSymptomPosition());
|
||||
Map<Integer,String> castLevelMap = new HashMap<>();
|
||||
castLevelMap.put(1,"轻度");
|
||||
castLevelMap.put(2,"中度");
|
||||
castLevelMap.put(3,"重度");
|
||||
vo.setStrainLevel(castLevelMap.get(userFreeTrialInfo.getStrainLevel()));
|
||||
vo.setRestrict(castLevelMap.get(userFreeTrialInfo.getRestrictedDegree()));
|
||||
castLevelMap.clear();
|
||||
castLevelMap.put(1,"低");
|
||||
castLevelMap.put(2,"中");
|
||||
castLevelMap.put(3,"高");
|
||||
vo.setConsumptionLevel(castLevelMap.get(userFreeTrialInfo.getConsumptionLevel()));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@PostMapping("/writeOff")
|
||||
public ResultData writeOff(@RequestParam("appUserId") Integer appUserId){
|
||||
UserFreeTrialInfo userFreeTrialInfo = userFreeTrialInfoMapper.selectOne(new LambdaQueryWrapper<UserFreeTrialInfo>()
|
||||
.eq(UserFreeTrialInfo::getUserId, appUserId));
|
||||
if (Objects.isNull(userFreeTrialInfo)){
|
||||
throw new ServiceException("用户尚未填写首次免费体验信息,无法核销!");
|
||||
}
|
||||
MobileAppUser user = new MobileAppUser();
|
||||
user.setId(appUserId);
|
||||
user.setFreeTrial(0);
|
||||
mobileAppUserMapper.updateById(user);
|
||||
return ResultData.success();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user