From baf8c2142cfbff2e9191db4dedf3f33060492c96 Mon Sep 17 00:00:00 2001 From: Administrator <15274802129@163.com> Date: Mon, 07 Jul 2025 16:37:13 +0800 Subject: [PATCH] feat(mall): 新增设计衣服社区功能 --- src/main/resources/templates/febs/views/modules/clothesType/socialList.html | 266 +++++ src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialCategoryMapper.java | 7 src/main/java/cc/mrbird/febs/mall/service/ApiClothesSocialService.java | 11 src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java | 75 + src/main/java/cc/mrbird/febs/mall/controller/clothes/AdminClothesTypeController.java | 217 ++++ src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java | 104 ++ src/main/resources/templates/febs/views/modules/clothesType/groupAdd.html | 95 + src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesCategoryAddDto.java | 16 src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java | 29 src/main/resources/mapper/modules/ClothesSocialMuseMapper.xml | 6 src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java | 3 src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminSocialMuseUpdateVo.java | 17 src/main/java/cc/mrbird/febs/mall/service/ClothesTypeService.java | 47 src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesCategoryUpdateDto.java | 19 src/main/resources/mapper/modules/ClothesSocialCategoryMapper.xml | 6 src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesSocialListVo.java | 13 src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesSocialCategoryDto.java | 10 src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialCategory.java | 23 src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialFileMapper.java | 7 src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java | 331 ++++++ src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html | 325 ++++++ src/main/resources/mapper/modules/ClothesSocialFileMapper.xml | 6 src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialFile.java | 19 src/main/resources/templates/febs/views/modules/clothesType/groupList.html | 236 ++++ src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesSocialListDto.java | 19 src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialMuseMapper.java | 7 src/main/resources/templates/febs/views/modules/clothesType/socialAdd.html | 371 +++++++ src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesCategoryInfoVo.java | 16 src/main/resources/mapper/modules/ClothesSocialMapper.xml | 34 src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialMapper.java | 14 src/main/resources/templates/febs/views/modules/clothesType/groupInfo.html | 112 ++ src/main/java/cc/mrbird/febs/mall/entity/ClothesSocial.java | 43 src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesSocialController.java | 50 + src/main/resources/templates/febs/views/modules/clothesType/socialUpdate.html | 429 ++++++++ 34 files changed, 2,970 insertions(+), 13 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/controller/clothes/AdminClothesTypeController.java b/src/main/java/cc/mrbird/febs/mall/controller/clothes/AdminClothesTypeController.java index 7d18b56..32587c8 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/clothes/AdminClothesTypeController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/clothes/AdminClothesTypeController.java @@ -10,11 +10,11 @@ import cc.mrbird.febs.common.utils.excl.ExcelUtil; import cc.mrbird.febs.common.utils.excl.ExcelVersion; import cc.mrbird.febs.common.utils.excl.ResponseHeadUtil; +import cc.mrbird.febs.mall.dto.AdminHappyActivityCategoryDto; import cc.mrbird.febs.mall.dto.DeliverGoodsDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesDeliverGoodsDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesOrderListDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesRefundOrderDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; +import cc.mrbird.febs.mall.dto.activity.AdminCategoryAddDto; +import cc.mrbird.febs.mall.dto.activity.AdminCategoryUpdateDto; +import cc.mrbird.febs.mall.dto.clothes.*; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.service.ClothesTypeService; import cn.hutool.core.collection.CollUtil; @@ -51,6 +51,215 @@ private final ClothesTypeService clothesTypeService; /** + * 分类列表 + * @return + */ + @GetMapping("groupList") + public FebsResponse groupList(AdminClothesSocialCategoryDto dto, QueryRequest request) { + + Map<String, Object> data = getDataTable(clothesTypeService.getGroupList(dto, request)); + return new FebsResponse().success().data(data); + } + /** + * 分类-新增 + */ + @PostMapping("addGroup") + @ControllerEndpoint(operation = "分类-新增", exceptionMessage = "操作失败") + public FebsResponse addGroup(@RequestBody @Valid AdminClothesCategoryAddDto dto) { + + return clothesTypeService.addGroup(dto); + } + + /** + * 分类-删除 + */ + @GetMapping("groupDelete/{id}") + @ControllerEndpoint(operation = "选项-删除", exceptionMessage = "操作失败") + public FebsResponse groupDelete(@NotNull(message = "{required}") @PathVariable Long id) { + + return clothesTypeService.groupDelete(id); + } + + /** + * 分类-更新 + */ + @PostMapping("groupUpdate") + @ControllerEndpoint(operation = "分类-更新", exceptionMessage = "操作失败") + public FebsResponse groupUpdate(@RequestBody @Valid AdminClothesCategoryUpdateDto dto) { + + return clothesTypeService.groupUpdate(dto); + } + /** + * 分类-开启 + */ + @GetMapping("groupState/{id}/{type}") + @ControllerEndpoint(operation = "分类-开启", exceptionMessage = "操作失败") + public FebsResponse groupState( + @NotNull(message = "{required}") @PathVariable Long id, + @NotNull(message = "{required}") @PathVariable Integer type) { + + return clothesTypeService.groupState(id,type); + } + + /** + * 社区列表 + * + * @param dto + * @param request + * @return + */ + @GetMapping("socialList") + public FebsResponse socialList(AdminClothesSocialListDto dto, QueryRequest request) { + String startTime = dto.getStartTime(); + String endTime = dto.getEndTime(); + if(StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)){ + DateTime dateStartTime= DateUtil.parseDate(startTime); + DateTime dateEndTime = DateUtil.parseDate(endTime); + int compare = DateUtil.compare(dateStartTime, dateEndTime); + if(compare >= 0){ + return new FebsResponse().fail().message("请输入正确的开始时间和结束时间"); + } + } + Map<String, Object> data = getDataTable(clothesTypeService.getSocialListInPage(dto, request)); + return new FebsResponse().success().data(data); + } + + + /** + * 社区-新增 + */ + @PostMapping("socialAdd") + @ControllerEndpoint(operation = "新增", exceptionMessage = "操作失败") + public FebsResponse socialAdd(@RequestBody ClothesSocial dto) { + + return clothesTypeService.socialAdd(dto); + } + + + /** + * 社区-更新 + */ + @PostMapping("socialUpdate") + @ControllerEndpoint(operation = "社区-更新", exceptionMessage = "操作失败") + public FebsResponse socialUpdate(@RequestBody ClothesSocial dto) { + + return clothesTypeService.socialUpdate(dto); + } + + + /** + * 社区-灵感 + */ + @PostMapping("socialMuseUpdate") + @ControllerEndpoint(operation = "社区-灵感", exceptionMessage = "操作失败") + public FebsResponse socialMuseUpdate(@RequestBody ClothesSocialMuse dto) { + + return clothesTypeService.socialMuseUpdate(dto); + } + + /** + * 社区获取设计类型-工艺 + * @return + */ + @GetMapping(value = "/allArt/{typeId}") + public FebsResponse allArt(@NotNull(message = "{required}") @PathVariable Long typeId) { + + return new FebsResponse().success().data(clothesTypeService.allArt(typeId)); + } + + /** + * 社区获取设计类型-尺码 + * @return + */ + @GetMapping(value = "/allSize/{typeId}") + public FebsResponse allSize(@NotNull(message = "{required}") @PathVariable Long typeId) { + + return new FebsResponse().success().data(clothesTypeService.allSize(typeId)); + } + + /** + * 社区获取设计类型-位置 + * @return + */ + @GetMapping(value = "/allLocation/{typeId}") + public FebsResponse allLocation(@NotNull(message = "{required}") @PathVariable Long typeId) { + + return new FebsResponse().success().data(clothesTypeService.allLocation(typeId)); + } + + /** + * 社区获取设计类型-图案 + * @return + */ + @GetMapping(value = "/allPattern/{typeId}") + public FebsResponse allPattern(@NotNull(message = "{required}") @PathVariable Long typeId) { + + return new FebsResponse().success().data(clothesTypeService.allPattern(typeId)); + } + + /** + * 社区获取设计类型-布料 + * @return + */ + @GetMapping(value = "/allCloth/{typeId}") + public FebsResponse allCloth(@NotNull(message = "{required}") @PathVariable Long typeId) { + + return new FebsResponse().success().data(clothesTypeService.allCloth(typeId)); + } + + /** + * 社区获取设计类型 + * @return + */ + @GetMapping(value = "/allType") + public FebsResponse allType() { + + return new FebsResponse().success().data(clothesTypeService.allType()); + } + + /** + * 社区获取分类 + * @return + */ + @GetMapping(value = "/allGroup") + public FebsResponse allGroup() { + + return new FebsResponse().success().data(clothesTypeService.allGroup()); + } + + /** + * 社区-开启 + */ + @GetMapping("socialState/{id}/{state}") + @ControllerEndpoint(operation = "社区-开启", exceptionMessage = "操作失败") + public FebsResponse socialState(@NotNull(message = "{required}") @PathVariable Long id, + @NotNull(message = "{required}") @PathVariable Integer state) { + + return clothesTypeService.socialState(id,state); + } + + /** + * 社区-推荐首页 + */ + @GetMapping("socialHotState/{id}/{state}") + @ControllerEndpoint(operation = "社区-开启", exceptionMessage = "操作失败") + public FebsResponse socialHotState(@NotNull(message = "{required}") @PathVariable Long id, + @NotNull(message = "{required}") @PathVariable Integer state) { + + return clothesTypeService.socialHotState(id,state); + } + + /** + * 社区-删除 + */ + @GetMapping("socialDelete/{id}") + @ControllerEndpoint(operation = "社区-删除", exceptionMessage = "删除失败") + public FebsResponse socialDelete(@NotNull(message = "{required}") @PathVariable Long id) { + + return clothesTypeService.socialDelete(id); + } + + /** * 订单列表 * * @param dto diff --git a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesSocialController.java b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesSocialController.java new file mode 100644 index 0000000..655e778 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesSocialController.java @@ -0,0 +1,50 @@ +package cc.mrbird.febs.mall.controller.clothes; + +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.mall.dto.clothes.*; +import cc.mrbird.febs.mall.service.ApiClothesOrderService; +import cc.mrbird.febs.mall.service.ApiClothesSocialService; +import cc.mrbird.febs.mall.vo.activity.ApiScCategoryInfoVo; +import cc.mrbird.febs.mall.vo.clothes.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping(value = "/api/clothes/social") +@Api(value = "ApiClothesSocialController", tags = "设计衣服社区") +public class ApiClothesSocialController { + + private final ApiClothesSocialService apiClothesSocialService; + + @ApiOperation(value = "全部分类", notes = "全部分类") + @ApiResponses({ + @ApiResponse(code = 200, message = "success", response = ApiClothesCategoryInfoVo.class) + }) + @GetMapping(value = "/allCategory") + public FebsResponse allCategory() { + + return apiClothesSocialService.allCategory(); + } + + @ApiOperation(value = "首页分类", notes = "首页分类") + @ApiResponses({ + @ApiResponse(code = 200, message = "success", response = ApiClothesCategoryInfoVo.class) + }) + @GetMapping(value = "/indexCategory") + public FebsResponse indexCategory() { + + return apiClothesSocialService.indexCategory(); + } + + + +} diff --git a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java index e5ca549..5163636 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java @@ -46,9 +46,113 @@ private final ClothesTypePatternMapper clothesTypePatternMapper; private final ClothesTypeLocationMapper clothesTypeLocationMapper; private final ClothesOrderMapper clothesOrderMapper; + private final ClothesSocialCategoryMapper clothesSocialCategoryMapper; + private final ClothesSocialMapper clothesSocialMapper; + private final ClothesSocialMuseMapper clothesSocialMuseMapper; + private final ClothesSocialFileMapper clothesSocialFileMapper; private final MallExpressInfoMapper mallExpressInfoMapper; /** + * 社区分类列表 + */ + @GetMapping("groupList") + @RequiresPermissions("groupList:view") + public String groupList() { + + return FebsUtil.view("modules/clothesType/groupList"); + } + + /** + * 社区分类新增 + * @return + */ + @GetMapping(value = "/groupAdd") + @RequiresPermissions("groupAdd:add") + public String groupAdd() { + + return FebsUtil.view("modules/clothesType/groupAdd"); + } + + /** + * 社区分类编辑 + * @param id + * @param model + * @return + */ + @GetMapping("groupInfo/{id}") + @RequiresPermissions("groupInfo:view") + public String groupInfo(@PathVariable long id, Model model) { + + ClothesSocialCategory clothesSocialCategory = clothesSocialCategoryMapper.selectById(id); + model.addAttribute("voteActivityGroup", clothesSocialCategory); + return FebsUtil.view("modules/clothesType/groupInfo"); + } + + /** + * 社区列表 + */ + @GetMapping("socialList") + @RequiresPermissions("socialList:view") + public String socialList() { + + return FebsUtil.view("modules/clothesType/socialList"); + } + + /** + * 社区-新增 + */ + @GetMapping("socialAdd") + @RequiresPermissions("socialAdd:add") + public String socialAdd() { + return FebsUtil.view("modules/clothesType/socialAdd"); + } + + /** + * 社区-修改 + */ + @GetMapping("socialUpdate/{id}") + @RequiresPermissions("socialUpdate:update") + public String socialUpdate(@PathVariable long id, Model model) { + ClothesSocial clothesSocial = clothesSocialMapper.selectById(id); + List<ClothesSocialFile> clothesSocialFiles = clothesSocialFileMapper.selectList( + Wrappers.lambdaQuery(ClothesSocialFile.class) + .eq(ClothesSocialFile::getSocialId, id) + ); + if(CollUtil.isNotEmpty(clothesSocialFiles)){ + clothesSocial.setImages(clothesSocialFiles.stream().map(ClothesSocialFile::getFileUrl).collect(Collectors.toList())); + } + ClothesSocialMuse clothesSocialMuse = clothesSocialMuseMapper.selectOne( + Wrappers.lambdaQuery(ClothesSocialMuse.class) + .eq(ClothesSocialMuse::getSocialId, clothesSocial.getId()) + .last("LIMIT 1") + ); + if(ObjectUtil.isNotNull(clothesSocialMuse)){ + clothesSocial.setTypeId(clothesSocialMuse.getTypeId()); + } + model.addAttribute("activity", clothesSocial); + + return FebsUtil.view("modules/clothesType/socialUpdate"); + } + + /** + * 社区-灵感 + */ + @GetMapping("socialMuseUpdate/{id}") + @RequiresPermissions("socialMuseUpdate:update") + public String socialMuseUpdate(@PathVariable long id, Model model) { + ClothesSocial clothesSocial = clothesSocialMapper.selectById(id); + + ClothesSocialMuse clothesSocialMuse = clothesSocialMuseMapper.selectOne( + Wrappers.lambdaQuery(ClothesSocialMuse.class) + .eq(ClothesSocialMuse::getSocialId, clothesSocial.getId()) + .last("LIMIT 1") + ); + model.addAttribute("socialMuse", clothesSocialMuse); + + return FebsUtil.view("modules/clothesType/socialMuseUpdate"); + } + + /** * 订单列表 */ @GetMapping("orderList") diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesCategoryAddDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesCategoryAddDto.java new file mode 100644 index 0000000..ed825e1 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesCategoryAddDto.java @@ -0,0 +1,16 @@ +package cc.mrbird.febs.mall.dto.clothes; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class AdminClothesCategoryAddDto { + + @NotBlank(message = "名称不能为空") + private String name; + + @NotNull(message = "排序不能为空") + private Integer orderCnt; +} diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesCategoryUpdateDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesCategoryUpdateDto.java new file mode 100644 index 0000000..bcfac48 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesCategoryUpdateDto.java @@ -0,0 +1,19 @@ +package cc.mrbird.febs.mall.dto.clothes; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +public class AdminClothesCategoryUpdateDto { + + @NotNull(message = "ID不能为空") + private Long id; + + @NotBlank(message = "名称不能为空") + private String name; + + @NotNull(message = "排序不能为空") + private Integer orderCnt; +} diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesSocialCategoryDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesSocialCategoryDto.java new file mode 100644 index 0000000..49e575d --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesSocialCategoryDto.java @@ -0,0 +1,10 @@ +package cc.mrbird.febs.mall.dto.clothes; + +import lombok.Data; + +@Data +public class AdminClothesSocialCategoryDto { + private String name; + private Integer status; + private Integer hotState; +} diff --git a/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesSocialListDto.java b/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesSocialListDto.java new file mode 100644 index 0000000..ea26ebb --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/dto/clothes/AdminClothesSocialListDto.java @@ -0,0 +1,19 @@ +package cc.mrbird.febs.mall.dto.clothes; + +import lombok.Data; + +@Data +public class AdminClothesSocialListDto { + + + private String name; + + /** + * 状态 0-待审核 1-审核通过 2-审核失败 + */ + private Integer state; + + private String startTime; + + private String endTime; +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocial.java b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocial.java new file mode 100644 index 0000000..3acd812 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocial.java @@ -0,0 +1,43 @@ +package cc.mrbird.febs.mall.entity; + +import cc.mrbird.febs.common.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.List; + +@Data +@TableName("clothes_social") +public class ClothesSocial extends BaseEntity { + /** + * + `member_id` bigint(20) DEFAULT NULL COMMENT '用户ID', + `name` varchar(500) DEFAULT NULL COMMENT '标题', + `content` text COMMENT '内容', + `index_file` varchar(500) DEFAULT NULL COMMENT '首页显示', + `category_id` bigint(20) DEFAULT NULL COMMENT '分类ID', + `del_flag` int(11) DEFAULT '0' COMMENT '删除标识 0-未删除 1-已删除', + `state` int(11) DEFAULT '0' COMMENT '状态 0-不展示 1-展示', + `order_cnt` int(11) DEFAULT '0' COMMENT '排序', + */ + private Long memberId; + private String name; + private String content; + private String indexFile; + private Long categoryId; + private Integer delFlag; + private Integer state; + private Integer hotState; + private Integer orderCnt; + + @TableField(exist = false) + private String thumbs; + + @TableField(exist = false) + private Long typeId; + + @TableField(exist = false) + private List<String> images; + +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialCategory.java b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialCategory.java new file mode 100644 index 0000000..605a9e2 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialCategory.java @@ -0,0 +1,23 @@ +package cc.mrbird.febs.mall.entity; + +import cc.mrbird.febs.common.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("clothes_social_category") +public class ClothesSocialCategory extends BaseEntity { + /** + * + `name` varchar(500) DEFAULT NULL, + `order_cnt` int(11) DEFAULT '0' COMMENT '排序', + `hot_state` int(11) DEFAULT '0' COMMENT '是否推荐到首页 0-不推荐 1-推荐', + `state` int(11) DEFAULT NULL COMMENT '状态 0-未开启 1-已开启', + `DELETE_FLAG` int(11) DEFAULT '0' COMMENT '删除标识 0-未删除 1-已删除', + */ + private String name; + private Integer orderCnt; + private Integer hotState; + private Integer state; + private Integer deleteFlag; +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialFile.java b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialFile.java new file mode 100644 index 0000000..3870b27 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialFile.java @@ -0,0 +1,19 @@ +package cc.mrbird.febs.mall.entity; + +import cc.mrbird.febs.common.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("clothes_social_file") +public class ClothesSocialFile extends BaseEntity { + /** + * + `social_id` bigint(20) DEFAULT NULL, + `file_url` varchar(200) DEFAULT NULL, + `seq` int(11) DEFAULT NULL COMMENT '排序', + */ + private Long socialId; + private String fileUrl; + private Integer seq; +} diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java new file mode 100644 index 0000000..f36051d --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/entity/ClothesSocialMuse.java @@ -0,0 +1,29 @@ +package cc.mrbird.febs.mall.entity; + +import cc.mrbird.febs.common.entity.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +@Data +@TableName("clothes_social_muse") +public class ClothesSocialMuse extends BaseEntity { + /** + * + `social_id` bigint(20) DEFAULT NULL, + `type_id` bigint(20) DEFAULT NULL COMMENT '类别', + `art_id` bigint(20) DEFAULT NULL, + `stature_id` bigint(20) DEFAULT NULL, + `size_id` bigint(20) DEFAULT NULL, + `pattern_id` bigint(20) DEFAULT NULL, + `location_id` bigint(20) DEFAULT NULL, + `cloth_id` bigint(20) DEFAULT NULL, + */ + private Long socialId; + private Long typeId; + private Long artId; + private Long statureId; + private Long sizeId; + private Long patternId; + private Long locationId; + private Long clothId; +} diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialCategoryMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialCategoryMapper.java new file mode 100644 index 0000000..de8dfc8 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialCategoryMapper.java @@ -0,0 +1,7 @@ +package cc.mrbird.febs.mall.mapper; + +import cc.mrbird.febs.mall.entity.ClothesSocialCategory; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +public interface ClothesSocialCategoryMapper extends BaseMapper<ClothesSocialCategory> { +} diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialFileMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialFileMapper.java new file mode 100644 index 0000000..07761df --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialFileMapper.java @@ -0,0 +1,7 @@ +package cc.mrbird.febs.mall.mapper; + +import cc.mrbird.febs.mall.entity.ClothesSocialFile; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +public interface ClothesSocialFileMapper extends BaseMapper<ClothesSocialFile> { +} diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialMapper.java new file mode 100644 index 0000000..049fa25 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialMapper.java @@ -0,0 +1,14 @@ +package cc.mrbird.febs.mall.mapper; + +import cc.mrbird.febs.mall.dto.clothes.AdminClothesSocialListDto; +import cc.mrbird.febs.mall.entity.ClothesSocial; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; + +public interface ClothesSocialMapper extends BaseMapper<ClothesSocial> { + + IPage<AdminClothesSocialListVo> selectSocialListInPage(Page<AdminClothesSocialListVo> page, @Param("record")AdminClothesSocialListDto dto); +} \ No newline at end of file diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialMuseMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialMuseMapper.java new file mode 100644 index 0000000..99b392d --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/mapper/ClothesSocialMuseMapper.java @@ -0,0 +1,7 @@ +package cc.mrbird.febs.mall.mapper; + +import cc.mrbird.febs.mall.entity.ClothesSocialMuse; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +public interface ClothesSocialMuseMapper extends BaseMapper<ClothesSocialMuse> { +} diff --git a/src/main/java/cc/mrbird/febs/mall/service/ApiClothesSocialService.java b/src/main/java/cc/mrbird/febs/mall/service/ApiClothesSocialService.java new file mode 100644 index 0000000..4549801 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/service/ApiClothesSocialService.java @@ -0,0 +1,11 @@ +package cc.mrbird.febs.mall.service; + +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.mall.entity.ClothesSocial; +import com.baomidou.mybatisplus.extension.service.IService; + +public interface ApiClothesSocialService extends IService<ClothesSocial> { + FebsResponse allCategory(); + + FebsResponse indexCategory(); +} diff --git a/src/main/java/cc/mrbird/febs/mall/service/ClothesTypeService.java b/src/main/java/cc/mrbird/febs/mall/service/ClothesTypeService.java index 1986c27..a6ca28f 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/ClothesTypeService.java +++ b/src/main/java/cc/mrbird/febs/mall/service/ClothesTypeService.java @@ -2,12 +2,13 @@ import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.entity.QueryRequest; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesDeliverGoodsDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesOrderListDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesRefundOrderDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; +import cc.mrbird.febs.mall.dto.AdminHappyActivityCategoryDto; +import cc.mrbird.febs.mall.dto.activity.AdminCategoryAddDto; +import cc.mrbird.febs.mall.dto.activity.AdminCategoryUpdateDto; +import cc.mrbird.febs.mall.dto.clothes.*; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; @@ -79,4 +80,42 @@ void exportOrderList(List<Long> list, HttpServletResponse response) throws IOException; void deliverGoodsImport(AdminClothesDeliverGoodsDto dto); + + IPage<AdminClothesSocialListVo> getSocialListInPage(AdminClothesSocialListDto dto, QueryRequest request); + + FebsResponse socialState(Long id, Integer state); + + FebsResponse socialHotState(Long id, Integer state); + + FebsResponse socialDelete(Long id); + + List<ClothesSocialCategory> allGroup(); + + IPage<ClothesSocialCategory> getGroupList(AdminClothesSocialCategoryDto dto, QueryRequest request); + + FebsResponse addGroup(AdminClothesCategoryAddDto dto); + + FebsResponse groupDelete(Long id); + + FebsResponse groupUpdate(AdminClothesCategoryUpdateDto dto); + + FebsResponse groupState(Long id, Integer type); + + FebsResponse socialAdd(ClothesSocial dto); + + FebsResponse socialUpdate(ClothesSocial dto); + + List<ClothesType> allType(); + + List<ClothesCloth> allCloth(Long typeId); + + List<ClothesPattern> allPattern(Long typeId); + + List<ClothesLocation> allLocation(Long typeId); + + List<ClothesSize> allSize(Long typeId); + + List<ClothesArt> allArt(Long typeId); + + FebsResponse socialMuseUpdate(ClothesSocialMuse dto); } diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java index 3ddad7e..e4df4fe 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesOrderServiceImpl.java @@ -381,6 +381,7 @@ orderItem.setMemberId(memberId); orderItem.setOrderId(orderId); orderItem.setType(item.getType()); + orderItem.setItemCnt(dto.getCnt()); if (ClothesOrderItemEnum.CLOTH.getCode() == item.getType()) { ClothesCloth cloth = clothesClothMapper.selectById(item.getSkuId()); if (ObjectUtil.isNull(cloth)) { @@ -389,7 +390,7 @@ orderItem.setName(cloth.getName()); orderItem.setPrice(cloth.getPrice()); orderItem.setItemCnt(item.getCnt()); - orderItem.setAmount(cloth.getPrice().multiply(new BigDecimal(item.getCnt())).setScale(2, RoundingMode.DOWN)); + orderItem.setAmount(cloth.getPrice().multiply(new BigDecimal(orderItem.getItemCnt())).setScale(2, RoundingMode.DOWN)); clothesOrderItemMapper.insert(orderItem); total = total.add(orderItem.getAmount()); diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java new file mode 100644 index 0000000..cad4aab --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java @@ -0,0 +1,75 @@ +package cc.mrbird.febs.mall.service.impl; + +import cc.mrbird.febs.common.entity.FebsResponse; +import cc.mrbird.febs.common.enumerates.ClothesEnum; +import cc.mrbird.febs.common.enumerates.StateUpDownEnum; +import cc.mrbird.febs.mall.entity.ClothesSocial; +import cc.mrbird.febs.mall.entity.ClothesSocialCategory; +import cc.mrbird.febs.mall.entity.HappySocialCircleCategory; +import cc.mrbird.febs.mall.mapper.ClothesSocialCategoryMapper; +import cc.mrbird.febs.mall.mapper.ClothesSocialMapper; +import cc.mrbird.febs.mall.service.ApiClothesSocialService; +import cc.mrbird.febs.mall.vo.activity.ApiScCategoryInfoVo; +import cc.mrbird.febs.mall.vo.clothes.ApiClothesCategoryInfoVo; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Service +@RequiredArgsConstructor +public class ApiClothesSocialServiceImpl extends ServiceImpl<ClothesSocialMapper, ClothesSocial> implements ApiClothesSocialService { + + private final ClothesSocialMapper clothesSocialMapper; + private final ClothesSocialCategoryMapper clothesSocialCategoryMapper; + + @Override + public FebsResponse allCategory() { + List<ApiClothesCategoryInfoVo> vos = new ArrayList<>(); + List<ClothesSocialCategory> list = clothesSocialCategoryMapper.selectList( + Wrappers.lambdaQuery(ClothesSocialCategory.class) + .select(ClothesSocialCategory::getId, ClothesSocialCategory::getName) + .eq(ClothesSocialCategory::getState, ClothesEnum.UP.getCode()) + .eq(ClothesSocialCategory::getDeleteFlag, ClothesEnum.DOWN.getCode()) + .orderByAsc(ClothesSocialCategory::getOrderCnt) + ); + if(CollUtil.isNotEmpty(list)){ + vos = buildApiClothesCategoryInfoVo(list, vos); + } + return new FebsResponse().success().data(vos); + } + + private List<ApiClothesCategoryInfoVo> buildApiClothesCategoryInfoVo(List<ClothesSocialCategory> list, List<ApiClothesCategoryInfoVo> vos) { + for (ClothesSocialCategory entity : list) { + ApiClothesCategoryInfoVo vo = new ApiClothesCategoryInfoVo(); + vo.setId(entity.getId()); + vo.setName(entity.getName()); + vos.add(vo); + } + return vos; + } + + @Override + public FebsResponse indexCategory() { + List<ApiClothesCategoryInfoVo> vos = new ArrayList<>(); + List<ClothesSocialCategory> list = clothesSocialCategoryMapper.selectList( + Wrappers.lambdaQuery(ClothesSocialCategory.class) + .select(ClothesSocialCategory::getId, ClothesSocialCategory::getName) + .eq(ClothesSocialCategory::getState, ClothesEnum.UP.getCode()) + .eq(ClothesSocialCategory::getHotState, ClothesEnum.UP.getCode()) + .eq(ClothesSocialCategory::getDeleteFlag, ClothesEnum.DOWN.getCode()) + .orderByAsc(ClothesSocialCategory::getOrderCnt) + ); + if(CollUtil.isNotEmpty(list)){ + vos = buildApiClothesCategoryInfoVo(list, vos); + } + return new FebsResponse().success().data(vos); + } +} diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java index c8015bf..6d6c591 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ClothesTypeServiceImpl.java @@ -9,10 +9,7 @@ import cc.mrbird.febs.common.utils.excl.ExcelUtil; import cc.mrbird.febs.common.utils.excl.ExcelVersion; import cc.mrbird.febs.common.utils.excl.ResponseHeadUtil; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesDeliverGoodsDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesOrderListDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesRefundOrderDto; -import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; +import cc.mrbird.febs.mall.dto.clothes.*; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.*; import cc.mrbird.febs.mall.service.ClothesTypeService; @@ -20,7 +17,9 @@ import cc.mrbird.febs.mall.service.IMallMoneyFlowService; import cc.mrbird.febs.mall.vo.AdminMallOrderInfoVo; import cc.mrbird.febs.mall.vo.clothes.AdminClothesOrderListVo; +import cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo; import cc.mrbird.febs.pay.util.WeixinServiceUtil; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; @@ -64,6 +63,11 @@ private final ClothesTypeLocationMapper clothesTypeLocationMapper; private final ClothesOrderMapper clothesOrderMapper; private final MallExpressInfoMapper mallExpressInfoMapper; + private final ClothesSocialMapper clothesSocialMapper; + private final ClothesSocialFileMapper clothesSocialFileMapper; + private final ClothesSocialMuseMapper clothesSocialMuseMapper; + private final ClothesSocialCategoryMapper clothesSocialCategoryMapper; + private final IApiMallMemberWalletService memberWalletService; private final IMallMoneyFlowService mallMoneyFlowService; private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class); @@ -732,4 +736,323 @@ .eq(ClothesOrder::getId, clothesOrder.getId()) ); } + + @Override + public IPage<AdminClothesSocialListVo> getSocialListInPage(AdminClothesSocialListDto dto, QueryRequest request) { + Page<AdminClothesSocialListVo> page = new Page<>(request.getPageNum(), request.getPageSize()); + IPage<AdminClothesSocialListVo> vos = clothesSocialMapper.selectSocialListInPage(page, dto); + return vos; + } + + @Override + public FebsResponse socialState(Long id, Integer state) { + + ClothesSocial clothesSocial = clothesSocialMapper.selectById(id); + if(ObjectUtil.isNull(clothesSocial)){ + throw new RuntimeException("内容不存在"); + } + clothesSocialMapper.update( + null, + Wrappers.lambdaUpdate(ClothesSocial.class) + .set(ClothesSocial::getState, state) + .eq(ClothesSocial::getId, id) + ); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse socialHotState(Long id, Integer state) { + + ClothesSocial clothesSocial = clothesSocialMapper.selectById(id); + if(ObjectUtil.isNull(clothesSocial)){ + throw new RuntimeException("内容不存在"); + } + clothesSocialMapper.update( + null, + Wrappers.lambdaUpdate(ClothesSocial.class) + .set(ClothesSocial::getHotState, state) + .eq(ClothesSocial::getId, id) + ); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse socialDelete(Long id) { + ClothesSocial clothesSocial = clothesSocialMapper.selectById(id); + if(ObjectUtil.isNull(clothesSocial)){ + throw new RuntimeException("内容不存在"); + } + clothesSocialMapper.update( + null, + Wrappers.lambdaUpdate(ClothesSocial.class) + .set(ClothesSocial::getDelFlag, ClothesEnum.UP.getCode()) + .eq(ClothesSocial::getId, id) + ); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public List<ClothesSocialCategory> allGroup() { + List<ClothesSocialCategory> list = + clothesSocialCategoryMapper.selectList( + Wrappers.lambdaQuery(ClothesSocialCategory.class) + .eq(ClothesSocialCategory::getState, ClothesEnum.UP.getCode()) + .eq(ClothesSocialCategory::getDeleteFlag, ClothesEnum.DOWN.getCode()) + .orderByDesc(ClothesSocialCategory::getOrderCnt) + ); + if(CollUtil.isNotEmpty(list)){ + return list; + } + return Collections.emptyList(); + } + + @Override + public IPage<ClothesSocialCategory> getGroupList(AdminClothesSocialCategoryDto dto, QueryRequest request) { + Page<ClothesSocialCategory> page = new Page<>(request.getPageNum(), request.getPageSize()); + LambdaQueryWrapper<ClothesSocialCategory> queryWrapper = new LambdaQueryWrapper<>(); + if(StrUtil.isNotEmpty(dto.getName())){ + queryWrapper.like(ClothesSocialCategory::getName,dto.getName()); + } + if(ObjectUtil.isNotEmpty(dto.getStatus())){ + queryWrapper.eq(ClothesSocialCategory::getState,dto.getStatus()); + } + if(ObjectUtil.isNotEmpty(dto.getHotState())){ + queryWrapper.eq(ClothesSocialCategory::getHotState,dto.getHotState()); + } + queryWrapper.eq(ClothesSocialCategory::getDeleteFlag, ClothesEnum.DOWN.getCode()); + queryWrapper.orderByAsc(ClothesSocialCategory::getOrderCnt); + + Page<ClothesSocialCategory> pages = clothesSocialCategoryMapper.selectPage(page, queryWrapper); + return pages; + } + + @Override + public FebsResponse addGroup(AdminClothesCategoryAddDto dto) { + ClothesSocialCategory entity = new ClothesSocialCategory(); + entity.setName(dto.getName()); + entity.setOrderCnt(dto.getOrderCnt()); + clothesSocialCategoryMapper.insert(entity); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse groupDelete(Long id) { + + ClothesSocialCategory vo = clothesSocialCategoryMapper.selectById(id); + vo.setDeleteFlag(ClothesEnum.UP.getCode()); + clothesSocialCategoryMapper.updateById(vo); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse groupUpdate(AdminClothesCategoryUpdateDto dto) { + + ClothesSocialCategory vo = clothesSocialCategoryMapper.selectById(dto.getId()); + vo.setName(dto.getName()); + vo.setOrderCnt(dto.getOrderCnt()); + clothesSocialCategoryMapper.updateById(vo); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse groupState(Long id, Integer type) { + + ClothesSocialCategory vo = clothesSocialCategoryMapper.selectById(id); + if(ClothesEnum.UP.getCode() == vo.getDeleteFlag()){ + throw new RuntimeException("该分组已删除,无法操作"); + } + + if(type == 1){ + vo.setHotState(vo.getHotState() == ClothesEnum.UP.getCode() ? ClothesEnum.DOWN.getCode() : ClothesEnum.UP.getCode()); + } + + if(type == 2){ + vo.setState(vo.getState() == ClothesEnum.UP.getCode() ? ClothesEnum.DOWN.getCode() : ClothesEnum.UP.getCode()); + } + clothesSocialCategoryMapper.updateById(vo); + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse socialAdd(ClothesSocial dto) { + if(ObjectUtil.isEmpty(dto.getMemberId())){ + throw new RuntimeException("请选择发布人"); + } + if(ObjectUtil.isEmpty(dto.getCategoryId())){ + throw new RuntimeException("请选择分类"); + } + ClothesSocial entity = new ClothesSocial(); + BeanUtil.copyProperties(dto, entity); + clothesSocialMapper.insert(entity); + + String thumbs = dto.getThumbs(); + if (StrUtil.isNotEmpty(thumbs)) { + List<String> list = StrUtil.splitTrim(thumbs, ","); + if (CollUtil.isNotEmpty(list)) { + int i = 1; + for (String img : list) { + ClothesSocialFile clothesSocialFile = new ClothesSocialFile(); + clothesSocialFile.setSocialId(entity.getId()); + clothesSocialFile.setFileUrl(img); + clothesSocialFile.setSeq(i); + clothesSocialFileMapper.insert(clothesSocialFile); + i++; + } + } + } + + if(ObjectUtil.isNotNull(dto.getTypeId())){ + ClothesSocialMuse clothesSocialMuse = new ClothesSocialMuse(); + clothesSocialMuse.setSocialId(entity.getId()); + clothesSocialMuse.setTypeId(dto.getTypeId()); + clothesSocialMuseMapper.insert(clothesSocialMuse); + } + + return new FebsResponse().success().message("操作成功"); + } + + @Override + public FebsResponse socialUpdate(ClothesSocial dto) { + ClothesSocial entity = clothesSocialMapper.selectById(dto.getId()); + if(ObjectUtil.isNull(entity)){ + throw new RuntimeException("内容不存在,无法操作"); + } + entity.setCategoryId(dto.getCategoryId()); + entity.setMemberId(dto.getMemberId()); + entity.setName(dto.getName()); + entity.setContent(dto.getContent()); + entity.setIndexFile(dto.getIndexFile()); + entity.setOrderCnt(dto.getOrderCnt()); + + clothesSocialMapper.updateById(entity); + + clothesSocialFileMapper.delete( + Wrappers.lambdaQuery(ClothesSocialFile.class) + .eq(ClothesSocialFile::getSocialId, entity.getId()) + ); + String thumbs = dto.getThumbs(); + if (StrUtil.isNotEmpty(thumbs)) { + List<String> list = StrUtil.splitTrim(thumbs, ","); + if (CollUtil.isNotEmpty(list)) { + int i = 1; + for (String img : list) { + ClothesSocialFile clothesSocialFile = new ClothesSocialFile(); + clothesSocialFile.setSocialId(entity.getId()); + clothesSocialFile.setFileUrl(img); + clothesSocialFile.setSeq(i); + clothesSocialFileMapper.insert(clothesSocialFile); + i++; + } + } + } + + clothesSocialMuseMapper.delete( + Wrappers.lambdaQuery(ClothesSocialMuse.class) + .eq(ClothesSocialMuse::getSocialId, entity.getId()) + ); + if(ObjectUtil.isNotNull(dto.getTypeId())){ + ClothesSocialMuse clothesSocialMuse = new ClothesSocialMuse(); + clothesSocialMuse.setSocialId(entity.getId()); + clothesSocialMuse.setTypeId(dto.getTypeId()); + clothesSocialMuseMapper.insert(clothesSocialMuse); + } + + return new FebsResponse().success().message("操作成功"); + } + + @Override + public List<ClothesType> allType() { + List<ClothesType> list = + clothesTypeMapper.selectList( + Wrappers.lambdaQuery(ClothesType.class) + .eq(ClothesType::getState, ClothesEnum.UP.getCode()) + ); + if(CollUtil.isNotEmpty(list)){ + return list; + } + return Collections.emptyList(); + } + + @Override + public List<ClothesCloth> allCloth(Long typeId) { + List<ClothesTypeCloth> entities = clothesTypeClothMapper.selectList( + Wrappers.lambdaQuery(ClothesTypeCloth.class) + .eq(ClothesTypeCloth::getTypeId, typeId) + ); + if(CollUtil.isNotEmpty(entities)){ + Set<Long> ids = entities.stream().map(ClothesTypeCloth::getClothId).collect(Collectors.toSet()); + return clothesClothMapper.selectBatchIds(ids); + } + return Collections.emptyList(); + } + + @Override + public List<ClothesPattern> allPattern(Long typeId) { + List<ClothesTypePattern> entities = clothesTypePatternMapper.selectList( + Wrappers.lambdaQuery(ClothesTypePattern.class) + .eq(ClothesTypePattern::getTypeId, typeId) + ); + if(CollUtil.isNotEmpty(entities)){ + Set<Long> ids = entities.stream().map(ClothesTypePattern::getPatternId).collect(Collectors.toSet()); + return clothesPatternMapper.selectBatchIds(ids); + } + return Collections.emptyList(); + } + + @Override + public List<ClothesLocation> allLocation(Long typeId) { + List<ClothesTypeLocation> entities = clothesTypeLocationMapper.selectList( + Wrappers.lambdaQuery(ClothesTypeLocation.class) + .eq(ClothesTypeLocation::getTypeId, typeId) + ); + if(CollUtil.isNotEmpty(entities)){ + Set<Long> ids = entities.stream().map(ClothesTypeLocation::getLocationId).collect(Collectors.toSet()); + return clothesLocationMapper.selectBatchIds(ids); + } + return Collections.emptyList(); + } + + @Override + public List<ClothesSize> allSize(Long typeId) { + List<ClothesTypeSize> entities = clothesTypeSizeMapper.selectList( + Wrappers.lambdaQuery(ClothesTypeSize.class) + .eq(ClothesTypeSize::getTypeId, typeId) + ); + if(CollUtil.isNotEmpty(entities)){ + Set<Long> ids = entities.stream().map(ClothesTypeSize::getSizeId).collect(Collectors.toSet()); + return clothesSizeMapper.selectBatchIds(ids); + } + return Collections.emptyList(); + } + + @Override + public List<ClothesArt> allArt(Long typeId) { + List<ClothesTypeArt> entities = clothesTypeArtMapper.selectList( + Wrappers.lambdaQuery(ClothesTypeArt.class) + .eq(ClothesTypeArt::getTypeId, typeId) + ); + if(CollUtil.isNotEmpty(entities)){ + Set<Long> ids = entities.stream().map(ClothesTypeArt::getArtId).collect(Collectors.toSet()); + return clothesArtMapper.selectBatchIds(ids); + } + return Collections.emptyList(); + } + + @Override + public FebsResponse socialMuseUpdate(ClothesSocialMuse dto) { + Long id = dto.getId(); + + ClothesSocialMuse entity = clothesSocialMuseMapper.selectById(id); + if(ObjectUtil.isNotNull(entity)){ + entity.setClothId(dto.getClothId()); + entity.setLocationId(dto.getLocationId()); + entity.setSizeId(dto.getSizeId()); + entity.setPatternId(dto.getPatternId()); + entity.setArtId(dto.getArtId()); + clothesSocialMuseMapper.updateById(entity); + } + + return new FebsResponse().success().message("操作成功"); + } + } diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesSocialListVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesSocialListVo.java new file mode 100644 index 0000000..29ac47e --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminClothesSocialListVo.java @@ -0,0 +1,13 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import lombok.Data; + +@Data +public class AdminClothesSocialListVo { + private Long id; + private String name; + private String socialTitle; + private Integer socialState; + private Integer hotState; + private Integer delFlag; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminSocialMuseUpdateVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminSocialMuseUpdateVo.java new file mode 100644 index 0000000..20b16b6 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/AdminSocialMuseUpdateVo.java @@ -0,0 +1,17 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import lombok.Data; + +@Data +public class AdminSocialMuseUpdateVo { + + private Long id; + private Long socialId; + private Long typeId; + private Long artId; + private Long statureId; + private Long sizeId; + private Long patternId; + private Long locationId; + private Long clothId; +} diff --git a/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesCategoryInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesCategoryInfoVo.java new file mode 100644 index 0000000..0b64e2e --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/clothes/ApiClothesCategoryInfoVo.java @@ -0,0 +1,16 @@ +package cc.mrbird.febs.mall.vo.clothes; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "ApiClothesCategoryInfoVo", description = "参数") +public class ApiClothesCategoryInfoVo { + + @ApiModelProperty(value = "ID") + private Long id; + + @ApiModelProperty(value = "名称") + private String name; +} diff --git a/src/main/resources/mapper/modules/ClothesSocialCategoryMapper.xml b/src/main/resources/mapper/modules/ClothesSocialCategoryMapper.xml new file mode 100644 index 0000000..92a8117 --- /dev/null +++ b/src/main/resources/mapper/modules/ClothesSocialCategoryMapper.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cc.mrbird.febs.mall.mapper.ClothesSocialCategoryMapper"> + + +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/modules/ClothesSocialFileMapper.xml b/src/main/resources/mapper/modules/ClothesSocialFileMapper.xml new file mode 100644 index 0000000..4e3ecb6 --- /dev/null +++ b/src/main/resources/mapper/modules/ClothesSocialFileMapper.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cc.mrbird.febs.mall.mapper.ClothesSocialFileMapper"> + + +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/modules/ClothesSocialMapper.xml b/src/main/resources/mapper/modules/ClothesSocialMapper.xml new file mode 100644 index 0000000..32aa9e2 --- /dev/null +++ b/src/main/resources/mapper/modules/ClothesSocialMapper.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cc.mrbird.febs.mall.mapper.ClothesSocialMapper"> + + <select id="selectSocialListInPage" resultType="cc.mrbird.febs.mall.vo.clothes.AdminClothesSocialListVo"> + select + b.name as name, + a.id as id, + a.name as socialTitle, + a.del_flag as delFlag, + a.hot_state as hotState, + a.state as socialState + from clothes_social a + left join mall_member b on a.member_id = b.id + <where> + <if test="record != null"> + <if test="record.name != null and record.name != ''"> + and b.name like CONCAT('%', CONCAT(#{record.name}, '%')) + </if> + <if test="record.state != null"> + and a.state = #{record.status} + </if> + <if test="record.startTime != null and record.startTime != ''"> + and a.created_time >= #{record.startTime} + </if> + <if test="record.endTime != null and record.endTime != ''"> + and a.created_time <= #{record.endTime} + </if> + </if> + </where> + order by a.order_cnt asc, a.created_time desc + </select> + +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/modules/ClothesSocialMuseMapper.xml b/src/main/resources/mapper/modules/ClothesSocialMuseMapper.xml new file mode 100644 index 0000000..8915271 --- /dev/null +++ b/src/main/resources/mapper/modules/ClothesSocialMuseMapper.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cc.mrbird.febs.mall.mapper.ClothesSocialMuseMapper"> + + +</mapper> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/clothesType/groupAdd.html b/src/main/resources/templates/febs/views/modules/clothesType/groupAdd.html new file mode 100644 index 0000000..d6a2cb2 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/clothesType/groupAdd.html @@ -0,0 +1,95 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-sc-add" lay-title="社区分类新增"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-fluid" id="groupSc-add"> + <form class="layui-form" action="" lay-filter="groupSc-add-form"> + <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> + <ul class="layui-tab-title"> + <li class="layui-this">基础信息</li> + </ul> + <div class="layui-tab-content"> + <div class="layui-tab-item layui-show"> + <blockquote class="layui-elem-quote blue-border">基础信息</blockquote> + <div class="layui-row layui-col-space10 layui-form-item"> + + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">排序:</label> + <div class="layui-input-block"> + <input type="text" name="orderCnt" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> + </div> + </div> + + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">名称:</label> + <div class="layui-input-block"> + <input type="text" name="name" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> + </div> + </div> + </div> + </div> + + </div> + </div> + + <div class="layui-form-item febs-hide"> + <button class="layui-btn" lay-submit="" lay-filter="groupSc-add-form-submit" id="submit">保存</button> + </div> + </form> + </div> + </div> + </div> +</div> +<style> + .blue-border { + border-left-color: #2db7f5; + font-size: 18px; + } + .layui-table-cell { + height:auto; + } + .layui-upload-list { + margin: 0 !important; + } + .multi-images { + margin: 0 5px !important; + } +</style> +<!-- 表格操作栏 end --> +<script data-th-inline="javascript"> + layui.use(['febs', 'form', 'validate'], function () { + var $ = layui.jquery, + febs = layui.febs, + layer = layui.layer, + form = layui.form, + $view = $('#groupSc-add'), + validate = layui.validate; + + form.render(); + + + form.on('submit(groupSc-add-form-submit)', function (data) { + $.ajax({ + 'url':ctx + 'admin/clothesType/addGroup', + 'type':'post', + 'dataType':'json', + 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 + 'traditional': true,//ajax传递数组必须添加属性 + 'data':JSON.stringify(data.field), + 'success':function (data) { + if(data.code==200){ + layer.closeAll(); + febs.alert.success(data.message); + $('#febs-sc-group').find('#query').click(); + }else{ + febs.alert.warn(data.message); + } + }, + 'error':function () { + febs.alert.warn('服务器繁忙'); + } + }) + return false; + }); + + }); +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/clothesType/groupInfo.html b/src/main/resources/templates/febs/views/modules/clothesType/groupInfo.html new file mode 100644 index 0000000..c699352 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/clothesType/groupInfo.html @@ -0,0 +1,112 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-scgroup-info" lay-title="社区分类编辑"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-fluid" id="group-info"> + <form class="layui-form" action="" lay-filter="group-info-form"> + <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> + <ul class="layui-tab-title"> + <li class="layui-this">基础信息</li> + </ul> + <div class="layui-tab-content"> + <input type="text" name="id" + placeholder="" autoComplete="off" class="layui-input febs-hide"> + <div class="layui-tab-item layui-show"> + <blockquote class="layui-elem-quote blue-border">基础信息</blockquote> + <div class="layui-row layui-col-space10 layui-form-item"> + + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">排序:</label> + <div class="layui-input-block"> + <input type="text" name="orderCnt" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> + </div> + </div> + + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">名称:</label> + <div class="layui-input-block"> + <input type="text" name="name" lay-verify="required" placeholder="" autocomplete="off" class="layui-input"> + </div> + </div> + </div> + </div> + + </div> + </div> + + <div class="layui-form-item febs-hide"> + <button class="layui-btn" lay-submit="" lay-filter="group-info-form-submit" id="submit">保存</button> + </div> + </form> + </div> + </div> + </div> +</div> +<style> + .blue-border { + border-left-color: #2db7f5; + font-size: 18px; + } + .layui-table-cell { + height:auto; + } + .layui-upload-list { + margin: 0 !important; + } + .multi-images { + margin: 0 5px !important; + } +</style> +<!-- 表格操作栏 end --> +<script data-th-inline="javascript"> + layui.use(['febs', 'form', 'validate','formSelects', 'table'], function () { + var $ = layui.jquery, + febs = layui.febs, + layer = layui.layer, + table = layui.table, + form = layui.form, + formSelects = layui.formSelects, + $view = $('#group-info'), + voteActivityGroup = [[${voteActivityGroup}]], + validate = layui.validate; + + form.render(); + initVoteActivityGroup(); + + formSelects.render(); + + function initVoteActivityGroup() { + console.log("voteActivityGroup:", voteActivityGroup); // 调试信息 + form.val("group-info-form", { + "id": voteActivityGroup.id, + "name": voteActivityGroup.name, + "orderCnt": voteActivityGroup.orderCnt, + }); + + } + + form.on('submit(group-info-form-submit)', function (data) { + $.ajax({ + 'url':ctx + 'admin/clothesType/groupUpdate', + 'type':'post', + 'dataType':'json', + 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 + 'traditional': true,//ajax传递数组必须添加属性 + 'data':JSON.stringify(data.field), + 'success':function (data) { + if(data.code==200){ + layer.closeAll(); + febs.alert.success(data.message); + $('#febs-sc-group').find('#query').click(); + }else{ + febs.alert.warn(data.message); + } + }, + 'error':function () { + febs.alert.warn('服务器繁忙'); + } + }) + return false; + }); + + }); +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/clothesType/groupList.html b/src/main/resources/templates/febs/views/modules/clothesType/groupList.html new file mode 100644 index 0000000..951ab8b --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/clothesType/groupList.html @@ -0,0 +1,236 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-sc-group" lay-title="社区分类管理"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-card"> + <div class="layui-card-body febs-table-full"> + <form class="layui-form layui-table-form" lay-filter="sc-table-form"> + <div class="layui-row"> + <div class="layui-col-md10"> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label layui-form-label-sm">名称</label> + <div class="layui-input-inline"> + <input type="text" placeholder="名称" name="name" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label layui-form-label-sm">审核状态</label> + <div class="layui-input-inline"> + <select name="status"> + <option value="">请选择</option> + <option value="0">未开启</option> + <option value="1">开启</option> + </select> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label layui-form-label-sm">推荐首页</label> + <div class="layui-input-inline"> + <select name="hotState"> + <option value="">请选择</option> + <option value="0">不推荐</option> + <option value="1">推荐</option> + </select> + </div> + </div> + </div> + + </div> + <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> + <i class="layui-icon"></i> + </div> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> + <i class="layui-icon"></i> + </div> + </div> + </div> + </form> + <table lay-filter="scGroupTable" lay-data="{id: 'scGroupTable'}"></table> + </div> + </div> + </div> + </div> +</div> +<!-- 表格操作栏 start --> +<script type="text/html" id="user-option"> + <span shiro:lacksPermission="list:view,add:add,votesActivityUpdate:update"> + <span class="layui-badge-dot febs-bg-orange"></span> 无权限 + </span> + <a lay-event="edit" shiro:hasPermission="votesActivityUpdate:update"><i + class="layui-icon febs-edit-area febs-blue"></i></a> +</script> +<script type="text/html" id="hotStateSwitch"> + {{# if(d.hotState === 1) { }} + <input type="checkbox" value={{d.id}} lay-text="推荐|不推荐" checked lay-skin="switch" lay-filter="hotStateSwitch"> + {{# } else { }} + <input type="checkbox" value={{d.id}} lay-text="推荐|不推荐" lay-skin="switch" lay-filter="hotStateSwitch"> + {{# } }} +</script> +<script type="text/html" id="groupStatusSwitch"> + {{# if(d.state === 1) { }} + <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="groupStatusSwitch"> + {{# } else { }} + <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="groupStatusSwitch"> + {{# } }} +</script> +<script type="text/html" id="scGroupToolbar"> + <div class="layui-btn-container"> + <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="groupAdd:add" lay-event="addScGroup">新增分类</button> + </div> +</script> + +<script type="text/html" id="scGroupOption"> + <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="groupInfo:view" lay-event="groupInfo">编辑</button> + <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" shiro:hasPermission="groupDelete:delete" lay-event="groupDelete">删除</button> +</script> +<script type="text/html" id="deleteFlag"> + {{# + var deleteFlag = { + 0: {title: '生效中', color: 'green'}, + 1: {title: '已删除', color: 'red'}, + }[d.deleteFlag]; + }} + <span class="layui-badge febs-bg-{{deleteFlag.color}}">{{ deleteFlag.title }}</span> +</script> + +<style> + .layui-form-onswitch { + background-color: #5FB878 !important; + } +</style> +<!-- 表格操作栏 end --> +<script data-th-inline="none" type="text/javascript"> + // 引入组件并初始化 + layui.use([ 'jquery', 'form', 'table', 'febs'], function () { + var $ = layui.jquery, + febs = layui.febs, + form = layui.form, + table = layui.table, + $view = $('#febs-sc-group'), + $query = $view.find('#query'), + $reset = $view.find('#reset'), + $searchForm = $view.find('form'), + sortObject = {field: 'phone', type: null}, + tableIns; + + form.render(); + + // 表格初始化 + initscGroupTable(); + // 初始化表格操作栏各个按钮功能 + table.on('tool(scGroupTable)', function (obj) { + var data = obj.data, + layEvent = obj.event; + if (layEvent === 'groupDelete') { + febs.modal.confirm('删除', '确认删除?', function () { + groupDelete(data.id); + }); + } + if (layEvent === 'groupInfo') { + febs.modal.open('编辑','modules/clothesType/groupInfo/' + data.id, { + btn: ['提交', '取消'], + area: ['100%', '100%'], + yes: function (index, layero) { + $('#febs-scgroup-info').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + } + }); + function groupDelete(id) { + febs.get(ctx + 'admin/clothesType/groupDelete/' + id, null, function (data) { + febs.alert.success(data.message); + $query.click(); + }); + } + + // 初始化表格操作栏各个按钮功能 + table.on('toolbar(scGroupTable)', function (obj) { + let data = obj.data, + layEvent = obj.event; + console.log("触发事件:", obj.event); // 调试信息 + if(layEvent === 'addScGroup'){ + febs.modal.open('新增','modules/clothesType/groupAdd/', { + btn: ['提交', '取消'], + area: ['100%', '100%'], + yes: function (index, layero) { + $('#febs-sc-add').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + } + }); + + + function initscGroupTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'scGroupTable', + url: ctx + 'admin/clothesType/groupList', + toolbar:"#scGroupToolbar", + defaultToolbar:[], + cols: [[ + {type: 'numbers', title: '', width: 80}, + {title: '操作', toolbar: '#scGroupOption', minWidth: 200, align: 'center'}, + {field: 'orderCnt', title: '排序', minWidth: 100,align:'center'}, + {field: 'name', title: '名称', minWidth: 100,align:'center'}, + {title: '推荐首页', templet: '#hotStateSwitch', minWidth: 100,align:'center'}, + {title: '状态', templet: '#groupStatusSwitch', minWidth: 100,align:'center'}, + {title: '是否删除', templet: '#deleteFlag', minWidth: 100,align:'center'}, + {field: 'createdTime', title: '创建时间', minWidth: 150,align:'left'} + ]] + }); + } + + form.on('switch(hotStateSwitch)', function (data) { + if (data.elem.checked) { + groupState(data.value,1); + } else { + groupState(data.value,1); + } + }) + + form.on('switch(groupStatusSwitch)', function (data) { + if (data.elem.checked) { + groupState(data.value,2); + } else { + groupState(data.value,2); + } + }) + function groupState(id,type) { + febs.get(ctx + 'admin/clothesType/groupState/' + id+'/' + type, null, function (data) { + febs.alert.success(data.message); + $query.click(); + }); + } + + + + // 查询按钮 + $query.on('click', function () { + var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); + tableIns.reload({where: params, page: {curr: 1}}); + }); + + // 刷新按钮 + $reset.on('click', function () { + $searchForm[0].reset(); + sortObject.type = 'null'; + tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); + }); + // 获取查询参数 + function getQueryParams() { + return { + name: $searchForm.find('input[name="name"]').val().trim(), + status: $searchForm.find("select[name='status']").val(), + hotState: $searchForm.find("select[name='hotState']").val(), + }; + } + + }) +</script> diff --git a/src/main/resources/templates/febs/views/modules/clothesType/socialAdd.html b/src/main/resources/templates/febs/views/modules/clothesType/socialAdd.html new file mode 100644 index 0000000..25d6252 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/clothesType/socialAdd.html @@ -0,0 +1,371 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-sc-add" lay-title="内容新增"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-fluid" id="sc-add"> + <form class="layui-form" action="" lay-filter="sc-add-form"> + <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> + <ul class="layui-tab-title"> + <li class="layui-this">基础信息</li> + </ul> + <div class="layui-tab-content"> + <div class="layui-tab-item layui-show"> + <blockquote class="layui-elem-quote blue-border">基础信息</blockquote> + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">分类:</label> + <div class="layui-input-block"> + <div id="sc-group"></div> + </div> + </div> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">发布人:</label> + <div class="layui-input-block"> + <div id="sc-member"></div> + <div class="layui-form-mid layui-word-aux">数据来源:会员管理-会员列表中设置成核销员</div> + </div> + </div> + </div> + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">设计类型:</label> + <div class="layui-input-block"> + <div id="sc-type"></div> + <div class="layui-form-mid layui-word-aux">数据来源:衣服设计库-设计类型</div> + </div> + </div> + </div> + + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">封面:</label> + <div class="layui-input-block"> + <div class="layui-upload"> + <button type="button" class="layui-btn layui-btn-normal layui-btn" id="test1Max">上传</button> + <div class="layui-form-mid layui-word-aux"> + 上传图片、视频或者音频文件大小不超过100M。 + 图片:"bmp", "gif", "jpg", "jpeg", "png", + 视频格式:"mp4", "avi", + 音频:"mp3", "wav" , "ogg"。 + </div> + </div> + </div> + </div> + </div> + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label">封面链接:</label> + <div class="layui-input-block"> + <input type="text" id="indexFile" lay-verify="required" name="indexFile" autocomplete="off" class="layui-input" readonly> + </div> + </div> + </div> + + <div class="layui-form-item"> + <label class="layui-form-label febs-form-item-require">轮播图:</label> + <div class="layui-input-block"> + <div class="layui-upload"> + <button type="button" class="layui-btn layui-btn-normal layui-btn" id="thumbsBanner">上传</button> + <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> + <div class="layui-upload-list" id="thumbsBanners"></div> + </blockquote> + <div class="layui-word-aux">双击图片删除</div> + </div> + </div> + </div> + + <div class="layui-form-item febs-hide"> + <label class="layui-form-label">缩略图链接:</label> + <div class="layui-input-block"> + <input type="text" id="thumbs" lay-verify="required" name="thumbs" autocomplete="off" class="layui-input" readonly> + </div> + </div> + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">排序:</label> + <div class="layui-input-block"> + <input type="text" name="orderCnt" lay-verify="required" + placeholder="" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">标题:</label> + <div class="layui-input-block"> + <input type="text" name="name" lay-verify="required" + placeholder="" autocomplete="off" class="layui-input"> + </div> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label febs-form-item-require">内容:</label> + <div class="layui-input-block"> + <div style="border: 1px solid #ccc;"> + <div id="toolbar-container" class="toolbar"></div> + <div id="text-container" class="text" style="height: 450px;"></div> + </div> + </div> + </div> + + </div> + </div> + </div> + + <div class="layui-form-item febs-hide"> + <button class="layui-btn" lay-submit="" lay-filter="sc-add-form-submit" id="submit">保存</button> + </div> + </form> + </div> + </div> + </div> +</div> +<style> + .blue-border { + border-left-color: #2db7f5; + font-size: 18px; + } + .layui-table-cell { + height:auto; + } +</style> + +<!-- 表格操作栏 end --> +<script data-th-inline="javascript"> + layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect','jquery'], function () { + var $ = layui.jquery, + febs = layui.febs, + layer = layui.layer, + table = layui.table, + formSelects = layui.formSelects, + treeSelect = layui.treeSelect, + form = layui.form, + laydate = layui.laydate, + eleTree = layui.eleTree, + $view = $('#sc-add'), + layedit = layui.layedit, + upload = layui.upload, + validate = layui.validate, + element = layui.element; + + form.render(); + + const E = window.wangEditor; + const editor = new E('#toolbar-container', '#text-container'); // 传入两个元素 + editor.config.showLinkImg = false; + editor.config.uploadFileName = 'file'; + editor.config.customUploadImg = function (files, insertImgFn) { + // files 是 input 中选中的文件列表 + // insertImgFn 是获取图片 url 后,插入到编辑器的方法 + // 上传图片,返回结果,将图片插入到编辑器中 + for (let i = 0; i < files.length; i++){ + var form = new FormData(); + form.append("file", files[0]); + $.ajax({ + url:'/admin/goods/uploadFileBase64', + type: "post", + processData: false, + contentType: false, + data: form, + dataType: 'json', + success(res) { + // 上传代码返回结果之后,将图片插入到编辑器中 + insertImgFn(res.data.src, res.data.title, '') + } + }) + } + }; + editor.create(); + + formSelects.render(); + + let scGroup = xmSelect.render({ + el: '#sc-group', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allGroup', null, function(res) { + scGroup.update({ + data : res.data, + autoRow: true, + }); + }) + + let scMember = xmSelect.render({ + el: '#sc-member', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/socialCircle/allMember', null, function(res) { + scMember.update({ + data : res.data, + autoRow: true, + }); + }) + + let scType = xmSelect.render({ + el: '#sc-type', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allType', null, function(res) { + scType.update({ + data : res.data, + autoRow: true, + }); + }) + + //图片上传 + upload.render({ + elem: '#test1Max' + ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 + ,accept: 'file' //普通文件 + ,size: 102400 //限制文件大小,单位 KB + ,before: function(obj){ + } + ,done: function(res){ + $("#indexFile").val(res.data.src); + } + }); + + //多图片上传 + upload.render({ + elem: '#thumbsBanner' + ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 + ,multiple: true + ,before: function(obj){ + //预读本地文件示例,不支持ie8 + obj.preview(function(index, file, result){ + $('#thumbsBanners').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img multi-images" style="width: 130px">') + }); + } + ,done: function(res){ + var thumbs = $("#thumbs").val(); + if(thumbs == ''){ + $("#thumbs").val(res.data.src); + }else{ + $("#thumbs").val(thumbs + ',' + res.data.src); + } + + imgUnBind(".multi-images"); + imgMultiBind(); + } + }); + + function imgUnBind(className) { + $(className).each(function() { + $(this).unbind('dblclick'); + }) + } + + function imgMultiBind() { + $(".multi-images").each(function(index, element) { + $(this).on("dblclick", function() { + var imgThumb = $(".multi-images")[index]; + $(imgThumb).remove(); + + var images = $("#thumbs").val(); + var imagesArr; + if (images) { + imagesArr = images.split(","); + imagesArr.splice(index, 1); + images = imagesArr.join(","); + } + $("#thumbs").val(images); + + imgUnBind(".multi-images"); + imgMultiBind(); + }); + }) + } + + form.on('submit(sc-add-form-submit)', function (data) { + data.field.categoryId = scGroup.getValue('valueStr'); + data.field.memberId = scMember.getValue('valueStr'); + data.field.typeId = scType.getValue('valueStr'); + data.field.content = editor.txt.html(); + $.ajax({ + 'url':ctx + 'admin/clothesType/socialAdd', + 'type':'post', + 'dataType':'json', + 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 + 'traditional': true,//ajax传递数组必须添加属性 + 'data':JSON.stringify(data.field), + 'success':function (data) { + if(data.code==200){ + layer.closeAll(); + febs.alert.success(data.message); + $('#febs-sc').find('#query').click(); + }else{ + febs.alert.warn(data.message); + } + }, + 'error':function () { + febs.alert.warn('服务器繁忙'); + } + }) + return false; + }); + + form.on('select(goods-type-select)', function(data){ + $('.tc-set').each(function() { + if (data.value == 2) { + $(this).show(); + } else { + $(this).hide(); + } + }) + }); + + }); +</script> diff --git a/src/main/resources/templates/febs/views/modules/clothesType/socialList.html b/src/main/resources/templates/febs/views/modules/clothesType/socialList.html new file mode 100644 index 0000000..375fa07 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/clothesType/socialList.html @@ -0,0 +1,266 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-sc" lay-title="社区列表"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-card"> + <div class="layui-card-body febs-table-full"> + <form class="layui-form layui-table-form" lay-filter="activity-table-form"> + <div class="layui-row"> + <div class="layui-col-md10"> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label layui-form-label-sm">发布人</label> + <div class="layui-input-inline"> + <input type="text" placeholder="发布人" name="name" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label layui-form-label-sm">分类</label> + <div class="layui-input-inline"> + <select name="categoryId" class="sc-type"> + <option value="">请选择</option> + </select> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label layui-form-label-sm">状态</label> + <div class="layui-input-inline"> + <select name="state"> + <option value="">请选择</option> + <option value="0">隐藏</option> + <option value="1">展示</option> + </select> + </div> + </div> + </div> + </div> + <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> + <i class="layui-icon"></i> + </div> + <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> + <i class="layui-icon"></i> + </div> + </div> + </div> + </form> + <table lay-filter="scTable" lay-data="{id: 'scTable'}"></table> + </div> + </div> + </div> + </div> +</div> +<!-- 表格操作栏 start --> +<script type="text/html" id="user-option"> + <span shiro:lacksPermission="list:view,add:add,votesActivityUpdate:update"> + <span class="layui-badge-dot febs-bg-orange"></span> 无权限 + </span> + <a lay-event="edit" shiro:hasPermission="votesActivityUpdate:update"><i + class="layui-icon febs-edit-area febs-blue"></i></a> +</script> +<script type="text/html" id="scStateSwitch"> + {{# if(d.socialState === 1) { }} + <input type="checkbox" value={{d.id}} lay-text="展示|隐藏" checked lay-skin="switch" lay-filter="scStateSwitch"> + {{# } else { }} + <input type="checkbox" value={{d.id}} lay-text="展示|隐藏" lay-skin="switch" lay-filter="scStateSwitch"> + {{# } }} +</script> +<script type="text/html" id="scHotStateSwitch"> + {{# if(d.hotState === 1) { }} + <input type="checkbox" value={{d.id}} lay-text="展示|隐藏" checked lay-skin="switch" lay-filter="scHotStateSwitch"> + {{# } else { }} + <input type="checkbox" value={{d.id}} lay-text="展示|隐藏" lay-skin="switch" lay-filter="scHotStateSwitch"> + {{# } }} +</script> + +<script type="text/html" id="socialDelFlagFormat"> + {{# if(d.delFlag == 1) { }} + <span>已删除</span> + {{# }else if(d.delFlag == 0) { }} + <span>正常</span> + {{# } else { }} + <span>-</span> + {{# } }} +</script> + +<script type="text/html" id="scToolbar"> + <div class="layui-btn-container"> + <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="scAdd">新增内容</button> + </div> +</script> + +<script type="text/html" id="activityOption"> + <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="scUpdateEvent">编辑</button> + <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="museEvent">设计灵感</button> + <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="scDeleteEvent">删除</button> +</script> + +<style> + .layui-form-onswitch { + background-color: #5FB878 !important; + } +</style> +<!-- 表格操作栏 end --> +<script data-th-inline="none" type="text/javascript"> + // 引入组件并初始化 + layui.use([ 'jquery', 'form', 'table', 'febs'], function () { + var $ = layui.jquery, + febs = layui.febs, + form = layui.form, + table = layui.table, + $view = $('#febs-sc'), + $query = $view.find('#query'), + $reset = $view.find('#reset'), + $searchForm = $view.find('form'), + sortObject = {field: 'phone', type: null}, + tableIns; + + form.render(); + //(下拉框) + $.get(ctx + 'admin/clothesType/allGroup', function (res) { + var data = res.data; + for (let k in data) + { + $(".sc-type").append("<option value='" + data[k].id + "'>" + data[k].name + "</option>"); + } + layui.use('form', function () { + var form = layui.form; + form.render(); + }); + }); + + // 表格初始化 + initClothesSocialTable(); + + // 初始化表格操作栏各个按钮功能 + table.on('tool(scTable)', function (obj) { + console.log("触发事件:", obj.event); // 调试信息 + var data = obj.data, + layEvent = obj.event; + + if (layEvent === 'scDeleteEvent') { + febs.modal.confirm('删除', '确认删除该内容?', function () { + delAct(data.id); + }); + } + if (layEvent === 'scUpdateEvent') { + febs.modal.open('编辑','modules/clothesType/socialUpdate/' + data.id, { + btn: ['提交', '取消'], + area: ['100%', '100%'], + yes: function (index, layero) { + $('#febs-sc-discount').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + } + if (layEvent === 'museEvent') { + febs.modal.open('编辑','modules/clothesType/socialMuseUpdate/' + data.id, { + btn: ['提交', '取消'], + area: ['100%', '100%'], + yes: function (index, layero) { + $('#febs-sc-muse').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + } + }); + + form.on('switch(scHotStateSwitch)', function (data) { + if (data.elem.checked) { + changeHotState(data.value,1); + } else { + changeHotState(data.value,0); + } + }) + function changeHotState(id,state) { + febs.get(ctx + 'admin/clothesType/socialHotState/' + id+'/' + state, null, function (data) { + febs.alert.success(data.message); + $query.click(); + }); + } + + form.on('switch(scStateSwitch)', function (data) { + if (data.elem.checked) { + changeState(data.value,1); + } else { + changeState(data.value,0); + } + }) + function changeState(id,state) { + febs.get(ctx + 'admin/clothesType/socialState/' + id+'/' + state, null, function (data) { + febs.alert.success(data.message); + $query.click(); + }); + } + function delAct(id) { + febs.get(ctx + 'admin/clothesType/socialDelete/' + id, null, function (data) { + febs.alert.success(data.message); + $query.click(); + }); + } + + // 初始化表格操作栏各个按钮功能 + table.on('toolbar(scTable)', function (obj) { + let data = obj.data, + layEvent = obj.event; + console.log("触发事件:", obj.event); // 调试信息 + if(layEvent === 'scAdd'){ + febs.modal.open('新增', 'modules/clothesType/socialAdd/', { + btn: ['提交', '取消'], + area:['100%','100%'], + yes: function (index, layero) { + $('#febs-sc-add').find('#submit').trigger('click'); + }, + btn2: function () { + layer.closeAll(); + } + }); + } + }); + + function initClothesSocialTable() { + tableIns = febs.table.init({ + elem: $view.find('table'), + id: 'scTable', + url: ctx + 'admin/clothesType/socialList', + toolbar:"#scToolbar", + defaultToolbar:[], + cols: [[ + {type: 'numbers', title: '', width: 80}, + {title: '操作', toolbar: '#activityOption', minWidth: 200, align: 'center'}, + {field: 'name', title: '发布人', minWidth: 150,align:'left'}, + {field: 'socialTitle', title: '标题', minWidth: 150,align:'left'}, + {field: 'socialState', title: '状态', templet: '#scStateSwitch', minWidth: 130,align:'center'}, + {field: 'hotState', title: '显示首页', templet: '#scHotStateSwitch', minWidth: 130,align:'center'}, + {templet:"#socialDelFlagFormat", title: '是否删除', minWidth: 140,align:'left'}, + ]] + }); + } + + + // 查询按钮 + $query.on('click', function () { + var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); + tableIns.reload({where: params, page: {curr: 1}}); + }); + + // 刷新按钮 + $reset.on('click', function () { + $searchForm[0].reset(); + sortObject.type = 'null'; + tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); + }); + // 获取查询参数 + function getQueryParams() { + return { + name: $searchForm.find('input[name="name"]').val().trim(), + state: $searchForm.find("select[name='state']").val(), + categoryId: $searchForm.find("select[name='categoryId']").val(), + }; + } + + }) +</script> diff --git a/src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html b/src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html new file mode 100644 index 0000000..f155b26 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/clothesType/socialMuseUpdate.html @@ -0,0 +1,325 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-sc-muse" lay-title="内容编辑"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-fluid" id="sc-muse-update"> + <form class="layui-form" action="" lay-filter="sc-muse-update-form"> + <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> + <ul class="layui-tab-title"> + <li class="layui-this">基础信息</li> + </ul> + <div class="layui-tab-content"> + <div class="layui-tab-item layui-show"> + <blockquote class="layui-elem-quote blue-border">基础信息</blockquote> + <!-- 隐藏的 ID 项 --> + <div class="layui-form-item febs-hide"> + <label class="layui-form-label">ID:</label> + <div class="layui-input-block"> + <input type="text" name="id" autocomplete="off" class="layui-input"> + </div> + </div> + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">布料:</label> + <div class="layui-input-block"> + <div id="sc-cloth"></div> + </div> + </div> + </div> + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">图案:</label> + <div class="layui-input-block"> + <div id="sc-pattern"></div> + </div> + </div> + </div> + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">位置:</label> + <div class="layui-input-block"> + <div id="sc-location"></div> + </div> + </div> + </div> + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">尺码:</label> + <div class="layui-input-block"> + <div id="sc-size"></div> + </div> + </div> + </div> + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">工艺:</label> + <div class="layui-input-block"> + <div id="sc-art"></div> + </div> + </div> + </div> + + + </div> + </div> + </div> + <div class="layui-form-item febs-hide"> + <button class="layui-btn" lay-submit="" lay-filter="sc-muse-update-form-submit" id="submit">保存</button> + </div> + </form> + </div> + </div> + </div> +</div> +<style> + .blue-border { + border-left-color: #2db7f5; + font-size: 18px; + } +</style> +<script type="text/html" id="toolbar"> + <div class="layui-btn-container"> + <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="delSku">删除</button> + </div> +</script> +<!-- 表格操作栏 end --> +<script data-th-inline="javascript"> + layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect'], function () { + var $ = layui.jquery, + febs = layui.febs, + layer = layui.layer, + table = layui.table, + formSelects = layui.formSelects, + treeSelect = layui.treeSelect, + form = layui.form, + laydate = layui.laydate, + eleTree = layui.eleTree, + $view = $('#sc-muse-update'), + layedit = layui.layedit, + socialMuse = [[${socialMuse}]], + upload = layui.upload, + validate = layui.validate, + element = layui.element; + + + formSelects.render(); + + let scArt = xmSelect.render({ + el: '#sc-art', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allArt/' + socialMuse.typeId, null, function(res) { + scArt.update({ + data : res.data, + autoRow: true, + }); + }) + + let scSize = xmSelect.render({ + el: '#sc-size', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allSize/' + socialMuse.typeId, null, function(res) { + scSize.update({ + data : res.data, + autoRow: true, + }); + }) + + let scLocation = xmSelect.render({ + el: '#sc-location', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allLocation/' + socialMuse.typeId, null, function(res) { + scLocation.update({ + data : res.data, + autoRow: true, + }); + }) + + let scPattern = xmSelect.render({ + el: '#sc-pattern', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allPattern/' + socialMuse.typeId, null, function(res) { + scPattern.update({ + data : res.data, + autoRow: true, + }); + }) + + let scCloth = xmSelect.render({ + el: '#sc-cloth', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allCloth/' + socialMuse.typeId, null, function(res) { + scCloth.update({ + data : res.data, + autoRow: true, + }); + + + setTimeout(() => { + initSocialUpdateValue(); + }, 500); + }) + + function initSocialUpdateValue() { + if (!socialMuse) { + console.warn("数据为空,无法初始化表单!"); + return; + } + + form.val("sc-muse-update-form", { + "id": socialMuse.id, + }); + + var artList = []; + artList.push(socialMuse.artId); + scArt.setValue(artList); + + var sizeList = []; + sizeList.push(socialMuse.sizeId); + scSize.setValue(sizeList); + + var patternList = []; + patternList.push(socialMuse.patternId); + scPattern.setValue(patternList); + + var clothList = []; + clothList.push(socialMuse.clothId); + scCloth.setValue(clothList); + + var locationList = []; + locationList.push(socialMuse.locationId); + scLocation.setValue(locationList); + + } + + + + form.on('submit(sc-muse-update-form-submit)', function (data) { + data.field.artId = scArt.getValue('valueStr'); + data.field.sizeId = scSize.getValue('valueStr'); + data.field.patternId = scPattern.getValue('valueStr'); + data.field.locationId = scLocation.getValue('valueStr'); + data.field.clothId = scCloth.getValue('valueStr'); + $.ajax({ + 'url':ctx + 'admin/clothesType/socialMuseUpdate', + 'type':'post', + 'dataType':'json', + 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 + 'traditional': true,//ajax传递数组必须添加属性 + 'data':JSON.stringify(data.field), + 'success':function (data) { + if(data.code==200){ + layer.closeAll(); + febs.alert.success(data.message); + $('#febs-sc').find('#query').click(); + }else{ + febs.alert.warn(data.message); + } + }, + 'error':function () { + febs.alert.warn('服务器繁忙'); + } + }) + return false; + }); + + }); +</script> diff --git a/src/main/resources/templates/febs/views/modules/clothesType/socialUpdate.html b/src/main/resources/templates/febs/views/modules/clothesType/socialUpdate.html new file mode 100644 index 0000000..bce9727 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/clothesType/socialUpdate.html @@ -0,0 +1,429 @@ +<div class="layui-fluid layui-anim febs-anim" id="febs-sc-discount" lay-title="内容编辑"> + <div class="layui-row febs-container"> + <div class="layui-col-md12"> + <div class="layui-fluid" id="sc-discount-update"> + <form class="layui-form" action="" lay-filter="sc-discount-update-form"> + <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> + <ul class="layui-tab-title"> + <li class="layui-this">基础信息</li> + </ul> + <div class="layui-tab-content"> + <div class="layui-tab-item layui-show"> + <blockquote class="layui-elem-quote blue-border">基础信息</blockquote> + <!-- 隐藏的 ID 项 --> + <div class="layui-form-item febs-hide"> + <label class="layui-form-label">ID:</label> + <div class="layui-input-block"> + <input type="text" name="id" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">分类:</label> + <div class="layui-input-block"> + <div id="sc-group"></div> + </div> + </div> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">发布人:</label> + <div class="layui-input-block"> + <div id="sc-member"></div> + <div class="layui-form-mid layui-word-aux">数据来源:会员管理-会员列表中设置成核销员</div> + </div> + </div> + </div> + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">设计类型:</label> + <div class="layui-input-block"> + <div id="sc-type"></div> + <div class="layui-form-mid layui-word-aux">数据来源:衣服设计库-设计类型</div> + </div> + </div> + </div> + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">封面:</label> + <div class="layui-input-block"> + <div class="layui-upload"> + <button type="button" class="layui-btn layui-btn-normal layui-btn" id="test1Max">上传</button> + <div class="layui-form-mid layui-word-aux"> + 上传图片、视频或者音频文件大小不超过100M。 + 图片:"bmp", "gif", "jpg", "jpeg", "png", + 视频格式:"mp4", "avi", + 音频:"mp3", "wav" , "ogg"。 + </div> + </div> + </div> + </div> + </div> + + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label">封面链接:</label> + <div class="layui-input-block"> + <input type="text" id="indexFile" lay-verify="required" name="indexFile" autocomplete="off" class="layui-input" readonly> + </div> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label febs-form-item-require">轮播图:</label> + <div class="layui-input-block"> + <div class="layui-upload"> + <button type="button" + class="layui-btn layui-btn-normal layui-btn" + id="thumbsBanner">上传 + </button> + <blockquote class="layui-elem-quote layui-quote-nm" + style="margin-top: 10px;"> + <div class="layui-upload-list" id="thumbsBanners"></div> + </blockquote> + <div class="layui-word-aux">双击图片删除</div> + </div> + </div> + </div> + + <div class="layui-form-item febs-hide"> + <label class="layui-form-label">缩略图链接:</label> + <div class="layui-input-block"> + <input type="text" id="thumbs" lay-verify="required" name="thumbs" + autoComplete="off" class="layui-input" readOnly> + </div> + </div> + <div class="layui-row layui-col-space10 layui-form-item"> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">排序:</label> + <div class="layui-input-block"> + <input type="text" name="orderCnt" lay-verify="required" + placeholder="" autocomplete="off" class="layui-input"> + </div> + </div> + <div class="layui-col-lg6"> + <label class="layui-form-label febs-form-item-require">标题:</label> + <div class="layui-input-block"> + <input type="text" name="name" lay-verify="required" + placeholder="" autocomplete="off" class="layui-input"> + </div> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label febs-form-item-require">内容:</label> + <div class="layui-input-block"> + <div style="border: 1px solid #ccc;"> + <div id="toolbar-container" class="toolbar"></div> + <div id="text-container" class="text" style="height: 450px;"></div> + </div> + </div> + </div> + + </div> + </div> + </div> + <div class="layui-form-item febs-hide"> + <button class="layui-btn" lay-submit="" lay-filter="sc-discount-update-form-submit" id="submit">保存</button> + </div> + </form> + </div> + </div> + </div> +</div> +<style> + .blue-border { + border-left-color: #2db7f5; + font-size: 18px; + } +</style> +<script type="text/html" id="toolbar"> + <div class="layui-btn-container"> + <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="delSku">删除</button> + </div> +</script> +<!-- 表格操作栏 end --> +<script data-th-inline="javascript"> + layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect'], function () { + var $ = layui.jquery, + febs = layui.febs, + layer = layui.layer, + table = layui.table, + formSelects = layui.formSelects, + treeSelect = layui.treeSelect, + form = layui.form, + laydate = layui.laydate, + eleTree = layui.eleTree, + $view = $('#sc-discount-update'), + layedit = layui.layedit, + activity = [[${activity}]], + upload = layui.upload, + validate = layui.validate, + element = layui.element; + + + const E = window.wangEditor; + const editor = new E('#toolbar-container', '#text-container'); // 传入两个元素 + editor.config.showLinkImg = false; + editor.config.uploadFileName = 'file'; + editor.config.customUploadImg = function (files, insertImgFn) { + // files 是 input 中选中的文件列表 + // insertImgFn 是获取图片 url 后,插入到编辑器的方法 + // 上传图片,返回结果,将图片插入到编辑器中 + for (let i = 0; i < files.length; i++){ + var form = new FormData(); + form.append("file", files[0]); + $.ajax({ + url:'/admin/goods/uploadFileBase64', + type: "post", + processData: false, + contentType: false, + data: form, + dataType: 'json', + success(res) { + // 上传代码返回结果之后,将图片插入到编辑器中 + insertImgFn(res.data.src, res.data.title, '') + } + }) + } + }; + editor.create(); + + formSelects.render(); + + let scGroup = xmSelect.render({ + el: '#sc-group', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }); + + febs.get(ctx + 'admin/clothesType/allGroup', null, function(res) { + scGroup.update({ + data : res.data, + autoRow: true, + }); + }); + + let scType = xmSelect.render({ + el: '#sc-type', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }) + + febs.get(ctx + 'admin/clothesType/allType', null, function(res) { + scType.update({ + data : res.data, + autoRow: true, + }); + }) + + + let scMember = xmSelect.render({ + el: '#sc-member', + language: 'zn', + prop : { + value : 'id', + children : 'child' + }, + iconfont: { + parent: 'hidden', + }, + tips: '请选择', + filterable: true, + radio: true, + clickClose: true, + tree: { + show: true, + //非严格模式 + strict: false, + }, + data: [] + }); + + febs.get(ctx + 'admin/socialCircle/allMember', null, function(res) { + scMember.update({ + data : res.data, + autoRow: true, + }); + setTimeout(() => { + initSocialUpdateValue(); + }, 500); + }); + + //图片上传 + upload.render({ + elem: '#test1Max' + ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 + ,accept: 'file' //普通文件 + ,size: 10240 //限制文件大小,单位 KB + ,before: function(obj){ + } + ,done: function(res){ + $("#indexFile").val(res.data.src); + } + }); + + //多图片上传 + upload.render({ + elem: '#thumbsBanner' + ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 + ,multiple: true + ,before: function(obj){ + //预读本地文件示例,不支持ie8 + obj.preview(function(index, file, result){ + $('#thumbsBanners').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img multi-images" style="width: 130px">') + }); + } + ,done: function(res){ + var thumbs = $("#thumbs").val(); + if(thumbs == ''){ + $("#thumbs").val(res.data.src); + }else{ + $("#thumbs").val(thumbs + ',' + res.data.src); + } + + imgUnBind(".multi-images"); + imgMultiBind(); + } + }); + + function imgUnBind(className) { + $(className).each(function() { + $(this).unbind('dblclick'); + }) + } + + function imgMultiBind() { + $(".multi-images").each(function(index, element) { + $(this).on("dblclick", function() { + var imgThumb = $(".multi-images")[index]; + $(imgThumb).remove(); + + var images = $("#thumbs").val(); + var imagesArr; + if (images) { + imagesArr = images.split(","); + imagesArr.splice(index, 1); + images = imagesArr.join(","); + } + $("#thumbs").val(images); + + imgUnBind(".multi-images"); + imgMultiBind(); + }); + }) + } + + function initSocialUpdateValue() { + if (!activity) { + console.warn("数据为空,无法初始化表单!"); + return; + } + + var images = activity.images; + + var thumbs = ""; + if (images) { + thumbs = images.join(","); + for (let i = 0; i < images.length; i++) { + $('#thumbsBanners').append('<img src="' + images[i] + '" alt="" class="layui-upload-img multi-images" style="width: 130px">') + } + } + + form.val("sc-discount-update-form", { + "id": activity.id, + "name": activity.name, + "orderCnt": activity.orderCnt, + "indexFile": activity.indexFile, + "thumbs": thumbs + }); + + var arr = []; + arr.push(activity.categoryId); + scGroup.setValue(arr); + + var scMemberList = []; + scMemberList.push(activity.memberId); + scMember.setValue(scMemberList); + + var scTypeList = []; + scTypeList.push(activity.typeId); + scType.setValue(scTypeList); + + editor.txt.html(activity.content); + + if (activity.isNormal == 2) { + $(".tc-set").show(); + } + } + + + + form.on('submit(sc-discount-update-form-submit)', function (data) { + data.field.categoryId = scGroup.getValue('valueStr'); + data.field.memberId = scMember.getValue('valueStr'); + data.field.typeId = scType.getValue('valueStr'); + data.field.content = editor.txt.html(); + $.ajax({ + 'url':ctx + 'admin/clothesType/socialUpdate', + 'type':'post', + 'dataType':'json', + 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 + 'traditional': true,//ajax传递数组必须添加属性 + 'data':JSON.stringify(data.field), + 'success':function (data) { + if(data.code==200){ + layer.closeAll(); + febs.alert.success(data.message); + $('#febs-sc').find('#reset').click(); + }else{ + febs.alert.warn(data.message); + } + }, + 'error':function () { + febs.alert.warn('服务器繁忙'); + } + }) + return false; + }); + + form.on('select(goods-type-select)', function(data){ + $('.tc-set').each(function() { + if (data.value == 2) { + $(this).show(); + } else { + $(this).hide(); + } + }) + }); + }); +</script> -- Gitblit v1.9.1