diff --git a/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicAccountController.java b/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicAccountController.java index 6a1772a..de5b97d 100644 --- a/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicAccountController.java +++ b/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicAccountController.java @@ -1,15 +1,13 @@ package com.playlet.web.controller.system; import java.util.List; + +import com.playlet.system.domain.PlayletPublicDetail; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.playlet.common.annotation.Log; import com.playlet.common.enums.BusinessType; import com.playlet.system.domain.PlayletPublicAccount; @@ -34,6 +32,25 @@ public class PlayletPublicAccountController extends BaseController @Autowired private IPlayletPublicAccountService playletPublicAccountService; + + @GetMapping("/wxQrcode/{id}") + public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) { + mmap.put("id", id); + return prefix + "/wxQrcode"; + } + + @PostMapping("/checkExist") + @ResponseBody + public AjaxResult checkExist(@RequestBody Long id) { + PlayletPublicAccount account = playletPublicAccountService.getById(id); + if(account!=null){ + return AjaxResult.success(); + }else { + return AjaxResult.error(); + } + } + + @RequiresPermissions("playlet:account:view") @GetMapping() public String account() diff --git a/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicDetailController.java b/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicDetailController.java index 97133ed..ec546e6 100644 --- a/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicDetailController.java +++ b/playlet-admin/src/main/java/com/playlet/web/controller/system/PlayletPublicDetailController.java @@ -1,15 +1,14 @@ package com.playlet.web.controller.system; import java.util.List; + +import com.playlet.system.domain.PlayletPublicAccount; +import com.playlet.system.service.IPlayletPublicAccountService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.playlet.common.annotation.Log; import com.playlet.common.enums.BusinessType; import com.playlet.system.domain.PlayletPublicDetail; @@ -34,6 +33,27 @@ public class PlayletPublicDetailController extends BaseController @Autowired private IPlayletPublicDetailService playletPublicDetailService; + @Autowired + private IPlayletPublicAccountService playletPublicAccountService; + + + @GetMapping("/wxQrcode/{id}") + public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) { + mmap.put("id", id); + return prefix + "/wxQrcode"; + } + + @PostMapping("/checkExist") + @ResponseBody + public AjaxResult checkExist(@RequestBody Long id) { + PlayletPublicDetail detail = playletPublicDetailService.getById(id); + if(detail!=null){ + return AjaxResult.success(); + }else { + return AjaxResult.error(); + } + } + @RequiresPermissions("playlet:detail:view") @GetMapping() public String detail() @@ -72,8 +92,9 @@ public class PlayletPublicDetailController extends BaseController * 新增公众号文章详情 */ @GetMapping("/add") - public String add() + public String add(ModelMap modelMap) { + modelMap.put("publicAccounts", playletPublicAccountService.selectPlayletPublicAccountList(new PlayletPublicAccount())); return prefix + "/add"; } @@ -97,6 +118,7 @@ public class PlayletPublicDetailController extends BaseController public String edit(@PathVariable("id") Long id, ModelMap mmap) { PlayletPublicDetail playletPublicDetail = playletPublicDetailService.selectPlayletPublicDetailById(id); + mmap.put("publicAccounts", playletPublicAccountService.selectPlayletPublicAccountList(new PlayletPublicAccount())); mmap.put("playletPublicDetail", playletPublicDetail); return prefix + "/edit"; } diff --git a/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletItemAppServiceImpl.java b/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletItemAppServiceImpl.java index 4f1bb55..910c313 100644 --- a/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletItemAppServiceImpl.java +++ b/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletItemAppServiceImpl.java @@ -3,10 +3,14 @@ package com.playlet.web.service.app.impl; import cn.hutool.core.util.ObjectUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.playlet.common.utils.StringUtils; import com.playlet.system.domain.PlayletItem; import com.playlet.system.domain.PlayletItemType; +import com.playlet.system.domain.PlayletUserItem; +import com.playlet.system.domain.PlayletUserTask; import com.playlet.system.service.IPlayletItemService; import com.playlet.system.service.IPlayletItemTypeService; +import com.playlet.system.service.IPlayletUserItemService; import com.playlet.web.service.app.PlayletItemAppService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -24,6 +28,8 @@ public class PlayletItemAppServiceImpl implements PlayletItemAppService { private final IPlayletItemTypeService iPlayletItemTypeService; + private final IPlayletUserItemService iPlayletUserItemService; + @Override public PageInfo getItemPage(PlayletItem playletItem, Integer pageNum, Integer pageSize) { PageHelper.startPage(pageNum, pageSize); @@ -33,6 +39,16 @@ public class PlayletItemAppServiceImpl implements PlayletItemAppService { PlayletItemType itemType = iPlayletItemTypeService.selectPlayletItemTypeById(Long.valueOf(model.getItemType())); model.setItemTypeName(itemType.getName()); } + // 如果用户id不存在,则需要判断是否加入过该任务 + if(StringUtils.isNotEmpty(playletItem.getUserId())){ + long count = iPlayletUserItemService.lambdaQuery() + .eq(PlayletUserItem::getUserId, playletItem.getUserId()) + .eq(PlayletUserItem::getItemId, model.getId()) + .count(); + if(count > 0){ + model.setIsJoin(true); + } + } }); return PageInfo.of(playletItems); } diff --git a/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletTaskAppServiceImpl.java b/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletTaskAppServiceImpl.java index 019f518..3d541b3 100644 --- a/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletTaskAppServiceImpl.java +++ b/playlet-admin/src/main/java/com/playlet/web/service/app/impl/PlayletTaskAppServiceImpl.java @@ -7,6 +7,7 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.playlet.common.exception.ServiceException; import com.playlet.common.utils.DateUtils; +import com.playlet.common.utils.StringUtils; import com.playlet.system.domain.*; import com.playlet.system.service.IPlayletItemService; import com.playlet.system.service.IPlayletRevenueRecordService; @@ -49,6 +50,16 @@ public class PlayletTaskAppServiceImpl implements PlayletTaskAppService { if(playletItem != null){ model.setPlayletItem(playletItem); } + // 如果用户id不存在,则需要判断是否加入过该任务 + if(StringUtils.isNotEmpty(playletTask.getUserId())){ + long count = iPlayletUserTaskService.lambdaQuery() + .eq(PlayletUserTask::getUserId, playletTask.getUserId()) + .eq(PlayletUserTask::getTaskId, model.getId()) + .count(); + if(count > 0){ + model.setIsJoin(true); + } + } }); return PageInfo.of(revenueRecordList); } diff --git a/playlet-admin/src/main/resources/static/js/jquery.qrcode.min.js b/playlet-admin/src/main/resources/static/js/jquery.qrcode.min.js new file mode 100644 index 0000000..fe9680e --- /dev/null +++ b/playlet-admin/src/main/resources/static/js/jquery.qrcode.min.js @@ -0,0 +1,28 @@ +(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;da||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]= +0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c= +j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount- +b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0g;g++)if(null==this.modules[b][i-g]){var n=!1;f>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a, +c),b=new t,e=0;e8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d= +0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+ +a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;dc)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+ +a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256), +LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d +this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b>>7-a%8&1)},put:function(a,c){for(var d=0;d>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1, +correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e").css("height",b+"px").appendTo(c);for(i=0;i").css("width", +d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery); diff --git a/playlet-admin/src/main/resources/templates/system/playlet/account/account.html b/playlet-admin/src/main/resources/templates/system/playlet/account/account.html index 8b8ff23..b6e5ea3 100644 --- a/playlet-admin/src/main/resources/templates/system/playlet/account/account.html +++ b/playlet-admin/src/main/resources/templates/system/playlet/account/account.html @@ -14,30 +14,6 @@ -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  •  搜索  重置 @@ -94,7 +70,8 @@ }, { field: 'introduction', - title: '简介' + title: '简介', + visible: false }, { field: 'authorAlias', @@ -102,7 +79,11 @@ }, { field: 'logoUrl', - title: '头像' + title: '头像', + formatter: function(value) { + if (value != null && value !== ''){return '头像';} + else {return ''} + } }, { field: 'address', @@ -125,6 +106,7 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('公众号二维码 '); actions.push('编辑 '); actions.push('删除'); return actions.join(''); @@ -133,6 +115,28 @@ }; $.table.init(options); }); + + + function showQrcode(id) { + var url = "account/wxQrcode/" + id; + + layer.open({ + type: 2, + area: ['290px', '360px'], + fix: false, + //不固定 + maxmin: true, + shade: 0.3, + title: '微信二维码', + content: url, + btn: ['关闭'], + // 弹层外区域关闭 + shadeClose: true, + cancel: function(index) { + return true; + } + }); + } \ No newline at end of file diff --git a/playlet-admin/src/main/resources/templates/system/playlet/account/add.html b/playlet-admin/src/main/resources/templates/system/playlet/account/add.html index b959e3c..b00b6b1 100644 --- a/playlet-admin/src/main/resources/templates/system/playlet/account/add.html +++ b/playlet-admin/src/main/resources/templates/system/playlet/account/add.html @@ -2,6 +2,7 @@ +
    @@ -27,7 +28,10 @@
    - + +
    + +
    @@ -36,18 +40,6 @@
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    @@ -57,12 +49,32 @@
    + + + + diff --git a/playlet-admin/src/main/resources/templates/system/playlet/detail/add.html b/playlet-admin/src/main/resources/templates/system/playlet/detail/add.html index 5169068..c69a805 100644 --- a/playlet-admin/src/main/resources/templates/system/playlet/detail/add.html +++ b/playlet-admin/src/main/resources/templates/system/playlet/detail/add.html @@ -3,29 +3,31 @@ +
    + + + + + +
    - +
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    +
    + + + + + +
    @@ -35,15 +37,26 @@
    - + +
    + +
    - +
    - + +
    + + + + + + +
    @@ -54,12 +67,32 @@
    + \ No newline at end of file diff --git a/playlet-admin/src/main/resources/templates/system/playlet/detail/edit.html b/playlet-admin/src/main/resources/templates/system/playlet/detail/edit.html index a5d328a..409b5d9 100644 --- a/playlet-admin/src/main/resources/templates/system/playlet/detail/edit.html +++ b/playlet-admin/src/main/resources/templates/system/playlet/detail/edit.html @@ -9,15 +9,17 @@
    - +
    - +
    - +
    - +
    @@ -27,24 +29,12 @@
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    @@ -72,6 +62,7 @@ $('#' + this.id).summernote({ lang: 'zh-CN', dialogsInBody: true, + height: 300, callbacks: { onChange: function(contents, $edittable) { $("input[name='" + this.id + "']").val(contents); diff --git a/playlet-admin/src/main/resources/templates/system/playlet/detail/wxQrcode.html b/playlet-admin/src/main/resources/templates/system/playlet/detail/wxQrcode.html new file mode 100644 index 0000000..4327e70 --- /dev/null +++ b/playlet-admin/src/main/resources/templates/system/playlet/detail/wxQrcode.html @@ -0,0 +1,40 @@ + + + + + + + + +
    + + + + + + + diff --git a/playlet-system/src/main/java/com/playlet/system/domain/PlayletItem.java b/playlet-system/src/main/java/com/playlet/system/domain/PlayletItem.java index b5d0552..90e63f0 100644 --- a/playlet-system/src/main/java/com/playlet/system/domain/PlayletItem.java +++ b/playlet-system/src/main/java/com/playlet/system/domain/PlayletItem.java @@ -150,4 +150,12 @@ public class PlayletItem extends BaseEntity{ @TableField(exist = false) private Date createEndTime; + @ApiModelProperty(value = "用户id") + @TableField(exist = false) + private String userId; + + @ApiModelProperty(value = "是否加入") + @TableField(exist = false) + private Boolean isJoin = false; + } diff --git a/playlet-system/src/main/java/com/playlet/system/domain/PlayletTask.java b/playlet-system/src/main/java/com/playlet/system/domain/PlayletTask.java index 82cbf22..61c4595 100644 --- a/playlet-system/src/main/java/com/playlet/system/domain/PlayletTask.java +++ b/playlet-system/src/main/java/com/playlet/system/domain/PlayletTask.java @@ -150,4 +150,8 @@ public class PlayletTask extends BaseEntity { @ApiModelProperty(value = "用户id") private String userId; + @TableField(exist = false) + @ApiModelProperty(value = "是否加入任务") + private Boolean isJoin = false; + }