first commit
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
package com.sqx.modules.common.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "通用配置管理", tags = {"通用配置管理"})
|
||||
@RequestMapping(value = "/common")
|
||||
public class CommonController {
|
||||
@Autowired
|
||||
private CommonInfoService commonService;
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台通用配置详情")
|
||||
@ResponseBody
|
||||
public Result getCommon(@PathVariable Integer id) {
|
||||
return Result.success().put("data",commonService.findOne(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台添加通用配置")
|
||||
@ResponseBody
|
||||
public Result addCommon(@RequestBody CommonInfo app) {
|
||||
|
||||
return commonService.update(app);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台删除通用配置")
|
||||
public Result deleteCommon(@PathVariable int id) {
|
||||
return commonService.delete(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/type/{type}", method = RequestMethod.GET)
|
||||
@ApiOperation("用户端根据type获取对象 1客服二维码\n" +
|
||||
" 2公众号二维码\n" +
|
||||
" 3佣金开启\n" +
|
||||
" 4注册邀请码\n" +
|
||||
" 5微信APPID\n" +
|
||||
" 21微信秘钥\n" +
|
||||
" 6淘宝APPID\n" +
|
||||
" 7淘宝秘钥\n" +
|
||||
" 8淘宝授权地址\n" +
|
||||
" 9淘宝PID\n" +
|
||||
" 10好单库key\n" +
|
||||
" 11淘宝名\n" +
|
||||
" 12后台服务名称\n" +
|
||||
" 13京东APPID\n" +
|
||||
" 14京东秘钥\n" +
|
||||
" 15私域邀请码(唯一不变)\n" +
|
||||
" 16公众号Token\n" +
|
||||
" 17公众号EncodingAESKey\n" +
|
||||
" 18提现通知管理员openid\n" +
|
||||
" 19后台服务域名配置\n" +
|
||||
" 20后台管理平台域名配置\n" +
|
||||
" 22拼多多优惠券地址")
|
||||
@ResponseBody
|
||||
public Result getCommonList(@PathVariable Integer type) {
|
||||
return commonService.findByType(type);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/type/condition/{condition}", method = RequestMethod.GET)
|
||||
@ApiOperation("根据condition去查询 xitong xitongs shouye")
|
||||
@ResponseBody
|
||||
public Result findByTypeAndCondition(@PathVariable String condition) {
|
||||
return commonService.findByTypeAndCondition(condition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.sqx.modules.common.controller.app;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@Api(value = "通用配置管理", tags = {"通用配置管理"})
|
||||
@RequestMapping(value = "/app/common")
|
||||
public class AppCommonController {
|
||||
@Autowired
|
||||
private CommonInfoService commonService;
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ApiOperation("管理平台通用配置详情")
|
||||
@ResponseBody
|
||||
public Result getCommon(@PathVariable Integer id) {
|
||||
return Result.success().put("data",commonService.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/type/{type}", method = RequestMethod.GET)
|
||||
@ApiOperation("用户端根据type获取对象 1客服二维码\n" +
|
||||
" 2公众号二维码\n" +
|
||||
" 3佣金开启\n" +
|
||||
" 4注册邀请码\n" +
|
||||
" 5微信APPID\n" +
|
||||
" 21微信秘钥\n" +
|
||||
" 6淘宝APPID\n" +
|
||||
" 7淘宝秘钥\n" +
|
||||
" 8淘宝授权地址\n" +
|
||||
" 9淘宝PID\n" +
|
||||
" 10好单库key\n" +
|
||||
" 11淘宝名\n" +
|
||||
" 12后台服务名称\n" +
|
||||
" 13京东APPID\n" +
|
||||
" 14京东秘钥\n" +
|
||||
" 15私域邀请码(唯一不变)\n" +
|
||||
" 16公众号Token\n" +
|
||||
" 17公众号EncodingAESKey\n" +
|
||||
" 18提现通知管理员openid\n" +
|
||||
" 19后台服务域名配置\n" +
|
||||
" 20后台管理平台域名配置\n" +
|
||||
" 22拼多多优惠券地址")
|
||||
@ResponseBody
|
||||
public Result getCommonList(@PathVariable Integer type) {
|
||||
return commonService.findByType(type);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/type/condition/{condition}", method = RequestMethod.GET)
|
||||
@ApiOperation("根据condition去查询 xitong xitongs shouye")
|
||||
@ResponseBody
|
||||
public Result findByTypeAndCondition(@PathVariable String condition) {
|
||||
return commonService.findByTypeAndCondition(condition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
24
src/main/java/com/sqx/modules/common/dao/CommonInfoDao.java
Normal file
24
src/main/java/com/sqx/modules/common/dao/CommonInfoDao.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.sqx.modules.common.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/8
|
||||
*/
|
||||
@Mapper
|
||||
public interface CommonInfoDao extends BaseMapper<CommonInfo> {
|
||||
|
||||
List<CommonInfo> findByCondition(@Param("condition") String condition);
|
||||
|
||||
CommonInfo findOne(@Param("type") int type);
|
||||
|
||||
|
||||
|
||||
}
|
||||
33
src/main/java/com/sqx/modules/common/entity/CommonInfo.java
Normal file
33
src/main/java/com/sqx/modules/common/entity/CommonInfo.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.sqx.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 通用配置管理
|
||||
*/
|
||||
@Data
|
||||
@TableName("common_info")
|
||||
public class CommonInfo implements Serializable {
|
||||
|
||||
@TableId(type = IdType.INPUT)
|
||||
private long id;
|
||||
|
||||
private String createAt;
|
||||
|
||||
private Integer type; //1表示客服二维码 2表示公众号二维码 3表示全局佣金是否开启 4注册客服渠道id配置 5、佣金规则 6、
|
||||
|
||||
private String value;
|
||||
|
||||
private String max;
|
||||
|
||||
private String min;
|
||||
|
||||
private String conditionFrom;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.sqx.modules.common.service;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/8
|
||||
*/
|
||||
public interface CommonInfoService {
|
||||
|
||||
/**
|
||||
* 保存对象
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
Result update(CommonInfo commonInfo);
|
||||
|
||||
/**
|
||||
* 获取一个对象
|
||||
*/
|
||||
CommonInfo findOne(int id);
|
||||
|
||||
/**
|
||||
* 删除一个
|
||||
*/
|
||||
Result delete(long id);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
Result updateBody(CommonInfo commonInfo);
|
||||
/**
|
||||
* 通过类型查询
|
||||
*/
|
||||
Result findByType(Integer type);
|
||||
|
||||
/**
|
||||
* 通过类型查询
|
||||
*/
|
||||
Result findByTypeAndCondition(String condition);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.sqx.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.common.dao.CommonInfoDao;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.course.service.CourseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author fang
|
||||
* @date 2020/7/8
|
||||
*/
|
||||
@Service
|
||||
public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo> implements CommonInfoService {
|
||||
|
||||
@Autowired
|
||||
private CommonInfoDao commonInfoDao;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Result update(CommonInfo commonInfo) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date now = new Date();
|
||||
commonInfo.setCreateAt(sdf.format(now));
|
||||
if(commonInfo.getType()==820){
|
||||
Result result = courseService.setDyNotifyUrl(commonInfo.getValue());
|
||||
String code = String.valueOf(result.get("code"));
|
||||
if(!"0".equals(code)){
|
||||
return result;
|
||||
}
|
||||
}
|
||||
commonInfoDao.updateById(commonInfo);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CommonInfo findOne(int id) {
|
||||
return commonInfoDao.findOne(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result delete(long id) {
|
||||
commonInfoDao.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result updateBody(CommonInfo commonInfo) {
|
||||
commonInfoDao.updateById(commonInfo);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findByType(Integer type) {
|
||||
return Result.success().put("data",commonInfoDao.findOne(type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findByTypeAndCondition(String condition) {
|
||||
return Result.success().put("data",commonInfoDao.findByCondition(condition));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user