diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxUserRemark.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxUserRemark.java new file mode 100644 index 0000000..ec54102 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxUserRemark.java @@ -0,0 +1,85 @@ +package com.flossom.common.core.domain.entity; + +import com.flossom.common.core.annotation.Excel; +import com.flossom.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 微信用户备注列对象 wx_user_remark + * + * @author flossom + * @date 2023-12-21 + */ +public class WxUserRemark extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 微信用户id + */ + @Excel(name = "微信用户id") + private Long userId; + + /** + * 备注内容 + */ + @Excel(name = "备注内容") + private String content; + + /** + * 状态(0正常 1停用) + */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private Integer status; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Long getUserId() { + return userId; + } + + public void setContent(String content) { + this.content = content; + } + + public String getContent() { + return content; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Integer getStatus() { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("userId", getUserId()) + .append("content", getContent()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxUserRemarkReq.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxUserRemarkReq.java new file mode 100644 index 0000000..59b0733 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxUserRemarkReq.java @@ -0,0 +1,53 @@ +package com.flossom.common.core.domain.req; + +import com.flossom.common.core.web.domain.BaseEntity; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * 微信用户备注列对象 wx_user_remark + * + * @author flossom + * @date 2023-12-21 + */ +public class WxUserRemarkReq { + + /** + * 微信用户id列表 + */ + private List userIdList; + + /** + * 备注内容 + */ + @NotBlank(message = "请输入备注") + @Length(min = 0, max = 100, message = "备注内容不能为空") + private String content; + + + public WxUserRemarkReq() { + } + + public WxUserRemarkReq(List userIdList, String content) { + this.userIdList = userIdList; + this.content = content; + } + + public List getUserIdList() { + return userIdList; + } + + public void setUserIdList(List userIdList) { + this.userIdList = userIdList; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/enums/Status.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/enums/Status.java index 3d66a77..97d3c53 100644 --- a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/enums/Status.java +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/enums/Status.java @@ -7,18 +7,18 @@ package com.flossom.common.core.enums; */ public enum Status { - OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); + OK(0, "正常"), DISABLE(1, "停用"), DELETED(2, "删除"); - private final String code; + private final Integer code; private final String info; - Status(String code, String info) + Status(Integer code, String info) { this.code = code; this.info = info; } - public String getCode() + public Integer getCode() { return code; } diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxUserRemarkMapper.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxUserRemarkMapper.java new file mode 100644 index 0000000..fc52bc1 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxUserRemarkMapper.java @@ -0,0 +1,61 @@ +package com.flossom.common.core.mapper; + +import com.flossom.common.core.domain.entity.WxUserRemark; + +import java.util.List; + +/** + * 微信用户备注列Mapper接口 + * + * @author flossom + * @date 2023-12-21 + */ +public interface WxUserRemarkMapper { + /** + * 查询微信用户备注列 + * + * @param id 微信用户备注列主键 + * @return 微信用户备注列 + */ + public WxUserRemark selectWxUserRemarkById(Long id); + + /** + * 查询微信用户备注列列表 + * + * @param wxUserRemark 微信用户备注列 + * @return 微信用户备注列集合 + */ + public List selectWxUserRemarkList(WxUserRemark wxUserRemark); + + /** + * 新增微信用户备注列 + * + * @param wxUserRemark 微信用户备注列 + * @return 结果 + */ + public int insertWxUserRemark(WxUserRemark wxUserRemark); + + /** + * 修改微信用户备注列 + * + * @param wxUserRemark 微信用户备注列 + * @return 结果 + */ + public int updateWxUserRemark(WxUserRemark wxUserRemark); + + /** + * 删除微信用户备注列 + * + * @param id 微信用户备注列主键 + * @return 结果 + */ + public int deleteWxUserRemarkById(Long id); + + /** + * 批量删除微信用户备注列 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWxUserRemarkByIds(Long[] ids); +} diff --git a/flossom-common/flossom-common-core/src/main/resources/mapper/WxUserRemarkMapper.xml b/flossom-common/flossom-common-core/src/main/resources/mapper/WxUserRemarkMapper.xml new file mode 100644 index 0000000..fea7d45 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/resources/mapper/WxUserRemarkMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + select id, user_id, content, status, create_by, create_time, update_by, update_time from wx_user_remark + + + + + + + + insert into wx_user_remark + + user_id, + content, + status, + create_by, + create_time, + update_by, + update_time, + + + #{userId}, + #{content}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wx_user_remark + + user_id = #{userId}, + content = #{content}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from wx_user_remark where id = #{id} + + + + delete from wx_user_remark where id in + + #{id} + + + \ No newline at end of file diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxUserRemarkController.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxUserRemarkController.java new file mode 100644 index 0000000..ae0efeb --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxUserRemarkController.java @@ -0,0 +1,107 @@ +package com.flossom.system.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import com.flossom.common.core.domain.R; +import com.flossom.common.core.domain.entity.WxUserRemark; +import com.flossom.common.core.domain.req.WxUserIntegralVm; +import com.flossom.common.core.domain.req.WxUserRemarkReq; +import com.flossom.common.core.enums.IntegralChangeTypeEnum; +import com.flossom.common.core.exception.ServiceException; +import com.flossom.common.core.utils.poi.ExcelUtil; +import com.flossom.common.core.web.controller.BaseController; +import com.flossom.common.core.web.domain.AjaxResult; +import com.flossom.common.core.web.page.TableDataInfo; +import com.flossom.common.log.annotation.Log; +import com.flossom.common.log.enums.BusinessType; +import com.flossom.common.security.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import com.flossom.system.service.IWxUserRemarkService; + +/** + * 微信用户备注列Controller + * + * @author flossom + * @date 2023-12-21 + */ +@RestController +@RequestMapping("/wxUserRemark") +public class WxUserRemarkController extends BaseController { + @Autowired + private IWxUserRemarkService wxUserRemarkService; + + /** + * 查询微信用户备注列列表 + */ + @RequiresPermissions("system:wxUserRemark:list") + @GetMapping("/list") + public TableDataInfo list(WxUserRemark wxUserRemark) { + startPage(); + List list = wxUserRemarkService.selectWxUserRemarkList(wxUserRemark); + return getDataTable(list); + } + + /** + * 导出微信用户备注列列表 + */ + @RequiresPermissions("system:wxUserRemark:export") + @Log(title = "微信用户备注列", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WxUserRemark wxUserRemark) { + List list = wxUserRemarkService.selectWxUserRemarkList(wxUserRemark); + ExcelUtil util = new ExcelUtil(WxUserRemark.class); + util.exportExcel(response, list, "微信用户备注列数据"); + } + + /** + * 获取微信用户备注列详细信息 + */ + @RequiresPermissions("system:wxUserRemark:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(wxUserRemarkService.selectWxUserRemarkById(id)); + } + + /** + * 新增微信用户备注列 + */ + @RequiresPermissions("system:wxUserRemark:add") + @Log(title = "微信用户备注列", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WxUserRemark wxUserRemark) { + return toAjax(wxUserRemarkService.insertWxUserRemark(wxUserRemark)); + } + + /** + * 修改微信用户备注列 + */ + @RequiresPermissions("system:wxUserRemark:edit") + @Log(title = "微信用户备注列", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WxUserRemark wxUserRemark) { + return toAjax(wxUserRemarkService.updateWxUserRemark(wxUserRemark)); + } + + /** + * 删除微信用户备注列 + */ + @RequiresPermissions("system:wxUserRemark:remove") + @Log(title = "微信用户备注列", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(wxUserRemarkService.deleteWxUserRemarkByIds(ids)); + } + + /** + * 批量 添加备注 + */ + @PostMapping("/batchAddRemark") + public R batchAddRemark(@RequestBody @Validated WxUserRemarkReq wxUserRemarkReq) { + wxUserRemarkService.batchAddRemark(wxUserRemarkReq); + return R.ok(); + } +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxUserRemarkService.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxUserRemarkService.java new file mode 100644 index 0000000..f3de232 --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxUserRemarkService.java @@ -0,0 +1,64 @@ +package com.flossom.system.service; + +import com.flossom.common.core.domain.entity.WxUserRemark; +import com.flossom.common.core.domain.req.WxUserRemarkReq; + +import java.util.List; + +/** + * 微信用户备注列Service接口 + * + * @author flossom + * @date 2023-12-21 + */ +public interface IWxUserRemarkService { + /** + * 查询微信用户备注列 + * + * @param id 微信用户备注列主键 + * @return 微信用户备注列 + */ + public WxUserRemark selectWxUserRemarkById(Long id); + + /** + * 查询微信用户备注列列表 + * + * @param wxUserRemark 微信用户备注列 + * @return 微信用户备注列集合 + */ + public List selectWxUserRemarkList(WxUserRemark wxUserRemark); + + /** + * 新增微信用户备注列 + * + * @param wxUserRemark 微信用户备注列 + * @return 结果 + */ + public int insertWxUserRemark(WxUserRemark wxUserRemark); + + /** + * 修改微信用户备注列 + * + * @param wxUserRemark 微信用户备注列 + * @return 结果 + */ + public int updateWxUserRemark(WxUserRemark wxUserRemark); + + /** + * 批量删除微信用户备注列 + * + * @param ids 需要删除的微信用户备注列主键集合 + * @return 结果 + */ + public int deleteWxUserRemarkByIds(Long[] ids); + + /** + * 删除微信用户备注列信息 + * + * @param id 微信用户备注列主键 + * @return 结果 + */ + public int deleteWxUserRemarkById(Long id); + + void batchAddRemark(WxUserRemarkReq wxUserRemarkReq); +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxUserRemarkServiceImpl.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxUserRemarkServiceImpl.java new file mode 100644 index 0000000..bf847cb --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxUserRemarkServiceImpl.java @@ -0,0 +1,122 @@ +package com.flossom.system.service.impl; + +import java.util.List; +import java.util.stream.Collectors; + +import com.flossom.common.core.domain.entity.WxUserRemark; +import com.flossom.common.core.domain.req.WxUserRemarkReq; +import com.flossom.common.core.enums.Status; +import com.flossom.common.core.mapper.WxUserMemberMapper; +import com.flossom.common.core.mapper.WxUserRemarkMapper; +import com.flossom.common.core.utils.DateUtils; +import com.flossom.common.security.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.flossom.system.service.IWxUserRemarkService; + +/** + * 微信用户备注列Service业务层处理 + * + * @author flossom + * @date 2023-12-21 + */ +@Service +public class WxUserRemarkServiceImpl implements IWxUserRemarkService { + + @Autowired + private WxUserRemarkMapper wxUserRemarkMapper; + + @Autowired + private WxUserMemberMapper wxUserMemberMapper; + + /** + * 查询微信用户备注列 + * + * @param id 微信用户备注列主键 + * @return 微信用户备注列 + */ + @Override + public WxUserRemark selectWxUserRemarkById(Long id) { + return wxUserRemarkMapper.selectWxUserRemarkById(id); + } + + /** + * 查询微信用户备注列列表 + * + * @param wxUserRemark 微信用户备注列 + * @return 微信用户备注列 + */ + @Override + public List selectWxUserRemarkList(WxUserRemark wxUserRemark) { + return wxUserRemarkMapper.selectWxUserRemarkList(wxUserRemark); + } + + /** + * 新增微信用户备注列 + * + * @param wxUserRemark 微信用户备注列 + * @return 结果 + */ + @Override + public int insertWxUserRemark(WxUserRemark wxUserRemark) { + wxUserRemark.setCreateTime(DateUtils.getNowDate()); + return wxUserRemarkMapper.insertWxUserRemark(wxUserRemark); + } + + /** + * 修改微信用户备注列 + * + * @param wxUserRemark 微信用户备注列 + * @return 结果 + */ + @Override + public int updateWxUserRemark(WxUserRemark wxUserRemark) { + wxUserRemark.setUpdateTime(DateUtils.getNowDate()); + return wxUserRemarkMapper.updateWxUserRemark(wxUserRemark); + } + + /** + * 批量删除微信用户备注列 + * + * @param ids 需要删除的微信用户备注列主键 + * @return 结果 + */ + @Override + public int deleteWxUserRemarkByIds(Long[] ids) { + return wxUserRemarkMapper.deleteWxUserRemarkByIds(ids); + } + + /** + * 删除微信用户备注列信息 + * + * @param id 微信用户备注列主键 + * @return 结果 + */ + @Override + public int deleteWxUserRemarkById(Long id) { + return wxUserRemarkMapper.deleteWxUserRemarkById(id); + } + + @Override + public void batchAddRemark(WxUserRemarkReq wxUserRemarkReq) { + if (wxUserRemarkReq.getUserIdList() == null || wxUserRemarkReq.getUserIdList().size() == 0) { + List userIdList = wxUserMemberMapper.selectWxUserMemberIdList(); + if (userIdList != null && userIdList.size() > 0) { + List collect = userIdList.stream().map(Integer::longValue).collect(Collectors.toList()); + wxUserRemarkReq.setUserIdList(collect); + } + } + + if (wxUserRemarkReq.getUserIdList() != null && wxUserRemarkReq.getUserIdList().size() > 0) { + WxUserRemark wxUserRemark = new WxUserRemark(); + for (Long userId : wxUserRemarkReq.getUserIdList()) { + wxUserRemark.setUserId(userId); + wxUserRemark.setContent(wxUserRemarkReq.getContent()); + wxUserRemark.setStatus(Status.OK.getCode()); + wxUserRemark.setCreateTime(DateUtils.getNowDate()); +// wxUserRemark.setCreateBy(SecurityUtils.getUsername()); + wxUserRemarkMapper.insertWxUserRemark(wxUserRemark); + } + } + } +}