邝工测试,推广宽图修改

This commit is contained in:
liuyingfang 2023-07-31 09:56:13 +08:00
parent a938dc5e5f
commit ef5cb98648
8 changed files with 159 additions and 38 deletions

View File

@ -44,6 +44,11 @@
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
<dependency>

View File

@ -1,13 +1,18 @@
package com.chaozhanggui.admin.system.controller;
import com.chaozhanggui.admin.system.service.PromotionImageService;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.entity.TbPlussAppGuide;
import com.dianguang.cloud.ossservice.config.CloudStorageConfig;
import com.dianguang.cloud.ossservice.service.OSSFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@ -19,14 +24,57 @@ import java.util.Random;
*/
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("user")
@RequestMapping("/promotion")
@Slf4j
public class PromotionImageController {
@Resource
private PromotionImageService promotionImageService;
@Autowired
CloudStorageConfig config;
/**
* 列表
* @param pageNum
* @param pageSize
* @return
*/
@GetMapping("/promotionImageList")
public RespBody promotionImageList(@RequestParam Integer pageNum,@RequestParam Integer pageSize){
return promotionImageService.getPromotionImage(pageNum,pageSize);
}
// public RespBody getPromotionImage(){
//
// }
/**
*
* @param appGuide
* @return
*/
@PostMapping ("/updateById")
public RespBody updateByPrimaryKey(@RequestBody TbPlussAppGuide appGuide){
return promotionImageService.updateByPrimaryKey(appGuide);
}
/**
* 增加
* @param appGuide
* @return
*/
@PostMapping("/insert")
public RespBody insert(@RequestBody TbPlussAppGuide appGuide){
return promotionImageService.insert(appGuide);
}
@PostMapping("/OSSUpdate")
public RespBody OSSUpdate(@RequestBody MultipartFile file){
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
try {
Object url = OSSFactory.build(config).uploadSuffix(file.getBytes(), extension);
return new RespBody("000000",url);
} catch (Exception e) {
e.printStackTrace();
}
return new RespBody("999994");
}
@PostMapping("/testRequest")
public RespBody testRequest(){

View File

@ -22,6 +22,6 @@ public class AdminWebConfig implements WebMvcConfigurer {
registry.addInterceptor(new LoginInterceptor(redisUtil))
.addPathPatterns()
// 如果有静态资源的时候可以在这个地方放行
.excludePathPatterns("/","/user/doLogin","/agency/mytest","/agency/queryAgency","/user/testRequest");
.excludePathPatterns("/","/user/doLogin","/agency/mytest","/agency/queryAgency","/promotion/testRequest");
}
}

View File

@ -1,13 +1,54 @@
package com.chaozhanggui.admin.system.service;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.dao.TbPlussAppGuideMapper;
import com.chaozhanggui.dao.system.entity.TbPlussAppGuide;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* @author lyf
*/
@Service
@Slf4j
public class PromotionImageService {
@Resource
private TbPlussAppGuideMapper appGuideMapper;
public RespBody getPromotionImage(Integer pageNum, Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
List<TbPlussAppGuide> appGuides = appGuideMapper.selectGuideList();
PageInfo pageInfo=new PageInfo(appGuides);
return new RespBody("000000",pageInfo);
}
// public RespBody getPromotionImage(){
//
// }
public RespBody updateByPrimaryKey(TbPlussAppGuide appGuide){
appGuide.setUpdateTime(new Date());
int i = appGuideMapper.updateByPrimaryKeySelective(appGuide);
if (i>0) {
return new RespBody("000000");
}
log.error("修改错误");
return new RespBody("000051");
}
public RespBody insert(TbPlussAppGuide appGuide){
appGuide.setType("1");
appGuide.setCreatetime(new Date());
appGuide.setUpdateTime(new Date());
appGuide.setAndroid("0");
appGuide.setIos("0");
int i = appGuideMapper.insert(appGuide);
if (i>0) {
return new RespBody("000000");
}
log.error("修改错误");
return new RespBody("000051");
}
}

View File

@ -70,6 +70,7 @@ public class ExceptionUtil {
map.put("000048","不存在的订单号");
map.put("000049","用户没有创建活动的权限");
map.put("000050","用户权限不足");
map.put("000051","修改错误");
@ -80,13 +81,13 @@ public class ExceptionUtil {
map.put("999997","获取信息异常");
map.put("999996","退出异常");
map.put("999995","提现审核异常");
map.put("999994","上传失败");
map.put("999994","开通钱包异常");
map.put("999993","创建群异常");
map.put("999992","发送红包异常");
map.put("999991","领取红包异常");

View File

@ -3,7 +3,11 @@ package com.chaozhanggui.dao.system.dao;
import com.chaozhanggui.dao.system.entity.TbPlussAppGuide;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Component
@Mapper
@ -16,6 +20,8 @@ public interface TbPlussAppGuideMapper {
TbPlussAppGuide selectByPrimaryKey(Integer id);
List<TbPlussAppGuide> selectGuideList();
int updateByPrimaryKeySelective(TbPlussAppGuide record);
int updateByPrimaryKeyWithBLOBs(TbPlussAppGuide record);

View File

@ -12,11 +12,15 @@ public class TbPlussAppGuide implements Serializable {
private Date createtime;
private Date updatetime;
private Date updateTime;
/**
* 1为开启0关闭
*/
private String type;
private String content;
private String android;
private String ios;
private static final long serialVersionUID = 1L;
@ -52,12 +56,12 @@ public class TbPlussAppGuide implements Serializable {
this.createtime = createtime;
}
public Date getUpdatetime() {
return updatetime;
public Date getUpdateTime() {
return updateTime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getType() {
@ -75,4 +79,20 @@ public class TbPlussAppGuide implements Serializable {
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
public String getAndroid() {
return android;
}
public void setAndroid(String android) {
this.android = android;
}
public String getIos() {
return ios;
}
public void setIos(String ios) {
this.ios = ios;
}
}

View File

@ -26,17 +26,22 @@
from tb_pluss_app_guide
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectGuideList" resultType="com.chaozhanggui.dao.system.entity.TbPlussAppGuide">
SELECT *
FROM tb_pluss_app_guide
WHERE type IS NOT NULL
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_pluss_app_guide
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussAppGuide">
insert into tb_pluss_app_guide (id, code, name,
insert into tb_pluss_app_guide (code, name,
createTime, updateTime, type,
content)
values (#{id,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR})
content,android,ios)
values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{createtime,jdbcType=TIMESTAMP}, #{updateTime}, #{type,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR},#{android},#{ios})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussAppGuide">
insert into tb_pluss_app_guide
@ -90,23 +95,18 @@
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussAppGuide">
update tb_pluss_app_guide
<set>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
updateTime = #{updateTime,jdbcType=TIMESTAMP},
<if test="type != null and type != ''">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
<if test="content != null and content != ''">
content = #{content,jdbcType=LONGVARCHAR},
</if>
<if test="createtime != null">
createTime = #{createtime,jdbcType=TIMESTAMP},
<if test="android != null and android != ''">
android = #{android},
</if>
<if test="updatetime != null">
updateTime = #{updatetime,jdbcType=TIMESTAMP},
</if>
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
<if test="ios != null and android != ''">
ios = #{ios},
</if>
</set>
where id = #{id,jdbcType=INTEGER}