Browse Source

1、日指标调整单

2、监控页面所需40的接口迁移
develop
bobol 11 months ago
parent
commit
80fb5dd54f
  1. 20
      lzbi-admin/src/main/resources/application-dev.yml
  2. 18
      lzbi-common/src/main/java/com/lzbi/common/config/RestTemplateConfig.java
  3. 60
      lzbi-common/src/main/java/com/lzbi/common/config/VideoConfig.java
  4. 46
      lzbi-common/src/main/java/com/lzbi/common/utils/MD5Utils.java
  5. 188
      lzbi-module/src/main/java/com/lzbi/bi/controller/DCVedioScreenControler.java
  6. 17
      lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java
  7. 6
      lzbi-module/src/main/java/com/lzbi/bi/domain/VideoResp.java
  8. 9
      lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiDayPlanBillMasterService.java
  9. 3
      lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiMonthPlanBillMasterService.java
  10. 60
      lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiTargetAdjustDayMasterController.java
  11. 131
      lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiTargetDraftDaynewController.java
  12. 18
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetAdjustDayMasterDao.java
  13. 2
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetDraftDaynew.java
  14. 2
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetAdjustDayMasterMapper.java
  15. 4
      lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java
  16. 174
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetAdjustDayMasterService.java
  17. 2
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetAdjustDaySubService.java
  18. 6
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java
  19. 17
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetAdjustDayMasterMapper.xml
  20. 4
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml

20
lzbi-admin/src/main/resources/application-dev.yml

@ -76,12 +76,12 @@ spring:
datasource:
# 主库数据源
master:
#url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
#username: luenmei
#password: 123456
url: jdbc:mysql://localhost:3306/lmlz_dcdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
username: root
password: root123456
url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
username: luenmei
password: 123456
# url: jdbc:mysql://localhost:3306/lmlz_dcdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
# username: root
# password: root123456
# # 计费数据库
# charge:
# driverClassName: oracle.jdbc.OracleDriver
@ -103,8 +103,12 @@ spring:
primary: master
luenmeilz:
#视频设备监控地址
vedioServer:
url: 10.10.10.40:18000
vedio-server:
url: http://10.10.10.40:18000
login: /api/v1/login?username={username}&password={password}
deviceList: /api/v1/devicesconfig?device={device}&start={start}&limit={limit}
channelList: /api/v1/channelsconfig?device={device}&start={start}&limit={limit}
channelStream: /api/v1/devices/channelstream?device={device}&channel={channel}&protocol={protocol}&Token={Token}&type={type}
# 日志配置
logging:
file:

18
lzbi-common/src/main/java/com/lzbi/common/config/RestTemplateConfig.java

@ -0,0 +1,18 @@
package com.lzbi.common.config;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import java.time.Duration;
@Configuration
public class RestTemplateConfig {
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder.setConnectTimeout(Duration.ofMillis(2000))
.setReadTimeout(Duration.ofMillis(2000)).build();
}
}

60
lzbi-common/src/main/java/com/lzbi/common/config/VideoConfig.java

@ -0,0 +1,60 @@
package com.lzbi.common.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "luenmeilz.vedio-server")
public class VideoConfig {
private String url;
private String login;
private String deviceList;
private String channelList;
private String channelStream;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getLogin() {
return url + login;
}
public void setLogin(String login) {
this.login = login;
}
public String getDeviceList() {
return url + deviceList;
}
public void setDeviceList(String deviceList) {
this.deviceList = deviceList;
}
public String getChannelList() {
return url + channelList;
}
public void setChannelList(String channelList) {
this.channelList = channelList;
}
public String getChannelStream() {
return url + channelStream;
}
public void setChannelStream(String channelStream) {
this.channelStream = channelStream;
}
}

46
lzbi-common/src/main/java/com/lzbi/common/utils/MD5Utils.java

@ -0,0 +1,46 @@
package com.lzbi.common.utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* 南宫乘风
*/
public class MD5Utils {
/**
* MD5加密类
* @param str 要加密的字符串
* @return 加密后的字符串
*/
public static String code(String str){
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[]byteDigest = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < byteDigest.length; offset++) {
i = byteDigest[offset];
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");
buf.append(Integer.toHexString(i));
}
//32位加密
return buf.toString();
// 16位的加密
//return buf.toString().substring(8, 24);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
}
/**
* 测试方法
* @param args
*/
public static void main(String[] args) {
System.out.println(code("lmLz@2019"));
}
}

188
lzbi-module/src/main/java/com/lzbi/bi/controller/DCVedioScreenControler.java

