diff --git a/src/main/java/com/sincere/wechatbusiness/WechatBusinessApplication.java b/src/main/java/com/sincere/wechatbusiness/WechatBusinessApplication.java index 203e790..c38e5ce 100644 --- a/src/main/java/com/sincere/wechatbusiness/WechatBusinessApplication.java +++ b/src/main/java/com/sincere/wechatbusiness/WechatBusinessApplication.java @@ -7,7 +7,7 @@ import org.springframework.cache.annotation.EnableCaching; @EnableCaching @SpringBootApplication -@MapperScan("com.sincere.report.mapper") +@MapperScan("com.sincere.wechatbusiness.mapper") public class WechatBusinessApplication { public static void main(String[] args) { diff --git a/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java b/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java new file mode 100644 index 0000000..ef8135c --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java @@ -0,0 +1,263 @@ +package com.sincere.wechatbusiness.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.sincere.wechatbusiness.dto.BaseDto; +import com.sincere.wechatbusiness.dto.ChannelDto; +import com.sincere.wechatbusiness.model.*; +import com.sincere.wechatbusiness.service.*; +import com.sincere.wechatbusiness.utils.Page; +import io.swagger.annotations.ApiOperation; +import org.bouncycastle.jcajce.provider.symmetric.util.BaseWrapCipher; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.util.List; +import java.util.Map; + +@RestController +public class ChannelController { + @Autowired + ChannelService channelService; + + @Autowired + ChannelProductService channelProductService; + + @Autowired + BannerService bannerService; + + @Autowired + AttentionService attentionService; + + @Autowired + CatalogService catalogService; + + @Autowired + CatalogContentService catalogContentService; + + @RequestMapping(value = "GetChannelList",method = RequestMethod.POST) + @ApiOperation(value = "获取渠道商列表") + public BaseDto> GetChannelList(@RequestBody ChannelDto channelDto){ + BaseDto> result=new BaseDto<>(); + Channel channel=new Channel(); + channel.setName(channelDto.getName()); + channel.setState(1); + result.setData(channelService.getList(channel,channelDto.getPage(),channelDto.getPageSize())); + return result; + } + + @RequestMapping(value = "GetPackageList",method = RequestMethod.POST) + @ApiOperation(value = "获取代理商品列表") + public BaseDto> GetPackageList(){ + BaseDto> result=new BaseDto<>(); + String r=Get("https://mytest.myjxt.com:51314/University/getPackageList",""); + JSONObject jsonObject= JSONObject.parseObject(r); + String data = jsonObject.getString("data"); + List list=JSON.parseObject(data,new TypeReference>(){}); + result.setData(list); + return result; + } + + @RequestMapping(value = "AddChannel",method = RequestMethod.POST) + @ApiOperation(value = "新增渠道商") + public BaseDto AddChannel(@RequestBody Channel channel){ + channelService.insert(channel); + if(channel.getChannelProductList()!=null&&channel.getChannelProductList().size()>0) { + for(ChannelProduct channelProduct:channel.getChannelProductList()){ + channelProduct.setChannelId(channel.getId()); + channelProductService.insert(channelProduct); + } + } + return new BaseDto(); + } + + @RequestMapping(value = "GetChannelDetail",method = RequestMethod.GET) + @ApiOperation(value = "获取渠道商详情") + public BaseDto GetChannelDetail(int id){ + BaseDto result=new BaseDto<>(); + Channel channel=channelService.getDetail(id); + channel.setChannelProductList(channelProductService.getList(id)); + result.setData(channel); + return result; + } + + @RequestMapping(value = "UpdateChannel",method = RequestMethod.POST) + @ApiOperation(value = "编辑渠道商") + public BaseDto UpdateChannel(@RequestBody Channel channel){ + channelService.update(channel); + if(channel.getChannelProductList()!=null&&channel.getChannelProductList().size()>0){ + channelProductService.deleteChannelProduct(channel.getId()); + for (ChannelProduct channelProduct:channel.getChannelProductList()){ + channelProduct.setChannelId(channel.getId()); + channelProductService.insert(channelProduct); + } + } + return new BaseDto(); + } + + @RequestMapping(value = "DeleteChannel",method = RequestMethod.GET) + @ApiOperation(value = "删除渠道商") + public BaseDto DeleteChannel(int id){ + channelService.deleteChannel(id); + return new BaseDto(); + } + + @RequestMapping(value = "UpdateChannelProduct",method = RequestMethod.POST) + @ApiOperation(value = "编辑代理商品") + public BaseDto UpdateChannelProduct(@RequestBody ChannelProduct channelProduct){ + channelProductService.update(channelProduct); + return new BaseDto(); + } + + @RequestMapping(value = "GetBannerList",method = RequestMethod.GET) + @ApiOperation(value = "获取Banner轮播图列表") + public BaseDto> GetBannerList(int id){ + BaseDto> result=new BaseDto<>(); + result.setData(bannerService.getList(id)); + return result; + } + + @RequestMapping(value = "AddBanner",method = RequestMethod.POST) + @ApiOperation(value = "添加Banner轮播图") + public BaseDto AddBanner(@RequestBody Banner banner){ + bannerService.insert(banner); + return new BaseDto(); + } + + @RequestMapping(value = "UpdateBanner",method = RequestMethod.POST) + @ApiOperation(value = "编辑Banner轮播图") + public BaseDto UpdateBanner(@RequestBody Banner banner){ + bannerService.update(banner); + return new BaseDto(); + } + + @RequestMapping(value = "DeleteBanner",method = RequestMethod.GET) + @ApiOperation(value = "删除Banner轮播图") + public BaseDto DeleteBanner(int id){ + bannerService.deleteBanner(id); + return new BaseDto(); + } + + @RequestMapping(value = "GetAttention",method = RequestMethod.GET) + @ApiOperation(value = "获取关注配置") + public BaseDto GetAttention(int id){ + BaseDto result=new BaseDto<>(); + result.setData(attentionService.getDetail(id)); + return result; + } + + @RequestMapping(value = "AddAttention",method = RequestMethod.POST) + @ApiOperation(value = "添加关注配置") + public BaseDto AddAttention(@RequestBody Attention attention){ + attentionService.insert(attention); + return new BaseDto(); + } + + @RequestMapping(value = "UpdateAttention",method = RequestMethod.POST) + @ApiOperation(value = "编辑关注配置") + public BaseDto UpdateAttention(@RequestBody Attention attention){ + attentionService.update(attention); + return new BaseDto(); + } + + @RequestMapping(value = "GetCatalog",method = RequestMethod.GET) + @ApiOperation(value = "获取栏目") + public BaseDto GetCatalog(int channelId,int sort){ + BaseDto result=new BaseDto<>(); + Catalog catalog=new Catalog(); + catalog.setChannelId(channelId); + catalog.setSort(sort); + catalog=catalogService.getDetail(catalog); + catalog.setCatalogContentList(catalogContentService.getList(catalog.getId())); + result.setData(catalog); + return result; + } + + @RequestMapping(value = "AddCatalog",method = RequestMethod.POST) + @ApiOperation(value = "新增栏目") + public BaseDto AddCatalog(@RequestBody Catalog catalog){ + catalogService.insert(catalog); + return new BaseDto(); + } + + @RequestMapping(value = "UpdateCatalog",method = RequestMethod.POST) + @ApiOperation(value = "编辑栏目") + public BaseDto UpdateCatalog(@RequestBody Catalog catalog){ + catalogService.update(catalog); + return new BaseDto(); + } + + @RequestMapping(value = "AddCatalogContent",method = RequestMethod.POST) + @ApiOperation(value = "新增栏目内容") + public BaseDto AddCatalogContent(@RequestBody CatalogContent catalogContent){ + catalogContentService.insert(catalogContent); + return new BaseDto(); + } + + @RequestMapping(value = "UpdateCatalogContent",method = RequestMethod.POST) + @ApiOperation(value = "编辑栏目内容") + public BaseDto UpdateCatalogContent(@RequestBody CatalogContent catalogContent){ + catalogContentService.update(catalogContent); + return new BaseDto(); + } + + @RequestMapping(value = "DeleteCatalogContent",method = RequestMethod.GET) + @ApiOperation(value = "删除栏目内容") + public BaseDto DeleteCatalogContent(int id){ + catalogContentService.deleteCatalogContent(id); + return new BaseDto(); + } + + public String Get(String url, String param) { + String result = ""; + BufferedReader in = null; + try { + String urlNameString = url + "?" + param; + URL realUrl = new URL(urlNameString); + // 打开和URL之间的连接 + URLConnection connection = realUrl.openConnection(); + // 设置通用的请求属性 + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + // 建立实际的连接 + connection.connect(); + // 获取所有响应头字段 + Map> map = connection.getHeaderFields(); + // 遍历所有的响应头字段 + for (String key : map.keySet()) { + System.out.println(key + "--->" + map.get(key)); + } + // 定义 BufferedReader输入流来读取URL的响应 + in = new BufferedReader(new InputStreamReader( + connection.getInputStream())); + String line; + while ((line = in.readLine()) != null) { + result += line; + } + } catch (Exception e) { + System.out.println("发送GET请求出现异常!" + e); + e.printStackTrace(); + } + // 使用finally块来关闭输入流 + finally { + try { + if (in != null) { + in.close(); + } + } catch (Exception e2) { + e2.printStackTrace(); + } + } + return result; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/dto/BaseDto.java b/src/main/java/com/sincere/wechatbusiness/dto/BaseDto.java new file mode 100644 index 0000000..643178d --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/dto/BaseDto.java @@ -0,0 +1,43 @@ +package com.sincere.wechatbusiness.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel +public class BaseDto { + + @ApiModelProperty(value = "接口成功与否") + private boolean success ; + @ApiModelProperty(value = "错误信息") + private String message ; + @ApiModelProperty(value = "数据") + private T data ; + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + public BaseDto() { + this.success = true ; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/dto/ChannelDto.java b/src/main/java/com/sincere/wechatbusiness/dto/ChannelDto.java new file mode 100644 index 0000000..ed8d49c --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/dto/ChannelDto.java @@ -0,0 +1,33 @@ +package com.sincere.wechatbusiness.dto; + +public class ChannelDto { + private String name; + + private Integer page; + + private Integer pageSize; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/AttentionMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/AttentionMapper.java new file mode 100644 index 0000000..b942a53 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/mapper/AttentionMapper.java @@ -0,0 +1,11 @@ +package com.sincere.wechatbusiness.mapper; + +import com.sincere.wechatbusiness.model.Attention; + +public interface AttentionMapper { + Attention getDetail(int id); + + int insert(Attention attention); + + int update(Attention attention); +} diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/BannerMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/BannerMapper.java new file mode 100644 index 0000000..741e29c --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/mapper/BannerMapper.java @@ -0,0 +1,15 @@ +package com.sincere.wechatbusiness.mapper; + +import com.sincere.wechatbusiness.model.Banner; + +import java.util.List; + +public interface BannerMapper { + List getList(int id); + + int insert(Banner banner); + + int update(Banner banner); + + int deleteBanner(int id); +} diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/CatalogContentMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/CatalogContentMapper.java new file mode 100644 index 0000000..e613439 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/mapper/CatalogContentMapper.java @@ -0,0 +1,15 @@ +package com.sincere.wechatbusiness.mapper; + +import com.sincere.wechatbusiness.model.CatalogContent; + +import java.util.List; + +public interface CatalogContentMapper { + List getList(int id); + + int insert(CatalogContent catalogContent); + + int update(CatalogContent catalogContent); + + int deleteCatalogContent(int id); +} diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/CatalogMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/CatalogMapper.java new file mode 100644 index 0000000..096c4c2 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/mapper/CatalogMapper.java @@ -0,0 +1,11 @@ +package com.sincere.wechatbusiness.mapper; + +import com.sincere.wechatbusiness.model.Catalog; + +public interface CatalogMapper { + Catalog getDetail(Catalog catalog); + + int insert(Catalog catalog); + + int update(Catalog catalog); +} diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java new file mode 100644 index 0000000..3d4c54e --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java @@ -0,0 +1,19 @@ +package com.sincere.wechatbusiness.mapper; + +import com.sincere.wechatbusiness.model.Channel; + +import java.util.List; + +public interface ChannelMapper { + List getList(Channel channel); + + int getListCount(Channel channel); + + Channel getDetail(int id); + + int insert(Channel channel); + + int update(Channel channel); + + int deleteChannel(int id); +} diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java new file mode 100644 index 0000000..71e27be --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java @@ -0,0 +1,15 @@ +package com.sincere.wechatbusiness.mapper; + +import com.sincere.wechatbusiness.model.ChannelProduct; + +import java.util.List; + +public interface ChannelProductMapper { + List getList(int id); + + int insert(ChannelProduct channelProduct); + + int update(ChannelProduct channelProduct); + + int deleteChannelProduct(int id); +} diff --git a/src/main/java/com/sincere/wechatbusiness/model/Attention.java b/src/main/java/com/sincere/wechatbusiness/model/Attention.java new file mode 100644 index 0000000..af02862 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/model/Attention.java @@ -0,0 +1,92 @@ +package com.sincere.wechatbusiness.model; + +import io.swagger.annotations.ApiModelProperty; + +import java.util.Date; + +public class Attention { + private Integer id; + + @ApiModelProperty(value = "渠道商id") + private Integer channelId; + + @ApiModelProperty(value = "关注logo") + private String logo; + + @ApiModelProperty(value = "公众号或小程序名称") + private String name; + + @ApiModelProperty(value = "关注说明内容") + private String content; + + @ApiModelProperty(value = "关注图片") + private String imgUrl; + + private Integer state; + + private Date createTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getChannelId() { + return channelId; + } + + public void setChannelId(Integer channelId) { + this.channelId = channelId; + } + + public String getLogo() { + return logo; + } + + public void setLogo(String logo) { + this.logo = logo; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/model/Banner.java b/src/main/java/com/sincere/wechatbusiness/model/Banner.java new file mode 100644 index 0000000..ce86f01 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/model/Banner.java @@ -0,0 +1,65 @@ +package com.sincere.wechatbusiness.model; + +import java.util.Date; + +public class Banner { + private Integer id; + + private Integer channelId; + + private String imgUrl; + + private String linkUrl; + + private Integer state; + + private Date createTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getChannelId() { + return channelId; + } + + public void setChannelId(Integer channelId) { + this.channelId = channelId; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + public String getLinkUrl() { + return linkUrl; + } + + public void setLinkUrl(String linkUrl) { + this.linkUrl = linkUrl; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/model/Catalog.java b/src/main/java/com/sincere/wechatbusiness/model/Catalog.java new file mode 100644 index 0000000..07a4456 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/model/Catalog.java @@ -0,0 +1,79 @@ +package com.sincere.wechatbusiness.model; + +import io.swagger.annotations.ApiModelProperty; + +import java.util.Date; +import java.util.List; + +public class Catalog { + private Integer id; + + private Integer channelId; + + @ApiModelProperty(value = "栏目名称") + private String name; + + private Integer sort; + + private Integer state; + + private Date createTime; + + private List catalogContentList; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getChannelId() { + return channelId; + } + + public void setChannelId(Integer channelId) { + this.channelId = channelId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public List getCatalogContentList() { + return catalogContentList; + } + + public void setCatalogContentList(List catalogContentList) { + this.catalogContentList = catalogContentList; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/model/CatalogContent.java b/src/main/java/com/sincere/wechatbusiness/model/CatalogContent.java new file mode 100644 index 0000000..78074e9 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/model/CatalogContent.java @@ -0,0 +1,109 @@ +package com.sincere.wechatbusiness.model; + +import io.swagger.annotations.ApiModelProperty; + +import java.util.Date; + +public class CatalogContent { + private Integer id; + + private Integer catalogId; + + @ApiModelProperty(value = "主标题") + private String title; + + @ApiModelProperty(value = "副标题") + private String subtitle; + + private String startTime; + + private String endTime; + + private String imgUrl; + + private String linkUrl; + + private Integer state; + + private Date createTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCatalogId() { + return catalogId; + } + + public void setCatalogId(Integer catalogId) { + this.catalogId = catalogId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getSubtitle() { + return subtitle; + } + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + public String getLinkUrl() { + return linkUrl; + } + + public void setLinkUrl(String linkUrl) { + this.linkUrl = linkUrl; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/model/Channel.java b/src/main/java/com/sincere/wechatbusiness/model/Channel.java new file mode 100644 index 0000000..d2a3aa1 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/model/Channel.java @@ -0,0 +1,136 @@ +package com.sincere.wechatbusiness.model; + +import java.util.Date; +import java.util.List; + +public class Channel { + private Integer id; + + private String name; + + private String mobile; + + private String province; + + private String city; + + private Integer templateId; + + private Integer state; + + private Date createTime; + + private Integer productCount; + + private String templateName; + + private String provinceCode; + + private String cityCode; + + private List channelProductList; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Integer getTemplateId() { + return templateId; + } + + public void setTemplateId(Integer templateId) { + this.templateId = templateId; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Integer getProductCount() { + return productCount; + } + + public void setProductCount(Integer productCount) { + this.productCount = productCount; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getProvinceCode() { + return provinceCode; + } + + public void setProvinceCode(String provinceCode) { + this.provinceCode = provinceCode; + } + + public String getCityCode() { + return cityCode; + } + + public void setCityCode(String cityCode) { + this.cityCode = cityCode; + } + + public List getChannelProductList() { + return channelProductList; + } + + public void setChannelProductList(List channelProductList) { + this.channelProductList = channelProductList; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java b/src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java new file mode 100644 index 0000000..b956f6d --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java @@ -0,0 +1,85 @@ +package com.sincere.wechatbusiness.model; + +import java.util.Date; + +public class ChannelProduct { + private Integer id; + + private Integer channelId; + + private String productName; + + private String price; + + private String ChannelPrice; + + private String caption; + + private Integer state; + + private Date createTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getChannelId() { + return channelId; + } + + public void setChannelId(Integer channelId) { + this.channelId = channelId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + + public String getChannelPrice() { + return ChannelPrice; + } + + public void setChannelPrice(String channelPrice) { + ChannelPrice = channelPrice; + } + + public String getCaption() { + return caption; + } + + public void setCaption(String caption) { + this.caption = caption; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/model/DiscountPackage.java b/src/main/java/com/sincere/wechatbusiness/model/DiscountPackage.java new file mode 100644 index 0000000..b78f1e6 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/model/DiscountPackage.java @@ -0,0 +1,88 @@ +package com.sincere.wechatbusiness.model; + +import java.util.Date; + +public class DiscountPackage { + private Integer id; + private String package_name; + private String describe; + private String photo; + private String package_ids; + private String price; + private String require; + private Date create_time; + + private String isSelect; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getPackage_name() { + return package_name; + } + + public void setPackage_name(String package_name) { + this.package_name = package_name; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getPhoto() { + return photo; + } + + public void setPhoto(String photo) { + this.photo = photo; + } + + public String getPackage_ids() { + return package_ids; + } + + public void setPackage_ids(String package_ids) { + this.package_ids = package_ids; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + + public String getRequire() { + return require; + } + + public void setRequire(String require) { + this.require = require; + } + + public Date getCreate_time() { + return create_time; + } + + public void setCreate_time(Date create_time) { + this.create_time = create_time; + } + + public String getIsSelect() { + return isSelect; + } + + public void setIsSelect(String isSelect) { + this.isSelect = isSelect; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/model/Template.java b/src/main/java/com/sincere/wechatbusiness/model/Template.java new file mode 100644 index 0000000..e0e0b1d --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/model/Template.java @@ -0,0 +1,55 @@ +package com.sincere.wechatbusiness.model; + +import java.util.Date; + +public class Template { + private Integer id; + + private String title; + + private String imgUrl; + + private Integer state; + + private Date createTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/AttentionService.java b/src/main/java/com/sincere/wechatbusiness/service/AttentionService.java new file mode 100644 index 0000000..651b55b --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/AttentionService.java @@ -0,0 +1,11 @@ +package com.sincere.wechatbusiness.service; + +import com.sincere.wechatbusiness.model.Attention; + +public interface AttentionService { + Attention getDetail(int id); + + int insert(Attention attention); + + int update(Attention attention); +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/BannerService.java b/src/main/java/com/sincere/wechatbusiness/service/BannerService.java new file mode 100644 index 0000000..9679ea8 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/BannerService.java @@ -0,0 +1,15 @@ +package com.sincere.wechatbusiness.service; + +import com.sincere.wechatbusiness.model.Banner; + +import java.util.List; + +public interface BannerService { + List getList(int id); + + int insert(Banner banner); + + int update(Banner banner); + + int deleteBanner(int id); +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/CatalogContentService.java b/src/main/java/com/sincere/wechatbusiness/service/CatalogContentService.java new file mode 100644 index 0000000..464eadc --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/CatalogContentService.java @@ -0,0 +1,15 @@ +package com.sincere.wechatbusiness.service; + +import com.sincere.wechatbusiness.model.CatalogContent; + +import java.util.List; + +public interface CatalogContentService { + List getList(int id); + + int insert(CatalogContent catalogContent); + + int update(CatalogContent catalogContent); + + int deleteCatalogContent(int id); +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/CatalogService.java b/src/main/java/com/sincere/wechatbusiness/service/CatalogService.java new file mode 100644 index 0000000..5788d7c --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/CatalogService.java @@ -0,0 +1,11 @@ +package com.sincere.wechatbusiness.service; + +import com.sincere.wechatbusiness.model.Catalog; + +public interface CatalogService { + Catalog getDetail(Catalog catalog); + + int insert(Catalog catalog); + + int update(Catalog catalog); +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java b/src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java new file mode 100644 index 0000000..c89bbfb --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java @@ -0,0 +1,15 @@ +package com.sincere.wechatbusiness.service; + +import com.sincere.wechatbusiness.model.ChannelProduct; + +import java.util.List; + +public interface ChannelProductService { + List getList(int id); + + int insert(ChannelProduct channelProduct); + + int update(ChannelProduct channelProduct); + + int deleteChannelProduct(int id); +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java b/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java new file mode 100644 index 0000000..6dd7428 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java @@ -0,0 +1,16 @@ +package com.sincere.wechatbusiness.service; + +import com.sincere.wechatbusiness.model.Channel; +import com.sincere.wechatbusiness.utils.Page; + +public interface ChannelService { + Page getList(Channel channel, int page, int pageSize); + + Channel getDetail(int id); + + int insert(Channel channel); + + int update(Channel channel); + + int deleteChannel(int id); +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/AttentionServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/AttentionServiceImpl.java new file mode 100644 index 0000000..f156d45 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/impl/AttentionServiceImpl.java @@ -0,0 +1,22 @@ +package com.sincere.wechatbusiness.service.impl; + +import com.sincere.wechatbusiness.mapper.AttentionMapper; +import com.sincere.wechatbusiness.model.Attention; +import com.sincere.wechatbusiness.service.AttentionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class AttentionServiceImpl implements AttentionService { + @Autowired + AttentionMapper attentionMapper; + + @Override + public Attention getDetail(int id){return attentionMapper.getDetail(id);} + + @Override + public int insert(Attention attention){return attentionMapper.insert(attention);} + + @Override + public int update(Attention attention){return attentionMapper.update(attention);} +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/BannerServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/BannerServiceImpl.java new file mode 100644 index 0000000..9f69062 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/impl/BannerServiceImpl.java @@ -0,0 +1,27 @@ +package com.sincere.wechatbusiness.service.impl; + +import com.sincere.wechatbusiness.mapper.BannerMapper; +import com.sincere.wechatbusiness.model.Banner; +import com.sincere.wechatbusiness.service.BannerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class BannerServiceImpl implements BannerService { + @Autowired + BannerMapper bannerMapper; + + @Override + public List getList(int id){return bannerMapper.getList(id);} + + @Override + public int insert(Banner banner){return bannerMapper.insert(banner);} + + @Override + public int update(Banner banner){return bannerMapper.update(banner);} + + @Override + public int deleteBanner(int id){return bannerMapper.deleteBanner(id);} +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/CatalogContentServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/CatalogContentServiceImpl.java new file mode 100644 index 0000000..6b75583 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/impl/CatalogContentServiceImpl.java @@ -0,0 +1,28 @@ +package com.sincere.wechatbusiness.service.impl; + +import com.sincere.wechatbusiness.mapper.CatalogContentMapper; +import com.sincere.wechatbusiness.model.Catalog; +import com.sincere.wechatbusiness.model.CatalogContent; +import com.sincere.wechatbusiness.service.CatalogContentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class CatalogContentServiceImpl implements CatalogContentService { + @Autowired + CatalogContentMapper catalogContentMapper; + + @Override + public List getList(int id){return catalogContentMapper.getList(id);} + + @Override + public int insert(CatalogContent catalogContent){return catalogContentMapper.insert(catalogContent);} + + @Override + public int update(CatalogContent catalogContent){return catalogContentMapper.update(catalogContent);} + + @Override + public int deleteCatalogContent(int id){return catalogContentMapper.deleteCatalogContent(id);} +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/CatalogServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/CatalogServiceImpl.java new file mode 100644 index 0000000..2da4121 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/impl/CatalogServiceImpl.java @@ -0,0 +1,22 @@ +package com.sincere.wechatbusiness.service.impl; + +import com.sincere.wechatbusiness.mapper.CatalogMapper; +import com.sincere.wechatbusiness.model.Catalog; +import com.sincere.wechatbusiness.service.CatalogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class CatalogServiceImpl implements CatalogService { + @Autowired + CatalogMapper catalogMapper; + + @Override + public Catalog getDetail(Catalog catalog){return catalogMapper.getDetail(catalog);} + + @Override + public int insert(Catalog catalog){return catalogMapper.insert(catalog);} + + @Override + public int update(Catalog catalog){return catalogMapper.update(catalog);} +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java new file mode 100644 index 0000000..33d5f33 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java @@ -0,0 +1,27 @@ +package com.sincere.wechatbusiness.service.impl; + +import com.sincere.wechatbusiness.mapper.ChannelProductMapper; +import com.sincere.wechatbusiness.model.ChannelProduct; +import com.sincere.wechatbusiness.service.ChannelProductService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ChannelProductServiceImpl implements ChannelProductService { + @Autowired + ChannelProductMapper channelProductMapper; + + @Override + public List getList(int id){return channelProductMapper.getList(id);} + + @Override + public int insert(ChannelProduct channelProduct){return channelProductMapper.insert(channelProduct);} + + @Override + public int update(ChannelProduct channelProduct){return channelProductMapper.update(channelProduct);} + + @Override + public int deleteChannelProduct(int id){return channelProductMapper.deleteChannelProduct(id);} +} diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java new file mode 100644 index 0000000..b807bf7 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java @@ -0,0 +1,44 @@ +package com.sincere.wechatbusiness.service.impl; + +import com.github.pagehelper.PageHelper; +import com.sincere.wechatbusiness.mapper.ChannelMapper; +import com.sincere.wechatbusiness.model.Channel; +import com.sincere.wechatbusiness.service.ChannelService; +import com.sincere.wechatbusiness.utils.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class ChannelServiceImpl implements ChannelService { + @Autowired + ChannelMapper channelMapper; + + @Override + public Page getList(Channel channel,int page, int pageSize){ + Page result=new Page<>(page,pageSize); + PageHelper.startPage(page,pageSize); + result.setList(channelMapper.getList(channel)); + result.setCount(channelMapper.getListCount(channel)); + return result; + } + + @Override + public Channel getDetail(int id){ + Channel channel=new Channel(); + channel=channelMapper.getDetail(id); + return channel; + } + + @Override + public int insert(Channel channel){return channelMapper.insert(channel);} + + @Override + public int update(Channel channel){return channelMapper.update(channel);} + + @Override + public int deleteChannel(int id){return channelMapper.deleteChannel(id);} +} + diff --git a/src/main/java/com/sincere/wechatbusiness/utils/Page.java b/src/main/java/com/sincere/wechatbusiness/utils/Page.java new file mode 100644 index 0000000..5ebe606 --- /dev/null +++ b/src/main/java/com/sincere/wechatbusiness/utils/Page.java @@ -0,0 +1,55 @@ +package com.sincere.wechatbusiness.utils; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +@ApiModel +public class Page { + + @ApiModelProperty(value = "页码") + private int page ; + @ApiModelProperty(value = "每页数量") + private int pageSize ; + @ApiModelProperty(value = "总数") + private int count ; + private List list ; + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } + + public Page(int page, int pageSize) { + this.page = page; + this.pageSize = pageSize; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 760ad98..48b37ad 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -26,8 +26,8 @@ spring: ##mybatis mybatis: mapper-locations: classpath:mapper/*.xml - type-aliases-package: com.sincere.report.model + type-aliases-package: com.sincere.wechatBusiness.model logging: level: - com.sincere.report.mapper: debug \ No newline at end of file + com.sincere.wechatBusiness.mapper: debug \ No newline at end of file diff --git a/src/main/resources/mapper/AttentionMapper.xml b/src/main/resources/mapper/AttentionMapper.xml new file mode 100644 index 0000000..0670c44 --- /dev/null +++ b/src/main/resources/mapper/AttentionMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + insert into attention (channelId, logo,name,content,img_url) + values (#{channelId,jdbcType=INTEGER}, #{logo,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}) + + + + update attention + + + logo=#{logo}, + + + name=#{name}, + + + content=#{content}, + + + img_url=#{imgUrl}, + + + where id = #{id} + + \ No newline at end of file diff --git a/src/main/resources/mapper/BannerMapper.xml b/src/main/resources/mapper/BannerMapper.xml new file mode 100644 index 0000000..831edea --- /dev/null +++ b/src/main/resources/mapper/BannerMapper.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + insert into banner (channelId, img_url,link_url) + values (#{channelId,jdbcType=INTEGER}, #{imgUrl,jdbcType=VARCHAR}, #{linkUrl,jdbcType=VARCHAR} + ) + + + + update banner + + + img_url=#{imgUrl}, + + + link_url=#{linkUrl}, + + + where id = #{id} + + + + update banner set state=0 where id = #{id} + + \ No newline at end of file diff --git a/src/main/resources/mapper/CatalogContentMapper.xml b/src/main/resources/mapper/CatalogContentMapper.xml new file mode 100644 index 0000000..b33ab1c --- /dev/null +++ b/src/main/resources/mapper/CatalogContentMapper.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + insert into catalog_content (catalogId, title,subtitle,start_time,end_time,img_url,link_url) + values (#{catalogId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{subtitle,jdbcType=VARCHAR}, + #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, #{linkUrl,jdbcType=VARCHAR}) + + + + update catalog_content + + + title=#{title}, + + + subtitle=#{subtitle}, + + + start_time=#{startTime}, + + + end_time=#{endTime}, + + + img_url=#{imgUrl}, + + + link_url=#{linkUrl}, + + + where id = #{id} + + + + update catalog_content set state=0 where id = #{id} + + \ No newline at end of file diff --git a/src/main/resources/mapper/CatalogMapper.xml b/src/main/resources/mapper/CatalogMapper.xml new file mode 100644 index 0000000..6af0b77 --- /dev/null +++ b/src/main/resources/mapper/CatalogMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + insert into catalog (channelId, name,sort) + values (#{channelId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER} + ) + + + + update catalog + + + name=#{name}, + + + where id = #{id} + + \ No newline at end of file diff --git a/src/main/resources/mapper/ChannelMapper.xml b/src/main/resources/mapper/ChannelMapper.xml new file mode 100644 index 0000000..b0aafa8 --- /dev/null +++ b/src/main/resources/mapper/ChannelMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + insert into channel (name, mobile,province,city,templateId) + values (#{name,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{templateId,jdbcType=INTEGER} + ) + + + + update channel + + + name=#{name}, + + + mobile=#{mobile}, + + + province=#{province}, + + + city=#{city}, + + + templateId=#{templateId}, + + + where id = #{id} + + + + update channel set state=0 where id = #{id} + update channel_product set state=0 where channelId = #{id} + + \ No newline at end of file diff --git a/src/main/resources/mapper/ChannelProductMapper.xml b/src/main/resources/mapper/ChannelProductMapper.xml new file mode 100644 index 0000000..2a92c8d --- /dev/null +++ b/src/main/resources/mapper/ChannelProductMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + insert into channel_product (channelId, product_name,price) + values (#{channelId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{price,jdbcType=VARCHAR} + ) + + + + update channel_product + + + channel_price=#{channelPrice}, + + + caption=#{caption}, + + + where id = #{id} + + + + update channel_product set state=0 where channelId=#{id} + + \ No newline at end of file -- libgit2 0.21.0