Commit 1c7c7f7e authored by “yiyousong”'s avatar “yiyousong”
parents 200fadb9 8586d844
......@@ -38,15 +38,6 @@ public interface IDeviceFeign extends IFeign {
@GetMapping(value = "/device/info")
Rest<DevicePdu> info(@RequestParam(value = "id") Long id);
/**
* 删除设备
*
* @param ids
* @return
*/
@GetMapping(value = "/device/delete")
Rest<Void> delete(Long[] ids,@RequestHeader("Authorization") String authorization);
/**
* 设备保存更新
......@@ -77,11 +68,6 @@ class DeviceFeignFallbackFactory implements FallbackFactory<IDeviceFeign> {
return Rest.fail("暂时无法获取设备详细,请稍后再试!");
}
@Override
public Rest<Void> delete(Long[] ids, String authorization) {
return Rest.fail("暂时无法删除设备,请稍后再试!");
}
@Override
public Rest<RespData<DevicePdu>> save(DevicePdu devicePdu, String authorization) {
return Rest.fail("暂时无法保存设备,请稍后再试!");
......
......@@ -290,27 +290,29 @@ CREATE TABLE `mortals_xhx_device` (
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device_matter_datum`;
CREATE TABLE mortals_xhx_device_matter_datum(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键,自增长',
`siteId` bigint(20) COMMENT '站点ID',
`deviceId` bigint(20) COMMENT '设备id',
`deviceCode` varchar(255) COMMENT '设备编码',
`deviceName` varchar(255) COMMENT '设备名称',
`matterId` bigint(20) COMMENT '事项id',
`matterCode` varchar(255) COMMENT '事项编码',
`matterName` varchar(255) COMMENT '事项名称',
`deptId` bigint(20) COMMENT '部门ID',
`deptCode` varchar(256) COMMENT '部门编号',
`deptName` varchar(256) COMMENT '部门名称',
`source` tinyint(2) COMMENT '事项来源(0.政务网,1.自定义)',
`isRecommend` tinyint(2) COMMENT '是否推荐(0.未推荐,1.推荐)',
`sort` int(4) COMMENT '排序',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间',
PRIMARY KEY (`id`)
`id` bigint(20) AUTO_INCREMENT COMMENT '主键,自增长',
`siteId` bigint(20) COMMENT '站点ID',
`deviceId` bigint(20) COMMENT '设备id',
`deviceCode` varchar(255) COMMENT '设备编码',
`deviceName` varchar(255) COMMENT '设备名称',
`matterId` bigint(20) COMMENT '事项id',
`matterCode` varchar(255) COMMENT '事项编码',
`matterName` varchar(255) COMMENT '事项名称',
`materiaFullName` varchar(1024) COMMENT '事项全称',
`deptId` bigint(20) COMMENT '部门ID',
`deptCode` varchar(256) COMMENT '部门编号',
`deptName` varchar(256) COMMENT '部门名称',
`source` tinyint(2) COMMENT '事项来源(0.政务网,1.自定义)',
`isRecommend` tinyint(2) COMMENT '是否推荐(0.未推荐,1.推荐)',
`sort` int(4) COMMENT '排序',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备事项申请材料业务';
package com.mortals.xhx.module.device.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.device.dao.DeviceMatterDatumDao;
import com.mortals.xhx.module.device.model.DeviceMatterDatumEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
import org.springframework.stereotype.Repository;
/**
* 设备事项申请材料业务DaoImpl DAO接口
*
......
......@@ -10,7 +10,7 @@ import com.mortals.xhx.module.device.model.vo.DeviceMatterDatumVo;
* 设备事项申请材料业务实体对象
*
* @author zxfei
* @date 2023-03-23
* @date 2023-03-29
*/
public class DeviceMatterDatumEntity extends DeviceMatterDatumVo {
......@@ -68,6 +68,10 @@ public class DeviceMatterDatumEntity extends DeviceMatterDatumVo {
* 排序
*/
private Integer sort;
/**
* 事项全称
*/
private String materiaFullName;
......@@ -254,6 +258,20 @@ public class DeviceMatterDatumEntity extends DeviceMatterDatumVo {
public void setSort(Integer sort){
this.sort = sort;
}
/**
* 获取 事项全称
* @return String
*/
public String getMateriaFullName(){
return materiaFullName;
}
/**
* 设置 事项全称
* @param materiaFullName
*/
public void setMateriaFullName(String materiaFullName){
this.materiaFullName = materiaFullName;
}
......@@ -289,35 +307,38 @@ public class DeviceMatterDatumEntity extends DeviceMatterDatumVo {
sb.append(",source:").append(getSource());
sb.append(",isRecommend:").append(getIsRecommend());
sb.append(",sort:").append(getSort());
sb.append(",materiaFullName:").append(getMateriaFullName());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.siteId = -1L;
this.deviceId = null;
this.deviceCode = null;
this.deviceCode = "";
this.deviceName = null;
this.deviceName = "";
this.matterId = null;
this.matterCode = null;
this.matterCode = "";
this.matterName = null;
this.matterName = "";
this.deptId = null;
this.deptCode = null;
this.deptCode = "";
this.deptName = "";
this.deptName = null;
this.source = 0;
this.source = null;
this.isRecommend = 0;
this.isRecommend = null;
this.sort = 0;
this.sort = null;
this.materiaFullName = "";
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ import com.mortals.xhx.module.device.model.DeviceMatterDatumEntity;
* 设备事项申请材料业务查询对象
*
* @author zxfei
* @date 2023-03-23
* @date 2023-03-29
*/
public class DeviceMatterDatumQuery extends DeviceMatterDatumEntity {
/** 开始 主键,自增长 */
......@@ -186,6 +186,11 @@ public class DeviceMatterDatumQuery extends DeviceMatterDatumEntity {
/** 结束 修改时间 */
private String updateTimeEnd;
/** 事项全称 */
private List<String> materiaFullNameList;
/** 事项全称排除列表 */
private List <String> materiaFullNameNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<DeviceMatterDatumQuery> orConditionList;
......@@ -1179,6 +1184,38 @@ public class DeviceMatterDatumQuery extends DeviceMatterDatumEntity {
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 事项全称
* @return materiaFullNameList
*/
public List<String> getMateriaFullNameList(){
return this.materiaFullNameList;
}
/**
* 设置 事项全称
* @param materiaFullNameList
*/
public void setMateriaFullNameList(List<String> materiaFullNameList){
this.materiaFullNameList = materiaFullNameList;
}
/**
* 获取 事项全称
* @return materiaFullNameNotList
*/
public List<String> getMateriaFullNameNotList(){
return this.materiaFullNameNotList;
}
/**
* 设置 事项全称
* @param materiaFullNameNotList
*/
public void setMateriaFullNameNotList(List<String> materiaFullNameNotList){
this.materiaFullNameNotList = materiaFullNameNotList;
}
/**
* 设置 主键,自增长
* @param id
......@@ -1781,6 +1818,25 @@ public class DeviceMatterDatumQuery extends DeviceMatterDatumEntity {
}
/**
* 设置 事项全称
* @param materiaFullName
*/
public DeviceMatterDatumQuery materiaFullName(String materiaFullName){
setMateriaFullName(materiaFullName);
return this;
}
/**
* 设置 事项全称
* @param materiaFullNameList
*/
public DeviceMatterDatumQuery materiaFullNameList(List<String> materiaFullNameList){
this.materiaFullNameList = materiaFullNameList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
......@@ -61,12 +61,15 @@ public class DeviceMatterDatumServiceImpl extends AbstractCRUDServiceImpl<Device
throw new AppException("当前设备关联事项已存在,不能新增!");
}
//entity.getMatterId()
if(!ObjectUtils.isEmpty(entity.getMatterId())){
MatterEntity matterEntity = matterService.get(entity.getMatterId());
if(!ObjectUtils.isEmpty(matterEntity)){
entity.setMatterCode(matterEntity.getMatterNo());
entity.setMatterName(matterEntity.getMatterName());
entity.setMateriaFullName(matterEntity.getMatterFullName());
entity.setIsRecommend(matterEntity.getIsRecommend());
entity.setSource(matterEntity.getSource());
entity.setSort(matterEntity.getSort());
entity.setDeptId(matterEntity.getDeptId());
entity.setDeptCode(matterEntity.getDeptCode());
entity.setDeptName(matterEntity.getDeptName());
......
......@@ -26,9 +26,6 @@ public class DeviceServiceImpl extends AbstractCRUDServiceImpl<DeviceDao, Device
@Override
protected void saveBefore(DeviceEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
}
}
\ No newline at end of file
......@@ -8,6 +8,5 @@ public class HomeQueryPdu {
private String devicenum;
private Integer newSource;
}
package com.mortals.xhx.module.home.web;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
......@@ -24,6 +23,8 @@ import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import com.mortals.xhx.module.baseset.model.BasesetQuery;
import com.mortals.xhx.module.baseset.service.BasesetService;
import com.mortals.xhx.module.device.model.DeviceMatterDatumQuery;
import com.mortals.xhx.module.device.service.DeviceMatterDatumService;
import com.mortals.xhx.module.home.pdu.HomeQueryPdu;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
......@@ -35,6 +36,7 @@ import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterDatumService;
import com.mortals.xhx.module.matter.service.MatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -58,6 +60,8 @@ public class HomeController extends BaseJsonBodyController {
@Autowired
private ParamService paramService;
@Autowired
private DeviceMatterDatumService deviceMatterDatumService;
@Autowired
private ISiteFeign siteFeign;
@Autowired
private BasesetService basesetService;
......@@ -127,6 +131,11 @@ public class HomeController extends BaseJsonBodyController {
DeptPdu deptPdu = new DeptPdu();
deptPdu.setSiteId(queryPdu.getSiteId());
deptPdu.setSize(-1);
if(!ObjectUtils.isEmpty(queryPdu.getDevicenum())){
List<Long> deptIdList = deviceMatterDatumService.find(new DeviceMatterDatumQuery().deviceCode(queryPdu.getDevicenum())).stream().map(item -> item.getDeptId()).collect(Collectors.toList());
deptPdu.setIdList(deptIdList);
}
String resp = iApiBaseManagerFeign.getDeptByQuery(deptPdu);
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
......
package com.mortals.xhx.module.sample.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
......@@ -53,4 +54,10 @@ public class SampleBillController extends BaseCRUDJsonBodyMappingController<Samp
orderColList.add(new OrderCol("operTime", OrderCol.DESCENDING));
query.setOrderColList(orderColList);
}
@Override
@UnAuth
public String save(SampleBillEntity entity) {
return super.save(entity);
}
}
\ No newline at end of file
......@@ -22,6 +22,7 @@
<result property="createTime" column="createTime" />
<result property="createUserId" column="createUserId" />
<result property="updateTime" column="updateTime" />
<result property="materiaFullName" column="materiaFullName" />
</resultMap>
......@@ -80,23 +81,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('materiaFullName') or colPickMode == 1 and data.containsKey('materiaFullName')))">
a.materiaFullName,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="DeviceMatterDatumEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_device_matter_datum
(siteId,deviceId,deviceCode,deviceName,matterId,matterCode,matterName,deptId,deptCode,deptName,source,isRecommend,sort,createTime,createUserId,updateTime)
(siteId,deviceId,deviceCode,deviceName,matterId,matterCode,matterName,deptId,deptCode,deptName,source,isRecommend,sort,createTime,createUserId,updateTime,materiaFullName)
VALUES
(#{siteId},#{deviceId},#{deviceCode},#{deviceName},#{matterId},#{matterCode},#{matterName},#{deptId},#{deptCode},#{deptName},#{source},#{isRecommend},#{sort},#{createTime},#{createUserId},#{updateTime})
(#{siteId},#{deviceId},#{deviceCode},#{deviceName},#{matterId},#{matterCode},#{matterName},#{deptId},#{deptCode},#{deptName},#{source},#{isRecommend},#{sort},#{createTime},#{createUserId},#{updateTime},#{materiaFullName})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_device_matter_datum
(siteId,deviceId,deviceCode,deviceName,matterId,matterCode,matterName,deptId,deptCode,deptName,source,isRecommend,sort,createTime,createUserId,updateTime)
(siteId,deviceId,deviceCode,deviceName,matterId,matterCode,matterName,deptId,deptCode,deptName,source,isRecommend,sort,createTime,createUserId,updateTime,materiaFullName)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.siteId},#{item.deviceId},#{item.deviceCode},#{item.deviceName},#{item.matterId},#{item.matterCode},#{item.matterName},#{item.deptId},#{item.deptCode},#{item.deptName},#{item.source},#{item.isRecommend},#{item.sort},#{item.createTime},#{item.createUserId},#{item.updateTime})
(#{item.siteId},#{item.deviceId},#{item.deviceCode},#{item.deviceName},#{item.matterId},#{item.matterCode},#{item.matterName},#{item.deptId},#{item.deptCode},#{item.deptName},#{item.source},#{item.isRecommend},#{item.sort},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.materiaFullName})
</foreach>
</insert>
......@@ -178,6 +182,9 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
<if test="(colPickMode==0 and data.containsKey('materiaFullName')) or (colPickMode==1 and !data.containsKey('materiaFullName'))">
a.materiaFullName=#{data.materiaFullName},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
......@@ -342,6 +349,13 @@
</if>
</foreach>
</trim>
<trim prefix="materiaFullName=(case" suffix="ELSE materiaFullName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('materiaFullName')) or (colPickMode==1 and !item.containsKey('materiaFullName'))">
when a.id=#{item.id} then #{item.materiaFullName}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
......@@ -857,6 +871,27 @@
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('materiaFullName')">
<if test="conditionParamRef.materiaFullName != null and conditionParamRef.materiaFullName != ''">
${_conditionType_} a.materiaFullName like #{${_conditionParam_}.materiaFullName}
</if>
<if test="conditionParamRef.materiaFullName == null">
${_conditionType_} a.materiaFullName is null
</if>
</if>
<if test="conditionParamRef.containsKey('materiaFullNameList') and conditionParamRef.materiaFullNameList.size() > 0">
${_conditionType_} a.materiaFullName in
<foreach collection="conditionParamRef.materiaFullNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('materiaFullNameNotList') and conditionParamRef.materiaFullNameNotList.size() > 0">
${_conditionType_} a.materiaFullName not in
<foreach collection="conditionParamRef.materiaFullNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
......@@ -955,6 +990,11 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('materiaFullName')">
a.materiaFullName
<if test='orderCol.materiaFullName != null and "DESC".equalsIgnoreCase(orderCol.materiaFullName)'>DESC</if>
,
</if>
</trim>
</if>
</sql>
......
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