省市区三级数据
parent
2add6dfc3b
commit
de021d28cb
|
|
@ -46,6 +46,10 @@ public class ExperimentController {
|
|||
@PostMapping("/add")
|
||||
@ApiOperation(value="实验信息新增")
|
||||
public AjaxResult<Object> add(@Validated @RequestBody ExperimentCreateValidate createValidate) {
|
||||
System.out.println(createValidate.getGoodsIds());
|
||||
for (Integer goodsId : createValidate.getGoodsIds()) {
|
||||
System.out.println(goodsId);
|
||||
}
|
||||
iExperimentService.add(createValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,18 @@ package com.wyh.admin.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wyh.admin.service.IExperimentService;
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.entity.Experiment;
|
||||
import com.wyh.common.entity.GoodsExperiment;
|
||||
import com.wyh.common.entity.goods.Goods;
|
||||
import com.wyh.common.entity.info.ClassInfo;
|
||||
import com.wyh.common.mapper.ExperimentMapper;
|
||||
import com.wyh.common.mapper.GoodsExperimentMapper;
|
||||
import com.wyh.common.mapper.goods.GoodsMapper;
|
||||
import com.wyh.common.mapper.info.ClassInfoMapper;
|
||||
import com.wyh.common.util.TimeUtils;
|
||||
import com.wyh.common.validator.ExperimentCreateValidate;
|
||||
|
|
@ -16,6 +21,7 @@ import com.wyh.common.validator.ExperimentSearchValidate;
|
|||
import com.wyh.common.validator.ExperimentUpdateValidate;
|
||||
import com.wyh.common.vo.ExperimentDetailVo;
|
||||
import com.wyh.common.vo.ExperimentListedVo;
|
||||
import com.wyh.common.vo.goods.GoodsListedVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
|
@ -24,6 +30,7 @@ import javax.annotation.Resource;
|
|||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 实验信息实现类
|
||||
|
|
@ -38,6 +45,13 @@ public class ExperimentServiceImpl implements IExperimentService {
|
|||
|
||||
@Resource
|
||||
ClassInfoMapper classInfoMapper;
|
||||
|
||||
@Resource
|
||||
GoodsMapper goodsMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
GoodsExperimentMapper goodsExperimentMapper;
|
||||
/**
|
||||
* 实验信息列表
|
||||
*
|
||||
|
|
@ -104,6 +118,20 @@ public class ExperimentServiceImpl implements IExperimentService {
|
|||
|
||||
ExperimentDetailVo vo = new ExperimentDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
|
||||
List<GoodsExperiment> goodsExperiments = goodsExperimentMapper.selectList(Wrappers.<GoodsExperiment>lambdaQuery().eq(GoodsExperiment::getExperimentId, model.getId()));
|
||||
List<Integer> collect = goodsExperiments.stream().map(GoodsExperiment::getGoodsId).collect(Collectors.toList());
|
||||
vo.setGoodsIds(collect);
|
||||
List<Goods> goods = goodsMapper.selectList(Wrappers.<Goods>lambdaQuery().in(Goods::getId, collect));
|
||||
List<GoodsListedVo> goodsListedVos = new LinkedList<>();
|
||||
for (Goods good : goods) {
|
||||
GoodsListedVo goodsListedVo = new GoodsListedVo();
|
||||
BeanUtils.copyProperties(good, goodsListedVo);
|
||||
goodsListedVo.setCreateTime(TimeUtils.timestampToDate(good.getCreateTime()));
|
||||
goodsListedVo.setUpdateTime(TimeUtils.timestampToDate(good.getUpdateTime()));
|
||||
goodsListedVos.add(goodsListedVo);
|
||||
}
|
||||
vo.setGoodsListedVos(goodsListedVos);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +153,20 @@ public class ExperimentServiceImpl implements IExperimentService {
|
|||
model.setIsShow(createValidate.getIsShow());
|
||||
model.setClassId(createValidate.getClassId());
|
||||
model.setContent(createValidate.getContent());
|
||||
experimentMapper.insert(model);
|
||||
int insert = experimentMapper.insert(model);
|
||||
if (insert>0) {
|
||||
if (createValidate.getGoodsIds()!=null) {
|
||||
for (Integer goodsId : createValidate.getGoodsIds()) {
|
||||
GoodsExperiment goodsExperiment = new GoodsExperiment();
|
||||
goodsExperiment.setExperimentId(model.getId());
|
||||
goodsExperiment.setGoodsId(goodsId);
|
||||
goodsExperimentMapper.insert(goodsExperiment);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.wyh.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("区域实体")
|
||||
public class Area implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer cityCode;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer provinceCode;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.wyh.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("城市实体")
|
||||
public class City implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty(value = "")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer provinceCode;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.wyh.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("实验产品关联实体")
|
||||
public class GoodsExperiment implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "实验id")
|
||||
private Integer experimentId;
|
||||
|
||||
@ApiModelProperty(value = "产品id")
|
||||
private Integer goodsId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.wyh.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("省实体")
|
||||
public class Province implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wyh.common.mapper;
|
||||
|
||||
import com.wyh.common.core.basics.IBaseMapper;
|
||||
import com.wyh.common.entity.Area;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 区域Mapper
|
||||
* @author wyh
|
||||
*/
|
||||
@Mapper
|
||||
public interface AreaMapper extends IBaseMapper<Area> {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wyh.common.mapper;
|
||||
|
||||
import com.wyh.common.core.basics.IBaseMapper;
|
||||
import com.wyh.common.entity.City;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 城市Mapper
|
||||
* @author wyh
|
||||
*/
|
||||
@Mapper
|
||||
public interface CityMapper extends IBaseMapper<City> {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wyh.common.mapper;
|
||||
|
||||
import com.wyh.common.core.basics.IBaseMapper;
|
||||
import com.wyh.common.entity.GoodsExperiment;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 实验产品关联Mapper
|
||||
* @author wyh
|
||||
*/
|
||||
@Mapper
|
||||
public interface GoodsExperimentMapper extends IBaseMapper<GoodsExperiment> {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wyh.common.mapper;
|
||||
|
||||
import com.wyh.common.core.basics.IBaseMapper;
|
||||
import com.wyh.common.entity.Province;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 省Mapper
|
||||
* @author wyh
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProvinceMapper extends IBaseMapper<Province> {
|
||||
}
|
||||
|
|
@ -51,8 +51,8 @@ public class WxMnpDriver {
|
|||
Map<String, String> config = ConfigUtils.get("mp_channel");
|
||||
|
||||
WxMaDefaultConfigImpl wxConfig = new WxMaDefaultConfigImpl();
|
||||
wxConfig.setAppid(config.getOrDefault("appId", "wx7fc871589fa0b838"));
|
||||
wxConfig.setSecret(config.getOrDefault("appSecret", "95c2497c1bfcc2f8e4b9a5a33fd96b39"));
|
||||
wxConfig.setAppid(config.getOrDefault("appId", "wxb1dab5a0cb6414c2"));
|
||||
wxConfig.setSecret(config.getOrDefault("appSecret", "27e6953adfe8f4c8383c5f76c8417c0a"));
|
||||
wxMaService.setWxMaConfig(wxConfig);
|
||||
|
||||
return wxMaService;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("实验信息创建参数")
|
||||
|
|
@ -41,4 +42,6 @@ public class ExperimentCreateValidate implements Serializable {
|
|||
@ApiModelProperty(value = "实验内容")
|
||||
private String content;
|
||||
|
||||
private List<Integer> goodsIds ;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ public class FeedbackCreateValidate implements Serializable {
|
|||
@ApiModelProperty(value = "反馈内容")
|
||||
private String content;
|
||||
|
||||
@NotNull(message = "image参数缺失")
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String image;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wyh.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AreaTreeVO {
|
||||
private Integer code;
|
||||
private String name;
|
||||
private List<AreaTreeVO> children;
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
package com.wyh.common.vo;
|
||||
|
||||
import com.wyh.common.vo.goods.GoodsListedVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("实验信息详情Vo")
|
||||
|
|
@ -36,5 +38,9 @@ public class ExperimentDetailVo implements Serializable {
|
|||
@ApiModelProperty(value = "实验内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "产品id")
|
||||
private List<Integer> goodsIds;
|
||||
|
||||
private List<GoodsListedVo> goodsListedVos;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.wyh.front.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.validator.info.ClassInfoSearchValidate;
|
||||
import com.wyh.front.service.IClassInfoService;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("front/info")
|
||||
@Api(tags = "班级科目信息")
|
||||
public class ClassInfoController {
|
||||
|
||||
@Resource
|
||||
IClassInfoService iClassInfoService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value="班级信息列表")
|
||||
public AjaxResult<JSONArray> list(@Validated PageValidate pageValidate,
|
||||
@Validated ClassInfoSearchValidate searchValidate) {
|
||||
JSONArray list = iClassInfoService.list(pageValidate, searchValidate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -3,17 +3,21 @@ package com.wyh.front.controller;
|
|||
import com.github.stuxuhai.jpinyin.PinyinException;
|
||||
import com.google.gson.Gson;
|
||||
import com.wyh.common.aop.NotLogin;
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.util.ChangeChinesePinyinUtil;
|
||||
import com.wyh.common.util.HttpUtils;
|
||||
import com.wyh.common.vo.AreaTreeVO;
|
||||
import com.wyh.common.vo.ResponseDataVo;
|
||||
import com.wyh.common.vo.WxCityForClientVO;
|
||||
import com.wyh.common.vo.WxMainCitysForClientVO;
|
||||
import com.wyh.front.service.IIndexService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -26,6 +30,10 @@ import java.util.stream.Collectors;
|
|||
public class CpspController {
|
||||
|
||||
|
||||
@Resource
|
||||
private IIndexService iIndexservice;
|
||||
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/getCity")
|
||||
public Map<String,List<WxMainCitysForClientVO>> getCity(){
|
||||
|
|
@ -65,4 +73,12 @@ public class CpspController {
|
|||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/getAddressTree")
|
||||
public AjaxResult<List<AreaTreeVO>> getAddressTree(){
|
||||
List<AreaTreeVO> list = iIndexservice.getAddressTree();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.wyh.front.controller;
|
||||
|
||||
import com.wyh.common.aop.NotLogin;
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.validator.ExperimentSearchValidate;
|
||||
import com.wyh.common.validator.annotation.IDMust;
|
||||
import com.wyh.common.vo.ExperimentDetailVo;
|
||||
import com.wyh.common.vo.ExperimentListedVo;
|
||||
import com.wyh.front.service.IExperimentService;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("front/experiment")
|
||||
@Api(tags = "实验信息")
|
||||
public class ExperimentController {
|
||||
|
||||
@Resource
|
||||
IExperimentService iExperimentService;
|
||||
|
||||
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value="实验信息列表")
|
||||
public AjaxResult<PageResult<ExperimentListedVo>> list(@Validated PageValidate pageValidate,
|
||||
@Validated ExperimentSearchValidate searchValidate) {
|
||||
PageResult<ExperimentListedVo> list = iExperimentService.list(pageValidate, searchValidate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value="实验信息详情")
|
||||
public AjaxResult<ExperimentDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
ExperimentDetailVo detail = iExperimentService.detail(id);
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +1,22 @@
|
|||
package com.wyh.front.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.wyh.common.aop.NotLogin;
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.entity.notice.NoticeRecord;
|
||||
import com.wyh.common.enums.NoticeEnum;
|
||||
import com.wyh.common.exception.OperateException;
|
||||
import com.wyh.common.mapper.notice.NoticeRecordMapper;
|
||||
import com.wyh.common.plugin.notice.NoticeDriver;
|
||||
import com.wyh.common.plugin.notice.vo.NoticeSmsVo;
|
||||
import com.wyh.common.util.StringUtils;
|
||||
import com.wyh.common.util.ToolUtils;
|
||||
import com.wyh.common.validator.annotation.IDMust;
|
||||
import com.wyh.front.service.IBannerService;
|
||||
import com.wyh.front.service.IIndexService;
|
||||
import com.wyh.front.validate.common.SmsValidate;
|
||||
import com.wyh.front.vo.basic.banner.BannerListedVo;
|
||||
import com.wyh.front.vo.basic.bannerfront.BannerFrontListedVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -84,6 +75,7 @@ public class IndexController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/bannerPc")
|
||||
@ApiOperation(value="首页轮播图(PC端)")
|
||||
public AjaxResult<List<BannerListedVo>> bannerPc() {
|
||||
|
|
@ -91,6 +83,7 @@ public class IndexController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/bannerFront")
|
||||
@ApiOperation(value="首页轮播图(小程序端)")
|
||||
public AjaxResult<List<BannerFrontListedVo>> bannerFront() {
|
||||
|
|
|
|||
|
|
@ -9,14 +9,15 @@ import com.wyh.common.exception.OperateException;
|
|||
import com.wyh.common.mapper.notice.NoticeRecordMapper;
|
||||
import com.wyh.common.plugin.notice.NoticeDriver;
|
||||
import com.wyh.common.plugin.notice.vo.NoticeSmsVo;
|
||||
import com.wyh.common.util.HttpUtils;
|
||||
import com.wyh.common.util.StringUtils;
|
||||
import com.wyh.common.util.ToolUtils;
|
||||
import com.wyh.front.ZJFrontThreadLocal;
|
||||
import com.wyh.front.service.ILoginService;
|
||||
import com.wyh.front.validate.common.SmsValidate;
|
||||
import com.wyh.front.validate.login.*;
|
||||
import com.wyh.front.vo.login.LoginUrlsVo;
|
||||
import com.wyh.front.vo.login.LoginTokenVo;
|
||||
import com.wyh.front.vo.login.LoginUrlsVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -28,8 +29,6 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpSession;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
|
@ -177,4 +176,12 @@ public class LoginController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
ZJFrontThreadLocal.getUserId();
|
||||
String s = HttpUtils.sendGet("https://github.com/modood/Administrative-divisions-of-China/blob/master/dist/pca-code.json");
|
||||
System.out.println(s);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
package com.wyh.front.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.wyh.common.validator.info.ClassInfoCreateValidate;
|
||||
import com.wyh.common.validator.info.ClassInfoSearchValidate;
|
||||
import com.wyh.common.validator.info.ClassInfoUpdateValidate;
|
||||
import com.wyh.common.vo.info.ClassInfoDetailVo;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
|
||||
/**
|
||||
* 班级信息服务接口类
|
||||
* @author wyh
|
||||
*/
|
||||
public interface IClassInfoService {
|
||||
|
||||
/**
|
||||
* 班级信息列表
|
||||
*
|
||||
* @author wyh
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<ClassInfoListedVo>
|
||||
*/
|
||||
JSONArray list(PageValidate pageValidate, ClassInfoSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 班级信息详情
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
* @return ClassInfoDetailVo
|
||||
*/
|
||||
ClassInfoDetailVo detail(Integer id);
|
||||
|
||||
/**
|
||||
* 班级信息新增
|
||||
*
|
||||
* @author wyh
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
void add(ClassInfoCreateValidate createValidate);
|
||||
|
||||
/**
|
||||
* 班级信息编辑
|
||||
*
|
||||
* @author wyh
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
void edit(ClassInfoUpdateValidate updateValidate);
|
||||
|
||||
/**
|
||||
* 班级信息删除
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
*/
|
||||
void del(Integer id);
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
package com.wyh.front.service;
|
||||
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.admin.validate.ExperimentCreateValidate;
|
||||
import com.wyh.admin.validate.ExperimentUpdateValidate;
|
||||
import com.wyh.admin.validate.ExperimentSearchValidate;
|
||||
import com.wyh.admin.vo.ExperimentListedVo;
|
||||
import com.wyh.admin.vo.ExperimentDetailVo;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.validator.ExperimentCreateValidate;
|
||||
import com.wyh.common.validator.ExperimentSearchValidate;
|
||||
import com.wyh.common.validator.ExperimentUpdateValidate;
|
||||
import com.wyh.common.vo.ExperimentDetailVo;
|
||||
import com.wyh.common.vo.ExperimentListedVo;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
|
||||
/**
|
||||
* 实验信息服务接口类
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.wyh.front.service;
|
||||
|
||||
import com.wyh.common.vo.AreaTreeVO;
|
||||
import com.wyh.front.vo.AboutDataVo;
|
||||
import com.wyh.front.vo.basic.banner.BannerListedVo;
|
||||
import com.wyh.front.vo.basic.bannerfront.BannerFrontListedVo;
|
||||
|
|
@ -65,4 +66,7 @@ public interface IIndexService {
|
|||
List<BannerFrontListedVo> bannerFront();
|
||||
|
||||
AboutDataVo aboutData();
|
||||
|
||||
List<AreaTreeVO> getAddressTree();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,153 @@
|
|||
package com.wyh.front.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.wyh.common.entity.info.ClassInfo;
|
||||
import com.wyh.common.mapper.info.ClassInfoMapper;
|
||||
import com.wyh.common.util.ListUtils;
|
||||
import com.wyh.common.util.TimeUtils;
|
||||
import com.wyh.common.validator.info.ClassInfoCreateValidate;
|
||||
import com.wyh.common.validator.info.ClassInfoSearchValidate;
|
||||
import com.wyh.common.validator.info.ClassInfoUpdateValidate;
|
||||
import com.wyh.common.vo.info.ClassInfoDetailVo;
|
||||
import com.wyh.common.vo.info.ClassInfoListedVo;
|
||||
import com.wyh.front.service.IClassInfoService;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班级信息实现类
|
||||
* @author wyh
|
||||
*/
|
||||
@Service
|
||||
public class ClassInfoServiceImpl implements IClassInfoService {
|
||||
|
||||
@Resource
|
||||
ClassInfoMapper classInfoMapper;
|
||||
|
||||
/**
|
||||
* 班级信息列表
|
||||
*
|
||||
* @author wyh
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<ClassInfoListedVo>
|
||||
*/
|
||||
@Override
|
||||
public JSONArray list(PageValidate pageValidate, ClassInfoSearchValidate searchValidate) {
|
||||
MPJQueryWrapper<ClassInfo> mpjQueryWrapper = new MPJQueryWrapper<>();
|
||||
mpjQueryWrapper.selectAll(ClassInfo.class);
|
||||
mpjQueryWrapper.eq("is_delete", 0);
|
||||
mpjQueryWrapper.orderByDesc(Arrays.asList("sort", "id"));
|
||||
|
||||
classInfoMapper.setSearch(mpjQueryWrapper, searchValidate, new String[]{
|
||||
"like:name:str",
|
||||
"=:pid:str",
|
||||
"=:sort:str",
|
||||
});
|
||||
|
||||
List<ClassInfoListedVo> array = classInfoMapper.selectJoinList(
|
||||
ClassInfoListedVo.class,
|
||||
mpjQueryWrapper);
|
||||
|
||||
for(ClassInfoListedVo item : array) {
|
||||
item.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
|
||||
item.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime()));
|
||||
}
|
||||
|
||||
JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(array));
|
||||
return ListUtils.listToTree(jsonArray, "id", "pid", "children");
|
||||
}
|
||||
|
||||
/**
|
||||
* 班级信息详情
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键参数
|
||||
* @return ClassInfo
|
||||
*/
|
||||
@Override
|
||||
public ClassInfoDetailVo detail(Integer id) {
|
||||
ClassInfo model = classInfoMapper.selectOne(
|
||||
new QueryWrapper<ClassInfo>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在");
|
||||
|
||||
ClassInfoDetailVo vo = new ClassInfoDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 班级信息新增
|
||||
*
|
||||
* @author wyh
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void add(ClassInfoCreateValidate createValidate) {
|
||||
ClassInfo model = new ClassInfo();
|
||||
model.setName(createValidate.getName());
|
||||
model.setPid(createValidate.getPid());
|
||||
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
model.setSort(createValidate.getSort());
|
||||
classInfoMapper.insert(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 班级信息编辑
|
||||
*
|
||||
* @author wyh
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void edit(ClassInfoUpdateValidate updateValidate) {
|
||||
ClassInfo model = classInfoMapper.selectOne(
|
||||
new QueryWrapper<ClassInfo>()
|
||||
.eq("id", updateValidate.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setId(updateValidate.getId());
|
||||
model.setName(updateValidate.getName());
|
||||
model.setPid(updateValidate.getPid());
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
model.setSort(updateValidate.getSort());
|
||||
classInfoMapper.updateById(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 班级信息删除
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
public void del(Integer id) {
|
||||
ClassInfo model = classInfoMapper.selectOne(
|
||||
new QueryWrapper<ClassInfo>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setIsDelete(1);
|
||||
model.setDeleteTime(System.currentTimeMillis() / 1000);
|
||||
classInfoMapper.updateById(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,29 +1,36 @@
|
|||
package com.wyh.front.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.admin.service.IExperimentService;
|
||||
import com.wyh.admin.validate.ExperimentCreateValidate;
|
||||
import com.wyh.admin.validate.ExperimentUpdateValidate;
|
||||
import com.wyh.admin.validate.ExperimentSearchValidate;
|
||||
import com.wyh.admin.vo.ExperimentListedVo;
|
||||
import com.wyh.admin.vo.ExperimentDetailVo;
|
||||
import com.wyh.common.config.GlobalConfig;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.entity.Experiment;
|
||||
import com.wyh.common.entity.GoodsExperiment;
|
||||
import com.wyh.common.entity.goods.Goods;
|
||||
import com.wyh.common.entity.info.ClassInfo;
|
||||
import com.wyh.common.mapper.ExperimentMapper;
|
||||
import com.wyh.common.util.ListUtils;
|
||||
import com.wyh.common.mapper.GoodsExperimentMapper;
|
||||
import com.wyh.common.mapper.goods.GoodsMapper;
|
||||
import com.wyh.common.mapper.info.ClassInfoMapper;
|
||||
import com.wyh.common.util.TimeUtils;
|
||||
import com.wyh.common.util.UrlUtils;
|
||||
import com.wyh.common.validator.ExperimentCreateValidate;
|
||||
import com.wyh.common.validator.ExperimentSearchValidate;
|
||||
import com.wyh.common.validator.ExperimentUpdateValidate;
|
||||
import com.wyh.common.vo.ExperimentDetailVo;
|
||||
import com.wyh.common.vo.ExperimentListedVo;
|
||||
import com.wyh.common.vo.goods.GoodsListedVo;
|
||||
import com.wyh.front.service.IExperimentService;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 实验信息实现类
|
||||
|
|
@ -35,6 +42,16 @@ public class ExperimentServiceImpl implements IExperimentService {
|
|||
@Resource
|
||||
ExperimentMapper experimentMapper;
|
||||
|
||||
@Resource
|
||||
ClassInfoMapper classInfoMapper;
|
||||
|
||||
@Resource
|
||||
GoodsMapper goodsMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
GoodsExperimentMapper goodsExperimentMapper;
|
||||
|
||||
/**
|
||||
* 实验信息列表
|
||||
*
|
||||
|
|
@ -70,9 +87,16 @@ public class ExperimentServiceImpl implements IExperimentService {
|
|||
BeanUtils.copyProperties(item, vo);
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime()));
|
||||
if (item.getClassId()!=null) {
|
||||
ClassInfo classInfo = classInfoMapper.selectById(item.getClassId());
|
||||
if (classInfo!=null) {
|
||||
vo.setClassName(classInfo.getName());
|
||||
}
|
||||
}
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
|
||||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||
}
|
||||
|
||||
|
|
@ -95,6 +119,19 @@ public class ExperimentServiceImpl implements IExperimentService {
|
|||
|
||||
ExperimentDetailVo vo = new ExperimentDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
List<GoodsExperiment> goodsExperiments = goodsExperimentMapper.selectList(Wrappers.<GoodsExperiment>lambdaQuery().eq(GoodsExperiment::getExperimentId, model.getId()));
|
||||
List<Integer> collect = goodsExperiments.stream().map(GoodsExperiment::getGoodsId).collect(Collectors.toList());
|
||||
vo.setGoodsIds(collect);
|
||||
List<Goods> goods = goodsMapper.selectList(Wrappers.<Goods>lambdaQuery().in(Goods::getId, collect));
|
||||
List<GoodsListedVo> goodsListedVos = new LinkedList<>();
|
||||
for (Goods good : goods) {
|
||||
GoodsListedVo goodsListedVo = new GoodsListedVo();
|
||||
BeanUtils.copyProperties(good, goodsListedVo);
|
||||
goodsListedVo.setCreateTime(TimeUtils.timestampToDate(good.getCreateTime()));
|
||||
goodsListedVo.setUpdateTime(TimeUtils.timestampToDate(good.getUpdateTime()));
|
||||
goodsListedVos.add(goodsListedVo);
|
||||
}
|
||||
vo.setGoodsListedVos(goodsListedVos);
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,11 @@ package com.wyh.front.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.wyh.common.config.GlobalConfig;
|
||||
import com.wyh.common.entity.Area;
|
||||
import com.wyh.common.entity.City;
|
||||
import com.wyh.common.entity.Province;
|
||||
import com.wyh.common.entity.article.Article;
|
||||
import com.wyh.common.entity.basic.banner.Banner;
|
||||
import com.wyh.common.entity.basic.bannerfront.BannerFront;
|
||||
|
|
@ -10,6 +14,9 @@ import com.wyh.common.entity.basic.company.*;
|
|||
import com.wyh.common.entity.decorate.DecoratePage;
|
||||
import com.wyh.common.entity.decorate.DecorateTabbar;
|
||||
import com.wyh.common.entity.setting.HotSearch;
|
||||
import com.wyh.common.mapper.AreaMapper;
|
||||
import com.wyh.common.mapper.CityMapper;
|
||||
import com.wyh.common.mapper.ProvinceMapper;
|
||||
import com.wyh.common.mapper.article.ArticleMapper;
|
||||
import com.wyh.common.mapper.basic.banner.BannerMapper;
|
||||
import com.wyh.common.mapper.basic.bannerfront.BannerFrontMapper;
|
||||
|
|
@ -17,14 +24,14 @@ import com.wyh.common.mapper.basic.company.*;
|
|||
import com.wyh.common.mapper.decorate.DecoratePageMapper;
|
||||
import com.wyh.common.mapper.decorate.DecorateTabbarMapper;
|
||||
import com.wyh.common.mapper.setting.HotSearchMapper;
|
||||
import com.wyh.common.util.*;
|
||||
import com.wyh.common.vo.AreaTreeVO;
|
||||
import com.wyh.common.vo.basic.company.CertificationListedVo;
|
||||
import com.wyh.front.service.IIndexService;
|
||||
import com.wyh.common.util.*;
|
||||
import com.wyh.front.vo.AboutDataVo;
|
||||
import com.wyh.front.vo.basic.banner.BannerListedVo;
|
||||
import com.wyh.front.vo.basic.bannerfront.BannerFrontListedVo;
|
||||
import com.wyh.front.vo.basic.company.AboutDetailVo;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -37,6 +44,14 @@ import java.util.*;
|
|||
@Service
|
||||
public class IndexServiceImpl implements IIndexService {
|
||||
|
||||
@Resource
|
||||
ProvinceMapper provinceMapper;
|
||||
|
||||
@Resource
|
||||
CityMapper cityMapper;
|
||||
|
||||
@Resource
|
||||
AreaMapper areaMapper;
|
||||
@Resource
|
||||
DecoratePageMapper decoratePageMapper;
|
||||
|
||||
|
|
@ -307,4 +322,37 @@ public class IndexServiceImpl implements IIndexService {
|
|||
return aboutDataVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaTreeVO> getAddressTree() {
|
||||
List<Province> provinces = provinceMapper.selectList(null);
|
||||
List<AreaTreeVO> areaVos = new ArrayList<>();
|
||||
|
||||
for (Province province : provinces) {
|
||||
AreaTreeVO areaTreeVO = new AreaTreeVO();
|
||||
areaTreeVO.setName(province.getName());
|
||||
areaTreeVO.setCode(province.getCode());
|
||||
List<AreaTreeVO> list = new ArrayList<>();
|
||||
List<City> appCities = cityMapper.selectList(Wrappers.<City>lambdaQuery().eq(City::getProvinceCode, province.getCode()));
|
||||
for (City appCity : appCities) {
|
||||
AreaTreeVO child = new AreaTreeVO();
|
||||
child.setName(appCity.getName());
|
||||
child.setCode(appCity.getCode());
|
||||
List<AreaTreeVO> vos = new ArrayList<>();
|
||||
List<Area> appTowns = areaMapper.selectList(Wrappers.<Area>lambdaQuery().eq(Area::getCityCode, appCity.getCode()));
|
||||
|
||||
for (Area appTown : appTowns) {
|
||||
AreaTreeVO areaChild = new AreaTreeVO();
|
||||
areaChild.setName(appTown.getName());
|
||||
areaChild.setCode(appTown.getCode());
|
||||
vos.add(areaChild);
|
||||
}
|
||||
areaTreeVO.setChildren(list);
|
||||
child.setChildren(vos);
|
||||
list.add(child);
|
||||
}
|
||||
areaVos.add(areaTreeVO);
|
||||
}
|
||||
return areaVos;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,6 +158,9 @@ public class LoginServiceImpl implements ILoginService {
|
|||
|
||||
WxMaJscode2SessionResult sessionResult = wxMaService.getUserService().getSessionInfo(code);
|
||||
String openId = sessionResult.getOpenid();
|
||||
System.out.println(
|
||||
"openId=" + openId
|
||||
);
|
||||
String uniId = sessionResult.getUnionid();
|
||||
String unionId = uniId == null ? "0" : uniId;
|
||||
|
||||
|
|
@ -340,7 +343,6 @@ public class LoginServiceImpl implements ILoginService {
|
|||
// 查询授权
|
||||
UserAuth userAuth = userAuthMapper.selectOne(new QueryWrapper<UserAuth>()
|
||||
.nested(wq->wq
|
||||
.eq("unionid", unionId).or()
|
||||
.eq("openid", openId)
|
||||
).last("limit 1"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue