Commit 87591a15 authored by kongfm's avatar kongfm

修改 告知书流程接口 新增气瓶统计表相关接口

parent 1e7f2822
...@@ -18,6 +18,7 @@ import org.springframework.context.ConfigurableApplicationContext; ...@@ -18,6 +18,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
...@@ -38,6 +39,7 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -38,6 +39,7 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
@EnableFeignClients @EnableFeignClients
@EnableAsync @EnableAsync
@EnableEurekaClient @EnableEurekaClient
@EnableScheduling
@MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao", "com.yeejoin.amos.api.*.face.orm.dao", "org.typroject.tyboot.face.*.orm.dao*", @MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao", "com.yeejoin.amos.api.*.face.orm.dao", "org.typroject.tyboot.face.*.orm.dao*",
"com.yeejoin.amos.boot.biz.common.dao.mapper" }) "com.yeejoin.amos.boot.biz.common.dao.mapper" })
@ComponentScan({ "org.typroject", "com.yeejoin.amos" }) @ComponentScan({ "org.typroject", "com.yeejoin.amos" })
......
package com.yeejoin.amos.api.openapi.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderDateInfoModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingCheckModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingExamineModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingExamineModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderFillingRecordModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderInfoModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderInfoModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderInspectionModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderInspectionModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderTableModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderTagsModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderTagsModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderUnitModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderUnitModelList;
import com.yeejoin.amos.api.openapi.face.model.CylinderUnitTree;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderDateInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFilling;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingCheck;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingExamine;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingRecord;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderInspection;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderTags;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderUnit;
import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiBizToken;
import com.yeejoin.amos.api.openapi.face.service.CylinderDateInfoService;
import com.yeejoin.amos.api.openapi.face.service.CylinderFillingCheckService;
import com.yeejoin.amos.api.openapi.face.service.CylinderFillingExamineService;
import com.yeejoin.amos.api.openapi.face.service.CylinderFillingRecordService;
import com.yeejoin.amos.api.openapi.face.service.CylinderFillingService;
import com.yeejoin.amos.api.openapi.face.service.CylinderInfoService;
import com.yeejoin.amos.api.openapi.face.service.CylinderInspectionService;
import com.yeejoin.amos.api.openapi.face.service.CylinderTagsService;
import com.yeejoin.amos.api.openapi.face.service.CylinderUnitService;
import com.yeejoin.amos.api.openapi.face.service.OpenapiBizTokenService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@TycloudResource(module = "openapi", value = "cylinderPage")
@RequestMapping(value = "/cylinderPage")
@Api(tags = "气瓶首页controller")
public class CylinderPageController {
private static final Logger logger = LogManager.getLogger(CylinderPageController.class);
@Autowired
private CylinderUnitService cylinderUnitService;
@Autowired
private CylinderFillingCheckService cylinderFillingCheckService;
@Autowired
private CylinderFillingExamineService cylinderFillingExamineService;
@Autowired
private CylinderFillingRecordService cylinderFillingRecordService;
@Autowired
private CylinderFillingService cylinderFillingService;
@Autowired
private CylinderInfoService cylinderInfoService;
@Autowired
private CylinderInspectionService cylinderInspectionService;
@Autowired
private CylinderTagsService cylinderTagsService;
@Autowired
private OpenapiBizTokenService openapiBizTokenService;
@Autowired
private CylinderDateInfoService cylinderDateInfoService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "服务商树")
@GetMapping(value = "/serviceProvider")
public ResponseModel<List<CylinderUnitTree>> cylinderUnit() throws Exception {
List<CylinderUnitTree> result = new ArrayList<>();
List<String> serviceList = openapiBizTokenService.getServiceList();
serviceList.stream().forEach(s -> {
CylinderUnitTree temp = new CylinderUnitTree();
List<OpenapiBizToken> children = openapiBizTokenService.list(new LambdaQueryWrapper<OpenapiBizToken>().eq(OpenapiBizToken::getDeveloperAgency,s)
.eq(OpenapiBizToken::getDataType,"cyl"));
List<CylinderUnitTree> childrenList = new ArrayList<>();
children.stream().forEach(c ->{
CylinderUnitTree tt = new CylinderUnitTree();
tt.setUnitName(c.getApiCompanyName());
tt.setAppId(c.getAppId());
childrenList.add(tt);
});
temp.setUnitName(s);
temp.setChildren(childrenList);
result.add(temp);
});
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "根据搜索信息获取表格数据")
@PostMapping(value = "/getTableInfo")
public ResponseModel<List<CylinderTableModel>> cylinderTableInfo(@RequestParam(value = "serviceName",required = false) String serviceName,
@RequestParam(value = "appId",required = false) String appId,
@RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime) {
// 先同步或者更新今日数据
cylinderDateInfoService.updateTodayDate();
// 查询数据
List<CylinderTableModel> result = cylinderDateInfoService.selectTodayDate(serviceName, appId, startTime, endTime);
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "同步气瓶数据")
@GetMapping(value = "/initCylinderNum")
public ResponseModel<Boolean> initCylinderNum() {
Boolean result = cylinderDateInfoService.initCylinderNum();
return ResponseHelper.buildResponse(result);
};
}
package com.yeejoin.amos.api.openapi.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@EqualsAndHashCode(callSuper = true)
@Data
public class CylinderDateInfoModel extends AbstractBaseModel{
/**
*
*/
private static final long serialVersionUID = 1L;
private Date SyncDate;//同步时间 yyyy-MM-dd HH24:mi:ss
private String developerAgency;
protected String appId;
private String unitName;
private Integer cylinderInfo;
private Integer cylinderTagInfo;
private Integer cylinderInspectionInfo;
private Integer cylinderFillingInfo;
private Integer cylinderFillingRecordInfo;
private Integer cylinderFillingCheckInfo;
private Integer cylinderExamineInfo;
private Integer cylinderUnit;
}
package com.yeejoin.amos.api.openapi.face.model;
import lombok.Data;
/**
* @author fengwang
* @date 2022/1/24.
*/
@Data
public class CylinderTableModel {
/**
* 服务商名称
*/
private String unitName;
/**
* 气瓶企业信息
*/
private Integer cylinderUnit;
/**
* 气瓶基本信息
*/
private Integer cylinderInfo;
/**
* 气瓶标签信息
*/
private Integer cylinderTagInfo;
/**
* 气瓶检验信息
*/
private Integer cylinderInspectionInfo;
/**
* 气瓶充装前检查
*/
private Integer cylinderFllingInfo;
/**
* 气瓶充装信息
*/
private Integer cylinderFllingRecordInfo;
/**
* 充装后复查
*/
private Integer cylinderFllingCheckInfo;
/**
* 气瓶充装信息审核
*/
private Integer cylinderExamineInfo;
}
package com.yeejoin.amos.api.openapi.face.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
public class CylinderUnitTree extends AbstractBaseModel{
/**
*
*/
private static final long serialVersionUID = 1L;
private String unitName;
private String appId;
private List<CylinderUnitTree> children;
}
package com.yeejoin.amos.api.openapi.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderDateInfo;
/**
*
* <pre>
* 气瓶基本信息Mapper 接口
* </pre>
*
* @author gwb
* @version $Id: ElevatorMapper.java, v 0.1 2021年9月30日 下午3:28:31 gwb Exp $
*/
public interface CylinderDateInfoMapper extends BaseMapper<CylinderDateInfo> {
}
\ No newline at end of file
...@@ -2,6 +2,9 @@ package com.yeejoin.amos.api.openapi.face.orm.dao; ...@@ -2,6 +2,9 @@ package com.yeejoin.amos.api.openapi.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingRecord; import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingRecord;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* *
...@@ -14,4 +17,7 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingRecord; ...@@ -14,4 +17,7 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingRecord;
*/ */
public interface CylinderFillingRecordMapper extends BaseMapper<CylinderFillingRecord> { public interface CylinderFillingRecordMapper extends BaseMapper<CylinderFillingRecord> {
@Select("select date_format(`t`.`sync_date`,'%Y-%m-%d') AS `sync_time` from tm_cylinder_filling_record t GROUP BY date_format(`t`.`sync_date`,'%Y-%m-%d') ")
List<String> getDateList();
} }
\ No newline at end of file
...@@ -6,6 +6,8 @@ import org.apache.ibatis.annotations.Select; ...@@ -6,6 +6,8 @@ import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiBizToken; import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiBizToken;
import java.util.List;
/** /**
* *
* <pre> * <pre>
...@@ -16,11 +18,17 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiBizToken; ...@@ -16,11 +18,17 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiBizToken;
* @version $Id: OpenapiLogMapper.java, v 0.1 2021年11月10日 下午5:54:19 gwb Exp $ * @version $Id: OpenapiLogMapper.java, v 0.1 2021年11月10日 下午5:54:19 gwb Exp $
*/ */
public interface OpenapiBizTokenMapper extends BaseMapper<OpenapiBizToken> { public interface OpenapiBizTokenMapper extends BaseMapper<OpenapiBizToken> {
@Select("SELECT " +
@Select("SELECT " +
" * " + " * " +
" FROM " + " FROM " +
" iot_openapi_biz_token bt " + " iot_openapi_biz_token bt " +
" WHERE " + " WHERE " +
" bt.APP_ID = '${appId}'") " bt.APP_ID = '${appId}'")
public OpenapiBizToken getByAppId(@Param("appId") String appId); public OpenapiBizToken getByAppId(@Param("appId") String appId);
@Select("select DEVELOPER_AGENCY from iot_openapi_biz_token where DEVELOPER_AGENCY is not null AND DATA_TYPE = 'cyl' group by DEVELOPER_AGENCY")
public List<String> getServiceList();
} }
\ No newline at end of file
package com.yeejoin.amos.api.openapi.face.orm.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 气瓶基本信息
* @author kinky
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("cylinder_date_info")
public class CylinderDateInfo extends BaseEntity {
/**
* 同步时间
*/
private static final long serialVersionUID = 1L;
@TableField("sync_date")
protected Date SyncDate;//同步时间 yyyy-MM-dd HH24:mi:ss
/**
* 服务机构-开发机构
*/
@TableField("DEVELOPER_AGENCY")
private String developerAgency;
/**
* 对接公司编码
*/
@TableField("app_Id")
protected String appId;
/**
* 气瓶企业信息
*/
@TableField("unit_name")
private String unitName;
/**
* 气瓶基本信息
*/
@TableField("cylinder_info")
private Integer cylinderInfo;
/**
* 气瓶标签信息
*/
@TableField("cylinder_tag_info")
private Integer cylinderTagInfo;
/**
* 气瓶检验信息
*/
@TableField("cylinder_inspection_info")
private Integer cylinderInspectionInfo;
/**
* 气瓶充装前检查
*/
@TableField("cylinder_filling_info")
private Integer cylinderFillingInfo;
/**
* 气瓶充装信息
*/
@TableField("cylinder_filling_record_info")
private Integer cylinderFillingRecordInfo;
/**
* 充装后复查
*/
@TableField("cylinder_filling_check_info")
private Integer cylinderFillingCheckInfo;
/**
* 气瓶充装信息审核
*/
@TableField("cylinder_examine_info")
private Integer cylinderExamineInfo;
/**
* 气瓶充装信息审核
*/
@TableField("cylinder_unit")
private Integer cylinderUnit;
}
package com.yeejoin.amos.api.openapi.face.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.api.openapi.constant.Constant;
import com.yeejoin.amos.api.openapi.face.model.BizTokenModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderDateInfoModel;
import com.yeejoin.amos.api.openapi.face.model.CylinderTableModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.CylinderDateInfoMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderDateInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFilling;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingCheck;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingExamine;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderFillingRecord;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderInspection;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderTags;
import com.yeejoin.amos.api.openapi.face.orm.entity.CylinderUnit;
import com.yeejoin.amos.api.openapi.face.orm.entity.OpenapiBizToken;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
* <pre>
*气瓶基本信息 服务类
* </pre>
*
* @author gwb
* @version $Id: ElevatorService.java, v 0.1 2021年9月30日 下午3:28:55 gwb Exp $
*/
@Component
public class CylinderDateInfoService extends BaseService<CylinderDateInfoModel, CylinderDateInfo, CylinderDateInfoMapper> {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private CylinderUnitService cylinderUnitService;
@Autowired
private CylinderFillingCheckService cylinderFillingCheckService;
@Autowired
private CylinderFillingExamineService cylinderFillingExamineService;
@Autowired
private CylinderFillingRecordService cylinderFillingRecordService;
@Autowired
private CylinderFillingService cylinderFillingService;
@Autowired
private CylinderInfoService cylinderInfoService;
@Autowired
private CylinderInspectionService cylinderInspectionService;
@Autowired
private CylinderTagsService cylinderTagsService;
@Autowired
private OpenapiBizTokenService openapiBizTokenService;
public final static long ONE_Minute = 60 * 1000 * 10;
private String getAppId() {
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
return bizTokenModel.getAppId();
}
public void updateTodayDate() {
List<String> serviceUnitList = openapiBizTokenService.getServiceList();
serviceUnitList.stream().forEach(s -> {
List<OpenapiBizToken> tokenList = openapiBizTokenService.list(new LambdaQueryWrapper<OpenapiBizToken>().eq(OpenapiBizToken::getDeveloperAgency,s).eq(OpenapiBizToken::getDataType,"cyl"));
for(OpenapiBizToken token : tokenList) {
try {
Date today = new Date();
String todayStr = DateUtils.dateFormat(today,"yyyy-MM-dd");
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getSyncDate, todayStr + " 00:00:00"));
if(list.size() == 0) {
CylinderDateInfoModel temp = new CylinderDateInfoModel();
temp.setSyncDate(today);
String appid = token.getAppId();
temp.setUnitName(token.getApiCompanyName());
temp.setAppId(appid);
temp.setDeveloperAgency(s);
// 获取气瓶基本信息
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId,appid).between(CylinderInfo::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId,appid).between(CylinderUnit::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId,appid).between(CylinderTags::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId,appid).between(CylinderInspection::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId,appid).between(CylinderFilling::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId,appid).between(CylinderFillingRecord::getSyncDate,todayStr+ " 00:00:00",todayStr + " 23:59:59"));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId,appid).between(CylinderFillingCheck::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId,appid).between(CylinderFillingExamine::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
temp.setCylinderExamineInfo(examine);
temp.setCylinderUnit(cylinderUnit);
temp.setCylinderFillingCheckInfo(fillingCheck);
temp.setCylinderFillingInfo(filling);
temp.setCylinderInspectionInfo(inspection);
temp.setCylinderTagInfo(tags);
temp.setCylinderInfo(cylinder);
temp.setCylinderFillingRecordInfo(fillingRecord);
this.createWithModel(temp);
} else {
list.forEach( info -> {
String appid = token.getAppId();
// 获取气瓶基本信息
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId,appid).between(CylinderInfo::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId,appid).between(CylinderUnit::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId,appid).between(CylinderTags::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId,appid).between(CylinderInspection::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId,appid).between(CylinderFilling::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId,appid).between(CylinderFillingRecord::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId,appid).between(CylinderFillingCheck::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId,appid).between(CylinderFillingExamine::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
info.setCylinderExamineInfo(examine);
info.setCylinderUnit(cylinderUnit);
info.setCylinderFillingCheckInfo(fillingCheck);
info.setCylinderFillingInfo(filling);
info.setCylinderInspectionInfo(inspection);
info.setCylinderTagInfo(tags);
info.setCylinderInfo(cylinder);
info.setCylinderFillingRecordInfo(fillingRecord);
this.updateById(info);
});
}
} catch (ParseException e) {
e.printStackTrace();
}
}
});
}
public List<CylinderTableModel> selectTodayDate(String serviceName, String appId, String startTime, String endTime) {
List<CylinderTableModel> result = new ArrayList<>();
List<String> serviceList = new ArrayList<>();
// 如果没有serviceName 及 appId 获取全部数据
if(StringUtils.isBlank(serviceName) && StringUtils.isBlank(appId) ) {
serviceList = openapiBizTokenService.getServiceList();
} else if(StringUtils.isNotBlank(serviceName) && StringUtils.isBlank(appId)) {
serviceList = new ArrayList<String>();
serviceList.add(serviceName);
} else if(StringUtils.isNotBlank(appId)) { // 只查一个企业的
}
if(serviceList.size() > 0) {
serviceList.stream().forEach(s -> {
List<OpenapiBizToken> tokenList = openapiBizTokenService.list(new LambdaQueryWrapper<OpenapiBizToken>().eq(OpenapiBizToken::getDeveloperAgency,s).eq(OpenapiBizToken::getDataType,"cyl"));
for(OpenapiBizToken token : tokenList) {
CylinderTableModel temp = new CylinderTableModel();
temp.setUnitName(token.getApiCompanyName());
// 获取气瓶基本信息
Integer cylinderUnit = 0;
Integer cylinder = 0;
Integer tags = 0;
Integer inspection = 0;
Integer flling = 0;
Integer fllingRecord = 0;
Integer fllingCheck = 0;
Integer examine = 0;
// 不传入时间默认全部数据
if(StringUtils.isBlank(startTime) && StringUtils.isBlank(endTime)) {
// 获取气瓶基本信息
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getAppId,token.getAppId()));
for(CylinderDateInfo info : list) {
cylinder += info.getCylinderInfo();
cylinderUnit += info.getCylinderUnit();
tags += info.getCylinderTagInfo();
inspection += info.getCylinderInspectionInfo();
flling += info.getCylinderFillingInfo();
fllingRecord += info.getCylinderFillingRecordInfo();
fllingCheck += info.getCylinderFillingCheckInfo();
examine += info.getCylinderExamineInfo();
}
} else if(StringUtils.isNotBlank(startTime) && StringUtils.isBlank(endTime)) {
// 获取气瓶基本信息
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getAppId,token.getAppId()).ge(CylinderDateInfo::getSyncDate,startTime +" 00:00:00"));
for(CylinderDateInfo info : list) {
cylinder += info.getCylinderInfo();
cylinderUnit += info.getCylinderUnit();
tags += info.getCylinderTagInfo();
inspection += info.getCylinderInspectionInfo();
flling += info.getCylinderFillingInfo();
fllingRecord += info.getCylinderFillingRecordInfo();
fllingCheck += info.getCylinderFillingCheckInfo();
examine += info.getCylinderExamineInfo();
}
} else if(StringUtils.isBlank(startTime) && StringUtils.isNotBlank(endTime)) {
// 获取气瓶基本信息
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getAppId,token.getAppId()).le(CylinderDateInfo::getSyncDate,endTime +" 00:00:00"));
for(CylinderDateInfo info : list) {
cylinder += info.getCylinderInfo();
cylinderUnit += info.getCylinderUnit();
tags += info.getCylinderTagInfo();
inspection += info.getCylinderInspectionInfo();
flling += info.getCylinderFillingInfo();
fllingRecord += info.getCylinderFillingRecordInfo();
fllingCheck += info.getCylinderFillingCheckInfo();
examine += info.getCylinderExamineInfo();
}
} else if(StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)) {
// 获取气瓶基本信息
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getAppId,token.getAppId()).between(CylinderDateInfo::getSyncDate,startTime +" 00:00:00", endTime + " 23:59:59"));
for(CylinderDateInfo info : list) {
cylinder += info.getCylinderInfo();
cylinderUnit += info.getCylinderUnit();
tags += info.getCylinderTagInfo();
inspection += info.getCylinderInspectionInfo();
flling += info.getCylinderFillingInfo();
fllingRecord += info.getCylinderFillingRecordInfo();
fllingCheck += info.getCylinderFillingCheckInfo();
examine += info.getCylinderExamineInfo();
}
}
temp.setCylinderUnit(cylinderUnit);
temp.setCylinderFllingCheckInfo(fllingCheck);
temp.setCylinderExamineInfo(examine);
temp.setCylinderFllingInfo(flling);
temp.setCylinderFllingRecordInfo(fllingRecord);
temp.setCylinderInspectionInfo(inspection);
temp.setCylinderTagInfo(tags);
temp.setCylinderInfo(cylinder);
result.add(temp);
}
});
} else {
OpenapiBizToken token = openapiBizTokenService.getOne(new LambdaQueryWrapper<OpenapiBizToken>().eq(OpenapiBizToken::getAppId,appId).eq(OpenapiBizToken::getDataType,"cyl"));
CylinderTableModel temp = new CylinderTableModel();
temp.setUnitName(token.getApiCompanyName());
// 获取气瓶基本信息
Integer cylinderUnit = 0;
Integer cylinder = 0;
Integer tags = 0;
Integer inspection = 0;
Integer flling = 0;
Integer fllingRecord = 0;
Integer fllingCheck = 0;
Integer examine = 0;
// 不传入时间默认全部数据
if(StringUtils.isBlank(startTime) && StringUtils.isBlank(endTime)) {
// 获取气瓶基本信息
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getAppId,token.getAppId()));
for(CylinderDateInfo info : list) {
cylinder += info.getCylinderInfo();
cylinderUnit += info.getCylinderUnit();
tags += info.getCylinderTagInfo();
inspection += info.getCylinderInspectionInfo();
flling += info.getCylinderFillingInfo();
fllingRecord += info.getCylinderFillingRecordInfo();
fllingCheck += info.getCylinderFillingCheckInfo();
examine += info.getCylinderExamineInfo();
}
} else if(StringUtils.isNotBlank(startTime) && StringUtils.isBlank(endTime)) {
// 获取气瓶基本信息
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getAppId,token.getAppId()).ge(CylinderDateInfo::getSyncDate,startTime +" 00:00:00"));
for(CylinderDateInfo info : list) {
cylinder += info.getCylinderInfo();
cylinderUnit += info.getCylinderUnit();
tags += info.getCylinderTagInfo();
inspection += info.getCylinderInspectionInfo();
flling += info.getCylinderFillingInfo();
fllingRecord += info.getCylinderFillingRecordInfo();
fllingCheck += info.getCylinderFillingCheckInfo();
examine += info.getCylinderExamineInfo();
}
} else if(StringUtils.isBlank(startTime) && StringUtils.isNotBlank(endTime)) {
// 获取气瓶基本信息
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getAppId,token.getAppId()).le(CylinderDateInfo::getSyncDate,endTime +" 00:00:00"));
for(CylinderDateInfo info : list) {
cylinder += info.getCylinderInfo();
cylinderUnit += info.getCylinderUnit();
tags += info.getCylinderTagInfo();
inspection += info.getCylinderInspectionInfo();
flling += info.getCylinderFillingInfo();
fllingRecord += info.getCylinderFillingRecordInfo();
fllingCheck += info.getCylinderFillingCheckInfo();
examine += info.getCylinderExamineInfo();
}
} else if(StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)) {
// 获取气瓶基本信息
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getAppId,token.getAppId()).between(CylinderDateInfo::getSyncDate,startTime +" 00:00:00", endTime + " 23:59:59"));
for(CylinderDateInfo info : list) {
cylinder += info.getCylinderInfo();
cylinderUnit += info.getCylinderUnit();
tags += info.getCylinderTagInfo();
inspection += info.getCylinderInspectionInfo();
flling += info.getCylinderFillingInfo();
fllingRecord += info.getCylinderFillingRecordInfo();
fllingCheck += info.getCylinderFillingCheckInfo();
examine += info.getCylinderExamineInfo();
}
}
temp.setCylinderUnit(cylinderUnit);
temp.setCylinderFllingCheckInfo(fllingCheck);
temp.setCylinderExamineInfo(examine);
temp.setCylinderFllingInfo(flling);
temp.setCylinderFllingRecordInfo(fllingRecord);
temp.setCylinderInspectionInfo(inspection);
temp.setCylinderTagInfo(tags);
temp.setCylinderInfo(cylinder);
result.add(temp);
}
return result;
}
public Boolean initCylinderNum() {
// 气瓶企业信息、气瓶基本信息、气瓶标签信息、气瓶检验信息、气瓶充装前检查、气瓶充装信息、气瓶充装后复查、气瓶充装审核信息
List<CylinderTableModel> result = new ArrayList<>();
List<String> serviceList = openapiBizTokenService.getServiceList();
List<String> dateList = cylinderFillingRecordService.getDateList();
// 根据单位每一天 添加数据
serviceList.stream().forEach(s -> {
List<OpenapiBizToken> tokenList = openapiBizTokenService.list(new LambdaQueryWrapper<OpenapiBizToken>().eq(OpenapiBizToken::getDeveloperAgency,s).eq(OpenapiBizToken::getDataType,"cyl"));
for(OpenapiBizToken token : tokenList) {
for(String d : dateList) {
CylinderDateInfoModel temp = new CylinderDateInfoModel();
try {
temp.setSyncDate(DateUtils.dateParse(d,"yyyy-MM-dd"));
} catch (ParseException e) {
e.printStackTrace();
}
String appid = token.getAppId();
temp.setUnitName(token.getApiCompanyName());
temp.setAppId(appid);
temp.setDeveloperAgency(s);
// 获取气瓶基本信息
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId,appid).between(CylinderInfo::getSyncDate,d + " 00:00:00",d + " 23:59:59"));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId,appid).between(CylinderUnit::getSyncDate,d + " 00:00:00",d + " 23:59:59"));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId,appid).between(CylinderTags::getSyncDate,d + " 00:00:00",d + " 23:59:59"));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId,appid).between(CylinderInspection::getSyncDate,d + " 00:00:00",d + " 23:59:59"));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId,appid).between(CylinderFilling::getSyncDate,d + " 00:00:00",d + " 23:59:59"));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId,appid).between(CylinderFillingRecord::getSyncDate,d + " 00:00:00",d + " 23:59:59"));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId,appid).between(CylinderFillingCheck::getSyncDate,d + " 00:00:00",d + " 23:59:59"));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId,appid).between(CylinderFillingExamine::getSyncDate,d + " 00:00:00",d + " 23:59:59"));
temp.setCylinderExamineInfo(examine);
temp.setCylinderUnit(cylinderUnit);
temp.setCylinderFillingCheckInfo(fillingCheck);
temp.setCylinderFillingInfo(filling);
temp.setCylinderInspectionInfo(inspection);
temp.setCylinderTagInfo(tags);
temp.setCylinderInfo(cylinder);
temp.setCylinderFillingRecordInfo(fillingRecord);
this.createWithModel(temp);
}
}
});
return true;
}
@Scheduled(cron = "0 0 2 * * ?") //每天凌晨两点执行
public void fixedDelayJob(){
// 每天更新或者添加昨天的数据
Date date = new Date();//取时间
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DATE,-1);
//这个时间就是日期往后推一天的结果
date=calendar.getTime();
List<String> serviceUnitList = openapiBizTokenService.getServiceList();
for(String s: serviceUnitList) {
List<OpenapiBizToken> tokenList = openapiBizTokenService.list(new LambdaQueryWrapper<OpenapiBizToken>().eq(OpenapiBizToken::getDeveloperAgency,s).eq(OpenapiBizToken::getDataType,"cyl"));
for(OpenapiBizToken token : tokenList) {
try {
String todayStr = DateUtils.dateFormat(date,"yyyy-MM-dd");
List<CylinderDateInfo> list = this.list(new LambdaQueryWrapper<CylinderDateInfo>().eq(CylinderDateInfo::getSyncDate, todayStr + " 00:00:00"));
if(list.size() == 0) {
CylinderDateInfoModel temp = new CylinderDateInfoModel();
temp.setSyncDate(date);
String appid = token.getAppId();
temp.setUnitName(token.getApiCompanyName());
temp.setAppId(appid);
temp.setDeveloperAgency(s);
// 获取气瓶基本信息
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId,appid).between(CylinderInfo::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId,appid).between(CylinderUnit::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId,appid).between(CylinderTags::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId,appid).between(CylinderInspection::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId,appid).between(CylinderFilling::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId,appid).between(CylinderFillingRecord::getSyncDate,todayStr+ " 00:00:00",todayStr + " 23:59:59"));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId,appid).between(CylinderFillingCheck::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId,appid).between(CylinderFillingExamine::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
temp.setCylinderExamineInfo(examine);
temp.setCylinderUnit(cylinderUnit);
temp.setCylinderFillingCheckInfo(fillingCheck);
temp.setCylinderFillingInfo(filling);
temp.setCylinderInspectionInfo(inspection);
temp.setCylinderTagInfo(tags);
temp.setCylinderInfo(cylinder);
temp.setCylinderFillingRecordInfo(fillingRecord);
this.createWithModel(temp);
} else {
list.forEach( info -> {
String appid = token.getAppId();
// 获取气瓶基本信息
Integer cylinder = cylinderInfoService.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId,appid).between(CylinderInfo::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer cylinderUnit = cylinderUnitService.count(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId,appid).between(CylinderUnit::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer tags = cylinderTagsService.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId,appid).between(CylinderTags::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer inspection = cylinderInspectionService.count(new LambdaQueryWrapper<CylinderInspection>().eq(CylinderInspection::getAppId,appid).between(CylinderInspection::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer filling = cylinderFillingService.count(new LambdaQueryWrapper<CylinderFilling>().eq(CylinderFilling::getAppId,appid).between(CylinderFilling::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer fillingRecord = cylinderFillingRecordService.count(new LambdaQueryWrapper<CylinderFillingRecord>().eq(CylinderFillingRecord::getAppId,appid).between(CylinderFillingRecord::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer fillingCheck = cylinderFillingCheckService.count(new LambdaQueryWrapper<CylinderFillingCheck>().eq(CylinderFillingCheck::getAppId,appid).between(CylinderFillingCheck::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
Integer examine = cylinderFillingExamineService.count(new LambdaQueryWrapper<CylinderFillingExamine>().eq(CylinderFillingExamine::getAppId,appid).between(CylinderFillingExamine::getSyncDate,todayStr + " 00:00:00",todayStr + " 23:59:59"));
info.setCylinderExamineInfo(examine);
info.setCylinderUnit(cylinderUnit);
info.setCylinderFillingCheckInfo(fillingCheck);
info.setCylinderFillingInfo(filling);
info.setCylinderInspectionInfo(inspection);
info.setCylinderTagInfo(tags);
info.setCylinderInfo(cylinder);
info.setCylinderFillingRecordInfo(fillingRecord);
this.updateById(info);
});
}
} catch (ParseException e) {
e.printStackTrace();
}
}
};
System.out.println("更新昨日数据成功");
}
}
...@@ -53,5 +53,9 @@ public class CylinderFillingRecordService extends BaseService<CylinderFillingRec ...@@ -53,5 +53,9 @@ public class CylinderFillingRecordService extends BaseService<CylinderFillingRec
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken()); String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,RequestContext.getToken());
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey); BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
return bizTokenModel.getAppId(); return bizTokenModel.getAppId();
} }
public List<String> getDateList() {
return baseMapper.getDateList();
}
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.openapi.face.service; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.openapi.face.service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -33,6 +34,10 @@ import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel; ...@@ -33,6 +34,10 @@ import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
public class OpenapiBizTokenService extends BaseService<OpenapiBizTokenModel, OpenapiBizToken, OpenapiBizTokenMapper> { public class OpenapiBizTokenService extends BaseService<OpenapiBizTokenModel, OpenapiBizToken, OpenapiBizTokenMapper> {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
public List<String> getServiceList() {
return baseMapper.getServiceList();
}
public String getByAppId(String appId) { public String getByAppId(String appId) {
......
...@@ -111,4 +111,5 @@ public interface IEquipmentInformService { ...@@ -111,4 +111,5 @@ public interface IEquipmentInformService {
* @return * @return
*/ */
Boolean callbackInform(Long sequenceNbr); Boolean callbackInform(Long sequenceNbr);
} }
...@@ -10,9 +10,12 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; ...@@ -10,9 +10,12 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentIndexServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentServiceImpl; import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentServiceImpl;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -20,6 +23,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -20,6 +23,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -38,6 +42,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -38,6 +42,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
...@@ -57,6 +62,11 @@ public class EquipmentController extends BaseController { ...@@ -57,6 +62,11 @@ public class EquipmentController extends BaseController {
@Autowired @Autowired
EquipmentIndexServiceImpl equipmentIndexServiceImpl;
@Autowired
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
/** /**
...@@ -155,6 +165,19 @@ public class EquipmentController extends BaseController { ...@@ -155,6 +165,19 @@ public class EquipmentController extends BaseController {
int num= equipmentServiceImpl.count(equipmentQueryWrapper); int num= equipmentServiceImpl.count(equipmentQueryWrapper);
pageBean.setTotal(num); pageBean.setTotal(num);
IPage<EquipmentDto> equipmentDtoIPager = BeanDtoVoUtils.equipmentIPageDto(page); IPage<EquipmentDto> equipmentDtoIPager = BeanDtoVoUtils.equipmentIPageDto(page);
equipmentDtoIPager.getRecords().stream().forEach( dto -> {
// 封装详细参数
List<EquipmentIndex> indexList = equipmentIndexServiceImpl.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,dto.getSequenceNbr()));
List<EquipmentIndexDto> dtoList = new ArrayList<>();
indexList.stream().forEach(t -> {
EquipmentIndexDto temp = new EquipmentIndexDto();
BeanUtils.copyProperties(t,temp);
dtoList.add(temp);
});
dto.setEquipmentIndex(dtoList);
});
return ResponseHelper.buildResponse(equipmentDtoIPager); return ResponseHelper.buildResponse(equipmentDtoIPager);
} }
......
...@@ -5,13 +5,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -5,13 +5,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto; import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import feign.Response;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -19,12 +24,15 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -19,12 +24,15 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentInformServiceImpl; import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentInformServiceImpl;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
...@@ -45,6 +53,9 @@ public class EquipmentInformController extends BaseController { ...@@ -45,6 +53,9 @@ public class EquipmentInformController extends BaseController {
@Autowired @Autowired
EquipmentInformServiceImpl equipmentInformServiceImpl; EquipmentInformServiceImpl equipmentInformServiceImpl;
@Autowired
WorkflowFeignService workflowFeignService;
/** /**
* 根据regionCode 获取设备告知单单号 * 根据regionCode 获取设备告知单单号
* @param regionCode * @param regionCode
...@@ -269,4 +280,37 @@ public class EquipmentInformController extends BaseController { ...@@ -269,4 +280,37 @@ public class EquipmentInformController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/downloadFile/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "流程图高亮图片", notes = "流程图高亮图片")
public ResponseEntity<String> downloadFile(@PathVariable Long sequenceNbr, HttpServletRequest request, HttpServletResponse response) throws Exception {
String processId = equipmentInformServiceImpl.queryBySeq(sequenceNbr).getProcessId();
if(StringUtils.isBlank(processId)) {
throw new BadRequest("未找到流程图信息");
}
Response feignResponse = workflowFeignService.thighLineImg(processId);
try {
Response.Body body = feignResponse.body();
// response.setContentType("application/octet-stream");//
// response.setHeader("content-type", "application/octet-stream");
// response.setContentType("text/xml");//
// response.setHeader("content-type", "text/xml");
// response.setCharacterEncoding("utf-8");
// response.setHeader("Content-Disposition", "attachment;fileName=workflow.svg");
// response.reset();
// byte[] b = new byte[1024];
// int len;
// while ((len = body.asInputStream().read(b, 0, 1024)) != -1) {
// out.write(b, 0, len);
// }
// out.flush();
return new ResponseEntity<String>(IOUtils.toString(body.asInputStream()), HttpStatus.OK);
//.toByteArray(body.asInputStream()), responseHeaders, HttpStatus.OK);
} catch (Exception e) {
throw new BaseException("Error exporting diagram", "500", processId);
}
}
} }
...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils; ...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService; import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto; import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum; import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
...@@ -50,6 +51,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -50,6 +51,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -505,6 +507,7 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E ...@@ -505,6 +507,7 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
return true; return true;
} }
public boolean excuteTask(EquipmentInformDto model, ReginParams userInfo, InformWorkFlowEnum informWorkFlowEnum) throws Exception { public boolean excuteTask(EquipmentInformDto model, ReginParams userInfo, InformWorkFlowEnum informWorkFlowEnum) throws Exception {
HashMap<String, Object> conditionMap = new HashMap<String, Object>(); HashMap<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", informWorkFlowEnum.getProcessStatus()); conditionMap.put("condition", informWorkFlowEnum.getProcessStatus());
......
spring.application.name=TZS spring.application.name=TZS-kfm
server.servlet.context-path=/tzs server.servlet.context-path=/tzs
server.port=11000 server.port=11000
spring.profiles.active=jd spring.profiles.active=jd
......
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