commit
b1f24cedc2
@ -0,0 +1,10 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# 依赖于环境的 Maven 主目录路径
|
||||
/mavenHomeManager.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="23" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/main.iml" filepath="$PROJECT_DIR$/main.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,110 @@
|
||||
|
||||
package com.controller;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.entity.ConfigEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.annotation.IgnoreAuth;
|
||||
import com.service.ConfigService;
|
||||
import com.utils.PageUtils;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
* 登录相关
|
||||
*/
|
||||
@RequestMapping("config")
|
||||
@RestController
|
||||
public class ConfigController{
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> params,ConfigEntity config){
|
||||
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
|
||||
PageUtils page = configService.queryPage(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params,ConfigEntity config){
|
||||
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
|
||||
PageUtils page = configService.queryPage(params);
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") String id){
|
||||
ConfigEntity config = configService.selectById(id);
|
||||
return R.ok().put("data", config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@RequestMapping("/detail/{id}")
|
||||
public R detail(@PathVariable("id") String id){
|
||||
ConfigEntity config = configService.selectById(id);
|
||||
return R.ok().put("data", config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据name获取信息
|
||||
*/
|
||||
@RequestMapping("/info")
|
||||
public R infoByName(@RequestParam String name){
|
||||
ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
|
||||
return R.ok().put("data", config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public R save(@RequestBody ConfigEntity config){
|
||||
// ValidatorUtils.validateEntity(config);
|
||||
configService.insert(config);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody ConfigEntity config){
|
||||
// ValidatorUtils.validateEntity(config);
|
||||
configService.updateById(config);//全部更新
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Long[] ids){
|
||||
configService.deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
}
|
@ -0,0 +1,244 @@
|
||||
package com.controller;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.*;
|
||||
|
||||
import com.entity.JiedanEntity;
|
||||
import com.service.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import com.utils.StringUtil;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.annotation.IgnoreAuth;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
|
||||
import com.entity.DaiquEntity;
|
||||
|
||||
import com.entity.view.DaiquView;
|
||||
import com.entity.YonghuEntity;
|
||||
import com.entity.ZhandianEntity;
|
||||
import com.utils.PageUtils;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
* 待取件表
|
||||
* 后端接口
|
||||
* @author
|
||||
* @email
|
||||
* @date 2021-03-11
|
||||
*/
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/daiqu")
|
||||
public class DaiquController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DaiquController.class);
|
||||
|
||||
@Autowired
|
||||
private DaiquService daiquService;
|
||||
|
||||
@Autowired
|
||||
private JiedanService jiedanService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
|
||||
//级联表service
|
||||
@Autowired
|
||||
private YonghuService yonghuService;
|
||||
@Autowired
|
||||
private ZhandianService zhandianService;
|
||||
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
||||
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
if(StringUtil.isNotEmpty(role) && "用户".equals(role)){
|
||||
params.put("yonghuId",request.getSession().getAttribute("userId"));
|
||||
}
|
||||
PageUtils page = daiquService.queryPage(params);
|
||||
|
||||
//字典表数据转换
|
||||
List<DaiquView> list =(List<DaiquView>)page.getList();
|
||||
for(DaiquView c:list){
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
/**
|
||||
* 后端详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
DaiquEntity daiqu = daiquService.selectById(id);
|
||||
if(daiqu !=null){
|
||||
//entity转view
|
||||
DaiquView view = new DaiquView();
|
||||
BeanUtils.copyProperties( daiqu , view );//把实体数据重构到view中
|
||||
|
||||
//级联表
|
||||
YonghuEntity yonghu = yonghuService.selectById(daiqu.getYonghuId());
|
||||
if(yonghu != null){
|
||||
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
|
||||
view.setYonghuId(yonghu.getId());
|
||||
}
|
||||
//级联表
|
||||
ZhandianEntity zhandian = zhandianService.selectById(daiqu.getZhandianId());
|
||||
if(zhandian != null){
|
||||
BeanUtils.copyProperties( zhandian , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
|
||||
view.setZhandianId(zhandian.getId());
|
||||
}
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody DaiquEntity daiqu, HttpServletRequest request){
|
||||
logger.debug("save方法:,,Controller:{},,daiqu:{}",this.getClass().getName(),daiqu.toString());
|
||||
daiqu.setKdztTypes(1);
|
||||
daiqu.setTakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6));
|
||||
Wrapper<DaiquEntity> queryWrapper = new EntityWrapper<DaiquEntity>()
|
||||
.eq("dqname", daiqu.getDqname())
|
||||
.eq("zhandian_id", daiqu.getZhandianId())
|
||||
.eq("yonghu_id", daiqu.getYonghuId())
|
||||
.eq("takecode", daiqu.getTakecode())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
DaiquEntity daiquEntity = daiquService.selectOne(queryWrapper);
|
||||
if(daiquEntity==null){
|
||||
daiquService.insert(daiqu);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody DaiquEntity daiqu, HttpServletRequest request){
|
||||
logger.debug("update方法:,,Controller:{},,daiqu:{}",this.getClass().getName(),daiqu.toString());
|
||||
//根据字段查询是否有相同数据
|
||||
Wrapper<DaiquEntity> queryWrapper = new EntityWrapper<DaiquEntity>()
|
||||
.notIn("id",daiqu.getId())
|
||||
.eq("dqname", daiqu.getDqname())
|
||||
.eq("zhandian_id", daiqu.getZhandianId())
|
||||
.eq("yonghu_id", daiqu.getYonghuId())
|
||||
.eq("kddx_types", daiqu.getKddxTypes())
|
||||
.eq("dqphone", daiqu.getDqphone())
|
||||
.eq("takecode", daiqu.getTakecode())
|
||||
.eq("kdzt_types", daiqu.getKdztTypes())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
DaiquEntity daiquEntity = daiquService.selectOne(queryWrapper);
|
||||
daiqu.setPickupTime(new Date());
|
||||
if(daiquEntity==null){
|
||||
daiquService.updateById(daiqu);//根据id更新
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 代取订单
|
||||
*/
|
||||
@RequestMapping("/replaceExpress")
|
||||
public R replaceExpress(@RequestBody Integer ids){
|
||||
DaiquEntity daiqu = daiquService.selectById(ids);
|
||||
if(daiqu == null){
|
||||
return R.error("数据不存在");
|
||||
}
|
||||
YonghuEntity yonghu = yonghuService.selectById(daiqu.getYonghuId());
|
||||
if(yonghu == null){
|
||||
return R.error("数据不存在");
|
||||
}
|
||||
JiedanEntity jiedan = new JiedanEntity();
|
||||
jiedan.setInitiateTime(new Date());
|
||||
jiedan.setJdyonghuId(daiqu.getYonghuId());
|
||||
jiedan.setJdphone(daiqu.getDqphone());
|
||||
jiedan.setAddresseename(yonghu.getName());
|
||||
jiedan.setJdaddressee("住宿楼栋:"+yonghu.getDormitory()+" ,寝室号:"+yonghu.getDormitory());
|
||||
jiedan.setJdtakecode(daiqu.getTakecode());
|
||||
jiedan.setDaiqukuaidimc(daiqu.getDqname());
|
||||
jiedan.setJdztTypes(1);//1未接
|
||||
jiedan.setKdlxTypes(1);//1取件
|
||||
jiedan.setOdd(String.valueOf(new Date().getTime()));
|
||||
Wrapper<JiedanEntity> queryWrapper = new EntityWrapper<JiedanEntity>()
|
||||
.eq("jdyonghu_id", jiedan.getJdyonghuId())
|
||||
.eq("jdtakecode", jiedan.getJdtakecode())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper);
|
||||
if(jiedanEntity==null){
|
||||
daiqu.setKdztTypes(3);
|
||||
daiquService.updateById(daiqu);
|
||||
jiedanService.insert(jiedan);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"你已经发布过这件快递的代取订单了");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取件
|
||||
*/
|
||||
@RequestMapping("/pickUp")
|
||||
public R pickUp(@RequestBody Integer ids){
|
||||
DaiquEntity daiqu = daiquService.selectById(ids);
|
||||
if(daiqu == null){
|
||||
return R.error("数据不存在");
|
||||
}
|
||||
daiqu.setKdztTypes(2);
|
||||
daiqu.setPickupTime(new Date());
|
||||
daiquService.updateById(daiqu);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
||||
daiquService.deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,225 @@
|
||||
package com.controller;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.*;
|
||||
|
||||
import com.entity.DaiqurenEntity;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import javax.servlet.ServletContext;
|
||||
import com.service.TokenService;
|
||||
import com.utils.StringUtil;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import com.service.DictionaryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.annotation.IgnoreAuth;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
|
||||
import com.entity.DaiqurenEntity;
|
||||
|
||||
import com.service.DaiqurenService;
|
||||
import com.entity.view.DaiqurenView;
|
||||
import com.utils.PageUtils;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
*
|
||||
* 后端接口
|
||||
* @author
|
||||
* @email
|
||||
* @date 2021-03-11
|
||||
*/
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/daiquren")
|
||||
public class DaiqurenController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DaiqurenController.class);
|
||||
|
||||
@Autowired
|
||||
private DaiqurenService daiqurenService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
|
||||
//级联表service
|
||||
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
||||
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
if(StringUtil.isNotEmpty(role) && "代取人".equals(role)){
|
||||
params.put("yonghuId",request.getSession().getAttribute("userId"));
|
||||
}
|
||||
PageUtils page = daiqurenService.queryPage(params);
|
||||
|
||||
//字典表数据转换
|
||||
List<DaiqurenView> list =(List<DaiqurenView>)page.getList();
|
||||
for(DaiqurenView c:list){
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
/**
|
||||
* 后端详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
DaiqurenEntity daiquren = daiqurenService.selectById(id);
|
||||
if(daiquren !=null){
|
||||
//entity转view
|
||||
DaiqurenView view = new DaiqurenView();
|
||||
BeanUtils.copyProperties( daiquren , view );//把实体数据重构到view中
|
||||
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody DaiqurenEntity daiquren, HttpServletRequest request){
|
||||
logger.debug("save方法:,,Controller:{},,daiquren:{}",this.getClass().getName(),daiquren.toString());
|
||||
Wrapper<DaiqurenEntity> queryWrapper = new EntityWrapper<DaiqurenEntity>()
|
||||
.eq("name", daiquren.getName())
|
||||
.eq("username", daiquren.getUsername())
|
||||
.eq("password", daiquren.getPassword())
|
||||
.eq("sex_types", daiquren.getSexTypes())
|
||||
.eq("phone", daiquren.getPhone())
|
||||
.eq("role", daiquren.getRole())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
DaiqurenEntity daiqurenEntity = daiqurenService.selectOne(queryWrapper);
|
||||
if(daiqurenEntity==null){
|
||||
daiquren.setRole("代取人");
|
||||
daiqurenService.insert(daiquren);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody DaiqurenEntity daiquren, HttpServletRequest request){
|
||||
logger.debug("update方法:,,Controller:{},,daiquren:{}",this.getClass().getName(),daiquren.toString());
|
||||
//根据字段查询是否有相同数据
|
||||
Wrapper<DaiqurenEntity> queryWrapper = new EntityWrapper<DaiqurenEntity>()
|
||||
.notIn("id",daiquren.getId())
|
||||
.eq("name", daiquren.getName())
|
||||
.eq("username", daiquren.getUsername())
|
||||
.eq("password", daiquren.getPassword())
|
||||
.eq("sex_types", daiquren.getSexTypes())
|
||||
.eq("phone", daiquren.getPhone())
|
||||
.eq("role", daiquren.getRole())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
DaiqurenEntity daiqurenEntity = daiqurenService.selectOne(queryWrapper);
|
||||
if("".equals(daiquren.getImgPhoto()) || "null".equals(daiquren.getImgPhoto())){
|
||||
daiquren.setImgPhoto(null);
|
||||
}
|
||||
if(daiqurenEntity==null){
|
||||
daiqurenService.updateById(daiquren);//根据id更新
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
||||
daiqurenService.deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/login")
|
||||
public R login(String username, String password, String role, HttpServletRequest request) {
|
||||
DaiqurenEntity yonghu = daiqurenService.selectOne(new EntityWrapper<DaiqurenEntity>().eq("username", username));
|
||||
if(yonghu==null || !yonghu.getPassword().equals(password)) {
|
||||
return R.error("账号或密码不正确");
|
||||
}
|
||||
if(!role.equals(yonghu.getRole())){
|
||||
return R.error("权限不正确");
|
||||
}
|
||||
String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "代取人");
|
||||
R r = R.ok();
|
||||
r.put("token", token);
|
||||
r.put("role","代取人");
|
||||
r.put("userId",yonghu.getId());
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/register")
|
||||
public R register(@RequestBody DaiqurenEntity yonghu){
|
||||
// ValidatorUtils.validateEntity(user);
|
||||
if(daiqurenService.selectOne(new EntityWrapper<DaiqurenEntity>().eq("username", yonghu.getUsername()).orNew().eq("phone",yonghu.getPhone())) !=null) {
|
||||
return R.error("代取人已存在或手机号身份证号已经被使用");
|
||||
}
|
||||
daiqurenService.insert(yonghu);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代取人的session代取人信息
|
||||
*/
|
||||
@RequestMapping("/session")
|
||||
public R getCurrYonghu(HttpServletRequest request){
|
||||
Integer id = (Integer)request.getSession().getAttribute("userId");
|
||||
DaiqurenEntity yonghu = daiqurenService.selectById(id);
|
||||
return R.ok().put("data", yonghu);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出
|
||||
*/
|
||||
@GetMapping(value = "logout")
|
||||
public R logout(HttpServletRequest request) {
|
||||
request.getSession().invalidate();
|
||||
return R.ok("退出成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,188 @@
|
||||
package com.controller;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import javax.servlet.ServletContext;
|
||||
import com.service.TokenService;
|
||||
import com.utils.StringUtil;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import com.service.DictionaryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.annotation.IgnoreAuth;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
|
||||
import com.entity.DictionaryEntity;
|
||||
|
||||
import com.service.DictionaryService;
|
||||
import com.entity.view.DictionaryView;
|
||||
import com.utils.PageUtils;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
* 字典表
|
||||
* 后端接口
|
||||
* @author
|
||||
* @email
|
||||
* @date 2021-03-11
|
||||
*/
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/dictionary")
|
||||
public class DictionaryController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);
|
||||
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
|
||||
//级联表service
|
||||
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
||||
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
if(StringUtil.isNotEmpty(role) && "用户".equals(role)){
|
||||
params.put("yonghuId",request.getSession().getAttribute("userId"));
|
||||
}
|
||||
PageUtils page = dictionaryService.queryPage(params);
|
||||
|
||||
//字典表数据转换
|
||||
List<DictionaryView> list =(List<DictionaryView>)page.getList();
|
||||
for(DictionaryView c:list){
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
/**
|
||||
* 后端详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
DictionaryEntity dictionary = dictionaryService.selectById(id);
|
||||
if(dictionary !=null){
|
||||
//entity转view
|
||||
DictionaryView view = new DictionaryView();
|
||||
BeanUtils.copyProperties( dictionary , view );//把实体数据重构到view中
|
||||
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){
|
||||
logger.debug("save方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());
|
||||
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
|
||||
.eq("dic_code", dictionary.getDicCode())
|
||||
.eq("code_index", dictionary.getCodeIndex())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
|
||||
if(dictionaryEntity==null){
|
||||
dictionary.setCreateTime(new Date());
|
||||
// String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if("".equals(role)){
|
||||
// dictionary.set
|
||||
// }
|
||||
dictionaryService.insert(dictionary);
|
||||
//如果字典表新增数据的话,把数据再重新查出,放入监听器中
|
||||
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
|
||||
ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
|
||||
Map<String, Map<Integer,String>> map = new HashMap<>();
|
||||
for(DictionaryEntity d :dictionaryEntities){
|
||||
Map<Integer, String> m = map.get(d.getDicCode());
|
||||
if(m ==null || m.isEmpty()){
|
||||
m = new HashMap<>();
|
||||
}
|
||||
m.put(d.getCodeIndex(),d.getIndexName());
|
||||
map.put(d.getDicCode(),m);
|
||||
}
|
||||
servletContext.setAttribute("dictionaryMap",map);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){
|
||||
logger.debug("update方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());
|
||||
//根据字段查询是否有相同数据
|
||||
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
|
||||
.notIn("id",dictionary.getId())
|
||||
.eq("dic_code", dictionary.getDicCode())
|
||||
.eq("code_index", dictionary.getCodeIndex())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
|
||||
if(dictionaryEntity==null){
|
||||
// String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if("".equals(role)){
|
||||
// dictionary.set
|
||||
// }
|
||||
dictionaryService.updateById(dictionary);//根据id更新
|
||||
//如果字典表修改数据的话,把数据再重新查出,放入监听器中
|
||||
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
|
||||
ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
|
||||
Map<String, Map<Integer,String>> map = new HashMap<>();
|
||||
for(DictionaryEntity d :dictionaryEntities){
|
||||
Map<Integer, String> m = map.get(d.getDicCode());
|
||||
if(m ==null || m.isEmpty()){
|
||||
m = new HashMap<>();
|
||||
}
|
||||
m.put(d.getCodeIndex(),d.getIndexName());
|
||||
map.put(d.getDicCode(),m);
|
||||
}
|
||||
servletContext.setAttribute("dictionaryMap",map);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
||||
dictionaryService.deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,83 @@
|
||||
package com.controller;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.entity.ConfigEntity;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.annotation.IgnoreAuth;
|
||||
import com.entity.EIException;
|
||||
import com.service.ConfigService;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
* 上传文件映射表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("file")
|
||||
@SuppressWarnings({"unchecked","rawtypes"})
|
||||
public class FileController{
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
@RequestMapping("/upload")
|
||||
public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
throw new EIException("上传文件不能为空");
|
||||
}
|
||||
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
|
||||
String fileName = new Date().getTime()+"."+fileExt;
|
||||
File dest = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName);
|
||||
file.transferTo(dest);
|
||||
if(StringUtils.isNotBlank(type) && type.equals("1")) {
|
||||
ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
|
||||
if(configEntity==null) {
|
||||
configEntity = new ConfigEntity();
|
||||
configEntity.setName("faceFile");
|
||||
configEntity.setValue(fileName);
|
||||
} else {
|
||||
configEntity.setValue(fileName);
|
||||
}
|
||||
configService.insertOrUpdate(configEntity);
|
||||
}
|
||||
return R.ok().put("file", fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@RequestMapping("/download")
|
||||
public void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
File file = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName);
|
||||
if (file.exists()) {
|
||||
response.reset();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName+"\"");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream());
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,259 @@
|
||||
package com.controller;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.*;
|
||||
|
||||
import com.entity.DaiqurenEntity;
|
||||
import com.entity.YijiedanEntity;
|
||||
import com.entity.YonghuEntity;
|
||||
import com.service.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import com.utils.StringUtil;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.annotation.IgnoreAuth;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
|
||||
import com.entity.JiedanEntity;
|
||||
|
||||
import com.entity.view.JiedanView;
|
||||
import com.utils.PageUtils;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
* 快递接单表
|
||||
* 后端接口
|
||||
* @author
|
||||
* @email
|
||||
* @date 2021-03-11
|
||||
*/
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/jiedan")
|
||||
public class JiedanController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(JiedanController.class);
|
||||
|
||||
@Autowired
|
||||
private YijiedanService yijiedanService;
|
||||
|
||||
@Autowired
|
||||
private JiedanService jiedanService;
|
||||
|
||||
@Autowired
|
||||
private DaiqurenService daiqurenService;
|
||||
|
||||
@Autowired
|
||||
private YonghuService yonghuService;
|
||||
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
|
||||
//级联表service
|
||||
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
||||
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
PageUtils page = null;
|
||||
if(StringUtil.isNotEmpty(role) && "用户".equals(role)){
|
||||
params.put("yonghuId",request.getSession().getAttribute("userId"));
|
||||
page = jiedanService.queryPage(params);
|
||||
}
|
||||
page = jiedanService.queryPage(params);
|
||||
//字典表数据转换
|
||||
List<JiedanView> list =(List<JiedanView>)page.getList();
|
||||
for(JiedanView c:list){
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
/**
|
||||
* 后端详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
JiedanEntity jiedan = jiedanService.selectById(id);
|
||||
if(jiedan !=null){
|
||||
//entity转view
|
||||
JiedanView view = new JiedanView();
|
||||
BeanUtils.copyProperties( jiedan , view );//把实体数据重构到view中
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody JiedanEntity jiedan, HttpServletRequest request){
|
||||
logger.debug("save方法:,,Controller:{},,jiedan:{}",this.getClass().getName(),jiedan.toString());
|
||||
Wrapper<JiedanEntity> queryWrapper = new EntityWrapper<JiedanEntity>()
|
||||
.eq("addresseename", jiedan.getAddresseename())
|
||||
.eq("jdphone", jiedan.getJdphone())
|
||||
.eq("jdaddressee", jiedan.getJdaddressee())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper);
|
||||
if(jiedanEntity==null){
|
||||
jiedanService.insert(jiedan);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody JiedanEntity jiedan, HttpServletRequest request){
|
||||
logger.debug("update方法:,,Controller:{},,jiedan:{}",this.getClass().getName(),jiedan.toString());
|
||||
//根据字段查询是否有相同数据
|
||||
Wrapper<JiedanEntity> queryWrapper = new EntityWrapper<JiedanEntity>()
|
||||
.notIn("id",jiedan.getId())
|
||||
.eq("odd", jiedan.getOdd())
|
||||
.eq("daiqukuaidimc", jiedan.getDaiqukuaidimc())
|
||||
.eq("jdyonghu_id", jiedan.getJdyonghuId())
|
||||
.eq("addresseename", jiedan.getAddresseename())
|
||||
.eq("jdphone", jiedan.getJdphone())
|
||||
.eq("jdaddressee", jiedan.getJdaddressee())
|
||||
.eq("jdtakecode", jiedan.getJdtakecode())
|
||||
.eq("jdzt_types", jiedan.getJdztTypes())
|
||||
.eq("kdlx_types", jiedan.getKdlxTypes())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper);
|
||||
jiedan.setInitiateTime(new Date());
|
||||
if(jiedanEntity==null){
|
||||
jiedanService.updateById(jiedan);//根据id更新
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 接单
|
||||
*/
|
||||
@RequestMapping("/receiving")
|
||||
public R receiving(@RequestBody Integer ids, HttpServletRequest request){
|
||||
JiedanEntity jiedan = jiedanService.selectById(ids);
|
||||
if(jiedan == null){
|
||||
return R.error();
|
||||
}
|
||||
if(request.getSession().getAttribute("role").equals("代取人")){
|
||||
DaiqurenEntity userId = daiqurenService.selectById((Integer) request.getSession().getAttribute("userId"));
|
||||
|
||||
jiedan.setJdztTypes(2);//以接
|
||||
YijiedanEntity yijiedan = new YijiedanEntity();
|
||||
yijiedan.setOdd(jiedan.getOdd());
|
||||
yijiedan.setYonghuId(jiedan.getJdyonghuId());
|
||||
yijiedan.setFbphone(jiedan.getJdphone());
|
||||
yijiedan.setDaiqurenId(userId.getId());
|
||||
yijiedan.setJdphone(userId.getPhone());
|
||||
yijiedan.setInitiateTime(new Date());
|
||||
yijiedan.setDdztTypes(1);//1正在路上
|
||||
|
||||
Wrapper<YijiedanEntity> queryWrapper = new EntityWrapper<YijiedanEntity>()
|
||||
.eq("odd", yijiedan.getOdd())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper);
|
||||
if(yijiedanEntity==null){
|
||||
jiedanService.updateById(jiedan);
|
||||
yijiedanService.insert(yijiedan);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
return R.error("***");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/ship")
|
||||
public R ship(String name, Integer yh, Integer dx, HttpServletRequest request){
|
||||
if(name == null && name == "null" && name == ""){
|
||||
return R.error("快递名称不能为空");
|
||||
}
|
||||
if(yh == null && yh == 0){
|
||||
return R.error("收件人不能为空");
|
||||
}
|
||||
|
||||
YonghuEntity yonghu = yonghuService.selectById(yh);
|
||||
if(yonghu == null){
|
||||
return R.error();
|
||||
}
|
||||
if(yonghu.getId() == (Integer)request.getSession().getAttribute("userId")){
|
||||
return R.error("发件人和收件人不能相同");
|
||||
}
|
||||
JiedanEntity jiedan = new JiedanEntity();
|
||||
jiedan.setOdd(String.valueOf(new Date().getTime()));
|
||||
jiedan.setDaiqukuaidimc(name);
|
||||
jiedan.setDx(dx);
|
||||
jiedan.setJdyonghuId((Integer)request.getSession().getAttribute("userId"));
|
||||
jiedan.setJdphone(yonghu.getPhone());
|
||||
jiedan.setInitiateTime(new Date());
|
||||
jiedan.setAddresseename(yonghu.getName());
|
||||
jiedan.setJdaddressee("住宿楼栋:"+yonghu.getDormitory()+" ,寝室号:"+yonghu.getDormitory());
|
||||
jiedan.setJdtakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6));
|
||||
jiedan.setJdztTypes(1);//1未接
|
||||
jiedan.setKdlxTypes(2);//2寄件
|
||||
Wrapper<JiedanEntity> queryWrapper = new EntityWrapper<JiedanEntity>()
|
||||
.eq("addresseename", jiedan.getAddresseename())
|
||||
.eq("jdphone", jiedan.getJdphone())
|
||||
.eq("jdaddressee", jiedan.getJdaddressee())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper);
|
||||
if(jiedanEntity==null){
|
||||
jiedanService.insert(jiedan);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"已经有相同的数据了");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
||||
jiedanService.deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,246 @@
|
||||
package com.controller;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.*;
|
||||
|
||||
import com.entity.*;
|
||||
import com.service.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import com.utils.StringUtil;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.annotation.IgnoreAuth;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
|
||||
import com.entity.view.YijiedanView;
|
||||
import com.utils.PageUtils;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
* 已接单表
|
||||
* 后端接口
|
||||
* @author
|
||||
* @email
|
||||
* @date 2021-03-11
|
||||
*/
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/yijiedan")
|
||||
public class YijiedanController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(YijiedanController.class);
|
||||
|
||||
@Autowired
|
||||
private YijiedanService yijiedanService;
|
||||
|
||||
@Autowired
|
||||
private JiedanService jiedanService;
|
||||
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
@Autowired
|
||||
private DaiquService daiquService;
|
||||
|
||||
//级联表service
|
||||
@Autowired
|
||||
private DaiqurenService daiqurenService;
|
||||
|
||||
@Autowired
|
||||
private YonghuService yonghuService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ZhandianService zhandianService;
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
||||
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
PageUtils page = null;
|
||||
if(StringUtil.isNotEmpty(role) && "用户".equals(role)){
|
||||
params.put("yonghuId",request.getSession().getAttribute("userId"));
|
||||
page = yijiedanService.queryPage(params);
|
||||
}else if(StringUtil.isNotEmpty(role) && "代取人".equals(role)){
|
||||
params.put("daiqurenId",request.getSession().getAttribute("userId"));
|
||||
page = yijiedanService.queryPage(params);
|
||||
}
|
||||
page = yijiedanService.queryPage(params);
|
||||
|
||||
//字典表数据转换
|
||||
List<YijiedanView> list =(List<YijiedanView>)page.getList();
|
||||
for(YijiedanView c:list){
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
/**
|
||||
* 后端详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
YijiedanEntity yijiedan = yijiedanService.selectById(id);
|
||||
if(yijiedan !=null){
|
||||
//entity转view
|
||||
YijiedanView view = new YijiedanView();
|
||||
BeanUtils.copyProperties( yijiedan , view );//把实体数据重构到view中
|
||||
|
||||
//级联表
|
||||
DaiqurenEntity daiquren = daiqurenService.selectById(yijiedan.getDaiqurenId());
|
||||
if(daiquren != null){
|
||||
view.setDaiqurenId(daiquren.getId());
|
||||
view.setYhname(daiquren.getName());
|
||||
}
|
||||
//级联表
|
||||
YonghuEntity yonghu = yonghuService.selectById(yijiedan.getYonghuId());
|
||||
if(yonghu != null){
|
||||
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
|
||||
view.setYonghuId(yonghu.getId());
|
||||
}
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody YijiedanEntity yijiedan, HttpServletRequest request){
|
||||
logger.debug("save方法:,,Controller:{},,yijiedan:{}",this.getClass().getName(),yijiedan.toString());
|
||||
Wrapper<YijiedanEntity> queryWrapper = new EntityWrapper<YijiedanEntity>()
|
||||
.eq("odd", yijiedan.getOdd())
|
||||
.eq("yonghu_id", yijiedan.getYonghuId())
|
||||
.eq("fbphone", yijiedan.getFbphone())
|
||||
.eq("daiquren_id", yijiedan.getDaiqurenId())
|
||||
.eq("jdphone", yijiedan.getJdphone())
|
||||
.eq("ddzt_types", yijiedan.getDdztTypes())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper);
|
||||
if(yijiedanEntity==null){
|
||||
// String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if("".equals(role)){
|
||||
// yijiedan.set
|
||||
// }
|
||||
yijiedanService.insert(yijiedan);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody YijiedanEntity yijiedan, HttpServletRequest request){
|
||||
logger.debug("update方法:,,Controller:{},,yijiedan:{}",this.getClass().getName(),yijiedan.toString());
|
||||
//根据字段查询是否有相同数据
|
||||
Wrapper<YijiedanEntity> queryWrapper = new EntityWrapper<YijiedanEntity>()
|
||||
.notIn("id",yijiedan.getId())
|
||||
.eq("odd", yijiedan.getOdd())
|
||||
.eq("yonghu_id", yijiedan.getYonghuId())
|
||||
.eq("fbphone", yijiedan.getFbphone())
|
||||
.eq("daiquren_id", yijiedan.getDaiqurenId())
|
||||
.eq("jdphone", yijiedan.getJdphone())
|
||||
.eq("ddzt_types", yijiedan.getDdztTypes())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper);
|
||||
yijiedan.setInitiateTime(new Date());
|
||||
if(yijiedanEntity==null){
|
||||
// String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if("".equals(role)){
|
||||
// yijiedan.set
|
||||
// }
|
||||
yijiedanService.updateById(yijiedan);//根据id更新
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 完成
|
||||
*/
|
||||
@RequestMapping("/accomplish")
|
||||
public R accomplish(@RequestBody Integer ids){
|
||||
YijiedanEntity yijiedan = yijiedanService.selectById(ids);
|
||||
if(yijiedan == null){
|
||||
return R.error();
|
||||
}
|
||||
JiedanEntity odd = jiedanService.selectOne(new EntityWrapper<JiedanEntity>().eq("odd", yijiedan.getOdd()));
|
||||
if(odd == null){
|
||||
return R.error();
|
||||
}
|
||||
if(odd.getKdlxTypes() == 1){
|
||||
DaiquEntity takecode = daiquService.selectOne(new EntityWrapper().eq("takecode", odd.getJdtakecode()));
|
||||
if(takecode == null){
|
||||
return R.error();
|
||||
}
|
||||
takecode.setKdztTypes(2);
|
||||
|
||||
takecode.setPickupTime(new Date());
|
||||
daiquService.updateById(takecode);
|
||||
}else{
|
||||
DaiquEntity daiqu = new DaiquEntity();
|
||||
List<ZhandianEntity> zhandian = zhandianService.selectList(null);
|
||||
int max=zhandian.size()-1,min=0;
|
||||
int ran2 = (int) (Math.random()*(max-min)+min);
|
||||
//随机站点
|
||||
daiqu.setZhandianId(zhandian.get(ran2).getId());
|
||||
//快递名称
|
||||
daiqu.setDqname(odd.getDaiqukuaidimc());
|
||||
//快递大小
|
||||
daiqu.setKddxTypes(odd.getDx());
|
||||
daiqu.setKdztTypes(1);
|
||||
//收件用户id
|
||||
YonghuEntity name = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("name", odd.getAddresseename()));
|
||||
daiqu.setYonghuId(name.getId());
|
||||
//手机号
|
||||
daiqu.setDqphone(name.getPhone());
|
||||
//取件码
|
||||
daiqu.setTakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6));
|
||||
daiquService.insert(daiqu);
|
||||
}
|
||||
yijiedan.setDdztTypes(2);//2已完成
|
||||
yijiedanService.updateById(yijiedan);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
||||
yijiedanService.deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,242 @@
|
||||
package com.controller;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import javax.servlet.ServletContext;
|
||||
import com.service.TokenService;
|
||||
import com.utils.StringUtil;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import com.service.DictionaryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.annotation.IgnoreAuth;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
|
||||
import com.entity.YonghuEntity;
|
||||
|
||||
import com.service.YonghuService;
|
||||
import com.entity.view.YonghuView;
|
||||
import com.utils.PageUtils;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
*
|
||||
* 后端接口
|
||||
* @author
|
||||
* @email
|
||||
* @date 2021-03-11
|
||||
*/
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/yonghu")
|
||||
public class YonghuController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(YonghuController.class);
|
||||
|
||||
@Autowired
|
||||
private YonghuService yonghuService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
||||
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
||||
PageUtils page = yonghuService.queryPage(params);
|
||||
|
||||
//字典表数据转换
|
||||
List<YonghuView> list =(List<YonghuView>)page.getList();
|
||||
for(YonghuView c:list){
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
/**
|
||||
* 后端详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
YonghuEntity yonghu = yonghuService.selectById(id);
|
||||
if(yonghu !=null){
|
||||
//entity转view
|
||||
YonghuView view = new YonghuView();
|
||||
BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中
|
||||
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
|
||||
logger.debug("save方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());
|
||||
Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>()
|
||||
.eq("studentnumber", yonghu.getStudentnumber())
|
||||
.eq("name", yonghu.getName())
|
||||
.eq("username", yonghu.getUsername())
|
||||
.eq("password", yonghu.getPassword())
|
||||
.eq("sex_types", yonghu.getSexTypes())
|
||||
.eq("phone", yonghu.getPhone())
|
||||
.eq("zhuSuLou", yonghu.getZhuSuLou())
|
||||
.eq("dormitory", yonghu.getDormitory())
|
||||
.eq("role", yonghu.getRole())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);
|
||||
if(yonghuEntity==null){
|
||||
if(yonghu.getPassword()== "" || yonghu.getPassword() == null){
|
||||
yonghu.setPassword("123456");
|
||||
}
|
||||
yonghu.setRole("用户");
|
||||
yonghuService.insert(yonghu);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
|
||||
logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());
|
||||
//根据字段查询是否有相同数据
|
||||
Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>()
|
||||
.notIn("id",yonghu.getId())
|
||||
.eq("studentnumber", yonghu.getStudentnumber())
|
||||
.eq("name", yonghu.getName())
|
||||
.eq("username", yonghu.getUsername())
|
||||
.eq("password", yonghu.getPassword())
|
||||
.eq("sex_types", yonghu.getSexTypes())
|
||||
.eq("phone", yonghu.getPhone())
|
||||
.eq("zhuSuLou", yonghu.getZhuSuLou())
|
||||
.eq("dormitory", yonghu.getDormitory())
|
||||
.eq("role", yonghu.getRole())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);
|
||||
if("".equals(yonghu.getImgPhoto()) || "null".equals(yonghu.getImgPhoto())){
|
||||
yonghu.setImgPhoto(null);
|
||||
}
|
||||
if(yonghuEntity==null){
|
||||
yonghuService.updateById(yonghu);//根据id更新
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
||||
yonghuService.deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意注册
|
||||
*/
|
||||
@RequestMapping("/yanz")
|
||||
public R delete(Integer ids){
|
||||
YonghuEntity yonghu = yonghuService.selectById(ids);
|
||||
if(yonghu!= null){
|
||||
return R.error();
|
||||
}
|
||||
yonghu.setYanzheng(1);
|
||||
yonghuService.updateById(yonghu);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/login")
|
||||
public R login(String username, String password, String role, HttpServletRequest request) {
|
||||
YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));
|
||||
if(yonghu==null || !yonghu.getPassword().equals(password)) {
|
||||
return R.error("账号或密码不正确");
|
||||
}
|
||||
if(yonghu.getYanzheng() != 1){
|
||||
return R.error("还未通过验证请耐心等待");
|
||||
}
|
||||
if(!role.equals(yonghu.getRole())){
|
||||
return R.error("权限不正确");
|
||||
}
|
||||
String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "用户");
|
||||
R r = R.ok();
|
||||
r.put("token", token);
|
||||
r.put("role","用户");
|
||||
r.put("userId",yonghu.getId());
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@PostMapping(value = "/register")
|
||||
public R register(@RequestBody YonghuEntity yonghu){
|
||||
// ValidatorUtils.validateEntity(user);
|
||||
if(yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).orNew().eq("phone",yonghu.getPhone())) !=null) {
|
||||
return R.error("用户已存在或手机号身份证号已经被使用");
|
||||
}
|
||||
yonghuService.insert(yonghu);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户的session用户信息
|
||||
*/
|
||||
@RequestMapping("/session")
|
||||
public R getCurrYonghu(HttpServletRequest request){
|
||||
Integer id = (Integer)request.getSession().getAttribute("userId");
|
||||
YonghuEntity yonghu = yonghuService.selectById(id);
|
||||
return R.ok().put("data", yonghu);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出
|
||||
*/
|
||||
@GetMapping(value = "logout")
|
||||
public R logout(HttpServletRequest request) {
|
||||
request.getSession().invalidate();
|
||||
return R.ok("退出成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,163 @@
|
||||
package com.controller;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import java.util.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import javax.servlet.ServletContext;
|
||||
import com.service.TokenService;
|
||||
import com.utils.StringUtil;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import com.service.DictionaryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.annotation.IgnoreAuth;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
|
||||
import com.entity.ZhandianEntity;
|
||||
|
||||
import com.service.ZhandianService;
|
||||
import com.entity.view.ZhandianView;
|
||||
import com.utils.PageUtils;
|
||||
import com.utils.R;
|
||||
|
||||
/**
|
||||
* 快递站点
|
||||
* 后端接口
|
||||
* @author
|
||||
* @email
|
||||
* @date 2021-03-11
|
||||
*/
|
||||
@RestController
|
||||
@Controller
|
||||
@RequestMapping("/zhandian")
|
||||
public class ZhandianController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZhandianController.class);
|
||||
|
||||
@Autowired
|
||||
private ZhandianService zhandianService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
|
||||
//级联表service
|
||||
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
||||
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
if(StringUtil.isNotEmpty(role) && "用户".equals(role)){
|
||||
params.put("yonghuId",request.getSession().getAttribute("userId"));
|
||||
}
|
||||
PageUtils page = zhandianService.queryPage(params);
|
||||
|
||||
//字典表数据转换
|
||||
List<ZhandianView> list =(List<ZhandianView>)page.getList();
|
||||
for(ZhandianView c:list){
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
/**
|
||||
* 后端详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
ZhandianEntity zhandian = zhandianService.selectById(id);
|
||||
if(zhandian !=null){
|
||||
//entity转view
|
||||
ZhandianView view = new ZhandianView();
|
||||
BeanUtils.copyProperties( zhandian , view );//把实体数据重构到view中
|
||||
|
||||
//修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody ZhandianEntity zhandian, HttpServletRequest request){
|
||||
logger.debug("save方法:,,Controller:{},,zhandian:{}",this.getClass().getName(),zhandian.toString());
|
||||
Wrapper<ZhandianEntity> queryWrapper = new EntityWrapper<ZhandianEntity>()
|
||||
.eq("zdname", zhandian.getZdname())
|
||||
.eq("address", zhandian.getAddress())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
ZhandianEntity zhandianEntity = zhandianService.selectOne(queryWrapper);
|
||||
if(zhandianEntity==null){
|
||||
// String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if("".equals(role)){
|
||||
// zhandian.set
|
||||
// }
|
||||
zhandianService.insert(zhandian);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody ZhandianEntity zhandian, HttpServletRequest request){
|
||||
logger.debug("update方法:,,Controller:{},,zhandian:{}",this.getClass().getName(),zhandian.toString());
|
||||
//根据字段查询是否有相同数据
|
||||
Wrapper<ZhandianEntity> queryWrapper = new EntityWrapper<ZhandianEntity>()
|
||||
.notIn("id",zhandian.getId())
|
||||
.eq("zdname", zhandian.getZdname())
|
||||
.eq("address", zhandian.getAddress())
|
||||
;
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
ZhandianEntity zhandianEntity = zhandianService.selectOne(queryWrapper);
|
||||
if(zhandianEntity==null){
|
||||
// String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if("".equals(role)){
|
||||
// zhandian.set
|
||||
// }
|
||||
zhandianService.updateById(zhandian);//根据id更新
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
||||
zhandianService.deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
|
||||
package com.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用接口
|
||||
*/
|
||||
public interface CommonDao{
|
||||
List<String> getOption(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> getFollowByOption(Map<String, Object> params);
|
||||
|
||||
List<String> getFollowByOption2(Map<String, Object> params);
|
||||
|
||||
void sh(Map<String, Object> params);
|
||||
|
||||
int remindCount(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> selectCal(Map<String, Object> params);
|
||||
|
||||
List<Map<String, Object>> selectGroup(Map<String, Object> params);
|
||||
|
||||
List<Map<String, Object>> selectValue(Map<String, Object> params);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
|
||||
package com.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.entity.ConfigEntity;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
public interface ConfigDao extends BaseMapper<ConfigEntity> {
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.DaiquEntity;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.entity.view.DaiquView;
|
||||
|
||||
/**
|
||||
* 待取件表 Dao 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2021-03-11
|
||||
*/
|
||||
public interface DaiquDao extends BaseMapper<DaiquEntity> {
|
||||
|
||||
List<DaiquView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.DaiqurenEntity;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.entity.view.DaiqurenView;
|
||||
|
||||
/**
|
||||
* Dao 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2021-03-11
|
||||
*/
|
||||
public interface DaiqurenDao extends BaseMapper<DaiqurenEntity> {
|
||||
|
||||
List<DaiqurenView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.DictionaryEntity;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.entity.view.DictionaryView;
|
||||
|
||||
/**
|
||||
* 字典表 Dao 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2021-03-11
|
||||
*/
|
||||
public interface DictionaryDao extends BaseMapper<DictionaryEntity> {
|
||||
|
||||
List<DictionaryView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.JiedanEntity;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.entity.view.JiedanView;
|
||||
|
||||
/**
|
||||
* 快递接单表 Dao 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2021-03-11
|
||||
*/
|
||||
public interface JiedanDao extends BaseMapper<JiedanEntity> {
|
||||
|
||||
List<JiedanView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
|
||||
package com.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
import com.entity.TokenEntity;
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
public interface TokenDao extends BaseMapper<TokenEntity> {
|
||||
|
||||
List<TokenEntity> selectListView(@Param("ew") Wrapper<TokenEntity> wrapper);
|
||||
|
||||
List<TokenEntity> selectListView(Pagination page, @Param("ew") Wrapper<TokenEntity> wrapper);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
|
||||
package com.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
import com.entity.UserEntity;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
public interface UserDao extends BaseMapper<UserEntity> {
|
||||
|
||||
List<UserEntity> selectListView(@Param("ew") Wrapper<UserEntity> wrapper);
|
||||
|
||||
List<UserEntity> selectListView(Pagination page, @Param("ew") Wrapper<UserEntity> wrapper);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.YijiedanEntity;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.entity.view.YijiedanView;
|
||||
|
||||
/**
|
||||
* 已接单表 Dao 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2021-03-11
|
||||
*/
|
||||
public interface YijiedanDao extends BaseMapper<YijiedanEntity> {
|
||||
|
||||
List<YijiedanView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.YonghuEntity;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.entity.view.YonghuView;
|
||||
|
||||
/**
|
||||
* Dao 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2021-03-11
|
||||
*/
|
||||
public interface YonghuDao extends BaseMapper<YonghuEntity> {
|
||||
|
||||
List<YonghuView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.ZhandianEntity;
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.entity.view.ZhandianView;
|
||||
|
||||
/**
|
||||
* 快递站点 Dao 接口
|
||||
*
|
||||
* @author
|
||||
* @since 2021-03-11
|
||||
*/
|
||||
public interface ZhandianDao extends BaseMapper<ZhandianEntity> {
|
||||
|
||||
List<ZhandianView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
Loading…
Reference in new issue