@ -1,86 +1,192 @@
package com.lzbi.bi.controller;
import cn.hutool.Hutool;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.lzbi.common.config.VideoConfig;
import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.core.redis.RedisCache;
import com.lzbi.common.utils.SecurityUtils;
import com.lzbi.common.utils.StringUtils;
import com.lzbi.common.utils.sign.Md5Utils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import java.util.Optional;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @auth create by Administrator
* @date 2023/12/27
* DCVedioScreenControler
*/
@Slf4j
@Api("视频监控大屏接口")
@RestController
@RequestMapping("/vedio")
@RequestMapping("/api/v1")
public class DCVedioScreenControler extends BaseController {
@Autowired
private RedisCache redisCache;
@Autowired
RedisTemplate<String,String> redisTemplate;
@Value("${luenmeilz.vedioServer.url}")
String vedio_server_url;
private RestTemplate restTemplate;
@Autowired
private VideoConfig videoConfig;
//String md532Upper=md532Lower.toUpperCase();
//16位,小写
//String md516Lower =md532Lower.substring(8, 24);
//16位,大写
//String md516Upper=md532Lower.substring(8, 24).toUpperCase();
@ApiOperation("根据用户对照信息并获取视频的用户登录token")
@GetMapping("/getToken")
public AjaxResult getToken2(){
@GetMapping("/login")
public AjaxResult getToken2() {
return AjaxResult.success(getToken());
}
private String getToken(){
String userName=SecurityUtils.getUsername();
String token= redisTemplate.opsForValue().get("vedio:" + userName);
if(StringUtils.isNull(token)){//没有tokean需要重新获取
String vedio_userName="easycvr" ;//SecurityUtils.getUsername();
String vedio_password="lmlz@2019"; //
private String getToken() {
String userName = SecurityUtils.getUsername();
String token = redisCache.getCacheObject("video:" + userName);
//没有tokean需要重新获取
if (StringUtils.isEmpty(token)) {
String vedio_userName = "easycvr";
String vedio_password = "lmLz@2019"; //
//根据平台用户名查询 对应的监控用户名和密码,如果不需要则默认给出easycvr lmlz@2019
String passwordMd532 = DigestUtils.md5DigestAsHex(vedio_password.getBytes());
HttpRequest get = HttpUtil.createGet(StrUtil.format("{}/api/v1/login?username={}&password={}", vedio_server_url, userName, passwordMd532));
HttpResponse execute = get.execute();
if(execute.getStatus()==200){
//解析token
token= Optional.ofNullable(JSONObject.parseObject(execute.body()).getString("token")).orElse("");
redisTemplate.opsForValue().set("vedio:" + userName,token);
Map<String, Object> query = new HashMap<>();
query.put("username", vedio_userName);
query.put("password", passwordMd532);
JSONObject resp = restTemplate.getForObject(videoConfig.getLogin(), JSONObject.class, query);
log.info("登录请求结果:{}", resp);
if (null != resp) {
JSONObject body = this.getBody(resp);
if (null != body) {
token = body.getString("Token");
redisCache.setCacheObject("video:" + userName, token, 1, TimeUnit.DAYS);
}
log.info("token:{}", token);
}
}
return token;
}
@ApiOperation("获取设备列表")
@GetMapping("/getDevcieList")
public AjaxResult getDeviceList(){
String token=getToken();
HttpRequest get = HttpUtil.createGet(StrUtil.format("{}/api/v1/devices?device={}&start={}&limit={}&token={}", vedio_server_url,0,0,100,token));
return AjaxResult.success(get.execute().body());
@ApiOperation("获取设备列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "start", value = "分页开始,从零开始", dataType = "Integer", dataTypeClass = Integer.class, required = true),
@ApiImplicitParam(name = "limit", value = "分页大小", dataType = "Integer", dataTypeClass = Integer.class, required = true),
@ApiImplicitParam(name = "device", value = "设备ID", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "protocol_type", value = "设备类型", example = "sdk, ipc, rtmp_push", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "q", value = "查询参数", dataType = "String", dataTypeClass = String.class),
})
@GetMapping("/devicesconfig")
public AjaxResult getDeviceList(@RequestParam(value = "device", required = false) Integer device,
@RequestParam(value = "start") Integer start,
@RequestParam(value = "limit") Integer limit,
@RequestParam(value = "protocol_type", required = false) String protocol_type,
@RequestParam(value = "q", required = false) String q) {
String token = getToken();
HttpHeaders headers = new HttpHeaders();
headers.set("Token", token);
HttpEntity entity = new HttpEntity<>(headers);
Map<String, Object> query = new HashMap<>();
query.put("device", device);
query.put("start", start);
query.put("limit", limit);
query.put("protocol_type", protocol_type);
query.put("q", q);
ResponseEntity response = restTemplate.exchange(videoConfig.getDeviceList(), HttpMethod.GET, entity, JSONObject.class, query);
log.info("获取设备列表请求结果:{}", response);
JSONObject body = this.getBody((JSONObject) response.getBody());
if (null != body) {
return AjaxResult.success(body);
}
return AjaxResult.success(null);
}
@ApiOperation("获取通道列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "depId", value = "上级部门编码默认0", dataType = "Long", dataTypeClass = Long.class),
@ApiImplicitParam(name = "start", value = "分页开始,从零开始", dataType = "Integer", dataTypeClass = Integer.class, required = true),
@ApiImplicitParam(name = "limit", value = "分页大小", dataType = "Integer", dataTypeClass = Integer.class, required = true),
@ApiImplicitParam(name = "device", value = "设备ID", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "q", value = "查询参数", dataType = "String", dataTypeClass = String.class),
})
@GetMapping("/getChanleList")
public AjaxResult getChanelList(){
String token="";
return AjaxResult.success(token);
@GetMapping("/channelsconfig")
public AjaxResult getChanelList(@RequestParam(value = "device", required = false) Integer device,
@RequestParam(value = "start") Integer start,
@RequestParam(value = "limit") Integer limit,
@RequestParam(value = "q", required = false) String q) {
String token = getToken();
HttpHeaders headers = new HttpHeaders();
headers.set("Token", token);
HttpEntity entity = new HttpEntity<>(headers);
Map<String, Object> query = new HashMap<>();
query.put("device", device);
query.put("start", start);
query.put("limit", limit);
query.put("q", q);
ResponseEntity response = restTemplate.exchange(videoConfig.getChannelList(), HttpMethod.GET, entity, JSONObject.class, query);
log.info("获取通道列表请求结果:{}", response);
JSONObject body = this.getBody((JSONObject) response.getBody());
if (null != body) {
return AjaxResult.success(body);
}
return AjaxResult.success(null);
}
@ApiOperation(value = "获取设备通道直播链接(具有保活功能,建议按需模式25s-30s调用一次)")
@ApiImplicitParams({
@ApiImplicitParam(name = "device", value = "设备ID", dataType = "Integer", dataTypeClass = Integer.class, required = true),
@ApiImplicitParam(name = "channel", value = "通道id ", dataType = "Integer", dataTypeClass = Integer.class, required = true),
@ApiImplicitParam(name = "protocol", value = "直播协议", example = "FLV, WS_FLV, WEBRTC, RTMP, HLS, rtsp", dataType = "Integer", dataTypeClass = Integer.class, required = true),
@ApiImplicitParam(name = "Token", value = "播放token", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "type", value = "首次播放之后保活请带上此字段", example = "keepalive", dataType = "String", dataTypeClass = String.class),
})
@GetMapping("/devices/channelstream")
public AjaxResult getChannelStream(@RequestParam(value = "device") Integer device,
@RequestParam(value = "channel") Integer channel,
@RequestParam(value = "protocol") String protocol,
@RequestParam(value = "Token", required = false) String Token,
@RequestParam(value = "type", required = false) String type) {
String token = getToken();
HttpHeaders headers = new HttpHeaders();
headers.set("Token", token);
HttpEntity entity = new HttpEntity<>(headers);
Map<String, Object> query = new HashMap<>();
query.put("device", device);
query.put("channel", channel);
query.put("protocol", protocol);
query.put("Token", Token);
query.put("type", type);
ResponseEntity response = restTemplate.exchange(videoConfig.getChannelStream(), HttpMethod.GET, entity, JSONObject.class, query);
log.info("获取设备通道直播链接请求结果:{}", response);
JSONObject body = this.getBody((JSONObject) response.getBody());
if (null != body) {
return AjaxResult.success(body);
}
return AjaxResult.success(null);
}
private JSONObject getBody(JSONObject resp) {
JSONObject easyDarwin = resp.getJSONObject("EasyDarwin");
if (null != easyDarwin) {
JSONObject body = easyDarwin.getJSONObject("Body");
return body;
}
return null;
}
}

17
lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiDataScreenMainController.java

@ -10,10 +10,14 @@ import com.lzbi.bi.service.DcBusiDataScreenMainService;
import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.core.domain.TreeSelect;
import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.utils.StringUtils;
import com.lzbi.system.service.impl.SysDeptServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
@ -45,6 +49,9 @@ public class DcBusiDataScreenMainController extends BaseController{
@Autowired
private DcBusiDataScreenMainService dcBusiDataScreenMainService;
@Autowired
private SysDeptServiceImpl sysDeptService;
/**
* 大屏数据煤耗
* @return
@ -296,6 +303,16 @@ public class DcBusiDataScreenMainController extends BaseController{
//ret.put("unit",unit.get());
return AjaxResult.success(ret);
}
@GetMapping("/company/tree/{depId}")
public AjaxResult getCompanyTreeList(@Nullable @PathVariable Long depId){
if(depId==0){
depId=null;
}
List<SysDept> lsysDept = sysDeptService.selectCompany(depId);
List<TreeSelect> treeSelects = sysDeptService.buildDeptTreeSelect(lsysDept);
return AjaxResult.success( treeSelects) ;
}
}
/**
* {

6
lzbi-module/src/main/java/com/lzbi/bi/domain/VideoResp.java

@ -0,0 +1,6 @@
package com.lzbi.bi.domain;
public class VideoResp {
}

9
lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiDayPlanBillMasterService.java

@ -2,8 +2,8 @@ package com.lzbi.bill.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzbi.bi.domain.DcBusiTargetDraftDaynew;
import com.lzbi.bi.mapper.DcBusiTargetDraftDaynewMapper;
import com.lzbi.draft.domain.DcBusiTargetDraftDaynew;
import com.lzbi.draft.mapper.DcBusiTargetDraftDaynewMapper;
import com.lzbi.bill.domain.DcBusiDayPlanBillMaster;
import com.lzbi.bill.domain.DcBusiDayPlanBillSub;
import com.lzbi.bill.mapper.DcBusiDayPlanBillMasterMapper;
@ -11,7 +11,6 @@ import com.lzbi.bill.mapper.DcBusiDayPlanBillSubMapper;
import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.utils.DateUtils;
import com.lzbi.common.utils.SecurityUtils;
import com.lzbi.common.utils.StringUtils;
import com.lzbi.system.service.impl.SysDeptServiceImpl;
import com.lzbi.targetFolder.domain.DcBaseAssetTarget;
import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper;
@ -184,7 +183,6 @@ public class DcBusiDayPlanBillMasterService extends ServiceImpl<DcBusiDayPlanBil
// 修改计划单状态为2
master.setUpdatedBy(SecurityUtils.getUsername());
master.setCreatedTime(DateUtils.getNowDate());
master.setBillNo(billNo);
master.setCheckStatus("2");
return baseMapper.updateDcBusiPlanBillMasterByBillNo(master);
}
@ -205,8 +203,9 @@ public class DcBusiDayPlanBillMasterService extends ServiceImpl<DcBusiDayPlanBil
DcBusiDayPlanBillSub subParams = new DcBusiDayPlanBillSub();
subParams.setBillNo(billNo);
List<DcBusiDayPlanBillSub> subList = dcBusiDayPlanBillSubMapper.selectDcBusiPlanBillSubList(subParams);
DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew;
for (int i = 0, len = subList.size(); i < len; i++) {
DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew = new DcBusiTargetDraftDaynew();
dcBusiTargetDraftDaynew = new DcBusiTargetDraftDaynew();
dcBusiTargetDraftDaynew.setCompanyId(master.getCompanyId());
dcBusiTargetDraftDaynew.setOrganizeId(master.getOragnizeId());
dcBusiTargetDraftDaynew.setFieldCode(subList.get(i).getFieldCode());

3
lzbi-module/src/main/java/com/lzbi/bill/service/DcBusiMonthPlanBillMasterService.java

@ -2,9 +2,6 @@ package com.lzbi.bill.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzbi.bi.domain.DcBusiTargetDraftDaynew;
import com.lzbi.bill.domain.DcBusiDayPlanBillMaster;
import com.lzbi.bill.domain.DcBusiDayPlanBillSub;
import com.lzbi.bill.domain.DcBusiMonthPlanBillMaster;
import com.lzbi.bill.domain.DcBusiMonthPlanBillSub;
import com.lzbi.bill.mapper.DcBusiMonthPlanBillMasterMapper;

60
lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiTargetAdjustDayMasterController.java

@ -11,6 +11,7 @@ import com.lzbi.draft.domain.DcBusiTargetAdjustDaySubDao;
import com.lzbi.draft.service.DcBusiTargetAdjustDayMasterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -27,7 +28,7 @@ import java.util.List;
*/
@Api(value = "资产指标调整单",tags = "资产指标调整单")
@RestController
@RequestMapping("/asset/target/adjust")
@RequestMapping("/asset/targetDayAdjustBill")
public class DcBusiTargetAdjustDayMasterController extends BaseController
{
@Autowired
@ -36,7 +37,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
/**
* 查询资产指标调整单主()列表
*/
@PreAuthorize("@ss.hasPermi('asset:targetAdjustBill:list')")
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:list')")
@GetMapping("/list")
public TableDataInfo list(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao)
{
@ -48,7 +49,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
/**
* 导出资产指标调整单主()列表
*/
@PreAuthorize("@ss.hasPermi('asset:targetAdjustBill:export')")
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:export')")
@Log(title = "资产指标调整单主(日)", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao)
@ -61,18 +62,28 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
/**
* 获取资产指标调整单主()详细信息
*/
@PreAuthorize("@ss.hasPermi('asset:targetAdjustBill:query')")
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(dcBusiTargetAdjustDayMasterService.selectDcBusiTargetAdjustDayMasterDaoById(id));
}
/**
* 获取资产指标调整单主()详细信息
*/
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:query')")
@GetMapping(value = "/billNo/{billNo}")
public AjaxResult getInfo(@PathVariable("billNo") String billNo)
{
return success(dcBusiTargetAdjustDayMasterService.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo));
}
/**
* 新增资产指标调整单主()
*/
@ApiOperation("新增资产指标调整单")
@PreAuthorize("@ss.hasPermi('asset:targetAdjustBill:add')")
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:add')")
@Log(title = "资产指标调整单主(日)", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcBusiTargetAdjustDayMasterDao<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDayMasterDao)
@ -83,7 +94,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
/**
* 修改资产指标调整单主()
*/
@PreAuthorize("@ss.hasPermi('asset:targetAdjustBill:edit')")
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:edit')")
@Log(title = "资产指标调整单主(日)", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcBusiTargetAdjustDayMasterDao<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDayMasterDao)
@ -94,7 +105,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
/**
* 删除资产指标调整单主()
*/
@PreAuthorize("@ss.hasPermi('asset:targetAdjustBill:remove')")
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:remove')")
@Log(title = "资产指标调整单主(日)", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
@ -107,7 +118,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
*/
@ApiOperation("审核资产指标调整单")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", dataTypeClass = Long.class, paramType = "path", required = true)
@PreAuthorize("@ss.hasPermi('asset:targetAdjustBill:audit')")
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:audit')")
@Log(title = "资产指标调整单主(日)", businessType = BusinessType.OTHER)
@PostMapping("/audit/{id}")
public AjaxResult audit(@PathVariable("id") Long id)
@ -120,7 +131,7 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
*/
@ApiOperation("处理资产指标调整单")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", dataTypeClass = Long.class, paramType = "path", required = true)
@PreAuthorize("@ss.hasPermi('asset:targetAdjustBill:dispose')")
@PreAuthorize("@ss.hasPermi('asset:targetDayAdjustBill:dispose')")
@Log(title = "资产指标调整单主(日)", businessType = BusinessType.OTHER)
@PostMapping("/dispose/{id}")
public AjaxResult dispose(@PathVariable("id") Long id)
@ -132,4 +143,35 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
}
}
@ApiOperation("驳回")
@PreAuthorize("@ss.hasPermi('bill:dayPlanBill:check')")
@ApiImplicitParams({
@ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class),
})
@PostMapping("/checkBack/{billNo}")
public AjaxResult checkBack(@PathVariable String billNo){
return AjaxResult.success(dcBusiTargetAdjustDayMasterService.checkBack(billNo));
}
@ApiOperation("审核")
@PreAuthorize("@ss.hasPermi('bill:dayPlanBill:check')")
@ApiImplicitParams({
@ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class),
})
@PostMapping("/checkPass/{billNo}")
public AjaxResult checkPass(@PathVariable String billNo){
return AjaxResult.success(dcBusiTargetAdjustDayMasterService.checkPass(billNo));
}
@ApiOperation("反审核")
@PreAuthorize("@ss.hasPermi('bill:dayPlanBill:check')")
@ApiImplicitParams({
@ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class),
})
@PostMapping("/checkRevert/{billNo}")
public AjaxResult checkRevert(@PathVariable String billNo){
return AjaxResult.success(dcBusiTargetAdjustDayMasterService.checkRevert(billNo));
}
}

