dongdingding 1 month ago
commit 4d72832f62

@ -8,6 +8,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
@ -30,7 +31,7 @@ public class BaseClass {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
private Date createTime;
/**
*
@ -46,7 +47,7 @@ public class BaseClass {
@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
private Date updateTime;
private String remark;

@ -88,7 +88,7 @@ public class AssetAppController extends BaseController {
@ApiOperation(value = "编辑数据")
@Log(title = "编辑app数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(AssetApp assetApp) {
public AjaxResult edit(@RequestBody AssetApp assetApp) {
return success(assetAppService.updateById(assetApp));
}

@ -86,7 +86,7 @@ public class AssetEmailController extends BaseController {
@ApiOperation(value = "编辑email数据")
@Log(title = "编辑email数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(AssetEmail assetEmail) {
public AjaxResult edit(@RequestBody AssetEmail assetEmail) {
return success(assetEmailService.updateById(assetEmail));
}

@ -88,7 +88,7 @@ public class AssetMiniProgramsController extends BaseController {
@ApiOperation(value = "编辑小程序数据")
@Log(title = "编辑小程序数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(AssetMiniPrograms assetMiniPrograms) {
public AjaxResult edit(@RequestBody AssetMiniPrograms assetMiniPrograms) {
return success(assetMiniProgramsService.updateById(assetMiniPrograms));
}

@ -89,7 +89,7 @@ public class AssetOfficialAccountController {
@ApiOperation(value = "编辑公众号数据")
@Log(title = "编辑公众号数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(AssetOfficialAccount assetOfficialAccount) {
public AjaxResult edit(@RequestBody AssetOfficialAccount assetOfficialAccount) {
return success(assetOfficialAccountService.updateById(assetOfficialAccount));
}

@ -1,9 +1,5 @@
package com.ruoyi.tc.controller;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
@ -25,7 +21,6 @@ import com.ruoyi.tc.service.UnitOtherConcatService;
import com.ruoyi.tc.service.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -44,7 +39,7 @@ import java.util.*;
*/
@Api(tags = "单位表控制层")
@RestController
//@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@RequestMapping("/tc/unit")
public class UnitController {

@ -1,6 +1,7 @@
package com.ruoyi.tc.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;

@ -223,7 +223,7 @@ public class Unit implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
private Date createTime;
/**
*
@ -239,7 +239,7 @@ public class Unit implements Serializable {
@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
private Date updateTime;
@ApiModelProperty("备注")
@Excel(name = "备注")

@ -12,12 +12,16 @@ import com.ruoyi.tc.regular.entity.AssetDbxx;
import com.ruoyi.tc.regular.entity.AssetJcxx;
import com.ruoyi.tc.service.AssetCurrentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -27,9 +31,8 @@ import java.util.Map;
* @author du
* @since 2024/12/3 17:06
*/
//@Configuration
//@EnableScheduling
@Component
@Configuration
@EnableScheduling
public class AssetCurrentChange {
@Value("${isTime}")
@ -47,7 +50,7 @@ public class AssetCurrentChange {
/**
*
*/
// @Scheduled(cron = "0 0 3 * * *")
@Scheduled(cron = "0 0 3 * * *")
@Transactional(rollbackFor = Exception.class)
public void assetTotal() {
if (isTime) {
@ -61,10 +64,8 @@ public class AssetCurrentChange {
.header("Content-Type", "application/json;charset=utf-8")
.formStr(new HashMap<>())
.execute();
System.out.println(response.getStatus());
if (response.getStatus() == 200) {
JSONObject jsonObj = JSONUtil.parseObj(response.body());
System.out.println(jsonObj);
if ("200".equals(jsonObj.get("code").toString())) {
JSONObject reqData = JSONUtil.parseObj(jsonObj.get("data"));
JSONArray arr = reqData.getJSONArray("result"); // 直接获取数组,无需再次解析
@ -192,10 +193,8 @@ public class AssetCurrentChange {
.formStr(new HashMap<>())
.body(jo.toString())
.execute();
System.out.println(response.getStatus());
if (response.getStatus() == 200) {
JSONObject jsonObj = JSONUtil.parseObj(response.body());
System.out.println(jsonObj);
if ("200".equals(jsonObj.get("code").toString())) {
JSONArray arr = jsonObj.getJSONArray("data"); // 直接获取数组,无需再次解析
if (arr.size() > 0) {
@ -216,19 +215,12 @@ public class AssetCurrentChange {
/**
* LocalDateTime
*/
public Boolean getDateBoolean(LocalDateTime a, LocalDateTime b) {
LocalDateTime now = LocalDateTime.now();
Duration duration1 = Duration.between(now, a);
Duration duration2 = Duration.between(now, b);
if (duration1.isNegative()) {
duration1 = duration1.negated();
}
if (duration2.isNegative()) {
duration2 = duration2.negated();
}
if (duration1.compareTo(duration2) < 0) {
public Boolean getDateBoolean(Date a, Date b) {
long diff1 = Math.abs(System.currentTimeMillis() - a.getTime());
long diff2 = Math.abs(System.currentTimeMillis() - b.getTime());
if (diff1 < diff2) {
return true;
} else if (duration1.compareTo(duration2) > 0) {
} else if (diff1 > diff2) {
return false;
}
return false;

@ -14,12 +14,16 @@ import com.ruoyi.tc.regular.entity.UnitConcat;
import com.ruoyi.tc.service.UnitOtherConcatService;
import com.ruoyi.tc.service.UnitService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -30,9 +34,8 @@ import java.util.Map;
* @author du
* @since 2024/12/3 10:59
*/
//@Configuration
//@EnableScheduling
@Component
@Configuration
@EnableScheduling
public class UnitChange {
@Value("${isTime}")
@ -53,7 +56,7 @@ public class UnitChange {
/**
*
*/
// @Scheduled(cron = "0 0 2 * * *")
@Scheduled(cron = "0 0 2 * * *")
@Transactional(rollbackFor = Exception.class)
public void unitTotal() {
if (isTime) {
@ -226,19 +229,12 @@ public class UnitChange {
/**
* LocalDateTime
*/
public Boolean getDateBoolean(LocalDateTime a, LocalDateTime b) {
LocalDateTime now = LocalDateTime.now();
Duration duration1 = Duration.between(now, a);
Duration duration2 = Duration.between(now, b);
if (duration1.isNegative()) {
duration1 = duration1.negated();
}
if (duration2.isNegative()) {
duration2 = duration2.negated();
}
if (duration1.compareTo(duration2) < 0) {
public Boolean getDateBoolean(Date a, Date b) {
long diff1 = Math.abs(System.currentTimeMillis() - a.getTime());
long diff2 = Math.abs(System.currentTimeMillis() - b.getTime());
if (diff1 < diff2) {
return true;
} else if (duration1.compareTo(duration2) > 0) {
} else if (diff1 > diff2) {
return false;
}
return false;

@ -6,6 +6,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
@ -74,10 +75,10 @@ public class AssetDbxx {
@ApiModelProperty("更新时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatetime;
private Date updatetime;
@ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createtime;
private Date createtime;
}

@ -6,6 +6,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
@ -94,10 +95,10 @@ public class AssetJcxx {
@ApiModelProperty("更新时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatetime;
private Date updatetime;
@ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createtime;
private Date createtime;
}

@ -6,6 +6,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
@ -72,10 +73,10 @@ public class UnitArchives {
@ApiModelProperty("更新时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatetime;
private Date updatetime;
@ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createtime;
private Date createtime;
}

@ -6,6 +6,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
@ -35,10 +36,10 @@ public class UnitConcat {
@ApiModelProperty("更新时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatetime;
private Date updatetime;
@ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createtime;
private Date createtime;
}

@ -73,19 +73,23 @@ public class AssetCurrentServiceImpl extends ServiceImpl<AssetCurrentMapper, Ass
byId.setXjgywxt(assetBusinessFormService.lambdaQuery().eq(AssetBusinessForm::getAssetId, id).eq(AssetBusinessForm::getDelFlag, "0").one());
byId.setOtherConcat(unitOtherConcatService.lambdaQuery().eq(UnitOtherConcat::getAssetId, id).eq(UnitOtherConcat::getDelFlag, "0").list());
List<Acomma> a1 = new ArrayList<>();
Arrays.asList(byId.getGlym().split(",")).forEach(x -> {
Acomma acomma = new Acomma();
acomma.setKey(x);
a1.add(acomma);
});
byId.setGlymList(a1);
if(byId.getGlym()!=null){
Arrays.asList(byId.getGlym().split(",")).forEach(x -> {
Acomma acomma = new Acomma();
acomma.setKey(x);
a1.add(acomma);
});
byId.setGlymList(a1);
}
List<Acomma> a2 = new ArrayList<>();
Arrays.asList(byId.getGlIp().split(",")).forEach(x -> {
Acomma acomma = new Acomma();
acomma.setKey(x);
a2.add(acomma);
});
byId.setGlIpList(a2);
if(byId.getGlIp()!=null){
Arrays.asList(byId.getGlIp().split(",")).forEach(x -> {
Acomma acomma = new Acomma();
acomma.setKey(x);
a2.add(acomma);
});
byId.setGlIpList(a2);
}
return byId;
}

@ -118,3 +118,4 @@ server:
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
isTime: true

@ -104,7 +104,7 @@
</where>
order by create_time desc
</select>
<select id="getById" parameterType="unit">
<select id="getById" resultMap="unitResult">
select a.*,
c.*,
e.*,

Loading…
Cancel
Save