main
杜函宇 1 month ago
parent b1777c7ef4
commit e7c2363ee6

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

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

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

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

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

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

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

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

@ -6,6 +6,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
@ -74,10 +75,10 @@ public class AssetDbxx {
@ApiModelProperty("更新时间") @ApiModelProperty("更新时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatetime; private Date updatetime;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @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 org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
@ -94,10 +95,10 @@ public class AssetJcxx {
@ApiModelProperty("更新时间") @ApiModelProperty("更新时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatetime; private Date updatetime;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @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 org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
@ -72,10 +73,10 @@ public class UnitArchives {
@ApiModelProperty("更新时间") @ApiModelProperty("更新时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatetime; private Date updatetime;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @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 org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
/** /**
* *
@ -35,10 +36,10 @@ public class UnitConcat {
@ApiModelProperty("更新时间") @ApiModelProperty("更新时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatetime; private Date updatetime;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @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.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()); byId.setOtherConcat(unitOtherConcatService.lambdaQuery().eq(UnitOtherConcat::getAssetId, id).eq(UnitOtherConcat::getDelFlag, "0").list());
List<Acomma> a1 = new ArrayList<>(); List<Acomma> a1 = new ArrayList<>();
if(byId.getGlym()!=null){
Arrays.asList(byId.getGlym().split(",")).forEach(x -> { Arrays.asList(byId.getGlym().split(",")).forEach(x -> {
Acomma acomma = new Acomma(); Acomma acomma = new Acomma();
acomma.setKey(x); acomma.setKey(x);
a1.add(acomma); a1.add(acomma);
}); });
byId.setGlymList(a1); byId.setGlymList(a1);
}
List<Acomma> a2 = new ArrayList<>(); List<Acomma> a2 = new ArrayList<>();
if(byId.getGlIp()!=null){
Arrays.asList(byId.getGlIp().split(",")).forEach(x -> { Arrays.asList(byId.getGlIp().split(",")).forEach(x -> {
Acomma acomma = new Acomma(); Acomma acomma = new Acomma();
acomma.setKey(x); acomma.setKey(x);
a2.add(acomma); a2.add(acomma);
}); });
byId.setGlIpList(a2); byId.setGlIpList(a2);
}
return byId; return byId;
} }

Loading…
Cancel
Save