131
lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiTargetDraftDaynewController.java

@ -0,0 +1,131 @@
package com.lzbi.draft.controller;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lzbi.common.annotation.Log;
import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.enums.BusinessType;
import com.lzbi.draft.domain.DcBusiTargetDraftDaynew;
import com.lzbi.draft.service.DcBusiTargetDraftDaynewService;
import com.lzbi.common.utils.poi.ExcelUtil;
import com.lzbi.common.core.page.TableDataInfo;
/**
* 指标数据底稿日-新结构Controller
*
* @author 李恩博
* @date 2023-12-25
*/
@RestController
@RequestMapping("/asset/dcBusiTargetDraftDaynew")
public class DcBusiTargetDraftDaynewController extends BaseController
{
@Autowired
private DcBusiTargetDraftDaynewService dcBusiTargetDraftDaynewService;
/**
* 查询指标数据底稿日-新结构列表
*/
@ApiOperation("查询指标数据底稿日-新结构列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcBusiTargetDraftDaynew", value = "", dataType = "DcBusiTargetDraftDaynew", dataTypeClass = DcBusiTargetDraftDaynew.class),
})
@PreAuthorize("@ss.hasPermi('bi:dcBusiTargetDraftDaynew:list')")
@GetMapping("/list")
public TableDataInfo list(DcBusiTargetDraftDaynew DcBusiTargetDraftDaynew)
{
startPage();
List< DcBusiTargetDraftDaynew> list = dcBusiTargetDraftDaynewService.selectDcBusiTargetDraftDaynewList(DcBusiTargetDraftDaynew);
return getDataTable(list);
}
/**
* 导出指标数据底稿日-新结构列表
*/
@ApiOperation("导出指标数据底稿日-新结构列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcBusiTargetDraftDaynew", value = "", dataType = "DcBusiTargetDraftDaynew", dataTypeClass = DcBusiTargetDraftDaynew.class),
})
@PreAuthorize("@ss.hasPermi('bi:dcBusiTargetDraftDaynew:export')")
@Log(title = "指标数据底稿日-新结构", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response,DcBusiTargetDraftDaynew DcBusiTargetDraftDaynew)
{
List<DcBusiTargetDraftDaynew> list = dcBusiTargetDraftDaynewService.selectDcBusiTargetDraftDaynewList(DcBusiTargetDraftDaynew);
ExcelUtil<DcBusiTargetDraftDaynew> util = new ExcelUtil<DcBusiTargetDraftDaynew>(DcBusiTargetDraftDaynew.class);
util.exportExcel(response, list, "指标数据底稿日-新结构数据");
}
/**
* 获取指标数据底稿日-新结构详细信息
*/
@ApiOperation("获取指标数据底稿日-新结构详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "", dataType = "String", dataTypeClass = String.class),
})
@PreAuthorize("@ss.hasPermi('bi:dcBusiTargetDraftDaynew:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(dcBusiTargetDraftDaynewService.selectDcBusiTargetDraftDaynewById(id));
}
/**
* 新增指标数据底稿日-新结构
*/
@ApiOperation("新增指标数据底稿日-新结构")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcBusiTargetDraftDaynew", value = "", dataType = "DcBusiTargetDraftDaynew", dataTypeClass = DcBusiTargetDraftDaynew.class),
})
@PreAuthorize("@ss.hasPermi('bi:dcBusiTargetDraftDaynew:add')")
@Log(title = "指标数据底稿日-新结构", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcBusiTargetDraftDaynew DcBusiTargetDraftDaynew)
{
return toAjax(dcBusiTargetDraftDaynewService.insertDcBusiTargetDraftDaynew(DcBusiTargetDraftDaynew));
}
/**
* 修改指标数据底稿日-新结构
*/
@ApiOperation("修改指标数据底稿日-新结构")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcBusiTargetDraftDaynew", value = "", dataType = "DcBusiTargetDraftDaynew", dataTypeClass = DcBusiTargetDraftDaynew.class),
})
@PreAuthorize("@ss.hasPermi('bi:dcBusiTargetDraftDaynew:edit')")
@Log(title = "指标数据底稿日-新结构", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcBusiTargetDraftDaynew DcBusiTargetDraftDaynew)
{
return toAjax(dcBusiTargetDraftDaynewService.updateDcBusiTargetDraftDaynew(DcBusiTargetDraftDaynew));
}
/**
* 删除指标数据底稿日-新结构
*/
@ApiOperation("删除指标数据底稿日-新结构")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "", dataType = "String", dataTypeClass =String.class),
})
@PreAuthorize("@ss.hasPermi('bi:dcBusiTargetDraftDaynew:remove')")
@Log(title = "指标数据底稿日-新结构", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(dcBusiTargetDraftDaynewService.deleteDcBusiTargetDraftDaynewByIds(ids));
}
}

