This commit is contained in:
577732344@qq.com
2025-09-24 11:38:07 +08:00
parent 85d6b57314
commit 14bbeead60
4 changed files with 31 additions and 18 deletions

View File

@@ -16,6 +16,8 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
/**
@@ -33,6 +35,8 @@ public class SysOssController extends BaseController
@PostMapping("/upload")
public AjaxResult upload(@RequestParam("file") MultipartFile file) throws Exception
{
LocalDateTime now = LocalDateTime.now();
String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
if (file.isEmpty())
{
throw new OssException("上传文件不能为空");
@@ -48,7 +52,7 @@ public class SysOssController extends BaseController
ossEntity.setFileSuffix(suffix);
ossEntity.setCreateBy(SecurityUtils.getUsername());
ossEntity.setFileName(fileName);
ossEntity.setCreateTime(new Date());
ossEntity.setCreateTime(formattedDate);
ossEntity.setService(storage.getService());
return toAjax(sysOssService.save(ossEntity)).put("url", ossEntity.getUrl()).put("fileName",ossEntity.getFileName());
}

View File

@@ -33,6 +33,8 @@ import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -571,7 +573,8 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
int totalJobInserted = 0;
String string = UUID.randomUUID().toString();
logger.info("生成唯一标识符: {}", string);
LocalDateTime now = LocalDateTime.now();
String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
for (RowWork rowWork : rowWorks) {
try {
Job job = new Job();
@@ -620,7 +623,7 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
job.setRemark(string);
job.setDelFlag("0");
job.setCreateBy(string);
job.setCreateTime(new Date());
job.setCreateTime(formattedDate);
job.setRowId(Long.valueOf(rowWork.getId()));
jobBatch.add(job);
@@ -665,6 +668,8 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
List<BussinessDictData> natureData = iBussinessDictTypeService.selectDictDataByType("company_nature");
List<TreeSelect> treeSelects = industryService.appIndustry();
List<Company> companyList = new ArrayList<>();
LocalDateTime now = LocalDateTime.now();
String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
for(Company company:companyRowList){
Company companyNew = new Company();
companyNew.setName(company.getName());
@@ -676,7 +681,7 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
}
companyNew.setDelFlag("0");
companyNew.setCreateBy("system");
companyNew.setCreateTime(new Date());
companyNew.setCreateTime(formattedDate);
companyNew.setRemark("add");
companyNew.setDescription(company.getDescription());
companyNew.setIndustry(findIndustry(treeSelects,company));

View File

@@ -39,7 +39,7 @@ public class BaseEntity implements Serializable
@TableField(fill = FieldFill.INSERT)
// @JsonIgnore
@ApiModelProperty(hidden = true)
private Date createTime;
private String createTime;
/** 更新者 */
@TableField(fill = FieldFill.INSERT_UPDATE)
@@ -52,7 +52,7 @@ public class BaseEntity implements Serializable
@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonIgnore
@ApiModelProperty(hidden = true)
private Date updateTime;
private String updateTime;
/** 删除标志0代表存在 2代表删除 */
@TableLogic(value = "0",delval = "2")
@@ -93,12 +93,12 @@ public class BaseEntity implements Serializable
this.createBy = createBy;
}
public Date getCreateTime()
public String getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
public void setCreateTime(String createTime)
{
this.createTime = createTime;
}
@@ -113,12 +113,12 @@ public class BaseEntity implements Serializable
this.updateBy = updateBy;
}
public Date getUpdateTime()
public String getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
public void setUpdateTime(String updateTime)
{
this.updateTime = updateTime;
}

View File

@@ -8,6 +8,8 @@ import com.ruoyi.common.utils.spring.SpringUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Objects;
@@ -30,19 +32,20 @@ public class FieldMetaObjectConfig implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
Date date = new Date();
LocalDateTime now = LocalDateTime.now();
String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
if(SecurityUtils.isLogin()) {
LoginUser loginUser = SecurityUtils.getLoginUser();
// 创建者
strictInsertFill(metaObject, CREATE_BY, String.class, loginUser.getUsername());
strictInsertFill(metaObject, CREATE_BY_ID, Long.class, loginUser.getUserId());
// 创建时间
strictInsertFill(metaObject, CREATE_TIME, Date.class, date);
strictInsertFill(metaObject, CREATE_TIME, String.class, formattedDate);
// 更新者
strictInsertFill(metaObject, UPDATE_BY, String.class, loginUser.getUsername());
strictInsertFill(metaObject, UPDATE_BY_ID, Long.class, loginUser.getUserId());
// 更新时间
strictInsertFill(metaObject, UPDATE_TIME, Date.class, date);
strictInsertFill(metaObject, UPDATE_TIME, String.class, formattedDate);
// 删除标识
strictInsertFill(metaObject, DEL_FLAG, String.class, "0");
}else {
@@ -50,12 +53,12 @@ public class FieldMetaObjectConfig implements MetaObjectHandler {
strictInsertFill(metaObject, CREATE_BY, String.class, "匿名登录");
strictInsertFill(metaObject, CREATE_BY_ID, Long.class, 0l);
// 创建时间
strictInsertFill(metaObject, CREATE_TIME, Date.class, date);
strictInsertFill(metaObject, CREATE_TIME, String.class, formattedDate);
// 更新者
strictInsertFill(metaObject, UPDATE_BY, String.class, "匿名登录");
strictInsertFill(metaObject, UPDATE_BY_ID, Long.class, 0l);
// 更新时间
strictInsertFill(metaObject, UPDATE_TIME, Date.class, date);
strictInsertFill(metaObject, UPDATE_TIME, String.class, formattedDate);
// 删除标识
strictInsertFill(metaObject, DEL_FLAG, String.class, "0");
}
@@ -64,9 +67,10 @@ public class FieldMetaObjectConfig implements MetaObjectHandler {
@Override
public void updateFill(MetaObject metaObject) {
LocalDateTime now = LocalDateTime.now();
String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
if(!SecurityUtils.isLogin()){
strictUpdateFill(metaObject, UPDATE_TIME, Date.class, new Date());
strictUpdateFill(metaObject, UPDATE_TIME, String.class, formattedDate);
return;
}
LoginUser loginUser = SecurityUtils.getLoginUser();
@@ -77,6 +81,6 @@ public class FieldMetaObjectConfig implements MetaObjectHandler {
strictUpdateFill(metaObject, UPDATE_BY, String.class, loginUser.getUsername());
strictUpdateFill(metaObject, UPDATE_BY_ID, Long.class, loginUser.getUserId());
// 更新时间
strictUpdateFill(metaObject, UPDATE_TIME, Date.class, new Date());
strictUpdateFill(metaObject, UPDATE_TIME, String.class, formattedDate);
}
}