Commit 4208bd84 authored by “yiyousong”'s avatar “yiyousong”
parents 307e3916 d491caed
......@@ -86,8 +86,8 @@ public class SyncHolidayTaskImpl implements ITaskExcuteService {
holidayEntity.initAttrValue();
holidayEntity.setSiteId(1L);
holidayEntity.setStartTime(DateUtil.parseDateTime(date));
holidayEntity.setEndTime(DateUtil.parseDateTime(date));
holidayEntity.setStartTime(DateUtil.parseDate(date));
holidayEntity.setEndTime(DateUtil.parseDate(date));
holidayEntity.setYear(DateUtil.year(new Date()));
String name = "法定节假日(" + value1.get("name").toString() + ")";
......
......@@ -53,4 +53,12 @@ CREATE TABLE `mortals_xhx_user_model_collect` (
`modelIds` varchar(128) DEFAULT NULL COMMENT '收藏模块',
`createTime` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户模块收藏';
\ No newline at end of file
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户模块收藏';
-- ----------------------------
2023-10-10
-- ----------------------------
ALTER TABLE `mortals_xhx_user_model_collect`
ADD COLUMN `siteId` bigint(20) DEFAULT NULL COMMENT '站点ID';
UPDATE mortals_xhx_user_model_collect SET siteId=1;
\ No newline at end of file
package com.mortals.xhx.module.user.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.user.model.vo.UserModelCollectVo;
import lombok.Data;
/**
* 用户模块收藏实体对象
*
* @author zxfei
* @date 2023-08-29
*/
* 用户模块收藏实体对象
*
* @author zxfei
* @date 2023-10-10
*/
@Data
public class UserModelCollectEntity extends UserModelCollectVo {
private static final long serialVersionUID = 1L;
/**
* 用户ID,主键,自增长
*/
* 用户ID,主键,自增长
*/
private Long userId;
/**
* 登录名
*/
* 登录名
*/
private String realName;
/**
* 收藏模块
*/
* 收藏模块
*/
private String modelIds;
/**
* 站点id
*/
private Long siteId;
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -38,18 +37,16 @@ public class UserModelCollectEntity extends UserModelCollectVo {
if (obj instanceof UserModelCollectEntity) {
UserModelCollectEntity tmp = (UserModelCollectEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
return false;
}
public void initAttrValue(){
this.userId = -1L;
this.realName = "";
this.modelIds = "";
this.userId = null;
this.realName = "";
this.modelIds = "";
this.siteId = null;
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.IUser;
......@@ -54,20 +55,27 @@ public class UserModelCollectController extends BaseCRUDJsonBodyMappingControlle
@PostMapping({"get"})
public String getCollect() {
@UnAuth
public String getCollect(@RequestBody UserModelCollectEntity query) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "查看" + this.getModuleDesc();
Context context = this.getContext();
model.put("data", Collections.emptyList());
try {
UserModelCollectEntity query = new UserModelCollectEntity();
query.setUserId(this.getCurUser().getId());
UserModelCollectEntity entity = this.service.selectOne(query);
if(query.getSiteId()==null){
throw new AppException("站点ID不能为空");
}
UserModelCollectEntity temp = new UserModelCollectEntity();
temp.setUserId(this.getCurUser().getId());
temp.setSiteId(query.getSiteId());
UserModelCollectEntity entity = this.service.selectOne(temp);
if (entity == null) {
entity = new UserModelCollectEntity();
entity.setUserId(this.getCurUser().getId());
entity.setRealName(this.getCurUser().getRealName());
entity.setSiteId(query.getSiteId());
entity.setModelIds("");
}else {
if(StringUtils.isNotEmpty(entity.getModelIds())){
......@@ -117,6 +125,7 @@ public class UserModelCollectController extends BaseCRUDJsonBodyMappingControlle
@Override
@PostMapping({"save"})
@RepeatSubmit
@UnAuth
public String save(@RequestBody UserModelCollectEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
......@@ -126,8 +135,12 @@ public class UserModelCollectController extends BaseCRUDJsonBodyMappingControlle
return this.createFailJsonResp("请选择要收藏的模块");
}
try {
if(entity.getSiteId()==null){
throw new AppException("站点ID不能为空");
}
UserModelCollectEntity query = new UserModelCollectEntity();
query.setUserId(this.getCurUser().getId());
query.setSiteId(query.getSiteId());
UserModelCollectEntity temp = this.service.selectOne(query);
if (temp == null) {
Class<UserModelCollectEntity> tClass = ReflectUtils.getClassGenricType(this.getClass(), 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment