Commit 62b2c997 authored by “yiyousong”'s avatar “yiyousong”
parents 7bae0f7b a8ae80b6
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
/** /**
* 设备 Feign接口 * 设备 Feign接口
* @author zxfei * @author zxfei
* @date 2022-10-26 * @date 2023-02-25
*/ */
@FeignClient(name = "device-manager", path = "/m", fallbackFactory = DeviceFeignFallbackFactory.class) @FeignClient(name = "device-manager", path = "/m", fallbackFactory = DeviceFeignFallbackFactory.class)
public interface IDeviceFeign extends IFeign { public interface IDeviceFeign extends IFeign {
......
This diff is collapsed.
...@@ -59,6 +59,12 @@ ...@@ -59,6 +59,12 @@
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -225,7 +225,65 @@ CREATE TABLE mortals_xhx_baseset ...@@ -225,7 +225,65 @@ CREATE TABLE mortals_xhx_baseset
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='样表服务基础设置'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='样表服务基础设置';
-- ----------------------------
-- 样报服务表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_sample_bill`;
CREATE TABLE mortals_xhx_sample_bill(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键,自增长',
`siteId` bigint(20) COMMENT '站点ID',
`matterId` bigint(20) DEFAULT '0' COMMENT '事项id',
`matterName` varchar(512) COMMENT '事项名称',
`matterFullName` varchar(512) COMMENT '事项全称',
`materialName` varchar(255) COMMENT '材料名称',
`materialFullName` varchar(255) COMMENT '材料全称',
`deviceCode` varchar(255) COMMENT '设备编码',
`deviceName` varchar(255) COMMENT '设备名称',
`operTime` datetime COMMENT '操作时间',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间',
PRIMARY KEY (`id`)
,KEY `siteId` (`siteId`) USING BTREE
,KEY `matterId` (`matterId`) USING BTREE
,KEY `matterName` (`matterName`) USING BTREE
,KEY `matterFullName` (`matterFullName`) USING BTREE
,KEY `materialName` (`materialName`) USING BTREE
,KEY `materialFullName` (`materialFullName`) USING BTREE
,KEY `deviceCode` (`deviceCode`) USING BTREE
,KEY `deviceName` (`deviceName`) USING BTREE
,KEY `operTime` (`operTime`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='样报服务';
-- ----------------------------
-- 设备表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device`;
CREATE TABLE `mortals_xhx_device` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`deviceId` bigint(20) DEFAULT NULL COMMENT '设备id',
`deviceName` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备名称',
`deviceCode` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '设备编码',
`deviceMac` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '设备的MAC地址',
`siteId` bigint(20) DEFAULT NULL COMMENT '站点Id',
`siteCode` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '站点编号,来源基础服务平台',
`siteName` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '站点名称',
`productCode` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '产品编码',
`productName` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '产品名称',
`deviceSrc` tinyint(2) DEFAULT 2 COMMENT '设备来源(0.子设备,1.网关设备,2.直连设备)',
`lon` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '经度',
`lati` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '纬度',
`leadingOfficial` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '负责人',
`leadingOfficialTelephone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '联系电话',
`deviceStatus` tinyint(2) DEFAULT NULL COMMENT '设备状态 (0.未激活,1.离线,2.在线)',
`deviceRemark` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
`source` tinyint(2) DEFAULT 1 COMMENT '设备来源(0.旧设备,1.新设备)',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) DEFAULT NULL COMMENT '更新用户',
`updateTime` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备';
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 设备来源(0.旧设备,1.新设备)枚举类
*
* @author zxfei
*/
public enum DeviceSourceEnum {
旧设备(0, "旧设备"),
新设备(1, "新设备");
private Integer value;
private String desc;
DeviceSourceEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static DeviceSourceEnum getByValue(Integer value) {
for (DeviceSourceEnum sourceEnum : DeviceSourceEnum.values()) {
if (sourceEnum.getValue() == value) {
return sourceEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (DeviceSourceEnum item : DeviceSourceEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 设备来源(0.子设备,1.网关设备,2.直连设备)枚举类
*
* @author zxfei
*/
public enum DeviceSrcEnum {
子设备(0, "子设备"),
网关设备(1, "网关设备"),
直连设备(2, "直连设备");
private Integer value;
private String desc;
DeviceSrcEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static DeviceSrcEnum getByValue(Integer value) {
for (DeviceSrcEnum deviceSrcEnum : DeviceSrcEnum.values()) {
if (deviceSrcEnum.getValue() == value) {
return deviceSrcEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (DeviceSrcEnum item : DeviceSrcEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 设备状态 (0.未激活,1.离线,2.在线)枚举类
*
* @author zxfei
*/
public enum DeviceStatusEnum {
未激活(0, "未激活"),
离线(1, "离线"),
在线(2, "在线");
private Integer value;
private String desc;
DeviceStatusEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static DeviceStatusEnum getByValue(Integer value) {
for (DeviceStatusEnum deviceStatusEnum : DeviceStatusEnum.values()) {
if (deviceStatusEnum.getValue() == value) {
return deviceStatusEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (DeviceStatusEnum item : DeviceStatusEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.daemon.task;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.device.DevicePdu;
import com.mortals.xhx.common.pdu.site.SiteMatterPdu;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.feign.site.ISiteMatterFeign;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import com.mortals.xhx.module.sheet.model.SheetMatterQuery;
import com.mortals.xhx.module.sheet.service.SheetMatterService;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 同步事项列表
*/
@Slf4j
@Service("SyncSiteDeviceTask")
public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
@Autowired
private ISiteFeign siteFeign;
@Autowired
private IDeviceFeign deviceFeign;
@Autowired
private DeviceService deviceService;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("开始同步设备列表!");
SitePdu sitePdu = new SitePdu();
sitePdu.setId(1L);
Rest<List<SitePdu>> siteRest = siteFeign.getFlatSitesBySiteId(sitePdu);
if (siteRest.getCode() == YesNoEnum.YES.getValue()) {
log.info("站点总数量:{}", siteRest.getData().size());
siteRest.getData().forEach(site -> {
log.info("站点名称:{}",site.getSiteName());
DevicePdu devicePdu = new DevicePdu();
devicePdu.setProductCode("ybj");
devicePdu.setSize(-1);
Rest<RespData<List<DevicePdu>>> deviceRest = deviceFeign.list(devicePdu);
log.info("deviceRest:{}",JSON.toJSONString(deviceRest));
if (YesNoEnum.YES.getValue() == deviceRest.getCode()) {
List<DevicePdu> devicePduList = deviceRest.getData().getData();
log.info("样表机总数量:{}", devicePduList.size());
if (!ObjectUtils.isEmpty(devicePduList)) {
List<DeviceEntity> newDeviceList = devicePduList.stream().map(newDevice -> {
DeviceEntity deviceEntity = new DeviceEntity();
deviceEntity.initAttrValue();
BeanUtils.copyProperties(newDevice, deviceEntity, BeanUtil.getNullPropertyNames(newDevice));
return deviceEntity;
}).collect(Collectors.toList());
List<DeviceEntity> oldDeviceList = deviceService.find(new DeviceQuery().siteId(site.getId()));
Map<String, DeviceEntity> oldDeviceMap = oldDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
List<DeviceEntity> updateDeviceLsit = newDeviceList.stream().map(item -> {
if (oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setId(oldDeviceMap.get(item.getDeviceCode()).getId());
item.setDeviceId(item.getId());
item.setUpdateTime(new Date());
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
List<DeviceEntity> saveDeviceList = newDeviceList.stream().map(item -> {
if (!oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setDeviceId(item.getId());
item.setCreateUserId(1L);
item.setCreateUserName("系统管理员");
item.setCreateTime(new Date());
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(updateDeviceLsit)) {
log.info("设备更新,size:{}", updateDeviceLsit.size());
deviceService.update(updateDeviceLsit);
}
if (!ObjectUtils.isEmpty(saveDeviceList)) {
log.info("设备新增,size:{}", saveDeviceList.size());
deviceService.save(saveDeviceList);
}
}
} else {
log.info("设备列表查询异常,{}", JSON.toJSONString(deviceRest));
}
});
} else {
log.info("站点列表查询异常,{}", JSON.toJSONString(siteRest));
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
...@@ -2,14 +2,15 @@ package com.mortals.xhx.module.device.dao; ...@@ -2,14 +2,15 @@ package com.mortals.xhx.module.device.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
import java.util.List;
/** /**
* 设备Dao * 设备Dao
* 设备 DAO接口 * 设备 DAO接口
* *
* @author zxfei * @author zxfei
* @date 2022-06-27 * @date 2023-02-25
*/ */
public interface DeviceDao extends ICRUDDao<DeviceEntity,Long>{ public interface DeviceDao extends ICRUDDao<DeviceEntity,Long>{
......
package com.mortals.xhx.module.device.dao.ibatis; package com.mortals.xhx.module.device.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.device.dao.DeviceDao; import com.mortals.xhx.module.device.dao.DeviceDao;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
import org.springframework.stereotype.Repository; import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/** /**
* 设备DaoImpl DAO接口 * 设备DaoImpl DAO接口
* *
* @author zxfei * @author zxfei
* @date 2022-06-27 * @date 2023-02-25
*/ */
@Repository("deviceDao") @Repository("deviceDao")
public class DeviceDaoImpl extends BaseCRUDDaoMybatis<DeviceEntity,Long> implements DeviceDao { public class DeviceDaoImpl extends BaseCRUDDaoMybatis<DeviceEntity,Long> implements DeviceDao {
......
package com.mortals.xhx.module.device.model.vo; package com.mortals.xhx.module.device.model.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import lombok.Data; import com.mortals.xhx.module.device.model.DeviceEntity;
import org.apache.poi.ss.usermodel.PictureData; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* 设备视图对象 * 设备视图对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-01 * @date 2023-02-25
*/ */
@Data
public class DeviceVo extends BaseEntityLong { public class DeviceVo extends BaseEntityLong {
/**
* 唯一标识
*/
private String token;
/**
* 平台编码
*/
private String platformCode;
/**
* 产品编码
*/
@Excel(name = "产品类型",cacheDict = "productDict" ,type = Excel.Type.IMPORT)
private String productCode;
/**
* 是否通知第三方
*/
private Boolean switchSend=true;
/**
* 设备图片附件
*/
@Excel(name = "设备图片", type = Excel.Type.IMPORT, cellType = Excel.ColumnType.IMAGE)
@JSONField(deserialize = false,serialize = false)
@JsonIgnore
private PictureData picObj;
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
/**
* 产品列表
*/
private List <Long> productIdList;
private List <Integer> deviceStatusList;
} }
\ No newline at end of file
package com.mortals.xhx.module.device.service; package com.mortals.xhx.module.device.service;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
/** /**
* DeviceService * DeviceService
* *
* 设备 service接口 * 设备 service接口
* *
* @author zxfei * @author zxfei
* @date 2022-03-09 * @date 2023-02-25
*/ */
public interface DeviceService extends ICRUDService<DeviceEntity,Long> { public interface DeviceService extends ICRUDService<DeviceEntity,Long>{
} }
\ No newline at end of file
package com.mortals.xhx.module.device.service.impl; package com.mortals.xhx.module.device.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.device.DevicePdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.module.device.dao.DeviceDao; import com.mortals.xhx.module.device.dao.DeviceDao;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.service.DeviceService; import com.mortals.xhx.module.device.service.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* DeviceService * DeviceService
* 设备 service实现 * 设备 service实现
* *
* @author zxfei * @author zxfei
* @date 2022-03-09 * @date 2023-02-25
*/ */
@Service("deviceService") @Service("deviceService")
@Slf4j
public class DeviceServiceImpl extends AbstractCRUDServiceImpl<DeviceDao, DeviceEntity, Long> implements DeviceService { public class DeviceServiceImpl extends AbstractCRUDServiceImpl<DeviceDao, DeviceEntity, Long> implements DeviceService {
@Autowired
private IDeviceFeign deviceFeign;
@Override
public Result<DeviceEntity> find(DeviceEntity entity, PageInfo pageInfo, Context context) throws AppException {
Result<DeviceEntity> result = new Result();
DevicePdu devicePdu = new DevicePdu();
BeanUtils.copyProperties(entity, devicePdu, BeanUtil.getNullPropertyNames(entity));
String productName = GlobalSysInfo.getParamValue(Constant.PARAMS_PRODUCT_NAME, "样表机");
devicePdu.setProductName(productName);
Rest<RespData<List<DevicePdu>>> rest = deviceFeign.list(devicePdu);
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
List<DeviceEntity> collect = rest.getData().getData().stream().map(item -> {
DeviceEntity deviceEntity = new DeviceEntity();
BeanUtils.copyProperties(item, deviceEntity, BeanUtil.getNullPropertyNames(item));
return deviceEntity;
}).collect(Collectors.toList());
result.setList(collect);
result.setDict(rest.getDict());
}
return result;
}
} }
\ No newline at end of file
package com.mortals.xhx.module.device.web; package com.mortals.xhx.module.device.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.device.service.DeviceService; import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.service.DeviceService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/** /**
* 设备 *
* * 设备
* @author zxfei *
* @date 2022-06-27 * @author zxfei
*/ * @date 2023-02-25
*/
@RestController @RestController
@RequestMapping("device") @RequestMapping("device")
@Slf4j public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceService,DeviceEntity,Long> {
public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceService, DeviceEntity, Long> {
@Autowired
private ParamService paramService;
public DeviceController(){
super.setModuleDesc( "设备");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "deviceSrc", paramService.getParamBySecondOrganize("Device","deviceSrc"));
this.addDict(model, "deviceStatus", paramService.getParamBySecondOrganize("Device","deviceStatus"));
this.addDict(model, "source", paramService.getParamBySecondOrganize("Device","source"));
super.init(model, context);
}
} }
\ No newline at end of file
...@@ -6,7 +6,6 @@ import com.mortals.framework.exception.AppException; ...@@ -6,7 +6,6 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.MatterSourceEnum;
import com.mortals.xhx.common.code.SourceEnum; import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.matter.dao.MatterDao; import com.mortals.xhx.module.matter.dao.MatterDao;
...@@ -18,7 +17,6 @@ import com.mortals.xhx.module.matter.service.MatterDatumService; ...@@ -18,7 +17,6 @@ import com.mortals.xhx.module.matter.service.MatterDatumService;
import com.mortals.xhx.module.matter.service.MatterService; import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.sheet.model.SheetMatterEntity; import com.mortals.xhx.module.sheet.model.SheetMatterEntity;
import com.mortals.xhx.module.sheet.service.SheetMatterService; import com.mortals.xhx.module.sheet.service.SheetMatterService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
......
...@@ -6,6 +6,8 @@ import com.mortals.framework.model.OrderCol; ...@@ -6,6 +6,8 @@ import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.key.ParamKey; import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.sample.model.SampleBillEntity;
import com.mortals.xhx.module.sample.service.SampleBillService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -42,6 +44,8 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat ...@@ -42,6 +44,8 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private SampleBillService sampleBillService;
public MatterDatumController() { public MatterDatumController() {
super.setModuleDesc("事项申请材料"); super.setModuleDesc("事项申请材料");
...@@ -113,4 +117,19 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat ...@@ -113,4 +117,19 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
ret.put("data", model); ret.put("data", model);
return ret.toJSONString(); return ret.toJSONString();
} }
@Override
protected int infoAfter(Long id, Map<String, Object> model, MatterDatumEntity entity, Context context) throws AppException {
SampleBillEntity sampleBillEntity = new SampleBillEntity();
sampleBillEntity.initAttrValue();
sampleBillEntity.setSiteId(entity.getSiteId());
sampleBillEntity.setMaterialName(entity.getMaterialName());
sampleBillEntity.setMaterialFullName(entity.getMateriaFullName());
sampleBillEntity.setMatterName(entity.getMatterName());
sampleBillEntity.setMatterFullName(entity.getMatterName());
sampleBillEntity.setOperTime(new Date());
sampleBillService.save(sampleBillEntity,context);
return super.infoAfter(id, model, entity, context);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.sample.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.sample.model.SampleBillEntity;
import java.util.List;
/**
* 样报服务Dao
* 样报服务 DAO接口
*
* @author zxfei
* @date 2023-02-23
*/
public interface SampleBillDao extends ICRUDDao<SampleBillEntity,Long>{
}
package com.mortals.xhx.module.sample.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.sample.dao.SampleBillDao;
import com.mortals.xhx.module.sample.model.SampleBillEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 样报服务DaoImpl DAO接口
*
* @author zxfei
* @date 2023-02-23
*/
@Repository("sampleBillDao")
public class SampleBillDaoImpl extends BaseCRUDDaoMybatis<SampleBillEntity,Long> implements SampleBillDao {
}
package com.mortals.xhx.module.sample.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.sample.model.vo.SampleBillVo;
/**
* 样报服务实体对象
*
* @author zxfei
* @date 2023-02-23
*/
public class SampleBillEntity extends SampleBillVo {
private static final long serialVersionUID = 1L;
/**
* 站点ID
*/
private Long siteId;
/**
* 事项id
*/
private Long matterId;
/**
* 事项名称
*/
private String matterName;
/**
* 事项全称
*/
private String matterFullName;
/**
* 材料名称
*/
private String materialName;
/**
* 材料全称
*/
private String materialFullName;
/**
* 设备编码
*/
private String deviceCode;
/**
* 设备名称
*/
private String deviceName;
/**
* 操作时间
*/
private Date operTime;
public SampleBillEntity(){}
/**
* 获取 站点ID
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点ID
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 事项id
* @return Long
*/
public Long getMatterId(){
return matterId;
}
/**
* 设置 事项id
* @param matterId
*/
public void setMatterId(Long matterId){
this.matterId = matterId;
}
/**
* 获取 事项名称
* @return String
*/
public String getMatterName(){
return matterName;
}
/**
* 设置 事项名称
* @param matterName
*/
public void setMatterName(String matterName){
this.matterName = matterName;
}
/**
* 获取 事项全称
* @return String
*/
public String getMatterFullName(){
return matterFullName;
}
/**
* 设置 事项全称
* @param matterFullName
*/
public void setMatterFullName(String matterFullName){
this.matterFullName = matterFullName;
}
/**
* 获取 材料名称
* @return String
*/
public String getMaterialName(){
return materialName;
}
/**
* 设置 材料名称
* @param materialName
*/
public void setMaterialName(String materialName){
this.materialName = materialName;
}
/**
* 获取 材料全称
* @return String
*/
public String getMaterialFullName(){
return materialFullName;
}
/**
* 设置 材料全称
* @param materialFullName
*/
public void setMaterialFullName(String materialFullName){
this.materialFullName = materialFullName;
}
/**
* 获取 设备编码
* @return String
*/
public String getDeviceCode(){
return deviceCode;
}
/**
* 设置 设备编码
* @param deviceCode
*/
public void setDeviceCode(String deviceCode){
this.deviceCode = deviceCode;
}
/**
* 获取 设备名称
* @return String
*/
public String getDeviceName(){
return deviceName;
}
/**
* 设置 设备名称
* @param deviceName
*/
public void setDeviceName(String deviceName){
this.deviceName = deviceName;
}
/**
* 获取 操作时间
* @return Date
*/
public Date getOperTime(){
return operTime;
}
/**
* 设置 操作时间
* @param operTime
*/
public void setOperTime(Date operTime){
this.operTime = operTime;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof SampleBillEntity) {
SampleBillEntity tmp = (SampleBillEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",matterId:").append(getMatterId());
sb.append(",matterName:").append(getMatterName());
sb.append(",matterFullName:").append(getMatterFullName());
sb.append(",materialName:").append(getMaterialName());
sb.append(",materialFullName:").append(getMaterialFullName());
sb.append(",deviceCode:").append(getDeviceCode());
sb.append(",deviceName:").append(getDeviceName());
sb.append(",operTime:").append(getOperTime());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.matterId = 0L;
this.matterName = "";
this.matterFullName = "";
this.materialName = "";
this.materialFullName = "";
this.deviceCode = "";
this.deviceName = "";
this.operTime = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.sample.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.sample.model.SampleBillEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 样报服务视图对象
*
* @author zxfei
* @date 2023-02-23
*/
@Data
public class SampleBillVo extends BaseEntityLong {
/** 开始 操作时间 */
private String operTimeStart;
/** 结束 操作时间 */
private String operTimeEnd;
}
\ No newline at end of file
package com.mortals.xhx.module.sample.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.sample.model.SampleBillEntity;
/**
* SampleBillService
*
* 样报服务 service接口
*
* @author zxfei
* @date 2023-02-23
*/
public interface SampleBillService extends ICRUDService<SampleBillEntity,Long>{
}
\ No newline at end of file
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