From a07b4b6ff1c98dcf81338bb45d59308db7c058a9 Mon Sep 17 00:00:00 2001 From: 李旭东 <woaiguo66@sina.com> Date: 星期五, 03 十一月 2023 17:18:56 +0800 Subject: [PATCH] Merge branch 'master' of http://111.30.93.211:10101/r/supipe --- hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/PipeOutPlanService.java | 24 hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java | 18 hd/pipe/StaffManage/src/main/java/com/thhy/staff/config/StartListener.java | 25 hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/entity/TBigDevice.java | 145 ++ hd/pipe/engineeringManage/src/main/resources/mapping/TBigDeviceMapper.xml | 293 ++++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java | 4 hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/controller/SysMenusController.java | 23 hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/mapper/SysMenusMapper.java | 2 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/smoke/SmokeMessage.java | 73 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java | 112 ++ hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/ISysMenusService.java | 3 web/src/api/modules/materials.js | 7 hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/mapper/PlatUserMapper.java | 4 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java | 11 hd/pipe/UserCore/src/main/resources/mapping/SysMenusMapper.xml | 79 + web/src/views/GoodManage/components/MixingExpend.vue | 203 +++ hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml | 36 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java | 36 hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/impl/SysMenusServiceImpl.java | 16 hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml | 249 ++++ hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java | 10 hd/pipe/materialsManage/src/main/java/com/thhy/MaterialsApplication.java | 6 hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml | 606 +++++++++- hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/service/impl/TBigDeviceServiceImpl.java | 194 +-- web/src/views/GoodManage/MixingManage.vue | 10 hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/GetUserTask.java | 45 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java | 83 + hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java | 47 hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java | 2 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java | 105 + hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/PlatUser.java | 2 web/src/views/Basics/MouldIndex.vue | 24 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/rebarprint/controller/TSteelPrintController.java | 2 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java | 31 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataAi.java | 426 ++++++++ hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanMothEntity.java | 33 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataSmock.java | 50 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java | 9 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataValue.java | 118 ++ hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml | 10 40 files changed, 2,875 insertions(+), 301 deletions(-) diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/config/StartListener.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/config/StartListener.java new file mode 100644 index 0000000..ea8eeab --- /dev/null +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/config/StartListener.java @@ -0,0 +1,25 @@ +package com.thhy.staff.config; + +import com.thhy.staff.modules.biz.face.controller.GetUserTask; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.context.annotation.Configuration; + +import java.util.Timer; + +@Configuration +public class StartListener implements ApplicationRunner { + + + @Value("${file.vfprefix}") + private String vfPrefix; + + @Override + public void run(ApplicationArguments args) throws Exception { + GetUserTask gutask = new GetUserTask(vfPrefix); + Timer timer = new Timer(); + timer.schedule(gutask,1000,300000); + } +} diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java index 2e948f2..e8aad12 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/FaceController.java @@ -112,5 +112,15 @@ } } + @RequestMapping("/allPerson") + public JSONObject allPerson(@RequestBody String mess){ + faceServer.allPerson(mess); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code",0); + jsonObject.put("msg","OK"); + jsonObject.put("success",true); + return jsonObject; + } + } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/GetUserTask.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/GetUserTask.java new file mode 100644 index 0000000..7dc7260 --- /dev/null +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/controller/GetUserTask.java @@ -0,0 +1,45 @@ +package com.thhy.staff.modules.biz.face.controller; + +import com.alibaba.fastjson.JSONObject; +import com.thhy.general.utils.SpringContextUtils; +import com.thhy.staff.config.EmqxConfig; +import com.thhy.staff.modules.biz.face.mapper.FaceDeviceMapper; +import com.thhy.staff.utils.MqUtils; +import java.util.List; +import java.util.TimerTask; + +public class GetUserTask extends TimerTask { + + private String prefix; + + private FaceDeviceMapper faceDeviceMapper; + + public FaceDeviceMapper getFaceDeviceMapper() { + return SpringContextUtils.getBean(FaceDeviceMapper.class); + } + + private EmqxConfig emqxConfig; + + public EmqxConfig getEmqxConfig() { + return SpringContextUtils.getBean(EmqxConfig.class); + } + + public GetUserTask(String urlPrefix) { + this.prefix = urlPrefix; + } + + @Override + public void run() { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("method","get_person_all"); + + JSONObject dataJson = new JSONObject(); + dataJson.put("path",prefix+"allPerson"); + jsonObject.put("data",dataJson); + jsonObject.put("params",new JSONObject()); + EmqxConfig emqxConfig = getEmqxConfig(); + FaceDeviceMapper faceDeviceMapper = getFaceDeviceMapper(); + List<String> sns = faceDeviceMapper.queryDevSn(); + MqUtils.createClient(emqxConfig,sns,jsonObject.toJSONString()); + } +} diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java index 0c57764..31cdbbd 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/FaceServer.java @@ -20,4 +20,6 @@ void removeNotify(String mess); String queryOriStrById(String id); + + void allPerson(String mess); } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java index 707b5d1..a5ef6e8 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/face/service/impl/FaceServerImpl.java @@ -12,6 +12,7 @@ import com.thhy.staff.modules.biz.face.mapper.FaceDeviceMapper; import com.thhy.staff.modules.biz.face.service.FaceServer; import com.thhy.staff.modules.biz.platuser.entity.DoorLis; +import com.thhy.staff.modules.biz.platuser.entity.PlatUser; import com.thhy.staff.modules.biz.platuser.mapper.PlatUserMapper; import com.thhy.staff.utils.MqUtils; import org.checkerframework.checker.units.qual.A; @@ -172,6 +173,23 @@ return userMapper.queryOriStrById(id); } + @Override + public void allPerson(String mess) { + JSONObject jsonObject = JSONObject.parseObject(mess); + JSONArray jsonArray = jsonObject.getJSONArray("person_list"); + for(Object obj : jsonArray){ + JSONObject personJson = JSON.parseObject(obj.toString()); + String faceId = personJson.getString("person_id"); + int count = userMapper.countByFaceId(faceId); + if(count>0)continue; + PlatUser platUser = new PlatUser(); + platUser.setFaceId(faceId); + platUser.setIdNo(personJson.getString("id_card")); + platUser.setRealName(personJson.getString("name")); + userMapper.insertSamplePlatUser(platUser); + } + } + public static void main(String[] args) { JSONObject jsonObject = new JSONObject(); jsonObject.put("method","delete_person"); diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/PlatUser.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/PlatUser.java index 42f9162..9cc2101 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/PlatUser.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/entity/PlatUser.java @@ -144,4 +144,6 @@ private Integer isLogin; private String phone; + + private String faceId; } diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/mapper/PlatUserMapper.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/mapper/PlatUserMapper.java index b988c39..c9398a4 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/mapper/PlatUserMapper.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/platuser/mapper/PlatUserMapper.java @@ -115,4 +115,8 @@ void syncFail(@Param("userId") String userId,@Param("syncFailReason")String syncFailReason); String queryOriStrById(String id); + + int countByFaceId(String faceId); + + void insertSamplePlatUser(PlatUser platUser); } diff --git a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml index 4591523..70a6c79 100644 --- a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml +++ b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml @@ -930,4 +930,40 @@ update sys_plat_user set sync_success = 2,sync_fail_reason = #{syncFailReason} where user_id = #{userId} </update> + <select id="countByFaceId" resultType="int"> + select count(user_id) from sys_plat_user where face_id = #{faceId} + </select> + + <insert id="insertSamplePlatUser"> + insert into sys_plat_user + <trim prefix="(" suffixOverrides="," suffix=")"> + <if test="userId != null and userId != ''"> + user_id, + </if> + <if test="realName != null and realName != ''"> + real_name, + </if> + <if test="faceId != null and faceId != ''"> + face_id, + </if> + <if test="idNo != null and idNo != ''"> + id_no, + </if> + </trim> + <trim prefix="values (" suffixOverrides="," suffix=")"> + <if test="userId != null and userId != ''"> + #{userId}, + </if> + <if test="realName != null and realName != ''"> + #{realName}, + </if> + <if test="faceId != null and faceId != ''"> + #{faceId}, + </if> + <if test="idNo != null and idNo != ''"> + #{idNo}, + </if> + </trim> + </insert> + </mapper> diff --git a/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/controller/SysMenusController.java b/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/controller/SysMenusController.java index 88a954d..a306cfd 100644 --- a/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/controller/SysMenusController.java +++ b/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/controller/SysMenusController.java @@ -1,6 +1,9 @@ package com.thhy.usercore.modules.sys.sysmenu.controller; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.JSONToken; import com.github.pagehelper.PageInfo; import com.thhy.general.utils.PagingUtils; import com.thhy.general.common.BasicResult; @@ -17,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; -import java.io.Serializable; +import java.io.*; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -74,6 +77,24 @@ return BasicResult.success(sysMenusList); } + @RequestMapping("syncMenu") + public BasicResult syncMenu(){ + String value = ""; + try { + InputStream ins = new FileInputStream(new File("D:\\dd.txt")); + byte[] bytes = new byte[ins.available()]; + ins.read(bytes); + value = new String(bytes,"UTF-8"); + + } catch (Exception e) { + throw new RuntimeException(e); + } + + List<MenuTreeVo> sysMenusList = JSONArray.parseArray(value,MenuTreeVo.class); + sysMenusService.syncMenu(sysMenusList); + return BasicResult.success(sysMenusList); + } + @RequestMapping("allRoleMenu") public BasicResult allRoleMenu(@RequestBody MenuDto menuDto){ menuDto.setParentId("0"); diff --git a/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/mapper/SysMenusMapper.java b/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/mapper/SysMenusMapper.java index a68cd06..9fa353d 100644 --- a/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/mapper/SysMenusMapper.java +++ b/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/mapper/SysMenusMapper.java @@ -28,6 +28,8 @@ void insert(SysMenus sysmenus); + void insertVo(MenuTreeVo menuTreeVo); + void update(SysMenus sysmenus); int deletelogic(Serializable menuId); diff --git a/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/ISysMenusService.java b/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/ISysMenusService.java index 2ea58dc..bc74ef3 100644 --- a/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/ISysMenusService.java +++ b/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/ISysMenusService.java @@ -1,5 +1,6 @@ package com.thhy.usercore.modules.sys.sysmenu.service; +import com.alibaba.fastjson.JSONObject; import com.thhy.usercore.modules.sys.sysmenu.entity.*; import com.thhy.usercore.modules.sys.sysmenubutton.entity.MenuButtonVo; @@ -34,6 +35,8 @@ List<MenuTreeVo> findAllTree(MenuDto menuDto); + void syncMenu(List<MenuTreeVo> sysMenusList); + List<MenuButtonTreeVo> allRoleMenu(MenuDto menuDto); List<MenuButtonVo> MenuEnableButtons(MenuButtonDto menuButtonDto); diff --git a/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/impl/SysMenusServiceImpl.java b/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/impl/SysMenusServiceImpl.java index 5aed559..bdbf448 100644 --- a/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/impl/SysMenusServiceImpl.java +++ b/hd/pipe/UserCore/src/main/java/com/thhy/usercore/modules/sys/sysmenu/service/impl/SysMenusServiceImpl.java @@ -1,5 +1,8 @@ package com.thhy.usercore.modules.sys.sysmenu.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.thhy.general.utils.UserInfoUtils; import com.thhy.general.common.BasicStatus; import com.thhy.general.exception.BasicException; @@ -138,6 +141,19 @@ } @Override + @Transactional + public void syncMenu(List<MenuTreeVo> sysMenusList) { + for(MenuTreeVo tree : sysMenusList){ + + sysMenusMapper.insertVo(tree); + if(tree.getChildrens().size()>0){ + + syncMenu(tree.getChildrens()); + } + } + } + + @Override public List<MenuButtonTreeVo> allRoleMenu(MenuDto menuDto) { List<MenuButtonTreeVo> sysMenusList = sysMenusMapper.menuRoleTree(menuDto); for(MenuButtonTreeVo mv : sysMenusList){ diff --git a/hd/pipe/UserCore/src/main/resources/mapping/SysMenusMapper.xml b/hd/pipe/UserCore/src/main/resources/mapping/SysMenusMapper.xml index 6f8e3d6..51ae824 100644 --- a/hd/pipe/UserCore/src/main/resources/mapping/SysMenusMapper.xml +++ b/hd/pipe/UserCore/src/main/resources/mapping/SysMenusMapper.xml @@ -195,7 +195,86 @@ </trim> </insert> + <insert id="insertVo"> + insert into sys_menus + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="menuId != null"> + menu_id, + </if> + <if test="isUse != null"> + is_use, + </if> + <if test="path != null"> + path, + </if> + <if test="name != null"> + name, + </if> + <if test="hidden != null"> + hidden, + </if> + <if test="redirect != null"> + redirect, + </if> + <if test="parentId != null"> + parent_id, + </if> + <if test="title != null"> + title, + </if> + <if test="icon != null"> + icon, + </if> + <if test="component != null"> + component, + </if> + <if test="level != null"> + level, + </if> + <if test="isDefault != null"> + is_default, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="menuId != null"> + #{menuId}, + </if> + <if test="isUse != null"> + #{isUse}, + </if> + <if test="path != null"> + #{path}, + </if> + <if test="name != null"> + #{name}, + </if> + <if test="hidden != null"> + #{hidden}, + </if> + <if test="redirect != null"> + #{redirect}, + </if> + <if test="parentId != null"> + #{parentId}, + </if> + <if test="title != null"> + #{title}, + </if> + <if test="icon != null"> + #{icon}, + </if> + <if test="component != null"> + #{component}, + </if> + <if test="level != null"> + #{level}, + </if> + <if test="isDefault != null"> + #{isDefault}, + </if> + </trim> + </insert> <!--更新操作--> <update id="update"> update sys_menus diff --git a/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/entity/TBigDevice.java b/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/entity/TBigDevice.java index d324ba6..f859f93 100644 --- a/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/entity/TBigDevice.java +++ b/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/entity/TBigDevice.java @@ -1,6 +1,7 @@ package com.thhy.engineering.modules.biz.device.entity; import com.fasterxml.jackson.annotation.JsonFormat; +import com.thhy.general.annotations.Excel; import lombok.Data; import lombok.Getter; import lombok.Setter; @@ -23,23 +24,36 @@ /** * 设备名称 */ + @Excel(sort = 1,title = "设备名称") private String bigDeviceName; /** * 规格型号 */ + @Excel(sort = 2,title = "规格型号") private String bigDeviceModel; /** * 设备型号 */ + @Excel(sort = 3,title = "设备编号") private String bigNumber; /** * 设备类型 */ private String bigType; + @Excel(sort = 4,title = "设备类型") private String bigTypeName; + + public String getBigTypeName() { + if ("1".equals(bigType)){ + return "特种设备"; + }else if ("2".equals(bigType)){ + return "一般设备"; + } + return ""; + } /** * 安装位置 @@ -66,6 +80,7 @@ /** * 使用年限 */ + @Excel(sort = 8,title = "使用年限") private String useLife; /** @@ -77,6 +92,13 @@ * 责任人 */ private String userId; + + /** + * 责任人电话 + */ + @Excel(sort = 22,title = "责任人电话") + private String zrrPhone; + @Excel(sort = 21,title = "责任人") private String realName; @@ -120,4 +142,127 @@ * @mbg.generated Mon May 15 16:41:32 CST 2023 */ private static final long serialVersionUID = 1L; + + + /** + * 分公司id + */ + private String companyId; + + /** + * 生产厂家 + */ + @Excel(sort = 5,title = "生产厂家") + private String manufacturer; + + /** + * 出厂年月 + */ + @JsonFormat(pattern = "yyyy-MM") + @Excel(sort = 6,title = "出厂年月") + private Date dateOfProduction; + + /** + * 使用年月 + */ + @Excel(sort = 7,title = "使用年月") + @JsonFormat(pattern = "yyyy-MM") + private Date useYearMonth; + + /** + * 外形尺寸mm(长*宽*高) + */ + @Excel(sort = 9,title = "外形尺寸mm(长*宽*高)") + private String shapeSize; + + /** + * 总功率kw + */ + @Excel(sort = 10,title = "总功率kw") + private String totalPower; + + /** + * 总重量kg + */ + @Excel(sort = 11,title = "总重量kg") + private String totalWeight; + + /** + * 原值(元) + */ + @Excel(sort = 12,title = "原值(元)") + private String originalValue; + + /** + * 年折旧率 + */ + @Excel(sort = 13,title = "年折旧率") + private String yearDepreciationRate; + + /** + * 已提折旧 + */ + @Excel(sort = 14,title = "已提折旧") + private String accumulatedDepreciation; + + /** + * 净值 + */ + @Excel(sort = 15,title = "净值(元)") + private String netWorth; + + /** + * 使用状况 1、良好 2、老化 + */ + private Integer useStatus; + @Excel(sort = 16,title = "使用状况") + private String useStatusName; + + public String getUseStatusName() { + if (useStatus == 1){ + return "良好"; + }else if (useStatus == 2){ + return "老化"; + } + return ""; + } + + /** + * 是否满足需要 1是 、2否 + */ + private Integer isNeed; + @Excel(sort = 17,title = "是否满足需要") + private String isNeedName; + public String getIsNeedName() { + if (isNeed == 1){ + return "是"; + }else if (isNeed == 2){ + return "否"; + } + return ""; + } + /** + * 设备来源 + */ + @Excel(sort = 18,title = "设备来源") + private String deviceSource; + + /** + * 设备配属关系 + */ + @Excel(sort = 19,title = "设备配属关系") + private String deviceNexus; + + /** + * 定机人 + */ + @Excel(sort = 20,title = "定机人") + private String fixedPerson; + + /** + * 管理员电话 + */ + @Excel(sort = 23,title = "管理员电话") + private String adminPhone; + } \ No newline at end of file diff --git a/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/service/impl/TBigDeviceServiceImpl.java b/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/service/impl/TBigDeviceServiceImpl.java index 9e19ae3..731f225 100644 --- a/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/service/impl/TBigDeviceServiceImpl.java +++ b/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/service/impl/TBigDeviceServiceImpl.java @@ -16,6 +16,8 @@ import com.thhy.engineering.modules.biz.file.service.FileService; import com.thhy.general.common.BasicResult; import com.thhy.general.config.SysUserInfo; +import com.thhy.general.utils.ExcelUtils; +import com.thhy.general.utils.UUIDUtils; import com.thhy.general.utils.UserInfoUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,6 +26,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -37,6 +40,7 @@ @Resource private FileService fileService; + private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); @Override @Transactional @@ -50,35 +54,40 @@ if(!StringUtil.isEmpty(bigDeviceId)){ return BasicResult.faild("11111","设备编号重复","error"); } - values.put("bigDeviceId",""); + values.put("bigDeviceId", UUIDUtils.create()); values.put("companyId",companyId); + values.put("createUser",sysUserInfo.getUserId()); + try { + values.put("dateOfProduction",sdf.parse((String) values.get("dateOfProduction"))); + values.put("useYearMonth",sdf.parse((String) values.get("useYearMonth"))); + }catch (Exception e){} bigDeviceMapper.bigDeviceInsert(values); - //大型生产设备id - String bigDeviceId1 = values.get("bigDeviceId").toString(); - //图片 列表 - List<String> pictures = (List<String>) values.get("pictures"); - if(pictures!=null && pictures.size()>0){ - for (String p:pictures){ - HashMap<String, Object> val = new HashMap<>(); - val.put("bigDeviceId",bigDeviceId1); - val.put("id",""); - val.put("fileType",1); - val.put("filePath",p); - bigDeviceMapper.picturesInsert(val); - } - } - //文件 - List<String> files = (List<String>) values.get("files"); - if(files!=null && files.size()>0){ - for (String f:files){ - HashMap<String, Object> val = new HashMap<>(); - val.put("bigDeviceId",bigDeviceId1); - val.put("id",""); - val.put("fileType",2); - val.put("filePath",f); - bigDeviceMapper.picturesInsert(val); - } - } +// //大型生产设备id +// String bigDeviceId1 = values.get("bigDeviceId").toString(); +// //图片 列表 +// List<String> pictures = (List<String>) values.get("pictures"); +// if(pictures!=null && pictures.size()>0){ +// for (String p:pictures){ +// HashMap<String, Object> val = new HashMap<>(); +// val.put("bigDeviceId",bigDeviceId1); +// val.put("id",""); +// val.put("fileType",1); +// val.put("filePath",p); +// bigDeviceMapper.picturesInsert(val); +// } +// } +// //文件 +// List<String> files = (List<String>) values.get("files"); +// if(files!=null && files.size()>0){ +// for (String f:files){ +// HashMap<String, Object> val = new HashMap<>(); +// val.put("bigDeviceId",bigDeviceId1); +// val.put("id",""); +// val.put("fileType",2); +// val.put("filePath",f); +// bigDeviceMapper.picturesInsert(val); +// } +// } return BasicResult.success("添加成功"); } @@ -98,22 +107,6 @@ @Override public BasicResult bigDeviceInfo(String bigDeviceId) { TBigDevice tBigDevices = bigDeviceMapper.bigDeviceInfo(bigDeviceId); - List<TBigPath> bigPaths = bigDeviceMapper.devicePath(bigDeviceId); - bigPaths.stream().forEach(fl->{ - JSONObject json = new JSONObject(); - json.put("fullpath",fl.getFilePath()); - BasicResult basicResult = fileService.fileinfo(json.toJSONString()); - if(basicResult.isSuccess()){ - JSONArray jsonArray = JSONArray.parseArray(basicResult.getData().toString()); - for(Object obj : jsonArray){ - JSONObject j = JSON.parseObject(obj.toString()); - if(j.containsKey("name")&&"name".equals(j.getString("name"))){ - fl.setFilePathName(j.getString("value")); - } - } - } - }); - tBigDevices.setTBigPaths(bigPaths); return BasicResult.success(tBigDevices); } @@ -136,31 +129,35 @@ if(!StringUtil.isEmpty(bigDeviceId)&&!bigDeviceId.equals(bigDeviceId1)){ return BasicResult.faild("11111","设备编号重复","error"); } - bigDeviceMapper.bigDevicePathDel(bigDeviceId1); - - List<String> pictures = (List<String>) values.get("pictures"); - if(pictures!=null && pictures.size()>0){ - for (String p:pictures){ - HashMap<String, Object> val = new HashMap<>(); - val.put("bigDeviceId",bigDeviceId1); - val.put("id",""); - val.put("fileType",1); - val.put("filePath",p); - bigDeviceMapper.picturesInsert(val); - } - } - //文件 - List<String> files = (List<String>) values.get("files"); - if(files!=null && files.size()>0){ - for (String f:files){ - HashMap<String, Object> val = new HashMap<>(); - val.put("bigDeviceId",bigDeviceId1); - val.put("id",""); - val.put("fileType",2); - val.put("filePath",f); - bigDeviceMapper.picturesInsert(val); - } - } +// bigDeviceMapper.bigDevicePathDel(bigDeviceId1); +// +// List<String> pictures = (List<String>) values.get("pictures"); +// if(pictures!=null && pictures.size()>0){ +// for (String p:pictures){ +// HashMap<String, Object> val = new HashMap<>(); +// val.put("bigDeviceId",bigDeviceId1); +// val.put("id",""); +// val.put("fileType",1); +// val.put("filePath",p); +// bigDeviceMapper.picturesInsert(val); +// } +// } +// //文件 +// List<String> files = (List<String>) values.get("files"); +// if(files!=null && files.size()>0){ +// for (String f:files){ +// HashMap<String, Object> val = new HashMap<>(); +// val.put("bigDeviceId",bigDeviceId1); +// val.put("id",""); +// val.put("fileType",2); +// val.put("filePath",f); +// bigDeviceMapper.picturesInsert(val); +// } +// } + try { + values.put("dateOfProduction",sdf.parse((String) values.get("dateOfProduction"))); + values.put("useYearMonth",sdf.parse((String) values.get("useYearMonth"))); + }catch (Exception e){} bigDeviceMapper.bigDeviceUpdate(values); return BasicResult.success("修改成功"); } @@ -179,50 +176,23 @@ String companyId = sysUserInfo.getCompanyId(); values.put("companyId",companyId); List<TBigDevice> tBigDevices = bigDeviceMapper.bigDeviceList(values); - List<BigDeviceExcelDto> bigDeviceExcelDtos = new ArrayList<>(); - for (TBigDevice bigDevice : tBigDevices){ - BigDeviceExcelDto bigDeviceExcelDto = new BigDeviceExcelDto(); - bigDeviceExcelDto.setBigDeviceName(bigDevice.getBigDeviceName()); - bigDeviceExcelDto.setBigDeviceModel(bigDevice.getBigDeviceModel()); - bigDeviceExcelDto.setBigNumber(bigDevice.getBigNumber()); - bigDeviceExcelDto.setBigTypeName(bigDevice.getBigTypeName()); - bigDeviceExcelDto.setBigPosition(bigDevice.getBigPosition()); - if(bigDevice.getBigState()!=null&&bigDevice.getBigState()==1){ - bigDeviceExcelDto.setBigState("在线"); - }else{ - bigDeviceExcelDto.setBigState("离线"); + tBigDevices.forEach(t->{ + if ("1".equals(t.getBigType())){ + t.setBigTypeName("特种设备"); + }else if ("2".equals(t.getBigType())){ + t.setBigTypeName("一般设备"); } - bigDeviceExcelDto.setRealName(bigDevice.getRealName()); - bigDeviceExcelDto.setSupplierName(bigDevice.getSupplierName()); - bigDeviceExcelDto.setKeyCabinet(bigDevice.getKeyCabinet()); - bigDeviceExcelDto.setUseLife(bigDevice.getUseLife()); - bigDeviceExcelDtos.add(bigDeviceExcelDto); - } - ExcelWriter excel = new ExcelWriter();//定义excel - excel.addHeaderAlias("bigDeviceName", "设备名称"); - excel.addHeaderAlias("bigDeviceModel", "规格型号"); - excel.addHeaderAlias("bigNumber", "设备编号"); - excel.addHeaderAlias("bigTypeName", "设备类型"); - excel.addHeaderAlias("bigPosition", "安装位置"); - excel.addHeaderAlias("bigState", "设备状态"); - excel.addHeaderAlias("realName", "操作工人"); - excel.addHeaderAlias("supplierName", "供应商"); - excel.addHeaderAlias("keyCabinet", "钥匙柜编号"); - excel.addHeaderAlias("useLife", "使用年限"); - response.setContentType("application/vnd.ms-excel;charset=UTF-8"); - response.setHeader("Content-Disposition", "attachment;filename=test.xls"); - OutputStream out = null; - try { - out = response.getOutputStream(); - excel.write(bigDeviceExcelDtos); - excel.flush(out, true); - } catch (IOException e) { - e.printStackTrace(); - } finally { - // 关闭writer,释放内存 - excel.close(); - } - IoUtil.close(out); - + if (t.getUseStatus() == 1){ + t.setUseStatusName("良好"); + }else if (t.getUseStatus() == 2){ + t.setUseStatusName("老化"); + } + if (t.getIsNeed() == 1){ + t.setIsNeedName("是"); + }else if (t.getIsNeed() == 2){ + t.setIsNeedName("否"); + } + }); + ExcelUtils.downExcel(tBigDevices,TBigDevice.class,response,"设备信息管理"); } } diff --git a/hd/pipe/engineeringManage/src/main/resources/mapping/TBigDeviceMapper.xml b/hd/pipe/engineeringManage/src/main/resources/mapping/TBigDeviceMapper.xml index 66e85ae..0a29984 100644 --- a/hd/pipe/engineeringManage/src/main/resources/mapping/TBigDeviceMapper.xml +++ b/hd/pipe/engineeringManage/src/main/resources/mapping/TBigDeviceMapper.xml @@ -25,6 +25,23 @@ <result column="is_use" jdbcType="INTEGER" property="isUse" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" /> + + <result column="company_id" jdbcType="VARCHAR" property="companyId" /> + <result column="manufacturer" jdbcType="VARCHAR" property="manufacturer" /> + <result column="date_of_production" jdbcType="TIMESTAMP" property="dateOfProduction" /> + <result column="use_year_month" jdbcType="TIMESTAMP" property="useYearMonth" /> + <result column="shape_size" jdbcType="VARCHAR" property="shapeSize" /> + <result column="total_power" jdbcType="VARCHAR" property="totalPower" /> + <result column="total_weight" jdbcType="VARCHAR" property="totalWeight" /> + <result column="original_value" jdbcType="VARCHAR" property="originalValue" /> + <result column="year_depreciation_rate" jdbcType="VARCHAR" property="yearDepreciationRate" /> + <result column="accumulated_depreciation" jdbcType="VARCHAR" property="accumulatedDepreciation" /> + <result column="net_worth" jdbcType="VARCHAR" property="netWorth" /> + <result column="use_status" jdbcType="INTEGER" property="useStatus" /> + <result column="is_need" jdbcType="INTEGER" property="isNeed" /> + <result column="device_source" jdbcType="VARCHAR" property="deviceSource" /> + <result column="device_nexus" jdbcType="VARCHAR" property="deviceNexus" /> + <result column="fixed_person" jdbcType="VARCHAR" property="fixedPerson" /> </resultMap> @@ -92,6 +109,54 @@ <if test="companyId != null"> company_id, </if> + <if test="manufacturer != null"> + manufacturer, + </if> + <if test="dateOfProduction != null"> + date_of_production, + </if> + <if test="useYearMonth != null"> + use_year_month, + </if> + <if test="shapeSize != null"> + shape_size, + </if> + <if test="totalPower != null"> + total_power, + </if> + <if test="totalWeight != null"> + total_weight, + </if> + <if test="originalValue != null"> + original_value, + </if> + <if test="yearDepreciationRate != null"> + year_depreciation_rate, + </if> + <if test="accumulatedDepreciation != null"> + accumulated_depreciation, + </if> + <if test="netWorth != null"> + net_worth, + </if> + <if test="useStatus != null"> + use_status, + </if> + <if test="isNeed != null"> + is_need, + </if> + <if test="deviceSource != null"> + device_source, + </if> + <if test="deviceNexus != null"> + device_nexus, + </if> + <if test="fixedPerson != null"> + fixed_person, + </if> + <if test="adminPhone != null"> + admin_phone, + </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="bigDeviceId != null"> @@ -151,6 +216,55 @@ <if test="companyId != null"> #{companyId,jdbcType=VARCHAR}, </if> + + <if test="manufacturer != null"> + #{manufacturer,jdbcType=VARCHAR}, + </if> + <if test="dateOfProduction != null"> + #{dateOfProduction,jdbcType=TIMESTAMP}, + </if> + <if test="useYearMonth != null"> + #{useYearMonth,jdbcType=TIMESTAMP}, + </if> + <if test="shapeSize != null"> + #{shapeSize,jdbcType=VARCHAR}, + </if> + <if test="totalPower != null"> + #{totalPower}, + </if> + <if test="totalWeight != null"> + #{totalWeight,jdbcType=VARCHAR}, + </if> + <if test="originalValue != null"> + #{originalValue,jdbcType=VARCHAR}, + </if> + <if test="yearDepreciationRate != null"> + #{yearDepreciationRate,jdbcType=VARCHAR}, + </if> + <if test="accumulatedDepreciation != null"> + #{accumulatedDepreciation,jdbcType=VARCHAR}, + </if> + <if test="netWorth != null"> + #{netWorth,jdbcType=VARCHAR}, + </if> + <if test="useStatus != null"> + #{useStatus,jdbcType=INTEGER}, + </if> + <if test="isNeed != null"> + #{isNeed,jdbcType=INTEGER}, + </if> + <if test="deviceSource != null"> + #{deviceSource,jdbcType=VARCHAR}, + </if> + <if test="deviceNexus != null"> + #{deviceNexus,jdbcType=VARCHAR}, + </if> + <if test="fixedPerson != null"> + #{fixedPerson,jdbcType=VARCHAR}, + </if> + <if test="adminPhone != null"> + #{adminPhone,jdbcType=VARCHAR}, + </if> </trim> </insert> <insert id="picturesInsert" > @@ -185,26 +299,57 @@ </trim> </insert> <select id="bigDeviceList" resultType="com.thhy.engineering.modules.biz.device.entity.TBigDevice"> - SELECT - tbd.big_device_id AS bigDeviceId, - tbd.big_device_Name AS bigDeviceName, - tbd.big_device_model AS bigDeviceModel, - tbd.big_number AS bigNumber, - sd.dict_name AS bigTypeName, - tbd.big_position AS bigPosition, - tbd.big_state AS bigState, - spu.real_name AS realName, - ss.supplier_name AS supplierName, - tbd.key_cabinet AS keyCabinet, - tbd.use_life AS useLife -FROM - t_big_device tbd - LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id - LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id - LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id - where tbd.is_use=1 + SELECT + tbd.big_device_id AS bigDeviceId, + tbd.big_device_Name AS bigDeviceName, + tbd.big_device_model AS bigDeviceModel, + tbd.big_number AS bigNumber, + sd.dict_name AS bigTypeName, + tbd.big_position AS bigPosition, + tbd.big_state AS bigState, + spu.real_name AS realName, + ss.supplier_name AS supplierName, + tbd.key_cabinet AS keyCabinet, + tbd.use_life AS useLife, + tbd.purchase_time as purchaseTime, + tbd.use_life as useLife, + tbd.big_type as bigType, + tbd.key_cabinet as keyCabinet, + tbd.big_notes AS bigNotes, + tbd.safety_code AS safetyCode, + tbd.is_certificate AS isCertificate, + tbd.create_time AS createTime, + tbd.manufacturer AS manufacturer, + tbd.date_of_production AS dateOfProduction, + tbd.use_year_month AS useYearMonth, + tbd.shape_size AS shapeSize, + tbd.total_power AS totalPower, + tbd.total_weight AS totalWeight, + tbd.original_value AS originalValue, + tbd.year_depreciation_rate AS yearDepreciationRate, + tbd.accumulated_depreciation AS accumulatedDepreciation, + tbd.net_worth AS netWorth, + tbd.use_status AS useStatus, + tbd.is_need AS isNeed, + tbd.device_source AS deviceSource, + tbd.device_nexus AS deviceNexus, + spu.real_name AS realName, + spu.phone AS zrrPhone, + tbd.fixed_person AS fixedPerson, + su.real_name AS adminRealName, + tbd.admin_phone AS adminPhone + FROM + t_big_device tbd + LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id + LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id + LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id + LEFT JOIN sys_users su ON su.user_id = tbd.create_user + where tbd.is_use=1 <if test="bigDeviceName!=null and bigDeviceName!='' "> and tbd.big_device_Name like concat('%',#{bigDeviceName},'%') + </if> + <if test="bigNumber!=null and bigNumber!='' "> + and tbd.big_number like concat('%',#{bigNumber},'%') </if> <if test="supplierId!=null and supplierId!='' "> and tbd.supplier_id=#{supplierId} @@ -231,29 +376,48 @@ <select id="bigDeviceInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigDevice"> SELECT - tbd.big_device_id AS bigDeviceId, - tbd.big_device_Name AS bigDeviceName, - tbd.big_device_model AS bigDeviceModel, - tbd.big_number AS bigNumber, - sd.dict_name AS bigTypeName, - tbd.big_position AS bigPosition, - tbd.big_state AS bigState, - spu.real_name AS realName, - ss.supplier_name AS supplierName, - tbd.key_cabinet AS keyCabinet, - tbd.use_life AS useLife, - tbd.big_type as bigType, - tbd.supplier_id as supplierId, - tbd.purchase_time as purchaseTime, - tbd.big_notes as bigNotes, - tbd.user_id as userId, - tbd.safety_code as safetyCode, - tbd.is_certificate as isCertificate + tbd.big_device_id AS bigDeviceId, + tbd.big_device_Name AS bigDeviceName, + tbd.big_device_model AS bigDeviceModel, + tbd.big_number AS bigNumber, + sd.dict_name AS bigTypeName, + tbd.big_position AS bigPosition, + tbd.big_state AS bigState, + spu.real_name AS realName, + spu.phone AS zrrPhone, + ss.supplier_name AS supplierName, + tbd.key_cabinet AS keyCabinet, + tbd.use_life AS useLife, + tbd.big_type as bigType, + tbd.supplier_id as supplierId, + tbd.purchase_time as purchaseTime, + tbd.big_notes as bigNotes, + tbd.user_id as userId, + tbd.safety_code as safetyCode, + tbd.is_certificate as isCertificate, + tbd.manufacturer AS manufacturer, + tbd.date_of_production AS dateOfProduction, + tbd.use_year_month AS useYearMonth, + tbd.shape_size AS shapeSize, + tbd.total_power AS totalPower, + tbd.total_weight AS totalWeight, + tbd.original_value AS originalValue, + tbd.year_depreciation_rate AS yearDepreciationRate, + tbd.accumulated_depreciation AS accumulatedDepreciation, + tbd.net_worth AS netWorth, + tbd.use_status AS useStatus, + tbd.is_need AS isNeed, + tbd.device_source AS deviceSource, + tbd.device_nexus AS deviceNexus, + tbd.fixed_person AS fixedPerson, + su.real_name AS adminRealName, + tbd.admin_phone AS adminPhone FROM - t_big_device tbd - LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id - LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id - LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id + t_big_device tbd + LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id + LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id + LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id + LEFT JOIN sys_users su ON su.user_id = tbd.create_user where tbd.is_use=1 and tbd.big_device_id=#{bigDeviceId} </select> @@ -329,6 +493,55 @@ <if test="createUser != null"> create_user = #{createUser,jdbcType=VARCHAR}, </if> + + <if test="manufacturer != null"> + manufacturer = #{manufacturer,jdbcType=VARCHAR}, + </if> + <if test="dateOfProduction != null"> + date_of_production = #{dateOfProduction,jdbcType=TIMESTAMP}, + </if> + <if test="useYearMonth != null"> + use_year_month = #{useYearMonth,jdbcType=TIMESTAMP}, + </if> + <if test="shapeSize != null"> + shape_size = #{shapeSize,jdbcType=VARCHAR}, + </if> + <if test="totalPower != null"> + total_power = #{totalPower}, + </if> + <if test="totalWeight != null"> + total_weight = #{totalWeight,jdbcType=VARCHAR}, + </if> + <if test="originalValue != null"> + original_value = #{originalValue,jdbcType=VARCHAR}, + </if> + <if test="yearDepreciationRate != null"> + year_depreciation_rate = #{yearDepreciationRate,jdbcType=VARCHAR}, + </if> + <if test="accumulatedDepreciation != null"> + accumulated_depreciation = #{accumulatedDepreciation,jdbcType=VARCHAR}, + </if> + <if test="netWorth != null"> + net_worth = #{netWorth,jdbcType=VARCHAR}, + </if> + <if test="useStatus != null"> + use_status = #{useStatus,jdbcType=INTEGER}, + </if> + <if test="isNeed != null"> + is_need = #{isNeed,jdbcType=INTEGER}, + </if> + <if test="deviceSource != null"> + device_source = #{deviceSource,jdbcType=VARCHAR}, + </if> + <if test="deviceNexus != null"> + device_nexus = #{deviceNexus,jdbcType=VARCHAR}, + </if> + <if test="fixedPerson != null"> + fixed_person = #{fixedPerson,jdbcType=VARCHAR}, + </if> + <if test="adminPhone != null"> + admin_phone = #{adminPhone,jdbcType=VARCHAR}, + </if> </set> where big_device_id = #{bigDeviceId,jdbcType=VARCHAR} </update> diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/MaterialsApplication.java b/hd/pipe/materialsManage/src/main/java/com/thhy/MaterialsApplication.java index fe1fda3..350cde0 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/MaterialsApplication.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/MaterialsApplication.java @@ -2,6 +2,7 @@ import com.thhy.materials.modules.biz.helmet.smoke.SmokeServer; import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -16,6 +17,9 @@ @EnableScheduling public class MaterialsApplication implements CommandLineRunner { + @Value("${materialstcpport}") + private Integer tcpport; + @Resource private SmokeServer smokeServer; @@ -25,7 +29,7 @@ @Override public void run(String... args) throws Exception { - smokeServer.run(8973); + smokeServer.run(tcpport); } } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java index 28a3317..86dc3df 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java @@ -1,7 +1,9 @@ package com.thhy.materials.modules.biz.helmet.controller; +import com.alibaba.fastjson.JSONObject; import com.thhy.general.common.BasicResult; import com.thhy.materials.modules.biz.helmet.service.HelmetService; +import org.apache.ibatis.annotations.Mapper; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -43,10 +45,10 @@ - //接数据 - @PostMapping("/dataValueInsert") - public BasicResult dataValueInsert(@RequestBody Map<String,Object> values){ - return helmetService.dataValueInsert(values); + //接数据 环境监测 数据 + @PostMapping("/dataValueIn") + public BasicResult dataValueIn(@RequestBody Map<String,Object> values){ + return helmetService.dataValueIn(values); } /** @@ -70,6 +72,27 @@ public BasicResult helmetReportUser(@RequestBody Map<String,Object> values){ return helmetService.helmetReportUser(values); } + //烟尘数据 + @PostMapping("/dataSmockList") + public BasicResult dataSmockList(@RequestBody Map<String,Object> values){ + return helmetService.dataSmockList(values); + } + + //环境监测 + @PostMapping("/dataValuesList") + public BasicResult dataValuesList(@RequestBody Map<String,Object> values){ + return helmetService.dataValuesList(values); + } + //AI边缘盒子 数据接收 + @PostMapping("/dataBox") + public BasicResult dataBox(@RequestBody String message){ + /** 将String转换为JSON **/ + JSONObject result= JSONObject.parseObject(message); + System.out.println("--------接收的参数为 :---------------"+result); + Integer type = Integer.valueOf(result.get("type").toString()); + return helmetService.dataBox(result); + } + } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataAi.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataAi.java new file mode 100644 index 0000000..5ab6004 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataAi.java @@ -0,0 +1,426 @@ +package com.thhy.materials.modules.biz.helmet.entity; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.io.Serializable; + +@Data +@Getter +@Setter +@ToString +public class TDataAi implements Serializable { + /** + * + */ + private Integer aiId; + + /** + * RTSP流 + */ + private String rtspUrl; + + /** + * 盒子的id + */ + private Integer boxId; + + /** + * 预警消息类型(参数 + 类型见参数类型书 + 名) + */ + private Integer type; + + /** + * 预警消息名称 + */ + private String typeName; + + /** + * 盒子的名称 + */ + private String boxName; + + /** + * 摄像头名称 + */ + private String deviceName; + + /** + * 设备编号 + */ + private String deviceId; + + /** + * 摄像头编码 + */ + private String channelNo; + + /** + * 企业编码 + */ + private String enterCode; + + /** + * 企业名称 + */ + private String enterName; + + /** + * 抓拍时间 + */ + private String signTime; + + /** + * x坐标 + */ + private Integer x; + + /** + * y坐标 + */ + private Integer y; + + /** + * w坐标 + */ + private Integer w; + + /** + * h坐标 + */ + private Integer h; + + /** + * + */ + private String messagerType; + + /** + * (仅电 + 动车检 + 测才返 + 回)是否是电动车,1是,2 + 否 + */ + private Integer eBike; + + /** + * (仅烟 + 火检测 + 才会返 + 回)是否有烟,1是,2否 + */ + private Integer smoke; + + /** + * (仅烟 + 火检测 + 才会返 + 回)是否有火,1是,2否 + */ + private Integer fire; + + /** + * (仅离 + 岗检测 + 才会返 + 回)是否离岗,1是,2否 + */ + private Integer isExist; + + /** + * (仅检 + 测灭火 + 器才会 + 返回)是否是灭火器1是,2否 + */ + private Integer ext; + + /** + * (仅油 + 罐车检 + 测才会 + 返回)是否是油罐车1是,2否 + */ + private Integer tanker; + + /** + * (仅检 + 测杂物 + 堆积才 + 会)是否杂物堆积1是,2否 + */ + private Integer sudire; + + /** + * (仅检 + 测消防 + 通道占 + 用才 + 会)是否消防通道占用1是, + 2否 + */ + private Integer fireControl; + + /** + * (仅检 + 测摄像 + 头遮挡 + 才会)是否摄像头遮挡1是,2 + 否 + */ + private Integer cover; + + /** + * (仅车 + 辆检测 + 才会返 + 回)车牌号码 + */ + private String licensePlateNumber; + + /** + * (仅车 + 辆检测 + 才会返 + 回)是否违停 + */ + private Integer illegalParking; + + /** + * (仅人 + 脸检测 + 才会返 + 回)年龄 + */ + private Integer age; + + /** + * (仅人 + 脸检测 + 才会返 + 回)性别,0男,1女 + */ + private Integer gender; + + /** + * (仅人 + 脸检测 + 才会返 + 回)是否佩戴眼镜,1否,2 + 是 + */ + private Integer glasses; + + /** + * (仅人 + 脸检测 + 才会返 + 回)是否佩戴口罩,1否,2 + 是 + */ + private Integer mask; + + /** + * (仅人 + 脸检测 + 才会返 + 回)人脸认证照片base64 + */ + private String certifiedAvatarUrl; + + /** + * (仅人 + 脸检测 + 才会返 + 回)人脸唯一ID + */ + private Integer faceId; + + /** + * (仅人 + 脸检测 + 才会返 + 回)人脸库类型,1黑名单, + 2白名单 + */ + private Integer personType; + + /** + * + */ + private String passStatus; + + /** + * (仅人 + 脸检测 + 才会返 + 回)人脸最大分数 + */ + private String faceMaxSorce; + + /** + * (仅人 + 体,人 + 脸检测 + 才会返 + 回)人员姓名 + */ + private String personName; + + /** + * (仅人 + 体,人 + 脸检测 + 才会返 + 回)跟踪id + */ + private Integer trackId; + + /** + * (仅人 + 体,人 + 脸检测 + 才会返 + 回)分数 + */ + private String score; + + /** + * (仅人 + 体检测 + 才会返 + 回)人体数量 + */ + private Integer count; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否抽烟,1是,2否 + */ + private Integer smoking; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否入侵,1是,2否 + */ + private Integer isInQuadrangle; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否翻越围栏,1是,2 + 否 + */ + private Integer climbFence; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否佩戴安全帽,1是, + 2否 + */ + private Integer safetyHat; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否穿反光衣,1是,2 + 否 + */ + private Integer reflective; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否打电话,1是,2否 + */ + private Integer calling; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否聚集,1是,2否 + */ + private Integer assemble; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否穿工装,1是,2否 + */ + private Integer isTooling; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否跌倒,1是,2否 + */ + private Integer tumble; + + /** + * (仅人 + 体检测 + 才会返 + 回)是否睡岗,1是,2否 + */ + private Integer sleeping; + + /** + * 规定时间内区域人数统 + 计 + */ + private Integer humanCountSum; + + /** + * 业务时长 + */ + private String businessDurationTime; + + /** + * 今日进入总人数 + */ + private Integer pinCountSum; + + /** + * 今日出去总人数 + */ + private Integer poutCountSum; + + /** + * 当前进入人数 + */ + private Integer pinSingle; + + /** + * 当前出去人数 + */ + private Integer poutSingle; + private String signBigAvatar; + private String signAvatar; + private String videoBase64; + private String humanCoor; + private String faceAttrSum; + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_data_ai + * + * @mbg.generated Wed Nov 01 09:22:27 CST 2023 + */ + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataSmock.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataSmock.java index 7cdc954..ab48063 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataSmock.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataSmock.java @@ -20,103 +20,113 @@ /** * */ - private String gatewayCyc; + private String time; /** * */ - private String fans; + private String i00; /** * */ - private String v1run; + private String i01; /** * */ - private String uv1run; + private String i02; /** * */ - private String fanrun; + private String i03; /** * */ - private String uv2run; + private String i04; /** * */ - private String ssvrun; + private String i05; /** * */ - private String dp; + private String i06; /** * */ - private String t; + private String i07; /** * */ - private String oc; + private String i10; /** * */ - private String gatew; + private String i11; /** * */ - private String nxrun; + private String q00; /** * */ - private String alarm; + private String q01; /** * */ - private String times; + private String q02; /** * */ - private String rtcVolt; + private String q03; /** * */ - private String v2run; + private String q04; /** * */ - private String dxqvrun; + private String q05; /** * */ - private String press; + private String vb0; /** * */ - private String dc; + private String vb10; + + /** + * + */ + private String vb11; + + /** + * + */ + private String vb12; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table t_data_smock * - * @mbg.generated Wed Oct 18 15:12:02 CST 2023 + * @mbg.generated Mon Oct 30 13:02:05 CST 2023 */ private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataValue.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataValue.java new file mode 100644 index 0000000..9fdb64b --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/TDataValue.java @@ -0,0 +1,118 @@ +package com.thhy.materials.modules.biz.helmet.entity; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.io.Serializable; + +@Data +@Getter +@Setter +@ToString +public class TDataValue implements Serializable { + /** + * + */ + private Integer dataId; + + /** + * 设备编号 + */ + private Integer deviceId; + + /** + * 设备名称 + */ + private String deviceName; + + /** + * 账号 + */ + private String accountNumber; + + /** + * 上传时间 + */ + private String uploadTime; + + /** + * pm2.5 + */ + private String pm25; + + /** + * pm10 + */ + private String pm10; + + /** + * tsp + */ + private String tsp; + + /** + * 温度 + */ + private String temperature; + + /** + * 湿度 + */ + private String humidity; + + /** + * 数据6 + */ + private String data6; + + /** + * 风速 + */ + private String windSpeed; + + /** + * 风向 + */ + private String windDirection; + + /** + * tvoc + */ + private String tvoc; + + /** + * no2 + */ + private String no2; + + /** + * co + */ + private String co; + + /** + * so2 + */ + private String so2; + + /** + * o3 + */ + private String o3; + + + /** + * 噪音 + */ + private String noise; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_data_value + * + * @mbg.generated Fri Oct 13 15:29:00 CST 2023 + */ + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java index 5303370..b2abea6 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java @@ -42,12 +42,17 @@ List<THelmetMotion> helmetMotionList(Map<String, Object> values); - void dataValueInsert(Map<String, Object> values); + void dataValueIn(Map<String, Object> values); List<ReportNumDto> helmetReportTotal(Map<String, Object> values); List<THelmetReport> helmetReportUser(Map<String, Object> values); - void smockInsert(TDataSmock tDataSmock); + void smockIn(TDataSmock tDataSmock); + List<TDataSmock> dataSmockList(Map<String, Object> values); + + List<TDataValue> dataValuesList(Map<String, Object> values); + + void dataBox(TDataAi tDataAi); } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java index 9c5497b..9bee834 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java @@ -1,5 +1,6 @@ package com.thhy.materials.modules.biz.helmet.service; +import com.alibaba.fastjson.JSONObject; import com.thhy.general.common.BasicResult; import com.thhy.materials.modules.biz.helmet.entity.*; @@ -36,11 +37,17 @@ BasicResult helmetMotionList(Map<String, Object> values); - BasicResult dataValueInsert(Map<String, Object> values); + BasicResult dataValueIn(Map<String, Object> values); BasicResult helmetReportTotal(Map<String, Object> values); BasicResult helmetReportUser(Map<String, Object> values); - void smockInsert(TDataSmock tDataSmock); + void smockIn(TDataSmock tDataSmock); + + BasicResult dataSmockList(Map<String, Object> values); + + BasicResult dataValuesList(Map<String, Object> values); + + BasicResult dataBox(JSONObject result); } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java index eb38b37..c98c12e 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java @@ -1,5 +1,6 @@ package com.thhy.materials.modules.biz.helmet.service.impl; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.thhy.general.common.BasicResult; @@ -8,6 +9,7 @@ import com.thhy.materials.modules.biz.helmet.mapper.HelmetMapper; import com.thhy.materials.modules.biz.helmet.service.HelmetService; import org.springframework.stereotype.Service; +import sun.misc.Cache; import javax.annotation.Resource; import java.util.HashMap; @@ -111,10 +113,10 @@ } @Override - public BasicResult dataValueInsert(Map<String, Object> values) { + public BasicResult dataValueIn(Map<String, Object> values) { - helmetMapper.dataValueInsert(values); + helmetMapper.dataValueIn(values); return BasicResult.success(); } @@ -134,8 +136,103 @@ } @Override - public void smockInsert(TDataSmock tDataSmock) { + public void smockIn(TDataSmock tDataSmock) { System.out.println("参数为---"+tDataSmock.toString()); - helmetMapper.smockInsert(tDataSmock); + helmetMapper.smockIn(tDataSmock); + } + + @Override + public BasicResult dataSmockList(Map<String, Object> values) { + Integer pageSize = Integer.valueOf(values.get("pageSize").toString()); + Integer pageNum = Integer.valueOf(values.get("pageNum").toString()); + PageHelper.startPage(pageNum,pageSize); + List<TDataSmock> dataSmocks = helmetMapper.dataSmockList(values); + PageInfo<TDataSmock> tDataSmockPageInfo = new PageInfo<>(dataSmocks); + return BasicResult.success(tDataSmockPageInfo); + } + + @Override + public BasicResult dataValuesList(Map<String, Object> values) { + Integer pageSize = Integer.valueOf(values.get("pageSize").toString()); + Integer pageNum = Integer.valueOf(values.get("pageNum").toString()); + PageHelper.startPage(pageNum,pageSize); + List<TDataValue> dataSmocks = helmetMapper.dataValuesList(values); + PageInfo<TDataValue> tDataValuePageInfo = new PageInfo<>(dataSmocks); + return BasicResult.success(tDataValuePageInfo); + } + + @Override + public BasicResult dataBox(JSONObject result) { + + Integer type = Integer.valueOf(result.get("type").toString()); + + TDataAi tDataAi = new TDataAi(); + //公共参数 + tDataAi.setType(type); + tDataAi.setTypeName(result.get("typeName").toString()); + tDataAi.setRtspUrl(result.getString("rtspUrl")); + tDataAi.setBoxId(Integer.valueOf(result.get("boxId").toString())); + tDataAi.setBoxName(result.get("boxName").toString()); + tDataAi.setDeviceName(result.get("deviceName").toString()); + tDataAi.setDeviceId(result.get("deviceId").toString()); + tDataAi.setEnterName(result.get("enterName").toString()); + tDataAi.setEnterCode(result.get("enterCode").toString()); + //图片上传 + + //上边缺少图片处理 + tDataAi.setSignTime(result.get("signTime").toString()); + tDataAi.setChannelNo(result.get("channelNo").toString()); + tDataAi.setX(result.getIntValue("x")); + tDataAi.setY(result.getIntValue("y")); + tDataAi.setW(result.getIntValue("w")); + tDataAi.setH(result.getIntValue("h")); + + if(type==1){//人脸 + tDataAi.setAge(result.getIntValue("age")); + tDataAi.setGender(result.getIntValue("gender")); + tDataAi.setGlasses(result.getIntValue("glasses")); + tDataAi.setMask(result.getIntValue("mask")); + //人脸照片 base64 (需要解密) + tDataAi.setCertifiedAvatarUrl(result.getString("certifiedAvatarURL")); + + tDataAi.setFaceId(result.getIntValue("faceId")); + tDataAi.setPersonType(result.getIntValue("personType")); + tDataAi.setFaceMaxSorce(result.getString("faceMaxSorce")); + tDataAi.setPersonName(result.getString("personName")); + + + }else if(type==2){//人体 + + + + + }else if(type==3){//车辆 + tDataAi.setLicensePlateNumber(result.getString("licensePlateNumber")); + tDataAi.setIllegalParking(result.getIntValue("illegalParking")); + + }else if(type==4){//电动车 + tDataAi.setEBike(result.getIntValue("eBike")); + }else if(type==5){//烟火 + tDataAi.setSmoke(result.getIntValue("smoke")); + tDataAi.setFire(result.getIntValue("fire")); + + }else if(type==6){//离岗 + tDataAi.setIsExist(result.getIntValue("isExist")); + }else if(type==8){//灭火器 + tDataAi.setExt(result.getIntValue("ext")); + }else if(type==10){//油罐车 + tDataAi.setTanker(result.getIntValue("tanker")); + }else if(type==16){//睡岗 + // + + } else if(type==23){//杂物堆积 + tDataAi.setSudire(result.getIntValue("sudire")); + }else if(type==24){//摄像头遮挡 + tDataAi.setCover(result.getIntValue("cover")); + }else if(type==26){//消防通道占用 + tDataAi.setFireControl(result.getIntValue("fireControl")); + } + helmetMapper.dataBox(tDataAi); + return BasicResult.success(); } } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/smoke/SmokeMessage.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/smoke/SmokeMessage.java index 45069df..071d48e 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/smoke/SmokeMessage.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/smoke/SmokeMessage.java @@ -1,7 +1,6 @@ package com.thhy.materials.modules.biz.helmet.smoke; import com.alibaba.fastjson.JSONObject; import com.thhy.materials.modules.biz.helmet.entity.TDataSmock; -import com.thhy.materials.modules.biz.helmet.mapper.HelmetMapper; import com.thhy.materials.modules.biz.helmet.service.HelmetService; import com.thhy.materials.modules.biz.utils.ApplicationContextUtil; import io.netty.buffer.ByteBuf; @@ -11,12 +10,7 @@ import io.netty.util.CharsetUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; @Component public class SmokeMessage extends SimpleChannelInboundHandler<ByteBuf>{ @@ -53,27 +47,54 @@ System.out.println("客户端接收到消息: " + in.toString(CharsetUtil.UTF_8)); JSONObject jsonObject11 = JSONObject.parseObject(in.toString(CharsetUtil.UTF_8)); System.out.println("客户端接收到消息: " + jsonObject11); + Object time = jsonObject11.get("time"); + String parems = jsonObject11.get("params").toString(); + JSONObject jsonObject = JSONObject.parseObject(parems); + System.out.println(time+"-------------"+jsonObject); TDataSmock tDataSmock = new TDataSmock(); - tDataSmock.setGatewayCyc(jsonObject11.get("gateway_cyc").toString()); - tDataSmock.setFans(jsonObject11.get("FanS").toString()); - tDataSmock.setV1run(jsonObject11.get("V1Run").toString()); - tDataSmock.setUv1run(jsonObject11.get("UV1Run").toString()); - tDataSmock.setFanrun(jsonObject11.get("FanRun").toString()); - tDataSmock.setUv2run(jsonObject11.get("UV2Run").toString()); - tDataSmock.setSsvrun(jsonObject11.get("SSVRun").toString()); - tDataSmock.setDp(jsonObject11.get("DP").toString()); - tDataSmock.setT(jsonObject11.get("T").toString()); - tDataSmock.setOc(jsonObject11.get("OC").toString()); - tDataSmock.setGatew(jsonObject11.get("gatew").toString()); - tDataSmock.setNxrun(jsonObject11.get("NXRun").toString()); - tDataSmock.setTimes(jsonObject11.get("time").toString()); - tDataSmock.setRtcVolt(jsonObject11.get("RTC_VOLT").toString()); - tDataSmock.setV2run(jsonObject11.get("V2Run").toString()); - tDataSmock.setDxqvrun(jsonObject11.get("DXQVRun").toString()); - tDataSmock.setPress(jsonObject11.get("Press").toString()); - tDataSmock.setDc(jsonObject11.get("Dc").toString()); - System.out.println("-------"+tDataSmock); - getUserService().smockInsert(tDataSmock); + tDataSmock.setTime(time.toString()); + tDataSmock.setI00(jsonObject.get("I00").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI01(jsonObject.get("I01").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI02(jsonObject.get("I02").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI03(jsonObject.get("I03").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI04(jsonObject.get("I04").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI05(jsonObject.get("I05").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI06(jsonObject.get("I06").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI07(jsonObject.get("I07").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI10(jsonObject.get("I10").toString().equals("true")?"开启":"关闭"); + tDataSmock.setI11(jsonObject.get("I11").toString().equals("true")?"开启":"关闭"); + tDataSmock.setQ00(jsonObject.get("Q00").toString().equals("true")?"运行中":"停止状态"); + tDataSmock.setQ01(jsonObject.get("Q01").toString().equals("true")?"运行中":"停止状态"); + tDataSmock.setQ02(jsonObject.get("Q02").toString().equals("true")?"运行中":"停止状态"); + tDataSmock.setQ03(jsonObject.get("Q03").toString().equals("true")?"运行中":"停止状态"); + tDataSmock.setQ04(jsonObject.get("Q04").toString().equals("true")?"运行中":"停止状态"); + tDataSmock.setQ05(jsonObject.get("Q05").toString().equals("true")?"运行中":"停止状态"); + tDataSmock.setVb0(jsonObject.get("VB0").toString()); + tDataSmock.setVb10(jsonObject.get("VB10").toString()); + tDataSmock.setVb11(jsonObject.get("VB11").toString()); + tDataSmock.setVb12(jsonObject.get("VB12").toString()); + +// TDataSmock tDataSmock = new TDataSmock(); +// tDataSmock.setGatewayCyc(jsonObject11.get("gateway_cyc").toString()); +// tDataSmock.setFans(jsonObject11.get("FanS").toString()); +// tDataSmock.setV1run(jsonObject11.get("V1Run").toString()); +// tDataSmock.setUv1run(jsonObject11.get("UV1Run").toString()); +// tDataSmock.setFanrun(jsonObject11.get("FanRun").toString()); +// tDataSmock.setUv2run(jsonObject11.get("UV2Run").toString()); +// tDataSmock.setSsvrun(jsonObject11.get("SSVRun").toString()); +// tDataSmock.setDp(jsonObject11.get("DP").toString()); +// tDataSmock.setT(jsonObject11.get("T").toString()); +// tDataSmock.setOc(jsonObject11.get("OC").toString()); +// tDataSmock.setGatew(jsonObject11.get("gatew").toString()); +// tDataSmock.setNxrun(jsonObject11.get("NXRun").toString()); +// tDataSmock.setTimes(jsonObject11.get("time").toString()); +// tDataSmock.setRtcVolt(jsonObject11.get("RTC_VOLT").toString()); +// tDataSmock.setV2run(jsonObject11.get("V2Run").toString()); +// tDataSmock.setDxqvrun(jsonObject11.get("DXQVRun").toString()); +// tDataSmock.setPress(jsonObject11.get("Press").toString()); +// tDataSmock.setDc(jsonObject11.get("Dc").toString()); +// System.out.println("-------"+tDataSmock); + getUserService().smockIn(tDataSmock); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java new file mode 100644 index 0000000..e7abcc2 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java @@ -0,0 +1,47 @@ +package com.thhy.materials.modules.biz.pipeoutplan.controller; + +import com.thhy.general.common.BasicResult; +import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity; +import com.thhy.materials.modules.biz.pipeoutplan.service.PipeOutPlanService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + * @Author QiuYuHao + * @CreateDate 2023-11-03 9:38:16 + * 发运计划 + */ +@RestController +@RequestMapping(value = "pipeoutplan") +public class PipeOutPlanController { + + @Autowired + private PipeOutPlanService pipeOutPlanService; + + @PostMapping("insert") + BasicResult insert(@RequestBody PipeOutPlanEntity pipeOutPlanEntity){ + return pipeOutPlanService.insert(pipeOutPlanEntity); + } + + @GetMapping("delete") + BasicResult delete(@RequestParam String planOutId){ + return pipeOutPlanService.delete(planOutId); + } + + @PostMapping("update") + BasicResult update(@RequestBody PipeOutPlanEntity pipeOutPlanEntity){ + return pipeOutPlanService.update(pipeOutPlanEntity); + } + + @GetMapping("selectInfo") + BasicResult selectInfo(@RequestParam String planOutId){ + return pipeOutPlanService.selectInfo(planOutId); + } + + @PostMapping("findAll") + BasicResult findAll(@RequestBody Map<String,Object> map){ + return pipeOutPlanService.findAll(map); + } +} diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java new file mode 100644 index 0000000..b5b59ff --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java @@ -0,0 +1,36 @@ +package com.thhy.materials.modules.biz.pipeoutplan.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.omg.CORBA.PRIVATE_MEMBER; + +import java.util.Date; +import java.util.List; + +/** + * @Author QiuYuHao + * @CreateDate 2023-11-03 9:40:41 + * 发运计划实体 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class PipeOutPlanEntity { + + private String planOutId;//计划ID + private String proId;//项目ID + private String proName;//项目名称 + private Integer planYear;//年份 + private Integer needPipeNum;//需求合计多少片 + private long completePipeNum;//已完成合计 + private Date createTime;//创建时间 + private String createUser;//创建人 + private Date updateTime;//修改时间 + private String updateUser;//修改人 + private Integer isUse;//1Y0N + + private List<PipeOutPlanMothEntity> monthList; +} diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanMothEntity.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanMothEntity.java new file mode 100644 index 0000000..dd43481 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanMothEntity.java @@ -0,0 +1,33 @@ +package com.thhy.materials.modules.biz.pipeoutplan.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author QiuYuHao + * @CreateDate 2023-11-03 10:52:23 + * 发运计划月份实体 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class PipeOutPlanMothEntity { + private String id; + private String pipeOutPlanId; + private Integer month; + + /** + * 管片需求数量 + */ + private Integer planProduct; + + private String proId; + + /** + * 已发运管片数量 + */ + private Integer completePlanProduct; +} diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java new file mode 100644 index 0000000..c6d8ae4 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java @@ -0,0 +1,83 @@ +package com.thhy.materials.modules.biz.pipeoutplan.mapper; + +import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity; +import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanMothEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Author QiuYuHao + * @CreateDate 2023-11-03 9:41:37 + * 发运计划mapper + */ +@Mapper +public interface PipeOutPlanMapper { + + /** + * 新增发运计划表 + * @param pipeOutPlanEntity + */ + void insert(PipeOutPlanEntity pipeOutPlanEntity); + + /** + * 新增发运计划月数表 + * @param pipeOutPlanMothEntity + */ + void insertMoth(PipeOutPlanMothEntity pipeOutPlanMothEntity); + + /** + * 删除发运计划表 + * @param pipeNeedId + */ + void delete(String pipeNeedId); + + /** + * 删除发运计划月数表 + * @param pipeNeedId + */ + void deleteMoth(String pipeNeedId); + + /** + * 更新发运计划表 + * @param pipeOutPlanEntity + */ + void update(PipeOutPlanEntity pipeOutPlanEntity); + + /** + * 查询单条发运计划表 + * @param pipeNeedId + * @return + */ + PipeOutPlanEntity selectInfo(String pipeNeedId); + + PipeOutPlanEntity selectInfoByProIdAndYear( + @Param("proId") String proId, + @Param("planYear") Integer year); + + /** + * 查询发运计划列表 + * @param map + * @return + */ + List<PipeOutPlanEntity> findAll(Map<String,Object> map); + + /** + * 查询发运计划月数表 + * @param pipeNeedId + * @return + */ + List<PipeOutPlanMothEntity> findMothList(String pipeNeedId); + + /** + * 查询每月数量 + * @param proId + * @param year + * @return + */ + List<PipeOutPlanMothEntity> findMothListByProIdAndYear(@Param("proId") String proId, + @Param("year") String year, + @Param("planOutId") String planOutId); +} diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/PipeOutPlanService.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/PipeOutPlanService.java new file mode 100644 index 0000000..0cadff3 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/PipeOutPlanService.java @@ -0,0 +1,24 @@ +package com.thhy.materials.modules.biz.pipeoutplan.service; + +import com.thhy.general.common.BasicResult; +import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity; + +import java.util.Map; + +/** + * @Author QiuYuHao + * @CreateDate 2023-11-03 9:42:10 + * 发运计划逻辑接口 + */ +public interface PipeOutPlanService { + + BasicResult insert(PipeOutPlanEntity pipeOutPlanEntity); + + BasicResult delete(String pipeNeedId); + + BasicResult update(PipeOutPlanEntity pipeOutPlanEntity); + + BasicResult selectInfo(String pipeNeedId); + + BasicResult findAll(Map<String,Object> map); +} diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java new file mode 100644 index 0000000..0f80f09 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java @@ -0,0 +1,112 @@ +package com.thhy.materials.modules.biz.pipeoutplan.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.thhy.general.common.BasicResult; +import com.thhy.general.config.SysUserInfo; +import com.thhy.general.utils.UUIDUtils; +import com.thhy.general.utils.UserInfoUtils; +import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity; +import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanMothEntity; +import com.thhy.materials.modules.biz.pipeoutplan.mapper.PipeOutPlanMapper; +import com.thhy.materials.modules.biz.pipeoutplan.service.PipeOutPlanService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +/** + * @Author QiuYuHao + * @CreateDate 2023-11-03 9:42:41 + * 发运管理逻辑实现层 + */ +@Service +public class PipeOutPlanServiceImpl implements PipeOutPlanService { + + @Autowired + private PipeOutPlanMapper pipeOutPlanMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public BasicResult insert(PipeOutPlanEntity pipeOutPlanEntity) { + PipeOutPlanEntity isExit = pipeOutPlanMapper.selectInfoByProIdAndYear(pipeOutPlanEntity.getProId(), pipeOutPlanEntity.getPlanYear()); + if (isExit != null){ + return BasicResult.faild("500","同一项目、年份有且只有一个计划",null); + } + String planOutId = UUIDUtils.create(); + pipeOutPlanEntity.setPlanOutId(planOutId); + pipeOutPlanMapper.insert(pipeOutPlanEntity); + List<PipeOutPlanMothEntity> monthList = pipeOutPlanEntity.getMonthList(); + for (PipeOutPlanMothEntity vo : monthList) { + vo.setPipeOutPlanId(planOutId); + vo.setId(UUIDUtils.create()); + pipeOutPlanMapper.insertMoth(vo); + } + return BasicResult.success(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BasicResult delete(String pipeNeedId) { + pipeOutPlanMapper.delete(pipeNeedId); + pipeOutPlanMapper.deleteMoth(pipeNeedId); + return BasicResult.success(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BasicResult update(PipeOutPlanEntity pipeOutPlanEntity) { + PipeOutPlanEntity isExit = pipeOutPlanMapper.selectInfoByProIdAndYear(pipeOutPlanEntity.getProId(), pipeOutPlanEntity.getPlanYear()); + if (!pipeOutPlanEntity.getPlanOutId().equals(isExit.getPlanOutId()) && isExit != null){ + return BasicResult.faild("500","同一项目、年份有且只有一个计划",null); + } + pipeOutPlanMapper.update(pipeOutPlanEntity); + String planOutId = pipeOutPlanEntity.getPlanOutId(); + pipeOutPlanMapper.deleteMoth(planOutId); + List<PipeOutPlanMothEntity> monthList = pipeOutPlanEntity.getMonthList(); + for (PipeOutPlanMothEntity vo : monthList) { + vo.setPipeOutPlanId(planOutId); + vo.setId(UUIDUtils.create()); + pipeOutPlanMapper.insertMoth(vo); + } + return BasicResult.success(); + } + + @Override + public BasicResult selectInfo(String pipeNeedId) { + PipeOutPlanEntity pipeOutPlanEntity = pipeOutPlanMapper.selectInfo(pipeNeedId); + List<PipeOutPlanMothEntity> mothList = pipeOutPlanMapper.findMothList(pipeNeedId); + pipeOutPlanEntity.setMonthList(mothList); + return BasicResult.success(pipeOutPlanEntity); + } + + @Override + public BasicResult findAll(Map<String, Object> map) { + Integer pageNum = (Integer) map.get("pageNum"); + Integer pageSize = (Integer) map.get("pageSize"); + PageHelper.startPage(pageNum,pageSize); + SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(); + map.put("companyId",userInfo.getCompanyId()); + List<PipeOutPlanEntity> all = pipeOutPlanMapper.findAll(map); + all.forEach(obj->{ + String proId = obj.getProId(); + Integer planYear = obj.getPlanYear(); + String planOutId = obj.getPlanOutId(); + List<PipeOutPlanMothEntity> mothListByProIdAndYear = pipeOutPlanMapper.findMothListByProIdAndYear(proId, planYear.toString(), planOutId); + Integer completePlanProductNum = 0; + for (PipeOutPlanMothEntity pipeOutPlanMothEntity : mothListByProIdAndYear) { + Integer completePlanProduct = pipeOutPlanMothEntity.getCompletePlanProduct(); + completePlanProductNum+=completePlanProduct; + } + obj.setMonthList(mothListByProIdAndYear); + obj.setCompletePipeNum(completePlanProductNum); + }); + return BasicResult.success(new PageInfo<>(all)); + } + + + +} diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/rebarprint/controller/TSteelPrintController.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/rebarprint/controller/TSteelPrintController.java index edcd83b..0b2db2a 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/rebarprint/controller/TSteelPrintController.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/rebarprint/controller/TSteelPrintController.java @@ -50,7 +50,7 @@ @GetMapping("/test") - public void dowanload(@RequestParam String num + public void dowanload(@RequestParam(required = false) String num ,@RequestParam(required = false) Integer type ,@RequestParam(required = false) String mouldId ,@RequestParam(required = false) String steelProduceId diff --git a/hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml b/hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml new file mode 100644 index 0000000..b5081a1 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml @@ -0,0 +1,249 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.thhy.materials.modules.biz.pipeoutplan.mapper.PipeOutPlanMapper"> + + <!--查询列表--> + <select id="findAll" resultType="com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity"> + SELECT + t.plan_out_id planOutId, + t.pro_id proId, + t.plan_year planYear, + t.need_pipe_num needPipeNum, + t.create_time createTime, + t.create_user createUser, + t.update_time updateTime, + t.update_user updateUser, + sp.pro_name proName + from t_pipe_out_plan t + left join sys_project sp on sp.pro_id = t.pro_id + WHERE t.is_use = 1 + AND sp.company_id = #{companyId} + <if test="proId !=null and proId !=''"> + and t.pro_id = #{proId} + </if> + <if test="planYear !=null and planYear !=''"> + and t.plan_year like concat("%",#{planYear},"%") + </if> + order by t.create_time desc + </select> + + <select id="findMothList" resultType="com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanMothEntity"> + select + id, + pipe_out_plan_id pipeOutPlanId, + month, + planProduct + from t_pipe_out_plan_moth + WHERE pipe_out_plan_id =#{pipeOutPlanId} + + </select> + <!--查询单条--> + <select id="selectInfo" resultType="com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity"> + SELECT + t.plan_out_id planOutId, + t.pro_id proId, + t.plan_year planYear, + t.need_pipe_num needPipeNum, + t.create_time createTime, + t.create_user createUser, + t.update_time updateTime, + t.update_user updateUser, + sp.pro_name proName + from t_pipe_out_plan t + where + t.is_use = 1 + and t.plan_out_id = #{planOutId} + </select> + + <select id="selectInfoByProIdAndYear" resultType="com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity"> + SELECT + t.plan_out_id planOutId, + t.pro_id proId, + t.plan_year planYear, + t.need_pipe_num needPipeNum, + t.create_time createTime, + t.create_user createUser, + t.update_time updateTime, + t.update_user updateUser, + sp.pro_name proName + from t_pipe_out_plan t + left join sys_project sp on sp.pro_id = t.pro_id + where + t.is_use = 1 + and t.pro_id = #{proId} + and t.plan_year = #{planYear} + </select> + <select id="findMothListByProIdAndYear" resultType="com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanMothEntity"> + SELECT a.`month`,a.plan_product planProduct,b.pro_id,e.num completePlanProduct FROM t_pipe_out_plan_moth a + LEFT JOIN t_pipe_out_plan b ON a.pipe_out_plan_id = b.plan_out_id + LEFT JOIN + (SELECT + d.yearAndMoth, + d.Moth, + IFNULL(c.num,0)num, + c.pro_id + FROM( + SELECT + IF(a.`index` < 10,CONCAT(#{year},'-0',a.`index`),CONCAT(#{year},'-',a.`index`)) yearAndMoth, + a.`index` Moth + FROM + (SELECT @s := @s + 1 AS `index` FROM mysql.help_topic,(SELECT @s := 0 ) temp WHERE @s < 12) a + )d + LEFT JOIN + ( SELECT + COUNT(b.pipe_id) num, + pro_id, + b.time yearAndMoth + FROM ( + SELECT + pipe_id, + pro_id, + DATE_FORMAT( out_mod_time, '%Y-%m' ) time + FROM + t_pipe_info + WHERE + go_in = 2 + AND pro_id = #{proId} + AND out_mod_time LIKE CONCAT(#{year},'%') + ) b + GROUP BY b.time + ) c ON c.yearAndMoth= d.yearAndMoth + ) e ON e.Moth = a.month + WHERE b.pro_id = #{proId} and a.pipe_out_plan_id =#{planOutId} + ORDER BY a.month + </select> + + <insert id="insertMoth"> + insert into t_pipe_out_plan_moth + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="id != null"> + id, + </if> + <if test="pipeOutPlanId != null"> + pipe_out_plan_id, + </if> + <if test="month != null"> + `month`, + </if> + <if test="planProduct != null"> + plan_product, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="pipeOutPlanId != null"> + #{pipeOutPlanId,jdbcType=VARCHAR}, + </if> + <if test="month != null"> + #{month,jdbcType=INTEGER}, + </if> + <if test="planProduct != null"> + #{planProduct,jdbcType=INTEGER}, + </if> + </trim> + </insert> + + <!--插入操作--> + <insert id="insert"> + insert into t_pipe_out_plan + <trim prefix="(" suffix=")" suffixOverrides="," > + + <if test="planOutId != null"> + plan_out_id, + </if> + <if test="proId != null"> + pro_id, + </if> + <if test="planYear != null"> + plan_year, + </if> + <if test="needPipeNum != null"> + need_pipe_num, + </if> + <if test="createTime != null"> + create_time, + </if> + <if test="createUser != null"> + create_user, + </if> + <if test="updateTime != null"> + update_time, + </if> + <if test="updateUser != null"> + update_user, + </if> + </trim> + + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="planOutId != null"> + #{planOutId}, + </if> + <if test="proId != null"> + #{proId}, + </if> + <if test="planYear != null"> + #{planYear}, + </if> + <if test="needPipeNum != null"> + #{needPipeNum}, + </if> + <if test="createTime != null"> + #{createTime}, + </if> + <if test="createUser != null"> + #{createUser}, + </if> + <if test="updateTime != null"> + #{updateTime}, + </if> + <if test="updateUser != null"> + #{updateUser}, + </if> + </trim> + </insert> + + + <!--更新操作--> + <update id="update"> + update t_pipe_out_plan + <set> + <if test="proId != null"> + pro_id=#{proId}, + </if> + <if test="planYear != null"> + plan_year=#{planYear}, + </if> + <if test="needPipeNum != null"> + need_pipe_num = #{needPipeNum}, + </if> + <if test="createTime != null"> + create_time=#{createTime}, + </if> + <if test="createUser != null"> + create_user=#{createUser}, + </if> + <if test="updateTime != null"> + update_time=#{updateTime}, + </if> + <if test="updateUser != null"> + update_user=#{updateUser}, + </if> + </set> + where plan_out_id=#{planOutId} + </update> + + <!--逻辑删除--> + <update id="delete"> + update t_pipe_out_plan + SET is_use = 0 + where plan_out_id=#{planOutId} + </update> + + <delete id="deleteMoth"> + delete from t_pipe_out_plan_moth where pipe_out_plan_id=#{planOutId} + </delete> + + +</mapper> diff --git a/hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml b/hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml index 94c0c00..2e9f97d 100644 --- a/hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml +++ b/hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml @@ -401,7 +401,7 @@ order by times asc </select> - <insert id="dataValueInsert" > + <insert id="dataValueIn" > insert into t_data_value <trim prefix="(" suffix=")" suffixOverrides=","> <if test="dataId != null"> @@ -553,132 +553,582 @@ order by sm_time desc </select> - <insert id="smockInsert" > + <insert id="smockIn" > insert into t_data_smock <trim prefix="(" suffix=")" suffixOverrides=","> <if test="smokeId != null"> smoke_id, </if> - <if test="gatewayCyc != null"> - gateway_cyc, + <if test="time != null"> + time, </if> - <if test="fans != null"> - FanS, + <if test="i00 != null"> + I00, </if> - <if test="v1run != null"> - V1Run, + <if test="i01 != null"> + I01, </if> - <if test="uv1run != null"> - UV1Run, + <if test="i02 != null"> + I02, </if> - <if test="fanrun != null"> - FanRun, + <if test="i03 != null"> + I03, </if> - <if test="uv2run != null"> - UV2Run, + <if test="i04 != null"> + I04, </if> - <if test="ssvrun != null"> - SSVRun, + <if test="i05 != null"> + I05, </if> - <if test="dp != null"> - DP, + <if test="i06 != null"> + I06, </if> - <if test="t != null"> - T, + <if test="i07 != null"> + I07, </if> - <if test="oc != null"> - OC, + <if test="i10 != null"> + I10, </if> - <if test="gatew != null"> - gatew, + <if test="i11 != null"> + I11, </if> - <if test="nxrun != null"> - NXRun, + <if test="q00 != null"> + Q00, </if> - <if test="alarm != null"> - Alarm, + <if test="q01 != null"> + Q01, </if> - <if test="times != null"> - times, + <if test="q02 != null"> + Q02, </if> - <if test="rtcVolt != null"> - RTC_VOLT, + <if test="q03 != null"> + Q03, </if> - <if test="v2run != null"> - V2Run, + <if test="q04 != null"> + Q04, </if> - <if test="dxqvrun != null"> - DXQVRun, + <if test="q05 != null"> + Q05, </if> - <if test="press != null"> - Press, + <if test="vb0 != null"> + VB0, </if> - <if test="dc != null"> - Dc, + <if test="vb10 != null"> + VB10, + </if> + <if test="vb11 != null"> + VB11, + </if> + <if test="vb12 != null"> + VB12, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="smokeId != null"> #{smokeId,jdbcType=INTEGER}, </if> - <if test="gatewayCyc != null"> - #{gatewayCyc,jdbcType=VARCHAR}, + <if test="time != null"> + #{time,jdbcType=VARCHAR}, </if> - <if test="fans != null"> - #{fans,jdbcType=VARCHAR}, + <if test="i00 != null"> + #{i00,jdbcType=VARCHAR}, </if> - <if test="v1run != null"> - #{v1run,jdbcType=VARCHAR}, + <if test="i01 != null"> + #{i01,jdbcType=VARCHAR}, </if> - <if test="uv1run != null"> - #{uv1run,jdbcType=VARCHAR}, + <if test="i02 != null"> + #{i02,jdbcType=VARCHAR}, </if> - <if test="fanrun != null"> - #{fanrun,jdbcType=VARCHAR}, + <if test="i03 != null"> + #{i03,jdbcType=VARCHAR}, </if> - <if test="uv2run != null"> - #{uv2run,jdbcType=VARCHAR}, + <if test="i04 != null"> + #{i04,jdbcType=VARCHAR}, </if> - <if test="ssvrun != null"> - #{ssvrun,jdbcType=VARCHAR}, + <if test="i05 != null"> + #{i05,jdbcType=VARCHAR}, </if> - <if test="dp != null"> - #{dp,jdbcType=VARCHAR}, + <if test="i06 != null"> + #{i06,jdbcType=VARCHAR}, </if> - <if test="t != null"> - #{t,jdbcType=VARCHAR}, + <if test="i07 != null"> + #{i07,jdbcType=VARCHAR}, </if> - <if test="oc != null"> - #{oc,jdbcType=VARCHAR}, + <if test="i10 != null"> + #{i10,jdbcType=VARCHAR}, </if> - <if test="gatew != null"> - #{gatew,jdbcType=VARCHAR}, + <if test="i11 != null"> + #{i11,jdbcType=VARCHAR}, </if> - <if test="nxrun != null"> - #{nxrun,jdbcType=VARCHAR}, + <if test="q00 != null"> + #{q00,jdbcType=VARCHAR}, </if> - <if test="alarm != null"> - #{alarm,jdbcType=VARCHAR}, + <if test="q01 != null"> + #{q01,jdbcType=VARCHAR}, </if> - <if test="times != null"> - #{times,jdbcType=VARCHAR}, + <if test="q02 != null"> + #{q02,jdbcType=VARCHAR}, </if> - <if test="rtcVolt != null"> - #{rtcVolt,jdbcType=VARCHAR}, + <if test="q03 != null"> + #{q03,jdbcType=VARCHAR}, </if> - <if test="v2run != null"> - #{v2run,jdbcType=VARCHAR}, + <if test="q04 != null"> + #{q04,jdbcType=VARCHAR}, </if> - <if test="dxqvrun != null"> - #{dxqvrun,jdbcType=VARCHAR}, + <if test="q05 != null"> + #{q05,jdbcType=VARCHAR}, </if> - <if test="press != null"> - #{press,jdbcType=VARCHAR}, + <if test="vb0 != null"> + #{vb0,jdbcType=VARCHAR}, </if> - <if test="dc != null"> - #{dc,jdbcType=VARCHAR}, + <if test="vb10 != null"> + #{vb10,jdbcType=VARCHAR}, + </if> + <if test="vb11 != null"> + #{vb11,jdbcType=VARCHAR}, + </if> + <if test="vb12 != null"> + #{vb12,jdbcType=VARCHAR}, </if> </trim> </insert> + <select id="dataSmockList" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataSmock"> + select + smoke_id as smokeId, + `time` as `time`, + I00 as i00, + I01 as i01, + I02 as i02, + I03 as i03, + I04 as i04, + I05 as i05, + I06 as i06, + I07 as i07, + I10 as i10, + I11 as i11, + Q00 as q00, + Q01 as q01, + Q02 as q02, + Q03 as q03, + Q04 as q04, + Q05 as q05, + VB0 as vb0, + VB10 as vb10, + VB11 as vb11, + VB12 as vb12 + from t_data_smock + where 1=1 + <if test="strTime!=null and endTime!=null and strTime!='' and endTime!='' "> + and `time` between #{strTime} and #{endTime} + </if> + order by `time` desc + </select> + <select id="dataValuesList" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataValue"> + select + data_id as dataId, + device_id as deviceId, + device_name as deviceName, + account_number as accountNumber, + upload_time as uploadTime, + pm25 as pm25, + pm10 as pm10, + tsp as tsp, + temperature as temperature, + humidity as humidity, + data6 as data6, + wind_speed as windSpeed, + wind_direction as windDirection, + tvoc as tvoc, + no2 as no2, + co as co, + so2 as so2, + o3 as o3, + noise as noise + from t_data_value + where 1=1 + <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' "> + and upload_time between #{strTime} and #{endTime} + </if> + order by upload_time desc + </select> + <insert id="dataBox" > + insert into t_data_ai + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="aiId != null"> + ai_id, + </if> + <if test="rtspUrl != null"> + rtsp_url, + </if> + <if test="boxId != null"> + box_id, + </if> + <if test="type != null"> + type, + </if> + <if test="typeName != null"> + type_name, + </if> + <if test="boxName != null"> + box_name, + </if> + <if test="deviceName != null"> + device_name, + </if> + <if test="deviceId != null"> + device_id, + </if> + <if test="channelNo != null"> + channel_no, + </if> + <if test="enterCode != null"> + enter_code, + </if> + <if test="enterName != null"> + enter_name, + </if> + <if test="signTime != null"> + sign_time, + </if> + <if test="x != null"> + x, + </if> + <if test="y != null"> + y, + </if> + <if test="w != null"> + w, + </if> + <if test="h != null"> + h, + </if> + <if test="messagerType != null"> + messager_type, + </if> + <if test="eBike != null"> + e_bike, + </if> + <if test="smoke != null"> + smoke, + </if> + <if test="fire != null"> + fire, + </if> + <if test="isExist != null"> + is_exist, + </if> + <if test="ext != null"> + ext, + </if> + <if test="tanker != null"> + tanker, + </if> + <if test="sudire != null"> + sudire, + </if> + <if test="fireControl != null"> + fire_control, + </if> + <if test="cover != null"> + cover, + </if> + <if test="licensePlateNumber != null"> + license_plate_number, + </if> + <if test="illegalParking != null"> + illegal_parking, + </if> + <if test="age != null"> + age, + </if> + <if test="gender != null"> + gender, + </if> + <if test="glasses != null"> + glasses, + </if> + <if test="mask != null"> + mask, + </if> + <if test="certifiedAvatarUrl != null"> + certified_avatar_url, + </if> + <if test="faceId != null"> + face_id, + </if> + <if test="personType != null"> + person_type, + </if> + <if test="passStatus != null"> + pass_status, + </if> + <if test="faceMaxSorce != null"> + face_max_sorce, + </if> + <if test="personName != null"> + person_name, + </if> + <if test="trackId != null"> + track_id, + </if> + <if test="score != null"> + score, + </if> + <if test="count != null"> + count, + </if> + <if test="smoking != null"> + smoking, + </if> + <if test="isInQuadrangle != null"> + is_in_quadrangle, + </if> + <if test="climbFence != null"> + climb_fence, + </if> + <if test="safetyHat != null"> + safety_hat, + </if> + <if test="reflective != null"> + reflective, + </if> + <if test="calling != null"> + calling, + </if> + <if test="assemble != null"> + assemble, + </if> + <if test="isTooling != null"> + is_tooling, + </if> + <if test="tumble != null"> + tumble, + </if> + <if test="sleeping != null"> + sleeping, + </if> + <if test="humanCountSum != null"> + human_count_sum, + </if> + <if test="businessDurationTime != null"> + business_duration_time, + </if> + <if test="pinCountSum != null"> + pin_count_sum, + </if> + <if test="poutCountSum != null"> + pout_count_sum, + </if> + <if test="pinSingle != null"> + pin_single, + </if> + <if test="poutSingle != null"> + pout_single, + </if> + <if test="signBigAvatar != null"> + sign_big_avatar, + </if> + <if test="signAvatar != null"> + sign_avatar, + </if> + <if test="videoBase64 != null"> + video_base64, + </if> + <if test="humanCoor != null"> + human_coor, + </if> + <if test="faceAttrSum != null"> + face_attr_sum, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="aiId != null"> + #{aiId,jdbcType=INTEGER}, + </if> + <if test="rtspUrl != null"> + #{rtspUrl,jdbcType=VARCHAR}, + </if> + <if test="boxId != null"> + #{boxId,jdbcType=INTEGER}, + </if> + <if test="type != null"> + #{type,jdbcType=INTEGER}, + </if> + <if test="typeName != null"> + #{typeName,jdbcType=VARCHAR}, + </if> + <if test="boxName != null"> + #{boxName,jdbcType=VARCHAR}, + </if> + <if test="deviceName != null"> + #{deviceName,jdbcType=VARCHAR}, + </if> + <if test="deviceId != null"> + #{deviceId,jdbcType=VARCHAR}, + </if> + <if test="channelNo != null"> + #{channelNo,jdbcType=VARCHAR}, + </if> + <if test="enterCode != null"> + #{enterCode,jdbcType=VARCHAR}, + </if> + <if test="enterName != null"> + #{enterName,jdbcType=VARCHAR}, + </if> + <if test="signTime != null"> + #{signTime,jdbcType=VARCHAR}, + </if> + <if test="x != null"> + #{x,jdbcType=INTEGER}, + </if> + <if test="y != null"> + #{y,jdbcType=INTEGER}, + </if> + <if test="w != null"> + #{w,jdbcType=INTEGER}, + </if> + <if test="h != null"> + #{h,jdbcType=INTEGER}, + </if> + <if test="messagerType != null"> + #{messagerType,jdbcType=VARCHAR}, + </if> + <if test="eBike != null"> + #{eBike,jdbcType=INTEGER}, + </if> + <if test="smoke != null"> + #{smoke,jdbcType=INTEGER}, + </if> + <if test="fire != null"> + #{fire,jdbcType=INTEGER}, + </if> + <if test="isExist != null"> + #{isExist,jdbcType=INTEGER}, + </if> + <if test="ext != null"> + #{ext,jdbcType=INTEGER}, + </if> + <if test="tanker != null"> + #{tanker,jdbcType=INTEGER}, + </if> + <if test="sudire != null"> + #{sudire,jdbcType=INTEGER}, + </if> + <if test="fireControl != null"> + #{fireControl,jdbcType=INTEGER}, + </if> + <if test="cover != null"> + #{cover,jdbcType=INTEGER}, + </if> + <if test="licensePlateNumber != null"> + #{licensePlateNumber,jdbcType=VARCHAR}, + </if> + <if test="illegalParking != null"> + #{illegalParking,jdbcType=INTEGER}, + </if> + <if test="age != null"> + #{age,jdbcType=INTEGER}, + </if> + <if test="gender != null"> + #{gender,jdbcType=INTEGER}, + </if> + <if test="glasses != null"> + #{glasses,jdbcType=INTEGER}, + </if> + <if test="mask != null"> + #{mask,jdbcType=INTEGER}, + </if> + <if test="certifiedAvatarUrl != null"> + #{certifiedAvatarUrl,jdbcType=VARCHAR}, + </if> + <if test="faceId != null"> + #{faceId,jdbcType=INTEGER}, + </if> + <if test="personType != null"> + #{personType,jdbcType=INTEGER}, + </if> + <if test="passStatus != null"> + #{passStatus,jdbcType=VARCHAR}, + </if> + <if test="faceMaxSorce != null"> + #{faceMaxSorce,jdbcType=VARCHAR}, + </if> + <if test="personName != null"> + #{personName,jdbcType=VARCHAR}, + </if> + <if test="trackId != null"> + #{trackId,jdbcType=INTEGER}, + </if> + <if test="score != null"> + #{score,jdbcType=VARCHAR}, + </if> + <if test="count != null"> + #{count,jdbcType=INTEGER}, + </if> + <if test="smoking != null"> + #{smoking,jdbcType=INTEGER}, + </if> + <if test="isInQuadrangle != null"> + #{isInQuadrangle,jdbcType=INTEGER}, + </if> + <if test="climbFence != null"> + #{climbFence,jdbcType=INTEGER}, + </if> + <if test="safetyHat != null"> + #{safetyHat,jdbcType=INTEGER}, + </if> + <if test="reflective != null"> + #{reflective,jdbcType=INTEGER}, + </if> + <if test="calling != null"> + #{calling,jdbcType=INTEGER}, + </if> + <if test="assemble != null"> + #{assemble,jdbcType=INTEGER}, + </if> + <if test="isTooling != null"> + #{isTooling,jdbcType=INTEGER}, + </if> + <if test="tumble != null"> + #{tumble,jdbcType=INTEGER}, + </if> + <if test="sleeping != null"> + #{sleeping,jdbcType=INTEGER}, + </if> + <if test="humanCountSum != null"> + #{humanCountSum,jdbcType=INTEGER}, + </if> + <if test="businessDurationTime != null"> + #{businessDurationTime,jdbcType=VARCHAR}, + </if> + <if test="pinCountSum != null"> + #{pinCountSum,jdbcType=INTEGER}, + </if> + <if test="poutCountSum != null"> + #{poutCountSum,jdbcType=INTEGER}, + </if> + <if test="pinSingle != null"> + #{pinSingle,jdbcType=INTEGER}, + </if> + <if test="poutSingle != null"> + #{poutSingle,jdbcType=INTEGER}, + </if> + <if test="signBigAvatar != null"> + #{signBigAvatar,jdbcType=LONGVARCHAR}, + </if> + <if test="signAvatar != null"> + #{signAvatar,jdbcType=LONGVARCHAR}, + </if> + <if test="videoBase64 != null"> + #{videoBase64,jdbcType=LONGVARCHAR}, + </if> + <if test="humanCoor != null"> + #{humanCoor,jdbcType=LONGVARCHAR}, + </if> + <if test="faceAttrSum != null"> + #{faceAttrSum,jdbcType=LONGVARCHAR}, + </if> + </trim> + </insert> </mapper> \ No newline at end of file diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java index 53c41d4..9b7ee8d 100644 --- a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java @@ -47,4 +47,8 @@ private String num; private String segmentId; + + private String yearMonth; + + private String goIn; } diff --git a/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml b/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml index e2ad715..927af88 100644 --- a/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml +++ b/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml @@ -195,8 +195,14 @@ <if test="segmentId!=null"> tpi.segment_id = #{segmentId} AND </if> - </trim> - </where> + <if test="yearMonth!=null"> + tpi.out_mod_time like CONCAT(#{yearMonth},'%') AND + </if> + <if test="goIn!=null"> + tpi.go_in = 2 AND + </if> + </trim> + </where> order by tpi.check_time desc ) a <if test="groupId != null and groupId !=''"> diff --git a/web/src/api/modules/materials.js b/web/src/api/modules/materials.js index 39e7b43..fc954a2 100644 --- a/web/src/api/modules/materials.js +++ b/web/src/api/modules/materials.js @@ -128,6 +128,13 @@ responseType: 'blob', data: params }), + + /** + * 搅拌站消耗 + */ + mixingExpendLists: (params) => + axios.post('/materials/materialRelease/materialRew', params), + /* 预埋件管理 */ embedded: { // 库存管理 diff --git a/web/src/views/Basics/MouldIndex.vue b/web/src/views/Basics/MouldIndex.vue index c4b7b51..50a5987 100644 --- a/web/src/views/Basics/MouldIndex.vue +++ b/web/src/views/Basics/MouldIndex.vue @@ -125,8 +125,8 @@ <el-form-item label="模具型号:" prop="mouldCode"> <el-input v-model="formMould.mouldCode" :size="size" clearable placeholder="请输入模具型号"></el-input> </el-form-item> - <el-form-item label="模具编号:" prop="mouldNum" v-if="!asyncTitle"> - <el-input v-model="formMould.mouldNum" :disabled="true" clearable placeholder="请输入模具编号"></el-input> + <el-form-item label="模具编号:" prop="mouldMn"> + <el-input v-model="formMould.mouldMn" clearable placeholder="请输入模具编号"></el-input> </el-form-item> <!-- <el-form-item label="模具MN号:" prop="mouldMn"> <el-input v-model="formMould.mouldMn" :size="size" clearable placeholder="请输入模具MN号"></el-input> @@ -192,10 +192,10 @@ </el-select> </el-form-item> <el-form-item label="模具检查预警值:" prop="supplierId"> - <el-input placeholder="请输入次数" v-model="formMould.input2" style="margin-right:15px"> + <el-input placeholder="请输入次数" v-model="formMould.alarmTimes" style="margin-right:15px"> <template slot="append">次数</template> </el-input> - <el-input placeholder="请输入天数" v-model="formMould.input2"> + <el-input placeholder="请输入天数" v-model="formMould.alarmDays"> <template slot="append">天数</template> </el-input> </el-form-item> @@ -212,7 +212,7 @@ <el-form-item label="最大循环次数:" prop="maxCycleTime"> <el-input v-model="formMould.maxCycleTime" :size="size" clearable placeholder="请输入最大循环次数"></el-input> </el-form-item> - <el-form-item label="生产日期:"> + <el-form-item label="生产日期:" prop="productDate"> <el-date-picker v-model="formMould.productDate" type="date" @@ -222,7 +222,7 @@ placeholder="请选择生产日期"> </el-date-picker> </el-form-item> - <el-form-item label="进厂日期:"> + <el-form-item label="进厂日期:" prop="comeFactoryTime"> <el-date-picker v-model="formMould.comeFactoryTime" type="date" @@ -336,7 +336,17 @@ required: true, message: '请输入最大循环次数', trigger: 'blur' - }] + }], + productDate: [{ + required: true, + message: '请选择生产日期', + trigger: ['blur', 'change'] + }], + comeFactoryTime: [{ + required: true, + message: '请选择进厂日期', + trigger: ['blur', 'change'] + }], }, // 表单校验规则 mouldTypeDatas: [], // 块号 mouldSizeData: [], // 尺寸 diff --git a/web/src/views/GoodManage/MixingManage.vue b/web/src/views/GoodManage/MixingManage.vue index 595c8c7..c73d0f9 100644 --- a/web/src/views/GoodManage/MixingManage.vue +++ b/web/src/views/GoodManage/MixingManage.vue @@ -17,6 +17,9 @@ <el-tab-pane label="原料实际放量" name="five"> <real-raw ref="realRaws"></real-raw> </el-tab-pane> + <el-tab-pane label="搅拌站消耗" name="six"> + <mixing-expend ref="expendm"></mixing-expend> + </el-tab-pane> </el-tabs> </div> </div> @@ -27,13 +30,15 @@ import MixingCost from './components/MixingCost.vue'//消耗记录 import MixingCheck from './components/MixingCheck.vue'//校正记录 import RealRaw from './components/RealRaw.vue'//原料实际放量 +import MixingExpend from './components/MixingExpend.vue'//搅拌站消耗 export default { components:{ MixingInvent, MixingIncome, MixingCost, MixingCheck, - RealRaw + RealRaw, + MixingExpend }, data(){ return{ @@ -66,6 +71,9 @@ this.$refs.realRaws.getLists(); this.$refs.realRaws.getMaterialNames(); break; + case 'six': + this.$refs.expendm.searchButtonInfo(true); + break; default: this.$refs.inventm.searchButtonInfo(true); } diff --git a/web/src/views/GoodManage/components/MixingExpend.vue b/web/src/views/GoodManage/components/MixingExpend.vue new file mode 100644 index 0000000..20d0934 --- /dev/null +++ b/web/src/views/GoodManage/components/MixingExpend.vue @@ -0,0 +1,203 @@ +<template> + <div class="main tabs_main" style="height:89%"> + <div class="main_header"> + <div class="header_item"> + <span class="header_label">盘次:</span> + <el-input v-model="search.byId" :size="size" clearable placeholder="请输入盘次"></el-input> + </div> + <div class="header_item"> + <el-button :size="size" icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button> + <!-- <el-button :size="size" icon="el-icon-upload2" v-if="showButton('export')" @click="exportCkeckFile()">导出Excel</el-button> --> + </div> + </div> + <div class="main_content"> + <div class="content_tables" v-for="(item,index) in tablesList" :key="index"> + <div class="content_tables_headers"> + <div class="tables_headers_title">盘次:</div> + <div class="tables_headers_datas">{{item.byId}}</div> + </div> + <div class="content_tables_alone"> + <el-table + v-loading="loading" + :data="item.rawMaterials" + height="100%"> + <el-table-column align="center" label="序号" width="60"> + <template #default="scope"> + <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span> + </template> + </el-table-column> + <el-table-column prop="storage" label="料仓" align="center" width="180"></el-table-column> + <el-table-column prop="material" label="原料名称" align="center" ></el-table-column> + <el-table-column prop="recamnt" label="配方用量(t)" align="center" ></el-table-column> + <el-table-column prop="planamnt" label="计划用量(t)" align="center" ></el-table-column> + <el-table-column prop="factamnt" label="实际用量(t)" align="center" ></el-table-column> + </el-table> + </div> + </div> + </div> + <div class="main_footer"> + <el-pagination + background + @current-change="changePageNum" + @size-change="changePageSize" + :current-page="pageNum" + :page-sizes="[10, 20, 50, 100]" + :page-size="pageSize" + layout="total, sizes, prev, pager, next, jumper" + :total="total"> + </el-pagination> + </div> + </div> +</template> + +<script> +import { buttonPinia } from '../../../pinia/index'; +import { changeSize,downFiles } from '../../../plugins/public'; // 导入节流、动态切换组件尺寸方法 + export default { + data() { + return { + size: changeSize(), // 组件尺寸 + pageNum: 1, + pageSize: 10, + search:{},//查询条件 + total: 0, + loading: false, + tablesList: [], //校正记录管理信息列表 + optionsDicts:[],//原料名称 + } + }, + watch: { + asyncVisible(bol) { + if(!bol) { + this.ruleForm = {}; + this.$refs.ruleForm.resetFields(); + } + } + }, + mounted() { + const that = this; + // 根据窗口大小动态修改组件尺寸 + window.onresize = () => { + that.size = changeSize(); + } + }, + methods: { + // 转圈圈 + functionLoading() { + this.loadingView = this.$loading({ + lock: true, + text: '请稍后...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }); + }, + //导出excel + exportCkeckFile(){ + this.functionLoading(); + let params = Object.assign({},this.search) + params.startTime = this.search.time==null?'':this.search.time&&this.search.time[0] + params.endTime = this.search.time==null?'':this.search.time&&this.search.time[1] + delete params.time + this.$api.Materials.mixingChecksexports(params).then(res => { + downFiles(res, '校正记录信息', 'xls') + this.loadingView.close() + }) + .catch(() => { + this.loadingView.close(); + }) + }, + // 查询按钮列表信息 + searchButtonInfo(bol) { + if(bol) { + this.pageNum = 1; + } + let params = Object.assign({},this.search,{ + pageNum: this.pageNum, + pageSize: this.pageSize + }) + this.loading = true; + this.$api.Materials.mixingExpendLists(params).then((res) => { + if(res.statusMsg === 'ok') { + this.total = res.data.total; + this.tablesList = res.data.list; + } + this.loading = false; + }) + }, + // 判断按钮权限信息 + showButton(str) { + const pinia = buttonPinia(); + return pinia.$state.buttonInfo.includes(str); + }, + // 切换页数 + changePageNum(page) { + this.pageNum = page; + this.searchButtonInfo(); + }, + // 切换每页条数 + changePageSize(size) { + this.pageSize = size; + this.searchButtonInfo(); + } + } + } +</script> + +<style lang="scss" scoped> +@import'@/style/layout-main.scss'; +//滚动条样式 +/deep/ ::-webkit-scrollbar { + width: 4px; + height: 8px; +} +/deep/ ::-webkit-scrollbar-thumb { + border-radius: 10px; + box-shadow: inset 0 0 5px #084E6B; + background: rgba(0,0,0,0.2); +} +/deep/ ::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px transparent; + border-radius: 0; + background: transparent; +} +.main_content{ + width: 100%; + display: flex; + justify-content: space-between; + flex-wrap: wrap; + overflow: auto!important; + padding: 0 43px 0px 5px; + + .content_tables{ + width: calc(50% - 10px); + height: 500px; + background-color: #031A46; + display: flex; + flex-direction: column; + margin-bottom: 10px; + + .content_tables_headers{ + width: 100%; + line-height: 55px; + background-color: #13497E; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + display: flex; + padding-left: 15px; + .tables_headers_title{ + color: #fff; + font-size: 18px; + } + .tables_headers_datas{ + font-size: 20px; + font-weight: bold; + color: #fff; + } + } + .content_tables_alone{ + padding: 5px 2px; + height: calc(100% - 55px); + } + } +} +</style> \ No newline at end of file -- Gitblit v1.9.3