18
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetAdjustDayMasterDao.java

@ -24,22 +24,6 @@ import springfox.documentation.annotations.ApiIgnore;
@Data
@Accessors(chain = true)
public class DcBusiTargetAdjustDayMasterDao<T> extends BaseModuleEntity {
/**
* 待审核状态
*/
public static final String CHECK_STATUS_PENDING_CHECK = "0";
/**
* 已审核状态
*/
public static final String CHECK_STATUS_CHECKED = "1";
/**
* 已审核状态
*/
public static final String CHECK_STATUS_PROCESSED = "2";
/**
* 人工
*/
public static final String CHECK_TYPE_ARTIFICIAL = "1";
private static final long serialVersionUID = 1L;
@ -154,7 +138,7 @@ public class DcBusiTargetAdjustDayMasterDao<T> extends BaseModuleEntity {
*/
@ApiModelProperty(hidden = true)
@Excel(name = "审核状态;0待审核 1 已经审核 2已处理")
private String checkStauts;
private String checkStatus;
/**
* 审核类型;1人工2自动

2
lzbi-module/src/main/java/com/lzbi/bi/domain/DcBusiTargetDraftDaynew.java → lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetDraftDaynew.java

@ -1,4 +1,4 @@
package com.lzbi.bi.domain;
package com.lzbi.draft.domain;
import java.math.BigDecimal;
import java.util.Date;

2
lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetAdjustDayMasterMapper.java

@ -21,6 +21,8 @@ public interface DcBusiTargetAdjustDayMasterMapper extends BaseMapper<DcBusiTarg
*/
public DcBusiTargetAdjustDayMasterDao selectDcBusiTargetAdjustDayMasterDaoById(Long id);
DcBusiTargetAdjustDayMasterDao selectDcBusiTargetAdjustDayMasterDaoByBillNo(String billNo);
/**
* 查询资产指标调整单主()列表
*

4
lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiTargetDraftDaynewMapper.java → lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiTargetDraftDaynewMapper.java

@ -1,8 +1,8 @@
package com.lzbi.bi.mapper;
package com.lzbi.draft.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.bi.domain.DcBusiTargetDraftDaynew;
import com.lzbi.draft.domain.DcBusiTargetDraftDaynew;
/**
* 指标数据底稿日-新结构Mapper接口

174
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetAdjustDayMasterService.java

@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzbi.asset.domain.DcBaseAssetInfo;
import com.lzbi.asset.mapper.DcBaseAssetInfoMapper;
import com.lzbi.draft.mapper.DcBusiTargetDraftDaynewMapper;
import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.utils.DateUtils;
import com.lzbi.common.utils.SecurityUtils;
import com.lzbi.draft.domain.DcBusiTargetAdjustDayMasterDao;
import com.lzbi.draft.domain.DcBusiTargetAdjustDaySubDao;
import com.lzbi.draft.domain.DcBusiTargetDraftMonth;
@ -56,6 +58,9 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
@Resource
private DcBusiTargetDraftMonthMapper dcBusiTargetDraftMonthMapper;
@Resource
private DcBusiTargetDraftDaynewMapper dcBusiTargetDraftDaynewMapper;
private static final Lock lock = new ReentrantLock();
/**
@ -73,6 +78,15 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
return dcBusiTargetAdjustDayMasterDao;
}
public DcBusiTargetAdjustDayMasterDao selectDcBusiTargetAdjustDayMasterDaoByBillNo(String billNo) {
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo);
DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao = new DcBusiTargetAdjustDaySubDao();
dcBusiTargetAdjustDaySubDao.setBillNoMaster(dcBusiTargetAdjustDayMasterDao.getBillSerial());
List<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDaySubDaos = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(dcBusiTargetAdjustDaySubDao);
dcBusiTargetAdjustDayMasterDao.setChildren(dcBusiTargetAdjustDaySubDaos);
return dcBusiTargetAdjustDayMasterDao;
}
/**
* 查询资产指标调整单主()列表
*
@ -112,10 +126,9 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
if (ObjectUtils.isNotEmpty(dcBaseWorkSpecial)) {
dcBusiTargetAdjustDayMasterDao.setFieldName(dcBaseWorkSpecial.getSpecialName());
}
dcBusiTargetAdjustDayMasterDao.setCheckStauts(DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PENDING_CHECK);
dcBusiTargetAdjustDayMasterDao.setCheckType(DcBusiTargetAdjustDayMasterDao.CHECK_TYPE_ARTIFICIAL);
dcBusiTargetAdjustDayMasterDao.setBiilType("1");
dcBusiTargetAdjustDayMasterDao.setCreatedTime(DateUtils.getNowDate());
dcBusiTargetAdjustDayMasterDao.setCreatedBy(SecurityUtils.getUsername());
// 新增子表数据
List<DcBusiTargetAdjustDaySubDao> children = dcBusiTargetAdjustDayMasterDao.getChildren();
for (DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao : children) {
@ -163,6 +176,7 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
dcBusiTargetAdjustDaySubService.insertDcBusiTargetAdjustDaySubDao(dcBusiTargetAdjustDaySubDao, assetCode);
}
dcBusiTargetAdjustDayMasterDao.setUpdatedTime(DateUtils.getNowDate());
dcBusiTargetAdjustDayMasterDao.setUpdatedBy(SecurityUtils.getUsername());
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao);
}
@ -185,7 +199,6 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
* @param id 资产指标调整单主()主键
* @return 结果
*/
public int deleteDcBusiTargetAdjustDayMasterDaoById(Long id) {
return baseMapper.deleteDcBusiTargetAdjustDayMasterDaoById(id);
}
@ -199,7 +212,7 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
public int audit(Long id) {
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = new DcBusiTargetAdjustDayMasterDao();
dcBusiTargetAdjustDayMasterDao.setId(id);
dcBusiTargetAdjustDayMasterDao.setCheckStauts(DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_CHECKED);
dcBusiTargetAdjustDayMasterDao.setCheckStatus("2");
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao);
}
@ -215,13 +228,11 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
try {
// 查询审核资产指标调整单主表数据
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id);
// 调整单未审核不能处理
if (DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PENDING_CHECK.equals(dcBusiTargetAdjustDayMasterDao.getCheckStauts())) {
throw new RuntimeException("调整单未审核不能处理");
if ("0".equals(dcBusiTargetAdjustDayMasterDao.getCheckStatus())) {
throw new RuntimeException("审核失败,单据未提交");
}
// 调整单已处理
if (DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PROCESSED.equals(dcBusiTargetAdjustDayMasterDao.getCheckStauts())) {
throw new RuntimeException("调整单已处理");
if ("2".equals(dcBusiTargetAdjustDayMasterDao.getCheckStatus())) {
throw new RuntimeException("审核失败,单据已审核");
}
// 查询审核资产指标调整单子表集合
DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao();
@ -259,12 +270,149 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
}
}
// 修改审核状态为已处理
dcBusiTargetAdjustDayMasterDao.setCheckStauts(DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PROCESSED);
dcBusiTargetAdjustDayMasterDao.setCheckStatus("2");
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao);
} catch (RuntimeException e) {
log.error("处理异常", e);
throw e;
}finally {
} finally {
lock.unlock();
}
}
public int checkBack(String billNo) {
DcBusiTargetAdjustDayMasterDao master = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo);
master.setUpdatedBy(SecurityUtils.getUsername());
master.setCreatedTime(DateUtils.getNowDate());
master.setCheckStatus("0");
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(master);
}
@Transactional(rollbackFor = Exception.class)
public int checkPass(String billNo) {
lock.lock();
try {
// 查询审核资产指标调整单主表数据
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo);
if ("0".equals(dcBusiTargetAdjustDayMasterDao.getCheckStatus())) {
throw new RuntimeException("审核失败,单据未提交");
}
if ("2".equals(dcBusiTargetAdjustDayMasterDao.getCheckStatus())) {
throw new RuntimeException("审核失败,单据已审核");
}
String dateAdjust = dcBusiTargetAdjustDayMasterDao.getDateAdjust();
String[] dataStrArr = dateAdjust.split("-");
if (dataStrArr.length == 3) {
throw new RuntimeException("调整目标日期有误");
}
// 查询审核资产指标调整单子表集合
DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao();
params.setBillNoMaster(dcBusiTargetAdjustDayMasterDao.getBillSerial());
List<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDaySubDaoList = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(params);
DcBusiTargetDraftMonth dcBusiTargetDraftMonth;
// 遍历子表集合,向指标数据底稿表(日)中同步数据
for (DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao : dcBusiTargetAdjustDaySubDaoList) {
dcBusiTargetDraftMonth = new DcBusiTargetDraftMonth();
dcBusiTargetDraftMonth.setCompanyId(dcBusiTargetAdjustDayMasterDao.getCompanyId());
dcBusiTargetDraftMonth.setOrgId(dcBusiTargetAdjustDayMasterDao.getOragnizeId());
dcBusiTargetDraftMonth.setAssetCode(dcBusiTargetAdjustDayMasterDao.getAssetCode());
dcBusiTargetDraftMonth.setFieldCode(dcBusiTargetAdjustDayMasterDao.getFieldCode());
dcBusiTargetDraftMonth.setTargetCode(dcBusiTargetAdjustDaySubDao.getTargetCode());
List<DcBusiTargetDraftMonth> dcBusiTargetDraftMonthList = dcBusiTargetDraftMonthMapper.selectDcBusiTargetDraftMonthList(dcBusiTargetDraftMonth);
// 如果未查询出来指标数据底稿数据,就新增,否则修改
if (CollectionUtils.isEmpty(dcBusiTargetDraftMonthList)) {
dcBusiTargetDraftMonth.setCompanyName(dcBusiTargetAdjustDayMasterDao.getCompanyName());
dcBusiTargetDraftMonth.setOrgName(dcBusiTargetAdjustDayMasterDao.getOrganizeName());
dcBusiTargetDraftMonth.setAssetName(dcBusiTargetAdjustDayMasterDao.getAssetName());
dcBusiTargetDraftMonth.setFieldName(dcBusiTargetAdjustDayMasterDao.getFieldName());
dcBusiTargetDraftMonth.setTargetName(dcBusiTargetAdjustDaySubDao.getTargetName());
dcBusiTargetDraftMonth.setTargetUint(dcBusiTargetAdjustDaySubDao.getTagetUnit());
dcBusiTargetDraftMonth.setCountDate(dcBusiTargetAdjustDayMasterDao.getDateAdjust());
dcBusiTargetDraftMonth.setValOriginal(dcBusiTargetAdjustDaySubDao.getValOrigin());
dcBusiTargetDraftMonth.setValAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust());
dcBusiTargetDraftMonth.setValResult(dcBusiTargetAdjustDaySubDao.getValResult());
dcBusiTargetDraftMonthMapper.insertDcBusiTargetDraftMonth(dcBusiTargetDraftMonth);
} else {
dcBusiTargetDraftMonth = dcBusiTargetDraftMonthList.get(0);
BigDecimal valResult = dcBusiTargetDraftMonth.getValResult().add(new BigDecimal(0));
dcBusiTargetDraftMonth.setValOriginal(valResult);
dcBusiTargetDraftMonth.setValAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust());
dcBusiTargetDraftMonth.setValResult(valResult.add(dcBusiTargetAdjustDaySubDao.getValAdjust()));
dcBusiTargetDraftMonthMapper.updateDcBusiTargetDraftMonth(dcBusiTargetDraftMonth);
}
}
// 修改审核状态为已处理
dcBusiTargetAdjustDayMasterDao.setCheckStatus("2");
dcBusiTargetAdjustDayMasterDao.setUpdatedBy(SecurityUtils.getUsername());
dcBusiTargetAdjustDayMasterDao.setCreatedTime(DateUtils.getNowDate());
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao);
} catch (RuntimeException e) {
log.error("处理异常", e);
throw e;
} finally {
lock.unlock();
}
}
@Transactional(rollbackFor = Exception.class)
public int checkRevert(String billNo) {
lock.lock();
try {
// 查询审核资产指标调整单主表数据
DcBusiTargetAdjustDayMasterDao master = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo);
if ("0".equals(master.getCheckStatus())) {
throw new RuntimeException("反审核失败,单据未提交");
}
if ("1".equals(master.getCheckStatus())) {
throw new RuntimeException("反审核失败,单据未审核通过");
}
// 如果单据状态为已审核状态,需要把底稿表数据恢复
if ("2".equals(master.getCheckStatus())) {
// String dateAdjust = master.getDateAdjust();
// String[] dataStrArr = dateAdjust.split("-");
// String year = null;
// String month = null;
// String day = null;
// if (dataStrArr.length == 3) {
// year = dataStrArr[0];
// month = dataStrArr[1];
// day = dataStrArr[2];
// } else {
// throw new RuntimeException("调整目标日期有误");
// }
// 查询审核资产指标调整单子表集合
// DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao();
// params.setBillNoMaster(billNo);
// List<DcBusiTargetAdjustDaySubDao> subList = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(params);
// DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew;
// if (CollectionUtils.isEmpty(subList)) {
// for (DcBusiTargetAdjustDaySubDao sub : subList) {
// dcBusiTargetDraftDaynew = new DcBusiTargetDraftDaynew();
// dcBusiTargetDraftDaynew.setCompanyId(master.getCompanyId());
// dcBusiTargetDraftDaynew.setOrganizeId(master.getOragnizeId());
// dcBusiTargetDraftDaynew.setFieldCode(master.getFieldCode());
// dcBusiTargetDraftDaynew.setAssetCode(master.getAssetCode());
// dcBusiTargetDraftDaynew.setTargetCode(sub.getTargetCode());
// dcBusiTargetDraftDaynew.setDateYear(year);
// dcBusiTargetDraftDaynew.setDateMonth(month);
// dcBusiTargetDraftDaynew.setDateDay(day);
// List<DcBusiTargetDraftDaynew> dcBusiTargetDraftDaynews = dcBusiTargetDraftDaynewMapper.selectDcBusiTargetDraftDaynewList(dcBusiTargetDraftDaynew);
// // 如果底稿表数据不为空,则减去计划值
// if (!CollectionUtils.isEmpty(dcBusiTargetDraftDaynews)) {
// dcBusiTargetDraftDaynew = dcBusiTargetDraftDaynews.get(0);
// dcBusiTargetDraftDaynewMapper.updateDcBusiTargetDraftDaynew(dcBusiTargetDraftDaynew);
// }
// }
// }
}
master.setUpdatedBy(SecurityUtils.getUsername());
master.setCreatedTime(DateUtils.getNowDate());
master.setCheckStatus("0");
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(master);
} catch (RuntimeException e) {
log.error("处理异常", e);
throw e;
} finally {
lock.unlock();
}
}

2
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetAdjustDaySubService.java

@ -2,6 +2,7 @@ package com.lzbi.draft.service;
import java.util.List;
import com.lzbi.common.utils.DateUtils;
import com.lzbi.common.utils.SecurityUtils;
import com.lzbi.draft.domain.DcBusiTargetAdjustDaySubDao;
import com.lzbi.draft.mapper.DcBusiTargetAdjustDaySubMapper;
import com.lzbi.targetFolder.domain.DcBaseAssetTarget;
@ -64,6 +65,7 @@ public class DcBusiTargetAdjustDaySubService extends ServiceImpl<DcBusiTargetAdj
dcBusiTargetAdjustDaySubDao.setTargetName(dcBaseAssetTarget.getTargetName());
}
dcBusiTargetAdjustDaySubDao.setCreatedTime(DateUtils.getNowDate());
dcBusiTargetAdjustDaySubDao.setCreatedBy(SecurityUtils.getUsername());
return baseMapper.insertDcBusiTargetAdjustDaySubDao(dcBusiTargetAdjustDaySubDao);
}

6
lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiTargetDraftDaynewService.java → lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetDraftDaynewService.java

@ -1,10 +1,10 @@
package com.lzbi.bi.service;
package com.lzbi.draft.service;
import java.util.List;
import com.lzbi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.lzbi.bi.domain.DcBusiTargetDraftDaynew;
import com.lzbi.bi.mapper.DcBusiTargetDraftDaynewMapper;
import com.lzbi.draft.domain.DcBusiTargetDraftDaynew;
import com.lzbi.draft.mapper.DcBusiTargetDraftDaynewMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**

17
lzbi-module/src/main/resources/mapper/asset/DcBusiTargetAdjustDayMasterMapper.xml

@ -25,7 +25,7 @@
<result property="updatedTime" column="updated_time"/>
<result property="deleteBy" column="delete_by"/>
<result property="deleteTime" column="delete_time"/>
<result property="checkStauts" column="check_stauts"/>
<result property="checkStatus" column="check_status"/>
<result property="checkType" column="check_type"/>
</resultMap>
@ -50,7 +50,7 @@
updated_time,
delete_by,
delete_time,
check_stauts,
check_status,
check_type
from dc_busi_target_adjust_day_master
</sql>
@ -74,7 +74,7 @@
<if test="fieldCode != null and fieldCode != ''">and field_code = #{fieldCode}</if>
<if test="fieldName != null and fieldName != ''">and field_name like concat('%', #{fieldName}, '%')</if>
<if test="dateAdjust != null and dateAdjust != ''">and date_adjust = #{dateAdjust}</if>
<if test="checkStauts != null and checkStauts != ''">and check_stauts = #{checkStauts}</if>
<if test="checkStatus != null and checkStatus != ''">and check_status = #{checkStatus}</if>
<if test="checkType != null and checkType != ''">and check_type = #{checkType}</if>
</where>
order by created_time desc
@ -85,6 +85,11 @@
<include refid="selectDcBusiTargetAdjustDayMasterVo"/>
where id = #{id}
</select>
<select id="selectDcBusiTargetAdjustDayMasterDaoByBillNo"
resultType="com.lzbi.draft.domain.DcBusiTargetAdjustDayMasterDao">
<include refid="selectDcBusiTargetAdjustDayMasterVo"/>
where bill_serial = #{billNo}
</select>
<insert id="insertDcBusiTargetAdjustDayMasterDao" parameterType="DcBusiTargetAdjustDayMasterDao" useGeneratedKeys="true"
keyProperty="id">
@ -109,7 +114,7 @@
<if test="updatedTime != null">updated_time,</if>
<if test="deleteBy != null">delete_by,</if>
<if test="deleteTime != null">delete_time,</if>
<if test="checkStauts != null">check_stauts,</if>
<if test="checkStatus != null">check_status,</if>
<if test="checkType != null">check_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -132,7 +137,7 @@
<if test="updatedTime != null">#{updatedTime},</if>
<if test="deleteBy != null">#{deleteBy},</if>
<if test="deleteTime != null">#{deleteTime},</if>
<if test="checkStauts != null">#{checkStauts},</if>
<if test="checkStatus != null">#{checkStatus},</if>
<if test="checkType != null">#{checkType},</if>
</trim>
</insert>
@ -159,7 +164,7 @@
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
<if test="deleteBy != null">delete_by = #{deleteBy},</if>
<if test="deleteTime != null">delete_time = #{deleteTime},</if>
<if test="checkStauts != null">check_stauts = #{checkStauts},</if>
<if test="checkStatus != null">check_status = #{checkStatus},</if>
<if test="checkType != null">check_type = #{checkType},</if>
</trim>
where id = #{id}

4
lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml

@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lzbi.bi.mapper.DcBusiTargetDraftDaynewMapper">
<mapper namespace="com.lzbi.draft.mapper.DcBusiTargetDraftDaynewMapper">
<resultMap type="com.lzbi.bi.domain.DcBusiTargetDraftDaynew" id="DcBusiTargetDraftDaynewResult">
<resultMap type="com.lzbi.draft.domain.DcBusiTargetDraftDaynew" id="DcBusiTargetDraftDaynewResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="revision" column="revision" />

Loading…
Cancel
Save