diff --git a/vetti-admin/src/main/java/com/vetti/web/controller/hotake/HotakeNotificationPreferencesController.java b/vetti-admin/src/main/java/com/vetti/web/controller/hotake/HotakeNotificationPreferencesController.java new file mode 100644 index 0000000..fa5077b --- /dev/null +++ b/vetti-admin/src/main/java/com/vetti/web/controller/hotake/HotakeNotificationPreferencesController.java @@ -0,0 +1,105 @@ +package com.vetti.web.controller.hotake; + +import com.vetti.common.annotation.Log; +import com.vetti.common.core.controller.BaseController; +import com.vetti.common.core.domain.R; +import com.vetti.common.core.page.TableWebDataInfo; +import com.vetti.common.enums.BusinessType; +import com.vetti.hotake.domain.HotakeNotificationPreferences; +import com.vetti.hotake.service.IHotakeNotificationPreferencesService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 用户通知偏好设置Controller + * + * @author vetti + * @date 2026-02-01 + */ +@Api(tags = "用户通知偏好设置") +@RestController +@RequestMapping("/hotake/notificationPreferences") +public class HotakeNotificationPreferencesController extends BaseController { + @Autowired + private IHotakeNotificationPreferencesService hotakeNotificationPreferencesService; + + /** + * 查询用户通知偏好设置列表 + */ + @ApiOperation("查询用户通知偏好设置列表(分页)") + @GetMapping("/getPagelist") + public TableWebDataInfo list(HotakeNotificationPreferences hotakeNotificationPreferences) { + startPage(); + hotakeNotificationPreferences.setCreateBy(getUsername()); + List list = hotakeNotificationPreferencesService.selectHotakeNotificationPreferencesList(hotakeNotificationPreferences); + return getWebDataTable(list); + } + + /** + * 查询用户通知偏好设置列表 + */ + @ApiOperation("查询用户通知偏好设置列表(无分页)") + @GetMapping("/getList") + public R> getList(HotakeNotificationPreferences hotakeNotificationPreferences) { + hotakeNotificationPreferences.setCreateBy(getUsername()); + List list = hotakeNotificationPreferencesService.selectHotakeNotificationPreferencesList(hotakeNotificationPreferences); + return R.ok(list, ""); + } + + /** + * 获取用户通知偏好设置详细信息 + */ + @ApiOperation("获取用户通知偏好设置详细信息") + @GetMapping(value = "/{id}") + public R getInfo(@ApiParam("设置ID") @PathVariable("id") Long id) { + return R.ok(hotakeNotificationPreferencesService.selectHotakeNotificationPreferencesById(id), ""); + } + + /** + * 新增用户通知偏好设置 + */ + @ApiOperation("新增用户通知偏好设置") + @Log(title = "用户通知偏好设置", businessType = BusinessType.INSERT) + @PostMapping + public R add(@RequestBody HotakeNotificationPreferences hotakeNotificationPreferences) { + return R.ok(hotakeNotificationPreferencesService.insertHotakeNotificationPreferences(hotakeNotificationPreferences)); + } + + /** + * 修改用户通知偏好设置 + */ + @ApiOperation("修改用户通知偏好设置") + @Log(title = "用户通知偏好设置", businessType = BusinessType.UPDATE) + @PutMapping + public R edit(@RequestBody HotakeNotificationPreferences hotakeNotificationPreferences) { + return R.ok(hotakeNotificationPreferencesService.updateHotakeNotificationPreferences(hotakeNotificationPreferences)); + } + + /** + * 删除用户通知偏好设置 + */ + @ApiOperation("删除用户通知偏好设置") + @Log(title = "用户通知偏好设置", businessType = BusinessType.DELETE) + @DeleteMapping("/{id}") + public R remove(@PathVariable Long id) { + return R.ok(hotakeNotificationPreferencesService.deleteHotakeNotificationPreferencesById(id)); + } + + /** + * 获取当前登录用户的通知偏好设置 + * 如果不存在则自动创建默认设置 + */ + @ApiOperation("获取当前登录用户的通知偏好设置") + @GetMapping("/getCurrentUser") + public R getCurrentUserPreferences() { + String username = getUsername(); + HotakeNotificationPreferences preferences = hotakeNotificationPreferencesService.getCurrentUserPreferences(username); + return R.ok(preferences, ""); + } + +} diff --git a/vetti-hotakes/src/main/java/com/vetti/hotake/domain/HotakeNotificationPreferences.java b/vetti-hotakes/src/main/java/com/vetti/hotake/domain/HotakeNotificationPreferences.java new file mode 100644 index 0000000..7616b31 --- /dev/null +++ b/vetti-hotakes/src/main/java/com/vetti/hotake/domain/HotakeNotificationPreferences.java @@ -0,0 +1,65 @@ +package com.vetti.hotake.domain; + +import com.vetti.common.annotation.Excel; +import com.vetti.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 用户通知偏好设置对象 hotake_notification_preferences + * + * @author vetti + * @date 2026-02-01 + */ +@Data +@Accessors(chain = true) +public class HotakeNotificationPreferences extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + @ApiModelProperty("主键ID") + private Long id; + + /** 职位提醒:新职位机会通知 (0-关闭, 1-开启) */ + @ApiModelProperty("职位提醒:新职位机会通知 (0-关闭, 1-开启)") + @Excel(name = "职位提醒") + private Integer emailJobAlerts; + + /** 申请更新:职位申请状态更新 (0-关闭, 1-开启) */ + @ApiModelProperty("申请更新:职位申请状态更新 (0-关闭, 1-开启)") + @Excel(name = "申请更新") + private Integer emailApplicationUpdates; + + /** AI匹配建议:基于个人资料的强匹配职位推荐 (0-关闭, 1-开启) */ + @ApiModelProperty("AI匹配建议:基于个人资料的强匹配职位推荐 (0-关闭, 1-开启)") + @Excel(name = "AI匹配建议") + private Integer emailAiMatchSuggestions; + + /** 新闻简报:每周职业技巧和行业新闻 (0-关闭, 1-开启) */ + @ApiModelProperty("新闻简报:每周职业技巧和行业新闻 (0-关闭, 1-开启)") + @Excel(name = "新闻简报") + private Integer emailNewsletter; + + /** 新消息:收到新消息时通知 (0-关闭, 1-开启) */ + @ApiModelProperty("新消息:收到新消息时通知 (0-关闭, 1-开启)") + @Excel(name = "新消息") + private Integer pushNewMessages; + + /** 面试提醒:即将到来的面试提醒 (0-关闭, 1-开启) */ + @ApiModelProperty("面试提醒:即将到来的面试提醒 (0-关闭, 1-开启)") + @Excel(name = "面试提醒") + private Integer pushInterviewReminders; + + /** 营销邮件:促销内容和特别优惠 (0-关闭, 1-开启) */ + @ApiModelProperty("营销邮件:促销内容和特别优惠 (0-关闭, 1-开启)") + @Excel(name = "营销邮件") + private Integer mailMarketingEmails; + + /** 合作伙伴优惠:来自可信合作伙伴的机会 (0-关闭, 1-开启) */ + @ApiModelProperty("合作伙伴优惠:来自可信合作伙伴的机会 (0-关闭, 1-开启)") + @Excel(name = "合作伙伴优惠") + private Integer mailPartnerOffers; + +} diff --git a/vetti-hotakes/src/main/java/com/vetti/hotake/mapper/HotakeNotificationPreferencesMapper.java b/vetti-hotakes/src/main/java/com/vetti/hotake/mapper/HotakeNotificationPreferencesMapper.java new file mode 100644 index 0000000..b15629f --- /dev/null +++ b/vetti-hotakes/src/main/java/com/vetti/hotake/mapper/HotakeNotificationPreferencesMapper.java @@ -0,0 +1,61 @@ +package com.vetti.hotake.mapper; + +import java.util.List; +import com.vetti.hotake.domain.HotakeNotificationPreferences; + +/** + * 用户通知偏好设置Mapper接口 + * + * @author vetti + * @date 2026-02-01 + */ +public interface HotakeNotificationPreferencesMapper +{ + /** + * 查询用户通知偏好设置 + * + * @param id 用户通知偏好设置主键 + * @return 用户通知偏好设置 + */ + public HotakeNotificationPreferences selectHotakeNotificationPreferencesById(Long id); + + /** + * 查询用户通知偏好设置列表 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 用户通知偏好设置集合 + */ + public List selectHotakeNotificationPreferencesList(HotakeNotificationPreferences hotakeNotificationPreferences); + + /** + * 新增用户通知偏好设置 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 结果 + */ + public int insertHotakeNotificationPreferences(HotakeNotificationPreferences hotakeNotificationPreferences); + + /** + * 修改用户通知偏好设置 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 结果 + */ + public int updateHotakeNotificationPreferences(HotakeNotificationPreferences hotakeNotificationPreferences); + + /** + * 删除用户通知偏好设置 + * + * @param id 用户通知偏好设置主键 + * @return 结果 + */ + public int deleteHotakeNotificationPreferencesById(Long id); + + /** + * 批量删除用户通知偏好设置 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHotakeNotificationPreferencesByIds(Long[] ids); +} diff --git a/vetti-hotakes/src/main/java/com/vetti/hotake/service/IHotakeNotificationPreferencesService.java b/vetti-hotakes/src/main/java/com/vetti/hotake/service/IHotakeNotificationPreferencesService.java new file mode 100644 index 0000000..b48dccc --- /dev/null +++ b/vetti-hotakes/src/main/java/com/vetti/hotake/service/IHotakeNotificationPreferencesService.java @@ -0,0 +1,70 @@ +package com.vetti.hotake.service; + +import java.util.List; +import com.vetti.hotake.domain.HotakeNotificationPreferences; + +/** + * 用户通知偏好设置Service接口 + * + * @author vetti + * @date 2026-02-01 + */ +public interface IHotakeNotificationPreferencesService +{ + /** + * 查询用户通知偏好设置 + * + * @param id 用户通知偏好设置主键 + * @return 用户通知偏好设置 + */ + public HotakeNotificationPreferences selectHotakeNotificationPreferencesById(Long id); + + /** + * 查询用户通知偏好设置列表 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 用户通知偏好设置集合 + */ + public List selectHotakeNotificationPreferencesList(HotakeNotificationPreferences hotakeNotificationPreferences); + + /** + * 新增用户通知偏好设置 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 结果 + */ + public HotakeNotificationPreferences insertHotakeNotificationPreferences(HotakeNotificationPreferences hotakeNotificationPreferences); + + /** + * 修改用户通知偏好设置 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 结果 + */ + public HotakeNotificationPreferences updateHotakeNotificationPreferences(HotakeNotificationPreferences hotakeNotificationPreferences); + + /** + * 批量删除用户通知偏好设置 + * + * @param ids 需要删除的用户通知偏好设置主键集合 + * @return 结果 + */ + public int deleteHotakeNotificationPreferencesByIds(Long[] ids); + + /** + * 删除用户通知偏好设置信息 + * + * @param id 用户通知偏好设置主键 + * @return 结果 + */ + public int deleteHotakeNotificationPreferencesById(Long id); + + /** + * 获取当前登录用户的通知偏好设置 + * 如果不存在则自动创建默认设置 + * + * @param username 用户名 + * @return 用户通知偏好设置 + */ + public HotakeNotificationPreferences getCurrentUserPreferences(String username); +} diff --git a/vetti-hotakes/src/main/java/com/vetti/hotake/service/impl/HotakeNotificationPreferencesServiceImpl.java b/vetti-hotakes/src/main/java/com/vetti/hotake/service/impl/HotakeNotificationPreferencesServiceImpl.java new file mode 100644 index 0000000..e5fce4e --- /dev/null +++ b/vetti-hotakes/src/main/java/com/vetti/hotake/service/impl/HotakeNotificationPreferencesServiceImpl.java @@ -0,0 +1,137 @@ +package com.vetti.hotake.service.impl; + +import com.vetti.common.core.service.BaseServiceImpl; +import com.vetti.common.enums.FillTypeEnum; +import com.vetti.hotake.domain.HotakeNotificationPreferences; +import com.vetti.hotake.mapper.HotakeNotificationPreferencesMapper; +import com.vetti.hotake.service.IHotakeNotificationPreferencesService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 用户通知偏好设置Service业务层处理 + * + * @author vetti + * @date 2026-02-01 + */ +@Service +public class HotakeNotificationPreferencesServiceImpl extends BaseServiceImpl implements IHotakeNotificationPreferencesService { + + @Autowired + private HotakeNotificationPreferencesMapper hotakeNotificationPreferencesMapper; + + /** + * 查询用户通知偏好设置 + * + * @param id 用户通知偏好设置主键 + * @return 用户通知偏好设置 + */ + @Transactional(readOnly = true) + @Override + public HotakeNotificationPreferences selectHotakeNotificationPreferencesById(Long id) { + return hotakeNotificationPreferencesMapper.selectHotakeNotificationPreferencesById(id); + } + + /** + * 查询用户通知偏好设置列表 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 用户通知偏好设置 + */ + @Transactional(readOnly = true) + @Override + public List selectHotakeNotificationPreferencesList(HotakeNotificationPreferences hotakeNotificationPreferences) { + return hotakeNotificationPreferencesMapper.selectHotakeNotificationPreferencesList(hotakeNotificationPreferences); + } + + /** + * 新增用户通知偏好设置 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 结果 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public HotakeNotificationPreferences insertHotakeNotificationPreferences(HotakeNotificationPreferences hotakeNotificationPreferences) { + fill(FillTypeEnum.INSERT.getCode(), hotakeNotificationPreferences); + hotakeNotificationPreferencesMapper.insertHotakeNotificationPreferences(hotakeNotificationPreferences); + return hotakeNotificationPreferences; + } + + /** + * 修改用户通知偏好设置 + * + * @param hotakeNotificationPreferences 用户通知偏好设置 + * @return 结果 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public HotakeNotificationPreferences updateHotakeNotificationPreferences(HotakeNotificationPreferences hotakeNotificationPreferences) { + fill(FillTypeEnum.UPDATE.getCode(), hotakeNotificationPreferences); + hotakeNotificationPreferencesMapper.updateHotakeNotificationPreferences(hotakeNotificationPreferences); + return hotakeNotificationPreferences; + } + + /** + * 批量删除用户通知偏好设置 + * + * @param ids 需要删除的用户通知偏好设置主键 + * @return 结果 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int deleteHotakeNotificationPreferencesByIds(Long[] ids) { + return hotakeNotificationPreferencesMapper.deleteHotakeNotificationPreferencesByIds(ids); + } + + /** + * 删除用户通知偏好设置信息 + * + * @param id 用户通知偏好设置主键 + * @return 结果 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int deleteHotakeNotificationPreferencesById(Long id) { + return hotakeNotificationPreferencesMapper.deleteHotakeNotificationPreferencesById(id); + } + + /** + * 获取当前登录用户的通知偏好设置 + * 如果不存在则自动创建默认设置 + * + * @param username 用户名 + * @return 用户通知偏好设置 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public HotakeNotificationPreferences getCurrentUserPreferences(String username) { + // 查询当前用户的设置 + HotakeNotificationPreferences query = new HotakeNotificationPreferences(); + query.setCreateBy(username); + List list = hotakeNotificationPreferencesMapper.selectHotakeNotificationPreferencesList(query); + + // 如果存在,返回第一条 + if (list != null && !list.isEmpty()) { + return list.get(0); + } + + // 如果不存在,创建默认设置 + HotakeNotificationPreferences defaultPreferences = new HotakeNotificationPreferences(); + // 设置默认值(根据数据库表定义) + defaultPreferences.setEmailJobAlerts(1); // 默认开启 + defaultPreferences.setEmailApplicationUpdates(1); // 默认开启 + defaultPreferences.setEmailAiMatchSuggestions(0); // 默认关闭 + defaultPreferences.setEmailNewsletter(0); // 默认关闭 + defaultPreferences.setPushNewMessages(1); // 默认开启 + defaultPreferences.setPushInterviewReminders(1); // 默认开启 + defaultPreferences.setMailMarketingEmails(0); // 默认关闭 + defaultPreferences.setMailPartnerOffers(0); // 默认关闭 + + // 保存并返回 + return insertHotakeNotificationPreferences(defaultPreferences); + } +} diff --git a/vetti-hotakes/src/main/resources/mapper/hotake/HotakeNotificationPreferencesMapper.xml b/vetti-hotakes/src/main/resources/mapper/hotake/HotakeNotificationPreferencesMapper.xml new file mode 100644 index 0000000..3894a01 --- /dev/null +++ b/vetti-hotakes/src/main/resources/mapper/hotake/HotakeNotificationPreferencesMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, email_job_alerts, email_application_updates, email_ai_match_suggestions, + email_newsletter, push_new_messages, push_interview_reminders, + mail_marketing_emails, mail_partner_offers, + del_flag, create_by, create_time, update_by, update_time, remark + from hotake_notification_preferences + + + + + + + + insert into hotake_notification_preferences + + email_job_alerts, + email_application_updates, + email_ai_match_suggestions, + email_newsletter, + push_new_messages, + push_interview_reminders, + mail_marketing_emails, + mail_partner_offers, + del_flag, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{emailJobAlerts}, + #{emailApplicationUpdates}, + #{emailAiMatchSuggestions}, + #{emailNewsletter}, + #{pushNewMessages}, + #{pushInterviewReminders}, + #{mailMarketingEmails}, + #{mailPartnerOffers}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update hotake_notification_preferences + + email_job_alerts = #{emailJobAlerts}, + email_application_updates = #{emailApplicationUpdates}, + email_ai_match_suggestions = #{emailAiMatchSuggestions}, + email_newsletter = #{emailNewsletter}, + push_new_messages = #{pushNewMessages}, + push_interview_reminders = #{pushInterviewReminders}, + mail_marketing_emails = #{mailMarketingEmails}, + mail_partner_offers = #{mailPartnerOffers}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + + delete from hotake_notification_preferences where id = #{id} + + + + delete from hotake_notification_preferences where id in + + #{id} + + +