Commit 9c4d6326b352a6ed9ee0cf9bcb721df2d982952c

Authored by 陈杰
1 parent 4086b7de
Exists in master

渠道商品 编辑

src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
... ... @@ -191,6 +191,14 @@ public class ChannelController {
191 191 if(channel.getChannelProductList()!=null&&channel.getChannelProductList().size()>0) {
192 192 for(ChannelProduct channelProduct:channel.getChannelProductList()){
193 193 channelProduct.setChannelId(channel.getId());
  194 + String r=Get(domain+"/University/getPackageById","id="+channelProduct.getProductId());
  195 + JSONObject jsonObject= JSONObject.parseObject(r);
  196 + String data = jsonObject.getString("data");
  197 + DiscountPackage model=JSON.parseObject(data,new TypeReference<DiscountPackage>(){});
  198 + channelProduct.setChannelTitle(model.getPackage_name());
  199 + channelProduct.setChannelImg(model.getPhoto());
  200 + channelProduct.setChannelRequire(model.getDescribe());
  201 + channelProduct.setChannelExplain(model.getRequire());
194 202 channelProductService.insert(channelProduct);
195 203 }
196 204 }
... ... @@ -244,6 +252,13 @@ public class ChannelController {
244 252 return new BaseDto();
245 253 }
246 254  
  255 + @RequestMapping(value = "UpdateChannelProductMsg",method = RequestMethod.POST)
  256 + @ApiOperation(value = "编辑代理商品详情")
  257 + public BaseDto UpdateChannelProductMsg(@RequestBody ChannelProduct channelProduct){
  258 + channelProductService.updateChannelProductMsg(channelProduct);
  259 + return new BaseDto();
  260 + }
  261 +
247 262 @RequestMapping(value = "GetBannerList",method = RequestMethod.GET)
248 263 @ApiOperation(value = "获取Banner轮播图列表")
249 264 public BaseDto<List<Banner>> GetBannerList(int id){
... ...
src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java
... ... @@ -14,4 +14,6 @@ public interface ChannelProductMapper {
14 14 int deleteChannelProduct(int id);
15 15  
16 16 ChannelProduct getDetail(int id);
  17 +
  18 + int updateChannelProductMsg(ChannelProduct channelProduct);
17 19 }
... ...
src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java
... ... @@ -27,6 +27,43 @@ public class ChannelProduct {
27 27 private Date endTime ;
28 28 private String title ;
29 29  
  30 + private String channelTitle ;
  31 + private String channelImg ;
  32 + private String channelRequire ;
  33 + private String channelExplain ;
  34 +
  35 + public String getChannelTitle() {
  36 + return channelTitle;
  37 + }
  38 +
  39 + public void setChannelTitle(String channelTitle) {
  40 + this.channelTitle = channelTitle;
  41 + }
  42 +
  43 + public String getChannelImg() {
  44 + return channelImg;
  45 + }
  46 +
  47 + public void setChannelImg(String channelImg) {
  48 + this.channelImg = channelImg;
  49 + }
  50 +
  51 + public String getChannelRequire() {
  52 + return channelRequire;
  53 + }
  54 +
  55 + public void setChannelRequire(String channelRequire) {
  56 + this.channelRequire = channelRequire;
  57 + }
  58 +
  59 + public String getChannelExplain() {
  60 + return channelExplain;
  61 + }
  62 +
  63 + public void setChannelExplain(String channelExplain) {
  64 + this.channelExplain = channelExplain;
  65 + }
  66 +
30 67 public String getPromotionPrice() {
31 68 return promotionPrice;
32 69 }
... ...
src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java
... ... @@ -14,4 +14,6 @@ public interface ChannelProductService {
14 14 int deleteChannelProduct(int id);
15 15  
16 16 ChannelProduct getDetail(int id);
  17 +
  18 + int updateChannelProductMsg(ChannelProduct channelProduct);
17 19 }
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java
... ... @@ -27,4 +27,9 @@ public class ChannelProductServiceImpl implements ChannelProductService {
27 27  
28 28 @Override
29 29 public ChannelProduct getDetail(int id){return channelProductMapper.getDetail(id);}
  30 +
  31 + @Override
  32 + public int updateChannelProductMsg(ChannelProduct channelProduct) {
  33 + return channelProductMapper.updateChannelProductMsg(channelProduct);
  34 + }
30 35 }
... ...
src/main/resources/mapper/ChannelProductMapper.xml
... ... @@ -22,11 +22,18 @@
22 22 </select>
23 23  
24 24 <insert id="insert" parameterType="com.sincere.wechatbusiness.model.ChannelProduct">
25   - insert into channel_product (channelId,productId,product_name,price,img_url)
26   - values (#{channelId,jdbcType=INTEGER},#{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{price,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}
  25 + insert into channel_product (channelId,productId,product_name,price,img_url,channel_title,channel_img,channel_require,channel_explain)
  26 + values (#{channelId,jdbcType=INTEGER},#{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR},
  27 + #{price,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},#{channelTitle},#{channelImg},#{channelRequire},#{channelExplain}
27 28 )
28 29 </insert>
29 30  
  31 + <update id="updateChannelProductMsg" parameterType="com.sincere.wechatbusiness.model.ChannelProduct">
  32 + update channel_product set channel_title = #{channelTitle} , channel_img =#{channelImg} ,
  33 + channel_require =#{channelRequire} , channel_explain=#{channelExplain}
  34 + where id =#{id}
  35 + </update>
  36 +
30 37 <update id="update" parameterType="com.sincere.wechatbusiness.model.ChannelProduct">
31 38 update channel_product
32 39 <trim prefix="set" suffixOverrides=",">
... ...