Commit f3f2b5ef authored by wujiang's avatar wujiang

提交修改bug

parent 0a860fb3
...@@ -82,10 +82,10 @@ public class CylinderInfoDto extends BaseDto { ...@@ -82,10 +82,10 @@ public class CylinderInfoDto extends BaseDto {
@ApiModelProperty(value = "数据完整度") @ApiModelProperty(value = "数据完整度")
private Double integrity; private Double integrity;
@ApiModelProperty(value = "???") @ApiModelProperty(value = "精度")
private String longitude; private String longitude;
@ApiModelProperty(value = "γ?") @ApiModelProperty(value = "纬度")
private String latitude; private String latitude;
@ApiModelProperty(value = "统一社会信用代码") @ApiModelProperty(value = "统一社会信用代码")
...@@ -110,10 +110,10 @@ public class CylinderInfoDto extends BaseDto { ...@@ -110,10 +110,10 @@ public class CylinderInfoDto extends BaseDto {
private String typeExperiments; private String typeExperiments;
@ApiModelProperty(value = "阀门制造单位") @ApiModelProperty(value = "阀门制造单位")
private Double valveManufacturUnit; private String valveManufacturUnit;
@ApiModelProperty(value = "公称工作压力(MPa)") @ApiModelProperty(value = "公称工作压力(MPa)")
private String nominalWorkPressure; private Double nominalWorkPressure;
@ApiModelProperty(value = "设备品种名称") @ApiModelProperty(value = "设备品种名称")
private String cylinderVarietyName; private String cylinderVarietyName;
...@@ -145,5 +145,14 @@ public class CylinderInfoDto extends BaseDto { ...@@ -145,5 +145,14 @@ public class CylinderInfoDto extends BaseDto {
* 检验状态(已超期、即将超期) * 检验状态(已超期、即将超期)
*/ */
private String inspectionStatusDesc; private String inspectionStatusDesc;
private int isWarn = 0;
private String qrCode;
private String electronicLabelCode;
private String cylinderStatusStr;
} }
...@@ -103,5 +103,8 @@ public class CylinderUnitDto extends BaseDto { ...@@ -103,5 +103,8 @@ public class CylinderUnitDto extends BaseDto {
* 星级 (写死的★★★★★) * 星级 (写死的★★★★★)
*/ */
private String evaluate; private String evaluate;
private boolean outOfDate = false;
} }
...@@ -33,7 +33,7 @@ public class TzCylinderInfoDto { ...@@ -33,7 +33,7 @@ public class TzCylinderInfoDto {
/** /**
* 设备品种 * 设备品种
*/ */
private Integer cylinderVariety; private String cylinderVariety;
@ApiModelProperty(value = "产品名称") @ApiModelProperty(value = "产品名称")
/** /**
...@@ -75,7 +75,7 @@ public class TzCylinderInfoDto { ...@@ -75,7 +75,7 @@ public class TzCylinderInfoDto {
/** /**
* 气瓶状态 * 气瓶状态
*/ */
private Integer cylinderStatus; private String cylinderStatus;
@ApiModelProperty(value = "阀门制造单位") @ApiModelProperty(value = "阀门制造单位")
/** /**
......
...@@ -109,10 +109,10 @@ public class CylinderInfo extends BaseEntity { ...@@ -109,10 +109,10 @@ public class CylinderInfo extends BaseEntity {
private String typeExperiments; private String typeExperiments;
@ApiModelProperty(value = "阀门制造单位") @ApiModelProperty(value = "阀门制造单位")
private Double valveManufacturUnit; private String valveManufacturUnit;
@ApiModelProperty(value = "公称工作压力(MPa)") @ApiModelProperty(value = "公称工作压力(MPa)")
private String nominalWorkPressure; private Double nominalWorkPressure;
@ApiModelProperty(value = "设备品种名称") @ApiModelProperty(value = "设备品种名称")
private String cylinderVarietyName; private String cylinderVarietyName;
......
...@@ -23,6 +23,9 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> { ...@@ -23,6 +23,9 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
* @return * @return
*/ */
Map<String, String> queryNumAndOutOfDateNum(@Param("sequenceNbr") Long sequenceNbr); Map<String, String> queryNumAndOutOfDateNum(@Param("sequenceNbr") Long sequenceNbr);
Integer getMonthInfoTotal(@Param("regionCode") String regionCode);
/** /**
* 获取上个月气瓶总量 * 获取上个月气瓶总量
...@@ -46,7 +49,9 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> { ...@@ -46,7 +49,9 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Double queryIntegirtyByAppId(@Param("appId") String appId); Double queryIntegirtyByAppId(@Param("appId") String appId);
Integer getWarnNum(String code); Integer getWarnNum(String code);
Integer getMonthInfoTotalUnit(@Param("appId") String appId);
/** /**
* 获取上个月气瓶总量-APPID * 获取上个月气瓶总量-APPID
* @return * @return
......
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper; package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInspection; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInspection;
/** /**
...@@ -10,5 +12,7 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInspection; ...@@ -10,5 +12,7 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInspection;
* @date 2022-03-04 * @date 2022-03-04
*/ */
public interface CylinderInspectionMapper extends BaseMapper<CylinderInspection> { public interface CylinderInspectionMapper extends BaseMapper<CylinderInspection> {
Page<CylinderInfo> queryOutOfDateCylinder(Page<CylinderInfo> pageBean,String appId);
} }
...@@ -32,4 +32,6 @@ public interface CylinderUnitMapper extends BaseMapper<CylinderUnit> { ...@@ -32,4 +32,6 @@ public interface CylinderUnitMapper extends BaseMapper<CylinderUnit> {
Integer getUnitTotalByRegionCode(@Param("regionCode") String regionCode); Integer getUnitTotalByRegionCode(@Param("regionCode") String regionCode);
Integer getWarnNum(String code); Integer getWarnNum(String code);
Integer getWarnNumByAppId(String appId);
} }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
IFNULL( IFNULL(
sum( sum(
case c.within_scope+c.sealed_state+c.defective+c.abnormal_temperature+c.warning_sign case c.within_scope+c.sealed_state+c.defective+c.abnormal_temperature+c.warning_sign
when 5 then 1 when 15730 then 1
else else
0 end ), 0) from tz_cylinder_filling_check c where date_format(c.inspection_date,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId} 0 end ), 0) from tz_cylinder_filling_check c where date_format(c.inspection_date,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select> </select>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
IFNULL( IFNULL(
sum( sum(
case f.is_valid+f.same+f.is_regulations+f.is_compliance_withGBT+f.have_still_pressure+f.is_complete+f.have_security_documents case f.is_valid+f.same+f.is_regulations+f.is_compliance_withGBT+f.have_still_pressure+f.is_complete+f.have_security_documents
when 7 then 1 when 21920 then 1
else else
0 end ),0) from tz_cylinder_filling f where date_format(f.inspection_date,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId} 0 end ),0) from tz_cylinder_filling f where date_format(f.inspection_date,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select> </select>
......
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
<sql id="selectAPPIdByRegionCode"> <sql id="selectAPPIdByRegionCode">
select u.app_id from tz_cylinder_unit u where u.region_code like CONCAT('%',#{regionCode},'%') select u.app_id from tz_cylinder_unit u where u.region_code like CONCAT('%',#{regionCode},'%')
</sql> </sql>
<select id="getMonthInfoTotal" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) ,
date_format( sync_date, '%Y%m' ) ) =0 AND app_id in (<include refid="selectAPPIdByRegionCode"/>)
</select>
<select id="getLastMonthInfoTotal" resultType="java.lang.Integer"> <select id="getLastMonthInfoTotal" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) ,
...@@ -43,7 +48,11 @@ ...@@ -43,7 +48,11 @@
<select id="getWarnNum" resultType="java.lang.Integer"> <select id="getWarnNum" resultType="java.lang.Integer">
select count(1) from view_cylider_outofdate v where v.app_id in (<include refid="selectAPPIdByRegionCode"/>) select count(1) from view_cylider_outofdate v where v.app_id in (<include refid="selectAPPIdByRegionCode"/>)
</select> </select>
<select id="getMonthInfoTotalUnit" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =0 AND app_id = #{appId}
</select>
<select id="getLastMonthInfoTotalUnit" resultType="java.lang.Integer"> <select id="getLastMonthInfoTotalUnit" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =1 AND app_id = #{appId} select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =1 AND app_id = #{appId}
</select> </select>
......
...@@ -2,4 +2,14 @@ ...@@ -2,4 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInspectionMapper"> <mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInspectionMapper">
<select id="queryOutOfDateCylinder" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo">
SELECT
*
FROM
tz_cylinder_info info
LEFT JOIN tz_cylinder_inspection ins ON ins.sequence_code = info.sequence_code
WHERE TO_DAYS(ins.next_inspection_date) - TO_DAYS(NOW()) &lt;= 20
AND info.app_id = #{appId}
</select>
</mapper> </mapper>
...@@ -19,5 +19,9 @@ ...@@ -19,5 +19,9 @@
select u.app_id from tz_cylinder_unit u where u.region_code like CONCAT('%',#{regionCode},'%') select u.app_id from tz_cylinder_unit u where u.region_code like CONCAT('%',#{regionCode},'%')
) )
</select> </select>
<select id="getWarnNumByAppId" resultType="java.lang.Integer">
select count(1) from view_cylider_outofdate v where v.app_id =#{appId}
</select>
</mapper> </mapper>
...@@ -104,22 +104,6 @@ public class AmosTzsApplication { ...@@ -104,22 +104,6 @@ public class AmosTzsApplication {
@Bean @Bean
public void initToken() { public void initToken() {
new Thread(new Runnable() {
@Override
public void run() {
cylinderInfoServiceImpl.synFillingUnloadData();
cylinderInfoServiceImpl.synAreaData();
cylinderInfoServiceImpl.addIntegrityData();
cylinderInfoServiceImpl.getCylinderUnitInfo();
cylinderInfoServiceImpl.getCylinderInfo();
cylinderInfoServiceImpl.synUnitCylinderInfoData();
cylinderInfoServiceImpl.synUnitCylinderFillingData();
cylinderInfoServiceImpl.synUnitCylinderTagsData();
cylinderInfoServiceImpl.synUnitIntegrityData();
cylinderInfoServiceImpl.synUnitFillingCheckData();
cylinderInfoServiceImpl.synFillingUnloadUnitData();
}
}).start();
startPlatformTokenService.getToken(); startPlatformTokenService.getToken();
} }
} }
package com.yeejoin.amos.boot.module.tzs.biz.controller; package com.yeejoin.amos.boot.module.tzs.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -12,8 +17,13 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -12,8 +17,13 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto; import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -28,76 +38,100 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -28,76 +38,100 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
@RequestMapping(value = "/equipment-category") @RequestMapping(value = "/equipment-category")
public class EquipmentCategoryController extends BaseController { public class EquipmentCategoryController extends BaseController {
@Autowired @Autowired
EquipmentCategoryServiceImpl equipmentCategoryServiceImpl; EquipmentCategoryServiceImpl equipmentCategoryServiceImpl;
/** /**
* 新增装备分类 * 新增装备分类
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增装备分类", notes = "新增装备分类") @ApiOperation(httpMethod = "POST", value = "新增装备分类", notes = "新增装备分类")
public ResponseModel<EquipmentCategoryDto> save(@RequestBody EquipmentCategoryDto model) { public ResponseModel<EquipmentCategoryDto> save(@RequestBody EquipmentCategoryDto model) {
model = equipmentCategoryServiceImpl.createWithModel(model); model = equipmentCategoryServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除装备分类", notes = "根据sequenceNbr删除装备分类") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除装备分类", notes = "根据sequenceNbr删除装备分类")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.removeById(sequenceNbr)); @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
} return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.removeById(sequenceNbr));
}
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个装备分类", notes = "根据sequenceNbr查询单个装备分类") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个装备分类", notes = "根据sequenceNbr查询单个装备分类")
public ResponseModel<EquipmentCategoryDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<EquipmentCategoryDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.queryBySeq(sequenceNbr));
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "装备分类分页查询", notes = "装备分类分页查询") @ApiOperation(httpMethod = "GET", value = "装备分类分页查询", notes = "装备分类分页查询")
public ResponseModel<Page<EquipmentCategoryDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<EquipmentCategoryDto>> queryForPage(@RequestParam(value = "current") int current,
(value = "size") int size) { @RequestParam(value = "size") int size) {
Page<EquipmentCategoryDto> page = new Page<EquipmentCategoryDto>(); Page<EquipmentCategoryDto> page = new Page<EquipmentCategoryDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.queryForEquipmentCategoryPage(page)); return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.queryForEquipmentCategoryPage(page));
} }
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "装备分类列表全部数据查询", notes = "装备分类列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "装备分类列表全部数据查询", notes = "装备分类列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<EquipmentCategoryDto>> selectForList() { public ResponseModel<List<EquipmentCategoryDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.queryForEquipmentCategoryList()); return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.queryForEquipmentCategoryList());
}
/**
* 树
*
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "装备分类列表全部数据查询", notes = "装备分类列表全部数据查询")
@GetMapping(value = "/tree")
public ResponseModel<Object> tree(@RequestParam Long code) throws Exception {
EquipmentCategory root = equipmentCategoryServiceImpl
.getOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getCode, code));
QueryWrapper<EquipmentCategory> queryWrapper = new QueryWrapper<>();
queryWrapper.likeRight("code", code.toString().replaceAll("0+$", ""));
Collection<EquipmentCategory> list = equipmentCategoryServiceImpl.list(queryWrapper);
Menu menu = new Menu(root.getId(), root.getName(), 0L, 0);
List<Menu> menus = TreeParser.getTree(root.getId(), list, EquipmentCategory.class.getName(), "getId", 0, "getName",
"getParentId", null, "getCode");
menu.setChildren(menus);
List<Menu> tree = new ArrayList<>();
tree.add(menu);
return ResponseHelper.buildResponse(tree);
} }
} }
...@@ -93,10 +93,10 @@ public class WechatController extends BaseController { ...@@ -93,10 +93,10 @@ public class WechatController extends BaseController {
@Value("${tzs.wechat.ticketurl}") @Value("${tzs.wechat.ticketurl}")
private String WECHAT_TICKETURL; private String WECHAT_TICKETURL;
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
@Value("${mqtt.topic.task.personinfo}") @Value("${mqtt.topic.task.personinfo}")
private String personInfoTopic; private String personInfoTopic;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
...@@ -124,62 +124,62 @@ public class WechatController extends BaseController { ...@@ -124,62 +124,62 @@ public class WechatController extends BaseController {
private Long TOKEN_TIME = 1209600l; private Long TOKEN_TIME = 1209600l;
/** /**
* 获取微信回调信息返回验证是否通过 * 获取微信回调信息返回验证是否通过
*
* @param signature * @param signature
* @param timestamp * @param timestamp
* @param nonce * @param nonce
* @param echostr * @param echostr
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.ANONYMOUS , needAuth = false) @TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false)
@GetMapping(value = "/getInfo") @GetMapping(value = "/getInfo")
@ApiOperation(httpMethod = "GET", value = "获取微信传回的get信息", notes = "获取微信传回的get信息") @ApiOperation(httpMethod = "GET", value = "获取微信传回的get信息", notes = "获取微信传回的get信息")
public String getWechatInfo(@RequestParam String signature,@RequestParam String timestamp,@RequestParam String nonce,@RequestParam String echostr) { public String getWechatInfo(@RequestParam String signature, @RequestParam String timestamp,
@RequestParam String nonce, @RequestParam String echostr) {
List<String> params = new ArrayList<String>(); List<String> params = new ArrayList<String>();
params.add(WECHAT_TOKEN); params.add(WECHAT_TOKEN);
params.add(timestamp); params.add(timestamp);
params.add(nonce); params.add(nonce);
Collections.sort(params); Collections.sort(params);
String tokenStr = StringUtils.join(params,""); String tokenStr = StringUtils.join(params, "");
tokenStr = DigestUtils.sha1Hex(tokenStr); tokenStr = DigestUtils.sha1Hex(tokenStr);
System.out.println("=============回调get消息start============="); System.out.println("=============回调get消息start=============");
System.out.println(echostr); System.out.println(echostr);
System.out.println("=============回调get消息end============="); System.out.println("=============回调get消息end=============");
if(tokenStr.equals(signature)) { if (tokenStr.equals(signature)) {
return echostr; return echostr;
} else { } else {
return ""; return "";
} }
} }
@TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false)
@TycloudOperation(ApiLevel = UserType.ANONYMOUS , needAuth = false)
@PostMapping(value = "/getSignature") @PostMapping(value = "/getSignature")
@ApiOperation(httpMethod = "POST", value = "获取微信签名", notes = "获取微信签名") @ApiOperation(httpMethod = "POST", value = "获取微信签名", notes = "获取微信签名")
public ResponseModel<String> getSignature(@RequestBody SignatureDto signatureDto) { public ResponseModel<String> getSignature(@RequestBody SignatureDto signatureDto) {
List<String> params = new ArrayList<String>(); List<String> params = new ArrayList<String>();
try { try {
String ticket = null; String ticket = null;
if(redisUtils.hasKey(RedisKey.WECHAT_JS_TOKEN)) { if (redisUtils.hasKey(RedisKey.WECHAT_JS_TOKEN)) {
ticket = redisUtils.get(RedisKey.WECHAT_JS_TOKEN).toString(); ticket = redisUtils.get(RedisKey.WECHAT_JS_TOKEN).toString();
} else { } else {
if(!redisUtils.hasKey(RedisKey.WECHAT_TOKEN)){ if (!redisUtils.hasKey(RedisKey.WECHAT_TOKEN)) {
this.getAccessToken(); this.getAccessToken();
} }
String token = redisUtils.get(RedisKey.WECHAT_TOKEN).toString(); String token = redisUtils.get(RedisKey.WECHAT_TOKEN).toString();
String result = HttpUtils.doGet(WECHAT_TICKETURL+token+"&type=jsapi"); String result = HttpUtils.doGet(WECHAT_TICKETURL + token + "&type=jsapi");
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
ticket = jsonObject.get("ticket").toString(); ticket = jsonObject.get("ticket").toString();
redisUtils.set(RedisKey.WECHAT_JS_TOKEN,ticket, 600l); redisUtils.set(RedisKey.WECHAT_JS_TOKEN, ticket, 600l);
} }
params.add("jsapi_ticket="+ticket); params.add("jsapi_ticket=" + ticket);
params.add("noncestr=" + signatureDto.getNoncestr()); params.add("noncestr=" + signatureDto.getNoncestr());
params.add("timestamp=" + signatureDto.getTimestamp()); params.add("timestamp=" + signatureDto.getTimestamp());
params.add("url=" + signatureDto.getUrl()); params.add("url=" + signatureDto.getUrl());
logger.error("jsapi_ticket="+ticket); logger.error("jsapi_ticket=" + ticket);
logger.error("noncestr=" + signatureDto.getNoncestr()); logger.error("noncestr=" + signatureDto.getNoncestr());
logger.error("timestamp=" + signatureDto.getTimestamp()); logger.error("timestamp=" + signatureDto.getTimestamp());
logger.error("url=" + signatureDto.getUrl()); logger.error("url=" + signatureDto.getUrl());
...@@ -187,29 +187,29 @@ public class WechatController extends BaseController { ...@@ -187,29 +187,29 @@ public class WechatController extends BaseController {
Collections.sort(params, new Comparator<String>() { Collections.sort(params, new Comparator<String>() {
@Override @Override
public int compare(String o1, String o2) { public int compare(String o1, String o2) {
char[] chars1=o1.toCharArray(); char[] chars1 = o1.toCharArray();
char[] chars2=o2.toCharArray(); char[] chars2 = o2.toCharArray();
int i=0; int i = 0;
while(i<chars1.length && i<chars2.length){ while (i < chars1.length && i < chars2.length) {
if(chars1[i]>chars2[i]){ if (chars1[i] > chars2[i]) {
return 1; return 1;
}else if(chars1[i]<chars2[i]){ } else if (chars1[i] < chars2[i]) {
return -1; return -1;
}else{ } else {
i++; i++;
} }
} }
if(i==chars1.length){ //o1到头 if (i == chars1.length) { // o1到头
return -1; return -1;
} }
if(i== chars2.length){ //o2到头 if (i == chars2.length) { // o2到头
return 1; return 1;
} }
return 0; return 0;
} }
}); });
String tokenStr = StringUtils.join(params,"&"); String tokenStr = StringUtils.join(params, "&");
logger.error(tokenStr); logger.error(tokenStr);
tokenStr = DigestUtils.sha1Hex(tokenStr); tokenStr = DigestUtils.sha1Hex(tokenStr);
return ResponseHelper.buildResponse(tokenStr); return ResponseHelper.buildResponse(tokenStr);
...@@ -218,14 +218,14 @@ public class WechatController extends BaseController { ...@@ -218,14 +218,14 @@ public class WechatController extends BaseController {
} }
} }
/** /**
* 获取微信推送的操作通知 * 获取微信推送的操作通知
*
* @param xml * @param xml
* @param resp * @param resp
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.ANONYMOUS , needAuth = false) @TycloudOperation(ApiLevel = UserType.ANONYMOUS, needAuth = false)
@PostMapping(value = "/getInfo") @PostMapping(value = "/getInfo")
@ApiOperation(httpMethod = "POST", value = "获取微信传回的post信息", notes = "获取微信传回的post信息") @ApiOperation(httpMethod = "POST", value = "获取微信传回的post信息", notes = "获取微信传回的post信息")
public String getWechatInfoPost(@RequestBody String xml, HttpServletResponse resp) { public String getWechatInfoPost(@RequestBody String xml, HttpServletResponse resp) {
...@@ -236,7 +236,6 @@ public class WechatController extends BaseController { ...@@ -236,7 +236,6 @@ public class WechatController extends BaseController {
return "1"; return "1";
} }
/** /**
* XML格式字符串转换为Map * XML格式字符串转换为Map
* *
...@@ -283,6 +282,7 @@ public class WechatController extends BaseController { ...@@ -283,6 +282,7 @@ public class WechatController extends BaseController {
/** /**
* 根据手机号发送短信验证码 * 根据手机号发送短信验证码
*
* @param tel * @param tel
* @return * @return
*/ */
...@@ -291,9 +291,9 @@ public class WechatController extends BaseController { ...@@ -291,9 +291,9 @@ public class WechatController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据手机号发送短信验证码", notes = "根据手机号发送短信验证码") @ApiOperation(httpMethod = "GET", value = "根据手机号发送短信验证码", notes = "根据手机号发送短信验证码")
public ResponseModel<Boolean> sendSmsCode(@PathVariable String tel) { public ResponseModel<Boolean> sendSmsCode(@PathVariable String tel) {
Boolean flag = false; Boolean flag = false;
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
params.put("smsType","MOBILE_REGISTER"); params.put("smsType", "MOBILE_REGISTER");
params.put("mobile",tel); params.put("mobile", tel);
FeignClientResult<SmsRecordModel> result = Systemctl.smsClient.sendVerifyCode(params); FeignClientResult<SmsRecordModel> result = Systemctl.smsClient.sendVerifyCode(params);
return ResponseHelper.buildResponse(flag); return ResponseHelper.buildResponse(flag);
} }
...@@ -308,12 +308,11 @@ public class WechatController extends BaseController { ...@@ -308,12 +308,11 @@ public class WechatController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "新增微信公众号openid与电话号对应关系表", notes = "新增微信公众号openid与电话号对应关系表") @ApiOperation(httpMethod = "POST", value = "新增微信公众号openid与电话号对应关系表", notes = "新增微信公众号openid与电话号对应关系表")
@Transactional @Transactional
public ResponseModel<WechatAccessDto> addUser(@RequestBody WechatRelationDto model) { public ResponseModel<WechatAccessDto> addUser(@RequestBody WechatRelationDto model) {
if (ValidationUtil.isEmpty(model.getOpenId()) if (ValidationUtil.isEmpty(model.getOpenId()) || ValidationUtil.isEmpty(model.getPhone())
|| ValidationUtil.isEmpty(model.getPhone())
|| ValidationUtil.isEmpty(model.getCode())) || ValidationUtil.isEmpty(model.getCode()))
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
AgencyUserModel agencyUserModel = new AgencyUserModel(); AgencyUserModel agencyUserModel = new AgencyUserModel();
String passwd = DesUtil.encode("a_"+model.getPhone(), "qaz"); String passwd = DesUtil.encode("a_" + model.getPhone(), "qaz");
agencyUserModel.setUserName(model.getPhone()); agencyUserModel.setUserName(model.getPhone());
agencyUserModel.setRealName(model.getPhone()); agencyUserModel.setRealName(model.getPhone());
agencyUserModel.setLockStatus("UNLOCK"); agencyUserModel.setLockStatus("UNLOCK");
...@@ -324,7 +323,7 @@ public class WechatController extends BaseController { ...@@ -324,7 +323,7 @@ public class WechatController extends BaseController {
agencyUserModel.setVerifyCode(model.getCode()); agencyUserModel.setVerifyCode(model.getCode());
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.mobileRegister(agencyUserModel); FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.mobileRegister(agencyUserModel);
agencyUserModel = result.getResult(); agencyUserModel = result.getResult();
if(agencyUserModel != null && StringUtils.isNotBlank(agencyUserModel.getUserId())) { if (agencyUserModel != null && StringUtils.isNotBlank(agencyUserModel.getUserId())) {
model.setUserId(agencyUserModel.getUserId()); model.setUserId(agencyUserModel.getUserId());
wechatRelationServiceImpl.createWithModel(model); wechatRelationServiceImpl.createWithModel(model);
} else { } else {
...@@ -337,10 +336,10 @@ public class WechatController extends BaseController { ...@@ -337,10 +336,10 @@ public class WechatController extends BaseController {
loninData.setLoginId(model.getPhone()); loninData.setLoginId(model.getPhone());
loninData.setPassword(passwd); loninData.setPassword(passwd);
FeignClientResult loginResult = Privilege.authClient.idpassword(loninData); FeignClientResult loginResult = Privilege.authClient.idpassword(loninData);
if(loginResult.getStatus() == 200) { if (loginResult.getStatus() == 200) {
HashMap resultMap = (HashMap) loginResult.getResult(); HashMap resultMap = (HashMap) loginResult.getResult();
dto.setToken(resultMap.get("token").toString()); dto.setToken(resultMap.get("token").toString());
redisUtils.set(model.getPhone() + "_token", resultMap.get("token").toString(), TOKEN_TIME); redisUtils.set(model.getPhone() + "_token", resultMap.get("token").toString(), TOKEN_TIME);
} }
return ResponseHelper.buildResponse(dto); return ResponseHelper.buildResponse(dto);
...@@ -353,10 +352,10 @@ public class WechatController extends BaseController { ...@@ -353,10 +352,10 @@ public class WechatController extends BaseController {
String passwd = DesUtil.encode("a_" + tel, "qaz"); String passwd = DesUtil.encode("a_" + tel, "qaz");
loninData.setPassword(passwd); loninData.setPassword(passwd);
FeignClientResult loginResult = Privilege.authClient.idpassword(loninData); FeignClientResult loginResult = Privilege.authClient.idpassword(loninData);
if(loginResult.getStatus() == 200) { if (loginResult.getStatus() == 200) {
HashMap resultMap = (HashMap) loginResult.getResult(); HashMap resultMap = (HashMap) loginResult.getResult();
token = resultMap.get("token").toString(); token = resultMap.get("token").toString();
redisUtils.set(tel + "_token", resultMap.get("token").toString(), TOKEN_TIME); redisUtils.set(tel + "_token", resultMap.get("token").toString(), TOKEN_TIME);
} }
return token; return token;
} }
...@@ -370,30 +369,43 @@ public class WechatController extends BaseController { ...@@ -370,30 +369,43 @@ public class WechatController extends BaseController {
@GetMapping(value = "/getOpenIdTel/{code}") @GetMapping(value = "/getOpenIdTel/{code}")
@ApiOperation(httpMethod = "GET", value = "根据微信code获取openId和手机号接口", notes = "根据微信code获取openId和手机号接口") @ApiOperation(httpMethod = "GET", value = "根据微信code获取openId和手机号接口", notes = "根据微信code获取openId和手机号接口")
public ResponseModel<WechatAccessDto> getOpenIdTel(@PathVariable String code) { public ResponseModel<WechatAccessDto> getOpenIdTel(@PathVariable String code) {
logger.info("公众号登录"+code); logger.info("公众号登录" + code);
System.out.println("公众号登录"+code); System.out.println("公众号登录" + code);
WechatAccessDto wechatAccessDto = new WechatAccessDto(); WechatAccessDto wechatAccessDto = new WechatAccessDto();
String openId = wechatService.getOpenId(code); String openId = wechatService.getOpenId(code);
logger.info("公众号登录openId"+openId); logger.info("公众号登录openId" + openId);
System.out.println("公众号登录openId"+openId); System.out.println("公众号登录openId" + openId);
if(StringUtils.isNotEmpty(openId)) { if (StringUtils.isNotEmpty(openId)) {
JSONObject userInfo = wechatService.getUserInfo(openId); JSONObject userInfo = wechatService.getUserInfo(openId);
wechatAccessDto.setOpenId(openId); wechatAccessDto.setOpenId(openId);
if(userInfo != null && userInfo.get("nickname") != null && userInfo.get("sex") != null) { if (userInfo != null && userInfo.get("nickname") != null && userInfo.get("sex") != null) {
wechatAccessDto.setNickname(userInfo.getString("nickname")); wechatAccessDto.setNickname(userInfo.getString("nickname"));
wechatAccessDto.setSex(userInfo.getString("sex")); wechatAccessDto.setSex(userInfo.getString("sex"));
} }
WechatRelation temp = wechatRelationServiceImpl.getOne(new LambdaQueryWrapper<WechatRelation>().eq(WechatRelation::getOpenId,openId)); WechatRelation temp = wechatRelationServiceImpl
if(temp != null ) { .getOne(new LambdaQueryWrapper<WechatRelation>().eq(WechatRelation::getOpenId, openId));
System.out.println("公众号登录temp" + temp);
logger.info("公众号登录temp" + temp);
if (temp != null) {
wechatAccessDto.setTel(temp.getPhone()); wechatAccessDto.setTel(temp.getPhone());
if(redisUtils.hasKey(temp.getPhone() + "_token") && redisUtils.getExpire(temp.getPhone() + "_token") > 1) { if (redisUtils.hasKey(temp.getPhone() + "_token")
&& redisUtils.getExpire(temp.getPhone() + "_token") > 1) {
System.out.println(
temp.getPhone() + "_token redis: " + redisUtils.get(temp.getPhone() + "_token").toString());
wechatAccessDto.setToken(redisUtils.get(temp.getPhone() + "_token").toString()); wechatAccessDto.setToken(redisUtils.get(temp.getPhone() + "_token").toString());
} else { } else {
wechatAccessDto.setToken(this.login(temp.getPhone())); String token = this.login(temp.getPhone());
System.out.println(temp.getPhone() + "_token login: " + token);
wechatAccessDto.setToken(token);
} }
} }
else
{
wechatAccessDto.setToken("");
}
} }
logger.info("公众号登录wechatAccessDto"+wechatAccessDto); System.out.println("公众号登录wechatAccessDto" + wechatAccessDto);
logger.info("公众号登录wechatAccessDto" + wechatAccessDto);
return ResponseHelper.buildResponse(wechatAccessDto); return ResponseHelper.buildResponse(wechatAccessDto);
} }
...@@ -405,36 +417,32 @@ public class WechatController extends BaseController { ...@@ -405,36 +417,32 @@ public class WechatController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/returnDistance") @PostMapping(value = "/returnDistance")
@ApiOperation(httpMethod = "POST", value = "根据任务id 经纬度 返回现在距离任务距离", notes = "根据任务id 经纬度 返回现在距离任务距离") @ApiOperation(httpMethod = "POST", value = "根据任务id 经纬度 返回现在距离任务距离", notes = "根据任务id 经纬度 返回现在距离任务距离")
public ResponseModel<String> returnDistance(@RequestBody WechatTaskLatLonDto dto ) { public ResponseModel<String> returnDistance(@RequestBody WechatTaskLatLonDto dto) {
if (ValidationUtil.isEmpty(dto) if (ValidationUtil.isEmpty(dto) || ValidationUtil.isEmpty(dto.getTaskId())
|| ValidationUtil.isEmpty(dto.getTaskId()) || ValidationUtil.isEmpty(dto.getLatitude()) || ValidationUtil.isEmpty(dto.getLongitude())) {
|| ValidationUtil.isEmpty(dto.getLatitude())
|| ValidationUtil.isEmpty(dto.getLongitude())){
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
// 推送经纬度 人员姓名 电话 警情id // 推送经纬度 人员姓名 电话 警情id
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
DispatchTask task = dispatchTaskServiceImpl.getById(dto.getTaskId()); DispatchTask task = dispatchTaskServiceImpl.getById(dto.getTaskId());
jsonObject.put("personName",task.getResponseUserName()); jsonObject.put("personName", task.getResponseUserName());
jsonObject.put("personTel",task.getResponseUserTel()); jsonObject.put("personTel", task.getResponseUserTel());
jsonObject.put("latitude",dto.getLatitude()); jsonObject.put("latitude", dto.getLatitude());
jsonObject.put("longitude",dto.getLongitude()); jsonObject.put("longitude", dto.getLongitude());
jsonObject.put("alertId",task.getAlertId()); jsonObject.put("alertId", task.getAlertId());
try { try {
emqKeeper.getMqttClient().publish(personInfoTopic, jsonObject.toString().getBytes("UTF-8"), 1, false); emqKeeper.getMqttClient().publish(personInfoTopic, jsonObject.toString().getBytes("UTF-8"), 1, false);
} catch (MqttException e) { } catch (MqttException e) {
logger.error("mqtt发送失败" +jsonObject ); logger.error("mqtt发送失败" + jsonObject);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
logger.error("mqtt发送失败" +jsonObject ); logger.error("mqtt发送失败" + jsonObject);
} }
String distance = dispatchTaskService.returnDistanceByTaskId(dto.getTaskId(), dto.getLongitude(),
String distance = dispatchTaskService.returnDistanceByTaskId(dto.getTaskId(),dto.getLongitude(),dto.getLatitude()); dto.getLatitude());
return ResponseHelper.buildResponse(distance); return ResponseHelper.buildResponse(distance);
} }
/** /**
* 获取业务详情 * 获取业务详情
* *
...@@ -444,13 +452,12 @@ public class WechatController extends BaseController { ...@@ -444,13 +452,12 @@ public class WechatController extends BaseController {
@GetMapping(value = "/getBussinessInfo/{bussinessId}") @GetMapping(value = "/getBussinessInfo/{bussinessId}")
@ApiOperation(httpMethod = "GET", value = "获取业务详情", notes = "获取业务详情") @ApiOperation(httpMethod = "GET", value = "获取业务详情", notes = "获取业务详情")
public ResponseModel<WechatMyBussinessDto> getBussinessInfo(@PathVariable Long bussinessId) { public ResponseModel<WechatMyBussinessDto> getBussinessInfo(@PathVariable Long bussinessId) {
if (ValidationUtil.isEmpty(bussinessId)){ if (ValidationUtil.isEmpty(bussinessId)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
return ResponseHelper.buildResponse(getBussinessDtoById(bussinessId)); return ResponseHelper.buildResponse(getBussinessDtoById(bussinessId));
} }
/** /**
* 获取任务列表 * 获取任务列表
* *
...@@ -459,18 +466,16 @@ public class WechatController extends BaseController { ...@@ -459,18 +466,16 @@ public class WechatController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getTaskList") @GetMapping(value = "/getTaskList")
@ApiOperation(httpMethod = "GET", value = "根据用户手机号获取任务列表", notes = "根据用户手机号获取任务列表") @ApiOperation(httpMethod = "GET", value = "根据用户手机号获取任务列表", notes = "根据用户手机号获取任务列表")
public ResponseModel<List<WechatMyTaskListDto>> getTaskList(@ApiParam(value = "电话号码", required = true) @RequestParam String phone, public ResponseModel<List<WechatMyTaskListDto>> getTaskList(
@ApiParam(value = "任务类别", required = true) @RequestParam String taskType, @ApiParam(value = "电话号码", required = true) @RequestParam String phone,
@ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) { @ApiParam(value = "任务类别", required = true) @RequestParam String taskType,
if (ValidationUtil.isEmpty(phone) || @ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) {
ValidationUtil.isEmpty(taskType) || if (ValidationUtil.isEmpty(phone) || ValidationUtil.isEmpty(taskType) || ValidationUtil.isEmpty(currentPage)) {
ValidationUtil.isEmpty(currentPage)){
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
return ResponseHelper.buildResponse(dispatchTaskService.getTaskListByPhonePager(phone, taskType, currentPage)); return ResponseHelper.buildResponse(dispatchTaskService.getTaskListByPhonePager(phone, taskType, currentPage));
} }
/** /**
* 获取我的业务列表 * 获取我的业务列表
* *
...@@ -479,15 +484,16 @@ public class WechatController extends BaseController { ...@@ -479,15 +484,16 @@ public class WechatController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getBussinessList") @GetMapping(value = "/getBussinessList")
@ApiOperation(httpMethod = "GET", value = "根据用户手机号获取业务列表", notes = "根据用户手机号获取业务列表") @ApiOperation(httpMethod = "GET", value = "根据用户手机号获取业务列表", notes = "根据用户手机号获取业务列表")
public ResponseModel<List<WechatMyBusinessListDto>> getBussinessList(@ApiParam(value = "电话号码", required = true) @RequestParam String phone, public ResponseModel<List<WechatMyBusinessListDto>> getBussinessList(
@ApiParam(value = "业务类别", required = true) @RequestParam String businessType, @ApiParam(value = "电话号码", required = true) @RequestParam String phone,
@ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) { @ApiParam(value = "业务类别", required = true) @RequestParam String businessType,
if (ValidationUtil.isEmpty(phone) || @ApiParam(value = "当前页码", required = true) @RequestParam Long currentPage) {
ValidationUtil.isEmpty(businessType) || if (ValidationUtil.isEmpty(phone) || ValidationUtil.isEmpty(businessType)
ValidationUtil.isEmpty(currentPage)){ || ValidationUtil.isEmpty(currentPage)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
return ResponseHelper.buildResponse(iAlertCalledService.getBussinessListByPhonePager(phone, businessType, currentPage)); return ResponseHelper
.buildResponse(iAlertCalledService.getBussinessListByPhonePager(phone, businessType, currentPage));
} }
/** /**
...@@ -498,19 +504,19 @@ public class WechatController extends BaseController { ...@@ -498,19 +504,19 @@ public class WechatController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/uploadImage") @PostMapping(value = "/uploadImage")
@ApiOperation(httpMethod = "POST", value = "微信公众号上传图片", notes = "微信公众号上传图片") @ApiOperation(httpMethod = "POST", value = "微信公众号上传图片", notes = "微信公众号上传图片")
public ResponseModel<String> uploadImage(@ApiParam(value = "图片", required = true)@RequestParam MultipartFile file public ResponseModel<String> uploadImage(
) { @ApiParam(value = "图片", required = true) @RequestParam MultipartFile file) {
if (ValidationUtil.isEmpty(file)){ if (ValidationUtil.isEmpty(file)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file); FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
String urlString=""; String urlString = "";
if (date != null) { if (date != null) {
Map<String, String> map = date.getResult(); Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator(); Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
urlString=it.next(); urlString = it.next();
} }
} }
return ResponseHelper.buildResponse(urlString); return ResponseHelper.buildResponse(urlString);
...@@ -525,10 +531,10 @@ public class WechatController extends BaseController { ...@@ -525,10 +531,10 @@ public class WechatController extends BaseController {
@GetMapping(value = "/downloadWechatPic/{mediaId}") @GetMapping(value = "/downloadWechatPic/{mediaId}")
@ApiOperation(httpMethod = "GET", value = "微信公众号从微信服务器下载图片到自己服务器", notes = "微信公众号从微信服务器下载图片到自己服务器") @ApiOperation(httpMethod = "GET", value = "微信公众号从微信服务器下载图片到自己服务器", notes = "微信公众号从微信服务器下载图片到自己服务器")
public ResponseModel<String> uploadImage(@PathVariable String mediaId) { public ResponseModel<String> uploadImage(@PathVariable String mediaId) {
if (ValidationUtil.isEmpty(mediaId)){ if (ValidationUtil.isEmpty(mediaId)) {
throw new BadRequest("参数校验失败."); throw new BadRequest("参数校验失败.");
} }
String urlString = wechatService.getWechatPicByMediaId(mediaId); String urlString = wechatService.getWechatPicByMediaId(mediaId);
return ResponseHelper.buildResponse(urlString); return ResponseHelper.buildResponse(urlString);
} }
...@@ -542,142 +548,141 @@ public class WechatController extends BaseController { ...@@ -542,142 +548,141 @@ public class WechatController extends BaseController {
List<AttachmentDto> feedbackDtos = null; List<AttachmentDto> feedbackDtos = null;
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
switch (temp.getTaskTypeCode()) { switch (temp.getTaskTypeCode()) {
case "960" : // 困人救援 case "960": // 困人救援
temp.setHasDeadHurt("无"); temp.setHasDeadHurt("无");
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getSequenceNbr()); queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getSequenceNbr());
// 警情动态表单数据 // 警情动态表单数据
List<AlertFormValue> alertList = iAlertFormValueService.list(queryWrapper); List<AlertFormValue> alertList = iAlertFormValueService.list(queryWrapper);
alertList.stream().forEach(t -> { alertList.stream().forEach(t -> {
String value = t.getFieldValue(); String value = t.getFieldValue();
if("trapped_floor_num".equals(t.getFieldCode())) { if ("trapped_floor_num".equals(t.getFieldCode())) {
// 被困楼层 // 被困楼层
temp.setTrappedFloorNum(value); temp.setTrappedFloorNum(value);
} else if("trapped_num".equals(t.getFieldCode())) { } else if ("trapped_num".equals(t.getFieldCode())) {
// 被困人数 // 被困人数
temp.setTrappedNum(value); temp.setTrappedNum(value);
} else if("injured_num".equals(t.getFieldCode())) { } else if ("injured_num".equals(t.getFieldCode())) {
// 受伤人数 // 受伤人数
if(StringUtils.isNotEmpty(value)) { if (StringUtils.isNotEmpty(value)) {
temp.setHasDeadHurt("有"); temp.setHasDeadHurt("有");
}
} else if("die_num".equals(t.getFieldCode())) {
// 死亡人数
if(StringUtils.isNotEmpty(value)) {
temp.setHasDeadHurt("有");
}
} }
}); } else if ("die_num".equals(t.getFieldCode())) {
queryWrapper = new LambdaQueryWrapper<>(); // 死亡人数
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId()); if (StringUtils.isNotEmpty(value)) {
// 派遣动态表单 temp.setHasDeadHurt("有");
paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> {
String value = t.getFieldValue();
if("error_result".equals(t.getFieldCode())) {
// 故障原因
temp.setErrorResult(value);
} else if("fix_result".equals(t.getFieldCode())) {
// 维修结果
temp.setFixResult(value);
} else if("fix_remark".equals(t.getFieldCode())) {
// 维修备注
temp.setRemark(value);
} }
}); }
});
queryWrapper = new LambdaQueryWrapper<>();
imgMap = sourceFileService.getAttachments(temp.getPaperId()); queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId());
imgDtos = imgMap.get("imgs"); // 派遣动态表单
temp.setFixImgs(imgDtos); paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> {
break; String value = t.getFieldValue();
case "961" : // 故障维修 if ("error_result".equals(t.getFieldCode())) {
queryWrapper = new LambdaQueryWrapper<>(); // 故障原因
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId()); temp.setErrorResult(value);
// 派遣动态表单 } else if ("fix_result".equals(t.getFieldCode())) {
paperList = iAlertFormValueService.list(queryWrapper); // 维修结果
paperList.stream().forEach(t -> { temp.setFixResult(value);
String value = t.getFieldValue(); } else if ("fix_remark".equals(t.getFieldCode())) {
if("error_result".equals(t.getFieldCode())) { // 维修备注
// 故障原因 temp.setRemark(value);
temp.setErrorResult(value); }
} else if("fix_result".equals(t.getFieldCode())) { });
// 维修结果
temp.setFixResult(value); imgMap = sourceFileService.getAttachments(temp.getPaperId());
} else if("fix_remark".equals(t.getFieldCode())) { imgDtos = imgMap.get("imgs");
// 维修备注 temp.setFixImgs(imgDtos);
temp.setRemark(value);
} else if("feedback_result".equals(t.getFieldCode())) { break;
// 反馈结果 case "961": // 故障维修
temp.setFeedbackResult(value); queryWrapper = new LambdaQueryWrapper<>();
} queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId());
}); // 派遣动态表单
paperList = iAlertFormValueService.list(queryWrapper);
paperList.stream().forEach(t -> {
imgMap = sourceFileService.getAttachments(temp.getPaperId()); String value = t.getFieldValue();
imgDtos = imgMap.get("imgs"); if ("error_result".equals(t.getFieldCode())) {
temp.setFixImgs(imgDtos); // 故障原因
errorImgMap = sourceFileService.getAttachments(temp.getSequenceNbr()); temp.setErrorResult(value);
errorImgDtos = errorImgMap.get("imgs"); } else if ("fix_result".equals(t.getFieldCode())) {
temp.setErrorImgs(errorImgDtos); // 维修结果
feedbackDtos = errorImgMap.get("feedbacks"); temp.setFixResult(value);
temp.setFeedBackImgs(feedbackDtos); } else if ("fix_remark".equals(t.getFieldCode())) {
break; // 维修备注
case "962" : // 投诉建议 temp.setRemark(value);
queryWrapper = new LambdaQueryWrapper<>(); } else if ("feedback_result".equals(t.getFieldCode())) {
queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId()); // 反馈结果
// 派遣动态表单 temp.setFeedbackResult(value);
paperList = iAlertFormValueService.list(queryWrapper); }
paperList.stream().forEach(t -> { });
String value = t.getFieldValue();
if("action_result".equals(t.getFieldCode())) { imgMap = sourceFileService.getAttachments(temp.getPaperId());
// 处置结果 imgDtos = imgMap.get("imgs");
temp.setActionResult(value); temp.setFixImgs(imgDtos);
} else if("main_feedback_result".equals(t.getFieldCode())) { errorImgMap = sourceFileService.getAttachments(temp.getSequenceNbr());
// 维修结果 errorImgDtos = errorImgMap.get("imgs");
temp.setRemark(value); temp.setErrorImgs(errorImgDtos);
} else if("feedback_result".equals(t.getFieldCode())) { feedbackDtos = errorImgMap.get("feedbacks");
// 维修结果 temp.setFeedBackImgs(feedbackDtos);
temp.setFeedbackResult(value); break;
} case "962": // 投诉建议
}); queryWrapper = new LambdaQueryWrapper<>();
imgMap = sourceFileService.getAttachments(temp.getPaperId()); queryWrapper.eq(AlertFormValue::getAlertCalledId, temp.getPaperId());
imgDtos = imgMap.get("imgs"); // 派遣动态表单
temp.setFixImgs(imgDtos); paperList = iAlertFormValueService.list(queryWrapper);
errorImgMap = sourceFileService.getAttachments(temp.getSequenceNbr()); paperList.stream().forEach(t -> {
errorImgDtos = errorImgMap.get("imgs"); String value = t.getFieldValue();
temp.setErrorImgs(errorImgDtos); if ("action_result".equals(t.getFieldCode())) {
feedbackDtos = errorImgMap.get("feedbacks"); // 处置结果
temp.setFeedBackImgs(feedbackDtos); temp.setActionResult(value);
break; } else if ("main_feedback_result".equals(t.getFieldCode())) {
// 维修结果
temp.setRemark(value);
} else if ("feedback_result".equals(t.getFieldCode())) {
// 维修结果
temp.setFeedbackResult(value);
}
});
imgMap = sourceFileService.getAttachments(temp.getPaperId());
imgDtos = imgMap.get("imgs");
temp.setFixImgs(imgDtos);
errorImgMap = sourceFileService.getAttachments(temp.getSequenceNbr());
errorImgDtos = errorImgMap.get("imgs");
temp.setErrorImgs(errorImgDtos);
feedbackDtos = errorImgMap.get("feedbacks");
temp.setFeedBackImgs(feedbackDtos);
break;
} }
return temp; return temp;
} }
/** /**
* 微信端图片上传 * 微信端图片上传
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/testWechatFile") @PostMapping(value = "/testWechatFile")
@ApiOperation(httpMethod = "POST", value = "微信公众号上传图片", notes = "微信公众号上传图片") @ApiOperation(httpMethod = "POST", value = "微信公众号上传图片", notes = "微信公众号上传图片")
public ResponseModel<String> testWechatFile(@ApiParam(value = "图片", required = true)@RequestParam MultipartFile file) { public ResponseModel<String> testWechatFile(
if (ValidationUtil.isEmpty(file)){ @ApiParam(value = "图片", required = true) @RequestParam MultipartFile file) {
throw new BadRequest("参数校验失败."); if (ValidationUtil.isEmpty(file)) {
} throw new BadRequest("参数校验失败.");
String accessToken = wechatService.getAccessToken(); }
String getPicUrl = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=" + accessToken + "&type=image"; String accessToken = wechatService.getAccessToken();
String url = HttpUtils.doPostWithFile(getPicUrl,file,"media",accessToken,"image"); String getPicUrl = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=" + accessToken + "&type=image";
return ResponseHelper.buildResponse(url); String url = HttpUtils.doPostWithFile(getPicUrl, file, "media", accessToken, "image");
} return ResponseHelper.buildResponse(url);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/test/templateMsg/warning") @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "测试发送公众号预警消息", notes = "测试发送公众号预警消息") @GetMapping(value = "/test/templateMsg/warning")
public ResponseModel testSendTemplateMsgWarning() { @ApiOperation(httpMethod = "GET", value = "测试发送公众号预警消息", notes = "测试发送公众号预警消息")
return ResponseHelper.buildResponse(wechatService.sendTestTemplateMsgWarning()); public ResponseModel testSendTemplateMsgWarning() {
} return ResponseHelper.buildResponse(wechatService.sendTestTemplateMsgWarning());
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/test/templateMsg/supervise") @GetMapping(value = "/test/templateMsg/supervise")
......
...@@ -23,6 +23,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgProduceInfoDto; ...@@ -23,6 +23,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgProduceInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgRegistrationInfoDto; import com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgRegistrationInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgSuperviseInfoDto; import com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgSuperviseInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgUseInfoDto; import com.yeejoin.amos.boot.module.tzs.api.dto.TzsJgUseInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.tzs.api.entity.PageParam; import com.yeejoin.amos.boot.module.tzs.api.entity.PageParam;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsJgConstructionInfo; import com.yeejoin.amos.boot.module.tzs.api.entity.TzsJgConstructionInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsJgDesignInfo; import com.yeejoin.amos.boot.module.tzs.api.entity.TzsJgDesignInfo;
...@@ -98,6 +99,8 @@ public class TzsJgServiceImpl implements ITzsJgService { ...@@ -98,6 +99,8 @@ public class TzsJgServiceImpl implements ITzsJgService {
@Autowired @Autowired
ITzsJgEnclosureInfoService iTzsJgEnclosureInfoService; ITzsJgEnclosureInfoService iTzsJgEnclosureInfoService;
@Autowired
EquipmentCategoryServiceImpl equipmentCategoryServiceImpl;
/** /**
* 文件服务器地址 * 文件服务器地址
*/ */
...@@ -113,6 +116,15 @@ public class TzsJgServiceImpl implements ITzsJgService { ...@@ -113,6 +116,15 @@ public class TzsJgServiceImpl implements ITzsJgService {
tzsJgBasicInfoDto.setOrgBranchCode(result.getResult().getOrgCode()); tzsJgBasicInfoDto.setOrgBranchCode(result.getResult().getOrgCode());
} }
} }
if (tzsJgBasicInfoDto.getEquCategory() != null) {
EquipmentCategory equipmentCategory = equipmentCategoryServiceImpl
.getOne(new LambdaQueryWrapper<EquipmentCategory>().eq(EquipmentCategory::getId,
tzsJgBasicInfoDto.getEquCategory()));
if (equipmentCategory != null) {
tzsJgBasicInfoDto.setEquCategory(equipmentCategory.getCode().toString().replaceAll("0+$", ""));
}
}
Page<TzsJgBasicInfoDto> page = new Page<>(pageParam.getCurrent(), pageParam.getSize()); Page<TzsJgBasicInfoDto> page = new Page<>(pageParam.getCurrent(), pageParam.getSize());
return tzsJgMapper.page(page, tzsJgBasicInfoDto); return tzsJgMapper.page(page, tzsJgBasicInfoDto);
} }
...@@ -302,14 +314,14 @@ public class TzsJgServiceImpl implements ITzsJgService { ...@@ -302,14 +314,14 @@ public class TzsJgServiceImpl implements ITzsJgService {
.list(new LambdaQueryWrapper<TzsJgEnclosureInfo>().eq(TzsJgEnclosureInfo::getSequenceCode, code)); .list(new LambdaQueryWrapper<TzsJgEnclosureInfo>().eq(TzsJgEnclosureInfo::getSequenceCode, code));
List<TzsJgEnclosureInfoDto> enclosureInfoDtoList = new ArrayList<TzsJgEnclosureInfoDto>(); List<TzsJgEnclosureInfoDto> enclosureInfoDtoList = new ArrayList<TzsJgEnclosureInfoDto>();
if (!enclosureInfoList.isEmpty()) { if (!enclosureInfoList.isEmpty()) {
for (TzsJgEnclosureInfo enclosureInfo : enclosureInfoList) { for (TzsJgEnclosureInfo enclosureInfo : enclosureInfoList) {
TzsJgEnclosureInfoDto enclosureInfoDtoOne = new TzsJgEnclosureInfoDto(); TzsJgEnclosureInfoDto enclosureInfoDtoOne = new TzsJgEnclosureInfoDto();
BeanUtils.copyProperties( enclosureInfo, enclosureInfoDtoOne); BeanUtils.copyProperties(enclosureInfo, enclosureInfoDtoOne);
//repairInform.forEach(e -> e.setFileUrl(fileServerUrl + e.getFileUrl())); // repairInform.forEach(e -> e.setFileUrl(fileServerUrl + e.getFileUrl()));
enclosureInfoDtoList.add(enclosureInfoDtoOne); enclosureInfoDtoList.add(enclosureInfoDtoOne);
} }
} }
dto.setSequenceCode(code); dto.setSequenceCode(code);
if (superviseInfo != null) { if (superviseInfo != null) {
dto.setSuperviseCode(superviseInfo.getSuperviseCode()); dto.setSuperviseCode(superviseInfo.getSuperviseCode());
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller; package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
...@@ -15,41 +44,19 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingRecordDto; ...@@ -15,41 +44,19 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderUnitDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderTags;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnit; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnit;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderFillingRecordServiceImpl; import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderFillingRecordServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl; import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInspectionServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderTagsServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderUnitServiceImpl; import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderUnitServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.ScheduleService; import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.ScheduleService;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 气瓶基本信息 * 气瓶基本信息
...@@ -62,105 +69,115 @@ import java.util.Map; ...@@ -62,105 +69,115 @@ import java.util.Map;
@RequestMapping(value = "/cylinder-info") @RequestMapping(value = "/cylinder-info")
public class CylinderInfoController extends BaseController { public class CylinderInfoController extends BaseController {
@Autowired @Autowired
CylinderInfoServiceImpl cylinderInfoServiceImpl; CylinderInfoServiceImpl cylinderInfoServiceImpl;
@Autowired @Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl; CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired @Autowired
CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl; CylinderInspectionServiceImpl cylinderInspectionServiceImpl;
@Autowired @Autowired
ESCylinderServiceImpl esCylinderService; CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl;
private Map<Integer, String> regionMap; @Autowired
ESCylinderServiceImpl esCylinderService;
@Autowired
private SourceFileServiceImpl sourceFileService; private Map<Integer, String> regionMap;
/** @Autowired
* 新增气瓶基本信息 private SourceFileServiceImpl sourceFileService;
*
* @return @Autowired
*/ DataDictionaryServiceImpl iDataDictionaryService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @Autowired
@ApiOperation(httpMethod = "POST", value = "新增气瓶基本信息", notes = "新增气瓶基本信息") CylinderTagsServiceImpl cylinderTagsServiceImpl;
public ResponseModel<CylinderInfoDto> save(@RequestBody CylinderInfoDto model) {
model = cylinderInfoServiceImpl.createWithModel(model); /**
return ResponseHelper.buildResponse(model); * 新增气瓶基本信息
} *
* @return
/** */
* 根据sequenceNbr更新 @TycloudOperation(ApiLevel = UserType.AGENCY)
* @PostMapping(value = "/save")
* @param sequenceNbr 主键 @ApiOperation(httpMethod = "POST", value = "新增气瓶基本信息", notes = "新增气瓶基本信息")
* @return public ResponseModel<CylinderInfoDto> save(@RequestBody CylinderInfoDto model) {
*/ model = cylinderInfoServiceImpl.createWithModel(model);
@TycloudOperation(ApiLevel = UserType.AGENCY) return ResponseHelper.buildResponse(model);
@PutMapping(value = "/{sequenceNbr}") }
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新气瓶基本信息", notes = "根据sequenceNbr更新气瓶基本信息")
public ResponseModel<CylinderInfoDto> updateBySequenceNbrCylinderInfo(@RequestBody CylinderInfoDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) { /**
model.setSequenceNbr(sequenceNbr); * 根据sequenceNbr更新
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.updateWithModel(model)); *
} * @param sequenceNbr 主键
* @return
/** */
* 根据sequenceNbr删除 @TycloudOperation(ApiLevel = UserType.AGENCY)
* @PutMapping(value = "/{sequenceNbr}")
* @param sequenceNbr 主键 @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新气瓶基本信息", notes = "根据sequenceNbr更新气瓶基本信息")
*/ public ResponseModel<CylinderInfoDto> updateBySequenceNbrCylinderInfo(@RequestBody CylinderInfoDto model,
@TycloudOperation(ApiLevel = UserType.AGENCY) @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
@DeleteMapping(value = "/{sequenceNbr}") model.setSequenceNbr(sequenceNbr);
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除气瓶基本信息", notes = "根据sequenceNbr删除气瓶基本信息") return ResponseHelper.buildResponse(cylinderInfoServiceImpl.updateWithModel(model));
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) { }
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.removeById(sequenceNbr));
} /**
* 根据sequenceNbr删除
/** *
* 根据sequenceNbr查询 * @param sequenceNbr 主键
* */
* @param sequenceNbr 主键 @TycloudOperation(ApiLevel = UserType.AGENCY)
* @return @DeleteMapping(value = "/{sequenceNbr}")
*/ @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除气瓶基本信息", notes = "根据sequenceNbr删除气瓶基本信息")
@TycloudOperation(ApiLevel = UserType.AGENCY) public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
@GetMapping(value = "/{sequenceNbr}") @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个气瓶基本信息", notes = "根据sequenceNbr查询单个气瓶基本信息") return ResponseHelper.buildResponse(cylinderInfoServiceImpl.removeById(sequenceNbr));
public ResponseModel<CylinderInfoDto> selectOne(@PathVariable Long sequenceNbr) { }
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.queryBySeq(sequenceNbr));
} /**
* 根据sequenceNbr查询
/** *
* 列表分页查询 * @param sequenceNbr 主键
* * @return
* @param current 当前页 */
* @param current 每页大小 @TycloudOperation(ApiLevel = UserType.AGENCY)
* @return @GetMapping(value = "/{sequenceNbr}")
*/ @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个气瓶基本信息", notes = "根据sequenceNbr查询单个气瓶基本信息")
@TycloudOperation(ApiLevel = UserType.AGENCY) public ResponseModel<CylinderInfoDto> selectOne(@PathVariable Long sequenceNbr) {
@GetMapping(value = "/page") return ResponseHelper.buildResponse(cylinderInfoServiceImpl.queryBySeq(sequenceNbr));
@ApiOperation(httpMethod = "GET", value = "气瓶基本信息分页查询", notes = "气瓶基本信息分页查询") }
public ResponseModel<Page<CylinderInfoDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) { /**
Page<CylinderInfoDto> page = new Page<CylinderInfoDto>(); * 列表分页查询
page.setCurrent(current); *
page.setSize(size); * @param current 当前页
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.queryForCylinderInfoPage(page)); * @param current 每页大小
} * @return
*/
/** @TycloudOperation(ApiLevel = UserType.AGENCY)
* 列表全部数据查询 @GetMapping(value = "/page")
* @ApiOperation(httpMethod = "GET", value = "气瓶基本信息分页查询", notes = "气瓶基本信息分页查询")
* @return public ResponseModel<Page<CylinderInfoDto>> queryForPage(@RequestParam(value = "current") int current,
*/ @RequestParam(value = "size") int size) {
@TycloudOperation(ApiLevel = UserType.AGENCY) Page<CylinderInfoDto> page = new Page<CylinderInfoDto>();
@ApiOperation(httpMethod = "GET", value = "气瓶基本信息列表全部数据查询", notes = "气瓶基本信息列表全部数据查询") page.setCurrent(current);
@GetMapping(value = "/list") page.setSize(size);
public ResponseModel<List<CylinderInfoDto>> selectForList() { return ResponseHelper.buildResponse(cylinderInfoServiceImpl.queryForCylinderInfoPage(page));
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.queryForCylinderInfoList()); }
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "气瓶基本信息列表全部数据查询", notes = "气瓶基本信息列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<CylinderInfoDto>> selectForList() {
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.queryForCylinderInfoList());
}
// /** // /**
// * 获取气瓶增加减少总量及环比 // * 获取气瓶增加减少总量及环比
...@@ -212,32 +229,31 @@ public class CylinderInfoController extends BaseController { ...@@ -212,32 +229,31 @@ public class CylinderInfoController extends BaseController {
// return ResponseHelper.buildResponse(result); // return ResponseHelper.buildResponse(result);
// } // }
/** /**
* 获取气瓶增加减少总量及环比 * 获取气瓶增加减少总量及环比
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderInfo") @GetMapping(value = "/getCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "获取气瓶增加减少总量及环比", notes = "获取气瓶增加减少总量及环比") @ApiOperation(httpMethod = "GET", value = "获取气瓶增加减少总量及环比", notes = "获取气瓶增加减少总量及环比")
public ResponseModel<Boolean> getCylinderInfo1() { public ResponseModel<Boolean> getCylinderInfo1() {
cylinderInfoServiceImpl.getCylinderInfo(); cylinderInfoServiceImpl.getCylinderInfo();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/** /**
* 获取企业增加减少总量及环比 * 获取企业增加减少总量及环比
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderUnitInfo") @GetMapping(value = "/getCylinderUnitInfo")
@ApiOperation(httpMethod = "GET", value = "获取企业增加减少总量及环比", notes = "获取企业增加减少总量及环比") @ApiOperation(httpMethod = "GET", value = "获取企业增加减少总量及环比", notes = "获取企业增加减少总量及环比")
public ResponseModel<Boolean> getCylinderUnitInfo() { public ResponseModel<Boolean> getCylinderUnitInfo() {
cylinderInfoServiceImpl.getCylinderUnitInfo(); cylinderInfoServiceImpl.getCylinderUnitInfo();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
// // 数据完整性计算 气瓶企业信息 气瓶基本信息 标签 检验 充装 充装审核 // // 数据完整性计算 气瓶企业信息 气瓶基本信息 标签 检验 充装 充装审核
// /** // /**
...@@ -375,194 +391,218 @@ public class CylinderInfoController extends BaseController { ...@@ -375,194 +391,218 @@ public class CylinderInfoController extends BaseController {
// return ResponseHelper.buildResponse(true); // return ResponseHelper.buildResponse(true);
// } // }
/** /**
* 数据完整性同步 * 数据完整性同步
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/addIntegrityData") @GetMapping(value = "/addIntegrityData")
@ApiOperation(httpMethod = "GET", value = "数据完整性同步", notes = "数据完整性同步") @ApiOperation(httpMethod = "GET", value = "数据完整性同步", notes = "数据完整性同步")
public ResponseModel<Boolean> addIntegrityData() { public ResponseModel<Boolean> addIntegrityData() {
cylinderInfoServiceImpl.addIntegrityData(); cylinderInfoServiceImpl.addIntegrityData();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/** /**
* 数据完整性同步 * 数据完整性同步
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synAreaData") @GetMapping(value = "/synAreaData")
@ApiOperation(httpMethod = "GET", value = "同步区域数据", notes = "同步区域数据") @ApiOperation(httpMethod = "GET", value = "同步区域数据", notes = "同步区域数据")
public ResponseModel<Boolean> synAreaData() { public ResponseModel<Boolean> synAreaData() {
cylinderInfoServiceImpl.synAreaData(); cylinderInfoServiceImpl.synAreaData();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/**
/** * 装卸液体数据同步
* 装卸液体数据同步 *
* * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @GetMapping(value = "/synFillingUnloadData")
@GetMapping(value = "/synFillingUnloadData") @ApiOperation(httpMethod = "GET", value = "装卸液体数据同步", notes = "装卸液体数据同步")
@ApiOperation(httpMethod = "GET", value = "装卸液体数据同步", notes = "装卸液体数据同步") public ResponseModel<Boolean> synFillingUnloadData() {
public ResponseModel<Boolean> synFillingUnloadData() { cylinderInfoServiceImpl.synFillingUnloadData();
cylinderInfoServiceImpl.synFillingUnloadData(); return ResponseHelper.buildResponse(true);
return ResponseHelper.buildResponse(true); }
}
/**
/** * 列表分页查询
* 列表分页查询 *
* * @param pageNum 当前页
* @param pageNum 当前页 * @param pageSize 每页大小
* @param pageSize 每页大小 * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @GetMapping(value = "/cyinderRecordList")
@GetMapping(value = "/cyinderRecordList") @ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶充装信息", notes = "获取登陆人所在气瓶充装信息")
@ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶充装信息", notes = "获取登陆人所在气瓶充装信息") public ResponseModel<IPage<CylinderFillingRecordDto>> cyinderRecordList(
public ResponseModel<IPage<CylinderFillingRecordDto>> cyinderRecordList(@RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort, CylinderFillingRecordDto cylinderFillingRecordDto) { @RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort,
Page<CylinderFillingRecordDto> page = new Page<>(); CylinderFillingRecordDto cylinderFillingRecordDto) {
page.setCurrent(pageNum); Page<CylinderFillingRecordDto> page = new Page<>();
page.setSize(pageSize); page.setCurrent(pageNum);
String sortParam = ""; page.setSize(pageSize);
String sortRule = ""; String sortParam = "";
if (sort != null) { // 排序失效 String sortRule = "";
String[] date = sort.split(","); if (sort != null) { // 排序失效
if (date[1].equals("ascend")) { String[] date = sort.split(",");
sortParam = "r." + RedisKey.humpToLine(date[0]); if (date[1].equals("ascend")) {
sortRule = "asc"; sortParam = "r." + RedisKey.humpToLine(date[0]);
} else { sortRule = "asc";
sortParam = "r." + RedisKey.humpToLine(date[0]); } else {
sortRule = "desc"; sortParam = "r." + RedisKey.humpToLine(date[0]);
} sortRule = "desc";
} else { }
sortParam = "r.sync_date"; } else {
sortRule = "desc"; sortParam = "r.sync_date";
} sortRule = "desc";
if (StringUtils.isEmpty(cylinderFillingRecordDto.getSequenceCode())) { }
cylinderFillingRecordDto.setAppId("9B150BB7D0C21A7A62BD6837E14A44BF"); if (StringUtils.isEmpty(cylinderFillingRecordDto.getSequenceCode())) {
} cylinderFillingRecordDto.setAppId("9B150BB7D0C21A7A62BD6837E14A44BF");
Page<CylinderFillingRecordDto> pageBean = cylinderFillingRecordServiceImpl.queryListByQueryDto(page, cylinderFillingRecordDto, sortParam, sortRule); }
Page<CylinderFillingRecordDto> result = new Page<>(pageNum, pageSize); Page<CylinderFillingRecordDto> pageBean = cylinderFillingRecordServiceImpl.queryListByQueryDto(page,
long totle = pageBean.getTotal(); cylinderFillingRecordDto, sortParam, sortRule);
result.setRecords(pageBean.getRecords()); Page<CylinderFillingRecordDto> result = new Page<>(pageNum, pageSize);
result.setTotal(totle); long totle = pageBean.getTotal();
return ResponseHelper.buildResponse(result); result.setRecords(pageBean.getRecords());
} result.setTotal(totle);
return ResponseHelper.buildResponse(result);
}
/**
* 气瓶基本信息 /**
* * 气瓶基本信息
* @param pageNum 当前页 *
* @param pageSize 每页大小 * @param pageNum 当前页
* @return * @param pageSize 每页大小
*/ * @return
@TycloudOperation(ApiLevel = UserType.AGENCY) */
@GetMapping(value = "/cyinderInfoList") @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶基本信息", notes = "获取登陆人所在气瓶基本信息") @GetMapping(value = "/cyinderInfoList")
public ResponseModel<IPage<CylinderInfoDto>> cyinderInfoList(@RequestParam(value = "pageNum") String pageNum, @RequestParam(value = "pageSize") String pageSize, String sort, CylinderInfoDto cylinderInfoDto) { @ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶基本信息", notes = "获取登陆人所在气瓶基本信息")
QueryWrapper<CylinderInfo> cylinderInfoQueryWrapper = new QueryWrapper<>(); public ResponseModel<IPage<CylinderInfoDto>> cyinderInfoList(@RequestParam(value = "pageNum") String pageNum,
if (StringUtils.isNotEmpty(cylinderInfoDto.getRegionCode())) { @RequestParam(value = "pageSize") String pageSize, String sort, CylinderInfoDto cylinderInfoDto) {
List<String> appids = new ArrayList<>(); QueryWrapper<CylinderInfo> cylinderInfoQueryWrapper = new QueryWrapper<>();
List<CylinderUnit> unitList = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>().like(CylinderUnit::getRegionCode, cylinderInfoDto.getRegionCode())); if (StringUtils.isNotEmpty(cylinderInfoDto.getRegionCode())) {
unitList.forEach(u -> { List<String> appids = new ArrayList<>();
appids.add(u.getAppId()); List<CylinderUnit> unitList = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
}); .like(CylinderUnit::getRegionCode, cylinderInfoDto.getRegionCode()));
if (appids.size() == 0) { unitList.forEach(u -> {
appids.add("-1"); appids.add(u.getAppId());
} });
cylinderInfoDto.setAppIds(appids); if (appids.size() == 0) {
} appids.add("-1");
setQueryWrapper(cylinderInfoQueryWrapper, cylinderInfoDto, sort); }
Page<CylinderInfo> pageBean; cylinderInfoDto.setAppIds(appids);
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { }
pageBean = new Page<>(0, Long.MAX_VALUE); setQueryWrapper(cylinderInfoQueryWrapper, cylinderInfoDto, sort);
} else { Page<CylinderInfo> pageBean;
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
} pageBean = new Page<>(0, Long.MAX_VALUE);
IPage<CylinderInfo> page = cylinderInfoServiceImpl.page(pageBean, cylinderInfoQueryWrapper); } else {
int num = cylinderInfoServiceImpl.count(cylinderInfoQueryWrapper); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
pageBean.setTotal(num); }
IPage<CylinderInfoDto> result = BeanDtoVoUtils.cyinderInfoIPageDto(page); IPage<CylinderInfo> page;
return ResponseHelper.buildResponse(result); if (cylinderInfoDto.getIsWarn() == 0) {
} page = cylinderInfoServiceImpl.page(pageBean, cylinderInfoQueryWrapper);
} else {
private QueryWrapper<CylinderInfo> setQueryWrapper(QueryWrapper<CylinderInfo> queryWrapper, CylinderInfoDto cylinderInfo, String sort) { page = cylinderInspectionServiceImpl.queryOutOfDateCylinder(pageBean, cylinderInfoDto.getAppId());
if (cylinderInfo.getAppIds() != null && cylinderInfo.getAppIds().size() > 0) { }
queryWrapper.in("app_id", cylinderInfo.getAppIds()); // int num = cylinderInfoServiceImpl.count(cylinderInfoQueryWrapper);
} // pageBean.setTotal(num);
if (sort != null) { // 排序失效
String[] date = sort.split(","); IPage<CylinderInfoDto> result = BeanDtoVoUtils.cyinderInfoIPageDto(page);
if ("ascend".equals(date[1])) { result.getRecords().forEach(i -> {
queryWrapper.orderByAsc(RedisKey.humpToLine(date[0])); DataDictionary fillingMedia = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
} else { .eq(DataDictionary::getCode, i.getFillingMedia()).eq(DataDictionary::getType, "CZJZMC"));
queryWrapper.orderByDesc(RedisKey.humpToLine(date[0])); i.setFillingMediaName(fillingMedia != null ? fillingMedia.getName() : null);
} DataDictionary cylinderVariety = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
} else { .eq(DataDictionary::getSequenceNbr, i.getCylinderVariety()));
queryWrapper.orderByDesc("sync_date"); i.setCylinderVarietyName(cylinderVariety != null ? cylinderVariety.getName() : null);
} DataDictionary cylinderStatus = iDataDictionaryService.getOne(
if (!ValidationUtil.isEmpty(cylinderInfo.getAppId())) { new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getSequenceNbr, i.getCylinderStatus()));
queryWrapper.eq("app_id", cylinderInfo.getAppId()); i.setCylinderStatusStr(cylinderStatus != null ? cylinderStatus.getName() : null);
} CylinderTags cylinderTags = cylinderTagsServiceImpl.getOne(
new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getSequenceCode, i.getSequenceCode()));
i.setQrCode(cylinderTags != null ? cylinderTags.getQrCode() : null);
i.setElectronicLabelCode(cylinderTags != null ? cylinderTags.getElectronicLabelCode() : null);
});
return ResponseHelper.buildResponse(result);
}
private QueryWrapper<CylinderInfo> setQueryWrapper(QueryWrapper<CylinderInfo> queryWrapper,
CylinderInfoDto cylinderInfo, String sort) {
if (cylinderInfo.getAppIds() != null && cylinderInfo.getAppIds().size() > 0) {
queryWrapper.in("app_id", cylinderInfo.getAppIds());
}
if (sort != null) { // 排序失效
String[] date = sort.split(",");
if ("ascend".equals(date[1])) {
queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
} else {
queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
}
} else {
queryWrapper.orderByDesc("sync_date");
}
if (!ValidationUtil.isEmpty(cylinderInfo.getAppId())) {
queryWrapper.eq("app_id", cylinderInfo.getAppId());
}
// if (!ValidationUtil.isEmpty(cylinderInfo.getInspectionDateStart())) { // if (!ValidationUtil.isEmpty(cylinderInfo.getInspectionDateStart())) {
// queryWrapper.ge("inspection_date", cylinderInfo.getInspectionDateStart()); // queryWrapper.ge("inspection_date", cylinderInfo.getInspectionDateStart());
// } // }
// if (!ValidationUtil.isEmpty(cylinderInfo.getInspectionDateEnd())) { // if (!ValidationUtil.isEmpty(cylinderInfo.getInspectionDateEnd())) {
// queryWrapper.le("inspection_date", cylinderInfo.getInspectionDateEnd()); // queryWrapper.le("inspection_date", cylinderInfo.getInspectionDateEnd());
// } // }
if (!ValidationUtil.isEmpty(cylinderInfo.getUnitName())) { // 产权单位 if (!ValidationUtil.isEmpty(cylinderInfo.getUnitName())) { // 产权单位
queryWrapper.like("unit_name", cylinderInfo.getUnitName()); queryWrapper.like("unit_name", cylinderInfo.getUnitName());
} }
if (!ValidationUtil.isEmpty(cylinderInfo.getFactoryNum())) {// 出厂编号 if (!ValidationUtil.isEmpty(cylinderInfo.getFactoryNum())) {// 出厂编号
queryWrapper.like("factory_num", cylinderInfo.getFactoryNum()); queryWrapper.like("factory_num", cylinderInfo.getFactoryNum());
} }
if (!ValidationUtil.isEmpty(cylinderInfo.getCylinderVariety())) {// 气瓶品种 if (!ValidationUtil.isEmpty(cylinderInfo.getCylinderVariety())) {// 气瓶品种
queryWrapper.eq("cylinder_variety", cylinderInfo.getCylinderVariety()); queryWrapper.eq("cylinder_variety", cylinderInfo.getCylinderVariety());
} }
// if (!ValidationUtil.isEmpty(cylinderInfo.getQrCode())) {// 二维码编号 // if (!ValidationUtil.isEmpty(cylinderInfo.getQrCode())) {// 二维码编号
// queryWrapper.like("qrCode", cylinderInfo.getQrCode()); // queryWrapper.like("qrCode", cylinderInfo.getQrCode());
// } // }
// if (!ValidationUtil.isEmpty(cylinderInfo.getElectronicLabelCode())) {// 电子标签编号 // if (!ValidationUtil.isEmpty(cylinderInfo.getElectronicLabelCode())) {// 电子标签编号
// queryWrapper.like("electronic_label_code", cylinderInfo.getElectronicLabelCode()); // queryWrapper.like("electronic_label_code", cylinderInfo.getElectronicLabelCode());
// } // }
if (!ValidationUtil.isEmpty(cylinderInfo.getSequenceCode())) {// 气瓶唯一标识码 if (!ValidationUtil.isEmpty(cylinderInfo.getSequenceCode())) {// 气瓶唯一标识码
queryWrapper.like("sequence_code", cylinderInfo.getSequenceCode()); queryWrapper.like("sequence_code", cylinderInfo.getSequenceCode());
} }
if (!ValidationUtil.isEmpty(cylinderInfo.getUnitInnerCode())) {// 单位内部编号 if (!ValidationUtil.isEmpty(cylinderInfo.getUnitInnerCode())) {// 单位内部编号
queryWrapper.like("unit_inner_code", cylinderInfo.getUnitInnerCode()); queryWrapper.like("unit_inner_code", cylinderInfo.getUnitInnerCode());
} }
if (!ValidationUtil.isEmpty(cylinderInfo.getCylinderStatus())) {// 气瓶状态 if (!ValidationUtil.isEmpty(cylinderInfo.getCylinderStatus())) {// 气瓶状态
queryWrapper.eq("cylinder_status", cylinderInfo.getCylinderStatus()); queryWrapper.eq("cylinder_status", cylinderInfo.getCylinderStatus());
} }
if (!ValidationUtil.isEmpty(cylinderInfo.getManufacturingUnit())) {// 制造单位 if (!ValidationUtil.isEmpty(cylinderInfo.getManufacturingUnit())) {// 制造单位
queryWrapper.like("manufacturing_unit", cylinderInfo.getManufacturingUnit()); queryWrapper.like("manufacturing_unit", cylinderInfo.getManufacturingUnit());
} }
return queryWrapper; return queryWrapper;
} }
/**
/** * 获取气瓶详细信息
* 获取气瓶详细信息 *
* * @param sequenceNbr
* @param sequenceNbr * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @GetMapping(value = "/cyinderInfo/{sequenceNbr}")
@GetMapping(value = "/cyinderInfo/{sequenceNbr}") @ApiOperation(httpMethod = "GET", value = "获取气瓶详细信息", notes = "获取气瓶详细信息")
@ApiOperation(httpMethod = "GET", value = "获取气瓶详细信息", notes = "获取气瓶详细信息") public ResponseModel<CylinderInfoDto> cyinderInfoList(@PathVariable Long sequenceNbr) {
public ResponseModel<CylinderInfoDto> cyinderInfoList(@PathVariable Long sequenceNbr) { CylinderInfo cylinderInfo = cylinderInfoServiceImpl.getById(sequenceNbr);
CylinderInfo cylinderInfo = cylinderInfoServiceImpl.getById(sequenceNbr); Map<String, List<AttachmentDto>> imgMap = sourceFileService.getAttachments(cylinderInfo.getSequenceNbr());
Map<String, List<AttachmentDto>> imgMap = sourceFileService.getAttachments(cylinderInfo.getSequenceNbr());
CylinderInfoDto target = new CylinderInfoDto();
CylinderInfoDto target = new CylinderInfoDto(); // 把原对象数据拷贝到新对象
// 把原对象数据拷贝到新对象 BeanUtils.copyProperties(cylinderInfo, target);
BeanUtils.copyProperties(cylinderInfo, target);
// if (0 == cylinderInfo.getCylinderStatus()) { // if (0 == cylinderInfo.getCylinderStatus()) {
// target.setCylinderStatusStr("在用"); // target.setCylinderStatusStr("在用");
// } else if (1 == cylinderInfo.getCylinderStatus()) { // } else if (1 == cylinderInfo.getCylinderStatus()) {
...@@ -599,67 +639,66 @@ public class CylinderInfoController extends BaseController { ...@@ -599,67 +639,66 @@ public class CylinderInfoController extends BaseController {
// } // }
// target.setAttachments(imgMap); // target.setAttachments(imgMap);
return ResponseHelper.buildResponse(target); return ResponseHelper.buildResponse(target);
} }
/**
/** * 获取登陆人所在气瓶充装单位信息
* 获取登陆人所在气瓶充装单位信息 *
* * @param pageNum 当前页
* @param pageNum 当前页 * @param pageSize 每页大小
* @param pageSize 每页大小 * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @GetMapping(value = "/cyinderUnitList")
@GetMapping(value = "/cyinderUnitList") @ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶充装单位信息", notes = "获取登陆人所在气瓶充装单位信息")
@ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶充装单位信息", notes = "获取登陆人所在气瓶充装单位信息") public ResponseModel<IPage<CylinderUnitDto>> cyinderUnitList(@RequestParam(value = "pageNum") String pageNum,
public ResponseModel<IPage<CylinderUnitDto>> cyinderUnitList(@RequestParam(value = "pageNum") String pageNum, @RequestParam(value = "pageSize") String pageSize, String sort, CylinderUnitDto cylinderUnitDto) { @RequestParam(value = "pageSize") String pageSize, String sort, CylinderUnitDto cylinderUnitDto) {
Page<CylinderUnit> pageBean; Page<CylinderUnit> pageBean;
IPage<CylinderUnit> page; IPage<CylinderUnit> page;
QueryWrapper<CylinderUnit> cylinderUnitQueryWrapper = new QueryWrapper<>(); QueryWrapper<CylinderUnit> cylinderUnitQueryWrapper = new QueryWrapper<>();
setQueryWrapper(cylinderUnitQueryWrapper, cylinderUnitDto, sort); setQueryWrapper(cylinderUnitQueryWrapper, cylinderUnitDto, sort);
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE); pageBean = new Page<>(0, Long.MAX_VALUE);
} else { } else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
page = cylinderUnitServiceImpl.page(pageBean, cylinderUnitQueryWrapper); page = cylinderUnitServiceImpl.page(pageBean, cylinderUnitQueryWrapper);
int num = cylinderUnitServiceImpl.count(cylinderUnitQueryWrapper); int num = cylinderUnitServiceImpl.count(cylinderUnitQueryWrapper);
pageBean.setTotal(num); pageBean.setTotal(num);
IPage<CylinderUnitDto> result = this.cyinderInfoIPageDto(page); IPage<CylinderUnitDto> result = this.cyinderInfoIPageDto(page);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/**
/** * 获取气瓶充装单位详情
* 获取气瓶充装单位详情 *
* * @param sequenceNbr
* @param sequenceNbr * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @GetMapping(value = "/cylinderUnit/{sequenceNbr}")
@GetMapping(value = "/cylinderUnit/{sequenceNbr}") @ApiOperation(httpMethod = "GET", value = "获取气瓶充装单位详情", notes = "获取气瓶充装单位详情")
@ApiOperation(httpMethod = "GET", value = "获取气瓶充装单位详情", notes = "获取气瓶充装单位详情") public ResponseModel<CylinderUnitDto> cyinderUnitList(@PathVariable Long sequenceNbr) {
public ResponseModel<CylinderUnitDto> cyinderUnitList(@PathVariable Long sequenceNbr) { CylinderUnit cylinderUnit = cylinderUnitServiceImpl.getById(sequenceNbr);
CylinderUnit cylinderUnit = cylinderUnitServiceImpl.getById(sequenceNbr); if (this.regionMap == null) {
if (this.regionMap == null) { this.regionMap = new HashMap<>();
this.regionMap = new HashMap<>(); Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult();
Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult(); regions.stream().forEach(t -> {
regions.stream().forEach(t -> { this.addRegionsMap(regionMap, t);
this.addRegionsMap(regionMap, t); });
}); }
} CylinderUnitDto target = new CylinderUnitDto();
CylinderUnitDto target = new CylinderUnitDto(); // 把原对象数据拷贝到新对象
// 把原对象数据拷贝到新对象 BeanUtils.copyProperties(cylinderUnit, target);
BeanUtils.copyProperties(cylinderUnit, target); String regionCode = cylinderUnit.getRegionCode();
String regionCode = cylinderUnit.getRegionCode(); String[] regionCodes = regionCode.split("#");
String[] regionCodes = regionCode.split("#"); regionCode = "";
regionCode = ""; for (int i = 0; i < regionCodes.length; i++) {
for (int i = 0; i < regionCodes.length; i++) { regionCode += this.regionMap.get(Integer.parseInt(regionCodes[i]));
regionCode += this.regionMap.get(Integer.parseInt(regionCodes[i])); }
} target.setRegionCode(regionCode);
target.setRegionCode(regionCode);
// if (1 == cylinderUnit.getUnitType()) { // if (1 == cylinderUnit.getUnitType()) {
// target.setUnitTypeStr("液化石油气瓶充装单位"); // target.setUnitTypeStr("液化石油气瓶充装单位");
// } else if (2 == cylinderUnit.getUnitType()) { // } else if (2 == cylinderUnit.getUnitType()) {
...@@ -670,7 +709,11 @@ public class CylinderInfoController extends BaseController { ...@@ -670,7 +709,11 @@ public class CylinderInfoController extends BaseController {
// target.setUnitTypeStr(""); // target.setUnitTypeStr("");
// } // }
// target.setCylinderNumber((long) cylinderInfoServiceImpl.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, target.getAppId()))); // target.setCylinderNumber((long) cylinderInfoServiceImpl.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, target.getAppId())));
// target.setCylinderOutOfDate((long) cylinderInfoServiceImpl.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, target.getAppId()).le(CylinderInfo::getNextInspectionDate, new Date()))); Page<CylinderInfo> pageBean = new Page<>(0, Long.MAX_VALUE);
Page<CylinderInfo> page = cylinderInspectionServiceImpl.queryOutOfDateCylinder(pageBean,
cylinderUnit.getAppId());
long outOfDate = page.getTotal();
target.setCylinderOutOfDate(String.valueOf(outOfDate));
// Date nextDate = target.getFillingPermitDate(); // Date nextDate = target.getFillingPermitDate();
// long dates = nextDate.getTime() - System.currentTimeMillis(); // long dates = nextDate.getTime() - System.currentTimeMillis();
// if (dates >= 1000 * 60 * 60 * 24 * 200) { // if (dates >= 1000 * 60 * 60 * 24 * 200) {
...@@ -681,21 +724,21 @@ public class CylinderInfoController extends BaseController { ...@@ -681,21 +724,21 @@ public class CylinderInfoController extends BaseController {
// target.setLicenseStatus(0); // target.setLicenseStatus(0);
// } // }
return ResponseHelper.buildResponse(target); return ResponseHelper.buildResponse(target);
} }
private QueryWrapper<CylinderUnit> setQueryWrapper(QueryWrapper<CylinderUnit> queryWrapper,
private QueryWrapper<CylinderUnit> setQueryWrapper(QueryWrapper<CylinderUnit> queryWrapper, CylinderUnitDto cylinderUnitDto, String sort) { CylinderUnitDto cylinderUnitDto, String sort) {
if (sort != null) { // 排序失效 if (sort != null) { // 排序失效
String[] date = sort.split(","); String[] date = sort.split(",");
if (date[1].equals("ascend")) { if (date[1].equals("ascend")) {
queryWrapper.orderByAsc(RedisKey.humpToLine(date[0])); queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
} else { } else {
queryWrapper.orderByDesc(RedisKey.humpToLine(date[0])); queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
} }
} else { } else {
queryWrapper.orderByDesc("sync_date"); queryWrapper.orderByDesc("sync_date");
} }
// if (!ValidationUtil.isEmpty(cylinderUnitDto.getFillingPermitDateStart())) { // 许可有效期 // if (!ValidationUtil.isEmpty(cylinderUnitDto.getFillingPermitDateStart())) { // 许可有效期
// queryWrapper.ge("filling_permit_date", cylinderUnitDto.getFillingPermitDateStart()); // queryWrapper.ge("filling_permit_date", cylinderUnitDto.getFillingPermitDateStart());
...@@ -705,61 +748,60 @@ public class CylinderInfoController extends BaseController { ...@@ -705,61 +748,60 @@ public class CylinderInfoController extends BaseController {
// queryWrapper.le("filling_permit_date", cylinderUnitDto.getFillingPermitDateEnd()); // queryWrapper.le("filling_permit_date", cylinderUnitDto.getFillingPermitDateEnd());
// } // }
if (!ValidationUtil.isEmpty(cylinderUnitDto.getUnitName())) { // 企业名称 if (!ValidationUtil.isEmpty(cylinderUnitDto.getUnitName())) { // 企业名称
queryWrapper.like("unit_name", cylinderUnitDto.getUnitName()); queryWrapper.like("unit_name", cylinderUnitDto.getUnitName());
} }
// if (!ValidationUtil.isEmpty(cylinderUnitDto.getUnitType())) {// 企业类型 // if (!ValidationUtil.isEmpty(cylinderUnitDto.getUnitType())) {// 企业类型
// queryWrapper.eq("unit_type", cylinderUnitDto.getUnitType()); // queryWrapper.eq("unit_type", cylinderUnitDto.getUnitType());
// } // }
if (!ValidationUtil.isEmpty(cylinderUnitDto.getCreditCode())) {// 统一社会信用代码 if (!ValidationUtil.isEmpty(cylinderUnitDto.getCreditCode())) {// 统一社会信用代码
queryWrapper.like("credit_code", cylinderUnitDto.getCreditCode()); queryWrapper.like("credit_code", cylinderUnitDto.getCreditCode());
} }
if (!ValidationUtil.isEmpty(cylinderUnitDto.getAddress())) {// 详细地址 if (!ValidationUtil.isEmpty(cylinderUnitDto.getAddress())) {// 详细地址
queryWrapper.like("address", cylinderUnitDto.getAddress()); queryWrapper.like("address", cylinderUnitDto.getAddress());
} }
if (!ValidationUtil.isEmpty(cylinderUnitDto.getUnitPerson())) {// 企业负责人 if (!ValidationUtil.isEmpty(cylinderUnitDto.getUnitPerson())) {// 企业负责人
queryWrapper.like("unit_person", cylinderUnitDto.getUnitPerson()); queryWrapper.like("unit_person", cylinderUnitDto.getUnitPerson());
} }
if (!ValidationUtil.isEmpty(cylinderUnitDto.getPersonMobilePhone())) {// 负责人手机 if (!ValidationUtil.isEmpty(cylinderUnitDto.getPersonMobilePhone())) {// 负责人手机
queryWrapper.like("person_mobile_phone", cylinderUnitDto.getPersonMobilePhone()); queryWrapper.like("person_mobile_phone", cylinderUnitDto.getPersonMobilePhone());
} }
// if (!ValidationUtil.isEmpty(cylinderUnitDto.getFillingLicense())) {// 许可证号 // if (!ValidationUtil.isEmpty(cylinderUnitDto.getFillingLicense())) {// 许可证号
// queryWrapper.like("filling_license", cylinderUnitDto.getFillingLicense()); // queryWrapper.like("filling_license", cylinderUnitDto.getFillingLicense());
// } // }
// if (!ValidationUtil.isEmpty(cylinderUnitDto.getFillingPermScope())) {// 许可范围 // if (!ValidationUtil.isEmpty(cylinderUnitDto.getFillingPermScope())) {// 许可范围
// queryWrapper.like("filling_perm_scope", cylinderUnitDto.getFillingPermScope()); // queryWrapper.like("filling_perm_scope", cylinderUnitDto.getFillingPermScope());
// } // }
if (!ValidationUtil.isEmpty(cylinderUnitDto.getRegionCode())) {// 所属区域 if (!ValidationUtil.isEmpty(cylinderUnitDto.getRegionCode())) {// 所属区域
queryWrapper.like("region_code", cylinderUnitDto.getRegionCode()); queryWrapper.like("region_code", cylinderUnitDto.getRegionCode());
} }
return queryWrapper; return queryWrapper;
} }
private IPage<CylinderUnitDto> cyinderInfoIPageDto(IPage<CylinderUnit> page) { private IPage<CylinderUnitDto> cyinderInfoIPageDto(IPage<CylinderUnit> page) {
if (this.regionMap == null) { if (this.regionMap == null) {
this.regionMap = new HashMap<>(); this.regionMap = new HashMap<>();
Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult(); Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult();
regions.stream().forEach(t -> { regions.stream().forEach(t -> {
this.addRegionsMap(regionMap, t); this.addRegionsMap(regionMap, t);
}); });
} }
return page.convert(item -> {
return page.convert(item -> { try {
try { CylinderUnitDto target = new CylinderUnitDto();
CylinderUnitDto target = new CylinderUnitDto(); // 把原对象数据拷贝到新对象
// 把原对象数据拷贝到新对象 BeanUtils.copyProperties(item, target);
BeanUtils.copyProperties(item, target); String regionCode = item.getRegionCode();
String regionCode = item.getRegionCode(); String[] regionCodes = regionCode.split("#");
String[] regionCodes = regionCode.split("#"); regionCode = "";
regionCode = ""; for (int i = 0; i < regionCodes.length; i++) {
for (int i = 0; i < regionCodes.length; i++) { regionCode += this.regionMap.get(Integer.parseInt(regionCodes[i]));
regionCode += this.regionMap.get(Integer.parseInt(regionCodes[i])); }
} target.setRegionCode(regionCode);
target.setRegionCode(regionCode);
// if (1 == item.getUnitType()) { // if (1 == item.getUnitType()) {
// target.setUnitTypeStr("液化石油气瓶充装单位"); // target.setUnitTypeStr("液化石油气瓶充装单位");
// } else if (2 == item.getUnitType()) { // } else if (2 == item.getUnitType()) {
...@@ -769,183 +811,209 @@ public class CylinderInfoController extends BaseController { ...@@ -769,183 +811,209 @@ public class CylinderInfoController extends BaseController {
// } else { // } else {
// target.setUnitTypeStr(""); // target.setUnitTypeStr("");
// } // }
target.setCylinderNumber( cylinderInfoServiceImpl.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, target.getAppId()))); target.setCylinderNumber(cylinderInfoServiceImpl
return target; .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, target.getAppId())));
} catch (Exception e) { return target;
return null; } catch (Exception e) {
} return null;
}); }
} });
}
private void addRegionsMap(Map<Integer, String> regionMap, RegionModel region) {
regionMap.put(region.getRegionCode(), region.getRegionName()); private void addRegionsMap(Map<Integer, String> regionMap, RegionModel region) {
if (region.getChildren() != null) { regionMap.put(region.getRegionCode(), region.getRegionName());
region.getChildren().stream().forEach(c -> { if (region.getChildren() != null) {
addRegionsMap(regionMap, c); region.getChildren().stream().forEach(c -> {
}); addRegionsMap(regionMap, c);
} });
} }
}
/** /**
* 企业气瓶总量数据同步 * 企业气瓶总量数据同步
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitCylinderInfoData") @GetMapping(value = "/synUnitCylinderInfoData")
@ApiOperation(httpMethod = "GET", value = "企业气瓶总量数据同步", notes = "企业气瓶总量数据同步") @ApiOperation(httpMethod = "GET", value = "企业气瓶总量数据同步", notes = "企业气瓶总量数据同步")
public ResponseModel<Boolean> synUnitCylinderInfoData() { public ResponseModel<Boolean> synUnitCylinderInfoData() {
cylinderInfoServiceImpl.synUnitCylinderInfoData(); cylinderInfoServiceImpl.synUnitCylinderInfoData();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/** /**
* 企业气瓶充装数据同步 * 企业气瓶充装数据同步
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitCylinderFillingData") @GetMapping(value = "/synUnitCylinderFillingData")
@ApiOperation(httpMethod = "GET", value = "企业气瓶充装数据同步", notes = "企业气瓶充装数据同步") @ApiOperation(httpMethod = "GET", value = "企业气瓶充装数据同步", notes = "企业气瓶充装数据同步")
public ResponseModel<Boolean> synUnitCylinderFillingData() { public ResponseModel<Boolean> synUnitCylinderFillingData() {
cylinderInfoServiceImpl.synUnitCylinderFillingData(); cylinderInfoServiceImpl.synUnitCylinderFillingData();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/** /**
* 企业气瓶标签数量比同步 * 企业气瓶标签数量比同步
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitCylinderTagsData") @GetMapping(value = "/synUnitCylinderTagsData")
@ApiOperation(httpMethod = "GET", value = "企业气瓶标签数量比同步", notes = "企业气瓶标签数量比同步") @ApiOperation(httpMethod = "GET", value = "企业气瓶标签数量比同步", notes = "企业气瓶标签数量比同步")
public ResponseModel<Boolean> synUnitCylinderTagsData() { public ResponseModel<Boolean> synUnitCylinderTagsData() {
cylinderInfoServiceImpl.synUnitCylinderTagsData(); cylinderInfoServiceImpl.synUnitCylinderTagsData();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/** /**
* 企业数据完整度同步 * 企业数据完整度同步
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitIntegrityData") @GetMapping(value = "/synUnitIntegrityData")
@ApiOperation(httpMethod = "GET", value = "企业数据完整度同步", notes = "企业数据完整度同步") @ApiOperation(httpMethod = "GET", value = "企业数据完整度同步", notes = "企业数据完整度同步")
public ResponseModel<Boolean> synUnitIntegrityData() { public ResponseModel<Boolean> synUnitIntegrityData() {
cylinderInfoServiceImpl.synUnitIntegrityData(); cylinderInfoServiceImpl.synUnitIntegrityData();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/** /**
* 气瓶充装检查情况同步 * 气瓶充装检查情况同步
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitFillingCheckData") @GetMapping(value = "/synUnitFillingCheckData")
@ApiOperation(httpMethod = "GET", value = "气瓶充装检查情况同步", notes = "气瓶充装检查情况同步") @ApiOperation(httpMethod = "GET", value = "气瓶充装检查情况同步", notes = "气瓶充装检查情况同步")
public ResponseModel<Boolean> synUnitFillingCheckData() { public ResponseModel<Boolean> synUnitFillingCheckData() {
cylinderInfoServiceImpl.synUnitFillingCheckData(); cylinderInfoServiceImpl.synUnitFillingCheckData();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
/** /**
* 装卸液体企业数据同步 * 装卸液体企业数据同步
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synFillingUnloadUnitData") @GetMapping(value = "/synFillingUnloadUnitData")
@ApiOperation(httpMethod = "GET", value = "装卸液体企业数据同步", notes = "装卸液体企业数据同步") @ApiOperation(httpMethod = "GET", value = "装卸液体企业数据同步", notes = "装卸液体企业数据同步")
public ResponseModel<Boolean> synFillingUnloadUnitData() { public ResponseModel<Boolean> synFillingUnloadUnitData() {
cylinderInfoServiceImpl.synFillingUnloadUnitData(); cylinderInfoServiceImpl.synFillingUnloadUnitData();
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "气瓶超期数量统计") @ApiOperation(httpMethod = "GET", value = "气瓶超期数量统计")
@GetMapping(value = "/{earlyWarningLevel}/statistics") @GetMapping(value = "/{earlyWarningLevel}/statistics")
public ResponseModel<Integer> getOverDateStatisticsNumber(@PathVariable String earlyWarningLevel){ public ResponseModel<Integer> getOverDateStatisticsNumber(@PathVariable String earlyWarningLevel) {
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.getOverDateStatisticsNumber(earlyWarningLevel)); return ResponseHelper.buildResponse(cylinderInfoServiceImpl.getOverDateStatisticsNumber(earlyWarningLevel));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "按照预警类型查询气瓶分页列表",notes = "按照预警类型查询气瓶分页列表") @ApiOperation(httpMethod = "GET", value = "按照预警类型查询气瓶分页列表", notes = "按照预警类型查询气瓶分页列表")
@GetMapping(value = "/{earlyWarningLevel}/page") @GetMapping(value = "/{earlyWarningLevel}/page")
public ResponseModel<Page<CylinderInfoDto>> getOverDateStatisticsNumber( public ResponseModel<Page<CylinderInfoDto>> getOverDateStatisticsNumber(
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current, @RequestParam(value = "size") int size,
@RequestParam(value = "size") int size, @PathVariable String earlyWarningLevel) {
@PathVariable String earlyWarningLevel){ Page<CylinderInfoDto> page = new Page<>();
Page<CylinderInfoDto> page = new Page<>(); page.setCurrent(current);
page.setCurrent(current); page.setSize(size);
page.setSize(size); return ResponseHelper.buildResponse(cylinderInfoServiceImpl.earlyWarningLevelPageList(page, earlyWarningLevel));
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.earlyWarningLevelPageList(page,earlyWarningLevel)); }
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "气瓶详情")
@ApiOperation(httpMethod = "GET",value = "气瓶详情") @GetMapping(value = "/{sequenceCode}/detail")
@GetMapping(value = "/{sequenceCode}/detail") public ResponseModel<CylinderInfoDto> getDetail(@PathVariable String sequenceCode) {
public ResponseModel<CylinderInfoDto> getDetail(@PathVariable String sequenceCode){ return ResponseHelper.buildResponse(cylinderInfoServiceImpl.getDetail(sequenceCode));
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.getDetail(sequenceCode)); }
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "气瓶处置日志")
@ApiOperation(httpMethod = "GET",value = "气瓶处置日志") @GetMapping(value = "/msg/{sequenceCode}/list")
@GetMapping(value = "/msg/{sequenceCode}/list") public ResponseModel<List<MsgLog>> getMsgList(@PathVariable String sequenceCode,
public ResponseModel<List<MsgLog>> getMsgList(@PathVariable String sequenceCode, @RequestParam(value = "terminalType", required = false) String terminalType) {
@RequestParam(value = "terminalType",required = false) String terminalType){ return ResponseHelper.buildResponse(cylinderInfoServiceImpl.getMsgList(sequenceCode, terminalType));
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.getMsgList(sequenceCode, terminalType)); }
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "PUT", value = "下次检验日期更新", notes = "下次检验日期更新")
@ApiOperation(httpMethod = "PUT",value = "下次检验日期更新",notes = "下次检验日期更新") @PutMapping(value = "/nextInspectionDate/update")
@PutMapping(value = "/nextInspectionDate/update") public ResponseModel<Boolean> nextInspectionDateUpdate(@RequestBody List<CylinderInfoDto> cylinderInfoDtos) {
public ResponseModel<Boolean> nextInspectionDateUpdate(@RequestBody List<CylinderInfoDto> cylinderInfoDtos){ return ResponseHelper.buildResponse(cylinderInfoServiceImpl.nextInspectionDateUpdate(cylinderInfoDtos));
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.nextInspectionDateUpdate(cylinderInfoDtos)); }
}
/**
/** * 气瓶信息放入es
* 气瓶信息放入es *
* * @return
* @return */
*/ @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @RequestMapping(value = "/init", method = RequestMethod.PUT)
@RequestMapping(value = "/init", method = RequestMethod.PUT) @ApiOperation(httpMethod = "PUT", value = "气瓶信息放入es", notes = "气瓶信息放入es")
@ApiOperation(httpMethod = "PUT", value = "气瓶信息放入es", notes = "气瓶信息放入es") public void init(Integer num) {
public void init(Integer num) { IPage<CylinderInfo> cylinderInfoPage = new Page<>();
IPage<CylinderInfo> cylinderInfoPage = new Page<>(); Integer count = cylinderInfoServiceImpl.count();
Integer count = cylinderInfoServiceImpl.count(); Integer times = 0;
Integer times = 0; if (ValidationUtil.isEmpty(num) && count != 0) {
if (ValidationUtil.isEmpty(num) && count != 0) { times = count / 500;
times = count / 500; int last = count % 500;
int last = count % 500; if (last > 0) {
if (last > 0) { times++;
times++; }
} } else if (count != 0) {
} else if (count != 0) { times = num;
times = num; }
}
for (int i = 0; i < times; i++) {
for (int i = 0; i < times; i++) { cylinderInfoPage.setCurrent(i);
cylinderInfoPage.setCurrent(i); cylinderInfoPage.setSize(500);
cylinderInfoPage.setSize(500); cylinderInfoPage = cylinderInfoServiceImpl.page(cylinderInfoPage);
cylinderInfoPage = cylinderInfoServiceImpl.page(cylinderInfoPage); esCylinderService.saveEsCylinderToES(cylinderInfoPage.getRecords());
esCylinderService.saveEsCylinderToES(cylinderInfoPage.getRecords()); }
} }
}
@Autowired
private ScheduleService scheduleService;
@Autowired
private ScheduleService scheduleService; @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "气瓶/设备/许可预警测试接口(实际应为定时任务)")
@TycloudOperation(ApiLevel = UserType.AGENCY , needAuth = false) @GetMapping(value = "/test")
@ApiOperation(httpMethod = "GET",value = "气瓶/设备/许可预警测试接口(实际应为定时任务)") public void test() {
@GetMapping(value = "/test") scheduleService.calEarlyWarningLevel();
public void test(){ }
scheduleService.calEarlyWarningLevel();
} /**
* 企业数据完整度同步
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/addAll")
@ApiOperation(httpMethod = "GET", value = "企业数据完整度同步", notes = "企业数据完整度同步")
public ResponseModel<Boolean> addAll() {
new Thread(new Runnable() {
@Override
public void run() {
cylinderInfoServiceImpl.synFillingUnloadData();
cylinderInfoServiceImpl.synAreaData();
cylinderInfoServiceImpl.addIntegrityData();
cylinderInfoServiceImpl.getCylinderUnitInfo();
cylinderInfoServiceImpl.getCylinderInfo();
cylinderInfoServiceImpl.synUnitCylinderInfoData();
cylinderInfoServiceImpl.synUnitCylinderFillingData();
cylinderInfoServiceImpl.synUnitCylinderTagsData();
cylinderInfoServiceImpl.synUnitIntegrityData();
cylinderInfoServiceImpl.synUnitFillingCheckData();
cylinderInfoServiceImpl.synFillingUnloadUnitData();
}
}).start();
return ResponseHelper.buildResponse(true);
}
} }
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderUnitDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnit; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderInfoService; import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderInfoService;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderUnitService;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderUnitServiceImpl; import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderUnitServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -36,8 +37,8 @@ import java.util.Map; ...@@ -36,8 +37,8 @@ import java.util.Map;
@RequestMapping(value = "/cylinder-unit") @RequestMapping(value = "/cylinder-unit")
public class CylinderUnitController extends BaseController { public class CylinderUnitController extends BaseController {
@Autowired @Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl; CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired @Autowired
ICylinderInfoService iCylinderInfoService; ICylinderInfoService iCylinderInfoService;
...@@ -50,68 +51,72 @@ public class CylinderUnitController extends BaseController { ...@@ -50,68 +51,72 @@ public class CylinderUnitController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/queryCylinderUnitList", method = RequestMethod.GET) @RequestMapping(value = "/queryCylinderUnitList", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "通过regionCode查询气瓶企业", notes = "通过regionCode查询气瓶企业") @ApiOperation(httpMethod = "GET", value = "通过regionCode查询气瓶企业", notes = "通过regionCode查询气瓶企业")
public ResponseModel<List<CylinderUnitDto>> querySpecialEquipmentList(@RequestParam String regionCode){ public ResponseModel<List<CylinderUnitDto>> querySpecialEquipmentList(@RequestParam String regionCode) {
List<CylinderUnit> unitList = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>().like(CylinderUnit::getRegionCode,regionCode)); List<CylinderUnit> unitList = cylinderUnitServiceImpl
.list(new LambdaQueryWrapper<CylinderUnit>().like(CylinderUnit::getRegionCode, regionCode));
List<CylinderUnitDto> result = new ArrayList<>(); List<CylinderUnitDto> result = new ArrayList<>();
unitList.stream().forEach(t -> { unitList.stream().forEach(t -> {
CylinderUnitDto temp = new CylinderUnitDto(); CylinderUnitDto temp = new CylinderUnitDto();
BeanUtils.copyProperties(t,temp); BeanUtils.copyProperties(t, temp);
// if(t.getFillingPermitDate() != null && t.getFillingPermitDate().getTime() < System.currentTimeMillis()) { int num = cylinderUnitServiceImpl.getWarnNumByAppId(t.getAppId());
// temp.setOutOfDate(true); if (num > 0) {
// } else { temp.setOutOfDate(true);
// temp.setOutOfDate(false); } else {
// } temp.setOutOfDate(false);
}
result.add(temp); result.add(temp);
}); });
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param id 主键 * @param id 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUnitInfo") @GetMapping(value = "/getUnitInfo")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个气瓶企业信息", notes = "根据sequenceNbr查询单个气瓶企业信息") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个气瓶企业信息", notes = "根据sequenceNbr查询单个气瓶企业信息")
public ResponseModel<CylinderUnitDto> selectOne(@RequestParam Long id) { public ResponseModel<CylinderUnitDto> selectOne(@RequestParam Long id) {
CylinderUnitDto unit = cylinderUnitServiceImpl.queryBySeq(id); CylinderUnitDto unit = cylinderUnitServiceImpl.queryBySeq(id);
unit.setEvaluate("★★★★★"); unit.setEvaluate("★★★★★");
// 查询气瓶数量以及过期数量 // 查询气瓶数量以及过期数量
Map<String, String> cylinderInfo = iCylinderInfoService.queryNumAndOutOfDateNum(unit.getSequenceNbr()); Map<String, String> cylinderInfo = iCylinderInfoService.queryNumAndOutOfDateNum(unit.getSequenceNbr());
if(cylinderInfo != null) {
if(cylinderInfo.get("cylinderNum") != null) { int num = cylinderUnitServiceImpl.getWarnNumByAppId(unit.getAppId());
if (cylinderInfo != null) {
if (cylinderInfo.get("cylinderNum") != null) {
unit.setCylinderNumber(Integer.valueOf(String.valueOf(cylinderInfo.get("cylinderNum")))); unit.setCylinderNumber(Integer.valueOf(String.valueOf(cylinderInfo.get("cylinderNum"))));
} }
if(cylinderInfo.get("outOfDateNum") != null) { // if (cylinderInfo.get("outOfDateNum") != null) {
unit.setCylinderOutOfDate(String.valueOf(cylinderInfo.get("outOfDateNum"))); // unit.setCylinderOutOfDate(String.valueOf(cylinderInfo.get("outOfDateNum")));
} // }
if(cylinderInfo.get("fillingPermitDate") != null){ unit.setCylinderOutOfDate(String.valueOf(num));
if (cylinderInfo.get("fillingPermitDate") != null) {
unit.setFillingPermitDate(String.valueOf(cylinderInfo.get("fillingPermitDate"))); unit.setFillingPermitDate(String.valueOf(cylinderInfo.get("fillingPermitDate")));
} }
} }
return ResponseHelper.buildResponse(unit); return ResponseHelper.buildResponse(unit);
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "气瓶企业信息分页查询", notes = "气瓶企业信息分页查询") @ApiOperation(httpMethod = "GET", value = "气瓶企业信息分页查询", notes = "气瓶企业信息分页查询")
public ResponseModel<Page<CylinderUnitDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<CylinderUnitDto>> queryForPage(@RequestParam(value = "current") int current,
(value = "size") int size) { @RequestParam(value = "size") int size) {
Page<CylinderUnitDto> page = new Page<CylinderUnitDto>(); Page<CylinderUnitDto> page = new Page<CylinderUnitDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(cylinderUnitServiceImpl.queryForCylinderUnitPage(page)); return ResponseHelper.buildResponse(cylinderUnitServiceImpl.queryForCylinderUnitPage(page));
} }
} }
...@@ -75,688 +75,733 @@ import lombok.extern.slf4j.Slf4j; ...@@ -75,688 +75,733 @@ import lombok.extern.slf4j.Slf4j;
*/ */
@Service @Service
@Slf4j @Slf4j
public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper> implements ICylinderInfoService { public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, CylinderInfo, CylinderInfoMapper>
implements ICylinderInfoService {
@Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl;
@Autowired @Autowired
CylinderUnitServiceImpl cylinderUnitServiceImpl; CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl;
@Autowired @Autowired
CylinderUnitDataServiceImpl cylinderUnitDataServiceImpl; CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl;
@Autowired @Autowired
CylinderInfoDataServiceImpl cylinderInfoDataServiceImpl; CylinderTagsServiceImpl cylinderTagsServiceImpl;
@Autowired @Autowired
CylinderTagsServiceImpl cylinderTagsServiceImpl; CylinderFillingServiceImpl cylinderFillingServiceImpl;
@Autowired @Autowired
CylinderFillingServiceImpl cylinderFillingServiceImpl; CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataServiceImpl cylinderIntegrityDataServiceImpl; CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl;
@Autowired @Autowired
CylinderFillingRecordServiceImpl cylinderFillingRecordServiceImpl; CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl;
@Autowired @Autowired
CylinderFillingCheckServiceImpl cylinderFillingCheckServiceImpl; CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl;
@Autowired @Autowired
CylinderAreaDataServiceImpl cylinderAreaDataServiceImpl; CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl; CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl;
@Autowired @Autowired
CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl; CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl; CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl;
@Autowired @Autowired
CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl; CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl;
@Autowired @Autowired
CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl; CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl; CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl;
@Autowired @Autowired
CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl; MsgLogServiceImpl msgLogService;
@Autowired @Autowired
MsgLogServiceImpl msgLogService; private RuleTrigger ruleTrigger;
@Autowired @Autowired
private RuleTrigger ruleTrigger; TzsAuthServiceImpl tzsAuthService;
@Autowired @Autowired
TzsAuthServiceImpl tzsAuthService; private ScheduleMapper scheduleMapper;
@Autowired @Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}")
private ScheduleMapper scheduleMapper; private String packageId;
@Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}") @Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}")
private String packageId; private String cylPackageId;
@Value("${cylinder-early-warning-packageId:气瓶消息预警/cylwarningmsg}") @Autowired
private String cylPackageId; StartPlatformTokenService startPlatformTokenService;
@Autowired /**
StartPlatformTokenService startPlatformTokenService; * 分页查询
*/
/** public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) {
* 分页查询 return queryForPage(page, null, false);
*/ }
public Page<CylinderInfoDto> queryForCylinderInfoPage(Page<CylinderInfoDto> page) {
return queryForPage(page, null, false); /**
} * 列表查询 示例
*/
/** public List<CylinderInfoDto> queryForCylinderInfoList() {
* 列表查询 示例 return queryForList("", false);
*/ }
public List<CylinderInfoDto> queryForCylinderInfoList() {
return queryForList("", false); @Override
} public Map<String, String> queryNumAndOutOfDateNum(Long unitId) {
return baseMapper.queryNumAndOutOfDateNum(unitId);
@Override }
public Map<String, String> queryNumAndOutOfDateNum(Long unitId) {
return baseMapper.queryNumAndOutOfDateNum(unitId); /**
} * 获取上个月气瓶总量
*/
/** public Integer getMonthInfoTotal(String regionCode) {
* 获取上个月气瓶总量 return baseMapper.getMonthInfoTotal(regionCode);
*/ }
public Integer getLastMonthInfoTotal(String regionCode) {
return baseMapper.getLastMonthInfoTotal(regionCode); /**
} * 获取上个月气瓶总量
*/
/** public Integer getLastMonthInfoTotal(String regionCode) {
* 获取上上个月气瓶总量 return baseMapper.getLastMonthInfoTotal(regionCode);
*/ }
public Integer getMonthBeforeLastInfoTotal(String regionCode) {
return baseMapper.getMonthBeforeLastInfoTotal(regionCode); /**
} * 获取上上个月气瓶总量
*/
public Integer getInfoTotalByRegionCode(String regionCode) { public Integer getMonthBeforeLastInfoTotal(String regionCode) {
return baseMapper.getInfoTotalByRegionCode(regionCode); return baseMapper.getMonthBeforeLastInfoTotal(regionCode);
} }
public Double queryIntegirtyByAppId(String appId) { public Integer getInfoTotalByRegionCode(String regionCode) {
return this.baseMapper.queryIntegirtyByAppId(appId); return baseMapper.getInfoTotalByRegionCode(regionCode);
} }
public Integer getWarnNum(String code) { public Double queryIntegirtyByAppId(String appId) {
return baseMapper.getWarnNum(code); return this.baseMapper.queryIntegirtyByAppId(appId);
} }
/** public Integer getWarnNum(String code) {
* 按单位统计 return baseMapper.getWarnNum(code);
*/ }
@Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") /**
public void synFillingUnloadData() { * 按单位统计
cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>()); */
countByRegion(regionModel -> { @Transactional(rollbackFor = Exception.class)
Calendar now = Calendar.getInstance(); @Scheduled(cron = "0 0 2 * * ?")
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); public void synFillingUnloadData() {
for (int i = 0; i < 30; i++) { cylinderFillingUnloadDataServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadData>());
now.add(Calendar.DATE, -1); countByRegion(regionModel -> {
CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto(); Calendar now = Calendar.getInstance();
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Double unloadSum = 0d; for (int i = 0; i < 30; i++) {
temp.setFillingSum(fillingSum); now.add(Calendar.DATE, -1);
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); CylinderFillingUnloadDataDto temp = new CylinderFillingUnloadDataDto();
temp.setStatisDate(now.getTime()); Double fillingSum = cylinderFillingRecordServiceImpl
temp.setStatisDateStr(sdf.format(now.getTime())); .getFillingSum(String.valueOf(regionModel.getRegionCode()), now.getTime());
temp.setUnloadSum(unloadSum); Double unloadSum = 0d;
cylinderFillingUnloadDataServiceImpl.createWithModel(temp); temp.setFillingSum(fillingSum);
} temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
}); temp.setStatisDate(now.getTime());
} temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum);
/** cylinderFillingUnloadDataServiceImpl.createWithModel(temp);
* 按区域统计 }
*/ });
@Transactional(rollbackFor = Exception.class) }
@Scheduled(cron = "0 0 2 * * ?")
public void synAreaData() { /**
cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>()); * 按区域统计
countByRegion(regionModel -> { */
CylinderAreaDataDto temp = new CylinderAreaDataDto(); @Transactional(rollbackFor = Exception.class)
temp.setAreaName(regionModel.getRegionName()); @Scheduled(cron = "0 0 2 * * ?")
String code = regionModel.getRegionCode() + ""; public void synAreaData() {
Integer cylinderTotal = this.getInfoTotalByRegionCode(code); cylinderAreaDataServiceImpl.remove(new LambdaQueryWrapper<CylinderAreaData>());
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code); countByRegion(regionModel -> {
Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code); CylinderAreaDataDto temp = new CylinderAreaDataDto();
Integer cylinderInfoWarn = this.getWarnNum(code); temp.setAreaName(regionModel.getRegionName());
int warmTotal = cylinderUnitWarn + cylinderInfoWarn; String code = regionModel.getRegionCode() + "";
String parentCode = ""; Integer cylinderTotal = this.getInfoTotalByRegionCode(code);
if ("610000".equals(code)) { Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(code);
parentCode = "-1"; Integer cylinderUnitWarn = cylinderUnitServiceImpl.getWarnNum(code);
} else if (!"00".equals(code.substring(4, 6))) { Integer cylinderInfoWarn = this.getWarnNum(code);
parentCode = code.substring(0, 4) + "00"; int warmTotal = cylinderUnitWarn + cylinderInfoWarn;
} else { String parentCode = "";
parentCode = "610000"; if ("610000".equals(code)) {
} parentCode = "-1";
temp.setCylinderNum(Long.valueOf(cylinderTotal)); } else if (!"00".equals(code.substring(4, 6))) {
temp.setParentRegionCode(parentCode); parentCode = code.substring(0, 4) + "00";
temp.setRegionCode(regionModel.getRegionCode() + ""); } else {
temp.setUnitNum(Long.valueOf(cylinderUnitTotal)); parentCode = "610000";
temp.setWarnNum((long) warmTotal); }
cylinderAreaDataServiceImpl.createWithModel(temp); temp.setCylinderNum(Long.valueOf(cylinderTotal));
}); temp.setParentRegionCode(parentCode);
} temp.setRegionCode(regionModel.getRegionCode() + "");
temp.setUnitNum(Long.valueOf(cylinderUnitTotal));
/** temp.setWarnNum((long) warmTotal);
* 按区域统计 cylinderAreaDataServiceImpl.createWithModel(temp);
*/ });
@Transactional(rollbackFor = Exception.class) }
@Scheduled(cron = "* * 2 * * ?")
public void addIntegrityData() { /**
System.out.println("====================数据完整性开始============================"); * 按区域统计
cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>()); */
countByRegion(regionModel -> { @Transactional(rollbackFor = Exception.class)
List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>().like(CylinderUnit::getRegionCode, regionModel.getRegionCode())); @Scheduled(cron = "* * 2 * * ?")
List<CylinderIntegrityDataDto> tempList = new LinkedList<>(); public void addIntegrityData() {
System.out.println("====================regioncode: "+regionModel.getRegionCode()+"============================"); System.out.println("====================数据完整性开始============================");
unitlist.forEach(t -> { cylinderIntegrityDataServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityData>());
System.out.println("====================appId: "+t.getAppId()+"============================"); countByRegion(regionModel -> {
CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto(); List<CylinderUnit> unitlist = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
String appId = t.getAppId(); .like(CylinderUnit::getRegionCode, regionModel.getRegionCode()));
Double totalIntegirty = 0d; List<CylinderIntegrityDataDto> tempList = new LinkedList<>();
// tz_cylinder_info System.out.println(
Double unitIntegirty = t.getIntegrity(); "====================regioncode: " + regionModel.getRegionCode() + "============================");
unitIntegirty=unitIntegirty==null?0d:unitIntegirty; unitlist.forEach(t -> {
//tz_cylinder_tags System.out.println("====================appId: " + t.getAppId() + "============================");
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId); CylinderIntegrityDataDto temp = new CylinderIntegrityDataDto();
tagIntegirty=tagIntegirty==null?0d:tagIntegirty; String appId = t.getAppId();
//tz_cylinder_info Double totalIntegirty = 0d;
Double infoIntegirty = this.queryIntegirtyByAppId(appId); // tz_cylinder_info
infoIntegirty=infoIntegirty==null?0d:infoIntegirty; Double unitIntegirty = t.getIntegrity();
// tz_cylinder_filling_record 30天内 unitIntegirty = unitIntegirty == null ? 0d : unitIntegirty;
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId); // tz_cylinder_tags
recordIntegirty=recordIntegirty==null?0d:recordIntegirty; Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(appId);
//tz_cylinder_filling 30天内ji tagIntegirty = tagIntegirty == null ? 0d : tagIntegirty;
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId); // tz_cylinder_info
fillingIntegirty=fillingIntegirty==null?0d:fillingIntegirty; Double infoIntegirty = this.queryIntegirtyByAppId(appId);
//tz_cylinder_filling_check 30天内 infoIntegirty = infoIntegirty == null ? 0d : infoIntegirty;
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId); // tz_cylinder_filling_record 30天内
checkIntegirty=checkIntegirty==null?0d:checkIntegirty; Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(appId);
totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty + checkIntegirty) / 6; recordIntegirty = recordIntegirty == null ? 0d : recordIntegirty;
BigDecimal bg = new BigDecimal(totalIntegirty); // tz_cylinder_filling 30天内ji
totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100; Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(appId);
temp.setAppId(appId); fillingIntegirty = fillingIntegirty == null ? 0d : fillingIntegirty;
temp.setRegionCode(String.valueOf(regionModel.getRegionCode())); // tz_cylinder_filling_check 30天内
temp.setIntegrity(totalIntegirty); Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(appId);
temp.setUnitName(t.getUnitName()); checkIntegirty = checkIntegirty == null ? 0d : checkIntegirty;
// 判断list 是否达到5个,如果达到则对比最后一个进行替换 totalIntegirty = (unitIntegirty + tagIntegirty + infoIntegirty + recordIntegirty + fillingIntegirty
if (tempList.size() == 5) { + checkIntegirty) / 6;
if (tempList.get(0).getIntegrity() < totalIntegirty) { BigDecimal bg = new BigDecimal(totalIntegirty);
tempList.set(0, temp); totalIntegirty = bg.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
} temp.setAppId(appId);
} else { temp.setRegionCode(String.valueOf(regionModel.getRegionCode()));
tempList.add(temp); temp.setIntegrity(totalIntegirty);
} temp.setUnitName(t.getUnitName());
tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity)); // 判断list 是否达到5个,如果达到则对比最后一个进行替换
}); if (tempList.size() == 5) {
tempList.forEach(t -> { if (tempList.get(0).getIntegrity() < totalIntegirty) {
System.out.println("====================unitName: "+t.getUnitName()+"============================"); tempList.set(0, temp);
t.setUpdateTime(new Date()); }
cylinderIntegrityDataServiceImpl.createWithModel(t); } else {
}); tempList.add(temp);
}); }
System.out.println("====================数据完整性结束============================"); tempList.sort(Comparator.comparing(CylinderIntegrityDataDto::getIntegrity));
} });
tempList.forEach(t -> {
/** System.out.println("====================unitName: " + t.getUnitName() + "============================");
* 企业总量按区域统计 t.setUpdateTime(new Date());
*/ cylinderIntegrityDataServiceImpl.createWithModel(t);
@Transactional(rollbackFor = Exception.class) });
@Scheduled(cron = "0 0 2 * * ?") });
public void getCylinderUnitInfo() { System.out.println("====================数据完整性结束============================");
cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>()); }
countByRegion(regionModel -> {
String regionCode = String.valueOf(regionModel.getRegionCode()); /**
Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode); * 企业总量按区域统计
Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode)); */
Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode)); @Transactional(rollbackFor = Exception.class)
double changeNum = lastUnitTotal - monthUnitLastInfo; @Scheduled(cron = "0 0 2 * * ?")
double percent = 0d; public void getCylinderUnitInfo() {
if (monthUnitLastInfo != 0) { cylinderUnitDataServiceImpl.remove(new LambdaQueryWrapper<CylinderUnitData>());
percent = changeNum / monthUnitLastInfo; countByRegion(regionModel -> {
BigDecimal bg = new BigDecimal(percent); String regionCode = String.valueOf(regionModel.getRegionCode());
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); Integer cylinderUnitTotal = cylinderUnitServiceImpl.getUnitTotalByRegionCode(regionCode);
} Double lastUnitTotal = Double.valueOf(cylinderUnitServiceImpl.getLastMonthUnitTotal(regionCode));
CylinderUnitDataDto temp = new CylinderUnitDataDto(); Double monthUnitLastInfo = Double.valueOf(cylinderUnitServiceImpl.getMonthBeforeLastUnitTotal(regionCode));
temp.setChangeSum((long) changeNum); double changeNum = cylinderUnitTotal - lastUnitTotal;
temp.setChangePercent((int) (percent * 100) + ""); double percent = 0d;
temp.setRegionCode(regionCode); if (monthUnitLastInfo != 0) {
temp.setTotalSum((long) cylinderUnitTotal); percent = (lastUnitTotal-monthUnitLastInfo) / monthUnitLastInfo;
temp.setUpdateTime(new Date()); BigDecimal bg = new BigDecimal(percent);
cylinderUnitDataServiceImpl.createWithModel(temp); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}); } else {
} percent = 0 ;
BigDecimal bg = new BigDecimal(percent);
/** percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
* 气瓶总量按区域统计 }
*/ CylinderUnitDataDto temp = new CylinderUnitDataDto();
@Transactional(rollbackFor = Exception.class) temp.setChangeSum((long) changeNum);
@Scheduled(cron = "0 0 2 * * ?") temp.setChangePercent((int) (percent * 100) + "");
public void getCylinderInfo() { temp.setRegionCode(regionCode);
cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>()); temp.setTotalSum((long) cylinderUnitTotal);
countByRegion(regionModel -> { temp.setUpdateTime(new Date());
CylinderInfoDataDto temp = new CylinderInfoDataDto(); cylinderUnitDataServiceImpl.createWithModel(temp);
String regionCode = String.valueOf(regionModel.getRegionCode()); });
Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);//当前总数 }
Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));//上月总数
Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));//上上月总数 /**
double percent = 0d; * 气瓶总量按区域统计
if (monthBeforeLastInfo != 0) { */
percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo; @Transactional(rollbackFor = Exception.class)
BigDecimal bg = new BigDecimal(percent); @Scheduled(cron = "0 0 2 * * ?")
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); public void getCylinderInfo() {
} cylinderInfoDataServiceImpl.remove(new LambdaQueryWrapper<>());
temp.setChangeSum((long) (lastInfoTotal - monthBeforeLastInfo)); countByRegion(regionModel -> {
temp.setChangePercent((int) (percent * 100) + ""); CylinderInfoDataDto temp = new CylinderInfoDataDto();
temp.setRegionCode(regionCode); String regionCode = String.valueOf(regionModel.getRegionCode());
temp.setTotalSum((long) cylinderTotal); Integer cylinderTotal = this.getInfoTotalByRegionCode(regionCode);// 当前总数
cylinderInfoDataServiceImpl.createWithModel(temp); Double InfoTotal = Double.valueOf(this.getMonthInfoTotal(regionCode));
}); Double lastInfoTotal = Double.valueOf(this.getLastMonthInfoTotal(regionCode));// 上月总数
} Double monthBeforeLastInfo = Double.valueOf(this.getMonthBeforeLastInfoTotal(regionCode));// 上上月总数
double percent = 0d;
/** if (monthBeforeLastInfo != 0) {
* 按单位统计 percent = (lastInfoTotal - monthBeforeLastInfo) / monthBeforeLastInfo;
*/ BigDecimal bg = new BigDecimal(percent);
@Transactional(rollbackFor = Exception.class) percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
@Scheduled(cron = "0 0 2 * * ?") }else
public void synUnitCylinderInfoData() { {
cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>()); percent = 0;
countByUnit(cylinderUnit -> { BigDecimal bg = new BigDecimal(percent);
CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto(); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
temp.setAppId(cylinderUnit.getAppId()); }
int count = this.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));//当前总数 temp.setChangeSum((long) (InfoTotal - lastInfoTotal));
temp.setTotalSum((long) count); temp.setChangePercent((int) (percent * 100) + "");
Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));//上月总数 temp.setRegionCode(regionCode);
Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));//上上月总数 temp.setTotalSum((long) cylinderTotal);
double percent = 0d; cylinderInfoDataServiceImpl.createWithModel(temp);
if (lastmonth != 0) { });
percent = (thismonth - lastmonth) / lastmonth; }
BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); /**
} * 按单位统计
temp.setChangeSum((long) (thismonth - lastmonth)); */
temp.setChangePercent((int) (percent * 100) + ""); @Transactional(rollbackFor = Exception.class)
cylinderInfoDataUnitServiceImpl.createWithModel(temp); @Scheduled(cron = "0 0 2 * * ?")
}); public void synUnitCylinderInfoData() {
} cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>());
countByUnit(cylinderUnit -> {
/** CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto();
* 充装量按单位和月统计 temp.setAppId(cylinderUnit.getAppId());
*/ int count = this
@Transactional(rollbackFor = Exception.class) .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));// 当前总数
@Scheduled(cron = "0 0 2 * * ?") temp.setTotalSum((long) count);
public void synUnitCylinderFillingData() { Double month = Double.valueOf(baseMapper.getMonthInfoTotalUnit(cylinderUnit.getAppId()));
cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>()); Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(cylinderUnit.getAppId()));// 上月总数
countByUnit(cylinderUnit -> { Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(cylinderUnit.getAppId()));// 上上月总数
// 按照月份 获取数据 取一年数据 double percent = 0d;
Calendar calendar = Calendar.getInstance(); if (lastmonth != 0) {
// 按月份获取充装量 percent = (thismonth - lastmonth) / lastmonth;
// 当月与上月 对比获取数据 BigDecimal bg = new BigDecimal(percent);
for (int i = 0; i < 12; i++) { percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
// 获取当月数据 }else
CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto(); {
String year = calendar.get(Calendar.YEAR) + ""; percent = 0;
int month = calendar.get(Calendar.MONTH) + 1; BigDecimal bg = new BigDecimal(percent);
String monthStr = month < 10 ? "0" + month : month + ""; percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
temp.setFillingYear(year); }
temp.setFillingMonth(monthStr); temp.setChangeSum((long) (month - thismonth));
//本月 temp.setChangePercent((int) (percent * 100) + "");
Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), calendar.getTime()); cylinderInfoDataUnitServiceImpl.createWithModel(temp);
temp.setTotalSum(thisMonth); });
calendar.add(Calendar.MONTH, -1); }
//上月
Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(), calendar.getTime()); /**
double percent = 0d; * 充装量按单位和月统计
if (lastMonth != 0) { */
percent = (thisMonth - lastMonth) / lastMonth; @Transactional(rollbackFor = Exception.class)
BigDecimal bg = new BigDecimal(percent); @Scheduled(cron = "0 0 2 * * ?")
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); public void synUnitCylinderFillingData() {
} cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>());
temp.setChangePercent((int) (percent * 100) + ""); countByUnit(cylinderUnit -> {
temp.setAppId(cylinderUnit.getAppId()); // 按照月份 获取数据 取一年数据
temp.setChangeSum(thisMonth - lastMonth); Calendar calendar = Calendar.getInstance();
cylinderFillingDataUnitServiceImpl.createWithModel(temp); // 按月份获取充装量
} // 当月与上月 对比获取数据
}); for (int i = 0; i < 12; i++) {
} // 获取当月数据
CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto();
/** String year = calendar.get(Calendar.YEAR) + "";
* 按单位统计 int month = calendar.get(Calendar.MONTH) + 1;
*/ String monthStr = month < 10 ? "0" + month : month + "";
@Transactional(rollbackFor = Exception.class) temp.setFillingYear(year);
@Scheduled(cron = "0 0 2 * * ?") temp.setFillingMonth(monthStr);
public void synUnitCylinderTagsData() { // 本月
cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>()); Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
countByUnit(cylinderUnit -> { calendar.getTime());
CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto(); temp.setTotalSum(thisMonth);
temp.setAppId(cylinderUnit.getAppId()); calendar.add(Calendar.MONTH, -1);
int cylinder = this.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId())); // 上月
int tags = cylinderTagsServiceImpl.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId())); Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(cylinderUnit.getAppId(),
double percent = 0d; calendar.getTime());
if (tags != 0) { double percent = 0d;
percent = (double) cylinder / (double) tags; if (lastMonth != 0) {
BigDecimal bg = new BigDecimal(percent); percent = (thisMonth - lastMonth) / lastMonth;
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); BigDecimal bg = new BigDecimal(percent);
} percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
temp.setCylinderSum((long) cylinder); }
temp.setTagsSum((long) tags); temp.setChangePercent((int) (percent * 100) + "");
temp.setTagPercent(percent * 100); temp.setAppId(cylinderUnit.getAppId());
cylinderTagsDataUnitServiceImpl.createWithModel(temp); temp.setChangeSum(thisMonth - lastMonth);
}); cylinderFillingDataUnitServiceImpl.createWithModel(temp);
} }
});
/** }
* 按单位统计
*/ /**
@Transactional(rollbackFor = Exception.class) * 按单位统计
@Scheduled(cron = "0 0 2 * * ?") */
public void synUnitIntegrityData() { @Transactional(rollbackFor = Exception.class)
cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>()); @Scheduled(cron = "0 0 2 * * ?")
countByUnit(cylinderUnit -> { public void synUnitCylinderTagsData() {
// 企业信息 cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>());
CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto(); countByUnit(cylinderUnit -> {
uninInfo.setAppId(cylinderUnit.getAppId()); CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto();
uninInfo.setDataType("企业信息"); temp.setAppId(cylinderUnit.getAppId());
Double unitIntegirty = cylinderUnit.getIntegrity(); int cylinder = this
uninInfo.setIntegrity(unitIntegirty); .count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));
cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo); int tags = cylinderTagsServiceImpl
// 气瓶基本信息 .count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId()));
CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto(); double percent = 0d;
cylinderInfo.setAppId(cylinderUnit.getAppId()); if (tags != 0) {
cylinderInfo.setDataType("气瓶基本信息"); percent = (double) cylinder / (double) tags;
Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId()); BigDecimal bg = new BigDecimal(percent);
cylinderInfo.setIntegrity(cylinderIntegirty); percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo); }
// 气瓶标签信息 temp.setCylinderSum((long) cylinder);
CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto(); temp.setTagsSum((long) tags);
cylinderTag.setAppId(cylinderUnit.getAppId()); temp.setTagPercent(percent * 100);
cylinderTag.setDataType("气瓶标签信息"); cylinderTagsDataUnitServiceImpl.createWithModel(temp);
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); });
cylinderTag.setIntegrity(tagIntegirty); }
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag);
// 气瓶检验信息 /**
CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto(); * 按单位统计
cylinderInspection.setAppId(cylinderUnit.getAppId()); */
cylinderInspection.setDataType("气瓶检验信息"); @Transactional(rollbackFor = Exception.class)
cylinderInspection.setIntegrity(0d); @Scheduled(cron = "0 0 2 * * ?")
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection); public void synUnitIntegrityData() {
// 充装前检查 cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>());
CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto(); countByUnit(cylinderUnit -> {
cylinderFilling.setAppId(cylinderUnit.getAppId()); // 企业信息
cylinderFilling.setDataType("充装前检查"); CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto();
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); uninInfo.setAppId(cylinderUnit.getAppId());
cylinderFilling.setIntegrity(fillingIntegirty); uninInfo.setDataType("企业信息");
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling); Double unitIntegirty = cylinderUnit.getIntegrity();
// 充装信息 uninInfo.setIntegrity(unitIntegirty);
CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto(); cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo);
cylinderRecord.setAppId(cylinderUnit.getAppId()); // 气瓶基本信息
cylinderRecord.setDataType("充装信息"); CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto();
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderInfo.setAppId(cylinderUnit.getAppId());
cylinderRecord.setIntegrity(recordIntegirty); cylinderInfo.setDataType("气瓶基本信息");
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord); Double cylinderIntegirty = this.queryIntegirtyByAppId(cylinderUnit.getAppId());
// 充装后复查 cylinderInfo.setIntegrity(cylinderIntegirty);
CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto(); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo);
cylinderCheck.setAppId(cylinderUnit.getAppId()); // 气瓶标签信息
cylinderCheck.setDataType("充装后复查"); CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto();
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId()); cylinderTag.setAppId(cylinderUnit.getAppId());
cylinderCheck.setIntegrity(checkIntegirty); cylinderTag.setDataType("气瓶标签信息");
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck); Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
}); cylinderTag.setIntegrity(tagIntegirty);
} cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag);
// 气瓶检验信息
/** CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto();
* 充装详情按单位统计 cylinderInspection.setAppId(cylinderUnit.getAppId());
*/ cylinderInspection.setDataType("气瓶检验信息");
@Transactional(rollbackFor = Exception.class) cylinderInspection.setIntegrity(0d);
@Scheduled(cron = "0 0 2 * * ?") cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection);
public void synUnitFillingCheckData() { // 充装前检查
cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>()); CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto();
countByUnit(cylinderUnit -> { cylinderFilling.setAppId(cylinderUnit.getAppId());
// 按照月份 获取数据 取一年数据 cylinderFilling.setDataType("充装前检查");
Calendar c = Calendar.getInstance(); Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
// 按月份获取充装量 cylinderFilling.setIntegrity(fillingIntegirty);
// 当月与上月 对比获取数据 cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling);
for (int i = 0; i < 12; i++) { // 充装信息
// 获取当月数据 CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto();
CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto(); cylinderRecord.setAppId(cylinderUnit.getAppId());
String year = c.get(Calendar.YEAR) + ""; cylinderRecord.setDataType("充装信息");
int month = c.get(Calendar.MONTH) + 1; Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
String monthStr = month < 10 ? "0" + month : month + ""; cylinderRecord.setIntegrity(recordIntegirty);
temp.setFillingMonth(monthStr); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord);
temp.setFillingYear(year); // 充装后复查
temp.setFillingDate(year + "-" + monthStr); CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto();
Integer countThisMonth = cylinderFillingRecordServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); cylinderCheck.setAppId(cylinderUnit.getAppId());
temp.setTotalSum((long) countThisMonth); cylinderCheck.setDataType("充装后复查");
// 获取本月数据 Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(cylinderUnit.getAppId());
Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); cylinderCheck.setIntegrity(checkIntegirty);
Integer fillingCheckCount = cylinderFillingCheckServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck);
// 充装前检查率:充装前检查次数/充装次数 });
double before = 0d; }
if (countThisMonth != 0) {
before = (double) (fillingCount) / (double) countThisMonth; /**
} * 充装详情按单位统计
temp.setFillingCount((long) fillingCount); */
temp.setFillingPercent(before * 100); @Transactional(rollbackFor = Exception.class)
// 充装后检查率:充装后检查次数/充装次数 @Scheduled(cron = "0 0 2 * * ?")
double after = 0d; public void synUnitFillingCheckData() {
if (countThisMonth != 0) { cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>());
after = (double) (fillingCheckCount) / (double) countThisMonth; countByUnit(cylinderUnit -> {
} // 按照月份 获取数据 取一年数据
temp.setFillingCheckCount((long) fillingCheckCount); Calendar c = Calendar.getInstance();
temp.setFillingCheckPercent(after * 100); // 按月份获取充装量
// 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数 // 当月与上月 对比获取数据
double passed = 0d; for (int i = 0; i < 12; i++) {
// 充装前检查合格次数 // 获取当月数据
Integer fillingPassedCount = cylinderFillingServiceImpl.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime()); CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto();
// 充装后检查合格次数 String year = c.get(Calendar.YEAR) + "";
Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime()); int month = c.get(Calendar.MONTH) + 1;
if (countThisMonth != 0) { String monthStr = month < 10 ? "0" + month : month + "";
passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount) / (double) (2 * countThisMonth); temp.setFillingMonth(monthStr);
} temp.setFillingYear(year);
temp.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount)); temp.setFillingDate(year + "-" + monthStr);
temp.setTotalSumDouble((long) 2 * countThisMonth); Integer countThisMonth = cylinderFillingRecordServiceImpl
temp.setFillingPassedPercent(passed * 100); .getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime());
temp.setAppId(cylinderUnit.getAppId()); temp.setTotalSum((long) countThisMonth);
c.add(Calendar.MONTH, -1); // 获取本月数据
cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp); Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(),
} c.getTime());
}); Integer fillingCheckCount = cylinderFillingCheckServiceImpl
} .getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime());
// 充装前检查率:充装前检查次数/充装次数
/** double before = 0d;
* 充装量、卸液量按单位统计 if (countThisMonth != 0) {
*/ before = (double) (fillingCount) / (double) countThisMonth;
@Transactional(rollbackFor = Exception.class) }
@Scheduled(cron = "0 0 2 * * ?") temp.setFillingCount((long) fillingCount);
public void synFillingUnloadUnitData() { temp.setFillingPercent(before * 100);
cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>()); // 充装后检查率:充装后检查次数/充装次数
countByUnit(cylinderUnit -> { double after = 0d;
Calendar now = Calendar.getInstance(); if (countThisMonth != 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); after = (double) (fillingCheckCount) / (double) countThisMonth;
for (int i = 0; i < 30; i++) { }
now.add(Calendar.DATE, -1); temp.setFillingCheckCount((long) fillingCheckCount);
CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto(); temp.setFillingCheckPercent(after * 100);
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(), now.getTime()); // 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数
Double unloadSum = 0d; double passed = 0d;
temp.setFillingSum(fillingSum); // 充装前检查合格次数
temp.setAppId(cylinderUnit.getAppId()); Integer fillingPassedCount = cylinderFillingServiceImpl
temp.setStatisDate(now.getTime()); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime());
temp.setStatisDateStr(sdf.format(now.getTime())); // 充装后检查合格次数
temp.setUnloadSum(unloadSum); Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl
cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp); .getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime());
} if (countThisMonth != 0) {
}); passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount)
} / (double) (2 * countThisMonth);
}
/** temp.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount));
* 根据月份统计 temp.setTotalSumDouble((long) 2 * countThisMonth);
*/ temp.setFillingPassedPercent(passed * 100);
private void countByMonth(IntConsumer consumer) { temp.setAppId(cylinderUnit.getAppId());
for (int i = 0; i < 12; i++) { c.add(Calendar.MONTH, -1);
consumer.accept(i); cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp);
} }
} });
}
/**
* 根据单位统计 /**
*/ * 充装量、卸液量按单位统计
private void countByUnit(Consumer<CylinderUnit> consumer) { */
List<CylinderUnit> units = cylinderUnitServiceImpl.list(); @Transactional(rollbackFor = Exception.class)
units.forEach(consumer); @Scheduled(cron = "0 0 2 * * ?")
} public void synFillingUnloadUnitData() {
cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>());
/** countByUnit(cylinderUnit -> {
* 根据区域统计 Calendar now = Calendar.getInstance();
*/ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private void countByRegion(Consumer<RegionModel> consumer) { for (int i = 0; i < 30; i++) {
List<RegionModel> regionList = new ArrayList<>(); now.add(Calendar.DATE, -1);
startPlatformTokenService.getToken(); CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto();
Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult(); Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(cylinderUnit.getAppId(),
regions.forEach(regionModel -> convertTreeToList(regionList, regionModel)); now.getTime());
regionList.forEach(consumer); Double unloadSum = 0d;
} temp.setFillingSum(fillingSum);
temp.setAppId(cylinderUnit.getAppId());
/** temp.setStatisDate(now.getTime());
* 将区域树转为区域List列表 temp.setStatisDateStr(sdf.format(now.getTime()));
*/ temp.setUnloadSum(unloadSum);
private void convertTreeToList(List<RegionModel> regionList, RegionModel region) { cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp);
regionList.add(region); }
if (region.getChildren() != null) { });
region.getChildren().forEach(c -> { }
convertTreeToList(regionList, c);
}); /**
} * 根据月份统计
} */
private void countByMonth(IntConsumer consumer) {
public Integer getOverDateStatisticsNumber(String earlyWarningLevel) { for (int i = 0; i < 12; i++) {
return this.baseMapper.countOverDateNumber(earlyWarningLevel); consumer.accept(i);
} }
}
public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel); /**
result.getRecords().forEach(r -> { * 根据单位统计
*/
private void countByUnit(Consumer<CylinderUnit> consumer) {
List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.forEach(consumer);
}
/**
* 根据区域统计
*/
private void countByRegion(Consumer<RegionModel> consumer) {
List<RegionModel> regionList = new ArrayList<>();
startPlatformTokenService.getToken();
Collection<RegionModel> regions = Systemctl.regionClient.queryForTree(null).getResult();
regions.forEach(regionModel -> convertTreeToList(regionList, regionModel));
regionList.forEach(consumer);
}
/**
* 将区域树转为区域List列表
*/
private void convertTreeToList(List<RegionModel> regionList, RegionModel region) {
regionList.add(region);
if (region.getChildren() != null) {
region.getChildren().forEach(c -> {
convertTreeToList(regionList, c);
});
}
}
public Integer getOverDateStatisticsNumber(String earlyWarningLevel) {
return this.baseMapper.countOverDateNumber(earlyWarningLevel);
}
public Page<CylinderInfoDto> earlyWarningLevelPageList(Page<CylinderInfoDto> page, String earlyWarningLevel) {
Page<CylinderInfoDto> result = this.baseMapper.queryPageListByEarlyWarningLevel(page, earlyWarningLevel);
result.getRecords().forEach(r -> {
// r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName()); // r.setEarlyWarningLevelName(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getName());
// r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus()); // r.setInspectionStatusDesc(EarlyWarningLevelEnum.getEumByLevel(earlyWarningLevel).getStatus());
}); });
return result; return result;
} }
public void calEarlyWarningLevel() { public void calEarlyWarningLevel() {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("气瓶超期预警时间调用规则开始"); log.debug("气瓶超期预警时间调用规则开始");
} }
// 1.批量分组大小 // 1.批量分组大小
int size = 500; int size = 500;
int total = this.count(); int total = this.count();
int groupNumber = total / size + 1; int groupNumber = total / size + 1;
// 2.批量小分组处理数据,调用规则 // 2.批量小分组处理数据,调用规则
for (int i = 0; i < groupNumber; i++) { for (int i = 0; i < groupNumber; i++) {
Page<CylinderInfo> page = new Page<>(); Page<CylinderInfo> page = new Page<>();
page.setCurrent(i); page.setCurrent(i);
page.setSize(size); page.setSize(size);
LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(CylinderInfo::getSequenceCode,CylinderInfo::getSequenceNbr).orderByDesc(CylinderInfo::getSequenceNbr); wrapper.select(CylinderInfo::getSequenceCode, CylinderInfo::getSequenceNbr)
IPage<CylinderInfo> result = this.page(page, wrapper); .orderByDesc(CylinderInfo::getSequenceNbr);
for (CylinderInfo r : result.getRecords()) { IPage<CylinderInfo> result = this.page(page, wrapper);
// 设置token for (CylinderInfo r : result.getRecords()) {
tzsAuthService.setRequestContext(); // 设置token
// 调用规则 tzsAuthService.setRequestContext();
this.touchRuleToCalLevel(r); // 调用规则
} this.touchRuleToCalLevel(r);
} }
if (log.isDebugEnabled()) { }
log.debug("气瓶超期预警时间调用规则完成"); if (log.isDebugEnabled()) {
} log.debug("气瓶超期预警时间调用规则完成");
} }
}
private void touchRuleToCalLevel(CylinderInfo r) {
Date now = new Date(); private void touchRuleToCalLevel(CylinderInfo r) {
String dateStr; Date now = new Date();
try { String dateStr;
dateStr = DateUtils.dateFormat(now,DateUtils.DATE_TIME_PATTERN); try {
} catch (ParseException e) { dateStr = DateUtils.dateFormat(now, DateUtils.DATE_TIME_PATTERN);
throw new RuntimeException("日期个时候失败"); } catch (ParseException e) {
} throw new RuntimeException("日期个时候失败");
//1.气瓶详情 }
CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode()); // 1.气瓶详情
try { CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode());
WarningMsgDto warningMsgDto = new WarningMsgDto(); try {
int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1; WarningMsgDto warningMsgDto = new WarningMsgDto();
warningMsgDto.setNum(String.valueOf(interval)); int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1;
warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum()); warningMsgDto.setNum(String.valueOf(interval));
warningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum());
// warningMsgDto.setUserType(cylinderInfoDto.getCustomType()); // warningMsgDto.setUserType(cylinderInfoDto.getCustomType());
// warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName()); // warningMsgDto.setUserPeople(cylinderInfoDto.getCustomName());
// warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone()); // warningMsgDto.setUserPeoplePhone(cylinderInfoDto.getContactPhone());
warningMsgDto.setCode(cylinderInfoDto.getSequenceCode()); warningMsgDto.setCode(cylinderInfoDto.getSequenceCode());
warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName()); warningMsgDto.setCompanyName(cylinderInfoDto.getUnitName());
warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone()); warningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone());
warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson()); warningMsgDto.setPeople(cylinderInfoDto.getUnitPerson());
warningMsgDto.setCurrentTime(dateStr); warningMsgDto.setCurrentTime(dateStr);
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto)); log.info("调用规则对象!+:{}", JSON.toJSONString(warningMsgDto));
} }
ruleTrigger.publish(warningMsgDto, packageId, null); ruleTrigger.publish(warningMsgDto, packageId, null);
} catch (Exception e) { } catch (Exception e) {
log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto),e); log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto), e);
} }
} }
public CylinderInfoDto getDetail(String sequenceCode) { public CylinderInfoDto getDetail(String sequenceCode) {
CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode); CylinderInfoDto dto = scheduleMapper.getCylDetail(sequenceCode);
dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel()) ? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus() : ""); dto.setInspectionStatusDesc(StringUtils.isNotEmpty(dto.getEarlyWarningLevel())
return dto; ? EarlyWarningLevelEnum.getEumByLevel(dto.getEarlyWarningLevel()).getStatus()
} : "");
return dto;
public List<MsgLog> getMsgList(String sequenceCode, String terminalType) { }
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsgLog::getRelationCode, sequenceCode); public List<MsgLog> getMsgList(String sequenceCode, String terminalType) {
wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType); LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(MsgLog::getSendTime); wrapper.eq(MsgLog::getRelationCode, sequenceCode);
return msgLogService.list(wrapper); wrapper.eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType);
} wrapper.orderByDesc(MsgLog::getSendTime);
return msgLogService.list(wrapper);
/** }
* 更新气瓶等级
* @param sequenceCode 唯一表设 /**
* @param level 等级 * 更新气瓶等级
* @return CylinderInfo *
*/ * @param sequenceCode 唯一表设
public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) { * @param level 等级
CylinderInfo cylinderInfo = this.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode)); * @return CylinderInfo
cylinderInfo.setEarlyWarningLevel(level); */
cylinderInfo.setEarlyWarningLevelCalDate(new Date()); public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) {
this.updateById(cylinderInfo); CylinderInfo cylinderInfo = this
return cylinderInfo; .getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode));
} cylinderInfo.setEarlyWarningLevel(level);
cylinderInfo.setEarlyWarningLevelCalDate(new Date());
public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) { this.updateById(cylinderInfo);
// 1.更新下次检验日期 return cylinderInfo;
List<CylinderInfo> cylinderInfos = new ArrayList<>(); }
cylinderInfoDtos.forEach(c -> {
CylinderInfo cylinderInfo = this.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode())); public Boolean nextInspectionDateUpdate(List<CylinderInfoDto> cylinderInfoDtos) {
// 1.更新下次检验日期
List<CylinderInfo> cylinderInfos = new ArrayList<>();
cylinderInfoDtos.forEach(c -> {
CylinderInfo cylinderInfo = this.getOne(
new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, c.getSequenceCode()));
// cylinderInfo.setNextInspectionDate(c.getNextInspectionDate()); // cylinderInfo.setNextInspectionDate(c.getNextInspectionDate());
cylinderInfos.add(cylinderInfo); cylinderInfos.add(cylinderInfo);
}); });
if (!cylinderInfos.isEmpty()) { if (!cylinderInfos.isEmpty()) {
this.updateBatchById(cylinderInfos); this.updateBatchById(cylinderInfos);
} }
// 2.循环调用规则 触发计算等级及发送消息 // 2.循环调用规则 触发计算等级及发送消息
cylinderInfos.forEach(this::touchRuleToCalLevel); cylinderInfos.forEach(this::touchRuleToCalLevel);
return Boolean.TRUE; return Boolean.TRUE;
} }
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInspectionDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInspection; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInspection;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInspectionMapper; import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInspectionMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderInspectionService; import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderInspectionService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInspectionDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/** /**
* 气瓶检验信息服务实现类 * 气瓶检验信息服务实现类
...@@ -16,18 +19,27 @@ import java.util.List; ...@@ -16,18 +19,27 @@ import java.util.List;
* @date 2022-03-04 * @date 2022-03-04
*/ */
@Service @Service
public class CylinderInspectionServiceImpl extends BaseService<CylinderInspectionDto, CylinderInspection,CylinderInspectionMapper> implements ICylinderInspectionService { public class CylinderInspectionServiceImpl
/** extends BaseService<CylinderInspectionDto, CylinderInspection, CylinderInspectionMapper>
* 分页查询 implements ICylinderInspectionService {
*/ /**
public Page<CylinderInspectionDto> queryForCylinderInspectionPage(Page<CylinderInspectionDto> page) { * 分页查询
return this.queryForPage(page, null, false); */
} public Page<CylinderInspectionDto> queryForCylinderInspectionPage(Page<CylinderInspectionDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<CylinderInspectionDto> queryForCylinderInspectionList() {
return this.queryForList("", false);
}
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<CylinderInspectionDto> queryForCylinderInspectionList() { public Page<CylinderInfo> queryOutOfDateCylinder(Page<CylinderInfo> pageBean,String appId) {
return this.queryForList("" , false); return this.baseMapper.queryOutOfDateCylinder(pageBean,appId);
} }
} }
\ No newline at end of file
...@@ -61,4 +61,9 @@ public class CylinderUnitServiceImpl extends BaseService<CylinderUnitDto, Cylind ...@@ -61,4 +61,9 @@ public class CylinderUnitServiceImpl extends BaseService<CylinderUnitDto, Cylind
// return baseMapper.getWarnNum(code); // return baseMapper.getWarnNum(code);
return 0; return 0;
} }
public int getWarnNumByAppId(String appId)
{
return baseMapper.getWarnNumByAppId(appId);
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.entity.PageParam; import com.yeejoin.amos.boot.module.tzs.api.entity.PageParam;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.*; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.*;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
...@@ -25,75 +28,97 @@ import java.util.Map; ...@@ -25,75 +28,97 @@ import java.util.Map;
* @date 2022-08-11 * @date 2022-08-11
*/ */
@Service @Service
public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, CylinderInfo, TzCylinderMapper> implements ITzCylinderService { public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, CylinderInfo, TzCylinderMapper>
implements ITzCylinderService {
@Autowired @Autowired
private TzCylinderMapper tzCylinderMapper; private TzCylinderMapper tzCylinderMapper;
@Override @Autowired
public IPage<TzCylinderInfoDto> getCylinderInfoDtoList(PageParam pageParam, TzCylinderInfoDto tzCylinderInfoDto, String key) { DataDictionaryServiceImpl iDataDictionaryService;
Page<TzCylinderInfoDto> page = new Page<>(pageParam.getCurrent(), pageParam.getSize());
System.out.println("key有值:"+key);
String superviseOrgCode = Privilege.companyClient.seleteOne(Long.valueOf(key)).getResult().getOrgCode();
return tzCylinderMapper.getTzCylinderInfoList(page, tzCylinderInfoDto, superviseOrgCode);
} @Override
public IPage<TzCylinderInfoDto> getCylinderInfoDtoList(PageParam pageParam, TzCylinderInfoDto tzCylinderInfoDto,
String key) {
Page<TzCylinderInfoDto> page = new Page<>(pageParam.getCurrent(), pageParam.getSize());
System.out.println("key有值:" + key);
String superviseOrgCode = Privilege.companyClient.seleteOne(Long.valueOf(key)).getResult().getOrgCode();
return tzCylinderMapper.getTzCylinderInfoList(page, tzCylinderInfoDto, superviseOrgCode);
@Override }
public TzCylinderTraceDto getCylinderTraceDto(String sequenceNbr) {
String orgCode = tzCylinderMapper.getSequencCode(sequenceNbr);
TzCylinderProduceDto tzCylinderProduceDto = tzCylinderMapper.getTzCylinderProduceDto(orgCode);
TzCylinderInfoDto tzCylinderInfoDto = tzCylinderMapper.getTzCylinderInfoDto(sequenceNbr);
TzCylinderTagsDto tzCylinderTagsDto = tzCylinderMapper.getTzCylinderTagsDto(orgCode);
List<TzCylinderInspectionDto> tzCylinderInspectionDtoList = tzCylinderMapper.getTzCylinderInspectionDto(orgCode);
List<TzCylinderFillingDto> tzCylinderFillingDtoList = tzCylinderMapper.getTzCylinderFillingDto(orgCode);
@Override
public TzCylinderTraceDto getCylinderTraceDto(String sequenceNbr) {
String orgCode = tzCylinderMapper.getSequencCode(sequenceNbr);
TzCylinderProduceDto tzCylinderProduceDto = tzCylinderMapper.getTzCylinderProduceDto(orgCode);
TzCylinderInfoDto tzCylinderInfoDto = tzCylinderMapper.getTzCylinderInfoDto(sequenceNbr);
DataDictionary data1 = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
.eq(DataDictionary::getSequenceNbr, tzCylinderInfoDto.getCylinderVariety()));
tzCylinderInfoDto.setCylinderVariety(data1 != null ? data1.getName() : null);
DataDictionary data2 = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
.eq(DataDictionary::getCode, tzCylinderInfoDto.getFillingMedia())
.eq(DataDictionary::getType, "mediumType"));
tzCylinderInfoDto.setFillingMedia(data2 != null ? data2.getName() : null);
DataDictionary data3 = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
.eq(DataDictionary::getSequenceNbr, tzCylinderInfoDto.getCylinderStatus()));
tzCylinderInfoDto.setCylinderStatus(data3 != null ? data3.getName() : null);
TzCylinderTagsDto tzCylinderTagsDto = tzCylinderMapper.getTzCylinderTagsDto(orgCode);
List<TzCylinderInspectionDto> tzCylinderInspectionDtoList = tzCylinderMapper
.getTzCylinderInspectionDto(orgCode);
List<TzCylinderFillingDto> tzCylinderFillingDtoList = tzCylinderMapper.getTzCylinderFillingDto(orgCode);
/** /**
* 取气瓶追溯详情 充装前检查项 名称和结果列表 * 取气瓶追溯详情 充装前检查项 名称和结果列表
*/ */
List<TzCylinderCheckDto> tzCylinderCheckDtoList = tzCylinderMapper.getTzCylinderCheckItem(); List<TzCylinderCheckDto> tzCylinderCheckDtoList = tzCylinderMapper.getTzCylinderCheckItem();
Map<String,String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
for(TzCylinderCheckDto tzCylinderCheckDto : tzCylinderCheckDtoList){ for (TzCylinderCheckDto tzCylinderCheckDto : tzCylinderCheckDtoList) {
map.put(tzCylinderCheckDto.getItem(), tzCylinderCheckDto.getExplain()); map.put(tzCylinderCheckDto.getItem(), tzCylinderCheckDto.getExplain());
} }
for(TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList){
List<TzCylinderCheckDto> tzCylinderCheckDtoListResult = new ArrayList<>();
TzCylinderBeforeCheckDto tzcylinderBeforeCheckDto = tzCylinderMapper.getTzCylinderBeforeCheck(tzCylinderFillingDto.getFillingBeforeId());
JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderBeforeCheckDto));
for( String str : obj.keySet())
{
String explain = map.get(str);
String value = String.valueOf(obj.get(str)) ;
TzCylinderCheckDto tzcylinderCheckDto = new TzCylinderCheckDto(str,explain,value);
tzCylinderCheckDtoListResult.add(tzcylinderCheckDto);
}
tzCylinderFillingDto.setTzCylinderCheckDtoList(tzCylinderCheckDtoListResult);
}
/** for (TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList) {
* 取气瓶追溯详情 充装后检查项 名称和结果列表 List<TzCylinderCheckDto> tzCylinderCheckDtoListResult = new ArrayList<>();
*/ TzCylinderBeforeCheckDto tzcylinderBeforeCheckDto = tzCylinderMapper
List<TzCylinderCheckDto> tzCylinderAfterCheckDtoList = tzCylinderMapper.getTzCylinderAfterCheckItem(); .getTzCylinderBeforeCheck(tzCylinderFillingDto.getFillingBeforeId());
Map<String,String> afterMap = new HashMap<>(); JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderBeforeCheckDto));
for(TzCylinderCheckDto tzCylinderCheckDto : tzCylinderAfterCheckDtoList){ for (String str : obj.keySet()) {
afterMap.put(tzCylinderCheckDto.getItem(), tzCylinderCheckDto.getExplain()); String explain = map.get(str);
} String value = String.valueOf(obj.get(str));
for(TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList){ DataDictionary data = iDataDictionaryService
List<TzCylinderCheckDto> tzCylinderAfterCheckDtoListResult = new ArrayList<>(); .getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getSequenceNbr, value));
TzCylinderAfterCheckDto tzcylinderAfterCheckDto = tzCylinderMapper.getTzCylinderAfterCheck(tzCylinderFillingDto.getFillingCheckId()); TzCylinderCheckDto tzcylinderCheckDto = new TzCylinderCheckDto(str, explain,
JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderAfterCheckDto)); data != null ? data.getCode() : null);
for( String str : obj.keySet()) tzCylinderCheckDtoListResult.add(tzcylinderCheckDto);
{ }
String explain = afterMap.get(str); tzCylinderFillingDto.setTzCylinderCheckDtoList(tzCylinderCheckDtoListResult);
String value = String.valueOf(obj.get(str)) ; }
TzCylinderCheckDto tzcylinderCheckDto = new TzCylinderCheckDto(str,explain,value);
tzCylinderAfterCheckDtoListResult.add(tzcylinderCheckDto);
}
tzCylinderFillingDto.setTzCylinderAfterCheckDtoList(tzCylinderAfterCheckDtoListResult);
}
/**
* 取气瓶追溯详情 充装后检查项 名称和结果列表
*/
List<TzCylinderCheckDto> tzCylinderAfterCheckDtoList = tzCylinderMapper.getTzCylinderAfterCheckItem();
Map<String, String> afterMap = new HashMap<>();
for (TzCylinderCheckDto tzCylinderCheckDto : tzCylinderAfterCheckDtoList) {
afterMap.put(tzCylinderCheckDto.getItem(), tzCylinderCheckDto.getExplain());
}
for (TzCylinderFillingDto tzCylinderFillingDto : tzCylinderFillingDtoList) {
List<TzCylinderCheckDto> tzCylinderAfterCheckDtoListResult = new ArrayList<>();
TzCylinderAfterCheckDto tzcylinderAfterCheckDto = tzCylinderMapper
.getTzCylinderAfterCheck(tzCylinderFillingDto.getFillingCheckId());
JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(tzcylinderAfterCheckDto));
for (String str : obj.keySet()) {
String explain = afterMap.get(str);
String value = String.valueOf(obj.get(str));
DataDictionary data = iDataDictionaryService
.getOne(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getSequenceNbr, value));
TzCylinderCheckDto tzcylinderCheckDto = new TzCylinderCheckDto(str, explain,
data != null ? data.getCode() : null);
tzCylinderAfterCheckDtoListResult.add(tzcylinderCheckDto);
}
tzCylinderFillingDto.setTzCylinderAfterCheckDtoList(tzCylinderAfterCheckDtoListResult);
}
return new TzCylinderTraceDto(tzCylinderProduceDto,tzCylinderInfoDto,tzCylinderTagsDto,tzCylinderInspectionDtoList,tzCylinderFillingDtoList); return new TzCylinderTraceDto(tzCylinderProduceDto, tzCylinderInfoDto, tzCylinderTagsDto,
} tzCylinderInspectionDtoList, tzCylinderFillingDtoList);
}
} }
#DB properties: #DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\ spring.datasource.url=jdbc:mysql://36.46.151.113:23306/per_tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
&characterEncoding=utf8
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2020
##eureka properties: #eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/ eureka.instance.hostname= eureka
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address = true
management.endpoint.health.show-details=always eureka.client.serviceUrl.defaultZone =http://36.46.151.113:10001/eureka/
management.endpoints.web.exposure.include=* eureka.instance.ip-address = 172.16.3.133
eureka.instance.health-check-url=http://172.16.10.90:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.10.90:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.10.90:${server.port}${server.servlet.context-path}/swagger-ui.html
## ES properties: ## ES properties:
biz.elasticsearch.address=172.16.10.90 biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch spring.data.elasticsearch.cluster-name=docker-cluster
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300 spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200 spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic elasticsearch.username=elastic
elasticsearch.password= 123456 elasticsearch.password=123456
## unit(h) ## unit(h)
alertcall.es.synchrony.time=48 alertcall.es.synchrony.time=48
fileserver.domain=https://rpm.yeeamos.com:8888/
#redis properties: #redis properties:
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.10.90 spring.redis.host=36.46.151.113
spring.redis.port=6379 spring.redis.port=16379
spring.redis.password=yeejoin@2020 spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
...@@ -40,20 +35,67 @@ spring.redis.lettuce.pool.min-idle=0 ...@@ -40,20 +35,67 @@ spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
## emqx properties: ## emqx properties:
emqx.clean-session=true emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883 emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=admin emqx.user-name=super
emqx.password=public emqx.password=123456
emqx.keepAliveInterval=1000
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
#tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
#tzs.wechat.tempId.wx=ofBIZS8Bup9s0zKbrGa8BfhVhS18H_hyC_OYXuBN6hI
tzs.wechat.tempId.wx=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
#tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.tempId.ts=VWqgY-lXFt4dg2EL4pLjfDCBAU49Z0mRxVaQhAMMW8Q
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
tzs.cti.url=http://113.134.211.174:8000 mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
rule.definition.load=false mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
rule.definition.model-package=com.yeejoin.amos.boot.module.tzs.api.dto
rule.definition.default-agency=tzs
#rule.definition.localIp=172.16.3.34
mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
## \u9884\u8B66\u901A\u77E5\u6A21\u677Fid
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##\u7763\u67E5\u6574\u6539\u901A\u77E5
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## \u516C\u4F17\u53F7\u6D4B\u8BD5\u7528\u6237id\uFF08\u5E73\u53F0userId\uFF09
tzs.wechat.test.userId=3413513
fileserver.domain=https://rpm.yeeamos.com:8888/
org.filter.group.seq=1564150103147573249 org.filter.group.seq=1564150103147573249
elasticsearch.username= elastic duty.seats.role.ids=1585956200472674305,1585956257590706177
elasticsearch.password= Yeejoin@2020
\ No newline at end of file
spring.application.name=TZS spring.application.name=TZS-wj
server.servlet.context-path=/tzs server.servlet.context-path=/tzs
server.port=11000 server.port=11000
spring.profiles.active=dev spring.profiles.active=dev2
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<logger name="org.apache.activemq" level="INFO"/> <logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/> <logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/> <logger name="com.yeejoin" level="INFO"/>
<logger name="org.apache.http" level="ERROR"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="DEBUG"> <root level="DEBUG">
<!-- <appender-ref ref="FILE" /> --> <!-- <appender-ref ref="FILE" /> -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment